summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vd_dshow.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 /libmpcodecs/vd_dshow.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 'libmpcodecs/vd_dshow.c')
-rw-r--r--libmpcodecs/vd_dshow.c133
1 files changed, 0 insertions, 133 deletions
diff --git a/libmpcodecs/vd_dshow.c b/libmpcodecs/vd_dshow.c
deleted file mode 100644
index 7e8fe35ce0..0000000000
--- a/libmpcodecs/vd_dshow.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-#include "config.h"
-
-#include "mp_msg.h"
-
-#include "vd_internal.h"
-
-#include "loader/dshow/DS_VideoDecoder.h"
-
-static const vd_info_t info = {
- "DirectShow video codecs",
- "dshow",
- "A'rpi",
- "based on http://avifile.sf.net",
- "win32 codecs"
-};
-
-LIBVD_EXTERN(dshow)
-
-// to set/get/query special features/parameters
-static int control(sh_video_t *sh,int cmd,void* arg,...){
- switch(cmd){
- case VDCTRL_QUERY_MAX_PP_LEVEL:
- return 4;
- case VDCTRL_SET_PP_LEVEL:
- if(!sh->context) return CONTROL_ERROR;
- DS_VideoDecoder_SetValue(sh->context,"Quality",*((int*)arg));
- return CONTROL_OK;
-
- case VDCTRL_SET_EQUALIZER: {
- va_list ap;
- int value;
- va_start(ap, arg);
- value=va_arg(ap, int);
- va_end(ap);
- if(DS_VideoDecoder_SetValue(sh->context,arg,50+value/2)==0)
- return CONTROL_OK;
- return CONTROL_FALSE;
- }
-
- }
- return CONTROL_UNKNOWN;
-}
-
-// init driver
-static int init(sh_video_t *sh){
- unsigned int out_fmt=sh->codec->outfmt[0];
-
- /* Hack for VSSH codec: new dll can't decode old files
- * In my samples old files have no extradata, so use that info
- * to decide what dll should be used (here and in vd_vfw).
- */
- if (!strcmp(sh->codec->dll, "vsshdsd.dll") && (sh->bih->biSize == 40))
- return 0;
-
- if(!(sh->context=DS_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){
- mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"ERROR: Could not open required DirectShow codec %s.\n",sh->codec->dll);
- mp_tmsg(MSGT_DECVIDEO,MSGL_HINT,"You need to upgrade/install the binary codecs package.\nGo to http://www.mplayerhq.hu/dload.html\n");
- return 0;
- }
- if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,out_fmt)) return 0;
- // mpcodecs_config_vo can change the format
- out_fmt=sh->codec->outfmt[sh->outfmtidx];
- switch(out_fmt){
- case IMGFMT_YUY2:
- case IMGFMT_UYVY:
- DS_VideoDecoder_SetDestFmt(sh->context,16,out_fmt);break; // packed YUV
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- DS_VideoDecoder_SetDestFmt(sh->context,12,out_fmt);break; // planar YUV
- case IMGFMT_YVU9:
- DS_VideoDecoder_SetDestFmt(sh->context,9,out_fmt);break;
- default:
- DS_VideoDecoder_SetDestFmt(sh->context,out_fmt&255,0); // RGB/BGR
- }
- DS_SetAttr_DivX("Quality",divx_quality);
- DS_VideoDecoder_StartInternal(sh->context);
- mp_tmsg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DShow video codec init OK.\n");
- return 1;
-}
-
-// uninit driver
-static void uninit(sh_video_t *sh){
- DS_VideoDecoder_Destroy(sh->context);
-}
-
-//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
-
-// decode a frame
-static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
- mp_image_t* mpi;
- if(len<=0) return NULL; // skipped frame
-
- if(flags&3){
- // framedrop:
- DS_VideoDecoder_DecodeInternal(sh->context, data, len, 0, 0);
- return NULL;
- }
-
- mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_COMMON_PLANE,
- sh->disp_w, sh->disp_h);
-
- if(!mpi){ // temporary!
- mp_tmsg(MSGT_DECVIDEO,MSGL_WARN,"[VD_DMO] Couldn't allocate image for cinepak codec.\n");
- return NULL;
- }
-
- DS_VideoDecoder_DecodeInternal(sh->context, data, len, 0, mpi->planes[0]);
-
- return mpi;
-}