From aebfbbf2bdda8e18beef90c16da97bd335f7d3b0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 12 Aug 2012 15:30:21 +0200 Subject: 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. --- loader/afl.c | 763 ------ loader/com.h | 82 - loader/debug.h | 12 - loader/dmo/DMO_AudioDecoder.c | 171 -- loader/dmo/DMO_AudioDecoder.h | 20 - loader/dmo/DMO_Filter.h | 39 - loader/dmo/DMO_VideoDecoder.c | 555 ---- loader/dmo/DMO_VideoDecoder.h | 29 - loader/dmo/buffer.c | 119 - loader/dmo/dmo.c | 166 -- loader/dmo/dmo.h | 81 - loader/dmo/dmo_guids.c | 41 - loader/dmo/dmo_guids.h | 35 - loader/dmo/dmo_interfaces.h | 194 -- loader/drv.c | 176 -- loader/drv.h | 18 - loader/dshow/DS_AudioDecoder.c | 192 -- loader/dshow/DS_AudioDecoder.h | 20 - loader/dshow/DS_Filter.c | 318 --- loader/dshow/DS_Filter.h | 42 - loader/dshow/DS_VideoDecoder.c | 916 ------- loader/dshow/DS_VideoDecoder.h | 32 - loader/dshow/allocator.c | 363 --- loader/dshow/allocator.h | 27 - loader/dshow/cmediasample.c | 576 ---- loader/dshow/cmediasample.h | 32 - loader/dshow/graph.c | 165 -- loader/dshow/graph.h | 57 - loader/dshow/guids.c | 83 - loader/dshow/guids.h | 89 - loader/dshow/inputpin.c | 1492 ----------- loader/dshow/inputpin.h | 70 - loader/dshow/interfaces.h | 360 --- loader/dshow/iunk.h | 54 - loader/dshow/libwin32.h | 256 -- loader/dshow/mediatype.c | 161 -- loader/dshow/mediatype.h | 96 - loader/dshow/outputpin.c | 957 ------- loader/dshow/outputpin.h | 32 - loader/elfdll.c | 292 -- loader/ext.c | 593 ----- loader/ext.h | 19 - loader/ldt_keeper.c | 275 -- loader/ldt_keeper.h | 15 - loader/loader.h | 36 - loader/module.c | 1075 -------- loader/pe_image.c | 949 ------- loader/pe_resource.c | 396 --- loader/qt_comp_template.c | 27 - loader/qt_fv.h | 1593 ----------- loader/qtx/qtxsdk/components.h | 757 ------ loader/qtx/qtxsdk/select.h | 72 - loader/registry.c | 531 ---- loader/registry.h | 40 - loader/resource.c | 487 ---- loader/vfl.c | 228 -- loader/win32.c | 5779 ---------------------------------------- loader/win32.h | 34 - loader/wine/avifmt.h | 240 -- loader/wine/basetsd.h | 152 -- loader/wine/debugtools.h | 71 - loader/wine/driver.h | 110 - loader/wine/elfdll.h | 13 - loader/wine/heap.h | 56 - loader/wine/ldt.h | 92 - loader/wine/mmreg.h | 249 -- loader/wine/module.h | 149 -- loader/wine/msacm.h | 935 ------- loader/wine/msacmdrv.h | 203 -- loader/wine/ntdef.h | 93 - loader/wine/objbase.h | 22 - loader/wine/pe_image.h | 81 - loader/wine/poppack.h | 15 - loader/wine/pshpack1.h | 12 - loader/wine/pshpack2.h | 12 - loader/wine/pshpack4.h | 14 - loader/wine/pshpack8.h | 12 - loader/wine/vfw.h | 669 ----- loader/wine/winbase.h | 1777 ------------ loader/wine/windef.h | 628 ----- loader/wine/windows.h | 30 - loader/wine/winerror.h | 1658 ------------ loader/wine/winestring.h | 13 - loader/wine/winnt.h | 2663 ------------------ loader/wine/winreg.h | 49 - loader/wine/winuser.h | 2922 -------------------- loader/wineacm.h | 62 - loader/wrapper.S | 88 - loader/wrapper.h | 19 - 89 files changed, 35198 deletions(-) delete mode 100644 loader/afl.c delete mode 100644 loader/com.h delete mode 100644 loader/debug.h delete mode 100644 loader/dmo/DMO_AudioDecoder.c delete mode 100644 loader/dmo/DMO_AudioDecoder.h delete mode 100644 loader/dmo/DMO_Filter.h delete mode 100644 loader/dmo/DMO_VideoDecoder.c delete mode 100644 loader/dmo/DMO_VideoDecoder.h delete mode 100644 loader/dmo/buffer.c delete mode 100644 loader/dmo/dmo.c delete mode 100644 loader/dmo/dmo.h delete mode 100644 loader/dmo/dmo_guids.c delete mode 100644 loader/dmo/dmo_guids.h delete mode 100644 loader/dmo/dmo_interfaces.h delete mode 100644 loader/drv.c delete mode 100644 loader/drv.h delete mode 100644 loader/dshow/DS_AudioDecoder.c delete mode 100644 loader/dshow/DS_AudioDecoder.h delete mode 100644 loader/dshow/DS_Filter.c delete mode 100644 loader/dshow/DS_Filter.h delete mode 100644 loader/dshow/DS_VideoDecoder.c delete mode 100644 loader/dshow/DS_VideoDecoder.h delete mode 100644 loader/dshow/allocator.c delete mode 100644 loader/dshow/allocator.h delete mode 100644 loader/dshow/cmediasample.c delete mode 100644 loader/dshow/cmediasample.h delete mode 100644 loader/dshow/graph.c delete mode 100644 loader/dshow/graph.h delete mode 100644 loader/dshow/guids.c delete mode 100644 loader/dshow/guids.h delete mode 100644 loader/dshow/inputpin.c delete mode 100644 loader/dshow/inputpin.h delete mode 100644 loader/dshow/interfaces.h delete mode 100644 loader/dshow/iunk.h delete mode 100644 loader/dshow/libwin32.h delete mode 100644 loader/dshow/mediatype.c delete mode 100644 loader/dshow/mediatype.h delete mode 100644 loader/dshow/outputpin.c delete mode 100644 loader/dshow/outputpin.h delete mode 100644 loader/elfdll.c delete mode 100644 loader/ext.c delete mode 100644 loader/ext.h delete mode 100644 loader/ldt_keeper.c delete mode 100644 loader/ldt_keeper.h delete mode 100644 loader/loader.h delete mode 100644 loader/module.c delete mode 100644 loader/pe_image.c delete mode 100644 loader/pe_resource.c delete mode 100644 loader/qt_comp_template.c delete mode 100644 loader/qt_fv.h delete mode 100644 loader/qtx/qtxsdk/components.h delete mode 100644 loader/qtx/qtxsdk/select.h delete mode 100644 loader/registry.c delete mode 100644 loader/registry.h delete mode 100644 loader/resource.c delete mode 100644 loader/vfl.c delete mode 100644 loader/win32.c delete mode 100644 loader/win32.h delete mode 100644 loader/wine/avifmt.h delete mode 100644 loader/wine/basetsd.h delete mode 100644 loader/wine/debugtools.h delete mode 100644 loader/wine/driver.h delete mode 100644 loader/wine/elfdll.h delete mode 100644 loader/wine/heap.h delete mode 100644 loader/wine/ldt.h delete mode 100644 loader/wine/mmreg.h delete mode 100644 loader/wine/module.h delete mode 100644 loader/wine/msacm.h delete mode 100644 loader/wine/msacmdrv.h delete mode 100644 loader/wine/ntdef.h delete mode 100644 loader/wine/objbase.h delete mode 100644 loader/wine/pe_image.h delete mode 100644 loader/wine/poppack.h delete mode 100644 loader/wine/pshpack1.h delete mode 100644 loader/wine/pshpack2.h delete mode 100644 loader/wine/pshpack4.h delete mode 100644 loader/wine/pshpack8.h delete mode 100644 loader/wine/vfw.h delete mode 100644 loader/wine/winbase.h delete mode 100644 loader/wine/windef.h delete mode 100644 loader/wine/windows.h delete mode 100644 loader/wine/winerror.h delete mode 100644 loader/wine/winestring.h delete mode 100644 loader/wine/winnt.h delete mode 100644 loader/wine/winreg.h delete mode 100644 loader/wine/winuser.h delete mode 100644 loader/wineacm.h delete mode 100644 loader/wrapper.S delete mode 100644 loader/wrapper.h (limited to 'loader') diff --git a/loader/afl.c b/loader/afl.c deleted file mode 100644 index b29471cdce..0000000000 --- a/loader/afl.c +++ /dev/null @@ -1,763 +0,0 @@ -/************************************************************************** - - - This file will contain an interface to ACM drivers. - Its content will be based mainly on wine/dlls/msacm32 - actually, for audio decompression only the following functions - are needed: - - acmStreamOpen ( takes formats of src and dest, returns stream handle ) - acmStreamPrepareHeader ( takes stream handler and info on data ) - acmStreamConvert ( the same as PrepareHeader ) - acmStreamUnprepareHeader - acmStreamClose - acmStreamSize - maybe acmStreamReset - - In future I'll also add functions for format enumeration, - but not right now. - - Modified for use with MPlayer, detailed changelog at - http://svn.mplayerhq.hu/mplayer/trunk/ - -***************************************************************************/ -#include "config.h" -#include "debug.h" - -#include "wine/winbase.h" -#include "wine/windef.h" -#include "wine/winuser.h" -#include "wine/vfw.h" -#include "wine/winestring.h" -#include "wine/driver.h" -#include "wine/winerror.h" -#include "wine/msacm.h" -#include "wine/msacmdrv.h" -#include "wineacm.h" -#ifndef __MINGW32__ -#include "ext.h" -#endif -#include "drv.h" - -#include -#include -#include -#pragma pack(1) -#define OpenDriverA DrvOpen -#define CloseDriver DrvClose - -static inline PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has) -{ - return (PWINE_ACMSTREAM)has; -} - -/*********************************************************************** - * acmDriverAddA (MSACM32.2) - */ -MMRESULT WINAPI acmDriverAddA(PHACMDRIVERID phadid, HINSTANCE hinstModule, - LPARAM lParam, DWORD dwPriority, DWORD fdwAdd) -{ - if (!phadid) - return MMSYSERR_INVALPARAM; - - /* Check if any unknown flags */ - if (fdwAdd & - ~(ACM_DRIVERADDF_FUNCTION|ACM_DRIVERADDF_NOTIFYHWND| - ACM_DRIVERADDF_GLOBAL)) - return MMSYSERR_INVALFLAG; - - /* Check if any incompatible flags */ - if ((fdwAdd & ACM_DRIVERADDF_FUNCTION) && - (fdwAdd & ACM_DRIVERADDF_NOTIFYHWND)) - return MMSYSERR_INVALFLAG; - - /* FIXME: in fact, should GetModuleFileName(hinstModule) and do a - * LoadDriver on it, to be sure we can call SendDriverMessage on the - * hDrvr handle. - */ - *phadid = (HACMDRIVERID) MSACM_RegisterDriver(NULL, 0, hinstModule); - - /* FIXME: lParam, dwPriority and fdwAdd ignored */ - - return MMSYSERR_NOERROR; -} - -/*********************************************************************** - * acmDriverClose (MSACM32.4) - */ -MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose) -{ - PWINE_ACMDRIVER p; - PWINE_ACMDRIVER* tp; - - if (fdwClose) - return MMSYSERR_INVALFLAG; - - p = MSACM_GetDriver(had); - if (!p) - return MMSYSERR_INVALHANDLE; - - for (tp = &(p->obj.pACMDriverID->pACMDriverList); *tp; *tp = (*tp)->pNextACMDriver) { - if (*tp == p) { - *tp = (*tp)->pNextACMDriver; - break; - } - } - - if (p->hDrvr && !p->obj.pACMDriverID->pACMDriverList) - CloseDriver(p->hDrvr); - - HeapFree(MSACM_hHeap, 0, p); - - return MMSYSERR_NOERROR; -} - -/*********************************************************************** - * acmDriverEnum (MSACM32.7) - */ -MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum) -{ - PWINE_ACMDRIVERID p; - DWORD fdwSupport; - - if (!fnCallback) { - return MMSYSERR_INVALPARAM; - } - - if (fdwEnum && ~(ACM_DRIVERENUMF_NOLOCAL|ACM_DRIVERENUMF_DISABLED)) { - return MMSYSERR_INVALFLAG; - } - - for (p = MSACM_pFirstACMDriverID; p; p = p->pNextACMDriverID) { - fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; - if (!p->bEnabled) { - if (fdwEnum & ACM_DRIVERENUMF_DISABLED) - fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED; - else - continue; - } - (*fnCallback)((HACMDRIVERID) p, dwInstance, fdwSupport); - } - - return MMSYSERR_NOERROR; -} - -/*********************************************************************** - * acmDriverID (MSACM32.8) - */ -MMRESULT WINAPI acmDriverID(HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID) -{ - PWINE_ACMOBJ pao; - - pao = MSACM_GetObj(hao); - if (!pao) - return MMSYSERR_INVALHANDLE; - - if (!phadid) - return MMSYSERR_INVALPARAM; - - if (fdwDriverID) - return MMSYSERR_INVALFLAG; - - *phadid = (HACMDRIVERID) pao->pACMDriverID; - - return MMSYSERR_NOERROR; -} - -/*********************************************************************** - * acmDriverMessage (MSACM32.9) - * FIXME - * Not implemented - */ -LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2) -{ - PWINE_ACMDRIVER pad = MSACM_GetDriver(had); - if (!pad) - return MMSYSERR_INVALPARAM; - - /* FIXME: Check if uMsg legal */ - - if (!SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2)) - return MMSYSERR_NOTSUPPORTED; - - return MMSYSERR_NOERROR; -} - - -/*********************************************************************** - * acmDriverOpen (MSACM32.10) - */ -MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen) -{ - PWINE_ACMDRIVERID padid; - PWINE_ACMDRIVER pad; - ICOPEN icopen; - - - TRACE("(%p, %x, %08lu)\n", phad, hadid, fdwOpen); - - if (!phad) - return MMSYSERR_INVALPARAM; - - padid = MSACM_GetDriverID(hadid); - if (!padid) - return MMSYSERR_INVALHANDLE; - - if (fdwOpen) - return MMSYSERR_INVALFLAG; - - pad = (PWINE_ACMDRIVER) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER)); - if (!pad) - return MMSYSERR_NOMEM; - - pad->obj.pACMDriverID = padid; - icopen.fccType = mmioFOURCC('a', 'u', 'd', 'c'); - icopen.fccHandler = (long)padid->pszFileName; - icopen.dwSize = sizeof(ICOPEN); - icopen.dwFlags = 0; - - icopen.pV1Reserved = padid->pszFileName; - if (!padid->hInstModule) - pad->hDrvr = OpenDriverA((long)&icopen); - else - pad->hDrvr = padid->hInstModule; - - if (!pad->hDrvr) { - HeapFree(MSACM_hHeap, 0, pad); - return MMSYSERR_ERROR; - } - - pad->pfnDriverProc = (DRIVERPROC)GetProcAddress(pad->hDrvr, "DriverProc"); - - /* insert new pad at beg of list */ - pad->pNextACMDriver = padid->pACMDriverList; - padid->pACMDriverList = pad; - - /* FIXME: Create a WINE_ACMDRIVER32 */ - *phad = (HACMDRIVER)pad; - - return MMSYSERR_NOERROR; -} - -/*********************************************************************** - * acmDriverRemove (MSACM32.12) - */ -MMRESULT WINAPI acmDriverRemove(HACMDRIVERID hadid, DWORD fdwRemove) -{ - PWINE_ACMDRIVERID padid; - - padid = MSACM_GetDriverID(hadid); - if (!padid) - return MMSYSERR_INVALHANDLE; - - if (fdwRemove) - return MMSYSERR_INVALFLAG; - - MSACM_UnregisterDriver(padid); - - return MMSYSERR_NOERROR; -} - - - -/**********************************************************************/ - -HANDLE MSACM_hHeap = (HANDLE) NULL; -PWINE_ACMDRIVERID MSACM_pFirstACMDriverID = NULL; -PWINE_ACMDRIVERID MSACM_pLastACMDriverID = NULL; - -/*********************************************************************** - * MSACM_RegisterDriver32() - */ -PWINE_ACMDRIVERID MSACM_RegisterDriver(const char* pszFileName, - WORD wFormatTag, - HINSTANCE hinstModule) -{ - PWINE_ACMDRIVERID padid; - - TRACE("('%s', '%x', 0x%08x)\n", pszFileName, wFormatTag, hinstModule); - -#ifndef WIN32_LOADER - MSACM_hHeap = GetProcessHeap(); -#endif - padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID)); - padid->pszFileName = malloc(strlen(pszFileName)+1); - strcpy(padid->pszFileName, pszFileName); -// 1~strdup(pszDriverAlias); - padid->wFormatTag = wFormatTag; - padid->hInstModule = hinstModule; - padid->bEnabled = TRUE; - padid->pACMDriverList = NULL; - padid->pNextACMDriverID = NULL; - padid->pPrevACMDriverID = MSACM_pLastACMDriverID; - if (MSACM_pLastACMDriverID) - MSACM_pLastACMDriverID->pNextACMDriverID = padid; - MSACM_pLastACMDriverID = padid; - if (!MSACM_pFirstACMDriverID) - MSACM_pFirstACMDriverID = padid; - - return padid; -} - - -/*********************************************************************** - * MSACM_UnregisterDriver32() - */ -PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p) -{ - PWINE_ACMDRIVERID pNextACMDriverID; - - while (p->pACMDriverList) - acmDriverClose((HACMDRIVER) p->pACMDriverList, 0); - - free(p->pszFileName); - - if (p == MSACM_pFirstACMDriverID) - MSACM_pFirstACMDriverID = p->pNextACMDriverID; - if (p == MSACM_pLastACMDriverID) - MSACM_pLastACMDriverID = p->pPrevACMDriverID; - - if (p->pPrevACMDriverID) - p->pPrevACMDriverID->pNextACMDriverID = p->pNextACMDriverID; - if (p->pNextACMDriverID) - p->pNextACMDriverID->pPrevACMDriverID = p->pPrevACMDriverID; - - pNextACMDriverID = p->pNextACMDriverID; - - HeapFree(MSACM_hHeap, 0, p); - - return pNextACMDriverID; -} - -/*********************************************************************** - * MSACM_UnregisterAllDrivers32() - * FIXME - * Where should this function be called? - */ -void MSACM_UnregisterAllDrivers(void) -{ - PWINE_ACMDRIVERID p; - - for (p = MSACM_pFirstACMDriverID; p; p = MSACM_UnregisterDriver(p)); -} - -/*********************************************************************** - * MSACM_GetDriverID32() - */ -PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID) -{ - return (PWINE_ACMDRIVERID)hDriverID; -} - -/*********************************************************************** - * MSACM_GetDriver32() - */ -PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver) -{ - return (PWINE_ACMDRIVER)hDriver; -} - -/*********************************************************************** - * MSACM_GetObj32() - */ -PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj) -{ - return (PWINE_ACMOBJ)hObj; -} - - - -/*********************************************************************** - * acmStreamOpen (MSACM32.40) - */ -MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc, - PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD dwCallback, - DWORD dwInstance, DWORD fdwOpen) -{ - PWINE_ACMSTREAM was; - PWINE_ACMDRIVER wad; - MMRESULT ret; - int wfxSrcSize; - int wfxDstSize; - - TRACE("(%p, 0x%08x, %p, %p, %p, %ld, %ld, %ld)\n", - phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen); - - TRACE("src [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", - pwfxSrc->wFormatTag, pwfxSrc->nChannels, pwfxSrc->nSamplesPerSec, pwfxSrc->nAvgBytesPerSec, - pwfxSrc->nBlockAlign, pwfxSrc->wBitsPerSample, pwfxSrc->cbSize); - - TRACE("dst [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", - pwfxDst->wFormatTag, pwfxDst->nChannels, pwfxDst->nSamplesPerSec, pwfxDst->nAvgBytesPerSec, - pwfxDst->nBlockAlign, pwfxDst->wBitsPerSample, pwfxDst->cbSize); - -#define SIZEOF_WFX(wfx) (sizeof(WAVEFORMATEX) + ((wfx->wFormatTag == WAVE_FORMAT_PCM) ? 0 : wfx->cbSize)) - wfxSrcSize = SIZEOF_WFX(pwfxSrc); - wfxDstSize = SIZEOF_WFX(pwfxDst); -#undef SIZEOF_WFX - - was = (PWINE_ACMSTREAM) HeapAlloc(MSACM_hHeap, 0, sizeof(*was) + wfxSrcSize + wfxDstSize + ((pwfltr) ? sizeof(WAVEFILTER) : 0)); - if (was == NULL) - return MMSYSERR_NOMEM; - was->drvInst.cbStruct = sizeof(was->drvInst); - was->drvInst.pwfxSrc = (PWAVEFORMATEX)(was + 1); - memcpy(was->drvInst.pwfxSrc, pwfxSrc, wfxSrcSize); - // LHACM is checking for 0x1 - // but if this will not help - // was->drvInst.pwfxSrc->wFormatTag = 1; - was->drvInst.pwfxDst = (PWAVEFORMATEX)((LPSTR)(was + 1) + wfxSrcSize); - memcpy(was->drvInst.pwfxDst, pwfxDst, wfxDstSize); - if (pwfltr) { - was->drvInst.pwfltr = (PWAVEFILTER)((LPSTR)(was + 1) + wfxSrcSize + wfxDstSize); - memcpy(was->drvInst.pwfltr, pwfltr, sizeof(WAVEFILTER)); - } else { - was->drvInst.pwfltr = NULL; - } - was->drvInst.dwCallback = dwCallback; - was->drvInst.dwInstance = dwInstance; - was->drvInst.fdwOpen = fdwOpen; - was->drvInst.fdwDriver = 0L; - was->drvInst.dwDriver = 0L; - was->drvInst.has = (HACMSTREAM)was; - - if (had) { - if (!(wad = MSACM_GetDriver(had))) { - ret = MMSYSERR_INVALPARAM; - goto errCleanUp; - } - - was->obj.pACMDriverID = wad->obj.pACMDriverID; - was->pDrv = wad; - was->hAcmDriver = 0; /* not to close it in acmStreamClose */ - - ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L); - if (ret != MMSYSERR_NOERROR) - goto errCleanUp; - } else { - PWINE_ACMDRIVERID wadi; - //short drv_tag; - ret = ACMERR_NOTPOSSIBLE; -/* if(pwfxSrc->wFormatTag==1)//compression - drv_tag=pwfxDst->wFormatTag; - else - if(pwfxDst->wFormatTag==1)//decompression - drv_tag=pwfxSrc->wFormatTag; - else - goto errCleanUp; - - ret=acmDriverOpen2(drv_tag); - if (ret == MMSYSERR_NOERROR) { - if ((wad = MSACM_GetDriver(had)) != 0) { - was->obj.pACMDriverID = wad->obj.pACMDriverID; - was->pDrv = wad; - was->hAcmDriver = had; - - ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L); - if (ret == MMSYSERR_NOERROR) { - if (fdwOpen & ACM_STREAMOPENF_QUERY) { - acmDriverClose(had, 0L); - } - break; - } - } - acmDriverClose(had, 0L);*/ - //if(MSACM_pFirstACMDriverID==NULL) - // MSACM_RegisterAllDrivers(); - - for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID) - { - /* Check Format */ - if ((int)wadi->wFormatTag != (int)pwfxSrc->wFormatTag) continue; - - ret = acmDriverOpen(&had, (HACMDRIVERID)wadi, 0L); - if (ret == MMSYSERR_NOERROR) { - if ((wad = MSACM_GetDriver(had)) != 0) { - was->obj.pACMDriverID = wad->obj.pACMDriverID; - was->pDrv = wad; - was->hAcmDriver = had; - - ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L); - //lhacm - crash printf("RETOPEN %d\n", ret); - //ret = 0; - if (ret == MMSYSERR_NOERROR) { - if (fdwOpen & ACM_STREAMOPENF_QUERY) { - acmDriverClose(had, 0L); - } - break; - } - } - // no match, close this acm driver and try next one - acmDriverClose(had, 0L); - } - } - if (ret != MMSYSERR_NOERROR) { - ret = ACMERR_NOTPOSSIBLE; - goto errCleanUp; - } - } - ret = MMSYSERR_NOERROR; - if (!(fdwOpen & ACM_STREAMOPENF_QUERY)) { - if (phas) - *phas = (HACMSTREAM)was; - TRACE("=> (%d)\n", ret); -#ifdef WIN32_LOADER - CodecAlloc(); -#endif - return ret; - } -errCleanUp: - if (phas) - *phas = (HACMSTREAM)0; - HeapFree(MSACM_hHeap, 0, was); - TRACE("=> (%d)\n", ret); - return ret; -} - - -MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose) -{ - PWINE_ACMSTREAM was; - MMRESULT ret; - - TRACE("(0x%08x, %ld)\n", has, fdwClose); - - if ((was = ACM_GetStream(has)) == NULL) { - return MMSYSERR_INVALHANDLE; - } - ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CLOSE, (DWORD)&was->drvInst, 0); - if (ret == MMSYSERR_NOERROR) { - if (was->hAcmDriver) - acmDriverClose(was->hAcmDriver, 0L); - HeapFree(MSACM_hHeap, 0, was); -#ifdef WIN32_LOADER - CodecRelease(); -#endif - } - TRACE("=> (%d)\n", ret); - return ret; -} - -/*********************************************************************** - * acmStreamConvert (MSACM32.38) - */ -MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, - DWORD fdwConvert) -{ - PWINE_ACMSTREAM was; - MMRESULT ret = MMSYSERR_NOERROR; - PACMDRVSTREAMHEADER padsh; - - TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwConvert); - - if ((was = ACM_GetStream(has)) == NULL) - return MMSYSERR_INVALHANDLE; - if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) - return MMSYSERR_INVALPARAM; - - if (!(pash->fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED)) - return ACMERR_UNPREPARED; - - /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same - * size. some fields are private to msacm internals, and are exposed - * in ACMSTREAMHEADER in the dwReservedDriver array - */ - padsh = (PACMDRVSTREAMHEADER)pash; - - /* check that pointers have not been modified */ - if (padsh->pbPreparedSrc != padsh->pbSrc || - padsh->cbPreparedSrcLength < padsh->cbSrcLength || - padsh->pbPreparedDst != padsh->pbDst || - padsh->cbPreparedDstLength < padsh->cbDstLength) { - return MMSYSERR_INVALPARAM; - } - - padsh->fdwConvert = fdwConvert; - - ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CONVERT, (DWORD)&was->drvInst, (DWORD)padsh); - if (ret == MMSYSERR_NOERROR) { - padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_DONE; - } - TRACE("=> (%d)\n", ret); - return ret; -} - - -/*********************************************************************** - * acmStreamPrepareHeader (MSACM32.41) - */ -MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, - DWORD fdwPrepare) -{ - PWINE_ACMSTREAM was; - MMRESULT ret = MMSYSERR_NOERROR; - PACMDRVSTREAMHEADER padsh; - - TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwPrepare); - - if ((was = ACM_GetStream(has)) == NULL) - return MMSYSERR_INVALHANDLE; - if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) - return MMSYSERR_INVALPARAM; - if (fdwPrepare) - ret = MMSYSERR_INVALFLAG; - - if (pash->fdwStatus & ACMSTREAMHEADER_STATUSF_DONE) - return MMSYSERR_NOERROR; - - /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same - * size. some fields are private to msacm internals, and are exposed - * in ACMSTREAMHEADER in the dwReservedDriver array - */ - padsh = (PACMDRVSTREAMHEADER)pash; - - padsh->fdwConvert = fdwPrepare; - padsh->padshNext = NULL; - padsh->fdwDriver = padsh->dwDriver = 0L; - - padsh->fdwPrepared = 0; - padsh->dwPrepared = 0; - padsh->pbPreparedSrc = 0; - padsh->cbPreparedSrcLength = 0; - padsh->pbPreparedDst = 0; - padsh->cbPreparedDstLength = 0; - - ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_PREPARE, (DWORD)&was->drvInst, (DWORD)padsh); - if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) { - ret = MMSYSERR_NOERROR; - padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE); - padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_PREPARED; - padsh->fdwPrepared = padsh->fdwStatus; - padsh->dwPrepared = 0; - padsh->pbPreparedSrc = padsh->pbSrc; - padsh->cbPreparedSrcLength = padsh->cbSrcLength; - padsh->pbPreparedDst = padsh->pbDst; - padsh->cbPreparedDstLength = padsh->cbDstLength; - } else { - padsh->fdwPrepared = 0; - padsh->dwPrepared = 0; - padsh->pbPreparedSrc = 0; - padsh->cbPreparedSrcLength = 0; - padsh->pbPreparedDst = 0; - padsh->cbPreparedDstLength = 0; - } - TRACE("=> (%d)\n", ret); - return ret; -} - -/*********************************************************************** - * acmStreamReset (MSACM32.42) - */ -MMRESULT WINAPI acmStreamReset(HACMSTREAM has, DWORD fdwReset) -{ - PWINE_ACMSTREAM was; - MMRESULT ret = MMSYSERR_NOERROR; - - TRACE("(0x%08x, %ld)\n", has, fdwReset); - - if (fdwReset) { - ret = MMSYSERR_INVALFLAG; - } else if ((was = ACM_GetStream(has)) == NULL) { - return MMSYSERR_INVALHANDLE; - } else if (was->drvInst.fdwOpen & ACM_STREAMOPENF_ASYNC) { - ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_RESET, (DWORD)&was->drvInst, 0); - } - TRACE("=> (%d)\n", ret); - return ret; -} - -/*********************************************************************** - * acmStreamSize (MSACM32.43) - */ -MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, - LPDWORD pdwOutputBytes, DWORD fdwSize) -{ - PWINE_ACMSTREAM was; - ACMDRVSTREAMSIZE adss; - MMRESULT ret; - - TRACE("(0x%08x, %ld, %p, %ld)\n", has, cbInput, pdwOutputBytes, fdwSize); - - if ((was = ACM_GetStream(has)) == NULL) { - return MMSYSERR_INVALHANDLE; - } - if ((fdwSize & ~ACM_STREAMSIZEF_QUERYMASK) != 0) { - return MMSYSERR_INVALFLAG; - } - - *pdwOutputBytes = 0L; - - switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) { - case ACM_STREAMSIZEF_DESTINATION: - adss.cbDstLength = cbInput; - adss.cbSrcLength = 0; - break; - case ACM_STREAMSIZEF_SOURCE: - adss.cbSrcLength = cbInput; - adss.cbDstLength = 0; - break; - default: - return MMSYSERR_INVALFLAG; - } - - adss.cbStruct = sizeof(adss); - adss.fdwSize = fdwSize; - ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_SIZE, - (DWORD)&was->drvInst, (DWORD)&adss); - if (ret == MMSYSERR_NOERROR) { - switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) { - case ACM_STREAMSIZEF_DESTINATION: - *pdwOutputBytes = adss.cbSrcLength; - break; - case ACM_STREAMSIZEF_SOURCE: - *pdwOutputBytes = adss.cbDstLength; - break; - } - } - TRACE("=> (%d) [%lu]\n", ret, *pdwOutputBytes); - return ret; -} - -/*********************************************************************** - * acmStreamUnprepareHeader (MSACM32.44) - */ -MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, - DWORD fdwUnprepare) -{ - PWINE_ACMSTREAM was; - MMRESULT ret = MMSYSERR_NOERROR; - PACMDRVSTREAMHEADER padsh; - - TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwUnprepare); - - if ((was = ACM_GetStream(has)) == NULL) - return MMSYSERR_INVALHANDLE; - if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) - return MMSYSERR_INVALPARAM; - - if (!(pash->fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED)) - return ACMERR_UNPREPARED; - - /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same - * size. some fields are private to msacm internals, and are exposed - * in ACMSTREAMHEADER in the dwReservedDriver array - */ - padsh = (PACMDRVSTREAMHEADER)pash; - - /* check that pointers have not been modified */ - if (padsh->pbPreparedSrc != padsh->pbSrc || - padsh->cbPreparedSrcLength < padsh->cbSrcLength || - padsh->pbPreparedDst != padsh->pbDst || - padsh->cbPreparedDstLength < padsh->cbDstLength) { - return MMSYSERR_INVALPARAM; - } - - padsh->fdwConvert = fdwUnprepare; - - ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_UNPREPARE, (DWORD)&was->drvInst, (DWORD)padsh); - if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) { - ret = MMSYSERR_NOERROR; - padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE|ACMSTREAMHEADER_STATUSF_PREPARED); - } - TRACE("=> (%d)\n", ret); - return ret; -} diff --git a/loader/com.h b/loader/com.h deleted file mode 100644 index 3e9a94bd67..0000000000 --- a/loader/com.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Modified for use with MPlayer, detailed changelog at - * http://svn.mplayerhq.hu/mplayer/trunk/ - */ - -#ifndef MPLAYER_COM_H -#define MPLAYER_COM_H - -#include "config.h" - -#ifdef HAVE_STDINT_H -#include -#else -#include -#endif - -/** - * Internal functions and structures for COM emulation code. - */ - -#ifndef GUID_TYPE -#define GUID_TYPE -typedef struct -{ - uint32_t f1; - uint16_t f2; - uint16_t f3; - uint8_t f4[8]; -} GUID; -#endif - -extern const GUID IID_IUnknown; -extern const GUID IID_IClassFactory; - -typedef long (*GETCLASSOBJECT) (GUID* clsid, const GUID* iid, void** ppv); -int RegisterComClass(const GUID* clsid, GETCLASSOBJECT gcs); -int UnregisterComClass(const GUID* clsid, GETCLASSOBJECT gcs); - -#ifndef STDCALL -#define STDCALL __attribute__((__stdcall__)) -#endif - -struct IUnknown; -struct IClassFactory; -struct IUnknown_vt -{ - long STDCALL (*QueryInterface)(struct IUnknown* this, const GUID* iid, void** ppv); - long STDCALL (*AddRef)(struct IUnknown* this) ; - long STDCALL (*Release)(struct IUnknown* this) ; -} ; - -typedef struct IUnknown -{ - struct IUnknown_vt* vt; -} IUnknown; - -struct IClassFactory_vt -{ - long STDCALL (*QueryInterface)(struct IUnknown* this, const GUID* iid, void** ppv); - long STDCALL (*AddRef)(struct IUnknown* this) ; - long STDCALL (*Release)(struct IUnknown* this) ; - long STDCALL (*CreateInstance)(struct IClassFactory* this, struct IUnknown* pUnkOuter, const GUID* riid, void** ppvObject); -}; - -struct IClassFactory -{ - struct IClassFactory_vt* vt; -}; - -#ifdef WIN32_LOADER -long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter, - long dwClsContext, const GUID* riid, void** ppv); -void* CoTaskMemAlloc(unsigned long cb); -void CoTaskMemFree(void* cb); -#else -long STDCALL CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter, - long dwClsContext, const GUID* riid, void** ppv); -void* STDCALL CoTaskMemAlloc(unsigned long); -void STDCALL CoTaskMemFree(void*); -#endif - -#endif /* MPLAYER_COM_H */ diff --git a/loader/debug.h b/loader/debug.h deleted file mode 100644 index ad3c9d5a46..0000000000 --- a/loader/debug.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef MPLAYER_DEBUG_H -#define MPLAYER_DEBUG_H - -#ifdef DEBUG -#define TRACE printf -#define dbg_printf printf -#else -#define TRACE(...) -#define dbg_printf(...) -#endif - -#endif /* MPLAYER_DEBUG_H */ diff --git a/loader/dmo/DMO_AudioDecoder.c b/loader/dmo/DMO_AudioDecoder.c deleted file mode 100644 index 37a32f2923..0000000000 --- a/loader/dmo/DMO_AudioDecoder.c +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************** - - DirectShow audio decoder - Copyright 2001 Eugene Kuznetsov (divx@euro.ru) - -*********************************************************/ -#include "config.h" -#include "loader/dshow/libwin32.h" -#ifdef WIN32_LOADER -#include "loader/ldt_keeper.h" -#endif - -#include "DMO_Filter.h" -#include "DMO_AudioDecoder.h" - -struct DMO_AudioDecoder -{ - DMO_MEDIA_TYPE m_sOurType, m_sDestType; - DMO_Filter* m_pDMO_Filter; - char* m_sVhdr; - char* m_sVhdr2; - int m_iFlushed; -}; - -#include "DMO_AudioDecoder.h" - -#include -#include -#include - -#include "mp_msg.h" -#include "libmpdemux/aviprint.h" - -typedef long STDCALL (*GETCLASS) (GUID*, GUID*, void**); - -DMO_AudioDecoder * DMO_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf,int out_channels) -//DMO_AudioDecoder * DMO_AudioDecoder_Create(const CodecInfo * info, const WAVEFORMATEX* wf) -{ - DMO_AudioDecoder *this; - int sz; - WAVEFORMATEX* pWF; - -#ifdef WIN32_LOADER - Setup_LDT_Keeper(); - Setup_FS_Segment(); -#endif - - this = malloc(sizeof(DMO_AudioDecoder)); - - this->m_iFlushed=1; - - sz = 18 + wf->cbSize; - this->m_sVhdr = malloc(sz); - memcpy(this->m_sVhdr, wf, sz); - this->m_sVhdr2 = malloc(18); - memcpy(this->m_sVhdr2, this->m_sVhdr, 18); - - pWF = (WAVEFORMATEX*)this->m_sVhdr2; - pWF->wFormatTag = 1; - pWF->wBitsPerSample = 16; - pWF->nChannels = out_channels; - pWF->nBlockAlign = 2*pWF->nChannels; //pWF->nChannels * (pWF->wBitsPerSample + 7) / 8; - pWF->nAvgBytesPerSec = pWF->nBlockAlign * pWF->nSamplesPerSec; - pWF->cbSize = 0; - - memset(&this->m_sOurType, 0, sizeof(this->m_sOurType)); - this->m_sOurType.majortype=MEDIATYPE_Audio; - this->m_sOurType.subtype=MEDIASUBTYPE_PCM; - this->m_sOurType.subtype.f1=wf->wFormatTag; - this->m_sOurType.formattype=FORMAT_WaveFormatEx; - this->m_sOurType.lSampleSize=wf->nBlockAlign; - this->m_sOurType.bFixedSizeSamples=1; - this->m_sOurType.bTemporalCompression=0; - this->m_sOurType.cbFormat=sz; - this->m_sOurType.pbFormat=this->m_sVhdr; - - memset(&this->m_sDestType, 0, sizeof(this->m_sDestType)); - this->m_sDestType.majortype=MEDIATYPE_Audio; - this->m_sDestType.subtype=MEDIASUBTYPE_PCM; - this->m_sDestType.formattype=FORMAT_WaveFormatEx; - this->m_sDestType.bFixedSizeSamples=1; - this->m_sDestType.bTemporalCompression=0; - this->m_sDestType.lSampleSize=pWF->nBlockAlign; - this->m_sDestType.cbFormat=18; //pWF->cbSize; - this->m_sDestType.pbFormat=this->m_sVhdr2; - -print_wave_header((WAVEFORMATEX *)this->m_sVhdr, MSGL_V); -print_wave_header((WAVEFORMATEX *)this->m_sVhdr2, MSGL_V); - - this->m_pDMO_Filter = DMO_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType); - if( !this->m_pDMO_Filter ) { - free(this); - return NULL; - } - - return this; -} - -void DMO_AudioDecoder_Destroy(DMO_AudioDecoder *this) -{ - free(this->m_sVhdr); - free(this->m_sVhdr2); - DMO_Filter_Destroy(this->m_pDMO_Filter); - free(this); -} - -int DMO_AudioDecoder_Convert(DMO_AudioDecoder *this, const void* in_data, unsigned int in_size, - void* out_data, unsigned int out_size, - unsigned int* size_read, unsigned int* size_written) -{ - DMO_OUTPUT_DATA_BUFFER db; - CMediaBuffer* bufferin; - unsigned long written = 0; - unsigned long read = 0; - int r = 0; - - if (!in_data || !out_data) - return -1; - -#ifdef WIN32_LOADER - Setup_FS_Segment(); -#endif - - //m_pDMO_Filter->m_pMedia->vt->Lock(m_pDMO_Filter->m_pMedia, 1); - bufferin = CMediaBufferCreate(in_size, (void*)in_data, in_size, 1); - r = this->m_pDMO_Filter->m_pMedia->vt->ProcessInput(this->m_pDMO_Filter->m_pMedia, 0, - (IMediaBuffer*)bufferin, - (this->m_iFlushed) ? DMO_INPUT_DATA_BUFFERF_SYNCPOINT : 0, - 0, 0); - if (r == 0){ - ((IMediaBuffer*)bufferin)->vt->GetBufferAndLength((IMediaBuffer*)bufferin, 0, &read); - this->m_iFlushed = 0; - } - - ((IMediaBuffer*)bufferin)->vt->Release((IUnknown*)bufferin); - - //printf("RESULTA: %d 0x%x %ld %d %d\n", r, r, read, m_iFlushed, out_size); - if (r == 0 || (unsigned)r == DMO_E_NOTACCEPTING){ - unsigned long status = 0; - /* something for process */ - db.rtTimestamp = 0; - db.rtTimelength = 0; - db.dwStatus = 0; - db.pBuffer = (IMediaBuffer*) CMediaBufferCreate(out_size, out_data, 0, 0); - //printf("OUTSIZE %d\n", out_size); - r = this->m_pDMO_Filter->m_pMedia->vt->ProcessOutput(this->m_pDMO_Filter->m_pMedia, - 0, 1, &db, &status); - - ((IMediaBuffer*)db.pBuffer)->vt->GetBufferAndLength((IMediaBuffer*)db.pBuffer, 0, &written); - ((IMediaBuffer*)db.pBuffer)->vt->Release((IUnknown*)db.pBuffer); - - //printf("RESULTB: %d 0x%x %ld\n", r, r, written); - //printf("Converted %d -> %d\n", in_size, out_size); - } - else if (in_size > 0) - printf("ProcessInputError r:0x%x=%d\n", r, r); - - if (size_read) - *size_read = read; - if (size_written) - *size_written = written; - return r; -} - -int DMO_AudioDecoder_GetSrcSize(DMO_AudioDecoder *this, int dest_size) -{ -// unsigned long inputs, outputs; -// Setup_FS_Segment(); -// this->m_pDMO_Filter->m_pMedia->vt->GetOutputSizeInfo(this->m_pDMO_Filter->m_pMedia, 0, &inputs, &outputs); - return ((WAVEFORMATEX*)this->m_sVhdr)->nBlockAlign*4; -} diff --git a/loader/dmo/DMO_AudioDecoder.h b/loader/dmo/DMO_AudioDecoder.h deleted file mode 100644 index d7d0035c84..0000000000 --- a/loader/dmo/DMO_AudioDecoder.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef MPLAYER_DMO_AUDIODECODER_H -#define MPLAYER_DMO_AUDIODECODER_H - -#include "loader/com.h" -#include "loader/wine/mmreg.h" - -typedef struct DMO_AudioDecoder DMO_AudioDecoder; - -//DMO_AudioDecoder * DMO_AudioDecoder_Create(const CodecInfo * info, const WAVEFORMATEX* wf); -DMO_AudioDecoder * DMO_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf,int out_channels); - -void DMO_AudioDecoder_Destroy(DMO_AudioDecoder *this); - -int DMO_AudioDecoder_Convert(DMO_AudioDecoder *this, const void* in_data, unsigned int in_size, - void* out_data, unsigned int out_size, - unsigned int* size_read, unsigned int* size_written); - -int DMO_AudioDecoder_GetSrcSize(DMO_AudioDecoder *this, int dest_size); - -#endif /* MPLAYER_DMO_AUDIODECODER_H */ diff --git a/loader/dmo/DMO_Filter.h b/loader/dmo/DMO_Filter.h deleted file mode 100644 index 0273245669..0000000000 --- a/loader/dmo/DMO_Filter.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef MPLAYER_DMO_FILTER_H -#define MPLAYER_DMO_FILTER_H - -#include "dmo_guids.h" -#include "dmo_interfaces.h" - -typedef struct DMO_Filter -{ - int m_iHandle; - IDMOVideoOutputOptimizations* m_pOptim; - IMediaObject* m_pMedia; - IMediaObjectInPlace* m_pInPlace; - AM_MEDIA_TYPE *m_pOurType, *m_pDestType; -} DMO_Filter; - -typedef struct CMediaBuffer CMediaBuffer; - -/** - * Create DMO_Filter object - similar syntax as for DS_Filter - */ -DMO_Filter* DMO_FilterCreate(const char* dllname, const GUID* id, - AM_MEDIA_TYPE* in_fmt, AM_MEDIA_TYPE* out_fmt); -/** - * Destroy DMO_Filter object - release all allocated resources - */ -void DMO_Filter_Destroy(DMO_Filter* This); - - -/** - * Create IMediaBuffer object - to pass/receive data from DMO_Filter - * - * maxlen - maximum size for this buffer - * mem - initial memory 0 - creates memory - * len - initial size of used portion of the buffer - * copy - make a local copy of data - */ -CMediaBuffer* CMediaBufferCreate(unsigned long maxlen, void* mem, unsigned long len, int copy); - -#endif /* MPLAYER_DMO_FILTER_H */ diff --git a/loader/dmo/DMO_VideoDecoder.c b/loader/dmo/DMO_VideoDecoder.c deleted file mode 100644 index dcc0affe2c..0000000000 --- a/loader/dmo/DMO_VideoDecoder.c +++ /dev/null @@ -1,555 +0,0 @@ -/******************************************************** - - DirectShow Video decoder implementation - Copyright 2000 Eugene Kuznetsov (divx@euro.ru) - -*********************************************************/ -#include "config.h" -#include "loader/dshow/guids.h" -#include "loader/dshow/interfaces.h" -#include "loader/registry.h" -#ifdef WIN32_LOADER -#include "loader/ldt_keeper.h" -#endif - -#include "loader/dshow/libwin32.h" -#include "DMO_Filter.h" - -#include "DMO_VideoDecoder.h" - -struct DMO_VideoDecoder -{ - IVideoDecoder iv; - - DMO_Filter* m_pDMO_Filter; - AM_MEDIA_TYPE m_sOurType, m_sDestType; - VIDEOINFOHEADER* m_sVhdr; - VIDEOINFOHEADER* m_sVhdr2; - int m_Caps;//CAPS m_Caps; // capabilities of DirectShow decoder - int m_iLastQuality; // remember last quality as integer - int m_iMinBuffers; - int m_iMaxAuto; -}; - -//#include "DMO_VideoDecoder.h" - -#include "loader/wine/winerror.h" - -#include -#include -#include -#include -#ifdef HAVE_SYS_MMAN_H -#include -#endif -#include -#include // labs - -// strcmp((const char*)info.dll,...) is used instead of (... == ...) -// so Arpi could use char* pointer in his simplified DMO_VideoDecoder class - -#define false 0 -#define true 1 - - -//int DMO_VideoDecoder_GetCapabilities(DMO_VideoDecoder *this){return this->m_Caps;} - -typedef struct ct ct; - -struct ct { - fourcc_t fcc; - unsigned int bits; - const GUID* subtype; - int cap; - char *name; - }; - -static ct check[] = { - { fccI420, 12, &MEDIASUBTYPE_I420, CAP_I420, NULL }, - { fccYV12, 12, &MEDIASUBTYPE_YV12, CAP_YV12, NULL }, - { fccYUY2, 16, &MEDIASUBTYPE_YUY2, CAP_YUY2, NULL }, - { fccUYVY, 16, &MEDIASUBTYPE_UYVY, CAP_UYVY, NULL }, - { fccYVYU, 16, &MEDIASUBTYPE_YVYU, CAP_YVYU, NULL }, - { fccIYUV, 24, &MEDIASUBTYPE_IYUV, CAP_IYUV, NULL }, - - { 8, 8, &MEDIASUBTYPE_RGB8, CAP_NONE, "RGB8" }, - { 15, 16, &MEDIASUBTYPE_RGB555, CAP_NONE, "RGB555" }, - { 16, 16, &MEDIASUBTYPE_RGB565, CAP_NONE, "RGB565" }, - { 24, 24, &MEDIASUBTYPE_RGB24, CAP_NONE, "RGB24" }, - { 32, 32, &MEDIASUBTYPE_RGB32, CAP_NONE, "RGB32" }, - - {0,0,NULL,0}, -}; - -DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto) -{ - DMO_VideoDecoder *this; - HRESULT result; - ct* c; - - this = malloc(sizeof(DMO_VideoDecoder)); - memset( this, 0, sizeof(DMO_VideoDecoder)); - - this->m_sVhdr2 = 0; - this->m_iLastQuality = -1; - this->m_iMaxAuto = maxauto; - -#ifdef WIN32_LOADER - Setup_LDT_Keeper(); -#endif - - //memset(&m_obh, 0, sizeof(m_obh)); - //m_obh.biSize = sizeof(m_obh); - /*try*/ - { - unsigned int bihs; - - bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ? - sizeof(BITMAPINFOHEADER) : format->biSize; - - this->iv.m_bh = malloc(bihs); - memcpy(this->iv.m_bh, format, bihs); - this->iv.m_bh->biSize = bihs; - - this->iv.m_State = STOP; - //this->iv.m_pFrame = 0; - this->iv.m_Mode = DIRECT; - this->iv.m_iDecpos = 0; - this->iv.m_iPlaypos = -1; - this->iv.m_fQuality = 0.0f; - this->iv.m_bCapable16b = true; - - bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER); - this->m_sVhdr = malloc(bihs); - memset(this->m_sVhdr, 0, bihs); - memcpy(&this->m_sVhdr->bmiHeader, this->iv.m_bh, this->iv.m_bh->biSize); - this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0; - this->m_sVhdr->rcSource.right = this->m_sVhdr->bmiHeader.biWidth; - this->m_sVhdr->rcSource.bottom = this->m_sVhdr->bmiHeader.biHeight; - //this->m_sVhdr->rcSource.right = 0; - //this->m_sVhdr->rcSource.bottom = 0; - this->m_sVhdr->rcTarget = this->m_sVhdr->rcSource; - - this->m_sOurType.majortype = MEDIATYPE_Video; - this->m_sOurType.subtype = MEDIATYPE_Video; - this->m_sOurType.subtype.f1 = this->m_sVhdr->bmiHeader.biCompression; - this->m_sOurType.formattype = FORMAT_VideoInfo; - this->m_sOurType.bFixedSizeSamples = false; - this->m_sOurType.bTemporalCompression = true; - this->m_sOurType.pUnk = 0; - this->m_sOurType.cbFormat = bihs; - this->m_sOurType.pbFormat = (char*)this->m_sVhdr; - - this->m_sVhdr2 = (VIDEOINFOHEADER*)(malloc(sizeof(VIDEOINFOHEADER)+12)); - memcpy(this->m_sVhdr2, this->m_sVhdr, sizeof(VIDEOINFOHEADER)); - memset((char*)this->m_sVhdr2 + sizeof(VIDEOINFOHEADER), 0, 12); - this->m_sVhdr2->bmiHeader.biCompression = 0; - this->m_sVhdr2->bmiHeader.biBitCount = 24; - -// memset((char*)this->m_sVhdr2, 0, sizeof(VIDEOINFOHEADER)+12); - this->m_sVhdr2->rcTarget = this->m_sVhdr->rcTarget; -// this->m_sVhdr2->rcSource = this->m_sVhdr->rcSource; - - memset(&this->m_sDestType, 0, sizeof(this->m_sDestType)); - this->m_sDestType.majortype = MEDIATYPE_Video; - this->m_sDestType.subtype = MEDIASUBTYPE_RGB24; - this->m_sDestType.formattype = FORMAT_VideoInfo; - this->m_sDestType.bFixedSizeSamples = true; - this->m_sDestType.bTemporalCompression = false; - this->m_sDestType.lSampleSize = labs(this->m_sVhdr2->bmiHeader.biWidth*this->m_sVhdr2->bmiHeader.biHeight - * ((this->m_sVhdr2->bmiHeader.biBitCount + 7) / 8)); - this->m_sVhdr2->bmiHeader.biSizeImage = this->m_sDestType.lSampleSize; - this->m_sDestType.pUnk = 0; - this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); - this->m_sDestType.pbFormat = (char*)this->m_sVhdr2; - - memset(&this->iv.m_obh, 0, sizeof(this->iv.m_obh)); - memcpy(&this->iv.m_obh, this->iv.m_bh, sizeof(this->iv.m_obh) < (unsigned) this->iv.m_bh->biSize - ? sizeof(this->iv.m_obh) : (unsigned) this->iv.m_bh->biSize); - this->iv.m_obh.biBitCount=24; - this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER); - this->iv.m_obh.biCompression = 0; //BI_RGB - //this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight); - this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight) - * ((this->iv.m_obh.biBitCount + 7) / 8); - - - this->m_pDMO_Filter = DMO_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType); - - if (!this->m_pDMO_Filter) - { - printf("Failed to create DMO filter\n"); - return 0; - } - - if (!flip) - { - this->iv.m_obh.biHeight *= -1; - this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight; -// result = this->m_pDMO_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDMO_Filter->m_pOutputPin, &this->m_sDestType); - result = this->m_pDMO_Filter->m_pMedia->vt->SetOutputType(this->m_pDMO_Filter->m_pMedia, 0, &this->m_sDestType, DMO_SET_TYPEF_TEST_ONLY); - if (result) - { - printf("Decoder does not support upside-down RGB frames\n"); - this->iv.m_obh.biHeight *= -1; - this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight; - } - } - - memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh) ); - - switch (this->iv.m_bh->biCompression) - { -#if 0 - case fccDIV3: - case fccDIV4: - case fccDIV5: - case fccDIV6: - case fccMP42: - case fccWMV2: - //YV12 seems to be broken for DivX :-) codec -// case fccIV50: - //produces incorrect picture - //m_Caps = (CAPS) (m_Caps & ~CAP_YV12); - //m_Caps = CAP_UYVY;//CAP_YUY2; // | CAP_I420; - //m_Caps = CAP_I420; - this->m_Caps = (CAP_YUY2 | CAP_UYVY); - break; -#endif - default: - - this->m_Caps = CAP_NONE; - - printf("Decoder supports the following formats: "); - for (c = check; c->bits; c++) - { - this->m_sVhdr2->bmiHeader.biBitCount = c->bits; - this->m_sVhdr2->bmiHeader.biCompression = c->fcc; - this->m_sDestType.subtype = *c->subtype; - //result = this->m_pDMO_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDMO_Filter->m_pOutputPin, &this->m_sDestType); - result = this->m_pDMO_Filter->m_pMedia->vt->SetOutputType(this->m_pDMO_Filter->m_pMedia, 0, &this->m_sDestType, DMO_SET_TYPEF_TEST_ONLY); - if (!result) - { - this->m_Caps = (this->m_Caps | c->cap); - if (c->name) - printf("%s ", c->name); - else - printf("%.4s ", (char*) &c->fcc); - } - } - printf("\n"); - } - - if (this->m_Caps != CAP_NONE) - printf("Decoder is capable of YUV output (flags 0x%x)\n", (int)this->m_Caps); - - this->m_sVhdr2->bmiHeader.biBitCount = 24; - this->m_sVhdr2->bmiHeader.biCompression = 0; - this->m_sDestType.subtype = MEDIASUBTYPE_RGB24; - - this->m_iMinBuffers = this->iv.VBUFSIZE; - } - /*catch (FatalError& error) - { - delete[] m_sVhdr; - delete[] m_sVhdr2; - delete m_pDMO_Filter; - throw; - }*/ - return this; -} - -void DMO_VideoDecoder_Destroy(DMO_VideoDecoder *this) -{ - DMO_VideoDecoder_StopInternal(this); - this->iv.m_State = STOP; - free(this->m_sVhdr); - free(this->m_sVhdr2); - DMO_Filter_Destroy(this->m_pDMO_Filter); -} - -void DMO_VideoDecoder_StartInternal(DMO_VideoDecoder *this) -{ -#if 0 - ALLOCATOR_PROPERTIES props, props1; - Debug printf("DMO_VideoDecoder_StartInternal\n"); - //cout << "DSSTART" << endl; - this->m_pDMO_Filter->Start(this->m_pDMO_Filter); - - props.cBuffers = 1; - props.cbBuffer = this->m_sDestType.lSampleSize; - - props.cbAlign = 1; - props.cbPrefix = 0; - this->m_pDMO_Filter->m_pAll->vt->SetProperties(this->m_pDMO_Filter->m_pAll, &props, &props1); - this->m_pDMO_Filter->m_pAll->vt->Commit(this->m_pDMO_Filter->m_pAll); -#endif - this->iv.m_State = START; -} - -void DMO_VideoDecoder_StopInternal(DMO_VideoDecoder *this) -{ - // this->m_pDMO_Filter->Stop(this->m_pDMO_Filter); - //??? why was this here ??? m_pOurOutput->SetFramePointer(0); -} - -int DMO_VideoDecoder_DecodeInternal(DMO_VideoDecoder *this, const void* src, int size, int is_keyframe, char* imdata) -{ -// IMediaSample* sample = 0; - int result; - unsigned long status; // to be ignored by M$ specs - DMO_OUTPUT_DATA_BUFFER db; - CMediaBuffer* bufferin; -//+ uint8_t* imdata = dest ? dest->Data() : 0; - - Debug printf("DMO_VideoDecoder_DecodeInternal(%p,%p,%d,%d,%p)\n",this,src,size,is_keyframe,imdata); - -// this->m_pDMO_Filter->m_pAll->vt->GetBuffer(this->m_pDMO_Filter->m_pAll, &sample, 0, 0, 0); -// if (!sample) -// { -// Debug printf("ERROR: null sample\n"); -// return -1; -// } - -#ifdef WIN32_LOADER - Setup_FS_Segment(); -#endif - - bufferin = CMediaBufferCreate(size, (void*)src, size, 0); - result = this->m_pDMO_Filter->m_pMedia->vt->ProcessInput(this->m_pDMO_Filter->m_pMedia, 0, - (IMediaBuffer*)bufferin, - DMO_INPUT_DATA_BUFFERF_SYNCPOINT, - 0, 0); - ((IMediaBuffer*)bufferin)->vt->Release((IUnknown*)bufferin); - - if (result != S_OK) - { - /* something for process */ - if (result != S_FALSE) - printf("ProcessInputError r:0x%x=%d (keyframe: %d)\n", result, result, is_keyframe); - else - printf("ProcessInputError FALSE ?? (keyframe: %d)\n", is_keyframe); - return size; - } - - db.rtTimestamp = 0; - db.rtTimelength = 0; - db.dwStatus = 0; - db.pBuffer = (IMediaBuffer*) CMediaBufferCreate(this->m_sDestType.lSampleSize, - imdata, 0, 0); - result = this->m_pDMO_Filter->m_pMedia->vt->ProcessOutput(this->m_pDMO_Filter->m_pMedia, - (imdata) ? 0 : DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER, - 1, &db, &status); - //m_pDMO_Filter->m_pMedia->vt->Lock(m_pDMO_Filter->m_pMedia, 0); - if ((unsigned)result == DMO_E_NOTACCEPTING) - printf("ProcessOutputError: Not accepting\n"); - else if (result) - printf("ProcessOutputError: r:0x%x=%d %ld stat:%ld\n", result, result, status, db.dwStatus); - - ((IMediaBuffer*)db.pBuffer)->vt->Release((IUnknown*)db.pBuffer); - - //int r = m_pDMO_Filter->m_pMedia->vt->Flush(m_pDMO_Filter->m_pMedia); - //printf("FLUSH %d\n", r); - - return 0; -} - -/* - * bits == 0 - leave unchanged - */ -//int SetDestFmt(DMO_VideoDecoder * this, int bits = 24, fourcc_t csp = 0); -int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int csp) -{ - HRESULT result; - //int should_test=1; - - Debug printf("DMO_VideoDecoder_SetDestFmt (%p, %d, %d)\n",this,bits,(int)csp); - - /* if (!CImage::Supported(csp, bits)) - return -1; -*/ - // BitmapInfo temp = m_obh; - - if (!csp) // RGB - { - int ok = true; - - switch (bits) - { - case 15: - this->m_sDestType.subtype = MEDIASUBTYPE_RGB555; - break; - case 16: - this->m_sDestType.subtype = MEDIASUBTYPE_RGB565; - break; - case 24: - this->m_sDestType.subtype = MEDIASUBTYPE_RGB24; - break; - case 32: - this->m_sDestType.subtype = MEDIASUBTYPE_RGB32; - break; - default: - ok = false; - break; - } - - if (ok) { - this->iv.m_obh.biBitCount=bits; - if( bits == 15 || bits == 16 ) { - this->iv.m_obh.biSize=sizeof(BITMAPINFOHEADER)+12; - this->iv.m_obh.biCompression=3;//BI_BITFIELDS - this->iv.m_obh.biSizeImage=abs((int)(2*this->iv.m_obh.biWidth*this->iv.m_obh.biHeight)); - } - - if( bits == 16 ) { - this->iv.m_obh.colors[0]=0xF800; - this->iv.m_obh.colors[1]=0x07E0; - this->iv.m_obh.colors[2]=0x001F; - } else if ( bits == 15 ) { - this->iv.m_obh.colors[0]=0x7C00; - this->iv.m_obh.colors[1]=0x03E0; - this->iv.m_obh.colors[2]=0x001F; - } else { - this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER); - this->iv.m_obh.biCompression = 0; //BI_RGB - //this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight); - this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight) - * ((this->iv.m_obh.biBitCount + 7) / 8); - } - } - //.biSizeImage=abs(temp.biWidth*temp.biHeight*((temp.biBitCount+7)/8)); - } else - { // YUV - int ok = true; - switch (csp) - { - case fccYUY2: - this->m_sDestType.subtype = MEDIASUBTYPE_YUY2; - break; - case fccYV12: - this->m_sDestType.subtype = MEDIASUBTYPE_YV12; - break; - case fccIYUV: - this->m_sDestType.subtype = MEDIASUBTYPE_IYUV; - break; - case fccI420: - this->m_sDestType.subtype = MEDIASUBTYPE_I420; - break; - case fccUYVY: - this->m_sDestType.subtype = MEDIASUBTYPE_UYVY; - break; - case fccYVYU: - this->m_sDestType.subtype = MEDIASUBTYPE_YVYU; - break; - case fccYVU9: - this->m_sDestType.subtype = MEDIASUBTYPE_YVU9; - default: - ok = false; - break; - } - - if (ok) { - if (csp != 0 && csp != 3 && this->iv.m_obh.biHeight > 0) - this->iv.m_obh.biHeight *= -1; // YUV formats uses should have height < 0 - this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER); - this->iv.m_obh.biCompression=csp; - this->iv.m_obh.biBitCount=bits; - - this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight) - * ((this->iv.m_obh.biBitCount + 7) / 8); - } - } - this->m_sDestType.lSampleSize = this->iv.m_obh.biSizeImage; - memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_obh, sizeof(this->iv.m_obh)); - this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - if (this->m_sVhdr2->bmiHeader.biCompression == 3) - this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12; - else - this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); - -#if 0 - switch(csp) - { - case fccYUY2: - if(!(this->m_Caps & CAP_YUY2)) - should_test=false; - break; - case fccYV12: - if(!(this->m_Caps & CAP_YV12)) - should_test=false; - break; - case fccIYUV: - if(!(this->m_Caps & CAP_IYUV)) - should_test=false; - break; - case fccI420: - if(!(this->m_Caps & CAP_I420)) - should_test=false; - break; - case fccUYVY: - if(!(this->m_Caps & CAP_UYVY)) - should_test=false; - break; - case fccYVYU: - if(!(this->m_Caps & CAP_YVYU)) - should_test=false; - break; - case fccYVU9: - if(!(this->m_Caps & CAP_YVU9)) - should_test=false; - break; - } -#endif - -#ifdef WIN32_LOADER - Setup_FS_Segment(); -#endif - -// if(should_test) -// result = this->m_pDMO_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDMO_Filter->m_pOutputPin, &this->m_sDestType); -// else -// result = -1; - - // test accept - if(!this->m_pDMO_Filter) return 0; - result = this->m_pDMO_Filter->m_pMedia->vt->SetOutputType(this->m_pDMO_Filter->m_pMedia, 0, &this->m_sDestType, DMO_SET_TYPEF_TEST_ONLY); - - if (result != 0) - { - if (csp) - printf("Warning: unsupported color space\n"); - else - printf("Warning: unsupported bit depth\n"); - - this->m_sDestType.lSampleSize = this->iv.m_decoder.biSizeImage; - memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_decoder, sizeof(this->iv.m_decoder)); - this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - if (this->m_sVhdr2->bmiHeader.biCompression == 3) - this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12; - else - this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); - - return -1; - } - - memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh)); - -// m_obh=temp; -// if(csp) -// m_obh.biBitCount=BitmapInfo::BitCount(csp); - this->iv.m_bh->biBitCount = bits; - - //DMO_VideoDecoder_Restart(this); - - this->m_pDMO_Filter->m_pMedia->vt->SetOutputType(this->m_pDMO_Filter->m_pMedia, 0, &this->m_sDestType, 0); - - return 0; -} - - -int DMO_VideoDecoder_SetDirection(DMO_VideoDecoder *this, int d) -{ - this->iv.m_obh.biHeight = (d) ? this->iv.m_bh->biHeight : -this->iv.m_bh->biHeight; - this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight; - return 0; -} diff --git a/loader/dmo/DMO_VideoDecoder.h b/loader/dmo/DMO_VideoDecoder.h deleted file mode 100644 index 77af6ded09..0000000000 --- a/loader/dmo/DMO_VideoDecoder.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef MPLAYER_DMO_VIDEODECODER_H -#define MPLAYER_DMO_VIDEODECODER_H - -#include "loader/com.h" -#include "loader/wine/vfw.h" - -typedef struct DMO_VideoDecoder DMO_VideoDecoder; - -int DMO_VideoDecoder_GetCapabilities(DMO_VideoDecoder *this); - -DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto); - -void DMO_VideoDecoder_Destroy(DMO_VideoDecoder *this); - -void DMO_VideoDecoder_StartInternal(DMO_VideoDecoder *this); - -void DMO_VideoDecoder_StopInternal(DMO_VideoDecoder *this); - -int DMO_VideoDecoder_DecodeInternal(DMO_VideoDecoder *this, const void* src, int size, int is_keyframe, char* pImage); - -/* - * bits == 0 - leave unchanged - */ -//int SetDestFmt(DMO_VideoDecoder * this, int bits = 24, fourcc_t csp = 0); -int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int csp); -int DMO_VideoDecoder_SetDirection(DMO_VideoDecoder *this, int d); - - -#endif /* MPLAYER_DMO_VIDEODECODER_H */ diff --git a/loader/dmo/buffer.c b/loader/dmo/buffer.c deleted file mode 100644 index 78428e249f..0000000000 --- a/loader/dmo/buffer.c +++ /dev/null @@ -1,119 +0,0 @@ -#include "DMO_Filter.h" - -#include "loader/wine/winerror.h" -#include "loader/wine/windef.h" - -#include -#include -#include - -struct CMediaBuffer -{ - IMediaBuffer_vt* vt; - DECLARE_IUNKNOWN(); - GUID interfaces[2]; - void* mem; - unsigned long len; - unsigned long maxlen; - int freemem; -}; - -static HRESULT STDCALL CMediaBuffer_SetLength(IMediaBuffer* This, - unsigned long cbLength) -{ - CMediaBuffer* cmb = (CMediaBuffer*) This; - Debug printf("CMediaBuffer_SetLength(%p) called (%ld, %ld)\n", This, cbLength, cmb->maxlen); - if (cbLength > cmb->maxlen) - return E_INVALIDARG; - cmb->len = cbLength; - return S_OK; -} - -static HRESULT STDCALL CMediaBuffer_GetMaxLength(IMediaBuffer* This, - /* [out] */ unsigned long *pcbMaxLength) -{ - CMediaBuffer* cmb = (CMediaBuffer*) This; - Debug printf("CMediaBuffer_GetMaxLength(%p) called -> %ld\n", This, cmb->maxlen); - if (!pcbMaxLength) - return E_POINTER; - *pcbMaxLength = cmb->maxlen; - return S_OK; -} - -static HRESULT STDCALL CMediaBuffer_GetBufferAndLength(IMediaBuffer* This, - /* [out] */ char** ppBuffer, - /* [out] */ unsigned long* pcbLength) -{ - CMediaBuffer* cmb = (CMediaBuffer*) This; - Debug printf("CMediaBuffer_GetBufferAndLength(%p) called -> %p %ld\n", This, cmb->mem, cmb->len); - if (!ppBuffer && !pcbLength) - return E_POINTER; - if (ppBuffer) - *ppBuffer = cmb->mem; - if (pcbLength) - *pcbLength = cmb->len; - return S_OK; -} - -static void CMediaBuffer_Destroy(CMediaBuffer* This) -{ - Debug printf("CMediaBuffer_Destroy(%p) called\n", This); - if (This->freemem) - free(This->mem); - free(This->vt); - free(This); -} - -IMPLEMENT_IUNKNOWN(CMediaBuffer) - -CMediaBuffer* CMediaBufferCreate(unsigned long maxlen, void* mem, - unsigned long len, int copy) -{ - CMediaBuffer* This = malloc(sizeof(CMediaBuffer)); - - if (!This) - return NULL; - - This->vt = malloc(sizeof(IMediaBuffer_vt)); - if (!This->vt) - { - CMediaBuffer_Destroy(This); - return NULL; - } - - This->refcount = 1; - This->len = len; - This->maxlen = maxlen; - This->freemem = 0; - This->mem = mem; - if (copy) - /* make a private copy of data */ - This->mem = 0; - if (This->mem == NULL) - { - if (This->maxlen) - { - This->mem = malloc(This->maxlen); - if (!This->mem) - { - CMediaBuffer_Destroy(This); - return NULL; - } - This->freemem = 1; - if (copy) - memcpy(This->mem, mem, This->len); - } - } - This->vt->QueryInterface = CMediaBuffer_QueryInterface; - This->vt->AddRef = CMediaBuffer_AddRef; - This->vt->Release = CMediaBuffer_Release; - - This->vt->SetLength = CMediaBuffer_SetLength; - This->vt->GetMaxLength = CMediaBuffer_GetMaxLength; - This->vt->GetBufferAndLen