1 /*****************************************************************************
\r
2 * dmo.h : DirectMedia Object codec module for vlc
\r
3 *****************************************************************************
\r
4 * Copyright (C) 2002, 2003 VideoLAN
\r
7 * Author: Gildas Bazin <gbazin@videolan.org>
\r
9 * This program is free software; you can redistribute it and/or modify
\r
10 * it under the terms of the GNU General Public License as published by
\r
11 * the Free Software Foundation; either version 2 of the License, or
\r
12 * (at your option) any later version.
\r
14 * This program is distributed in the hope that it will be useful,
\r
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 * GNU General Public License for more details.
\r
19 * You should have received a copy of the GNU General Public License
\r
20 * along with this program; if not, write to the Free Software
\r
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
\r
22 *****************************************************************************/
\r
24 static const GUID IID_IUnknown = {0x00000000, 0x0000, 0x0000, {0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46}};
\r
25 static const GUID IID_IClassFactory = {0x00000001, 0x0000, 0x0000, {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
\r
26 static const GUID IID_IMediaObject = {0xd8ad0f58, 0x5494, 0x4102, {0x97, 0xc5, 0xec, 0x79, 0x8e, 0x59, 0xbc, 0xf4}};
\r
27 static const GUID IID_IMediaBuffer = {0x59eff8b9, 0x938c, 0x4a26, {0x82, 0xf2, 0x95, 0xcb, 0x84, 0xcd, 0xc8, 0x37}};
\r
28 static const GUID MEDIATYPE_Video = {0x73646976, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
\r
29 static const GUID MEDIATYPE_Audio = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
\r
30 static const GUID MEDIASUBTYPE_PCM = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
\r
31 static const GUID MEDIASUBTYPE_VideoInfo = {0x05589f80, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}};
\r
32 static const GUID FORMAT_WaveFormatEx = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}};
\r
33 static const GUID GUID_NULL = {0x0000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
\r
34 static const GUID MEDIASUBTYPE_I420 = {0x30323449, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
\r
35 static const GUID MEDIASUBTYPE_YV12 = {0x32315659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
\r
37 #define IUnknown IUnknownHack
\r
38 #define IClassFactory IClassFactoryHack
\r
39 typedef struct _IUnknown IUnknown;
\r
40 typedef struct _IClassFactory IClassFactory;
\r
41 typedef struct _IEnumDMO IEnumDMO;
\r
42 typedef struct _IMediaBuffer IMediaBuffer;
\r
43 typedef struct _IMediaObject IMediaObject;
\r
46 #define STDCALL __stdcall
\r
49 #define DMO_INPUT_DATA_BUFFER_SYNCPOINT 1
\r
50 #define DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER 1
\r
51 #define DMO_E_NOTACCEPTING 0x80040204
\r
54 * DMO types definition
\r
57 #ifdef HAVE_ATTRIBUTE_PACKED
\r
58 __attribute__((__packed__))
\r
60 _DMO_PARTIAL_MEDIATYPE
\r
65 } DMO_PARTIAL_MEDIATYPE;
\r
68 #ifdef HAVE_ATTRIBUTE_PACKED
\r
69 __attribute__((__packed__))
\r
71 _DMO_OUTPUT_DATA_BUFFER
\r
73 IMediaBuffer *pBuffer;
\r
75 REFERENCE_TIME rtTimestamp;
\r
76 REFERENCE_TIME rtTimelength;
\r
78 } DMO_OUTPUT_DATA_BUFFER;
\r
81 #ifdef HAVE_ATTRIBUTE_PACKED
\r
82 __attribute__((__packed__))
\r
88 int bFixedSizeSamples;
\r
89 int bTemporalCompression;
\r
90 uint32_t lSampleSize;
\r
99 * IUnknown interface
\r
101 typedef struct IUnknown_vt
\r
103 /* IUnknown methods */
\r
104 long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,
\r
106 long (STDCALL *AddRef)(IUnknown *This);
\r
107 long (STDCALL *Release)(IUnknown *This);
\r
110 struct _IUnknown { IUnknown_vt* vt; };
\r
113 * IClassFactory interface
\r
115 typedef struct IClassFactory_vt
\r
117 long (STDCALL *QueryInterface)(IUnknown *This, const GUID* riid,
\r
119 long (STDCALL *AddRef)(IUnknown *This) ;
\r
120 long (STDCALL *Release)(IUnknown *This) ;
\r
121 long (STDCALL *CreateInstance)(IClassFactory *This, IUnknown *pUnkOuter,
\r
122 const GUID* riid, void** ppvObject);
\r
123 } IClassFactory_vt;
\r
125 struct _IClassFactory { IClassFactory_vt* vt; };
\r
128 * IEnumDMO interface
\r
130 typedef struct IEnumDMO_vt
\r
132 /* IUnknown methods */
\r
133 long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,
\r
135 long (STDCALL *AddRef)(IUnknown *This);
\r
136 long (STDCALL *Release)(IUnknown *This);
\r
138 /* IEnumDMO methods */
\r
139 long (STDCALL *Next)(IEnumDMO *This, uint32_t cItemsToFetch,
\r
140 const GUID *pCLSID, WCHAR **Names,
\r
141 uint32_t *pcItemsFetched);
\r
142 long (STDCALL *Skip)(IEnumDMO *This, uint32_t cItemsToSkip);
\r
143 long (STDCALL *Reset)(IEnumDMO *This);
\r
144 long (STDCALL *Clone)(IEnumDMO *This, IEnumDMO **ppEnum);
\r
147 struct _IEnumDMO { IEnumDMO_vt* vt; };
\r
150 * IMediaBuffer interface
\r
152 typedef struct IMediaBuffer_vt
\r
154 /* IUnknown methods */
\r
155 long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,
\r
157 long (STDCALL *AddRef)(IUnknown *This);
\r
158 long (STDCALL *Release)(IUnknown *This);
\r
160 long (STDCALL *SetLength)(IMediaBuffer* This, uint32_t cbLength);
\r
161 long (STDCALL *GetMaxLength)(IMediaBuffer* This, uint32_t *pcbMaxLength);
\r
162 long (STDCALL *GetBufferAndLength)(IMediaBuffer* This,
\r
163 char** ppBuffer, uint32_t* pcbLength);
\r
166 struct _IMediaBuffer { IMediaBuffer_vt* vt; };
\r
169 * IMediaObject interface
\r
171 typedef struct IMediaObject_vt
\r
173 /* IUnknown methods */
\r
174 long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,
\r
176 long (STDCALL *AddRef)(IUnknown *This);
\r
177 long (STDCALL *Release)(IUnknown *This);
\r
179 /* IEnumDMO methods */
\r
180 long (STDCALL *GetStreamCount)(IMediaObject *This,
\r
181 uint32_t *pcInputStreams,
\r
182 uint32_t *pcOutputStreams);
\r
183 long (STDCALL *GetInputStreamInfo)(IMediaObject *This,
\r
184 uint32_t dwInputStreamIndex,
\r
185 uint32_t *pdwFlags);
\r
186 long (STDCALL *GetOutputStreamInfo)(IMediaObject *This,
\r
187 uint32_t dwOutputStreamIndex,
\r
188 uint32_t *pdwFlags);
\r
189 long (STDCALL *GetInputType)(IMediaObject *This,
\r
190 uint32_t dwInputStreamIndex,
\r
191 uint32_t dwTypeIndex,
\r
192 DMO_MEDIA_TYPE *pmt);
\r
193 long (STDCALL *GetOutputType)(IMediaObject *This,
\r
194 uint32_t dwOutputStreamIndex,
\r
195 uint32_t dwTypeIndex,
\r
196 DMO_MEDIA_TYPE *pmt);
\r
197 long (STDCALL *SetInputType)(IMediaObject *This,
\r
198 uint32_t dwInputStreamIndex,
\r
199 const DMO_MEDIA_TYPE *pmt,
\r
201 long (STDCALL *SetOutputType)(IMediaObject *This,
\r
202 uint32_t dwOutputStreamIndex,
\r
203 const DMO_MEDIA_TYPE *pmt,
\r
205 long (STDCALL *GetInputCurrentType)(IMediaObject *This,
\r
206 uint32_t dwInputStreamIndex,
\r
207 DMO_MEDIA_TYPE *pmt);
\r
208 long (STDCALL *GetOutputCurrentType)(IMediaObject *This,
\r
209 uint32_t dwOutputStreamIndex,
\r
210 DMO_MEDIA_TYPE *pmt);
\r
211 long (STDCALL *GetInputSizeInfo)(IMediaObject *This,
\r
212 uint32_t dwInputStreamIndex,
\r
214 uint32_t *pcbMaxLookahead,
\r
215 uint32_t *pcbAlignment);
\r
216 long (STDCALL *GetOutputSizeInfo)(IMediaObject *This,
\r
217 uint32_t dwOutputStreamIndex,
\r
219 uint32_t *pcbAlignment);
\r
220 long (STDCALL *GetInputMaxLatency)(IMediaObject *This,
\r
221 uint32_t dwInputStreamIndex,
\r
222 REFERENCE_TIME *prtMaxLatency);
\r
223 long (STDCALL *SetInputMaxLatency)(IMediaObject *This,
\r
224 uint32_t dwInputStreamIndex,
\r
225 REFERENCE_TIME rtMaxLatency);
\r
226 long (STDCALL *Flush)(IMediaObject * This);
\r
227 long (STDCALL *Discontinuity)(IMediaObject *This,
\r
228 uint32_t dwInputStreamIndex);
\r
229 long (STDCALL *AllocateStreamingResources)(IMediaObject * This);
\r
230 long (STDCALL *FreeStreamingResources)(IMediaObject * This);
\r
231 long (STDCALL *GetInputStatus)(IMediaObject *This,
\r
232 uint32_t dwInputStreamIndex,
\r
233 uint32_t *dwFlags);
\r
234 long (STDCALL *ProcessInput)(IMediaObject *This,
\r
235 uint32_t dwInputStreamIndex,
\r
236 IMediaBuffer *pBuffer,
\r
238 REFERENCE_TIME rtTimestamp,
\r
239 REFERENCE_TIME rtTimelength);
\r
240 long (STDCALL *ProcessOutput)(IMediaObject *This,
\r
242 uint32_t cOutputBufferCount,
\r
243 DMO_OUTPUT_DATA_BUFFER *pOutputBuffers,
\r
244 uint32_t *pdwStatus);
\r
245 long (STDCALL *Lock)(IMediaObject *This, long bLock);
\r
248 struct _IMediaObject { IMediaObject_vt* vt; };
\r
250 /* Implementation of IMediaBuffer */
\r
251 typedef struct _CMediaBuffer
\r
253 IMediaBuffer_vt *vt;
\r
261 CMediaBuffer *CMediaBufferCreate( block_t *, int, vlc_bool_t );
\r