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

📄 umc_media_data.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 "umc_media_data.h"namespace UMC{MediaData::MediaData(size_t length){    m_pBufferPointer   = NULL;    m_pDataPointer     = NULL;    m_nBufferSize      = 0;    m_nDataSize        = 0;    m_pts_start        = -1;    m_pts_end          = 0;    m_bMemoryAllocated = 0;    if (length)    {        m_pBufferPointer = new vm_byte[length];        if (m_pBufferPointer)        {            m_pDataPointer     = m_pBufferPointer;            m_nBufferSize      = length;            m_bMemoryAllocated = 1;        }    }} // MediaData::MediaData(size_t length) :MediaData::~MediaData(){    Close();} // MediaData::~MediaData()Status MediaData::Close(void){    if (m_pBufferPointer && m_bMemoryAllocated)        delete[] m_pBufferPointer;    m_pBufferPointer   = NULL;    m_pDataPointer     = NULL;    m_nBufferSize      = 0;    m_nDataSize        = 0;    m_bMemoryAllocated = 0;    return UMC_OK;} // Status MediaData::Close(void)Status MediaData::SetDataSize(size_t bytes){    if (!m_pBufferPointer)        return UMC_NULL_PTR;    if (bytes > (m_nBufferSize - (m_pDataPointer - m_pBufferPointer)))        return UMC_OPERATION_FAILED;    m_nDataSize = bytes;    return UMC_OK;} // Status MediaData::SetDataSize(size_t bytes)// Set the pointer to a buffer allocated by the user// bytes define the size of buffer// size of data is equal to buffer size after this callStatus MediaData::SetBufferPointer(vm_byte *ptr, size_t size){    // release object    Close();    // set new value(s)    m_pBufferPointer  = ptr;    m_pDataPointer    = ptr;    m_nBufferSize     = size;    m_nDataSize       = size;    return UMC_OK;} // Status MediaData::SetBufferPointer(vm_byte *ptr, size_t size)Status MediaData::SetTime(double start, double end){    if (start < 0  && start != -1.0)        return UMC_OPERATION_FAILED;    m_pts_start = start;    m_pts_end = end;    return UMC_OK;} // Status MediaData::SetTime(double start, double end)Status MediaData::GetTime(double& start, double& end){    start = m_pts_start;    end = m_pts_end;    return UMC_OK;} // Status MediaData::GetTime(double& start, double& end)Status MediaData::MoveDataPointer(int bytes){    if (m_nDataSize >= bytes && bytes >= 0) {        m_pDataPointer   += bytes;        m_nDataSize      -= bytes;        return UMC_OK;    } else if (bytes < 0 && (vm_sizet)(m_pDataPointer - m_pBufferPointer) > bytes) {        m_pDataPointer   += bytes;        m_nDataSize      -= bytes;        return UMC_OK;    }    return UMC_OPERATION_FAILED;} // Status MediaData::MovePointer(size_t bytes)MediaData& MediaData::operator = (MediaData& src){    Close();    m_pts_start        = src.m_pts_start;    m_pts_end          = src.m_pts_end;    m_nBufferSize      = src.m_nBufferSize;    m_nDataSize        = src.m_nDataSize;    m_pDataPointer     = src.m_pDataPointer;    m_pBufferPointer   = src.m_pBufferPointer;    m_bMemoryAllocated = false;    return *this;} // MediaData& MediaData::operator = (MediaData& src)} // namespace UMC

⌨️ 快捷键说明

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