#include <vlc/decoder.h>\r
#include <vlc/vout.h>\r
\r
-#define LOADER\r
+#ifndef WIN32\r
+# define LOADER\r
+#else\r
+# include <objbase.h>\r
+#endif\r
+\r
#ifdef LOADER\r
/* Need the w32dll loader from mplayer */\r
# include <wine/winerror.h>\r
-# include <dmo/dmo.h>\r
-# include <dmo/dmo_interfaces.h>\r
-# include <dmo/dmo_guids.h>\r
# include <ldt_keeper.h>\r
-\r
-/* Avoid codecs.h to redefine a few symbols */\r
-# define _RECT32_\r
-# define _GUID_DEFINED\r
-# define _REFERENCE_TIME_\r
-# define _VIDEOINFOHEADER_\r
-\r
-/* Ugly, wine loader and vlc doesn't use the same field name for GUID */\r
-#define Data1 f1\r
-#define Data2 f2\r
-#define Data3 f3\r
-#define Data4 f4\r
-\r
-/* Not Needed */\r
-HRESULT CoInitialize( LPVOID pvReserved ) { return (HRESULT)-1; }\r
-void CoUninitialize(void) { }\r
-\r
-/* */\r
-HMODULE WINAPI LoadLibraryA(LPCSTR);\r
-FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR);\r
-int WINAPI FreeLibrary(HMODULE);\r
-\r
-typedef long STDCALL (*GETCLASS) (const GUID*, const GUID*, void**);\r
-\r
-#else\r
-# include <objbase.h>\r
+# include <wine/windef.h>\r
#endif\r
\r
-#include "dmo.h"\r
#include "codecs.h"\r
+#include "dmo.h"\r
+\r
+#ifdef LOADER\r
+/* Not Needed */\r
+long CoInitialize( void *pvReserved ) { return -1; }\r
+void CoUninitialize( void ) { }\r
+\r
+/* A few prototypes */\r
+HMODULE WINAPI LoadLibraryA(LPCSTR);\r
+#define LoadLibrary LoadLibraryA\r
+FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR);\r
+int WINAPI FreeLibrary(HMODULE);\r
+typedef long STDCALL (*GETCLASS) ( const GUID*, const GUID*, void** );\r
+#endif /* LOADER */\r
\r
static int pi_channels_maps[7] =\r
{\r
/* */\r
{ 0, NULL, NULL }\r
};\r
-\r
-#endif\r
+#endif /* LOADER */\r
\r
/*****************************************************************************\r
* Open: open dmo codec\r
{\r
#ifndef LOADER\r
return DecoderOpen( p_this );\r
+\r
#else\r
decoder_t *p_dec = (decoder_t*)p_this;\r
int i;\r
\r
p_dec->p_sys = NULL;\r
\r
-\r
/* Probe if we support it */\r
for( i = 0; codecs_table[i].i_fourcc != 0; i++ )\r
{\r
if( codecs_table[i].i_fourcc == p_dec->fmt_in.i_codec )\r
{\r
msg_Dbg( p_dec, "DMO codec for %4.4s may work with dll=%s",\r
- (char*)&p_dec->fmt_in.i_codec,\r
- codecs_table[i].psz_dll );\r
+ (char*)&p_dec->fmt_in.i_codec, codecs_table[i].psz_dll );\r
\r
/* Set callbacks */\r
- p_dec->pf_decode_video = (picture_t *(*)(decoder_t *, block_t **))DecodeBlock;\r
- p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **))DecodeBlock;\r
+ p_dec->pf_decode_video =\r
+ (picture_t *(*)(decoder_t *, block_t **))DecodeBlock;\r
+ p_dec->pf_decode_audio =\r
+ (aout_buffer_t *(*)(decoder_t *, block_t **))DecodeBlock;\r
return VLC_SUCCESS;\r
}\r
}\r
+\r
return VLC_EGENERIC;\r
-#endif\r
+#endif /* LOADER */\r
}\r
\r
/*****************************************************************************\r
}\r
\r
#ifndef LOADER\r
- { /* <- ugly ? yes */\r
+ {\r
IEnumDMO *p_enum_dmo = NULL;\r
WCHAR *psz_dmo_name;\r
GUID clsid_dmo;\r
- HRESULT (STDCALL *OurDMOEnum)( const GUID *, uint32_t, uint32_t,\r
- const DMO_PARTIAL_MEDIATYPE *,\r
- uint32_t, const DMO_PARTIAL_MEDIATYPE *,\r
- IEnumDMO ** );\r
-\r
+ long (STDCALL *OurDMOEnum)( const GUID *, uint32_t, uint32_t,\r
+ const DMO_PARTIAL_MEDIATYPE *,\r
+ uint32_t, const DMO_PARTIAL_MEDIATYPE *,\r
+ IEnumDMO ** );\r
\r
/* Load msdmo DLL */\r
hmsdmo_dll = LoadLibrary( "msdmo.dll" );\r
goto error;\r
}\r
}\r
+\r
#else /* LOADER */\r
{\r
GETCLASS GetClass;\r
- struct IClassFactory* cFactory = NULL;\r
- struct IUnknown* cObject = NULL;\r
+ IClassFactory *cFactory = NULL;\r
+ IUnknown *cObject = NULL;\r
\r
int i_err;\r
int i_codec;\r
return VLC_EGENERIC;\r
}\r
\r
- GetClass = (GETCLASS)GetProcAddress( hmsdmo_dll, "DllGetClassObject");\r
+ GetClass = (GETCLASS)GetProcAddress( hmsdmo_dll, "DllGetClassObject" );\r
if (!GetClass)\r
{\r
msg_Dbg( p_dec, "GetProcAddress failed to find DllGetClassObject()" );\r
return VLC_EGENERIC;\r
}\r
\r
- i_err = GetClass( codecs_table[i_codec].p_guid, &IID_IClassFactory, (void**)&cFactory );\r
+ i_err = GetClass( codecs_table[i_codec].p_guid, &IID_IClassFactory,\r
+ (void**)&cFactory );\r
if( i_err || cFactory == NULL )\r
{\r
msg_Dbg( p_dec, "no such class object" );\r
return VLC_EGENERIC;\r
}\r
\r
- i_err = cFactory->vt->CreateInstance( cFactory, 0, &IID_IUnknown, (void**)&cObject );\r
+ i_err = cFactory->vt->CreateInstance( cFactory, 0, &IID_IUnknown,\r
+ (void**)&cObject );\r
cFactory->vt->Release((IUnknown*)cFactory );\r
if( i_err || !cObject )\r
{\r
FreeLibrary( hmsdmo_dll );\r
return VLC_EGENERIC;\r
}\r
- i_err = cObject->vt->QueryInterface( cObject, &IID_IMediaObject, (void**)&p_dmo );\r
-#if 0\r
- if (hr == 0)\r
- {\r
- /* query for some extra available interface */\r
- HRESULT r = object->vt->QueryInterface(object, &IID_IMediaObjectInPlace, (void**)&This->m_pInPlace);\r
- if (r == 0 && This->m_pInPlace)\r
- printf("DMO dll supports InPlace - PLEASE REPORT to developer\n");\r
- r = object->vt->QueryInterface(object, &IID_IDMOVideoOutputOptimizations, (void**)&This->m_pOptim);\r
- if (r == 0 && This->m_pOptim)\r
- {\r
- unsigned long flags;\r
- r = This->m_pOptim->vt->QueryOperationModePreferences(This->m_pOptim, 0, &flags);\r
- printf("DMO dll supports VO Optimizations %ld %lx\n", r, flags);\r
- if (flags & DMO_VOSF_NEEDS_PREVIOUS_SAMPLE)\r
- printf("DMO dll might use previous sample when requested\n");\r
- }\r
- }\r
-#endif\r
+ i_err = cObject->vt->QueryInterface( cObject, &IID_IMediaObject,\r
+ (void**)&p_dmo );\r
cObject->vt->Release((IUnknown*)cObject );\r
}\r
#endif /* LOADER */\r
*****************************************************************************/\r
\r
static const GUID IID_IUnknown = {0x00000000, 0x0000, 0x0000, {0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46}};\r
+static const GUID IID_IClassFactory = {0x00000001, 0x0000, 0x0000, {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};\r
static const GUID IID_IMediaObject = {0xd8ad0f58, 0x5494, 0x4102, {0x97, 0xc5, 0xec, 0x79, 0x8e, 0x59, 0xbc, 0xf4}};\r
static const GUID IID_IMediaBuffer = {0x59eff8b9, 0x938c, 0x4a26, {0x82, 0xf2, 0x95, 0xcb, 0x84, 0xcd, 0xc8, 0x37}};\r
static const GUID MEDIATYPE_Video = {0x73646976, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};\r
static const GUID MEDIASUBTYPE_I420 = {0x30323449, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};\r
static const GUID MEDIASUBTYPE_YV12 = {0x32315659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};\r
\r
-#ifdef WIN32\r
-# define IUnknown IUnknownHack\r
-#endif\r
+#define IUnknown IUnknownHack\r
+#define IClassFactory IClassFactoryHack\r
+typedef struct _IUnknown IUnknown;\r
+typedef struct _IClassFactory IClassFactory;\r
+typedef struct _IEnumDMO IEnumDMO;\r
+typedef struct _IMediaBuffer IMediaBuffer;\r
+typedef struct _IMediaObject IMediaObject;\r
\r
#ifndef STDCALL\r
#define STDCALL __stdcall\r
\r
} DMO_PARTIAL_MEDIATYPE;\r
\r
-/* Implementation of IMediaBuffer */\r
-typedef struct _CMediaBuffer\r
-{\r
- IMediaBuffer_vt *vt;\r
- int i_ref;\r
- block_t *p_block;\r
- int i_max_size;\r
- vlc_bool_t b_own;\r
-\r
-} CMediaBuffer;\r
-\r
-CMediaBuffer *CMediaBufferCreate( block_t *, int, vlc_bool_t );\r
-\r
-#ifndef LOADER\r
-typedef struct _IUnknown IUnknown;\r
-typedef struct _IEnumDMO IEnumDMO;\r
-typedef struct _IMediaBuffer IMediaBuffer;\r
-typedef struct _IMediaObject IMediaObject;\r
-\r
typedef struct\r
#ifdef HAVE_ATTRIBUTE_PACKED\r
__attribute__((__packed__))\r
} IUnknown_vt;\r
struct _IUnknown { IUnknown_vt* vt; };\r
\r
+/*\r
+ * IClassFactory interface\r
+ */\r
+typedef struct IClassFactory_vt\r
+{\r
+ long (STDCALL *QueryInterface)(IUnknown *This, const GUID* riid,\r
+ void **ppvObject);\r
+ long (STDCALL *AddRef)(IUnknown *This) ;\r
+ long (STDCALL *Release)(IUnknown *This) ;\r
+ long (STDCALL *CreateInstance)(IClassFactory *This, IUnknown *pUnkOuter,\r
+ const GUID* riid, void** ppvObject);\r
+} IClassFactory_vt;\r
+\r
+struct _IClassFactory { IClassFactory_vt* vt; };\r
+\r
/*\r
* IEnumDMO interface\r
*/\r
\r
} IMediaObject_vt;\r
struct _IMediaObject { IMediaObject_vt* vt; };\r
-#endif /* !define LOADER */\r
\r
+/* Implementation of IMediaBuffer */\r
+typedef struct _CMediaBuffer\r
+{\r
+ IMediaBuffer_vt *vt;\r
+ int i_ref;\r
+ block_t *p_block;\r
+ int i_max_size;\r
+ vlc_bool_t b_own;\r
+\r
+} CMediaBuffer;\r
+\r
+CMediaBuffer *CMediaBufferCreate( block_t *, int, vlc_bool_t );\r