]> git.sesse.net Git - vlc/blob - modules/codec/dmo/dmo.h
* dmo: - fixed init of WAVEFORMATEX (cbSize is only the size of extra datas).
[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_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
35 \r
36 #ifdef WIN32\r
37 #   define IUnknown IUnknownHack\r
38 #endif\r
39 \r
40 #ifndef STDCALL\r
41 #define STDCALL __stdcall\r
42 #endif\r
43 \r
44 #define DMO_INPUT_DATA_BUFFER_SYNCPOINT 1\r
45 #define DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER 1\r
46 #define DMO_E_NOTACCEPTING 0x80040204\r
47 \r
48 /*\r
49  * DMO types definition\r
50  */\r
51 typedef struct\r
52 #ifdef HAVE_ATTRIBUTE_PACKED\r
53     __attribute__((__packed__))\r
54 #endif\r
55  _DMO_PARTIAL_MEDIATYPE\r
56 {\r
57     GUID type;\r
58     GUID subtype;\r
59 \r
60 } DMO_PARTIAL_MEDIATYPE;\r
61 \r
62 /* Implementation of IMediaBuffer */\r
63 typedef struct _CMediaBuffer\r
64 {\r
65     IMediaBuffer_vt *vt;\r
66     int i_ref;\r
67     block_t *p_block;\r
68     int i_max_size;\r
69     vlc_bool_t b_own;\r
70 \r
71 } CMediaBuffer;\r
72 \r
73 CMediaBuffer *CMediaBufferCreate( block_t *, int, vlc_bool_t );\r
74 \r
75 #ifndef LOADER\r
76 typedef struct _IUnknown IUnknown;\r
77 typedef struct _IEnumDMO IEnumDMO;\r
78 typedef struct _IMediaBuffer IMediaBuffer;\r
79 typedef struct _IMediaObject IMediaObject;\r
80 \r
81 typedef struct\r
82 #ifdef HAVE_ATTRIBUTE_PACKED\r
83     __attribute__((__packed__))\r
84 #endif\r
85  _DMO_OUTPUT_DATA_BUFFER\r
86 {\r
87     IMediaBuffer *pBuffer;\r
88     uint32_t dwStatus;\r
89     REFERENCE_TIME rtTimestamp;\r
90     REFERENCE_TIME rtTimelength;\r
91 \r
92 } DMO_OUTPUT_DATA_BUFFER;\r
93 \r
94 typedef struct\r
95 #ifdef HAVE_ATTRIBUTE_PACKED\r
96     __attribute__((__packed__))\r
97 #endif\r
98  _DMOMediaType\r
99 {\r
100     GUID     majortype;\r
101     GUID     subtype;\r
102     int      bFixedSizeSamples;\r
103     int      bTemporalCompression;\r
104     uint32_t lSampleSize;\r
105     GUID     formattype;\r
106     IUnknown *pUnk;\r
107     uint32_t cbFormat;\r
108     char     *pbFormat;\r
109 \r
110 } DMO_MEDIA_TYPE;\r
111 \r
112 /*\r
113  * IUnknown interface\r
114  */\r
115 typedef struct IUnknown_vt\r
116 {\r
117     /* IUnknown methods */\r
118     long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,\r
119                                    void **ppvObject);\r
120     long (STDCALL *AddRef)(IUnknown *This);\r
121     long (STDCALL *Release)(IUnknown *This);\r
122 \r
123 } IUnknown_vt;\r
124 struct _IUnknown { IUnknown_vt* vt; };\r
125 \r
126 /*\r
127  * IEnumDMO interface\r
128  */\r
129 typedef struct IEnumDMO_vt\r
130 {\r
131     /* IUnknown methods */\r
132     long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,\r
133                                    void **ppvObject);\r
134     long (STDCALL *AddRef)(IUnknown *This);\r
135     long (STDCALL *Release)(IUnknown *This);\r
136 \r
137     /* IEnumDMO methods */\r
138     long (STDCALL *Next)(IEnumDMO *This, uint32_t cItemsToFetch,\r
139                          const GUID *pCLSID, WCHAR **Names,\r
140                          uint32_t *pcItemsFetched);\r
141     long (STDCALL *Skip)(IEnumDMO *This, uint32_t cItemsToSkip);\r
142     long (STDCALL *Reset)(IEnumDMO *This);\r
143     long (STDCALL *Clone)(IEnumDMO *This, IEnumDMO **ppEnum);\r
144 \r
145 } IEnumDMO_vt;\r
146 struct _IEnumDMO { IEnumDMO_vt* vt; };\r
147 \r
148 /*\r
149  * IMediaBuffer interface\r
150  */\r
151 typedef struct IMediaBuffer_vt\r
152 {\r
153     /* IUnknown methods */\r
154     long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,\r
155                                    void **ppvObject);\r
156     long (STDCALL *AddRef)(IUnknown *This);\r
157     long (STDCALL *Release)(IUnknown *This);\r
158 \r
159     long (STDCALL *SetLength)(IMediaBuffer* This, uint32_t cbLength);\r
160     long (STDCALL *GetMaxLength)(IMediaBuffer* This, uint32_t *pcbMaxLength);\r
161     long (STDCALL *GetBufferAndLength)(IMediaBuffer* This,\r
162                                        char** ppBuffer, uint32_t* pcbLength);\r
163 \r
164 } IMediaBuffer_vt;\r
165 struct _IMediaBuffer { IMediaBuffer_vt* vt; };\r
166 \r
167 /*\r
168  * IMediaObject interface\r
169  */\r
170 typedef struct IMediaObject_vt\r
171 {\r
172     /* IUnknown methods */\r
173     long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,\r
174                                    void **ppvObject);\r
175     long (STDCALL *AddRef)(IUnknown *This);\r
176     long (STDCALL *Release)(IUnknown *This);\r
177 \r
178     /* IEnumDMO methods */\r
179     long (STDCALL *GetStreamCount)(IMediaObject *This,\r
180                                    uint32_t *pcInputStreams,\r
181                                    uint32_t *pcOutputStreams);\r
182     long (STDCALL *GetInputStreamInfo)(IMediaObject *This,\r
183                                        uint32_t dwInputStreamIndex,\r
184                                        uint32_t *pdwFlags);\r
185     long (STDCALL *GetOutputStreamInfo)(IMediaObject *This,\r
186                                         uint32_t dwOutputStreamIndex,\r
187                                         uint32_t *pdwFlags);\r
188     long (STDCALL *GetInputType)(IMediaObject *This,\r
189                                  uint32_t dwInputStreamIndex,\r
190                                  uint32_t dwTypeIndex,\r
191                                  DMO_MEDIA_TYPE *pmt);\r
192     long (STDCALL *GetOutputType)(IMediaObject *This,\r
193                                   uint32_t dwOutputStreamIndex,\r
194                                   uint32_t dwTypeIndex,\r
195                                   DMO_MEDIA_TYPE *pmt);\r
196     long (STDCALL *SetInputType)(IMediaObject *This,\r
197                                  uint32_t dwInputStreamIndex,\r
198                                  const DMO_MEDIA_TYPE *pmt,\r
199                                  uint32_t dwFlags);\r
200     long (STDCALL *SetOutputType)(IMediaObject *This,\r
201                                   uint32_t dwOutputStreamIndex,\r
202                                   const DMO_MEDIA_TYPE *pmt,\r
203                                   uint32_t dwFlags);\r
204     long (STDCALL *GetInputCurrentType)(IMediaObject *This,\r
205                                         uint32_t dwInputStreamIndex,\r
206                                         DMO_MEDIA_TYPE *pmt);\r
207     long (STDCALL *GetOutputCurrentType)(IMediaObject *This,\r
208                                          uint32_t dwOutputStreamIndex,\r
209                                          DMO_MEDIA_TYPE *pmt);\r
210     long (STDCALL *GetInputSizeInfo)(IMediaObject *This,\r
211                                      uint32_t dwInputStreamIndex,\r
212                                      uint32_t *pcbSize,\r
213                                      uint32_t *pcbMaxLookahead,\r
214                                      uint32_t *pcbAlignment);\r
215     long (STDCALL *GetOutputSizeInfo)(IMediaObject *This,\r
216                                       uint32_t dwOutputStreamIndex,\r
217                                       uint32_t *pcbSize,\r
218                                       uint32_t *pcbAlignment);\r
219     long (STDCALL *GetInputMaxLatency)(IMediaObject *This,\r
220                                        uint32_t dwInputStreamIndex,\r
221                                        REFERENCE_TIME *prtMaxLatency);\r
222     long (STDCALL *SetInputMaxLatency)(IMediaObject *This,\r
223                                        uint32_t dwInputStreamIndex,\r
224                                        REFERENCE_TIME rtMaxLatency);\r
225     long (STDCALL *Flush)(IMediaObject * This);\r
226     long (STDCALL *Discontinuity)(IMediaObject *This,\r
227                                   uint32_t dwInputStreamIndex);\r
228     long (STDCALL *AllocateStreamingResources)(IMediaObject * This);\r
229     long (STDCALL *FreeStreamingResources)(IMediaObject * This);\r
230     long (STDCALL *GetInputStatus)(IMediaObject *This,\r
231                                    uint32_t dwInputStreamIndex,\r
232                                    uint32_t *dwFlags);\r
233     long (STDCALL *ProcessInput)(IMediaObject *This,\r
234                                  uint32_t dwInputStreamIndex,\r
235                                  IMediaBuffer *pBuffer,\r
236                                  uint32_t dwFlags,\r
237                                  REFERENCE_TIME rtTimestamp,\r
238                                  REFERENCE_TIME rtTimelength);\r
239     long (STDCALL *ProcessOutput)(IMediaObject *This,\r
240                                   uint32_t dwFlags,\r
241                                   uint32_t cOutputBufferCount,\r
242                                   DMO_OUTPUT_DATA_BUFFER *pOutputBuffers,\r
243                                   uint32_t *pdwStatus);\r
244     long (STDCALL *Lock)(IMediaObject *This, long bLock);\r
245 \r
246 } IMediaObject_vt;\r
247 struct _IMediaObject { IMediaObject_vt* vt; };\r
248 #endif  /* !define LOADER */\r
249 \r