Parent Directory | Revision Log
Revision 1962 - (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 | 1962 | * $Id: CXvidDecoder.h,v 1.9.2.2 2011-03-17 15:13:25 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 : | Isibaar | 1949 | #define FOURCC_xvid mmioFOURCC('x','v','i','d') |
38 : | edgomez | 1384 | #define FOURCC_DIVX mmioFOURCC('D','I','V','X') |
39 : | Isibaar | 1949 | #define FOURCC_divx mmioFOURCC('d','i','v','x') |
40 : | edgomez | 1384 | #define FOURCC_DX50 mmioFOURCC('D','X','5','0') |
41 : | Isibaar | 1949 | #define FOURCC_dx50 mmioFOURCC('d','x','5','0') |
42 : | suxen_drol | 1647 | #define FOURCC_MP4V mmioFOURCC('M','P','4','V') |
43 : | #define FOURCC_mp4v mmioFOURCC('m','p','4','v') | ||
44 : | Isibaar | 1949 | #define FOURCC_3IVX mmioFOURCC('3','I','V','X') |
45 : | #define FOURCC_3ivx mmioFOURCC('3','i','v','x') | ||
46 : | #define FOURCC_3IV0 mmioFOURCC('3','I','V','0') | ||
47 : | #define FOURCC_3iv0 mmioFOURCC('3','i','v','0') | ||
48 : | #define FOURCC_3IV1 mmioFOURCC('3','I','V','1') | ||
49 : | #define FOURCC_3iv1 mmioFOURCC('3','i','v','1') | ||
50 : | #define FOURCC_3IV2 mmioFOURCC('3','I','V','2') | ||
51 : | #define FOURCC_3iv2 mmioFOURCC('3','i','v','2') | ||
52 : | #define FOURCC_LMP4 mmioFOURCC('L','M','P','4') | ||
53 : | #define FOURCC_lmp4 mmioFOURCC('l','m','p','4') | ||
54 : | #define FOURCC_RMP4 mmioFOURCC('R','M','P','4') | ||
55 : | #define FOURCC_rmp4 mmioFOURCC('r','m','p','4') | ||
56 : | #define FOURCC_SMP4 mmioFOURCC('S','M','P','4') | ||
57 : | #define FOURCC_smp4 mmioFOURCC('s','m','p','4') | ||
58 : | #define FOURCC_HDX4 mmioFOURCC('H','D','X','4') | ||
59 : | #define FOURCC_hdx4 mmioFOURCC('h','d','x','4') | ||
60 : | edgomez | 1384 | |
61 : | /* --- media uids --- */ | ||
62 : | |||
63 : | DEFINE_GUID(CLSID_XVID, mmioFOURCC('x','v','i','d'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
64 : | DEFINE_GUID(CLSID_XVID_UC, mmioFOURCC('X','V','I','D'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
65 : | DEFINE_GUID(CLSID_DIVX, mmioFOURCC('d','i','v','x'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
66 : | DEFINE_GUID(CLSID_DIVX_UC, mmioFOURCC('D','I','V','X'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
67 : | DEFINE_GUID(CLSID_DX50, mmioFOURCC('d','x','5','0'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
68 : | DEFINE_GUID(CLSID_DX50_UC, mmioFOURCC('D','X','5','0'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
69 : | Isibaar | 1949 | DEFINE_GUID(CLSID_3IVX, mmioFOURCC('3','i','v','x'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); |
70 : | DEFINE_GUID(CLSID_3IVX_UC, mmioFOURCC('3','I','V','X'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
71 : | DEFINE_GUID(CLSID_3IV0, mmioFOURCC('3','i','v','0'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
72 : | DEFINE_GUID(CLSID_3IV0_UC, mmioFOURCC('3','I','V','0'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
73 : | DEFINE_GUID(CLSID_3IV1, mmioFOURCC('3','i','v','1'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
74 : | DEFINE_GUID(CLSID_3IV1_UC, mmioFOURCC('3','I','V','1'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
75 : | DEFINE_GUID(CLSID_3IV2, mmioFOURCC('3','i','v','2'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
76 : | DEFINE_GUID(CLSID_3IV2_UC, mmioFOURCC('3','I','V','2'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
77 : | DEFINE_GUID(CLSID_LMP4, mmioFOURCC('l','m','p','4'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
78 : | DEFINE_GUID(CLSID_LMP4_UC, mmioFOURCC('L','M','P','4'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
79 : | DEFINE_GUID(CLSID_RMP4, mmioFOURCC('r','m','p','4'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
80 : | DEFINE_GUID(CLSID_RMP4_UC, mmioFOURCC('R','M','P','4'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
81 : | DEFINE_GUID(CLSID_SMP4, mmioFOURCC('s','m','p','4'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
82 : | DEFINE_GUID(CLSID_SMP4_UC, mmioFOURCC('S','M','P','4'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
83 : | DEFINE_GUID(CLSID_HDX4, mmioFOURCC('h','d','x','4'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
84 : | DEFINE_GUID(CLSID_HDX4_UC, mmioFOURCC('H','D','X','4'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
85 : | edgomez | 1384 | DEFINE_GUID(CLSID_MP4V, mmioFOURCC('m','p','4','v'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); |
86 : | suxen_drol | 1647 | DEFINE_GUID(CLSID_MP4V_UC, mmioFOURCC('M','P','4','V'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); |
87 : | edgomez | 1384 | |
88 : | |||
89 : | /* MEDIATYPE_IYUV is not always defined in the directx headers */ | ||
90 : | DEFINE_GUID(CLSID_MEDIASUBTYPE_IYUV, 0x56555949, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); | ||
91 : | |||
92 : | |||
93 : | Isibaar | 1898 | class CXvidDecoder : |
94 : | public CVideoTransformFilter, | ||
95 : | public IXvidDecoder, | ||
96 : | public ISpecifyPropertyPages | ||
97 : | #if defined(XVID_USE_MFT) | ||
98 : | ,public IMFTransform | ||
99 : | #endif | ||
100 : | edgomez | 1384 | { |
101 : | |||
102 : | public : | ||
103 : | |||
104 : | static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr); | ||
105 : | STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); | ||
106 : | DECLARE_IUNKNOWN; | ||
107 : | |||
108 : | CXvidDecoder(LPUNKNOWN punk, HRESULT *phr); | ||
109 : | ~CXvidDecoder(); | ||
110 : | |||
111 : | Isibaar | 1896 | HRESULT CompleteConnect(PIN_DIRECTION direction, IPin *pReceivePin); |
112 : | HRESULT BreakConnect(PIN_DIRECTION dir); | ||
113 : | |||
114 : | edgomez | 1384 | HRESULT CheckInputType(const CMediaType * mtIn); |
115 : | HRESULT GetMediaType(int iPos, CMediaType * pmt); | ||
116 : | HRESULT SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt); | ||
117 : | |||
118 : | HRESULT CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut); | ||
119 : | HRESULT DecideBufferSize(IMemAllocator * pima, ALLOCATOR_PROPERTIES * pProperties); | ||
120 : | |||
121 : | HRESULT Transform(IMediaSample *pIn, IMediaSample *pOut); | ||
122 : | |||
123 : | STDMETHODIMP GetPages(CAUUID * pPages); | ||
124 : | STDMETHODIMP FreePages(CAUUID * pPages); | ||
125 : | |||
126 : | Isibaar | 1898 | /* IMFTransform */ |
127 : | #if defined(XVID_USE_MFT) | ||
128 : | STDMETHODIMP MFTGetStreamLimits(DWORD *pdwInputMinimum, DWORD *pdwInputMaximum, DWORD *pdwOutputMinimum, DWORD *pdwOutputMaximum); | ||
129 : | STDMETHODIMP MFTGetStreamCount(DWORD *pcInputStreams, DWORD *pcOutputStreams); | ||
130 : | STDMETHODIMP MFTGetStreamIDs(DWORD dwInputIDArraySize, DWORD *pdwInputIDs, DWORD dwOutputIDArraySize, DWORD *pdwOutputIDs); | ||
131 : | STDMETHODIMP MFTGetInputStreamInfo(DWORD dwInputStreamID, MFT_INPUT_STREAM_INFO *pStreamInfo); | ||
132 : | STDMETHODIMP MFTGetOutputStreamInfo(DWORD dwOutputStreamID, MFT_OUTPUT_STREAM_INFO *pStreamInfo); | ||
133 : | STDMETHODIMP GetAttributes(IMFAttributes** pAttributes); | ||
134 : | STDMETHODIMP GetInputStreamAttributes(DWORD dwInputStreamID, IMFAttributes **ppAttributes); | ||
135 : | STDMETHODIMP GetOutputStreamAttributes(DWORD dwOutputStreamID, IMFAttributes **ppAttributes); | ||
136 : | STDMETHODIMP MFTDeleteInputStream(DWORD dwStreamID); | ||
137 : | STDMETHODIMP MFTAddInputStreams(DWORD cStreams, DWORD *adwStreamIDs); | ||
138 : | STDMETHODIMP MFTGetInputAvailableType(DWORD dwInputStreamID, DWORD dwTypeIndex, IMFMediaType **ppType); | ||
139 : | STDMETHODIMP MFTGetOutputAvailableType(DWORD dwOutputStreamID, DWORD dwTypeIndex, IMFMediaType **ppType); | ||
140 : | STDMETHODIMP MFTSetInputType(DWORD dwInputStreamID, IMFMediaType *pType, DWORD dwFlags); | ||
141 : | STDMETHODIMP MFTSetOutputType(DWORD dwOutputStreamID, IMFMediaType *pType, DWORD dwFlags); | ||
142 : | STDMETHODIMP MFTGetInputCurrentType(DWORD dwInputStreamID, IMFMediaType **ppType); | ||
143 : | STDMETHODIMP MFTGetOutputCurrentType(DWORD dwOutputStreamID, IMFMediaType **ppType); | ||
144 : | STDMETHODIMP MFTGetInputStatus(DWORD dwInputStreamID, DWORD *pdwFlags); | ||
145 : | STDMETHODIMP MFTGetOutputStatus(DWORD *pdwFlags); | ||
146 : | STDMETHODIMP MFTSetOutputBounds(LONGLONG hnsLowerBound, LONGLONG hnsUpperBound); | ||
147 : | STDMETHODIMP MFTProcessEvent(DWORD dwInputStreamID, IMFMediaEvent *pEvent); | ||
148 : | STDMETHODIMP MFTProcessMessage(MFT_MESSAGE_TYPE eMessage, ULONG_PTR ulParam); | ||
149 : | |||
150 : | STDMETHODIMP MFTProcessInput(DWORD dwInputStreamID, IMFSample *pSample, DWORD dwFlags); | ||
151 : | STDMETHODIMP MFTProcessOutput(DWORD dwFlags, DWORD cOutputBufferCount, MFT_OUTPUT_DATA_BUFFER *pOutputSamples, DWORD *pdwStatus); | ||
152 : | #endif /* XVID_USE_MFT */ | ||
153 : | |||
154 : | edgomez | 1384 | private : |
155 : | |||
156 : | Isibaar | 1962 | HRESULT ChangeColorspace(GUID subtype, GUID formattype, void * format, int noflip); |
157 : | Isibaar | 1605 | HRESULT OpenLib(); |
158 : | syskin | 1428 | void CloseLib(); |
159 : | edgomez | 1384 | |
160 : | xvid_dec_create_t m_create; | ||
161 : | xvid_dec_frame_t m_frame; | ||
162 : | |||
163 : | HINSTANCE m_hdll; | ||
164 : | int (*xvid_global_func)(void *handle, int opt, void *param1, void *param2); | ||
165 : | int (*xvid_decore_func)(void *handle, int opt, void *param1, void *param2); | ||
166 : | int ar_x, ar_y; | ||
167 : | syskin | 1498 | bool forced_ar; |
168 : | edgomez | 1384 | |
169 : | int rgb_flip; | ||
170 : | Isibaar | 1898 | int out_stride; |
171 : | |||
172 : | /* mft stuff */ | ||
173 : | #if defined(XVID_USE_MFT) | ||
174 : | BOOL HasPendingOutput() const { return m_frame.output.plane[1] != NULL; } | ||
175 : | |||
176 : | HRESULT OnSetInputType(IMFMediaType *pmt); | ||
177 : | HRESULT OnCheckInputType(IMFMediaType *pmt); | ||
178 : | |||
179 : | HRESULT OnSetOutputType(IMFMediaType *pmt); | ||
180 : | |||
181 : | IMFMediaType *m_pInputType; | ||
182 : | IMFMediaType *m_pOutputType; | ||
183 : | |||
184 : | CRITICAL_SECTION m_mft_lock; | ||
185 : | REFERENCE_TIME m_timestamp; | ||
186 : | REFERENCE_TIME m_timelength; | ||
187 : | |||
188 : | int m_discont; | ||
189 : | |||
190 : | /* Used to construct or interpolate missing timestamps */ | ||
191 : | REFERENCE_TIME m_rtFrame; | ||
192 : | MFRatio m_frameRate; | ||
193 : | UINT64 m_duration; | ||
194 : | #endif | ||
195 : | |||
196 : | Isibaar | 1896 | #ifdef XVID_USE_TRAYICON |
197 : | HWND MSG_hwnd; /* message handler window */ | ||
198 : | edgomez | 1384 | }; |
199 : | Isibaar | 1896 | #define WM_ICONMESSAGE (WM_USER + 1) |
200 : | #else | ||
201 : | }; | ||
202 : | #endif | ||
203 : | edgomez | 1384 | |
204 : | syskin | 1498 | static const int PARS[][2] = { |
205 : | {1, 1}, | ||
206 : | {12, 11}, | ||
207 : | {10, 11}, | ||
208 : | {16, 11}, | ||
209 : | {40, 33}, | ||
210 : | {0, 0}, | ||
211 : | }; | ||
212 : | edgomez | 1384 | |
213 : | #endif /* _FILTER_H_ */ |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |