⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gx_video_render.cpp

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 CPP
字号:
/*////                  INTEL CORPORATION PROPRIETARY INFORMATION//     This software is supplied under the terms of a license agreement or//     nondisclosure agreement with Intel Corporation and may not be copied//     or disclosed except in accordance with the terms of that agreement.//       Copyright(c) 2003-2005 Intel Corporation. All Rights Reserved.//*/#include "gx_video_render.h"#if defined(UMC_ENABLE_GX_VIDEO_RENDER)#include "ippi.h"#include "umc_video_data.h"namespace UMC{GXVideoRenderParams::GXVideoRenderParams() :    m_hWnd(NULL),    m_ColorKey(0){} // GXVideoRenderParams::GXVideoRenderParams() :GXVideoRender::GXVideoRender() :    m_color_key(0),    m_hWnd(NULL){    m_Rect.bottom =    m_Rect.left =    m_Rect.right =    m_Rect.top = 0;    memset(&m_prop, 0, sizeof(m_prop));} // GXVideoRender::GXVideoRender() :GXVideoRender::~GXVideoRender(){    Close();} // GXVideoRender::~GXVideoRender()Status GXVideoRender::Init(MediaReceiverParams* pInit){    Status umcRes = UMC_OK;    GXVideoRenderParams *pParams = DynamicCast<GXVideoRenderParams>(pInit);    if (NULL == pParams)        umcRes = UMC_NULL_PTR;    if (UMC_OK == umcRes)        umcRes = MobileVideoRender::Init(pInit);    if (UMC_OK == umcRes)    {        m_hWnd = pParams->m_hWnd;        m_Rect = pParams->disp;        m_color_key = pParams->m_ColorKey;        assert(NULL != m_hWnd);        if (NULL == m_hWnd)            umcRes = UMC_NULL_PTR;    }    ::RECT rect;    if (UMC_OK == umcRes && !GetWindowRect( m_hWnd, &rect ))        umcRes = UMC_OPERATION_FAILED;    HBRUSH hBrush = NULL;    if (UMC_OK == umcRes)    {        hBrush = CreateSolidBrush(0);        if (NULL == hBrush)            umcRes = UMC_OPERATION_FAILED;    }    if (UMC_OK == umcRes && 0 == FillRect(GetDC(m_hWnd),&rect, hBrush))        umcRes = UMC_OPERATION_FAILED;    if (UMC_OK == umcRes && 0 == GXOpenDisplay(0,kfDirect565))        umcRes = UMC_FAILED_TO_ALLOCATE_BUFFER;    if (UMC_OK == umcRes)        m_prop = GXGetDisplayProperties();    return umcRes;} // Status GXVideoRender::Init(MediaReceiverParams* pInit)Status GXVideoRender::Close(){    Status umcRes = MobileVideoRender::Close();    m_color_key   = 0;    m_hWnd        = 0;    GXCloseDisplay();    return umcRes;} // Status GXVideoRender::Close()// Lock input bufferStatus GXVideoRender::LockInputBuffer(MediaData* pInData){    Status umcRes = UMC_OK;    VideoData* pVideoData = DynamicCast<VideoData>(pInData);    if (NULL == pVideoData)        umcRes = UMC_NULL_PTR;    //  Wait for the end od prev frame or Stop()    while(UMC_OK == umcRes &&          !m_bStopFlag &&          m_dfFrameTime != -1.0 &&          UMC_TIMEOUT == m_ReadySema.Wait(10));    if (UMC_OK == umcRes && (m_bStopFlag || m_dfFrameTime == -1.0))        umcRes = UMC_END_OF_STREAM;    if (UMC_OK == umcRes)    {        vm_byte* pbVideoMemory = static_cast<vm_byte *>(GXBeginDraw());        if (0 > m_prop.cbyPitch)        {            pbVideoMemory += (m_Rect.bottom - m_Rect.top) * m_prop.cbyPitch;        }        else if (64 <= m_prop.cbyPitch)        {            pbVideoMemory += m_Rect.top * m_prop.cbyPitch +                             m_Rect.left * (m_prop.cBPP >> 3);        }        else            assert(false);        pVideoData->SetDest(pbVideoMemory);        if (NULL != pbVideoMemory)            pVideoData->SetPitch(m_prop.cbyPitch);        else            pVideoData->SetPitch(0);    }    else    {        pVideoData->SetDest(NULL);        pVideoData->SetPitch(0);    }    return umcRes;} // Status GXVideoRender::LockInputBuffer(MediaData* pInData)// Unlock input bufferStatus GXVideoRender::UnLockInputBuffer(MediaData *pInData,                                        Status StreamStatus){    Status umcRes = UMC_OK;    VideoData* pVideoData = DynamicCast<VideoData> (pInData);    if (NULL == pVideoData)        umcRes = UMC_NULL_PTR;    if (UMC_OK == umcRes)    {        double dfEndTime;        pVideoData->GetTime(m_dfFrameTime, dfEndTime);        umcRes = m_DoneSema.Signal();    }    if (UMC_END_OF_STREAM == StreamStatus)        Stop();    return umcRes;} // Status GXVideoRender::UnLockInputBuffer(MediaData *pInDataStatus GXVideoRender::RenderFrame(){    GXEndDraw();    return MobileVideoRender::RenderFrame();} // Status GXVideoRender::RenderFrame()Status GXVideoRender::ShowLastFrame(){    GXEndDraw();    return MobileVideoRender::ShowLastFrame();} // Status GXVideoRender::ShowLastFrame()} // namespace UMC#endif // defined(UMC_ENABLE_GX_VIDEO_RENDER)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -