Parent Directory | Revision Log
Revision 1925 - (view) (download)
1 : | edgomez | 1384 | /***************************************************************************** |
2 : | * | ||
3 : | * XVID MPEG-4 VIDEO CODEC | ||
4 : | * - XviD Decoder part of the DShow Filter - | ||
5 : | * | ||
6 : | Isibaar | 1896 | * Copyright(C) 2002-2010 Peter Ross <pross@xvid.org> |
7 : | edgomez | 1384 | * |
8 : | * This program is free software ; you can redistribute it and/or modify | ||
9 : | * it under the terms of the GNU General Public License as published by | ||
10 : | * the Free Software Foundation ; either version 2 of the License, or | ||
11 : | * (at your option) any later version. | ||
12 : | * | ||
13 : | * This program is distributed in the hope that it will be useful, | ||
14 : | * but WITHOUT ANY WARRANTY ; without even the implied warranty of | ||
15 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 : | * GNU General Public License for more details. | ||
17 : | * | ||
18 : | * You should have received a copy of the GNU General Public License | ||
19 : | * along with this program ; if not, write to the Free Software | ||
20 : | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 : | * | ||
22 : | Isibaar | 1898 | * $Id: CXvidDecoder.h,v 1.9 2010-10-17 18:31:46 Isibaar Exp $ |
23 : | edgomez | 1384 | * |
24 : | ****************************************************************************/ | ||
25 : | |||
26 : | #ifndef _FILTER_H_ | ||
27 : | #define _FILTER_H_ | ||
28 : | |||
29 : | #include <xvid.h> | ||
30 : | #include "IXvidDecoder.h" | ||
31 : | |||
32 : | Isibaar | 1802 | #define XVID_NAME_L L"Xvid MPEG-4 Video Decoder" |
33 : | edgomez | 1384 | |
34 : | /* --- fourcc --- */ | ||
35 : | |||
36 : | #define FOURCC_XVID mmioFOURCC('X','V','I','D') | ||
37 : | #define FOURCC_DIVX mmioFOURCC('D','I','V','X') | ||
38 : | #define FOURCC_DX50 mmioFOURCC('D','X','5','0') | ||
39 : | suxen_drol | 1647 | #define FOURCC_MP4V mmioFOURCC('M','P','4','V') |
40 : | #define FOURCC_mp4v mmioFOURCC('m','p','4','v') | ||
41 : | edgomez | 1384 | |
42 : | /* --- media uids --- */ | ||
43 : | |||
44 : | DEFINE_GUID(CLSID_XVID, mmioFOURCC('x','v','i','d'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
45 : | DEFINE_GUID(CLSID_XVID_UC, mmioFOURCC('X','V','I','D'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
46 : | DEFINE_GUID(CLSID_DIVX, mmioFOURCC('d','i','v','x'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
47 : | DEFINE_GUID(CLSID_DIVX_UC, mmioFOURCC('D','I','V','X'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
48 : | DEFINE_GUID(CLSID_DX50, mmioFOURCC('d','x','5','0'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
49 : | DEFINE_GUID(CLSID_DX50_UC, mmioFOURCC('D','X','5','0'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
50 : | DEFINE_GUID(CLSID_MP4V, mmioFOURCC('m','p','4','v'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
51 : | suxen_drol | 1647 | DEFINE_GUID(CLSID_MP4V_UC, mmioFOURCC('M','P','4','V'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); |
52 : | edgomez | 1384 | |
53 : | |||
54 : | /* MEDIATYPE_IYUV is not always defined in the directx headers */ | ||
55 : | DEFINE_GUID(CLSID_MEDIASUBTYPE_IYUV, 0x56555949, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
56 : | |||
57 : | |||
58 : | Isibaar | 1898 | class CXvidDecoder : |
59 : | public CVideoTransformFilter, | ||
60 : | public IXvidDecoder, | ||
61 : | public ISpecifyPropertyPages | ||
62 : | #if defined(XVID_USE_MFT) | ||
63 : | ,public IMFTransform | ||
64 : | #endif | ||
65 : | edgomez | 1384 | { |
66 : | |||
67 : | public : | ||
68 : | |||
69 : | static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr); | ||
70 : | STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); | ||
71 : | DECLARE_IUNKNOWN; | ||
72 : | |||
73 : | CXvidDecoder(LPUNKNOWN punk, HRESULT *phr); | ||
74 : | ~CXvidDecoder(); | ||
75 : | |||
76 : | Isibaar | 1896 | HRESULT CompleteConnect(PIN_DIRECTION direction, IPin *pReceivePin); |
77 : | HRESULT BreakConnect(PIN_DIRECTION dir); | ||
78 : | |||
79 : | edgomez | 1384 | HRESULT CheckInputType(const CMediaType * mtIn); |
80 : | HRESULT GetMediaType(int iPos, CMediaType * pmt); | ||
81 : | HRESULT SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt); | ||
82 : | |||
83 : | HRESULT CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut); | ||
84 : | HRESULT DecideBufferSize(IMemAllocator * pima, ALLOCATOR_PROPERTIES * pProperties); | ||
85 : | |||
86 : | HRESULT Transform(IMediaSample *pIn, IMediaSample *pOut); | ||
87 : | |||
88 : | STDMETHODIMP GetPages(CAUUID * pPages); | ||
89 : | STDMETHODIMP FreePages(CAUUID * pPages); | ||
90 : | |||
91 : | Isibaar | 1898 | /* IMFTransform */ |
92 : | #if defined(XVID_USE_MFT) | ||
93 : | STDMETHODIMP MFTGetStreamLimits(DWORD *pdwInputMinimum, DWORD *pdwInputMaximum, DWORD *pdwOutputMinimum, DWORD *pdwOutputMaximum); | ||
94 : | STDMETHODIMP MFTGetStreamCount(DWORD *pcInputStreams, DWORD *pcOutputStreams); | ||
95 : | STDMETHODIMP MFTGetStreamIDs(DWORD dwInputIDArraySize, DWORD *pdwInputIDs, DWORD dwOutputIDArraySize, DWORD *pdwOutputIDs); | ||
96 : | STDMETHODIMP MFTGetInputStreamInfo(DWORD dwInputStreamID, MFT_INPUT_STREAM_INFO *pStreamInfo); | ||
97 : | STDMETHODIMP MFTGetOutputStreamInfo(DWORD dwOutputStreamID, MFT_OUTPUT_STREAM_INFO *pStreamInfo); | ||
98 : | STDMETHODIMP GetAttributes(IMFAttributes** pAttributes); | ||
99 : | STDMETHODIMP GetInputStreamAttributes(DWORD dwInputStreamID, IMFAttributes **ppAttributes); | ||
100 : | STDMETHODIMP GetOutputStreamAttributes(DWORD dwOutputStreamID, IMFAttributes **ppAttributes); | ||
101 : | STDMETHODIMP MFTDeleteInputStream(DWORD dwStreamID); | ||
102 : | STDMETHODIMP MFTAddInputStreams(DWORD cStreams, DWORD *adwStreamIDs); | ||
103 : | STDMETHODIMP MFTGetInputAvailableType(DWORD dwInputStreamID, DWORD dwTypeIndex, IMFMediaType **ppType); | ||
104 : | STDMETHODIMP MFTGetOutputAvailableType(DWORD dwOutputStreamID, DWORD dwTypeIndex, IMFMediaType **ppType); | ||
105 : | STDMETHODIMP MFTSetInputType(DWORD dwInputStreamID, IMFMediaType *pType, DWORD dwFlags); | ||
106 : | STDMETHODIMP MFTSetOutputType(DWORD dwOutputStreamID, IMFMediaType *pType, DWORD dwFlags); | ||
107 : | STDMETHODIMP MFTGetInputCurrentType(DWORD dwInputStreamID, IMFMediaType **ppType); | ||
108 : | STDMETHODIMP MFTGetOutputCurrentType(DWORD dwOutputStreamID, IMFMediaType **ppType); | ||
109 : | STDMETHODIMP MFTGetInputStatus(DWORD dwInputStreamID, DWORD *pdwFlags); | ||
110 : | STDMETHODIMP MFTGetOutputStatus(DWORD *pdwFlags); | ||
111 : | STDMETHODIMP MFTSetOutputBounds(LONGLONG hnsLowerBound, LONGLONG hnsUpperBound); | ||
112 : | STDMETHODIMP MFTProcessEvent(DWORD dwInputStreamID, IMFMediaEvent *pEvent); | ||
113 : | STDMETHODIMP MFTProcessMessage(MFT_MESSAGE_TYPE eMessage, ULONG_PTR ulParam); | ||
114 : | |||
115 : | STDMETHODIMP MFTProcessInput(DWORD dwInputStreamID, IMFSample *pSample, DWORD dwFlags); | ||
116 : | STDMETHODIMP MFTProcessOutput(DWORD dwFlags, DWORD cOutputBufferCount, MFT_OUTPUT_DATA_BUFFER *pOutputSamples, DWORD *pdwStatus); | ||
117 : | #endif /* XVID_USE_MFT */ | ||
118 : | |||
119 : | edgomez | 1384 | private : |
120 : | |||
121 : | HRESULT ChangeColorspace(GUID subtype, GUID formattype, void * format); | ||
122 : | Isibaar | 1605 | HRESULT OpenLib(); |
123 : | syskin | 1428 | void CloseLib(); |
124 : | edgomez | 1384 | |
125 : | xvid_dec_create_t m_create; | ||
126 : | xvid_dec_frame_t m_frame; | ||
127 : | |||
128 : | HINSTANCE m_hdll; | ||
129 : | int (*xvid_global_func)(void *handle, int opt, void *param1, void *param2); | ||
130 : | int (*xvid_decore_func)(void *handle, int opt, void *param1, void *param2); | ||
131 : | int ar_x, ar_y; | ||
132 : | syskin | 1498 | bool forced_ar; |
133 : | edgomez | 1384 | |
134 : | int rgb_flip; | ||
135 : | Isibaar | 1898 | int out_stride; |
136 : | |||
137 : | /* mft stuff */ | ||
138 : | #if defined(XVID_USE_MFT) | ||
139 : | BOOL HasPendingOutput() const { return m_frame.output.plane[1] != NULL; } | ||
140 : | |||
141 : | HRESULT OnSetInputType(IMFMediaType *pmt); | ||
142 : | HRESULT OnCheckInputType(IMFMediaType *pmt); | ||
143 : | |||
144 : | HRESULT OnSetOutputType(IMFMediaType *pmt); | ||
145 : | |||
146 : | IMFMediaType *m_pInputType; | ||
147 : | IMFMediaType *m_pOutputType; | ||
148 : | |||
149 : | CRITICAL_SECTION m_mft_lock; | ||
150 : | REFERENCE_TIME m_timestamp; | ||
151 : | REFERENCE_TIME m_timelength; | ||
152 : | |||
153 : | int m_discont; | ||
154 : | |||
155 : | /* Used to construct or interpolate missing timestamps */ | ||
156 : | REFERENCE_TIME m_rtFrame; | ||
157 : | MFRatio m_frameRate; | ||
158 : | UINT64 m_duration; | ||
159 : | #endif | ||
160 : | |||
161 : | Isibaar | 1896 | #ifdef XVID_USE_TRAYICON |
162 : | HWND MSG_hwnd; /* message handler window */ | ||
163 : | edgomez | 1384 | }; |
164 : | Isibaar | 1896 | #define WM_ICONMESSAGE (WM_USER + 1) |
165 : | #else | ||
166 : | }; | ||
167 : | #endif | ||
168 : | edgomez | 1384 | |
169 : | syskin | 1498 | static const int PARS[][2] = { |
170 : | {1, 1}, | ||
171 : | {12, 11}, | ||
172 : | {10, 11}, | ||
173 : | {16, 11}, | ||
174 : | {40, 33}, | ||
175 : | {0, 0}, | ||
176 : | }; | ||
177 : | edgomez | 1384 | |
178 : | #endif /* _FILTER_H_ */ |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |