diff options
Diffstat (limited to 'plugins/pluginWinMF/internals/mf_codec.h')
-rwxr-xr-x | plugins/pluginWinMF/internals/mf_codec.h | 163 |
1 files changed, 87 insertions, 76 deletions
diff --git a/plugins/pluginWinMF/internals/mf_codec.h b/plugins/pluginWinMF/internals/mf_codec.h index 51b06dc..d4f00c7 100755 --- a/plugins/pluginWinMF/internals/mf_codec.h +++ b/plugins/pluginWinMF/internals/mf_codec.h @@ -1,18 +1,18 @@ /* Copyright (C) 2013 Mamadou DIOP * Copyright (C) 2013 Doubango Telecom <http://www.doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. */ @@ -30,125 +30,136 @@ class MFSampleQueue; -typedef enum MFCodecId_e -{ - MFCodecId_H264Base, - MFCodecId_H264Main, - MFCodecId_AAC +typedef enum MFCodecId_e { + MFCodecId_H264Base, + MFCodecId_H264Main, + MFCodecId_AAC } MFCodecId_t; -typedef enum MFCodecType_e -{ - MFCodecType_Encoder, - MFCodecType_Decoder +typedef enum MFCodecType_e { + MFCodecType_Encoder, + MFCodecType_Decoder } MFCodecType_t; -typedef enum MFCodecMediaType_e -{ - MFCodecMediaType_Audio, - MFCodecMediaType_Video +typedef enum MFCodecMediaType_e { + MFCodecMediaType_Audio, + MFCodecMediaType_Video } MFCodecMediaType_t; -class MFCodec : IMFAsyncCallback +class MFCodec : IMFAsyncCallback { protected: - MFCodec(MFCodecId_t eId, MFCodecType_t eType, IMFTransform *pMFT = NULL); - virtual ~MFCodec(); - HRESULT ProcessInput(IMFSample* pSample); - HRESULT ProcessOutput(IMFSample **ppSample); + MFCodec(MFCodecId_t eId, MFCodecType_t eType, IMFTransform *pMFT = NULL); + virtual ~MFCodec(); + HRESULT ProcessInput(IMFSample* pSample); + HRESULT ProcessOutput(IMFSample **ppSample); public: - virtual bool IsValid(); - virtual bool IsReady(); - virtual HRESULT Process(const void* pcInputPtr, UINT32 nInputSize, IMFSample **ppSampleOut); - static enum tmedia_chroma_e GetUncompressedChroma(); - inline IMFTransform* GetMFT(){ return m_pMFT; } - inline MFCodecId_t GetId() { return m_eId; } - inline MFCodecType_t GetType() { return m_eType; } - inline void setBundled(BOOL bBundled) { m_bIsBundled = bBundled; } - - // IUnknown + virtual bool IsValid(); + virtual bool IsReady(); + virtual HRESULT Process(const void* pcInputPtr, UINT32 nInputSize, IMFSample **ppSampleOut); + static enum tmedia_chroma_e GetUncompressedChroma(); + inline IMFTransform* GetMFT() { + return m_pMFT; + } + inline MFCodecId_t GetId() { + return m_eId; + } + inline MFCodecType_t GetType() { + return m_eType; + } + inline void setBundled(BOOL bBundled) { + m_bIsBundled = bBundled; + } + + // IUnknown STDMETHODIMP QueryInterface(REFIID iid, void** ppv); STDMETHODIMP_(ULONG) AddRef(); STDMETHODIMP_(ULONG) Release(); - // IMFAsyncCallback - STDMETHODIMP GetParameters(DWORD *pdwFlags, DWORD *pdwQueue); - STDMETHODIMP Invoke(IMFAsyncResult *pAsyncResult); + // IMFAsyncCallback + STDMETHODIMP GetParameters(DWORD *pdwFlags, DWORD *pdwQueue); + STDMETHODIMP Invoke(IMFAsyncResult *pAsyncResult); private: - long m_nRefCount; + long m_nRefCount; protected: - MFCodecId_t m_eId; // Codec Id - MFCodecType_t m_eType; // Codec type. - MFCodecMediaType_t m_eMediaType; // Codec Media type. - DWORD m_dwInputID; // Input stream ID. + MFCodecId_t m_eId; // Codec Id + MFCodecType_t m_eType; // Codec type. + MFCodecMediaType_t m_eMediaType; // Codec Media type. + DWORD m_dwInputID; // Input stream ID. DWORD m_dwOutputID; // Output stream ID. - GUID m_guidCompressedFormat; // Compressed Media format (e.g. MFVideoFormat_H264) + GUID m_guidCompressedFormat; // Compressed Media format (e.g. MFVideoFormat_H264) IMFTransform *m_pMFT; // Pointer to the encoder MFT. - ICodecAPI *m_pCodecAPI; // Pointer to CodecAPI. + ICodecAPI *m_pCodecAPI; // Pointer to CodecAPI. IMFMediaType *m_pOutputType; // Output media type of the codec. - IMFMediaType *m_pInputType; // Input media type of the codec. + IMFMediaType *m_pInputType; // Input media type of the codec. - LONGLONG m_rtStart; + LONGLONG m_rtStart; UINT64 m_rtDuration; - IMFSample *m_pSampleIn; - IMFSample *m_pSampleOut; + IMFSample *m_pSampleIn; + IMFSample *m_pSampleOut; - MFSampleQueue *m_pSampleQueueAsyncInput; - BOOL m_bIsBundled; // Bundled with a producer or cosumer -> do not monitor events - BOOL m_bIsAsync; - IMFMediaEventGenerator *m_pEventGenerator; - BOOL m_bIsFirstFrame; - long m_nMETransformNeedInputCount, m_nMETransformHaveOutputCount; + MFSampleQueue *m_pSampleQueueAsyncInput; + BOOL m_bIsBundled; // Bundled with a producer or cosumer -> do not monitor events + BOOL m_bIsAsync; + IMFMediaEventGenerator *m_pEventGenerator; + BOOL m_bIsFirstFrame; + long m_nMETransformNeedInputCount, m_nMETransformHaveOutputCount; }; class MFCodecVideo : public MFCodec { - friend class MFCodec; + friend class MFCodec; protected: - MFCodecVideo(MFCodecId_t eId, MFCodecType_t eType, IMFTransform *pMFT = NULL); - virtual ~MFCodecVideo(); + MFCodecVideo(MFCodecId_t eId, MFCodecType_t eType, IMFTransform *pMFT = NULL); + virtual ~MFCodecVideo(); public: - virtual HRESULT Initialize( - UINT32 nFrameRate, - UINT32 nWidth, - UINT32 nHeight, - UINT32 nOutputBitRateInBps = 0 // Only for encoders - ); - virtual HRESULT SetGOPSize(UINT32 nFramesCount); - virtual HRESULT SetBitRate(UINT32 nBitRateInBps); - virtual HRESULT SetSliceMaxSizeInBytes(UINT32 nSliceMaxSizeInBytes); - virtual HRESULT RequestKeyFrame(); - - virtual HRESULT IsSetSliceMaxSizeInBytesSupported(BOOL &supported); - virtual inline UINT32 GetFrameRate() { return m_nFrameRate; } - virtual inline UINT32 GetWidth() { return m_nWidth; } - virtual inline UINT32 GetHeight() { return m_nHeight; } + virtual HRESULT Initialize( + UINT32 nFrameRate, + UINT32 nWidth, + UINT32 nHeight, + UINT32 nOutputBitRateInBps = 0 // Only for encoders + ); + virtual HRESULT SetGOPSize(UINT32 nFramesCount); + virtual HRESULT SetBitRate(UINT32 nBitRateInBps); + virtual HRESULT SetSliceMaxSizeInBytes(UINT32 nSliceMaxSizeInBytes); + virtual HRESULT RequestKeyFrame(); + + virtual HRESULT IsSetSliceMaxSizeInBytesSupported(BOOL &supported); + virtual inline UINT32 GetFrameRate() { + return m_nFrameRate; + } + virtual inline UINT32 GetWidth() { + return m_nWidth; + } + virtual inline UINT32 GetHeight() { + return m_nHeight; + } protected: - UINT32 m_nFrameRate; - UINT32 m_nWidth; - UINT32 m_nHeight; + UINT32 m_nFrameRate; + UINT32 m_nWidth; + UINT32 m_nHeight; }; class MFCodecVideoH264 : public MFCodecVideo { protected: - MFCodecVideoH264(MFCodecId_t eId, MFCodecType_t eType, IMFTransform *pMFT = NULL); + MFCodecVideoH264(MFCodecId_t eId, MFCodecType_t eType, IMFTransform *pMFT = NULL); public: - virtual ~MFCodecVideoH264(); - static MFCodecVideoH264* CreateCodecH264Base(MFCodecType_t eType, IMFTransform *pMFT = NULL); - static MFCodecVideoH264* CreateCodecH264Main(MFCodecType_t eType, IMFTransform *pMFT = NULL); + virtual ~MFCodecVideoH264(); + static MFCodecVideoH264* CreateCodecH264Base(MFCodecType_t eType, IMFTransform *pMFT = NULL); + static MFCodecVideoH264* CreateCodecH264Main(MFCodecType_t eType, IMFTransform *pMFT = NULL); protected: |