]> git.sesse.net Git - vlc/blob - modules/codec/dmo/dmo.h
* modules/codec/dmo: fixed dmo decoder on win32 + got rid of some of the dependencies...
[vlc] / modules / codec / dmo / dmo.h
1 /*****************************************************************************\r
2  * dmo.h : DirectMedia Object codec module for vlc\r
3  *****************************************************************************\r
4  * Copyright (C) 2002, 2003 VideoLAN\r
5  * $Id$\r
6  *\r
7  * Author: Gildas Bazin <gbazin@videolan.org>\r
8  *\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
13  *\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
18  *\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
23 \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
36 \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
44 \r
45 #ifndef STDCALL\r
46 #define STDCALL __stdcall\r
47 #endif\r
48 \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
52 \r
53 /*\r
54  * DMO types definition\r
55  */\r
56 typedef struct\r
57 #ifdef HAVE_ATTRIBUTE_PACKED\r
58     __attribute__((__packed__))\r
59 #endif\r
60  _DMO_PARTIAL_MEDIATYPE\r
61 {\r
62     GUID type;\r
63     GUID subtype;\r
64 \r
65 } DMO_PARTIAL_MEDIATYPE;\r
66 \r
67 typedef struct\r
68 #ifdef HAVE_ATTRIBUTE_PACKED\r
69     __attribute__((__packed__))\r
70 #endif\r
71  _DMO_OUTPUT_DATA_BUFFER\r
72 {\r
73     IMediaBuffer *pBuffer;\r
74     uint32_t dwStatus;\r
75     REFERENCE_TIME rtTimestamp;\r
76     REFERENCE_TIME rtTimelength;\r
77 \r
78 } DMO_OUTPUT_DATA_BUFFER;\r
79 \r
80 typedef struct\r
81 #ifdef HAVE_ATTRIBUTE_PACKED\r
82     __attribute__((__packed__))\r
83 #endif\r
84  _DMOMediaType\r
85 {\r
86     GUID     majortype;\r
87     GUID     subtype;\r
88     int      bFixedSizeSamples;\r
89     int      bTemporalCompression;\r
90     uint32_t lSampleSize;\r
91     GUID     formattype;\r
92     IUnknown *pUnk;\r
93     uint32_t cbFormat;\r
94     char     *pbFormat;\r
95 \r
96 } DMO_MEDIA_TYPE;\r
97 \r
98 /*\r
99  * IUnknown interface\r
100  */\r
101 typedef struct IUnknown_vt\r
102 {\r
103     /* IUnknown methods */\r
104     long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,\r
105                                    void **ppvObject);\r
106     long (STDCALL *AddRef)(IUnknown *This);\r
107     long (STDCALL *Release)(IUnknown *This);\r
108 \r
109 } IUnknown_vt;\r
110 struct _IUnknown { IUnknown_vt* vt; };\r
111 \r
112 /*\r
113  * IClassFactory interface\r
114  */\r
115 typedef struct IClassFactory_vt\r
116 {\r
117     long (STDCALL *QueryInterface)(IUnknown *This, const GUID* riid,\r
118                                    void **ppvObject);\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
124 \r
125 struct _IClassFactory { IClassFactory_vt* vt; };\r
126 \r
127 /*\r
128  * IEnumDMO interface\r
129  */\r
130 typedef struct IEnumDMO_vt\r
131 {\r
132     /* IUnknown methods */\r
133     long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,\r
134                                    void **ppvObject);\r
135     long (STDCALL *AddRef)(IUnknown *This);\r
136     long (STDCALL *Release)(IUnknown *This);\r
137 \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
145 \r
146 } IEnumDMO_vt;\r
147 struct _IEnumDMO { IEnumDMO_vt* vt; };\r
148 \r
149 /*\r
150  * IMediaBuffer interface\r
151  */\r
152 typedef struct IMediaBuffer_vt\r
153 {\r
154     /* IUnknown methods */\r
155     long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,\r
156                                    void **ppvObject);\r
157     long (STDCALL *AddRef)(IUnknown *This);\r
158     long (STDCALL *Release)(IUnknown *This);\r
159 \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
164 \r
165 } IMediaBuffer_vt;\r
166 struct _IMediaBuffer { IMediaBuffer_vt* vt; };\r
167 \r
168 /*\r
169  * IMediaObject interface\r
170  */\r
171 typedef struct IMediaObject_vt\r
172 {\r
173     /* IUnknown methods */\r
174     long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,\r
175                                    void **ppvObject);\r
176     long (STDCALL *AddRef)(IUnknown *This);\r
177     long (STDCALL *Release)(IUnknown *This);\r
178 \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
200                                  uint32_t dwFlags);\r
201     long (STDCALL *SetOutputType)(IMediaObject *This,\r
202                                   uint32_t dwOutputStreamIndex,\r
203                                   const DMO_MEDIA_TYPE *pmt,\r
204                                   uint32_t dwFlags);\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
213                                      uint32_t *pcbSize,\r
214                                      uint32_t *pcbMaxLookahead,\r
215                                      uint32_t *pcbAlignment);\r
216     long (STDCALL *GetOutputSizeInfo)(IMediaObject *This,\r
217                                       uint32_t dwOutputStreamIndex,\r
218                                       uint32_t *pcbSize,\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
237                                  uint32_t dwFlags,\r
238                                  REFERENCE_TIME rtTimestamp,\r
239                                  REFERENCE_TIME rtTimelength);\r
240     long (STDCALL *ProcessOutput)(IMediaObject *This,\r
241                                   uint32_t dwFlags,\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
246 \r
247 } IMediaObject_vt;\r
248 struct _IMediaObject { IMediaObject_vt* vt; };\r
249 \r
250 /* Implementation of IMediaBuffer */\r
251 typedef struct _CMediaBuffer\r
252 {\r
253     IMediaBuffer_vt *vt;\r
254     int i_ref;\r
255     block_t *p_block;\r
256     int i_max_size;\r
257     vlc_bool_t b_own;\r
258 \r
259 } CMediaBuffer;\r
260 \r
261 CMediaBuffer *CMediaBufferCreate( block_t *, int, vlc_bool_t );\r