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

📄 ovl2_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.//*/#if defined(LINUX32) && defined(MT_WILSON)#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include "vm_debug.h"#include "ovl2_video_render.h"#include "umc_video_data.h"namespace UMC{// Initialize the render, return false if failed, call Close anywayStatus OVL2VideoRender::Init(MediaReceiverParams* pInit){    Status umcRes = UMC_OK;    VideoRenderParams *pParams = DynamicCast<VideoRenderParams>(pInit);    if (NULL == pParams)        umcRes = UMC_NULL_PTR;    if (UMC_OK == umcRes)        umcRes = MobileVideoRender::Init(pInit);    if (UMC_OK == umcRes)    {        m_iDevHandle = open("/dev/fb0", O_RDWR);        if (0 == m_iDevHandle)        {            vm_debug_msg(-1, "No Frame Buffer device was found or insufficient access rights\n");            umcRes = UMC_FAILED_TO_OPEN_DEVICE;        }    }    // Get fixed screen information    if (UMC_OK == umcRes &&        0 != ioctl(m_iDevHandle, FBIOGET_FSCREENINFO, &m_sFixInfo))    {        vm_debug_msg(-1, "Error reading fixed information.\n");        umcRes = UMC_FAILED_TO_INITIALIZE;    }    // Get variable screen information    if (UMC_OK == umcRes &&        0 != ioctl(m_iDevHandle, FBIOGET_VSCREENINFO, &m_sVarInfo))    {        vm_debug_msg(-1, "Error reading variable information.\n");        umcRes = UMC_FAILED_TO_INITIALIZE;    }    //  YUV overlay experiments!!!    if (NULL != m_iDevHandle)    {        close(m_iDevHandle);        m_iDevHandle = 0;    }    if (UMC_OK == umcRes)    {        m_iDevHandle = open("/dev/fb2", O_RDWR);        if (0 == m_iDevHandle)        {            vm_debug_msg(-1, "No Frame Buffer 2 device was found or insufficient access rights\n");            umcRes = UMC_FAILED_TO_OPEN_DEVICE;        }    }    if (UMC_OK == umcRes)    {        int iFormat = 3; // YUV422        int iXPos = 0;        int iYPos = 0;        m_sVarInfo.nonstd = (iFormat << 20) + (iYPos << 10) + (iXPos);        m_sVarInfo.bits_per_pixel = 16;        if (0 != ioctl(m_iDevHandle, FBIOPUT_VSCREENINFO, &m_sVarInfo))        {            vm_debug_msg(-1, "Error setting variable information for fb2.\n");            umcRes = UMC_FAILED_TO_INITIALIZE;        }    }    // Get variable screen information    if (UMC_OK == umcRes &&        0 != ioctl(m_iDevHandle, FBIOGET_VSCREENINFO, &m_sVarInfo))    {        vm_debug_msg(-1, "Error reading variable information.\n");        umcRes = UMC_FAILED_TO_INITIALIZE;    }    //  End of YUV overlay experiments!!!    if (UMC_OK == umcRes)    {        // Figure out the size of the screen in bytes        m_uiMapSize = m_sVarInfo.xres *                      m_sVarInfo.yres *                      m_sVarInfo.bits_per_pixel / 8;        // Map the device to memory        m_pbMap = (vm_byte*)mmap(0, m_uiMapSize,                                    PROT_READ | PROT_WRITE, MAP_SHARED,                                    m_iDevHandle, 0);        if (MAP_FAILED == m_pbMap)        {            vm_debug_msg(-1, "Error: failed to map framebuffer device to memory.\n");            umcRes = UMC_FAILED_TO_ALLOCATE_BUFFER;        }    }    if (UMC_OK != umcRes)        Close();    return umcRes;} // Status OVL2VideoRender::Init(MediaReceiverParams* pInit)Status OVL2VideoRender::LockInputBuffer(MediaData* pInData){    Status umcRes = UMC_OK;    VideoData* pVideoData = DynamicCast<VideoData>(pInData);    if (NULL == pVideoData)        umcRes = UMC_NULL_PTR;    if (UMC_OK == umcRes && NULL == m_pbMap)        umcRes = UMC_NOT_INITIALIZED;    if (UMC_OK == umcRes)    {        assert(0 != m_uiMapSize);        while (VM_TIMEOUT == m_ReadySema.Wait(1000))        {            if (m_bStopFlag || m_dfFrameTime == -1.0)            {                umcRes = UMC_END_OF_STREAM;                break;            }        }    }    if (UMC_OK == umcRes)    {        pVideoData->SetDest(m_pbMap + m_sVarInfo.red.offset,                            m_pbMap + m_sVarInfo.blue.offset,                            m_pbMap + m_sVarInfo.green.offset);        pVideoData->SetPitch(m_sVarInfo.red.length / m_sVarInfo.yres,                             m_sVarInfo.green.length / (m_sVarInfo.yres),                             m_sVarInfo.blue.length / (m_sVarInfo.yres));    }    else    {        pVideoData->SetDest(NULL);        pVideoData->SetPitch(0);    }    return umcRes;} // Status OVL2VideoRender::LockInputBuffer(MediaData* pInData)} // namespace UMC#endif // defined(LINUX32) && defined(MT_WILSON)

⌨️ 快捷键说明

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