summaryrefslogtreecommitdiffstats
path: root/loader/dmo/dmo.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-08-12 15:30:21 +0200
committerwm4 <wm4@nowhere>2012-08-16 17:16:33 +0200
commitaebfbbf2bdda8e18beef90c16da97bd335f7d3b0 (patch)
treea7362bf3ef6f2d80a47b2e539a2ea4efe5e2e079 /loader/dmo/dmo.c
parentc6b03ffef6250096373c4a81a489dae9fbff9087 (diff)
downloadmpv-aebfbbf2bdda8e18beef90c16da97bd335f7d3b0.tar.bz2
mpv-aebfbbf2bdda8e18beef90c16da97bd335f7d3b0.tar.xz
Remove win32/qt/xanim/real binary codecs loading
Remove the win32 loader - the win32 emulation layer, as well as the code for using DirectShow/DMO/VFW codecs. Remove loading of xanim, QuickTime, and RealMedia codecs. The win32 emulation layer is based on a very old version of wine. Apparently, wine code was copied and hacked until it was somehow able to load a limited collection of binary codecs. It poked around in the code segment of some known binary codecs to disable unsupported win32 API calls to make them work. Example from module.c: for (i=0;i<5;i++) RVA(0x19e842)[i]=0x90; // make_new_region ? for (i=0;i<28;i++) RVA(0x19e86d)[i]=0x90; // call__call_CreateCompatibleDC ? for (i=0;i<5;i++) RVA(0x19e898)[i]=0x90; // jmp_to_call_loadbitmap ? for (i=0;i<9;i++) RVA(0x19e8ac)[i]=0x90; // call__calls_OLE_shit ? for (i=0;i<106;i++) RVA(0x261b10)[i]=0x90; // disable threads Just to show how utterly insane this code is. You wouldn't want even your worst enemy to have to maintain this. In fact, it seems nobody made major changes to this code ever since it was committed. Most formats can be decoded by libavcodecs these days, and the loader couldn't be used on 64 bit platforms anyway. The same is (probably) true for the other binary codecs. General note about how support for win32 codecs could be added back: It's not possible to replace the win32 loader code by using wine as library, because modern wine can not be linked with native Linux programs for certain reasons. It would be possible to to move DirectShow video decoding into a separate process linked with wine, like the CoreAVC-for-Linux patches do. There is also the mplayer-ww fork, which uses the dshownative library to use DirectShow codecs on Windows.
Diffstat (limited to 'loader/dmo/dmo.c')
-rw-r--r--loader/dmo/dmo.c166
1 files changed, 0 insertions, 166 deletions
diff --git a/loader/dmo/dmo.c b/loader/dmo/dmo.c
deleted file mode 100644
index 0ca7cf3206..0000000000
--- a/loader/dmo/dmo.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Modified for use with MPlayer, detailed changelog at
- * http://svn.mplayerhq.hu/mplayer/trunk/
- */
-
-#include "config.h"
-#include "DMO_Filter.h"
-#include "loader/drv.h"
-#include "loader/com.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "loader/win32.h" // printf macro
-
-void trapbug(void);
-typedef long STDCALL (*GETCLASS) (const GUID*, const GUID*, void**);
-
-void DMO_Filter_Destroy(DMO_Filter* This)
-{
- if (This->m_pOptim)
- This->m_pOptim->vt->Release((IUnknown*)This->m_pOptim);
- if (This->m_pInPlace)
- This->m_pInPlace->vt->Release((IUnknown*)This->m_pInPlace);
- if (This->m_pMedia)
- This->m_pMedia->vt->Release((IUnknown*)This->m_pMedia);
-
- free(This);
-#ifdef WIN32_LOADER
- CodecRelease();
-#endif
-}
-
-DMO_Filter* DMO_FilterCreate(const char* dllname, const GUID* id,
- DMO_MEDIA_TYPE* in_fmt,
- DMO_MEDIA_TYPE* out_fmt)
-{
- HRESULT hr = 0;
- const char* em = NULL;
- DMO_Filter* This = malloc(sizeof(DMO_Filter));
- if (!This)
- return NULL;
-
- memset(This, 0, sizeof(DMO_Filter));
-#ifdef WIN32_LOADER
- CodecAlloc();
-#endif
-
- //This->Start = DS_Filter_Start;
- //This->Stop = DS_Filter_Stop;
-
- for (;;)
- {
- GETCLASS func;
- struct IClassFactory* factory = NULL;
- struct IUnknown* object = NULL;
- unsigned int i;
- unsigned long inputs, outputs;
-
- This->m_iHandle = LoadLibraryA(dllname);
- if (!This->m_iHandle)
- {
- em = "could not open DMO DLL";
- break;
- }
- func = (GETCLASS)GetProcAddress((unsigned)This->m_iHandle, "DllGetClassObject");
- if (!func)
- {
- em = "illegal or corrupt DMO DLL";
- break;
- }
-//trapbug();
- hr = func(id, &IID_IClassFactory, (void*)&factory);
- if (hr || !factory)
- {
- em = "no such class object";
- break;
- }
- hr = factory->vt->CreateInstance(factory, 0, &IID_IUnknown, (void*)&object);
- factory->vt->Release((IUnknown*)factory);
- if (hr || !object)
- {
- em = "class factory failure";
- break;
- }
- hr = object->vt->QueryInterface(object, &IID_IMediaObject, (void*)&This->m_pMedia);
- if (hr == 0)
- {
- /* query for some extra available interface */
- HRESULT r = object->vt->QueryInterface(object, &IID_IMediaObjectInPlace, (void*)&This->m_pInPlace);
- if (r == 0 && This->m_pInPlace)
- printf("DMO dll supports InPlace - PLEASE REPORT to developer\n");
- r = object->vt->QueryInterface(object, &IID_IDMOVideoOutputOptimizations, (void*)&This->m_pOptim);
- if (r == 0 && This->m_pOptim)
- {
- unsigned long flags;
- r = This->m_pOptim->vt->QueryOperationModePreferences(This->m_pOptim, 0, &flags);
- printf("DMO dll supports VO Optimizations %ld %lx\n", r, flags);
- if (flags & DMO_VOSF_NEEDS_PREVIOUS_SAMPLE)
- printf("DMO dll might use previous sample when requested\n");
- }
- }
- object->vt->Release((IUnknown*)object);
- if (hr || !This->m_pMedia)
- {
- em = "object does not provide IMediaObject interface";
- break;
- }
- hr = This->m_pMedia->vt->SetInputType(This->m_pMedia, 0, in_fmt, 0);
- if (hr)
- {
- em = "input format not accepted";
- break;
- }
-
- if (0) {
- DMO_MEDIA_TYPE dmo;
- //VIDEOINFOHEADER* vi;
- memset(&dmo, 0, sizeof(dmo));
- i = This->m_pMedia->vt->GetOutputType(This->m_pMedia, 0, 2, &dmo);
- Debug printf("GetOutputType %x \n", i);
- Debug printf("DMO 0x%x (%.4s) 0x%x (%.4s)\n"
- //Debug printf("DMO 0x%x 0x%x\n"
- ":: fixszsamp:%d tempcomp:%d sampsz:%ld\n"
- ":: formtype: 0x%x\n"
- ":: unk %p cbform: %ld pbform:%p\n",
- dmo.majortype.f1,
- (const char*)&dmo.majortype.f1,
- dmo.subtype.f1,
- (const char*)&dmo.subtype.f1,
- dmo.bFixedSizeSamples, dmo.bTemporalCompression,
- dmo.lSampleSize,
- dmo.formattype.f1,
- dmo.pUnk, dmo.cbFormat, dmo.pbFormat
- );
-/* vi = (VIDEOINFOHEADER*) dmo.pbFormat;
- vi = (VIDEOINFOHEADER*) out_fmt->pbFormat;
- for (i = 0; i < out_fmt->cbFormat; i++)
- Debug printf("BYTE %d %02x %02x\n", i, ((uint8_t*)dmo.pbFormat)[i], ((uint8_t*)out_fmt->pbFormat)[i]);
-*/
- }
-
- hr = This->m_pMedia->vt->SetOutputType(This->m_pMedia, 0, out_fmt, 0);
- if (hr)
- {
- em = "output format no accepted";
- break;
- }
-
- inputs = outputs = 0;
- hr = This->m_pMedia->vt->GetOutputSizeInfo(This->m_pMedia, 0, &inputs, &outputs);
- Debug printf("GetOutput r=0x%lx size:%ld align:%ld\n", hr, inputs, outputs);
-
- // This->m_pMedia->vt->AllocateStreamingResources(This->m_pMedia);
- hr = This->m_pMedia->vt->GetStreamCount(This->m_pMedia, &inputs, &outputs);
- Debug printf("StreamCount r=0x%lx %ld %ld\n", hr, inputs, outputs);
-
- break;
- }
- if (em)
- {
- DMO_Filter_Destroy(This);
- printf("IMediaObject ERROR: %p %s (0x%lx : %ld)\n", em, em ? em : "", hr, hr);
- This = 0;
- }
- return This;
-}