diff options
author | wm4 <wm4@nowhere> | 2012-08-12 15:30:21 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-08-16 17:16:33 +0200 |
commit | aebfbbf2bdda8e18beef90c16da97bd335f7d3b0 (patch) | |
tree | a7362bf3ef6f2d80a47b2e539a2ea4efe5e2e079 /loader/dshow/graph.c | |
parent | c6b03ffef6250096373c4a81a489dae9fbff9087 (diff) | |
download | mpv-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/dshow/graph.c')
-rw-r--r-- | loader/dshow/graph.c | 165 |
1 files changed, 0 insertions, 165 deletions
diff --git a/loader/dshow/graph.c b/loader/dshow/graph.c deleted file mode 100644 index 14517a627f..0000000000 --- a/loader/dshow/graph.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Implemention of FilterGraph. Based on allocator.c. - * Copyright 2010 Steinar H. Gunderson - * - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Modified for use with MPlayer, detailed changelog at - * http://svn.mplayerhq.hu/mplayer/trunk/ - */ - -#include <stdio.h> -#include <stdlib.h> - -#include "config.h" -#include "loader/com.h" -#include "loader/dshow/graph.h" -#include "loader/wine/winerror.h" - -// How many FilterGraph objects exist. -// Used for knowing when to register and unregister the class in COM. -static int GraphKeeper = 0; - -#ifdef WIN32_LOADER -static long FilterGraph_CreateGraph(GUID* clsid, const GUID* iid, void** ppv) -{ - IUnknown* p; - int result; - if (!ppv) - return -1; - *ppv = 0; - if (memcmp(clsid, &CLSID_FilterGraph, sizeof(*clsid))) - return -1; - - p = (IUnknown*) FilterGraphCreate(); - result = p->vt->QueryInterface(p, iid, ppv); - p->vt->Release(p); - - return result; -} -#endif - -static void FilterGraph_Destroy(FilterGraph* This) -{ - Debug printf("FilterGraph_Destroy(%p) called (%d, %d)\n", This, This->refcount, GraphKeeper); -#ifdef WIN32_LOADER - if (--GraphKeeper == 0) - UnregisterComClass(&CLSID_FilterGraph, FilterGraph_CreateGraph); -#endif - free(This->vt); - free(This); -} - -static HRESULT STDCALL FilterGraph_AddFilter(IFilterGraph* This, - IBaseFilter* pFilter, - unsigned short* pName) -{ - Debug printf("FilterGraph_AddFilter(%p) called\n", This); - return E_NOTIMPL; -} - -static HRESULT STDCALL FilterGraph_RemoveFilter(IFilterGraph* This, IBaseFilter* pFilter) -{ - Debug printf("FilterGraph_RemoveFilter(%p) called\n", This); - return E_NOTIMPL; -} - -static HRESULT STDCALL FilterGraph_EnumFilters(IFilterGraph* This, IEnumFilters** ppEnum) -{ - Debug printf("FilterGraph_EnumFilters(%p) called\n", This); - return E_NOTIMPL; -} - -static HRESULT STDCALL FilterGraph_FindFilterByName(IFilterGraph* This, - unsigned short* pName, - IBaseFilter** ppFilter) -{ - Debug printf("FilterGraph_FindFilterByName(%p) called\n", This); - return E_NOTIMPL; -} - -static HRESULT STDCALL FilterGraph_ConnectDirect(IFilterGraph* This, - IPin* ppinOut, - IPin* ppinIn, - const AM_MEDIA_TYPE* pmt) -{ - Debug printf("FilterGraph_ConnectDirect(%p) called\n", This); - return E_NOTIMPL; -} - -static HRESULT STDCALL FilterGraph_Reconnect(IFilterGraph* This, IPin* ppin) -{ - Debug printf("FilterGraph_Reconnect(%p) called\n", This); - return E_NOTIMPL; -} - -static HRESULT STDCALL FilterGraph_Disconnect(IFilterGraph* This, IPin* ppin) -{ - Debug printf("FilterGraph_Disconnect(%p) called\n", This); - return E_NOTIMPL; -} - -static HRESULT STDCALL FilterGraph_SetDefaultSyncSource(IFilterGraph* This) -{ - Debug printf("FilterGraph_SetDefaultSyncSource(%p) called\n", This); - return E_NOTIMPL; -} - -IMPLEMENT_IUNKNOWN(FilterGraph) - -FilterGraph* FilterGraphCreate() -{ - FilterGraph* This = calloc(1, sizeof(*This)); - - if (!This) - return NULL; - - Debug printf("FilterGraphCreate() called -> %p\n", This); - - This->refcount = 1; - - This->vt = calloc(1, sizeof(*This->vt)); - - if (!This->vt) { - free(This); - return NULL; - } - - This->vt->QueryInterface = FilterGraph_QueryInterface; - This->vt->AddRef = FilterGraph_AddRef; - This->vt->Release = FilterGraph_Release; - - This->vt->AddFilter = FilterGraph_AddFilter; - This->vt->RemoveFilter = FilterGraph_RemoveFilter; - This->vt->EnumFilters = FilterGraph_EnumFilters; - This->vt->FindFilterByName = FilterGraph_FindFilterByName; - This->vt->ConnectDirect = FilterGraph_ConnectDirect; - This->vt->Reconnect = FilterGraph_Reconnect; - This->vt->Disconnect = FilterGraph_Disconnect; - This->vt->SetDefaultSyncSource = FilterGraph_SetDefaultSyncSource; - - This->interfaces[0] = IID_IUnknown; - This->interfaces[1] = IID_IFilterGraph; - -#ifdef WIN32_LOADER - if (GraphKeeper++ == 0) - RegisterComClass(&CLSID_FilterGraph, FilterGraph_CreateGraph); -#endif - - return This; -} - |