From 1fde09db6f4cee7347842261234082470dd3a2ca Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 30 Jul 2012 18:40:46 +0200 Subject: Remove some demuxers and decoders Most of these demuxers and decoders are provided in better form by libav, while the mplayer builtin ones are essentially unmaintained. The only legimitate use case for not using the libav ones was working around libav bugs or bugs related to the way mplayer uses libav. Instead of trying to keep dead code alive, development effort should go into improving libav or the mplayer libav glue code. Note that the libav demuxer have been preferred over the mplayer builtin ones for a while in mplayer2. There were some exceptions: playing DVDs with dvdnav or playing network sources. (That's because some stream modules and network.c requested explicit file formats, such as DEMUXER_TYPE_MPEG_PS, which mapped to builtin demuxers.) With this commit, they are switched to use libav. One caveat is that the requested format is not passed to libavformat, instead we rely on the auto probing to select the correct libav demuxer (see code in demux_open_stream()). --- Makefile | 30 - cfg-mplayer.h | 12 - command.c | 3 +- configure | 166 --- etc/codecs.conf | 111 -- libmpcodecs/ad.c | 16 - libmpcodecs/ad_dk3adpcm.c | 262 ---- libmpcodecs/ad_libvorbis.c | 350 ----- libmpcodecs/ad_mpc.c | 231 --- libmpcodecs/ad_speex.c | 179 --- libmpcodecs/ad_twin.c | 523 ------- libmpcodecs/dec_video.c | 1 - libmpcodecs/vd.c | 12 - libmpcodecs/vd_mpegpes.c | 84 -- libmpcodecs/vd_sgi.c | 343 ----- libmpcodecs/vd_theora.c | 207 --- libmpcodecs/vd_xvid4.c | 393 ----- libmpdemux/aac_hdr.c | 47 - libmpdemux/aac_hdr.h | 26 - libmpdemux/demux_aac.c | 260 ---- libmpdemux/demux_avi.c | 39 +- libmpdemux/demux_film.c | 490 ------ libmpdemux/demux_fli.c | 228 --- libmpdemux/demux_lmlm4.c | 385 ----- libmpdemux/demux_mov.c | 2350 ----------------------------- libmpdemux/demux_mov.h | 24 - libmpdemux/demux_mpc.c | 235 --- libmpdemux/demux_mpg.c | 1248 ---------------- libmpdemux/demux_nsv.c | 345 ----- libmpdemux/demux_nut.c | 321 ---- libmpdemux/demux_ogg.c | 1660 --------------------- libmpdemux/demux_ogg.h | 27 - libmpdemux/demux_pva.c | 536 ------- libmpdemux/demux_roq.c | 281 ---- libmpdemux/demux_smjpeg.c | 200 --- libmpdemux/demux_ts.c | 3533 -------------------------------------------- libmpdemux/demux_ts.h | 24 - libmpdemux/demux_ty.c | 899 ----------- libmpdemux/demux_ty_osd.c | 911 ------------ libmpdemux/demux_ty_osd.h | 25 - libmpdemux/demux_vqf.c | 240 --- libmpdemux/demux_y4m.c | 325 ---- libmpdemux/demuxer.c | 68 +- libmpdemux/demuxer.h | 17 - libmpdemux/extension.c | 23 +- libmpdemux/mpeg_hdr.c | 539 ------- libmpdemux/mpeg_hdr.h | 55 - libmpdemux/parse_es.c | 158 -- libmpdemux/parse_es.h | 45 - libmpdemux/parse_mp4.c | 173 --- libmpdemux/parse_mp4.h | 127 -- libmpdemux/video.c | 521 +------ mplayer.c | 6 +- stream/network.c | 21 - 54 files changed, 34 insertions(+), 19301 deletions(-) delete mode 100644 libmpcodecs/ad_dk3adpcm.c delete mode 100644 libmpcodecs/ad_libvorbis.c delete mode 100644 libmpcodecs/ad_mpc.c delete mode 100644 libmpcodecs/ad_speex.c delete mode 100644 libmpcodecs/ad_twin.c delete mode 100644 libmpcodecs/vd_mpegpes.c delete mode 100644 libmpcodecs/vd_sgi.c delete mode 100644 libmpcodecs/vd_theora.c delete mode 100644 libmpcodecs/vd_xvid4.c delete mode 100644 libmpdemux/aac_hdr.c delete mode 100644 libmpdemux/aac_hdr.h delete mode 100644 libmpdemux/demux_aac.c delete mode 100644 libmpdemux/demux_film.c delete mode 100644 libmpdemux/demux_fli.c delete mode 100644 libmpdemux/demux_lmlm4.c delete mode 100644 libmpdemux/demux_mov.c delete mode 100644 libmpdemux/demux_mov.h delete mode 100644 libmpdemux/demux_mpc.c delete mode 100644 libmpdemux/demux_mpg.c delete mode 100644 libmpdemux/demux_nsv.c delete mode 100644 libmpdemux/demux_nut.c delete mode 100644 libmpdemux/demux_ogg.c delete mode 100644 libmpdemux/demux_ogg.h delete mode 100644 libmpdemux/demux_pva.c delete mode 100644 libmpdemux/demux_roq.c delete mode 100644 libmpdemux/demux_smjpeg.c delete mode 100644 libmpdemux/demux_ts.c delete mode 100644 libmpdemux/demux_ts.h delete mode 100644 libmpdemux/demux_ty.c delete mode 100644 libmpdemux/demux_ty_osd.c delete mode 100644 libmpdemux/demux_ty_osd.h delete mode 100644 libmpdemux/demux_vqf.c delete mode 100644 libmpdemux/demux_y4m.c delete mode 100644 libmpdemux/mpeg_hdr.c delete mode 100644 libmpdemux/mpeg_hdr.h delete mode 100644 libmpdemux/parse_es.c delete mode 100644 libmpdemux/parse_es.h delete mode 100644 libmpdemux/parse_mp4.c delete mode 100644 libmpdemux/parse_mp4.h diff --git a/Makefile b/Makefile index cb35d0fb39..01c4d59305 100644 --- a/Makefile +++ b/Makefile @@ -88,11 +88,9 @@ SRCS_COMMON-$(LIBMAD) += libmpcodecs/ad_libmad.c SRCS_COMMON-$(LIBNEMESI) += libmpdemux/demux_nemesi.c \ stream/stream_nemesi.c -SRCS_COMMON-$(LIBNUT) += libmpdemux/demux_nut.c SRCS_COMMON-$(LIBPOSTPROC) += libmpcodecs/vf_pp.c SRCS_COMMON-$(LIBSMBCLIENT) += stream/stream_smb.c -SRCS_COMMON-$(LIBTHEORA) += libmpcodecs/vd_theora.c SRCS_COMMON-$(LIVE555) += libmpdemux/demux_rtp.cpp \ libmpdemux/demux_rtp_codec.cpp \ stream/stream_live555.c @@ -103,8 +101,6 @@ SRCS_COMMON-$(COCOA) += libvo/osx_common.c \ SRCS_COMMON-$(MNG) += libmpdemux/demux_mng.c SRCS_COMMON-$(MPG123) += libmpcodecs/ad_mpg123.c -SRCS_COMMON-$(MUSEPACK) += libmpcodecs/ad_mpc.c \ - libmpdemux/demux_mpc.c SRCS_COMMON-$(NATIVE_RTSP) += stream/stream_rtsp.c \ stream/freesdp/common.c \ stream/freesdp/errorlist.c \ @@ -148,7 +144,6 @@ SRCS_COMMON-$(RADIO) += stream/stream_radio.c SRCS_COMMON-$(RADIO_CAPTURE) += stream/audio_in.c SRCS_COMMON-$(REAL_CODECS) += libmpcodecs/ad_realaud.c \ libmpcodecs/vd_realvid.c -SRCS_COMMON-$(SPEEX) += libmpcodecs/ad_speex.c SRCS_COMMON-$(STREAM_CACHE) += stream/cache2.c SRCS_COMMON-$(TV) += stream/stream_tv.c stream/tv.c \ @@ -161,8 +156,6 @@ SRCS_COMMON-$(TV_DSHOW) += stream/tvi_dshow.c \ SRCS_COMMON-$(TV_V4L1) += stream/tvi_v4l.c stream/audio_in.c SRCS_COMMON-$(TV_V4L2) += stream/tvi_v4l2.c stream/audio_in.c SRCS_COMMON-$(VCD) += stream/stream_vcd.c -SRCS_COMMON-$(VORBIS) += libmpcodecs/ad_libvorbis.c \ - libmpdemux/demux_ogg.c SRCS_COMMON-$(VSTREAM) += stream/stream_vstream.c SRCS_QTX_EMULATION += loader/wrapper.S SRCS_COMMON-$(QTX_EMULATION) += $(SRCS_QTX_EMULATION) @@ -181,7 +174,6 @@ SRCS_COMMON-$(WIN32_EMULATION) += $(SRCS_WIN32_EMULATION) SRCS_COMMON-$(WIN32DLL) += libmpcodecs/ad_acm.c \ libmpcodecs/ad_dmo.c \ libmpcodecs/ad_dshow.c \ - libmpcodecs/ad_twin.c \ libmpcodecs/vd_dmo.c \ libmpcodecs/vd_dshow.c \ libmpcodecs/vd_vfw.c \ @@ -207,7 +199,6 @@ SRCS_COMMON-$(WIN32DLL) += libmpcodecs/ad_acm.c \ loader/dmo/dmo_guids.c \ SRCS_COMMON-$(XANIM_CODECS) += libmpcodecs/vd_xanim.c -SRCS_COMMON-$(XVID4) += libmpcodecs/vd_xvid4.c SRCS_COMMON-$(DUMMY_OSD) += sub/osd_dummy.c SRCS_COMMON-$(LIBASS_OSD) += sub/osd_libass.c @@ -262,7 +253,6 @@ SRCS_COMMON = asxparser.c \ libaf/window.c \ libmpcodecs/ad.c \ libmpcodecs/ad_alaw.c \ - libmpcodecs/ad_dk3adpcm.c \ libmpcodecs/ad_dvdpcm.c \ libmpcodecs/ad_ffmpeg.c \ libmpcodecs/ad_hwac3.c \ @@ -280,11 +270,9 @@ SRCS_COMMON = asxparser.c \ libmpcodecs/vd_ffmpeg.c \ libmpcodecs/vd_hmblck.c \ libmpcodecs/vd_lzo.c \ - libmpcodecs/vd_mpegpes.c \ libmpcodecs/vd_mtga.c \ libmpcodecs/vd_null.c \ libmpcodecs/vd_raw.c \ - libmpcodecs/vd_sgi.c \ libmpcodecs/vf.c \ libmpcodecs/vf_1bpp.c \ libmpcodecs/vf_2xsai.c \ @@ -357,48 +345,30 @@ SRCS_COMMON = asxparser.c \ libmpcodecs/vf_yadif.c \ libmpcodecs/vf_yuvcsp.c \ libmpcodecs/vf_yvu9.c \ - libmpdemux/aac_hdr.c \ libmpdemux/asfheader.c \ libmpdemux/aviheader.c \ libmpdemux/aviprint.c \ libmpdemux/demuxer.c \ - libmpdemux/demux_aac.c \ libmpdemux/demux_asf.c \ libmpdemux/demux_audio.c \ libmpdemux/demux_avi.c \ libmpdemux/demux_demuxers.c \ libmpdemux/demux_edl.c \ libmpdemux/demux_cue.c \ - libmpdemux/demux_film.c \ - libmpdemux/demux_fli.c \ libmpdemux/demux_lavf.c \ - libmpdemux/demux_lmlm4.c \ libmpdemux/demux_mf.c \ libmpdemux/demux_mkv.c \ - libmpdemux/demux_mov.c \ - libmpdemux/demux_mpg.c \ - libmpdemux/demux_nsv.c \ - libmpdemux/demux_pva.c \ libmpdemux/demux_rawaudio.c \ libmpdemux/demux_rawvideo.c \ libmpdemux/demux_realaud.c \ libmpdemux/demux_real.c \ - libmpdemux/demux_roq.c \ - libmpdemux/demux_smjpeg.c \ - libmpdemux/demux_ts.c \ - libmpdemux/demux_ty.c \ libmpdemux/demux_viv.c \ - libmpdemux/demux_vqf.c \ - libmpdemux/demux_y4m.c \ libmpdemux/ebml.c \ libmpdemux/extension.c \ libmpdemux/mf.c \ libmpdemux/mp3_hdr.c \ libmpdemux/mp_taglists.c \ - libmpdemux/mpeg_hdr.c \ libmpdemux/mpeg_packetizer.c \ - libmpdemux/parse_es.c \ - libmpdemux/parse_mp4.c \ libmpdemux/video.c \ libmpdemux/yuv4mpeg.c \ libmpdemux/yuv4mpeg_ratio.c \ diff --git a/cfg-mplayer.h b/cfg-mplayer.h index 489419d941..8dc026a00d 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -30,7 +30,6 @@ #include "config.h" #include "m_config.h" #include "m_option.h" -#include "libmpdemux/demux_ts.h" #include "stream/tv.h" #include "stream/stream_radio.h" #include "libvo/csputils.h" @@ -77,12 +76,6 @@ extern const m_option_t demux_rawaudio_opts[]; extern const m_option_t demux_rawvideo_opts[]; extern const m_option_t cdda_opts[]; -extern int ts_prog; -extern int ts_keep_broken; -extern off_t ts_probe; -extern int audio_substream_id; -extern off_t ps_probe; - extern int sws_flags; extern const char pp_help[]; @@ -465,7 +458,6 @@ const m_option_t common_opts[] = { // select audio/video/subtitle stream OPT_INTRANGE("aid", audio_id, 0, -2, 8190), - {"ausid", &audio_substream_id, CONF_TYPE_INT, 0, 0, 0, NULL}, OPT_INTRANGE("vid", video_id, 0, -2, 8190), OPT_INTRANGE("sid", sub_id, 0, -2, 8190), OPT_FLAG_CONSTANTS("no-sub", sub_id, 0, -1, -2), @@ -566,10 +558,6 @@ const m_option_t common_opts[] = { OPT_FLAG_CONSTANTS("flip", flip, 0, -1, 1), OPT_FLAG_CONSTANTS("no-flip", flip, 0, -1, 0), - {"tsprog", &ts_prog, CONF_TYPE_INT, CONF_RANGE, 0, 65534, NULL}, - {"tsprobe", &ts_probe, CONF_TYPE_POSITION, 0, 0, TS_MAX_PROBE_SIZE, NULL}, - {"psprobe", &ps_probe, CONF_TYPE_POSITION, 0, 0, TS_MAX_PROBE_SIZE, NULL}, - {"tskeepbroken", &ts_keep_broken, CONF_TYPE_FLAG, 0, 0, 1, NULL}, // draw by slices or whole frame (useful with libmpeg2/libavcodec) OPT_MAKE_FLAGS("slices", vd_use_slices, 0), diff --git a/command.c b/command.c index 1f38603aff..9a696348da 100644 --- a/command.c +++ b/command.c @@ -1610,8 +1610,7 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg, if ((d_sub->demuxer->type == DEMUXER_TYPE_MATROSKA || d_sub->demuxer->type == DEMUXER_TYPE_LAVF - || d_sub->demuxer->type == DEMUXER_TYPE_LAVF_PREFERRED - || d_sub->demuxer->type == DEMUXER_TYPE_OGG) + || d_sub->demuxer->type == DEMUXER_TYPE_LAVF_PREFERRED) && d_sub->sh && opts->sub_id >= 0) { struct sh_sub *sh = d_sub->sh; char *lang = sh->lang ? sh->lang : mp_gtext("unknown"); diff --git a/configure b/configure index d5a30aec8e..95acce4f47 100755 --- a/configure +++ b/configure @@ -349,13 +349,7 @@ Codecs: --disable-qtx disable QuickTime codecs support [enabled] --disable-xanim disable XAnim codecs support [enabled] --disable-real disable RealPlayer codecs support [enabled] - --disable-xvid disable Xvid [autodetect] - --disable-libnut disable libnut [autodetect] --enable-libav skip Libav autodetection [autodetect] - --disable-libvorbis disable libvorbis support [autodetect] - --disable-tremor disable Tremor [autodetect if no libvorbis] - --disable-speex disable Speex support [autodetect] - --enable-theora enable OggTheora libraries [autodetect] --enable-faad enable FAAD2 (AAC) [autodetect] --disable-ladspa disable LADSPA plugin support [autodetect] --disable-libbs2b disable libbs2b audio filter support [autodetect] @@ -364,8 +358,6 @@ Codecs: --disable-mad disable libmad (MPEG audio) support [autodetect] --enable-libdca enable libdca support [autodetect] --disable-liba52 disable liba52 [autodetect] - --enable-musepack enable libmpcdec support (deprecated, libavcodec - Musepack decoder is preferred) [disabled] Video output: --enable-gl enable OpenGL video output [autodetect] @@ -492,10 +484,6 @@ _jack=auto _openal=no _libcdio=auto _mad=auto -_tremor=auto -_libvorbis=auto -_speex=auto -_theora=auto _mpg123=auto _liba52=auto _libdca=auto @@ -538,8 +526,6 @@ _winsock2_h=auto _smb=auto _libquvi=auto _joystick=no -_xvid=auto -_libnut=auto _lirc=auto _lircc=auto _apple_remote=auto @@ -568,7 +554,6 @@ _enca=auto _inet6=auto _gethostbyname2=auto _ftp=auto -_musepack=no _vstream=auto _pthreads=auto _w32threads=auto @@ -751,22 +736,12 @@ for ac_option do --disable-mad) _mad=no ;; --enable-libcdio) _libcdio=yes ;; --disable-libcdio) _libcdio=no ;; - --enable-libvorbis) _libvorbis=yes ;; - --disable-libvorbis) _libvorbis=no ;; - --enable-speex) _speex=yes ;; - --disable-speex) _speex=no ;; - --enable-tremor) _tremor=yes ;; - --disable-tremor) _tremor=no ;; - --enable-theora) _theora=yes ;; - --disable-theora) _theora=no ;; --enable-mpg123) _mpg123=yes ;; --disable-mpg123) _mpg123=no ;; --enable-liba52) _liba52=yes ;; --disable-liba52) _liba52=no ;; --enable-libdca) _libdca=yes ;; --disable-libdca) _libdca=no ;; - --enable-musepack) _musepack=yes ;; - --disable-musepack) _musepack=no ;; --enable-faad) _faad=yes ;; --disable-faad) _faad=no ;; --enable-ladspa) _ladspa=yes ;; @@ -835,10 +810,6 @@ for ac_option do --disable-libquvi) _libquvi=no ;; --enable-joystick) _joystick=yes ;; --disable-joystick) _joystick=no ;; - --enable-xvid) _xvid=yes ;; - --disable-xvid) _xvid=no ;; - --enable-libnut) _libnut=yes ;; - --disable-libnut) _libnut=no ;; --enable-libav) ffmpeg=yes ;; --ffmpeg-source-dir=*) _ffmpeg_source=$(echo $ac_option | cut -d '=' -f 2 ) ;; @@ -3396,71 +3367,6 @@ else fi echores "$_mad" -echocheck "OggVorbis support" -if test "$_libvorbis" = auto; then - _libvorbis=no - statement_check vorbis/codec.h 'vorbis_packet_blocksize(0, 0)' -lvorbis -logg $_ld_lm && _libvorbis=yes && _tremor=no -elif test "$_libvorbis" = yes ; then - _tremor=no -fi -if test "$_tremor" = auto; then - _tremor=no - statement_check tremor/ivorbiscodec.h 'vorbis_packet_blocksize(0, 0)' -logg -lvorbisidec $_ld_lm && _tremor=yes -fi -if test "$_tremor" = yes ; then - _vorbis=yes - def_vorbis='#define CONFIG_OGGVORBIS 1' - def_tremor='#define CONFIG_TREMOR 1' - codecmodules="tremor(external) $codecmodules" - res_comment="external Tremor" - extra_ldflags="$extra_ldflags -logg -lvorbisidec" -elif test "$_libvorbis" = yes ; then - _vorbis=yes - def_vorbis='#define CONFIG_OGGVORBIS 1' - codecmodules="libvorbis $codecmodules" - res_comment="libvorbis" - extra_ldflags="$extra_ldflags -lvorbis -logg" -else - _vorbis=no - nocodecmodules="libvorbis $nocodecmodules" -fi -echores "$_vorbis" - -echocheck "libspeex (version >= 1.1 required)" -if test "$_speex" = auto ; then - _speex=no - cat > $TMPC << EOF -#include -#include -int main(void) { SpeexBits bits; void *dec = NULL; speex_decode_int(dec, &bits, dec); return 0; } -EOF - cc_check -lspeex $_ld_lm && _speex=yes -fi -if test "$_speex" = yes ; then - def_speex='#define CONFIG_SPEEX 1' - extra_ldflags="$extra_ldflags -lspeex" - codecmodules="speex $codecmodules" -else - def_speex='#undef CONFIG_SPEEX' - nocodecmodules="speex $nocodecmodules" -fi -echores "$_speex" - -echocheck "OggTheora support" -if test "$_theora" = auto ; then - _theora=no - if pkg_config_add theora ; then - _theora=yes - fi -fi -if test "$_theora" = yes ; then - def_theora='#define CONFIG_OGGTHEORA 1' - codecmodules="libtheora $codecmodules" -else - def_theora='#undef CONFIG_OGGTHEORA' - nocodecmodules="libtheora $nocodecmodules" -fi -echores "$_theora" # Any version of libmpg123 that knows MPG123_RESYNC_LIMIT shall be fine. # That is, 1.2.0 onwards. Recommened is 1.14 onwards, though. @@ -3514,32 +3420,6 @@ else fi echores "$_libdca" -echocheck "libmpcdec (musepack, version >= 1.2.1 required)" -if test "$_musepack" = yes ; then - _musepack=no - cat > $TMPC << EOF -#include -#include -int main(void) { - mpc_streaminfo info; - mpc_decoder decoder; - mpc_decoder_set_streaminfo(&decoder, &info); - mpc_decoder_decode_frame(&decoder, NULL, 0, NULL); - return 0; -} -EOF - cc_check -lmpcdec $_ld_lm && _musepack=yes -fi -if test "$_musepack" = yes ; then - def_musepack='#define CONFIG_MUSEPACK 1' - extra_ldflags="$extra_ldflags -lmpcdec" - codecmodules="musepack $codecmodules" -else - def_musepack='#undef CONFIG_MUSEPACK' - nocodecmodules="musepack $nocodecmodules" -fi -echores "$_musepack" - echocheck "FAAD2 support" if test "$_faad" = auto ; then @@ -3819,40 +3699,6 @@ fi echores "$_libdv" -echocheck "Xvid" -if test "$_xvid" = auto ; then - _xvid=no - for _ld_tmp in "-lxvidcore $_ld_lm" "-lxvidcore $_ld_lm $_ld_pthread" ; do - statement_check xvid.h 'xvid_global(0, 0, 0, 0)' $_ld_tmp && - extra_ldflags="$extra_ldflags $_ld_tmp" && _xvid=yes && break - done -fi - -if test "$_xvid" = yes ; then - def_xvid='#define CONFIG_XVID4 1' - codecmodules="xvid $codecmodules" -else - def_xvid='#undef CONFIG_XVID4' - nocodecmodules="xvid $nocodecmodules" -fi -echores "$_xvid" - - -echocheck "libnut" -if test "$_libnut" = auto ; then - _libnut=no - statement_check libnut.h 'nut_context_tt * nut; nut_error(0)' -lnut && _libnut=yes -fi - -if test "$_libnut" = yes ; then - def_libnut='#define CONFIG_LIBNUT 1' - extra_ldflags="$extra_ldflags -lnut" -else - def_libnut='#undef CONFIG_LIBNUT' -fi -echores "$_libnut" - - echocheck "TV interface" if test "$_tv" = yes ; then def_tv='#define CONFIG_TV 1' @@ -4391,7 +4237,6 @@ LIBDVDCSS_INTERNAL = $_libdvdcss_internal LIBMAD = $_mad LIBNEMESI = $_nemesi LCMS2 = $_lcms2 -LIBNUT = $_libnut LIBPOSTPROC = $libpostproc LIBSMBCLIENT = $_smb LIBQUVI = $_libquvi @@ -4402,7 +4247,6 @@ MACOSX_FINDER = $_macosx_finder MD5SUM = $_md5sum MNG = $_mng MPG123 = $_mpg123 -MUSEPACK = $_musepack NATIVE_RTSP = $_native_rtsp NETWORKING = $networking OPENAL = $_openal @@ -4421,7 +4265,6 @@ RADIO=$_radio RADIO_CAPTURE=$_radio_capture REAL_CODECS = $_real RSOUND = $_rsound -SPEEX = $_speex STREAM_CACHE = $_stream_cache TGA = $_tga TV = $_tv @@ -4433,14 +4276,12 @@ TV_V4L2 = $_tv_v4l2 V4L2 = $_v4l2 VCD = $_vcd VDPAU = $_vdpau -VORBIS = $_vorbis VSTREAM = $_vstream WIN32DLL = $_win32dll WIN32_EMULATION = $_win32_emulation X11 = $_x11 XANIM_CODECS = $_xanim XV = $_xv -XVID4 = $_xvid YUV4MPEG = $_yuv4mpeg # FFmpeg @@ -4624,16 +4465,9 @@ $def_libdca $def_libdv $def_mad $def_mpg123 -$def_musepack -$def_speex -$def_theora -$def_tremor -$def_vorbis -$def_xvid $def_zlib $def_libpostproc -$def_libnut /* binary codecs */ diff --git a/etc/codecs.conf b/etc/codecs.conf index 5120406f12..e4618a92d0 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -445,13 +445,6 @@ videocodec ffsgi driver ffmpeg dll sgi -videocodec sgi - info "SGI image" - status working - fourcc SGI1 ; SGI1 is an internal MPlayer FOURCC - driver sgi - out BGR24 - videocodec ffsunras info "FFmpeg SUN Rasterfile" status working @@ -562,14 +555,6 @@ videocodec lzo out YV12,I420 out BGR24 flip -videocodec theora - info "Theora (free, reworked VP3)" - status working - fourcc theo,Thra - driver theora - dll libtheora - out YV12,422P,444P - ; prefer native codecs over win32? ; the win32 codecs probably are (better) optimized and support direct ; rendering, so this may be not the best idea... @@ -1099,41 +1084,6 @@ videocodec fflibdirac driver ffmpeg dll libdirac -videocodec xvid - info "Xvid (MPEG-4)" - status working - fourcc FMP4,fmp4 - fourcc DIVX,divx - fourcc xvid,XVID,XviD,XVIX - fourcc DIV1,div1 divx - fourcc MP4S,mp4s ; ISO MPEG-4 Video V1 - fourcc M4S2,m4s2 - fourcc DX50,dx50,BLZ0 DX50 - fourcc mp4v,MP4V - format 0x4 - fourcc UMP4 - fourcc RMP4 - fourcc 3IV2,3iv2 ; 3ivx Delta 4 - fourcc DXGM - fourcc SEDG ; diskless camcorder Samsung Miniket VP-M110 - fourcc SMP4,smp4 ; Samsung SMP4 video codec - fourcc VIDM ; vidm 4.01 codec - fourcc FFDS - fourcc DCOD,MVXM,EM4A,PM4V - fourcc M4T3,DMK2,DIGI,INMC - fourcc EPHV,SN40,WAWV - fourcc uldx,ULDX,VSPX - format 0x10000004 ; mpeg 4 es - fourcc SIPP ; Samsung SHR-6040 - driver xvid - out YV12 - out I420 - out YUY2 - out UYVY - out YVYU - out BGR32,BGR24,BGR16,BGR15 - dll "libxvidcore.a" - ; is divx4vfw stable enough, working everywhere and faster than divxds? videocodec divx4vfw @@ -3860,13 +3810,6 @@ audiocodec ffadpcmimadk3 driver ffmpeg dll adpcm_ima_dk3 -audiocodec dk3adpcm - info "Duck DK3 ADPCM (rogue format number)" - status working - format 0x62 ; This format number was used by Duck Corp. but not officially - ; registered with Microsoft - driver dk3adpcm - audiocodec ffroqaudio info "Id RoQ File Audio" status working @@ -4501,13 +4444,6 @@ audiocodec ffmusepack8 driver ffmpeg dll "mpc8" -audiocodec musepack - info "Musepack audio codec" - status working - fourcc "MPC " - format 0x2b4d - driver mpcdec - audiocodec ffamrnb info "AMR Narrowband" status working @@ -4630,46 +4566,6 @@ audiocodec ffvorbis driver ffmpeg dll "vorbis" -audiocodec vorbis - info "OggVorbis Audio" - status working - comment "OggVorbis driver using libvorbis" - fourcc vrbs - format 0x566F - driver libvorbis - dll "libvorbis" - -audiocodec tremor - info "OggVorbis audio" - status working - comment "fixed-point decoder useful for systems without floating-point unit" - fourcc vrbs - format 0x566F - driver tremor - dll "tremor" - -audiocodec vorbisacm - info "OggVorbis ACM" - status working - comment "OggVorbis driver using vorbis.acm" - format 0x674F ; mode1 - format 0x6750 ; mode2 -; format 0x6751 ; mode3 - format 0x676F ; mode1+ - format 0x6770 ; mode2+ - format 0x6771 ; mode3+ - driver acm - dll "vorbis.acm" - -audiocodec speex - info "Speex audio" - status working - comment "Speex driver using libspeex" - fourcc 'spx ' - format 0xA109 - driver speex - dll "speex" - audiocodec vivoaudio info "Vivo G.723/Siren Audio Codec" status working @@ -4797,13 +4693,6 @@ audiocodec fftwinvq driver ffmpeg dll twinvq -audiocodec TwinVQ - info "VQF codec by NTTLabs" - status working - fourcc TWIN - driver vqf - dll "tvqdec.dll" - audiocodec hwmpa info "MPEG audio pass-through for hardware MPEG decoders" status working diff --git a/libmpcodecs/ad.c b/libmpcodecs/ad.c index 0ab5d44971..dce8f9f710 100644 --- a/libmpcodecs/ad.c +++ b/libmpcodecs/ad.c @@ -41,20 +41,14 @@ extern const ad_functions_t mpcodecs_ad_dvdpcm; extern const ad_functions_t mpcodecs_ad_alaw; extern const ad_functions_t mpcodecs_ad_imaadpcm; extern const ad_functions_t mpcodecs_ad_msadpcm; -extern const ad_functions_t mpcodecs_ad_dk3adpcm; -extern const ad_functions_t mpcodecs_ad_dk4adpcm; extern const ad_functions_t mpcodecs_ad_dshow; extern const ad_functions_t mpcodecs_ad_dmo; extern const ad_functions_t mpcodecs_ad_acm; extern const ad_functions_t mpcodecs_ad_faad; -extern const ad_functions_t mpcodecs_ad_libvorbis; -extern const ad_functions_t mpcodecs_ad_speex; extern const ad_functions_t mpcodecs_ad_libmad; extern const ad_functions_t mpcodecs_ad_realaud; extern const ad_functions_t mpcodecs_ad_libdv; extern const ad_functions_t mpcodecs_ad_qtaudio; -extern const ad_functions_t mpcodecs_ad_twin; -extern const ad_functions_t mpcodecs_ad_libmusepack; extern const ad_functions_t mpcodecs_ad_libdca; const ad_functions_t * const mpcodecs_ad_drivers[] = @@ -73,7 +67,6 @@ const ad_functions_t * const mpcodecs_ad_drivers[] = &mpcodecs_ad_alaw, &mpcodecs_ad_imaadpcm, &mpcodecs_ad_msadpcm, - &mpcodecs_ad_dk3adpcm, #ifdef CONFIG_WIN32DLL &mpcodecs_ad_dshow, &mpcodecs_ad_dmo, @@ -86,12 +79,6 @@ const ad_functions_t * const mpcodecs_ad_drivers[] = #ifdef CONFIG_FAAD &mpcodecs_ad_faad, #endif -#ifdef CONFIG_OGGVORBIS - &mpcodecs_ad_libvorbis, -#endif -#ifdef CONFIG_SPEEX - &mpcodecs_ad_speex, -#endif #ifdef CONFIG_LIBMAD &mpcodecs_ad_libmad, #endif @@ -101,9 +88,6 @@ const ad_functions_t * const mpcodecs_ad_drivers[] = #ifdef CONFIG_LIBDV095 &mpcodecs_ad_libdv, #endif -#ifdef CONFIG_MUSEPACK - &mpcodecs_ad_libmusepack, -#endif #ifdef CONFIG_LIBDCA &mpcodecs_ad_libdca, #endif diff --git a/libmpcodecs/ad_dk3adpcm.c b/libmpcodecs/ad_dk3adpcm.c deleted file mode 100644 index 15027f88b1..0000000000 --- a/libmpcodecs/ad_dk3adpcm.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * DK3 ADPCM decoder - * - * "This format number was used by Duck Corp. but not officially - * registered with Microsoft" - * - * This file is responsible for decoding audio data encoded with - * Duck Corp's DK3 ADPCM algorithm. Details about the data format - * can be found here: - * http://www.pcisys.net/~melanson/codecs/ - * - * Copyright (c) 2002 Mike Melanson - * - * 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 -#include -#include - -#include - -#include "config.h" -#include "ad_internal.h" - -static const ad_info_t info = -{ - "Duck Corp. DK3 ADPCM decoder", - "dk3adpcm", - "Nick Kurshev", - "Mike Melanson", - "" -}; - -LIBAD_EXTERN(dk3adpcm) - -#define DK3_ADPCM_PREAMBLE_SIZE 16 - -// useful macros -// clamp a number between 0 and 88 -#define CLAMP_0_TO_88(x) if (x < 0) x = 0; else if (x > 88) x = 88; -// clamp a number within a signed 16-bit range -#define CLAMP_S16(x) if (x < -32768) x = -32768; \ - else if (x > 32767) x = 32767; -// clamp a number above 16 -#define CLAMP_ABOVE_16(x) if (x < 16) x = 16; -// sign extend a 16-bit value -#define SE_16BIT(x) if (x & 0x8000) x -= 0x10000; -// sign extend a 4-bit value -#define SE_4BIT(x) if (x & 0x8) x -= 0x10; - -// pertinent tables -static int adpcm_step[89] = -{ - 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, - 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, - 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, - 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, - 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, - 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, - 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, - 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, - 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 -}; - -static int adpcm_index[16] = -{ - -1, -1, -1, -1, 2, 4, 6, 8, - -1, -1, -1, -1, 2, 4, 6, 8 -}; - -static int preinit(sh_audio_t *sh_audio) -{ - sh_audio->audio_out_minsize = sh_audio->wf->nBlockAlign * 6; - sh_audio->ds->ss_div = - (sh_audio->wf->nBlockAlign - DK3_ADPCM_PREAMBLE_SIZE) * 8 / 3; - sh_audio->audio_in_minsize= - sh_audio->ds->ss_mul = sh_audio->wf->nBlockAlign; - return 1; -} - -static int init(sh_audio_t *sh_audio) -{ - sh_audio->channels = sh_audio->wf->nChannels; - sh_audio->samplerate = sh_audio->wf->nSamplesPerSec; - sh_audio->i_bps = - (sh_audio->ds->ss_mul * sh_audio->samplerate) / sh_audio->ds->ss_div; - sh_audio->samplesize=2; - return 1; -} - -static void uninit(sh_audio_t *sh_audio) -{ -} - -static int control(sh_audio_t *sh_audio,int cmd,void* arg, ...) -{ - if(cmd==ADCTRL_SKIP_FRAME){ - demux_read_data(sh_audio->ds, sh_audio->a_in_buffer,sh_audio->ds->ss_mul); - return CONTROL_TRUE; - } - return CONTROL_UNKNOWN; -} - -#define DK3_GET_NEXT_NIBBLE() \ - if (decode_top_nibble_next) \ - { \ - nibble = (last_byte >> 4) & 0x0F; \ - decode_top_nibble_next = 0; \ - } \ - else \ - { \ - last_byte = input[in_ptr++]; \ - nibble = last_byte & 0x0F; \ - decode_top_nibble_next = 1; \ - } - -// note: This decoder assumes the format 0x62 data always comes in -// stereo flavor -static int dk3_adpcm_decode_block(unsigned short *output, unsigned char *input, - int block_size) -{ - int sum_pred; - int diff_pred; - int sum_index; - int diff_index; - int diff_channel; - int in_ptr = 0x10; - int out_ptr = 0; - - unsigned char last_byte = 0; - unsigned char nibble; - int decode_top_nibble_next = 0; - - // ADPCM work variables - int sign; - int delta; - int step; - int diff; - - sum_pred = AV_RL16(&input[10]); - diff_pred = AV_RL16(&input[12]); - SE_16BIT(sum_pred); - SE_16BIT(diff_pred); - diff_channel = diff_pred; - sum_index = input[14]; - diff_index = input[15]; - - while (in_ptr < block_size - !decode_top_nibble_next) -// while (in_ptr < 2048) - { - // process the first predictor of the sum channel - DK3_GET_NEXT_NIBBLE(); - - step = adpcm_step[sum_index]; - - sign = nibble & 8; - delta = nibble & 7; - - diff = step >> 3; - if (delta & 4) diff += step; - if (delta & 2) diff += step >> 1; - if (delta & 1) diff += step >> 2; - - if (sign) - sum_pred -= diff; - else - sum_pred += diff; - - CLAMP_S16(sum_pred); - - sum_index += adpcm_index[nibble]; - CLAMP_0_TO_88(sum_index); - - // process the diff channel predictor - DK3_GET_NEXT_NIBBLE(); - - step = adpcm_step[diff_index]; - - sign = nibble & 8; - delta = nibble & 7; - - diff = step >> 3; - if (delta & 4) diff += step; - if (delta & 2) diff += step >> 1; - if (delta & 1) diff += step >> 2; - - if (sign) - diff_pred -= diff; - else - diff_pred += diff; - - CLAMP_S16(diff_pred); - - diff_index += adpcm_index[nibble]; - CLAMP_0_TO_88(diff_index); - - // output the first pair of stereo PCM samples - diff_channel = (diff_channel + diff_pred) / 2; - output[out_ptr++] = sum_pred + diff_channel; - output[out_ptr++] = sum_pred - diff_channel; - - // process the second predictor of the sum channel - DK3_GET_NEXT_NIBBLE(); - - step = adpcm_step[sum_index]; - - sign = nibble & 8; - delta = nibble & 7; - - diff = step >> 3; - if (delta & 4) diff += step; - if (delta & 2) diff += step >> 1; - if (delta & 1) diff += step >> 2; - - if (sign) - sum_pred -= diff; - else - sum_pred += diff; - - CLAMP_S16(sum_pred); - - sum_index += adpcm_index[nibble]; - CLAMP_0_TO_88(sum_index); - - // output the second pair of stereo PCM samples - output[out_ptr++] = sum_pred + diff_channel; - output[out_ptr++] = sum_pred - diff_channel; - } - - return out_ptr; -} - -static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen) -{ - if (demux_read_data(sh_audio->ds, sh_audio->a_in_buffer, - sh_audio->ds->ss_mul) != - sh_audio->ds->ss_mul) - return -1; /* EOF */ - - if (maxlen < 2 * 4 * sh_audio->wf->nBlockAlign * 2 / 3) { - mp_msg(MSGT_DECAUDIO, MSGL_V, "dk3adpcm: maxlen too small in decode_audio\n"); - return -1; - } - return 2 * dk3_adpcm_decode_block( - (unsigned short*)buf, sh_audio->a_in_buffer, - sh_audio->ds->ss_mul); -} diff --git a/libmpcodecs/ad_libvorbis.c b/libmpcodecs/ad_libvorbis.c deleted file mode 100644 index a768095187..0000000000 --- a/libmpcodecs/ad_libvorbis.c +++ /dev/null @@ -1,350 +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 -#include -#include -#include -#include - -#include "config.h" -#include "ad_internal.h" -#include "libaf/reorder_ch.h" - -static const ad_info_t info = -{ - "Ogg/Vorbis audio decoder", -#ifdef CONFIG_TREMOR - "tremor", -#else - "libvorbis", -#endif - "Felix Buenemann, A'rpi", - "libvorbis", - "" -}; - -LIBAD_EXTERN(libvorbis) - -#ifdef CONFIG_TREMOR -#include -#else -#include -#endif - -// This struct is also defined in demux_ogg.c => common header ? -typedef struct ov_struct_st { - vorbis_info vi; /* struct that stores all the static vorbis bitstream - settings */ - vorbis_comment vc; /* struct that stores all the bitstream user comments */ - vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ - vorbis_block vb; /* local working space for packet->PCM decode */ - float rg_scale; /* replaygain scale */ -#ifdef CONFIG_TREMOR - int rg_scale_int; -#endif -} ov_struct_t; - -static int read_vorbis_comment( char* ptr, const char* comment, const char* format, ... ) { - va_list va; - int clen, ret; - - va_start( va, format ); - clen = strlen( comment ); - ret = strncasecmp( ptr, comment, clen) == 0 ? vsscanf( ptr+clen, format, va ) : 0; - va_end( va ); - - return ret; -} - -static int preinit(sh_audio_t *sh) -{ - sh->audio_out_minsize=1024*4; // 1024 samples/frame - return 1; -} - -static int init(sh_audio_t *sh) -{ - unsigned int offset, i, length, hsizes[3]; - void *headers[3]; - unsigned char* extradata; - ogg_packet op; - vorbis_comment vc; - struct ov_struct_st *ov; -#define ERROR() { \ - vorbis_comment_clear(&vc); \ - vorbis_info_clear(&ov->vi); \ - free(ov); \ - return 0; \ - } - - /// Init the decoder with the 3 header packets - ov = malloc(sizeof(struct ov_struct_st)); - vorbis_info_init(&ov->vi); - vorbis_comment_init(&vc); - - if(! sh->wf) { - mp_msg(MSGT_DECAUDIO,MSGL_ERR,"ad_vorbis, extradata seems to be absent! exit\n"); - ERROR(); - } - - if(! sh->wf->cbSize) { - mp_msg(MSGT_DECAUDIO,MSGL_ERR,"ad_vorbis, extradata seems to be absent!, exit\n"); - ERROR(); - } - - mp_msg(MSGT_DECAUDIO,MSGL_V,"ad_vorbis, extradata seems is %d bytes long\n", sh->wf->cbSize); - extradata = (char*) (sh->wf+1); - if(!extradata) { - mp_msg(MSGT_DECAUDIO,MSGL_ERR,"ad_vorbis, extradata seems to be NULL!, exit\n"); - ERROR(); - } - - if(*extradata != 2) { - mp_msg (MSGT_DEMUX, MSGL_WARN, "ad_vorbis: Vorbis track does not contain valid headers.\n"); - ERROR(); - } - - offset = 1; - for (i=0; i < 2; i++) { - length = 0; - while ((extradata[offset] == (unsigned char) 0xFF) && length < sh->wf->cbSize) { - length += 255; - offset++; - } - if(offset >= (sh->wf->cbSize - 1)) { - mp_msg (MSGT_DEMUX, MSGL_WARN, "ad_vorbis: Vorbis track does not contain valid headers.\n"); - ERROR(); - } - length += extradata[offset]; - offset++; - mp_msg (MSGT_DEMUX, MSGL_V, "ad_vorbis, offset: %u, length: %u\n", offset, length); - hsizes[i] = length; - } - - headers[0] = &extradata[offset]; - headers[1] = &extradata[offset + hsizes[0]]; - headers[2] = &extradata[offset + hsizes[0] + hsizes[1]]; - hsizes[2] = sh->wf->cbSize - offset - hsizes[0] - hsizes[1]; - mp_msg (MSGT_DEMUX, MSGL_V, "ad_vorbis, header sizes: %d %d %d\n", hsizes[0], hsizes[1], hsizes[2]); - - for(i=0; i<3; i++) { - op.bytes = hsizes[i]; - op.packet = headers[i]; - op.b_o_s = (i == 0); - if(vorbis_synthesis_headerin(&ov->vi,&vc,&op) <0) { - mp_msg(MSGT_DECAUDIO,MSGL_ERR,"OggVorbis: header n. %d broken! len=%ld\n", i, op.bytes); - ERROR(); - } - if(i == 2) { - float rg_gain=0.f, rg_peak=0.f; - char **ptr=vc.user_comments; - while(*ptr){ - mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbisComment: %s\n",*ptr); - /* replaygain */ - read_vorbis_comment( *ptr, "replaygain_album_gain=", "%f", &rg_gain ); - read_vorbis_comment( *ptr, "rg_audiophile=", "%f", &rg_gain ); - if( !rg_gain ) { - read_vorbis_comment( *ptr, "replaygain_track_gain=", "%f", &rg_gain ); - read_vorbis_comment( *ptr, "rg_radio=", "%f", &rg_gain ); - } - read_vorbis_comment( *ptr, "replaygain_album_peak=", "%f", &rg_peak ); - if( !rg_peak ) { - read_vorbis_comment( *ptr, "replaygain_track_peak=", "%f", &rg_peak ); - read_vorbis_comment( *ptr, "rg_peak=", "%f", &rg_peak ); - } - ++ptr; - } - /* replaygain: scale */ - if(!rg_gain) - ov->rg_scale = 1.f; /* just in case pow() isn't standard-conformant */ - else - ov->rg_scale = pow(10.f, rg_gain/20); - /* replaygain: anticlip */ - if(ov->rg_scale * rg_peak > 1.f) - ov->rg_scale = 1.f / rg_peak; - /* replaygain: security */ - if(ov->rg_scale > 15.) - ov->rg_scale = 15.; -#ifdef CONFIG_TREMOR - ov->rg_scale_int = (int)(ov->rg_scale*64.f); -#endif - mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: Bitstream is %d channel%s, %dHz, %dbit/s %cBR\n",(int)ov->vi.channels,ov->vi.channels>1?"s":"",(int)ov->vi.rate,(int)ov->vi.bitrate_nominal, - (ov->vi.bitrate_lower!=ov->vi.bitrate_nominal)||(ov->vi.bitrate_upper!=ov->vi.bitrate_nominal)?'V':'C'); - if(rg_gain || rg_peak) - mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: Gain = %+.2f dB, Peak = %.4f, Scale = %.2f\n", rg_gain, rg_peak, ov->rg_scale); - mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: Encoded by: %s\n",vc.vendor); - } - } - - vorbis_comment_clear(&vc); - -// printf("lower=%d upper=%d \n",(int)ov->vi.bitrate_lower,(int)ov->vi.bitrate_upper); - - // Setup the decoder - sh->channels=ov->vi.channels; - sh->samplerate=ov->vi.rate; - sh->samplesize=2; - // assume 128kbit if bitrate not specified in the header - sh->i_bps=((ov->vi.bitrate_nominal>0) ? ov->vi.bitrate_nominal : 128000)/8; - sh->context = ov; - - /// Finish the decoder init - vorbis_synthesis_init(&ov->vd,&ov->vi); - vorbis_block_init(&ov->vd,&ov->vb); - mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: Init OK!\n"); - - return 1; -} - -static void uninit(sh_audio_t *sh) -{ - struct ov_struct_st *ov = sh->context; - vorbis_dsp_clear(&ov->vd); - vorbis_block_clear(&ov->vb); - vorbis_info_clear(&ov->vi); - free(ov); -} - -static int control(sh_audio_t *sh,int cmd,void* arg, ...) -{ - switch(cmd) - { -#if 0 - case ADCTRL_RESYNC_STREAM: - return CONTROL_TRUE; - case ADCTRL_SKIP_FRAME: - return CONTROL_TRUE; -#endif - } - return CONTROL_UNKNOWN; -} - -static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) -{ - int len = 0; - int samples; -#ifdef CONFIG_TREMOR - ogg_int32_t **pcm; -#else - float scale; - float **pcm; -#endif - struct ov_struct_st *ov = sh->context; - while(len < minlen) { - while((samples=vorbis_synthesis_pcmout(&ov->vd,&pcm))<=0){ - ogg_packet op; - double pts; - memset(&op,0,sizeof(op)); //op.b_o_s = op.e_o_s = 0; - op.bytes = ds_get_packet_pts(sh->ds,&op.packet, &pts); - if(op.bytes<=0) break; - if (pts != MP_NOPTS_VALUE) { - sh->pts = pts; - sh->pts_bytes = 0; - } - if(vorbis_synthesis(&ov->vb,&op)==0) /* test for success! */ - vorbis_synthesis_blockin(&ov->vd,&ov->vb); - } - if(samples<=0) break; // error/EOF - while(samples>0){ - int i,j; - int clipflag=0; - int convsize=(maxlen-len)/(2*ov->vi.channels); // max size! - int bout=((samplesrg_scale_int == 64) { - for(i=0;ivi.channels;i++){ - ogg_int16_t *convbuffer=(ogg_int16_t *)(&buf[len]); - ogg_int16_t *ptr=convbuffer+i; - ogg_int32_t *mono=pcm[i]; - for(j=0;j>9; - /* might as well guard against clipping */ - if(val>32767){ - val=32767; - clipflag=1; - } - if(val<-32768){ - val=-32768; - clipflag=1; - } - *ptr=val; - ptr+=ov->vi.channels; - } - } - } else -#endif /* CONFIG_TREMOR */ - { -#ifndef CONFIG_TREMOR - scale = 32767.f * ov->rg_scale; -#endif - for(i=0;ivi.channels;i++){ - ogg_int16_t *convbuffer=(ogg_int16_t *)(&buf[len]); - ogg_int16_t *ptr=convbuffer+i; -#ifdef CONFIG_TREMOR - ogg_int32_t *mono=pcm[i]; - for(j=0;jrg_scale_int)>>(9+6); -#else - float *mono=pcm[i]; - for(j=0;j32767){ - val=32767; - clipflag=1; - } - if(val<-32768){ - val=-32768; - clipflag=1; - } -#endif /* CONFIG_TREMOR */ - *ptr=val; - ptr+=ov->vi.channels; - } - } - } - - if(clipflag) - mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"Clipping in frame %ld\n",(long)(ov->vd.sequence)); - len+=2*ov->vi.channels*bout; - sh->pts_bytes += 2*ov->vi.channels*bout; - mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"\n[decoded: %d / %d ]\n",bout,samples); - samples-=bout; - vorbis_synthesis_read(&ov->vd,bout); /* tell libvorbis how - many samples we - actually consumed */ - } //while(samples>0) -// if (!samples) break; // why? how? - } - - if (len > 0 && ov->vi.channels >= 5) { - reorder_channel_nch(buf, AF_CHANNEL_LAYOUT_VORBIS_DEFAULT, - AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, - ov->vi.channels, len / sh->samplesize, - sh->samplesize); - } - - - return len; -} diff --git a/libmpcodecs/ad_mpc.c b/libmpcodecs/ad_mpc.c deleted file mode 100644 index 979dce6178..0000000000 --- a/libmpcodecs/ad_mpc.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Musepack audio files decoder for MPlayer - * by Reza Jelveh and - * Reimar Döffinger - * - * This code may be be relicensed under the terms of the GNU LGPL when it - * becomes part of the FFmpeg project (ffmpeg.org) - * - * 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 -#include -#include - -#include "config.h" -#include "ad_internal.h" -#include "libaf/af_format.h" -#include "libvo/fastmemcpy.h" - -static const ad_info_t info = -{ - "Musepack audio decoder", - "mpcdec", - "Reza Jelveh and Reimar Döffinger", - "", - "" -}; - -LIBAD_EXTERN(libmusepack) - -#include - -// BUFFER_LENGTH is in MPC_SAMPLE_FORMAT units -#define MAX_FRAMESIZE (4 * MPC_DECODER_BUFFER_LENGTH) -//! this many frames should decode good after seeking -#define MIN_SEEK_GOOD 5 -//! how many frames to discard at most after seeking -#define MAX_SEEK_DISCARD 50 - -typedef struct context_s { - char *header; - int header_len; - sh_audio_t *sh; - uint32_t pos; - mpc_decoder decoder; -} context_t; - -/** - * \brief mpc_reader callback function for reading the header - */ -static mpc_int32_t cb_read(void *data, void *buf, mpc_int32_t size) { - context_t *d = (context_t *)data; - char *p = (char *)buf; - int s = size; - if (d->pos < d->header_len) { - if (s > d->header_len - d->pos) - s = d->header_len - d->pos; - fast_memcpy(p, &d->header[d->pos], s); - } else - s = 0; - memset(&p[s], 0, size - s); - d->pos += size; - return size; -} - -/** - * \brief dummy mpc_reader callback function for seeking - */ -static mpc_bool_t cb_seek(void *data, mpc_int32_t offset ) { - context_t *d = (context_t *)data; - d->pos = offset; - return 1; -} - -/** - * \brief dummy mpc_reader callback function for getting stream position - */ -static mpc_int32_t cb_tell(void *data) { - context_t *d = (context_t *)data; - return d->pos; -} - -/** - * \brief dummy mpc_reader callback function for getting stream length - */ -static mpc_int32_t cb_get_size(void *data) { - return 1 << 30; -} - -/** - * \brief mpc_reader callback function, we cannot seek. - */ -static mpc_bool_t cb_canseek(void *data) { - return 0; -} - - -mpc_reader header_reader = { - .read = cb_read, .seek = cb_seek, .tell = cb_tell, - .get_size = cb_get_size, .canseek = cb_canseek -}; - -static int preinit(sh_audio_t *sh) { - sh->audio_out_minsize = MAX_FRAMESIZE; - return 1; -} - -static void uninit(sh_audio_t *sh) { - free(sh->context); - sh->context = NULL; -} - -static int init(sh_audio_t *sh) { - mpc_streaminfo info; - context_t *cd = malloc(sizeof(context_t)); - - if (!sh->wf || (sh->wf->cbSize < 6 * 4)) { - mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Missing extradata!\n"); - return 0; - } - cd->header = (char *)(sh->wf + 1); - cd->header_len = sh->wf->cbSize; - cd->sh = sh; - cd->pos = 0; - sh->context = (char *)cd; - - /* read file's streaminfo data */ - mpc_streaminfo_init(&info); - header_reader.data = cd; - if (mpc_streaminfo_read(&info, &header_reader) != ERROR_CODE_OK) { - mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Not a valid musepack file.\n"); - return 0; - } -// this value is nonsense, since it relies on the get_size function. -// use the value from the demuxer instead. -// sh->i_bps = info.average_bitrate / 8; - sh->channels = info.channels; - sh->samplerate = info.sample_freq; - sh->samplesize = 4; - sh->sample_format = -#if MPC_SAMPLE_FORMAT == float - AF_FORMAT_FLOAT_NE; -#elif MPC_SAMPLE_FORMAT == mpc_int32_t - AF_FORMAT_S32_NE; -#else - #error musepack lib must use either float or mpc_int32_t sample format -#endif - - mpc_decoder_setup(&cd->decoder, NULL); - mpc_decoder_set_streaminfo(&cd->decoder, &info); - return 1; -} - -// FIXME: minlen is currently ignored -static int decode_audio(sh_audio_t *sh, unsigned char *buf, - int minlen, int maxlen) { - int status, len; - MPC_SAMPLE_FORMAT *sample_buffer = (MPC_SAMPLE_FORMAT *)buf; - mpc_uint32_t *packet = NULL; - - context_t *cd = (context_t *) sh->context; - if (maxlen < MAX_FRAMESIZE) { - mp_msg(MSGT_DECAUDIO, MSGL_V, "maxlen too small in decode_audio\n"); - return -1; - } - len = ds_get_packet(sh->ds, (unsigned char **)&packet); - if (len <= 0) return -1; - status = mpc_decoder_decode_frame(&cd->decoder, packet, len, sample_buffer); - if (status == -1) // decode error - mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Error decoding file.\n"); - if (status <= 0) // error or EOF - return -1; - - status = MPC_FRAME_LENGTH * sh->channels; // one sample per channel -#if MPC_SAMPLE_FORMAT == float || MPC_SAMPLE_FORMAT == mpc_int32_t - status *= 4; -#else - // should not happen - status *= 2; -#endif - return status; -} - -/** - * \brief check if the decoded values are in a sane range - * \param buf decoded buffer - * \param len length of buffer in bytes - * \return 1 if all values are in (-1.01, 1.01) range, 0 otherwise - */ -static int check_clip(void *buf, int len) { -#if MPC_SAMPLE_FORMAT == float - float *p = buf; - if (len < 4) return 1; - len = -len / 4; - p = &p[-len]; - do { - if (p[len] < -1 || p[len] > 1) return 0; - } while (++len); -#endif - return 1; -} - -static int control(sh_audio_t *sh, int cmd, void* arg, ...) { - if (cmd == ADCTRL_RESYNC_STREAM) { - unsigned char *buf = malloc(MAX_FRAMESIZE); - int i; - int nr_ok = 0; - for (i = 0; i < MAX_SEEK_DISCARD; i++) { - int len = decode_audio(sh, buf, 0, MAX_FRAMESIZE); - if (check_clip(buf, len)) nr_ok++; else nr_ok = 0; - if (nr_ok > MIN_SEEK_GOOD) break; - } - free(buf); - } - return CONTROL_UNKNOWN; -} diff --git a/libmpcodecs/ad_speex.c b/libmpcodecs/ad_speex.c deleted file mode 100644 index c9ac1a42c6..0000000000 --- a/libmpcodecs/ad_speex.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Speex decoder by Reimar Döffinger - * - * This code may be be relicensed under the terms of the GNU LGPL when it - * becomes part of the FFmpeg project (ffmpeg.org) - * - * 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 "config.h" -#include -#include -#include -#include -#include "ad_internal.h" - -static const ad_info_t info = { - "Speex audio decoder", - "speex", - "Reimar Döffinger", - "", - "" -}; - -LIBAD_EXTERN(speex) - -typedef struct { - SpeexBits bits; - void *dec_context; - SpeexStereoState stereo; - SpeexHeader *hdr; -} context_t; - -#define MAX_FRAMES_PER_PACKET 100 - -static int preinit(sh_audio_t *sh) { - sh->audio_out_minsize = 2 * 320 * MAX_FRAMES_PER_PACKET * 2 * sizeof(short); - return 1; -} - -static int read_le32(const uint8_t **src) { - const uint8_t *p = *src; - *src += 4; - return p[0] + (p[1] << 8) + (p[2] << 16) + (p[3] << 24); -} - -static int init(sh_audio_t *sh) { - context_t *ctx = calloc(1, sizeof(context_t)); - const uint8_t *hdr = (const uint8_t *)(sh->wf + 1); - const SpeexMode *spx_mode; - const SpeexStereoState st_st = SPEEX_STEREO_STATE_INIT; // hack - if (sh->wf && sh->wf->cbSize >= 80) - ctx->hdr = speex_packet_to_header((char *)&sh->wf[1], sh->wf->cbSize); - if (!ctx->hdr && sh->wf->cbSize == 0x72 && hdr[0] == 1 && hdr[1] == 0) { - // speex.acm format: raw SpeexHeader dump - ctx->hdr = calloc(1, sizeof(*ctx->hdr)); - hdr += 2; - hdr += 8; // identifier string - hdr += 20; // version string - ctx->hdr->speex_version_id = read_le32(&hdr); - ctx->hdr->header_size = read_le32(&hdr); - ctx->hdr->rate = read_le32(&hdr); - ctx->hdr->mode = read_le32(&hdr); - ctx->hdr->mode_bitstream_version = read_le32(&hdr); - ctx->hdr->nb_channels = read_le32(&hdr); - ctx->hdr->bitrate = read_le32(&hdr); - ctx->hdr->frame_size = read_le32(&hdr); - ctx->hdr->vbr = read_le32(&hdr); - ctx->hdr->frames_per_packet = read_le32(&hdr); - } - if (!ctx->hdr) { - mp_msg(MSGT_DECAUDIO, MSGL_ERR, "Invalid or missing extradata! Assuming defaults.\n"); - ctx->hdr = calloc(1, sizeof(*ctx->hdr)); - ctx->hdr->frames_per_packet = 1; - ctx->hdr->mode = 0; - if (sh->wf) { - ctx->hdr->nb_channels = sh->wf->nChannels; - ctx->hdr->rate = sh->wf->nSamplesPerSec; - if (ctx->hdr->rate > 16000) - ctx->hdr->mode = 2; - else if (ctx->hdr->rate > 8000) - ctx->hdr->mode = 1; - } - } - if (ctx->hdr->nb_channels != 1 && ctx->hdr->nb_channels != 2) { - mp_msg(MSGT_DECAUDIO, MSGL_WARN, "Invalid number of channels (%i), " - "assuming mono\n", ctx->hdr->nb_channels); - ctx->hdr->nb_channels = 1; - } - if (ctx->hdr->frames_per_packet > MAX_FRAMES_PER_PACKET) { - mp_msg(MSGT_DECAUDIO, MSGL_WARN, "Invalid number of frames per packet (%i), " - "assuming 1\n", ctx->hdr->frames_per_packet); - ctx->hdr->frames_per_packet = 1; - } - switch (ctx->hdr->mode) { - case 0: - spx_mode = &speex_nb_mode; break; - case 1: - spx_mode = &speex_wb_mode; break; - case 2: - spx_mode = &speex_uwb_mode; break; - default: - mp_msg(MSGT_DECAUDIO, MSGL_WARN, "Unknown speex mode (%i)\n", ctx->hdr->mode); - spx_mode = &speex_nb_mode; - } - ctx->dec_context = speex_decoder_init(spx_mode); - speex_bits_init(&ctx->bits); - memcpy(&ctx->stereo, &st_st, sizeof(ctx->stereo)); // hack part 2 - sh->channels = ctx->hdr->nb_channels; - sh->samplerate = ctx->hdr->rate; - sh->samplesize = 2; - sh->sample_format = AF_FORMAT_S16_NE; - sh->context = ctx; - return 1; -} - -static void uninit(sh_audio_t *sh) { - context_t *ctx = sh->context; - if (ctx) { - speex_bits_destroy(&ctx->bits); - speex_decoder_destroy(ctx->dec_context); - free(ctx->hdr); - free(ctx); - } - ctx = NULL; -} - -static int decode_audio(sh_audio_t *sh, unsigned char *buf, - int minlen, int maxlen) { - double pts; - context_t *ctx = sh->context; - int len, framelen, framesamples; - char *packet; - int i, err; - speex_decoder_ctl(ctx->dec_context, SPEEX_GET_FRAME_SIZE, &framesamples); - framelen = framesamples * ctx->hdr->nb_channels * sizeof(short); - if (maxlen < ctx->hdr->frames_per_packet * framelen) { - mp_msg(MSGT_DECAUDIO, MSGL_V, "maxlen too small in decode_audio\n"); - return -1; - } - len = ds_get_packet_pts(sh->ds, (unsigned char **)&packet, &pts); - if (len <= 0) return -1; - if (sh->pts == MP_NOPTS_VALUE) - sh->pts = 0; - if (pts != MP_NOPTS_VALUE) { - sh->pts = pts; - sh->pts_bytes = 0; - } - speex_bits_read_from(&ctx->bits, packet, len); - i = ctx->hdr->frames_per_packet; - do { - err = speex_decode_int(ctx->dec_context, &ctx->bits, (short *)buf); - if (err == -2) - mp_msg(MSGT_DECAUDIO, MSGL_ERR, "Error decoding file.\n"); - if (ctx->hdr->nb_channels == 2) - speex_decode_stereo_int((short *)buf, framesamples, &ctx->stereo); - buf = &buf[framelen]; - } while (--i > 0); - sh->pts_bytes += ctx->hdr->frames_per_packet * framelen; - return ctx->hdr->frames_per_packet * framelen; -} - -static int control(sh_audio_t *sh, int cmd, void *arg, ...) { - return CONTROL_UNKNOWN; -} diff --git a/libmpcodecs/ad_twin.c b/libmpcodecs/ad_twin.c deleted file mode 100644 index 9aa304e4fc..0000000000 --- a/libmpcodecs/ad_twin.c +++ /dev/null @@ -1,523 +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 -#include -#include -#include "config.h" - -#include "ad_internal.h" -#include "vqf.h" -#include "libmpdemux/aviprint.h" -#include "loader/ldt_keeper.h" -#include "loader/wine/windef.h" -#include "libaf/af_format.h" - - -static const ad_info_t info = -{ - "TWinVQ decoder", - "vqf", - "Roberto Togni", - "Nick Kurshev", - "Ported from MPlayerXP" -}; - -LIBAD_EXTERN(twin) - -void* WINAPI LoadLibraryA(char* name); -void* WINAPI GetProcAddress(void* handle, char* func); -int WINAPI FreeLibrary(void* handle); - -static int (*TvqInitialize)( headerInfo *setupInfo, INDEX *index, int dispErrorMessageBox ); -static void (*TvqTerminate)( INDEX *index ); -static void (*TvqGetVectorInfo)(int *bits0[], int *bits1[]); - -static void (*TvqDecodeFrame)(INDEX *indexp, float out[]); -static int (*TvqWtypeToBtype)( int w_type, int *btype ); -static void (*TvqUpdateVectorInfo)(int varbits, int *ndiv, int bits0[], int bits1[]); - -static int (*TvqCheckVersion)(char *versionID); -static void (*TvqGetConfInfo)(tvqConfInfo *cf); -static int (*TvqGetFrameSize)(void); -static int (*TvqGetNumFixedBitsPerFrame)(void); - -#define BYTE_BIT 8 -#define BBUFSIZ 1024 /* Bit buffer size (bytes) */ -#define BBUFLEN (BBUFSIZ*BYTE_BIT) /* Bit buffer length (bits) */ -typedef struct vqf_priv_s -{ - float pts; - WAVEFORMATEX o_wf; // out format - INDEX index; - tvqConfInfo cf; - headerInfo hi; - int *bits_0[N_INTR_TYPE], *bits_1[N_INTR_TYPE]; - unsigned framesize; - /* stream related */ - int readable; - int ptr; /* current point in the bit buffer */ - int nbuf; /* bit buffer size */ - char buf[BBUFSIZ]; /* the bit buffer */ - int skip_cnt; -}vqf_priv_t; - -static void* vqf_dll; - -static int load_dll( char *libname ) -{ -#ifdef WIN32_LOADER - Setup_LDT_Keeper(); -#endif - vqf_dll = LoadLibraryA(libname); - if( vqf_dll == NULL ) - { - mp_msg(MSGT_DECAUDIO, MSGL_ERR, "failed loading dll\n" ); - return 0; - } - TvqInitialize = GetProcAddress(vqf_dll,"TvqInitialize"); - TvqTerminate = GetProcAddress(vqf_dll,"TvqTerminate"); - TvqGetVectorInfo = GetProcAddress(vqf_dll,"TvqGetVectorInfo"); - TvqDecodeFrame = GetProcAddress(vqf_dll,"TvqDecodeFrame"); - TvqWtypeToBtype = GetProcAddress(vqf_dll,"TvqWtypeToBtype"); - TvqUpdateVectorInfo = GetProcAddress(vqf_dll,"TvqUpdateVectorInfo"); - TvqCheckVersion = GetProcAddress(vqf_dll,"TvqCheckVersion"); - TvqGetConfInfo = GetProcAddress(vqf_dll,"TvqGetConfInfo"); - TvqGetFrameSize = GetProcAddress(vqf_dll,"TvqGetFrameSize"); - TvqGetNumFixedBitsPerFrame = GetProcAddress(vqf_dll,"TvqGetNumFixedBitsPerFrame"); - return TvqInitialize && TvqTerminate && TvqGetVectorInfo && - TvqDecodeFrame && TvqWtypeToBtype && TvqUpdateVectorInfo && - TvqCheckVersion && TvqGetConfInfo && TvqGetFrameSize && - TvqGetNumFixedBitsPerFrame; -} - -static int init_vqf_audio_codec(sh_audio_t *sh_audio){ - WAVEFORMATEX *in_fmt=sh_audio->wf; - vqf_priv_t*priv=sh_audio->context; - int ver; - mp_msg(MSGT_DECAUDIO, MSGL_INFO, "======= Win32 (TWinVQ) AUDIO Codec init =======\n"); - - sh_audio->channels=in_fmt->nChannels; - sh_audio->samplerate=in_fmt->nSamplesPerSec; - sh_audio->sample_format=AF_FORMAT_S16_NE; -// sh_audio->sample_format=AF_FORMAT_FLOAT_NE; - sh_audio->samplesize=af_fmt2bits(sh_audio->sample_format)/8; - priv->o_wf.nChannels=in_fmt->nChannels; - priv->o_wf.nSamplesPerSec=in_fmt->nSamplesPerSec; - priv->o_wf.nBlockAlign=sh_audio->samplesize*in_fmt->nChannels; - priv->o_wf.nAvgBytesPerSec=in_fmt->nBlockAlign*in_fmt->nChannels; - priv->o_wf.wFormatTag=0x01; - priv->o_wf.wBitsPerSample=in_fmt->wBitsPerSample; - priv->o_wf.cbSize=0; - - if( mp_msg_test(MSGT_DECAUDIO,MSGL_V) ) - { - mp_msg(MSGT_DECAUDIO, MSGL_V, "Input format:\n"); - print_wave_header(in_fmt, MSGL_V); - mp_msg(MSGT_DECAUDIO, MSGL_V, "Output fmt:\n"); - print_wave_header(&priv->o_wf, MSGL_V); - } - memcpy(&priv->hi,&in_fmt[1],sizeof(headerInfo)); - if((ver=TvqInitialize(&priv->hi,&priv->index,0))){ - const char *tvqe[]={ - "No errors", - "General error", - "Wrong version", - "Channel setting error", - "Wrong coding mode", - "Inner parameter setting error", - "Wrong number of VQ pre-selection candidates, used only in encoder" }; - mp_msg(MSGT_DECAUDIO, MSGL_ERR, "Tvq initialization error: %s\n",ver>=0&&ver<7?tvqe[ver]:"Unknown"); - return 0; - } - ver=TvqCheckVersion(priv->hi.ID); - if(ver==TVQ_UNKNOWN_VERSION){ - mp_msg(MSGT_DECAUDIO, MSGL_ERR, "Tvq unknown version of stream\n" ); - return 0; - } - TvqGetConfInfo(&priv->cf); - TvqGetVectorInfo(priv->bits_0,priv->bits_1); - priv->framesize=TvqGetFrameSize(); - sh_audio->audio_in_minsize=priv->framesize*in_fmt->nChannels; - sh_audio->a_in_buffer_size=4*sh_audio->audio_in_minsize; - sh_audio->a_in_buffer=av_malloc(sh_audio->a_in_buffer_size); - sh_audio->a_in_buffer_len=0; - - - return 1; -} - -static int close_vqf_audio_codec(sh_audio_t *sh_audio) -{ - vqf_priv_t*priv=sh_audio->context; - TvqTerminate(&priv->index); - return 1; -} - -int init(sh_audio_t *sh_audio) -{ - return 1; -} - -int preinit(sh_audio_t *sh_audio) -{ - /* Win32 VQF audio codec: */ - vqf_priv_t *priv; - if(!(sh_audio->context=malloc(sizeof(vqf_priv_t)))) return 0; - priv=sh_audio->context; - if(!load_dll(sh_audio->codec->dll)) - { - mp_msg(MSGT_DECAUDIO, MSGL_ERR, "win32.dll looks broken :(\n"); - return 0; - } - if(!init_vqf_audio_codec(sh_audio)){ - mp_msg(MSGT_DECAUDIO, MSGL_ERR, "TWinVQ initialization fail\n"); - return 0; - } - mp_msg(MSGT_DECAUDIO, MSGL_INFO, "INFO: TWinVQ (%s) audio codec init OK!\n",sh_audio->codec->dll); - priv->skip_cnt = 2; - return 1; -} - -void uninit(sh_audio_t *sh) -{ - close_vqf_audio_codec(sh); - free(sh->context); - FreeLibrary(vqf_dll); -} - -static int control(sh_audio_t *sh_audio,int cmd,