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

📄 umc_mpeg2_muxer.h

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

#ifndef __UMC_MPEG2_MUXER_H__
#define __UMC_MPEG2_MUXER_H__

#include "ippdefs.h"
#include "umc_muxer.h"

namespace UMC
{
    class MPEG2MuxerParams;
    class MPEG2ChunkWriter;
    class PATTableWriterParams;
    class PATTableWriter;
    class PMTTableWriterParams;
    class PMTTableWriter;

    enum
    {
        MPEG2MUX_ALIGN_I        = 0x01,
        MPEG2MUX_ALIGN_P        = 0x02,
        MPEG2MUX_ALIGN_B        = 0x04,
        MPEG2MUX_ALIGN_UNDEF    = 0x08,

        MPEG2MUX_ALIGN_IP       = MPEG2MUX_ALIGN_I | MPEG2MUX_ALIGN_P,
        MPEG2MUX_ALIGN_IPB      = MPEG2MUX_ALIGN_IP | MPEG2MUX_ALIGN_B,
        MPEG2MUX_ALIGN_ALL      = MPEG2MUX_ALIGN_IPB | MPEG2MUX_ALIGN_UNDEF
    };

    class MPEG2MuxerParams : public MuxerParams
    {
        DYNAMIC_CAST_DECL(MPEG2MuxerParams, MuxerParams)
    public:
        MPEG2MuxerParams()
        {
            m_uiAlignmentFlags = 0;
            m_dSystemTimeDelay = 0.3;
            m_uiChunkSizeLimit = 2048;
        }

        Ipp8u m_uiAlignmentFlags; // alignment for samples
        Ipp64f m_dSystemTimeDelay; // delay of system time relatively to tracks PTSs
        Ipp16u m_uiChunkSizeLimit; // max size of data chunk
    };

    class MPEG2Muxer : public Muxer
    {
        DYNAMIC_CAST_DECL(MPEG2Muxer, Muxer)
    public:
        MPEG2Muxer();
        ~MPEG2Muxer();
        Status Init(MuxerParams *lpInit);
        Status Close(void);

        Status PutEndOfStream(Ipp32s iTrack);
        Status UnlockBuffer(MediaData *pData, Ipp32s iTrack);
        Status Flush(void);

        virtual void DumpState(FILE*) {};

    protected:
        Status GetOutputTime(Ipp32s nStreamNumber, Ipp64f &dTime);

        // Writes chunks into stream
        // Flush mode means discarding empty buffers unless all buffers are empty
        Status WriteInterleavedFramesIntoStream(bool bFlushMode);

    protected:
        MPEG2MuxerParams *m_pMPEG2MuxerParams;
        vm_mutex m_synchro; // synchro object
        bool m_bQuit; // stop flag

        // rate variables
        Ipp32s m_uiTotalRate; // total bitrate of all elementary streams

        // system clock approximation
        Ipp64f m_dReferenceClock;
        Ipp64f m_dReferenceClockOfPrevSI;

        // PSI tables writers and params
        PATTableWriterParams *m_pPATTableWriterParams;
        PATTableWriter *m_pPATTableWriter;
        PMTTableWriterParams *m_pPMTTableWriterParams;
        PMTTableWriter **m_ppPMTTableWriter;

        Ipp32s max_video_buff;
        Ipp32s max_audio_buff;
#ifdef MUX_STATISTICS
        Ipp32s max_video_size;
        Ipp32s max_audio_size;
        Ipp32s total_video_size;
        Ipp32s total_audio_size;
        Ipp32s num_video_frames;
        Ipp32s num_audio_frames;
#endif
    };

}; // end namespace UMC

#endif // __UMC_MPEG2_MUXER_H__

⌨️ 快捷键说明

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