summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/ad_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 /libmpcodecs/ad_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 'libmpcodecs/ad_dmo.c')
-rw-r--r--libmpcodecs/ad_dmo.c126
1 files changed, 0 insertions, 126 deletions
diff --git a/libmpcodecs/ad_dmo.c b/libmpcodecs/ad_dmo.c
deleted file mode 100644
index 714651a7e4..0000000000
--- a/libmpcodecs/ad_dmo.c
+++ /dev/null
@@ -1,126 +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 <unistd.h>
-
-#include "config.h"
-#include "options.h"
-#include "mp_msg.h"
-
-#include "ad_internal.h"
-#include "libaf/reorder_ch.h"
-
-static const ad_info_t info =
-{
- "Win32/DMO decoders",
- "dmo",
- "A'rpi",
- "avifile.sf.net",
- ""
-};
-
-LIBAD_EXTERN(dmo)
-
-#include "loader/dmo/DMO_AudioDecoder.h"
-
-static int init(sh_audio_t *sh)
-{
- return 1;
-}
-
-static int preinit(sh_audio_t *sh_audio)
-{
- struct MPOpts *opts = sh_audio->opts;
- DMO_AudioDecoder* ds_adec;
- int chans=(opts->audio_output_channels==sh_audio->wf->nChannels) ?
- opts->audio_output_channels : (sh_audio->wf->nChannels>=2 ? 2 : 1);
- if(!(ds_adec=DMO_AudioDecoder_Open(sh_audio->codec->dll,&sh_audio->codec->guid,sh_audio->wf,chans)))
- {
- mp_tmsg(MSGT_DECAUDIO,MSGL_ERR,"ERROR: Could not open required DirectShow codec %s.\n",sh_audio->codec->dll);
- return 0;
- }
- sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
- sh_audio->channels=chans;
- sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
- sh_audio->samplesize=2;
- sh_audio->audio_in_minsize=4*sh_audio->wf->nBlockAlign;
- if(sh_audio->audio_in_minsize<8192) sh_audio->audio_in_minsize=8192;
- sh_audio->audio_out_minsize=4*16384;
- sh_audio->context = ds_adec;
- mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DMO audio codec init OK!\n");
- return 1;
-}
-
-static void uninit(sh_audio_t *sh)
-{
- DMO_AudioDecoder* ds_adec = sh->context;
- DMO_AudioDecoder_Destroy(ds_adec);
-}
-
-static int control(sh_audio_t *sh_audio,int cmd,void* arg, ...)
-{
- int skip;
- switch(cmd)
- {
- case ADCTRL_SKIP_FRAME:
- skip=sh_audio->wf->nBlockAlign;
- if(skip<16){
- skip=(sh_audio->wf->nAvgBytesPerSec/16)&(~7);
- if(skip<16) skip=16;
- }
- demux_read_data(sh_audio->ds,NULL,skip);
- return CONTROL_TRUE;
- }
- return CONTROL_UNKNOWN;
-}
-
-static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
-{
- DMO_AudioDecoder* ds_adec = sh_audio->context;
-// int len=-1;
- int size_in=0;
- int size_out=0;
- int srcsize=DMO_AudioDecoder_GetSrcSize(ds_adec, maxlen);
- mp_msg(MSGT_DECAUDIO,MSGL_DBG3,"DMO says: srcsize=%d (buffsize=%d) out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,maxlen);
- if(srcsize>sh_audio->a_in_buffer_size) srcsize=sh_audio->a_in_buffer_size; // !!!!!!
- if(sh_audio->a_in_buffer_len<srcsize){
- sh_audio->a_in_buffer_len+=
- demux_read_data(sh_audio->ds,&sh_audio->a_in_buffer[sh_audio->a_in_buffer_len],
- srcsize-sh_audio->a_in_buffer_len);
- }
- DMO_AudioDecoder_Convert(ds_adec, sh_audio->a_in_buffer,sh_audio->a_in_buffer_len,
- buf,maxlen, &size_in,&size_out);
- mp_dbg(MSGT_DECAUDIO,MSGL_DBG2,"DMO: audio %d -> %d converted (in_buf_len=%d of %d) %d\n",size_in,size_out,sh_audio->a_in_buffer_len,sh_audio->a_in_buffer_size,ds_tell_pts(sh_audio->ds));
- if(size_in>=sh_audio->a_in_buffer_len){
- sh_audio->a_in_buffer_len=0;
- } else {
- sh_audio->a_in_buffer_len-=size_in;
- memmove(sh_audio->a_in_buffer,&sh_audio->a_in_buffer[size_in],sh_audio->a_in_buffer_len);
- }
- if (size_out > 0 && sh_audio->channels >= 5) {
- reorder_channel_nch(buf, AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT,
- AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
- sh_audio->channels,
- size_out / sh_audio->samplesize,
- sh_audio->samplesize);
- }
-// len=size_out;
- return size_out;
-}