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_IMediaObject = {0xd8ad0f58, 0x5494, 0x4102, {0x97, 0xc5, 0xec, 0x79, 0x8e, 0x59, 0xbc, 0xf4}};
\r
26 static const GUID IID_IMediaBuffer = {0x59eff8b9, 0x938c, 0x4a26, {0x82, 0xf2, 0x95, 0xcb, 0x84, 0xcd, 0xc8, 0x37}};
\r
27 static const GUID MEDIATYPE_Video = {0x73646976, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
\r
28 static const GUID MEDIATYPE_Audio = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
\r
29 static const GUID MEDIASUBTYPE_PCM = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
\r
30 static const GUID MEDIASUBTYPE_VideoInfo = {0x05589f80, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}};
\r
31 static const GUID FORMAT_WaveFormatEx = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}};
\r
32 static const GUID GUID_NULL = {0x0000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
\r
33 static const GUID MEDIASUBTYPE_I420 = {0x30323449, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
\r
34 static const GUID MEDIASUBTYPE_YV12 = {0x32315659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
\r
37 # define IUnknown IUnknownHack
\r
39 typedef struct _IUnknown IUnknown;
\r
40 typedef struct _IEnumDMO IEnumDMO;
\r
41 typedef struct _IMediaBuffer IMediaBuffer;
\r
42 typedef struct _IMediaObject IMediaObject;
\r
44 #define STDCALL __stdcall
\r
47 #define DMO_INPUT_DATA_BUFFER_SYNCPOINT 1
\r
48 #define DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER 1
\r
49 #define DMO_E_NOTACCEPTING 0x80040204
\r
52 * DMO types definition
\r
55 #ifdef HAVE_ATTRIBUTE_PACKED
\r
56 __attribute__((__packed__))
\r
58 _DMO_PARTIAL_MEDIATYPE
\r
63 } DMO_PARTIAL_MEDIATYPE;
\r
66 #ifdef HAVE_ATTRIBUTE_PACKED
\r
67 __attribute__((__packed__))
\r
69 _DMO_OUTPUT_DATA_BUFFER
\r
71 IMediaBuffer *pBuffer;
\r
73 REFERENCE_TIME rtTimestamp;
\r
74 REFERENCE_TIME rtTimelength;
\r
76 } DMO_OUTPUT_DATA_BUFFER;
\r
79 #ifdef HAVE_ATTRIBUTE_PACKED
\r
80 __attribute__((__packed__))
\r
86 int bFixedSizeSamples;
\r
87 int bTemporalCompression;
\r
88 uint32_t lSampleSize;
\r
97 * IUnknown interface
\r
99 typedef struct IUnknown_vt
\r
101 /* IUnknown methods */
\r
102 long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,
\r
104 long (STDCALL *AddRef)(IUnknown *This);
\r
105 long (STDCALL *Release)(IUnknown *This);
\r
108 struct _IUnknown { IUnknown_vt* vt; };
\r
111 * IEnumDMO interface
\r
113 typedef struct IEnumDMO_vt
\r
115 /* IUnknown methods */
\r
116 long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,
\r
118 long (STDCALL *AddRef)(IUnknown *This);
\r
119 long (STDCALL *Release)(IUnknown *This);
\r
121 /* IEnumDMO methods */
\r
122 long (STDCALL *Next)(IEnumDMO *This, uint32_t cItemsToFetch,
\r
123 const GUID *pCLSID, WCHAR **Names,
\r
124 uint32_t *pcItemsFetched);
\r
125 long (STDCALL *Skip)(IEnumDMO *This, uint32_t cItemsToSkip);
\r
126 long (STDCALL *Reset)(IEnumDMO *This);
\r
127 long (STDCALL *Clone)(IEnumDMO *This, IEnumDMO **ppEnum);
\r
130 struct _IEnumDMO { IEnumDMO_vt* vt; };
\r
133 * IMediaBuffer interface
\r
135 typedef struct IMediaBuffer_vt
\r
137 /* IUnknown methods */
\r
138 long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,
\r
140 long (STDCALL *AddRef)(IUnknown *This);
\r
141 long (STDCALL *Release)(IUnknown *This);
\r
143 long (STDCALL *SetLength)(IMediaBuffer* This, uint32_t cbLength);
\r
144 long (STDCALL *GetMaxLength)(IMediaBuffer* This, uint32_t *pcbMaxLength);
\r
145 long (STDCALL *GetBufferAndLength)(IMediaBuffer* This,
\r
146 char** ppBuffer, uint32_t* pcbLength);
\r
149 struct _IMediaBuffer { IMediaBuffer_vt* vt; };
\r
152 * IMediaObject interface
\r
154 typedef struct IMediaObject_vt
\r
156 /* IUnknown methods */
\r
157 long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,
\r
159 long (STDCALL *AddRef)(IUnknown *This);
\r
160 long (STDCALL *Release)(IUnknown *This);
\r
162 /* IEnumDMO methods */
\r
163 long (STDCALL *GetStreamCount)(IMediaObject *This,
\r
164 uint32_t *pcInputStreams,
\r
165 uint32_t *pcOutputStreams);
\r
166 long (STDCALL *GetInputStreamInfo)(IMediaObject *This,
\r
167 uint32_t dwInputStreamIndex,
\r
168 uint32_t *pdwFlags);
\r
169 long (STDCALL *GetOutputStreamInfo)(IMediaObject *This,
\r
170 uint32_t dwOutputStreamIndex,
\r
171 uint32_t *pdwFlags);
\r
172 long (STDCALL *GetInputType)(IMediaObject *This,
\r
173 uint32_t dwInputStreamIndex,
\r
174 uint32_t dwTypeIndex,
\r
175 DMO_MEDIA_TYPE *pmt);
\r
176 long (STDCALL *GetOutputType)(IMediaObject *This,
\r
177 uint32_t dwOutputStreamIndex,
\r
178 uint32_t dwTypeIndex,
\r
179 DMO_MEDIA_TYPE *pmt);
\r
180 long (STDCALL *SetInputType)(IMediaObject *This,
\r
181 uint32_t dwInputStreamIndex,
\r
182 const DMO_MEDIA_TYPE *pmt,
\r
184 long (STDCALL *SetOutputType)(IMediaObject *This,
\r
185 uint32_t dwOutputStreamIndex,
\r
186 const DMO_MEDIA_TYPE *pmt,
\r
188 long (STDCALL *GetInputCurrentType)(IMediaObject *This,
\r
189 uint32_t dwInputStreamIndex,
\r
190 DMO_MEDIA_TYPE *pmt);
\r
191 long (STDCALL *GetOutputCurrentType)(IMediaObject *This,
\r
192 uint32_t dwOutputStreamIndex,
\r
193 DMO_MEDIA_TYPE *pmt);
\r
194 long (STDCALL *GetInputSizeInfo)(IMediaObject *This,
\r
195 uint32_t dwInputStreamIndex,
\r
197 uint32_t *pcbMaxLookahead,
\r
198 uint32_t *pcbAlignment);
\r
199 long (STDCALL *GetOutputSizeInfo)(IMediaObject *This,
\r
200 uint32_t dwOutputStreamIndex,
\r
202 uint32_t *pcbAlignment);
\r
203 long (STDCALL *GetInputMaxLatency)(IMediaObject *This,
\r
204 uint32_t dwInputStreamIndex,
\r
205 REFERENCE_TIME *prtMaxLatency);
\r
206 long (STDCALL *SetInputMaxLatency)(IMediaObject *This,
\r
207 uint32_t dwInputStreamIndex,
\r
208 REFERENCE_TIME rtMaxLatency);
\r
209 long (STDCALL *Flush)(IMediaObject * This);
\r
210 long (STDCALL *Discontinuity)(IMediaObject *This,
\r
211 uint32_t dwInputStreamIndex);
\r
212 long (STDCALL *AllocateStreamingResources)(IMediaObject * This);
\r
213 long (STDCALL *FreeStreamingResources)(IMediaObject * This);
\r
214 long (STDCALL *GetInputStatus)(IMediaObject *This,
\r
215 uint32_t dwInputStreamIndex,
\r
216 uint32_t *dwFlags);
\r
217 long (STDCALL *ProcessInput)(IMediaObject *This,
\r
218 uint32_t dwInputStreamIndex,
\r
219 IMediaBuffer *pBuffer,
\r
221 REFERENCE_TIME rtTimestamp,
\r
222 REFERENCE_TIME rtTimelength);
\r
223 long (STDCALL *ProcessOutput)(IMediaObject *This,
\r
225 uint32_t cOutputBufferCount,
\r
226 DMO_OUTPUT_DATA_BUFFER *pOutputBuffers,
\r
227 uint32_t *pdwStatus);
\r
228 long (STDCALL *Lock)(IMediaObject *This, long bLock);
\r
231 struct _IMediaObject { IMediaObject_vt* vt; };
\r
233 /* Implementation of IMediaBuffer */
\r
234 typedef struct _CMediaBuffer
\r
236 IMediaBuffer_vt *vt;
\r
244 CMediaBuffer *CMediaBufferCreate( block_t *, int, vlc_bool_t );
\r