Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

dmo.h

00001 /*****************************************************************************
00002  * dmo.h : DirectMedia Object codec module for vlc
00003  *****************************************************************************
00004  * Copyright (C) 2002, 2003 the VideoLAN team
00005  * $Id: dmo.h 11664 2005-07-09 06:17:09Z courmisch $
00006  *
00007  * Author: Gildas Bazin <[email protected]>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00022  *****************************************************************************/
00023 
00024 static const GUID IID_IUnknown = {0x00000000, 0x0000, 0x0000, {0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46}};
00025 static const GUID IID_IClassFactory = {0x00000001, 0x0000, 0x0000, {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
00026 static const GUID IID_IWMCodecPrivateData = {0x73f0be8e, 0x57f7, 0x4f01, {0xaa, 0x66, 0x9f, 0x57, 0x34, 0xc, 0xfe, 0xe}};
00027 static const GUID IID_IMediaObject = {0xd8ad0f58, 0x5494, 0x4102, {0x97, 0xc5, 0xec, 0x79, 0x8e, 0x59, 0xbc, 0xf4}};
00028 static const GUID IID_IMediaBuffer = {0x59eff8b9, 0x938c, 0x4a26, {0x82, 0xf2, 0x95, 0xcb, 0x84, 0xcd, 0xc8, 0x37}};
00029 static const GUID MEDIATYPE_Video = {0x73646976, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
00030 static const GUID MEDIATYPE_Audio = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
00031 static const GUID MEDIASUBTYPE_PCM = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
00032 static const GUID FORMAT_VideoInfo = {0x05589f80, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}};
00033 static const GUID FORMAT_WaveFormatEx = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}};
00034 static const GUID GUID_NULL = {0x0000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
00035 static const GUID MEDIASUBTYPE_I420 = {0x30323449, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
00036 static const GUID MEDIASUBTYPE_YV12 = {0x32315659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
00037 static const GUID MEDIASUBTYPE_RGB24 = {0xe436eb7d, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
00038 static const GUID MEDIASUBTYPE_RGB565 = {0xe436eb7b, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
00039 
00040 
00041 #ifndef WIN32
00042 void* CoTaskMemAlloc(unsigned long cb);
00043 void CoTaskMemFree(void* cb);
00044 #endif
00045 
00046 #define IUnknown IUnknownHack
00047 #define IClassFactory IClassFactoryHack
00048 typedef struct _IUnknown IUnknown;
00049 typedef struct _IClassFactory IClassFactory;
00050 typedef struct _IWMCodecPrivateData IWMCodecPrivateData;
00051 typedef struct _IEnumDMO IEnumDMO;
00052 typedef struct _IMediaBuffer IMediaBuffer;
00053 typedef struct _IMediaObject IMediaObject;
00054 
00055 #ifndef STDCALL
00056 #define STDCALL __stdcall
00057 #endif
00058 
00059 #define DMO_INPUT_DATA_BUFFERF_SYNCPOINT 1
00060 #define DMO_INPUT_DATA_BUFFERF_TIME 2
00061 #define DMO_INPUT_DATA_BUFFERF_TIMELENGTH 4
00062 #define DMO_OUTPUT_DATA_BUFFERF_SYNCPOINT 1
00063 #define DMO_OUTPUT_DATA_BUFFERF_TIME 2
00064 #define DMO_OUTPUT_DATA_BUFFERF_TIMELENGTH 4
00065 #define DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER 1
00066 #define DMO_E_NOTACCEPTING 0x80040204
00067 
00068 /*
00069  * DMO types definition
00070  */
00071 typedef struct
00072 #ifdef HAVE_ATTRIBUTE_PACKED
00073     __attribute__((__packed__))
00074 #endif
00075  _DMO_PARTIAL_MEDIATYPE
00076 {
00077     GUID type;
00078     GUID subtype;
00079 
00080 } DMO_PARTIAL_MEDIATYPE;
00081 
00082 typedef struct
00083 #ifdef HAVE_ATTRIBUTE_PACKED
00084     __attribute__((__packed__))
00085 #endif
00086  _DMO_OUTPUT_DATA_BUFFER
00087 {
00088     IMediaBuffer *pBuffer;
00089     uint32_t dwStatus;
00090     REFERENCE_TIME rtTimestamp;
00091     REFERENCE_TIME rtTimelength;
00092 
00093 } DMO_OUTPUT_DATA_BUFFER;
00094 
00095 typedef struct
00096 #ifdef HAVE_ATTRIBUTE_PACKED
00097     __attribute__((__packed__))
00098 #endif
00099  _DMOMediaType
00100 {
00101     GUID     majortype;
00102     GUID     subtype;
00103     int      bFixedSizeSamples;
00104     int      bTemporalCompression;
00105     uint32_t lSampleSize;
00106     GUID     formattype;
00107     IUnknown *pUnk;
00108     uint32_t cbFormat;
00109     char     *pbFormat;
00110 
00111 } DMO_MEDIA_TYPE;
00112 
00113 /*
00114  * IUnknown interface
00115  */
00116 typedef struct IUnknown_vt
00117 {
00118     /* IUnknown methods */
00119     long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,
00120                                    void **ppvObject);
00121     long (STDCALL *AddRef)(IUnknown *This);
00122     long (STDCALL *Release)(IUnknown *This);
00123 
00124 } IUnknown_vt;
00125 struct _IUnknown { IUnknown_vt* vt; };
00126 
00127 /*
00128  * IClassFactory interface
00129  */
00130 typedef struct IClassFactory_vt
00131 {
00132     long (STDCALL *QueryInterface)(IUnknown *This, const GUID* riid,
00133                                    void **ppvObject);
00134     long (STDCALL *AddRef)(IUnknown *This) ;
00135     long (STDCALL *Release)(IUnknown *This) ;
00136     long (STDCALL *CreateInstance)(IClassFactory *This, IUnknown *pUnkOuter,
00137                                    const GUID* riid, void** ppvObject);
00138 } IClassFactory_vt;
00139 
00140 struct _IClassFactory { IClassFactory_vt* vt; };
00141 
00142 /*
00143  * IWMCodecPrivateData interface
00144  */
00145 typedef struct IWMCodecPrivateData_vt
00146 {
00147     long (STDCALL *QueryInterface)(IUnknown *This, const GUID* riid,
00148                                    void **ppvObject);
00149     long (STDCALL *AddRef)(IUnknown *This) ;
00150     long (STDCALL *Release)(IUnknown *This) ;
00151 
00152         
00153     long (STDCALL *SetPartialOutputType)(IWMCodecPrivateData * This,
00154                                          DMO_MEDIA_TYPE *pmt);
00155 
00156     long (STDCALL *GetPrivateData )(IWMCodecPrivateData * This,
00157                                     uint8_t *pbData, uint32_t *pcbData);
00158 } IWMCodecPrivateData_vt;
00159 
00160 struct _IWMCodecPrivateData { IWMCodecPrivateData_vt* vt; };
00161 
00162 /*
00163  * IEnumDMO interface
00164  */
00165 typedef struct IEnumDMO_vt
00166 {
00167     /* IUnknown methods */
00168     long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,
00169                                    void **ppvObject);
00170     long (STDCALL *AddRef)(IUnknown *This);
00171     long (STDCALL *Release)(IUnknown *This);
00172 
00173     /* IEnumDMO methods */
00174     long (STDCALL *Next)(IEnumDMO *This, uint32_t cItemsToFetch,
00175                          const GUID *pCLSID, WCHAR **Names,
00176                          uint32_t *pcItemsFetched);
00177     long (STDCALL *Skip)(IEnumDMO *This, uint32_t cItemsToSkip);
00178     long (STDCALL *Reset)(IEnumDMO *This);
00179     long (STDCALL *Clone)(IEnumDMO *This, IEnumDMO **ppEnum);
00180 
00181 } IEnumDMO_vt;
00182 struct _IEnumDMO { IEnumDMO_vt* vt; };
00183 
00184 /*
00185  * IMediaBuffer interface
00186  */
00187 typedef struct IMediaBuffer_vt
00188 {
00189     /* IUnknown methods */
00190     long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,
00191                                    void **ppvObject);
00192     long (STDCALL *AddRef)(IUnknown *This);
00193     long (STDCALL *Release)(IUnknown *This);
00194 
00195     long (STDCALL *SetLength)(IMediaBuffer* This, uint32_t cbLength);
00196     long (STDCALL *GetMaxLength)(IMediaBuffer* This, uint32_t *pcbMaxLength);
00197     long (STDCALL *GetBufferAndLength)(IMediaBuffer* This,
00198                                        char **ppBuffer, uint32_t *pcbLength);
00199 
00200 } IMediaBuffer_vt;
00201 struct _IMediaBuffer { IMediaBuffer_vt* vt; };
00202 
00203 /*
00204  * IMediaObject interface
00205  */
00206 typedef struct IMediaObject_vt
00207 {
00208     /* IUnknown methods */
00209     long (STDCALL *QueryInterface)(IUnknown *This, const GUID *riid,
00210                                    void **ppvObject);
00211     long (STDCALL *AddRef)(IUnknown *This);
00212     long (STDCALL *Release)(IUnknown *This);
00213 
00214     /* IEnumDMO methods */
00215     long (STDCALL *GetStreamCount)(IMediaObject *This,
00216                                    uint32_t *pcInputStreams,
00217                                    uint32_t *pcOutputStreams);
00218     long (STDCALL *GetInputStreamInfo)(IMediaObject *This,
00219                                        uint32_t dwInputStreamIndex,
00220                                        uint32_t *pdwFlags);
00221     long (STDCALL *GetOutputStreamInfo)(IMediaObject *This,
00222                                         uint32_t dwOutputStreamIndex,
00223                                         uint32_t *pdwFlags);
00224     long (STDCALL *GetInputType)(IMediaObject *This,
00225                                  uint32_t dwInputStreamIndex,
00226                                  uint32_t dwTypeIndex,
00227                                  DMO_MEDIA_TYPE *pmt);
00228     long (STDCALL *GetOutputType)(IMediaObject *This,
00229                                   uint32_t dwOutputStreamIndex,
00230                                   uint32_t dwTypeIndex,
00231                                   DMO_MEDIA_TYPE *pmt);
00232     long (STDCALL *SetInputType)(IMediaObject *This,
00233                                  uint32_t dwInputStreamIndex,
00234                                  const DMO_MEDIA_TYPE *pmt,
00235                                  uint32_t dwFlags);
00236     long (STDCALL *SetOutputType)(IMediaObject *This,
00237                                   uint32_t dwOutputStreamIndex,
00238                                   const DMO_MEDIA_TYPE *pmt,
00239                                   uint32_t dwFlags);
00240     long (STDCALL *GetInputCurrentType)(IMediaObject *This,
00241                                         uint32_t dwInputStreamIndex,
00242                                         DMO_MEDIA_TYPE *pmt);
00243     long (STDCALL *GetOutputCurrentType)(IMediaObject *This,
00244                                          uint32_t dwOutputStreamIndex,
00245                                          DMO_MEDIA_TYPE *pmt);
00246     long (STDCALL *GetInputSizeInfo)(IMediaObject *This,
00247                                      uint32_t dwInputStreamIndex,
00248                                      uint32_t *pcbSize,
00249                                      uint32_t *pcbMaxLookahead,
00250                                      uint32_t *pcbAlignment);
00251     long (STDCALL *GetOutputSizeInfo)(IMediaObject *This,
00252                                       uint32_t dwOutputStreamIndex,
00253                                       uint32_t *pcbSize,
00254                                       uint32_t *pcbAlignment);
00255     long (STDCALL *GetInputMaxLatency)(IMediaObject *This,
00256                                        uint32_t dwInputStreamIndex,
00257                                        REFERENCE_TIME *prtMaxLatency);
00258     long (STDCALL *SetInputMaxLatency)(IMediaObject *This,
00259                                        uint32_t dwInputStreamIndex,
00260                                        REFERENCE_TIME rtMaxLatency);
00261     long (STDCALL *Flush)(IMediaObject * This);
00262     long (STDCALL *Discontinuity)(IMediaObject *This,
00263                                   uint32_t dwInputStreamIndex);
00264     long (STDCALL *AllocateStreamingResources)(IMediaObject * This);
00265     long (STDCALL *FreeStreamingResources)(IMediaObject * This);
00266     long (STDCALL *GetInputStatus)(IMediaObject *This,
00267                                    uint32_t dwInputStreamIndex,
00268                                    uint32_t *dwFlags);
00269     long (STDCALL *ProcessInput)(IMediaObject *This,
00270                                  uint32_t dwInputStreamIndex,
00271                                  IMediaBuffer *pBuffer,
00272                                  uint32_t dwFlags,
00273                                  REFERENCE_TIME rtTimestamp,
00274                                  REFERENCE_TIME rtTimelength);
00275     long (STDCALL *ProcessOutput)(IMediaObject *This,
00276                                   uint32_t dwFlags,
00277                                   uint32_t cOutputBufferCount,
00278                                   DMO_OUTPUT_DATA_BUFFER *pOutputBuffers,
00279                                   uint32_t *pdwStatus);
00280     long (STDCALL *Lock)(IMediaObject *This, long bLock);
00281 
00282 } IMediaObject_vt;
00283 struct _IMediaObject { IMediaObject_vt* vt; };
00284 
00285 /* Implementation of IMediaBuffer */
00286 typedef struct _CMediaBuffer
00287 {
00288     IMediaBuffer_vt *vt;
00289     int i_ref;
00290     block_t *p_block;
00291     int i_max_size;
00292     vlc_bool_t b_own;
00293 
00294 } CMediaBuffer;
00295 
00296 CMediaBuffer *CMediaBufferCreate( block_t *, int, vlc_bool_t );

Generated on Tue Dec 20 10:14:29 2005 for vlc-0.8.4a by  doxygen 1.4.2