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

📄 avsync.h

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 H
字号:
/* /////////////////////////////////////////////////////////////////////////////////                  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.////*/#ifndef __A_V_SYNC_H__#define __A_V_SYNC_H__#include "umc_structures.h"#include "umc_module_context.h"#include "umc_thread.h"#include "umc_event.h"#include "umc_mutex.h"#include "umc_data_reader.h"#include "umc_splitter.h"#include "umc_base_codec.h"#include "umc_audio_render.h"#include "umc_video_decoder.h"#include "umc_video_render.h"#include "umc_dual_thread_codec.h"#include "timed_color_converter.h"#include "umc_module_context.h"#include "umc_video_data.h"#include "vm_time.h"#include "umc_event.h"class AVSync{public:    AVSync();    class Stat {    public:        double      dfDuration;             // stream duration        double      dfFrameRate;            // frame rate        double      dfFrameTime;            // frame presentation time        double      dfRenderTime;           // total time spent for rendering        double      dfRenderRate;           // estimated rendering rate (including decoding)        vm_var32    uiFramesDecoded;        // number decoded video frames        vm_var32    uiFramesRendered;       // number rendered video frames        double      dfDecodeTime;           // total time spent for decoding video        double      dfConversionTime;       // total color conversion time        double      dfDecodeRate;           // estimated decoding rate        double      dfConversionRate;       // estimated color conversion rate        double      dfAudioDecodeTime;        double      dfAudioPlayTime;        double      dfAudioDecodeRate;        vm_var32    uiFrameNum;             // current frame number at rendering        vm_var32    uiSkippedNum;            // skipped frames        Stat() {   Reset();    }        void Reset()        {            dfFrameTime = 0.0;            dfRenderTime = 0.0;            dfRenderRate = 0.0;            uiFramesDecoded = 0;            dfDecodeTime = 0.0;            dfConversionTime = 0.0;            dfDecodeRate = 0.0;            dfAudioDecodeTime = 0.0;            dfAudioPlayTime = 0.0;            dfAudioDecodeRate = 0.0;            uiFrameNum = 0;            uiSkippedNum = 0;        }    };    struct ExternalInfo    {        ExternalInfo()        {            memset(this, 0, sizeof(ExternalInfo));        }        unsigned int         uiDataReaderFlags;        unsigned long        ulSplitterFlags;        unsigned long        ulVideoDecoderFlags;        unsigned long        ulAudioDecoderFlags;        unsigned long        ulVideoRenderFlags;        unsigned long        ulAudioRenderFlags;        UMC::DataReader  *   m_pDataReader;        UMC::Splitter    *   m_pSplitter;        UMC::AudioRender *   m_pAudioRender;        UMC::VideoDecoder*   m_pVideoDecoder;        UMC::VideoRender *   m_pVideoRender;        UMC::BaseCodec   *   m_pAudioDecoder;        UMC::DualThreadedCodec* m_pDSAudioCodec;    };   struct CommonCtl // control for all windows    {        vm_char                  file_list[UMC::MAXIMUM_PATH];   // a list of playback files, max 11        UMC::ColorFormat         cformat;               // YUV color format        unsigned long            ulReduceCoeff;         // Reduce coefficient        unsigned long            ulSplitterFlags;       // Splitter Flags        unsigned long    ulVideoDecoderFlags;   // Video Decoder Flags        unsigned long    ulAudioDecoderFlags;   // Audio Decoder Flags        unsigned long    ulVideoRenderFlags;    // Video Render Flags        unsigned long    ulAudioRenderFlags;    // Audio Render Flags        UMC::ModuleContext* pRenContext;        // Module context (HWND or some other)        UMC::ModuleContext* pReadContext;       // Module context (local or remote)        UMC::RECT       rectDisp;               // Display size        UMC::RECT       rectRange;              // Screen size        unsigned int    lInterpolation;         // Interpolation Flags        vm_var32        uiPrefVideoRender;      // Prefered video render        vm_var32        uiPrefAudioRender;      // Prefered audio render        vm_var32        uiPrefDataReader;       // Prefered data reader        unsigned int    lPostPcoc;              // Post Processing Flags        unsigned int    uiLimitVideoDecodeThreads;//up limit of number video                                                  //decoding threads         unsigned int    uiSelectedVideoID;//up limit of number video         unsigned int    uiSelectedAudioID;//up limit of number video        //allocate this one and pass any external info to AVSync        // external info can be external splitter, dataReader and etc        ExternalInfo *  pExternalInfo;        bool terminate;                         // terminate the program after playback        bool performance;                       // Performance statistic        bool repeat;                            // repeatedly playback        bool fullscr;                           // turn on full screen        bool stick;                             // stick to the window size        bool debug;                             // enable step & fast forward, sound disabled        bool step;                              // enable step & fast forward, sound disabled        bool bSync;                             //  Play synchronously even if no sound        CommonCtl();    };    // Initialize movie play back    virtual UMC::Status Init(CommonCtl& rControlParams);    // Finalize playback, wait until end if wait==true    void Close();    // Playback start    virtual UMC::Status Start();    // Stop playback    virtual UMC::Status Stop();    // Get playback statistics    virtual UMC::Status GetStat(Stat& rStat);    // Step playback    virtual UMC::Status Step();    // Resume playback    virtual UMC::Status Resume();    // Pause playback    virtual UMC::Status Pause();    // Pause playback    virtual bool IsPlaying();    void WaitForStop();    void SetFullScreen(UMC::ModuleContext& ModContext, bool bFoolScreen);    void HideSurface();    void ShowSurface();    //  Stream position control    vm_sizet GetStreamSize();    void GetPosition(double& rdfPos);    void SetPosition(double dfPos);    void ResizeDisplay(UMC::RECT& rDispRect, UMC::RECT& rRangeRect);    float SetVolume(float volume)    {        if ( m_pAudioRender )        {            return m_pAudioRender->SetVolume(volume);        }        return 0;    }    float GetVolume( void )    {        if(m_pAudioRender) return m_pAudioRender->GetVolume();        return 0;    }    UMC::SystemStreamType GetSystemStreamType()    {   return m_SplitterInfo.m_system_info.stream_type;   }    UMC::VideoStreamType GetVideoStreamType()    {   return m_SplitterInfo.m_video_info.stream_type; }    UMC::ColorFormat GetVideoFormatType()    {   return m_SplitterInfo.m_video_info.color_format; }    UMC::AudioStreamType GetAudioStreamType()    {   return m_SplitterInfo.m_audio_info  .stream_type; }    int GetDstFrmWidth()    {   return m_DecodedFrameSize.width;   }    int GetDstFrmHeight()    {   return m_DecodedFrameSize.height;  }    int GetSrcFrmWidth()    {   return m_SplitterInfo.m_video_info.clip_info.width; }    int GetSrcFrmHeight()    {   return m_SplitterInfo.m_video_info.clip_info.height;    }    double GetSrcFrmRate()    {   return m_SplitterInfo.m_video_info.framerate;    }    int GetSrcFrmBitRate()    {   return m_SplitterInfo.m_video_info.bitrate;    }    int GetAudioSmplFreq()    {   return m_SplitterInfo.m_audio_info.sample_frequency;    }    int GetAudioBitRate()    {   return m_SplitterInfo.m_audio_info.bitrate;    }    int GetAudioBitPerSmpl()    {   return m_SplitterInfo.m_audio_info.bitPerSample;    }    int GetAudioNChannel()    {   return m_SplitterInfo.m_audio_info.channels;    }    const UMC::SplitterInfo* GetProgramsInfo()    {   return &m_SplitterInfo;    }    UMC::Status SetTrickModeSpeed(CommonCtl& rControlParams,                            unsigned int trickFlag, double offset);protected:    UMC::Status GetFrameStub(UMC::MediaData* pInData,                             UMC::VideoData& rOutData,                             double& rdfDecTime);    static unsigned int SyncThreadProc(void* pvParam);    static unsigned int AudioThreadProc(void* pvParam);    static unsigned int VideoThreadProc(void* pvParam);    void SyncProc();    void AudioProc();    void VideoProc();    UMC::Event m_StepEvent;    UMC::Mutex m_MutAccess;    UMC::Thread m_SyncThread;    UMC::Thread m_AudioThread;    UMC::Thread m_VideoThread;    UMC::DataReader*     m_pDataReader;    UMC::Splitter*       m_pSplitter;    UMC::AudioRender*    m_pAudioRender;    UMC::VideoDecoder*   m_pVideoDecoder;    UMC::VideoRender*    m_pVideoRender;    //  Merge it to single class!!!    UMC::BaseCodec*      m_pAudioDecoder;    UMC::DualThreadedCodec* m_pDSAudioCodec;    UMC::MediaBuffer*    m_pMediaBuffer;    TimedColorConverter m_ColorConverter;    UMC::sClipInfo       m_DecodedFrameSize;    UMC::SplitterInfo    m_SplitterInfo;    volatile bool   m_bStopFlag;    volatile bool   m_bAudioPlaying;    volatile bool   m_bVideoPlaying;    volatile bool   m_bPaused;    bool            m_bSync;    vm_tick         m_lliFreq;    double          m_dfFrameRate;    Stat            m_Stat;    UMC::ColorFormat m_cFormat;    CommonCtl       m_ccParams;    UMC::Event      m_eventSyncPointSync;    UMC::Event      m_eventSyncPointVideo;    UMC::Event      m_eventSyncPointAudio;    UMC::Event      m_eventSyncPoint1Sync;    UMC::Event      m_eventSyncPoint1Video;    UMC::Event      m_eventSyncPoint1Audio;    bool            m_bStopSyncForReposition;};#endif // __A_V_SYNC_H__

⌨️ 快捷键说明

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