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

📄 umc_avs_splitter_thread.cpp

📁 audio-video-codecs.rar语音编解码器
💻 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) 2007 Intel Corporation. All Rights Reserved.
//
//
*/

#include "umc_defs.h"
#if defined(UMC_ENABLE_AVS_SPLITTER)

#include "umc_avs_splitter.h"
#include "umc_media_buffer.h"
#include "vm_time.h"

namespace UMC
{

enum
{
    TIME_TO_SLEEP               = 5
};

Ipp32u AVSSplitter::InternalThreadRoutine(void *pvParam)
{
    AVSSplitter *pParent = (AVSSplitter *) pvParam;
    Status umcRes;

    // check error(s)
    if (NULL == pParent)
        return 0x0a55bad;

    // main working cycle
    while (false == pParent->m_bQuit)
    {
        MediaData src;

        // lock the destination buffer
        umcRes = pParent->m_pVideoBuffer->LockInputBuffer(&src);

        // read the next video portion
        if (UMC_OK == umcRes)
        {
            Ipp32u nSize = (Ipp32u) src.GetBufferSize();

            // read data into buffer and unlock buffer
            umcRes = pParent->m_pDataReader->ReadData(src.GetBufferPointer(),
                                                      &nSize);
            src.SetDataSize(nSize);
            pParent->m_pVideoBuffer->UnLockInputBuffer(&src);
            // check end of stream
            if (UMC_OK != umcRes)
            {
                break;
            }
        }
        // the buffer is full, it is time to wait
        else if (UMC_ERR_NOT_ENOUGH_BUFFER == umcRes)
        {
            vm_time_sleep(TIME_TO_SLEEP);
        }
        // it is an error
        else
        {
            break;
        }
    }

    // set 'end of stream' state
    do
    {
        MediaData src;

        // lock the destination buffer
        umcRes = pParent->m_pVideoBuffer->LockInputBuffer(&src);
        if (UMC_OK == umcRes)
        {
            src.SetDataSize(0);
            pParent->m_pVideoBuffer->UnLockInputBuffer(&src, UMC_ERR_END_OF_STREAM);
            break;
        }

        // the buffer is full, it is time to wait
        vm_time_sleep(TIME_TO_SLEEP);

    } while (false == pParent->m_bQuit);

    return 0x0a55000;

} // Ipp32u AVSSplitter::InternalthreadRoutine(void *pvParam)

} // namespace UMC

#endif // #if defined(UMC_ENABLE_AVS_SPLITTER)

⌨️ 快捷键说明

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