--- trunk/xvidcore/dshow/src/CXvidDecoder.h 2004/04/14 03:25:41 1428 +++ trunk/xvidcore/dshow/src/CXvidDecoder.h 2010/10/17 18:31:52 1898 @@ -3,7 +3,7 @@ * XVID MPEG-4 VIDEO CODEC * - XviD Decoder part of the DShow Filter - * - * Copyright(C) 2002-2003 Peter Ross + * Copyright(C) 2002-2010 Peter Ross * * This program is free software ; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: CXvidDecoder.h,v 1.3 2004-04-14 03:25:41 syskin Exp $ + * $Id: CXvidDecoder.h,v 1.9 2010-10-17 18:31:46 Isibaar Exp $ * ****************************************************************************/ @@ -29,15 +29,15 @@ #include #include "IXvidDecoder.h" - -#define XVID_NAME_L L"XviD MPEG-4 Video Decoder" +#define XVID_NAME_L L"Xvid MPEG-4 Video Decoder" /* --- fourcc --- */ #define FOURCC_XVID mmioFOURCC('X','V','I','D') #define FOURCC_DIVX mmioFOURCC('D','I','V','X') #define FOURCC_DX50 mmioFOURCC('D','X','5','0') -#define FOURCC_MP4V mmioFOURCC('m','p','4','v') +#define FOURCC_MP4V mmioFOURCC('M','P','4','V') +#define FOURCC_mp4v mmioFOURCC('m','p','4','v') /* --- media uids --- */ @@ -48,13 +48,20 @@ DEFINE_GUID(CLSID_DX50, mmioFOURCC('d','x','5','0'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); DEFINE_GUID(CLSID_DX50_UC, mmioFOURCC('D','X','5','0'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); DEFINE_GUID(CLSID_MP4V, mmioFOURCC('m','p','4','v'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); +DEFINE_GUID(CLSID_MP4V_UC, mmioFOURCC('M','P','4','V'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); /* MEDIATYPE_IYUV is not always defined in the directx headers */ DEFINE_GUID(CLSID_MEDIASUBTYPE_IYUV, 0x56555949, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); -class CXvidDecoder : public CVideoTransformFilter, public IXvidDecoder, public ISpecifyPropertyPages +class CXvidDecoder : + public CVideoTransformFilter, + public IXvidDecoder, + public ISpecifyPropertyPages +#if defined(XVID_USE_MFT) + ,public IMFTransform +#endif { public : @@ -66,6 +73,9 @@ CXvidDecoder(LPUNKNOWN punk, HRESULT *phr); ~CXvidDecoder(); + HRESULT CompleteConnect(PIN_DIRECTION direction, IPin *pReceivePin); + HRESULT BreakConnect(PIN_DIRECTION dir); + HRESULT CheckInputType(const CMediaType * mtIn); HRESULT GetMediaType(int iPos, CMediaType * pmt); HRESULT SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt); @@ -78,9 +88,38 @@ STDMETHODIMP GetPages(CAUUID * pPages); STDMETHODIMP FreePages(CAUUID * pPages); + /* IMFTransform */ +#if defined(XVID_USE_MFT) + STDMETHODIMP MFTGetStreamLimits(DWORD *pdwInputMinimum, DWORD *pdwInputMaximum, DWORD *pdwOutputMinimum, DWORD *pdwOutputMaximum); + STDMETHODIMP MFTGetStreamCount(DWORD *pcInputStreams, DWORD *pcOutputStreams); + STDMETHODIMP MFTGetStreamIDs(DWORD dwInputIDArraySize, DWORD *pdwInputIDs, DWORD dwOutputIDArraySize, DWORD *pdwOutputIDs); + STDMETHODIMP MFTGetInputStreamInfo(DWORD dwInputStreamID, MFT_INPUT_STREAM_INFO *pStreamInfo); + STDMETHODIMP MFTGetOutputStreamInfo(DWORD dwOutputStreamID, MFT_OUTPUT_STREAM_INFO *pStreamInfo); + STDMETHODIMP GetAttributes(IMFAttributes** pAttributes); + STDMETHODIMP GetInputStreamAttributes(DWORD dwInputStreamID, IMFAttributes **ppAttributes); + STDMETHODIMP GetOutputStreamAttributes(DWORD dwOutputStreamID, IMFAttributes **ppAttributes); + STDMETHODIMP MFTDeleteInputStream(DWORD dwStreamID); + STDMETHODIMP MFTAddInputStreams(DWORD cStreams, DWORD *adwStreamIDs); + STDMETHODIMP MFTGetInputAvailableType(DWORD dwInputStreamID, DWORD dwTypeIndex, IMFMediaType **ppType); + STDMETHODIMP MFTGetOutputAvailableType(DWORD dwOutputStreamID, DWORD dwTypeIndex, IMFMediaType **ppType); + STDMETHODIMP MFTSetInputType(DWORD dwInputStreamID, IMFMediaType *pType, DWORD dwFlags); + STDMETHODIMP MFTSetOutputType(DWORD dwOutputStreamID, IMFMediaType *pType, DWORD dwFlags); + STDMETHODIMP MFTGetInputCurrentType(DWORD dwInputStreamID, IMFMediaType **ppType); + STDMETHODIMP MFTGetOutputCurrentType(DWORD dwOutputStreamID, IMFMediaType **ppType); + STDMETHODIMP MFTGetInputStatus(DWORD dwInputStreamID, DWORD *pdwFlags); + STDMETHODIMP MFTGetOutputStatus(DWORD *pdwFlags); + STDMETHODIMP MFTSetOutputBounds(LONGLONG hnsLowerBound, LONGLONG hnsUpperBound); + STDMETHODIMP MFTProcessEvent(DWORD dwInputStreamID, IMFMediaEvent *pEvent); + STDMETHODIMP MFTProcessMessage(MFT_MESSAGE_TYPE eMessage, ULONG_PTR ulParam); + + STDMETHODIMP MFTProcessInput(DWORD dwInputStreamID, IMFSample *pSample, DWORD dwFlags); + STDMETHODIMP MFTProcessOutput(DWORD dwFlags, DWORD cOutputBufferCount, MFT_OUTPUT_DATA_BUFFER *pOutputSamples, DWORD *pdwStatus); +#endif /* XVID_USE_MFT */ + private : HRESULT ChangeColorspace(GUID subtype, GUID formattype, void * format); + HRESULT OpenLib(); void CloseLib(); xvid_dec_create_t m_create; @@ -90,9 +129,50 @@ int (*xvid_global_func)(void *handle, int opt, void *param1, void *param2); int (*xvid_decore_func)(void *handle, int opt, void *param1, void *param2); int ar_x, ar_y; + bool forced_ar; int rgb_flip; + int out_stride; + + /* mft stuff */ +#if defined(XVID_USE_MFT) + BOOL HasPendingOutput() const { return m_frame.output.plane[1] != NULL; } + + HRESULT OnSetInputType(IMFMediaType *pmt); + HRESULT OnCheckInputType(IMFMediaType *pmt); + + HRESULT OnSetOutputType(IMFMediaType *pmt); + + IMFMediaType *m_pInputType; + IMFMediaType *m_pOutputType; + + CRITICAL_SECTION m_mft_lock; + REFERENCE_TIME m_timestamp; + REFERENCE_TIME m_timelength; + + int m_discont; + + /* Used to construct or interpolate missing timestamps */ + REFERENCE_TIME m_rtFrame; + MFRatio m_frameRate; + UINT64 m_duration; +#endif + +#ifdef XVID_USE_TRAYICON + HWND MSG_hwnd; /* message handler window */ +}; +#define WM_ICONMESSAGE (WM_USER + 1) +#else }; +#endif +static const int PARS[][2] = { + {1, 1}, + {12, 11}, + {10, 11}, + {16, 11}, + {40, 33}, + {0, 0}, +}; #endif /* _FILTER_H_ */