?? rmvdemux.h
字號:
/***************************************** Copyright ? 2001-2003 Sigma Designs, Inc. All Rights Reserved Proprietary and Confidential *****************************************//** @file rmvdemux.h @brief Simple Interface to an MPEG2 system demux. Typical use will be like this: RMvdemux * pvdemux = (RMvdemux *)RMCreateInstance (RM_CID_VDEMUXMOD); pvdemux->SetCallbackData (...); pvdemux->SetType (...); if (type == transport) { pvdemux->SetTransportChannel (...); } else if (type == dvd) { pvdemux->SetDvdAudioSubStreamId (); pvdemux->SetDvdSubPictureSubStreamId (); } do { pvdemux->Demux (...); // Here, your callback is called. } while (notEndOfStream); pvdemux->Reset (); pvdemux->Release (); @author Mathieu Lacage @date 2001-12-03*/#ifndef __RMVDEMUX_H__#define __RMVDEMUX_H__#include "../../rmcore/include/rmcore.h"#include "../../rmproperties/include/rmexternalproperties.h"/** Maximum number of streams supported by the demux */#define MAX_DEMUX_STREAM_TYPE 32#ifdef RMVDEMUX_LOCAL_RMOBJECT/* Don't inherit from RMobject to remove dependency of external definitions of * RMobject and RMdemuxBase from caribeean project and add a "C" interface for * RMvdemux */class RMdemuxBase{ public: RMdemuxBase(); virtual ~RMdemuxBase(); virtual RMuint32 Demux (RMuint8 *buffer, RMuint32 length) PURE_VIRTUAL; virtual void Reset (void) PURE_VIRTUAL; virtual void ResetState (void) PURE_VIRTUAL;};#include "../include/rmvdemuxapi.h"#else // no RMVDEMUX_LOCAL_RMOBJECT#include "../../rmmpeg2_framework/include/rmdemuxbase.h"typedef enum { RMVDEMUX_16BITS = 16, RMVDEMUX_20BITS = 20, RMVDEMUX_24BITS = 24} RMvdemuxQuantization;/// /** PESOffset is different from the offset pointed to by buffer across multiple RMvdemuxDemux() calls. @param RMvdemuxCallback @return */typedef void (*RMvdemuxCallback) (RMuint8 *buffer, RMuint32 length, RMuint64 PTS, RMbool isPtsValid, RMvdemuxDataType dataType, RMuint64 PESOffset, void *context);typedef void (*RMvdemuxAC3DTSCallback) (RMuint8 numberOfFrameHeaders, RMuint16 firstAccessUnitPointer, void *context);typedef void (*RMvdemuxLPCMCallback) (RMuint8 numberOfFrameHeaders, RMuint16 firstAccessUnitPointer, RMuint32 frequency, RMuint8 numberOfChannels, RMvdemuxQuantization quantizationWordLength, void *context);typedef void (*RMvdemuxAOBPCMCallback) (RMuint16 firstAccessUnitPointer, RMvdemuxQuantization quantizationGr1, RMvdemuxQuantization quantizationGr2, RMuint32 samplingFreqGr1, RMuint32 samplingFreqGr2, RMuint8 bitShift, RMuint8 channelAssign, void * context);typedef void (*RMvdemuxMLPCallback) (RMuint16 firstAccessUnitPointer, RMuint8 forwardAUSearchPointer, RMuint8 backwardAUSearchPointer, void *context);#endif // RMVDEMUX_LOCAL_RMOBJECTtypedef void (*RMvideotypeCallback) (RMDemuxStreamTypeEnum streamType, void* context);#ifdef RMVDEMUX_LOCAL_RMOBJECTclass RMvdemux#elseclass RMvdemux : public RMobject#endif{ public: RMvdemux (); virtual ~RMvdemux (); /** Must be called before any call to Demux (). @param callback @param context */ virtual void SetCallbackData (RMvdemuxCallback callback, void *context); /** Must be called to set the type of data to demux after SetCallbackData(...) and before any call to Demux(). It always resets the demux. @param type */ virtual void SetType (RMsystemType type); virtual RMsystemType GetType(void); /** Must be called to reset the demux' state, when changing the decoding bitstream. @param void */ virtual void Reset (); virtual void ResetState (void); /** Demuxes the data. @param buffer @param length */ virtual void Demux (RMuint8 *buffer, RMuint32 length); /** Must be called to set the channel to demux when demuxing transport data, after SetType () and before Demux (). */ virtual void SetTransportChannel (RMuint16 channelNumber); /** Must be called after SetType and before Demux to get to the user-selected audio or subpicture stream. These functions can be called anytime afterwards to change the audio and subpicture SubStreamIds. see VI 5-6, DVD Video spec, part 3, version 1.0 These functions take the low-order bits of the stream or substream ids. */ virtual void SetDvdSubPictureStreamNumber (RMuint8 subPictureSubStreamNumber); /** Must be called before calls to Demux if you want to get DVD-specific audio-related data. !!! This callback will be called before the usual data callback. However, more than one call to the data callback can be done if data is split across boundaries. */ virtual void SetAudioCallbacks (RMvdemuxAC3DTSCallback ac3Callback, RMvdemuxLPCMCallback lpcmCallback, RMvdemuxAOBPCMCallback aobPcmCallback, RMvdemuxMLPCallback mlpCallback); /** Must be called to set change the video type (MPEG2 or MPEG4) when demuxing transport data. */ virtual void SetVideoTypeCallbacks (RMvideotypeCallback videotypeCallback); virtual void EnableIndex(RMbool enable); virtual void GetVideoStream(RMuint16 *videoPid, RMuint8 *videoSubId); virtual void GetAudioStream(RMuint16 *audioPid, RMuint8 *audioSubId); virtual void SetVideoStream(RMuint16 videoPid, RMuint8 videoSubId); virtual void SetAudioStream(RMuint16 audioPid, RMuint8 audioSubId); virtual RMuint64 GetLastVideoPTS(void); virtual RMuint64 GetLastAudioPTS(void); virtual RMuint64 GetLastNPT_REFERENCE(void); virtual RMuint64 GetLastSTC_REFERENCE(void); /** Get the number of streams found by the demux */ virtual RMuint32 GetNumberOfStreams(); /** Get the stream type referenced by StreamNumber (inside RMDemuxStreamType) */ virtual RMstatus GetStreamType(RMdemuxStreamType *pdemuxStreamType); /** Remve all reference to previous detected streams */ virtual void ResetStreams(void); private: // vincent's demuxes. RMdemuxBase *m_demux; RMdemuxBase *m_audioPesDemux; RMdemuxBase *m_videoPesDemux; // user callback data. RMvdemuxCallback m_callback; void *m_context; RMvdemuxAC3DTSCallback m_ac3Callback; RMvdemuxLPCMCallback m_lpcmCallback; RMvideotypeCallback m_videotypeCallback; RMvdemuxAOBPCMCallback m_aobPcmCallback; RMvdemuxMLPCallback m_mlpCallback; // transport data. RMuint16 m_channelNumber; RMuint16 m_audioPid; RMuint16 m_audioSubId; // Should be 8 bit but we use 0xFFFF as invalid value RMuint16 m_videoPid; RMuint8 m_videoSubId; RMuint8 *m_pDescriptor; RMvdemuxDataType m_demuxType; // dvd data. RMuint8 m_subPictureStreamNumber; // stream type. RMsystemType m_systemType; // Enumerate the streams: RMcoreQueue m_demuxStreamTypeQueue; //Store the last PTS and PN RMuint64 m_lastAudioPTS; RMuint64 m_lastVideoPTS; RMuint64 m_lastNPT_REFERENCE; RMuint64 m_lastSTC_REFERENCE; RMcoreList m_demuxList; RMuint64 m_videoPesLength; RMbool m_noIndex; RMbool m_waitVideoPESstart; RMbool m_waitAudioPESstart; private: void DeleteDemux(void); // Stream List function RMbool NewStreamFound (RMuint16 streamPID, RMuint8 streamSubID, RMDemuxStreamTypeEnum demuxStreamTypeEnum); // Mpeg2 transport callbacks. static void PES2TCallback (RMuint8 *pData, RMuint32 Length, RMuint8 StreamId, RMuint8 SubStreamId, RMint64 Pts, RMint64 Dts, RMuint8 Flags, RMuint64 unused, void *Context); static void M2TCallback (RMuint8 *pData, RMuint32 Length, RMuint16 PID, RMuint8 Flags, RMuint64 TransportOffset, void *Context); static RMbool M2TPMTCallback (RMuint16 wPID, RMuint16 wType, void *Context); static RMuint16 M2TPATCallback (RMuint16 wPID, RMuint16 wProgramNumber, void *Context); static void M2TDESCRIPTORCallback (RMuint16 wProgramInfoLength, RMuint16 wPosition, RMuint8 bByte, void *Context); // mpeg1 callback. static void Mpeg1Callback (RMuint8 *pData, RMuint32 Length, RMuint8 PacketId, RMint64 Scr, RMint64 Pts, RMint64 Dts, RMuint8 Flags, RMuint64 PESOffset, void *Context); // Mpeg2 program callbacks. static void PES2PCallback (RMuint8 *pData, RMuint32 Length, RMuint8 StreamId, RMuint8 SubStreamId, RMint64 Pts, RMint64 Dts, RMuint8 Flags, RMuint64 PESOffset, void *Context); static void PSMCallback (RMuint8 streamType, RMuint8 streamId, void *Context); // DVD audio callbacks. static void AC3DTSCallback (RMuint8 numberOfFrameHeaders, RMuint16 firstAccessUnitPointer, void *context); static void LPCMCallback (RMuint8 numberOfFrameHeaders, RMuint16 firstAccessUnitPointer, RMuint32 frequency, RMuint8 numberOfChannels, RMuint8 quantizationWordLength, void *context); static void AOBPCMCallback (RMuint16 firstAccessUnitPointer, RMuint8 quantizationGr1, RMuint8 quantizationGr2, RMuint32 samplingFreqGr1, RMuint32 samplingFreqGr2, RMuint8 bitShift, RMuint8 channelAssign, void * context); static void MLPCallback (RMuint16 firstAccessUnitPointer, RMuint8 forwardAUSearchPointer, RMuint8 backwardAUSearchPointer, void *context);};#endif // __RMVDEMUX_H__
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -