Thread: [Mplayerxp-cvslog] SF.net SVN: mplayerxp:[58] mplayerxp (Page 11)
Brought to you by:
olov
From: <nic...@us...> - 2010-01-01 15:53:31
|
Revision: 58 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=58&view=rev Author: nickols_k Date: 2010-01-01 15:53:19 +0000 (Fri, 01 Jan 2010) Log Message: ----------- compile all internal stuff statically Modified Paths: -------------- DOCS/Makefile DOCS/configure Makefile configure etc/Makefile etc/configure functions mplayerxp/Makefile mplayerxp/configure mplayerxp/libmpcodecs/Makefile mplayerxp/libmpcodecs/ad.c mplayerxp/libmpcodecs/ad_a52.c mplayerxp/libmpcodecs/ad_acm.c mplayerxp/libmpcodecs/ad_dca.c mplayerxp/libmpcodecs/ad_dshow.c mplayerxp/libmpcodecs/ad_ffmp3.c mplayerxp/libmpcodecs/ad_hwac3.c mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/ad_twin.c mplayerxp/libmpcodecs/ad_vorbis.c mplayerxp/libmpcodecs/codecs_ld.c mplayerxp/libmpcodecs/codecs_ld.h mplayerxp/libmpcodecs/vd.c mplayerxp/libmpcodecs/vd_divx4.c mplayerxp/libmpcodecs/vd_dshow.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpcodecs/vd_libmpeg2.c mplayerxp/libmpcodecs/vd_theora.c mplayerxp/libmpcodecs/vd_vfw.c mplayerxp/libmpcodecs/vd_xvid.c mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_lavf.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demux_vqf.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/mux_lavf.c mplayerxp/libmpdemux/s_ffmpeg.c mplayerxp/libvo/img_format.c mplayerxp/loader/dmo/DMO_AudioDecoder.c mplayerxp/loader/dmo/DMO_VideoDecoder.c mplayerxp/loader/dmo/dmo.c mplayerxp/loader/dshow/DS_AudioDecoder.c mplayerxp/loader/dshow/DS_Filter.c mplayerxp/loader/dshow/DS_VideoDecoder.c mplayerxp/loader/dshow/Makefile mplayerxp/loader/dshow/allocator.c mplayerxp/postproc/af_ffenc.c mplayerxp/postproc/postprocess.c mplayerxp/postproc/postprocess.h mplayerxp/postproc/swscale.c Removed Paths: ------------- codecs/ mplayerxp/libmpcodecs/interface/ Property Changed: ---------------- / Property changes on: ___________________________________________________________________ Added: svn:externals + ffmpeg -r 20740 svn://svn.ffmpeg.org/ffmpeg/trunk Modified: DOCS/Makefile =================================================================== --- DOCS/Makefile 2010-01-01 09:48:37 UTC (rev 57) +++ DOCS/Makefile 2010-01-01 15:53:19 UTC (rev 58) @@ -8,7 +8,7 @@ all: clean: distclean: - rm -f config.mak + rm -f config.mak configure.log install: $(INSTALL) -D -c -m 644 mplayerxp.1 $(DESTDIR)$(MANDIR)/man1/$(PROGNAME).1 uninstall: Modified: DOCS/configure =================================================================== --- DOCS/configure 2010-01-01 09:48:37 UTC (rev 57) +++ DOCS/configure 2010-01-01 15:53:19 UTC (rev 58) @@ -1,74 +1,107 @@ #!/bin/sh # The simplest configure for win loader -for parm in "$@" ; do - if test "$parm" = "--help" || test "$parm" = "-help" || test "$parm" = "-h" ; then - cat << EOF +. ../functions +init_functions -Usage: $0 [OPTIONS]... -Configuration: - -h, --help display this help and exit +PATH_LIST=( + "prefix|architecture-independent files|/usr/local", + "datadir|read-only architecture-independent data|\$prefix/share/mplayerxp", + "confdir|read-only configuration files|\$prefix/share/mplayerxp" +) -Installation directories: - --prefix=DIR use this prefix for installing mplayer [/usr/local] +PROGNAME_LIST=( + "program_prefix|prepend PREFIX to installed program names", + "program_suffix|append SUFFIX to installed program names", + "program_transform_name|use TRANSFORM_NAME as program name|mplayerxp" +) -Fine tuning of the installation directories: - --datadir=DIR use this prefix for installing machine independent - data files (fonts, skins) [PREFIX/share/mplayer] - --confdir=DIR use this prefix for installing configuration files - [same as datadir] -Program names: - --program-suffix=SUFX append SUFX to installed program names +SYSTYPES_LIST=( + "build|configure for building on BUILD [guessed]", + "host|cross-compile to build program to run on HOST [BUILD]", + "install|use this INSTALL to install PROGRAM|install", + "pkg_config|use this PKG-CONFIG to configure PROGRAM|pkg-config" +) -Environment variables: - DESTDIR specifies base of installation +SYSCONF_LIST=( + "SYSTYPES_LIST", + "PROGNAME_LIST", + "PATH_LIST" +) -EOF - exit 0 - fi -done # for parm in ... +ENVIRONMENT_LIST=( + "MAKE|Make command (example: 'make -j')|make", + "DESTDIR|specifies base of installation" +) +HELP_LIST=( + "PATH_LIST|Fine tuning of the installation directories|--", + "PROGNAME_LIST|Program names|--", + "SYSTYPES_LIST|System types|--", + "ENVIRONMENT_LIST|Environment variables| " +) -# LGB: temporary files -for I in "$TMPDIR" "$TEMPDIR" "/tmp" ; do - test "$I" && break -done +DEFAULT_LIST=( + "PATH_LIST|Fine tuning of the installation directories|--", + "SYSTYPES_LIST|System types|--", + "PROGNAME_LIST|Program names|--" +) -TMPLOG="configure.log" -rm -f "$TMPLOG" -TMPC="$I/mplayerxp-conf-$RANDOM-$$.c" -TMPCPP="$I/mplayerxp-conf-$RANDOM-$$.cpp" -TMPO="$I/mplayerxp-conf-$RANDOM-$$.o" -TMPS="$I/mplayerxp-conf-$RANDOM-$$.S" +make_defaults "DEFAULT_LIST" +make_environment "ENVIRONMENT_LIST" -prefix="/usr/local" -psuffix= for ac_option do + optval="${ac_option#*=}" case "$ac_option" in - --prefix=*) - prefix=`echo $ac_option | cut -d '=' -f 2` + --help) + print_help "HELP_LIST" + exit 0 ;; - --datadir=*) - datadir=`echo $ac_option | cut -d '=' -f 2` + --enable-*=*|--disable-*=*) + eval $(echo "${ac_option%%=*}" | sed 's/--/action=/;s/-/ thing=/') + in_list "AUTOCONF_LIST" ${thing} || bad_options="$ac_option $bad_options" + if test "$action" = "disable"; then + test "${optval}" = "no" && action=enable + else + test "${optval}" = "no" && action=disable + fi + echo "$action ${thing}" + $action ${thing} ;; - --confdir=*) - confdir=`echo $ac_option | cut -d '=' -f 2` + + --enable-?*|--disable-?*) + eval $(echo "$ac_option" | sed 's/--/action=/;s/-/ thing=/;s/-/_/g') + in_list "AUTOCONF_LIST" ${thing} || bad_options="$ac_option $bad_options" + $action ${thing} ;; - --program-suffix=*) - psuffix=`echo $ac_option | cut -d '=' -f 2` + *) + optname="${ac_option%%=*}" + optname="${optname#--}" + optname=${optname//-/_} + if in_list "SYSCONF_LIST" $optname ; then + eval $optname=$optval + else + bad_options="$ac_option $bad_options" + fi ;; - *) - ;; esac done -prog_alias="mplayerxp$psuffix" +mktmps -# Atmos: moved this here, to be correct, if --prefix is specified -test -z "$_datadir" && datadir="$prefix/share/$prog_alias" -test -z "$_confdir" && confdir="$datadir" +echocheck "Program name" +prog_alias=$program_transform_name +prog_alias="$program_prefix$prog_alias$program_suffix" +echores "$prog_alias" +if cygwin ; then +# Keep everything in .exe folder +test -z "$datadir" && datadir="." +test -z "$confdir" && confdir="." +test -z "$libdir" && libdir="." +fi + ############################################################################# echo "Creating config.mak" cat > config.mak << EOF Modified: Makefile =================================================================== --- Makefile 2010-01-01 09:48:37 UTC (rev 57) +++ Makefile 2010-01-01 15:53:19 UTC (rev 58) @@ -1,4 +1,4 @@ -SUBDIRS = codecs loader mplayerxp etc DOCS +SUBDIRS = ffmpeg mplayerxp etc DOCS DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@ || exit; done Modified: configure =================================================================== --- configure 2010-01-01 09:48:37 UTC (rev 57) +++ configure 2010-01-01 15:53:19 UTC (rev 58) @@ -9,7 +9,7 @@ fi done # for parm in ... -for i in codecs etc DOCS mplayerxp ; do +for i in etc DOCS mplayerxp ; do echo Entering \'"$i"\' directory cd $i ./configure "$@" Modified: etc/Makefile =================================================================== --- etc/Makefile 2010-01-01 09:48:37 UTC (rev 57) +++ etc/Makefile 2010-01-01 15:53:19 UTC (rev 58) @@ -6,7 +6,7 @@ all: clean: distclean: - rm -f config.mak + rm -f config.mak configure.log install: $(INSTALL) -D -b -c -m 644 codecs.conf $(CONFDIR)/codecs.conf $(INSTALL) -D -b -c -m 644 menu.conf $(CONFDIR)/menu.conf Modified: etc/configure =================================================================== --- etc/configure 2010-01-01 09:48:37 UTC (rev 57) +++ etc/configure 2010-01-01 15:53:19 UTC (rev 58) @@ -1,71 +1,107 @@ #!/bin/sh # The simplest configure for win loader -for parm in "$@" ; do - if test "$parm" = "--help" || test "$parm" = "-help" || test "$parm" = "-h" ; then - cat << EOF +. ../functions +init_functions -Usage: $0 [OPTIONS]... -Configuration: - -h, --help display this help and exit +PATH_LIST=( + "prefix|architecture-independent files|/usr/local", + "datadir|read-only architecture-independent data|\$prefix/share/mplayerxp", + "confdir|read-only configuration files|\$prefix/share/mplayerxp" +) -Installation directories: - --prefix=DIR use this prefix for installing mplayer [/usr/local] +PROGNAME_LIST=( + "program_prefix|prepend PREFIX to installed program names", + "program_suffix|append SUFFIX to installed program names", + "program_transform_name|use TRANSFORM_NAME as program name|mplayerxp" +) -Fine tuning of the installation directories: - --datadir=DIR use this prefix for installing machine independent - data files (fonts, skins) [PREFIX/share/mplayer] - --confdir=DIR use this prefix for installing configuration files - [same as datadir] +SYSTYPES_LIST=( + "build|configure for building on BUILD [guessed]", + "host|cross-compile to build program to run on HOST [BUILD]", + "install|use this INSTALL to install PROGRAM|install", + "pkg_config|use this PKG-CONFIG to configure PROGRAM|pkg-config" +) -Program names: - --program-suffix=SUFX append SUFX to installed program names +SYSCONF_LIST=( + "SYSTYPES_LIST", + "PROGNAME_LIST", + "PATH_LIST" +) -EOF - exit 0 - fi -done # for parm in ... +ENVIRONMENT_LIST=( + "MAKE|Make command (example: 'make -j')|make", + "DESTDIR|specifies base of installation" +) +HELP_LIST=( + "PATH_LIST|Fine tuning of the installation directories|--", + "PROGNAME_LIST|Program names|--", + "SYSTYPES_LIST|System types|--", + "ENVIRONMENT_LIST|Environment variables| " +) -# LGB: temporary files -for I in "$TMPDIR" "$TEMPDIR" "/tmp" ; do - test "$I" && break -done +DEFAULT_LIST=( + "PATH_LIST|Fine tuning of the installation directories|--", + "SYSTYPES_LIST|System types|--", + "PROGNAME_LIST|Program names|--" +) -TMPLOG="configure.log" -rm -f "$TMPLOG" -TMPC="$I/mplayerxp-conf-$RANDOM-$$.c" -TMPCPP="$I/mplayerxp-conf-$RANDOM-$$.cpp" -TMPO="$I/mplayerxp-conf-$RANDOM-$$.o" -TMPS="$I/mplayerxp-conf-$RANDOM-$$.S" +make_defaults "DEFAULT_LIST" +make_environment "ENVIRONMENT_LIST" -prefix="/usr/local" -psuffix= for ac_option do + optval="${ac_option#*=}" case "$ac_option" in - --prefix=*) - prefix=`echo $ac_option | cut -d '=' -f 2` + --help) + print_help "HELP_LIST" + exit 0 ;; - --datadir=*) - datadir=`echo $ac_option | cut -d '=' -f 2` + --enable-*=*|--disable-*=*) + eval $(echo "${ac_option%%=*}" | sed 's/--/action=/;s/-/ thing=/') + in_list "AUTOCONF_LIST" ${thing} || bad_options="$ac_option $bad_options" + if test "$action" = "disable"; then + test "${optval}" = "no" && action=enable + else + test "${optval}" = "no" && action=disable + fi + echo "$action ${thing}" + $action ${thing} ;; - --confdir=*) - confdir=`echo $ac_option | cut -d '=' -f 2` + + --enable-?*|--disable-?*) + eval $(echo "$ac_option" | sed 's/--/action=/;s/-/ thing=/;s/-/_/g') + in_list "AUTOCONF_LIST" ${thing} || bad_options="$ac_option $bad_options" + $action ${thing} ;; - --program-suffix=*) - psuffix=`echo $ac_option | cut -d '=' -f 2` + *) + optname="${ac_option%%=*}" + optname="${optname#--}" + optname=${optname//-/_} + if in_list "SYSCONF_LIST" $optname ; then + eval $optname=$optval + else + bad_options="$ac_option $bad_options" + fi ;; - *) - ;; esac done -prog_alias="mplayerxp$psuffix" -# Atmos: moved this here, to be correct, if --prefix is specified -test -z "$_datadir" && datadir="$prefix/share/$prog_alias" -test -z "$_confdir" && confdir="$datadir" +mktmps +echocheck "Program name" +prog_alias=$program_transform_name +prog_alias="$program_prefix$prog_alias$program_suffix" +echores "$prog_alias" + +if cygwin ; then +# Keep everything in .exe folder +test -z "$datadir" && datadir="." +test -z "$confdir" && confdir="." +test -z "$libdir" && libdir="." +fi + ############################################################################# echo "Creating config.mak" cat > config.mak << EOF @@ -74,6 +110,7 @@ prefix = $prefix DATADIR = $datadir CONFDIR = $confdir +DESTDIR = $DESTDIR EOF Modified: functions =================================================================== --- functions 2010-01-01 09:48:37 UTC (rev 57) +++ functions 2010-01-01 15:53:19 UTC (rev 58) @@ -1374,3 +1374,21 @@ disable_list(){ set_list $1 no } + +check_pkg(){ + name=$1 + package=$2 + answer="no" + echocheck $name + $pkg_config --exists $package + test "$?" -ne 0 && disable $name + if enabled $name ; then + version=`echo $($pkg_config $package --modversion)` + log "found version: $version of $package" + check_cflags $($pkg_config $package --cflags) || disable $name + check_ldflags $($pkg_config $package --libs) || disable $name + answer=`echo "yes ($version)"` + fi + log "pkg-config --exists $package = $answer" + echores $answer +} Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/Makefile 2010-01-01 15:53:19 UTC (rev 58) @@ -28,6 +28,12 @@ OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) +FF_LIBS = ../ffmpeg/libavcodec/libavcodec.a \ + ../ffmpeg/libswscale/libswscale.a \ + ../ffmpeg/libpostproc/libpostproc.a \ + ../ffmpeg/libavformat/libavformat.a \ + ../ffmpeg/libavutil/libavutil.a + MP_LIBS = libmpdemux/libmpdemux.a \ libmpcodecs/libmpcodecs.a \ libao2/libao2.a \ @@ -40,7 +46,7 @@ MP_LIBS += loader/libloader.a endif -COMMON_LIBS = $(MP_LIBS) $(EXTRALIBS) -lm +COMMON_LIBS = $(MP_LIBS) $(FF_LIBS) $(EXTRALIBS) -lm CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Ilibvo $(EXTRA_INC) ALL_PRG = $(PRG) Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/configure 2010-01-01 15:53:19 UTC (rev 58) @@ -81,7 +81,10 @@ "libcss|build with libcss support", "libdvdread|build with libdvdread support", "libdvdnav|build with libdvdnav support", - "libvcd|build with libvcd support" + "libvcd|build with libvcd support", + "libvorbis|build with libvorbis support", + "libtheora|build with libtheora support", + "libbz2|build with libbz2 support" ) DISABLED_LIST=( "gcov|compile gnu coverage information into PROGRAM", @@ -101,7 +104,6 @@ "libdir|object code libraries|\$exec_prefix/lib", "datadir|read-only architecture-independent data|\$prefix/share/mplayerxp", "confdir|read-only configuration files|\$prefix/share/mplayerxp", - "codecdir|codec's shared libraries|\$libdir/mplayerxp", "win32libdir|win32 .dll locations [/usr/lib/win32]" ) @@ -198,7 +200,6 @@ --enable-?*|--disable-?*) eval $(echo "$ac_option" | sed 's/--/action=/;s/-/ thing=/;s/-/_/g') in_list "AUTOCONF_LIST" ${thing} || bad_options="$ac_option $bad_options" -# echo "$action ${thing}" $action ${thing} ;; *) @@ -206,11 +207,9 @@ optname="${optname#--}" optname=${optname//-/_} if in_list "SYSCONF_LIST" $optname ; then -# echo "eval $optname=$optval" eval $optname=$optval elif in_list "ADD_LIST" $optname ; then action="add_$optname" -# echo "$action ${optval}" $action ${optval} else bad_options="$ac_option $bad_options" @@ -311,13 +310,9 @@ test -z "$datadir" && datadir="." test -z "$confdir" && confdir="." test -z "$libdir" && libdir="." -test -z "$codecdir" && codecdir="." -else -codecdir="$libdir/$prog_alias" fi srcdir=`pwd` - #checking for pkg-config test $($pkg_config --version 2>/dev/null) || die "no pkg-config found" @@ -354,10 +349,26 @@ disable ffmpeg # Checking for FFMPEG -test -f "../codecs/ffmpeg/libavcodec/avcodec.h" && enable ffmpeg +test -f "../ffmpeg/libavcodec/avcodec.h" && enable ffmpeg disabled ffmpeg && die "**FATAL**: local copy of libavcodec doesn't exist! Please use latest svn to checkout external repository in mplayerxp source tree." -add_cflags "-I$srcdir/../codecs/ffmpeg" +add_cflags "-I$srcdir/../ffmpeg" print_config HAVE_ mp_config.h mp_config.mak ffmpeg +# Configuring external ffmpeg stuff +ffmpeg_args="--enable-static --disable-shared --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-postproc --enable-gpl --enable-pthreads" +if test -n $host ; then +_arch=$host_arch +x86_32 && _arch="x86_32" +x86_64 && _arch="x86_64" +ffmpeg_args="--arch=$arch $ffmpeg_args" +fi +test "$debug" -gt "0" && ffmpeg_args="$ffmpeg_args --enable-debug=$debug" +enabled $profile && ffmpeg_args="$ffmpeg_args --enable-profile" +echocheck "configuring ffmpeg stuff: --cc=\"$cc\" $ffmpeg_args" +cd ../ffmpeg +$(LC_ALL=C ./configure --cc="$cc" $ffmpeg_args) +cd $srcdir +echores "done" +################################### check_header inttypes.h || die "cannot find header inttypes.h (see in DOC/faq.html)" @@ -544,8 +555,7 @@ ######### # VIDEO # ######### -enabled x11 && check_cflags $($pkg_config x11 --cflags) && add_cflags $($pkg_config x11 --cflags) || disable x11 -enabled x11 && check_ldflags $($pkg_config x11 --libs) && add_extralibs $($pkg_config x11 --libs) || disable x11 +check_pkg x11 x11 enabled x11 && require2 x11 "X11/Xlib.h X11/Xutil.h" XCreateWindow -lXext print_config HAVE_ mp_config.h mp_config.mak x11 enabled x11 && vomodules="x11 $vomodules" || novomodules="x11 $novomodules" @@ -619,8 +629,7 @@ # VIDEO + AUDIO # ################# -enabled sdl && check_cflags $($pkg_config sdl --cflags) && add_cflags $($pkg_config sdl --cflags) || disable sdl -enabled sdl && check_ldflags $($pkg_config sdl --libs) && add_extralibs $($pkg_config sdl --libs) || disable sdl +check_pkg sdl sdl enabled sdl && require2 sdl SDL/SDL.h SDL_CreateYUVOverlay print_config HAVE_ mp_config.h mp_config.mak sdl if enabled sdl; then @@ -666,8 +675,7 @@ print_config HAVE_ mp_config.h mp_config.mak arts enabled arts && aomodules="arts $aomodules" || noaomodules="arts $noaomodules" -enabled esd && check_cflags $($pkg_config esound --cflags) && add_cflags $($pkg_config esound --cflags) || disable esd -enabled esd && check_ldflags $($pkg_config esound --libs) && add_extralibs $($pkg_config esound --libs) || disable esd +check_pkg esd esound enabled esd && require2 esd esd.h esd_open_sound print_config HAVE_ mp_config.h mp_config.mak esd enabled esd && aomodules="esd $aomodules" || noaomodules="esd $noaomodules" @@ -680,8 +688,7 @@ print_config HAVE_ mp_config.h mp_config.mak nas enabled nas && aomodules="nas $aomodules" || noaomodules="nas $noaomodules" -enabled jack && check_cflags $($pkg_config jack --cflags) && add_cflags $($pkg_config jack --cflags) || disable jack -enabled jack && check_ldflags $($pkg_config jack --libs) && add_extralibs $($pkg_config jack --libs) || disable jack +check_pkg jack jack enabled jack && require2 jack jack/jack.h jack_client_open print_config HAVE_ mp_config.h mp_config.mak jack enabled jack && aomodules="jack $aomodules" || noaomodules="jack $noaomodules" @@ -716,6 +723,17 @@ print_config HAVE_ mp_config.h mp_config.mak audio_select +enabled libvorbis && check_pkg libvorbis vorbis +print_config HAVE_ mp_config.h mp_config.mak libvorbis +enabled libvorbis && inputmodules="vorbis $inputmodules" || noinputmodules="vorbis $noinputmodules" + +enabled libtheora && check_pkg libtheora theora +print_config HAVE_ mp_config.h mp_config.mak libtheora +enabled libtheora && inputmodules="theora $inputmodules" || noinputmodules="theora $noinputmodules" + +enabled libbz2 && require2 libbz2 bzlib.h BZ2_bzlibVersion -lbz2 || disable libbz2 +print_config HAVE_ mp_config.h mp_config.mak libbz2 + CFLAGS="$CFLAGS -W -Wall" # Thread support if linux ; then @@ -755,7 +773,6 @@ DATADIR = $datadir CONFDIR = $confdir LIBDIR = $libdir -CODECDIR = $codecdir DESTDIR = $DESTDIR PROGNAME = $prog_alias AR = ar @@ -797,7 +814,6 @@ #define DATADIR "$datadir" #define CONFDIR "$confdir" #define LIBDIR "$libdir" -#define CODECDIR "$codecdir" /* Define this to enable avg. byte/sec-based AVI sync method by default: (use -bps or -nobps commandline option for run-time method selection) Modified: mplayerxp/libmpcodecs/Makefile =================================================================== --- mplayerxp/libmpcodecs/Makefile 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/Makefile 2010-01-01 15:53:19 UTC (rev 58) @@ -1,7 +1,7 @@ include ../mp_config.mak LIBNAME = libmpcodecs.a -SUBDIRS = libnuppelvideo +SUBDIRS = libnuppelvideo liba52 libdca DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@ || exit; done DO_ALL = @ for i in $(SUBDIRS); do $(MAKE) -C $$i all || exit; done @@ -24,15 +24,20 @@ ad_null.c \ ad_ffmp3.c \ ad_mp3.c \ - ad_a52.c \ - ad_dca.c \ ad_hwac3.c \ ad_pcm.c \ ad_dvdpcm.c \ - ad_vorbis.c \ ad_real.c \ ad_faad.c \ + ad_a52.c \ + ad_dca.c \ codecs_ld.c +ifeq ($(HAVE_LIBVORBIS),yes) +SRCS+=ad_vorbis.c +endif +ifeq ($(HAVE_LIBTHEORA),yes) +SRCS+=vd_theora.c +endif ifeq ($(HAVE_WIN32LOADER),yes) SRCS+=vd_dshow.c \ @@ -64,7 +69,9 @@ $(LIBNAME): $(SUBDIRS) $(OBJS) $(AR) r $(LIBNAME) $(OBJS) \ - $(wildcard libnuppelvideo/*.o) + $(wildcard libnuppelvideo/*.o) \ + $(wildcard liba52/*.o) \ + $(wildcard libdca/*.o) clean: Modified: mplayerxp/libmpcodecs/ad.c =================================================================== --- mplayerxp/libmpcodecs/ad.c 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/ad.c 2010-01-01 15:53:19 UTC (rev 58) @@ -43,7 +43,9 @@ &mpcodecs_ad_pcm, &mpcodecs_ad_dvdpcm, &mpcodecs_ad_faad, +#ifdef HAVE_LIBVORBIS &mpcodecs_ad_vorbis, +#endif &mpcodecs_ad_real, #ifdef HAVE_WIN32LOADER &mpcodecs_ad_dshow, Modified: mplayerxp/libmpcodecs/ad_a52.c =================================================================== --- mplayerxp/libmpcodecs/ad_a52.c 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/ad_a52.c 2010-01-01 15:53:19 UTC (rev 58) @@ -11,9 +11,9 @@ #include "help_mp.h" #include "cpudetect.h" -#include "interface/a52.h" #include "../mm_accel.h" #include "../mplayer.h" +#include "liba52/a52.h" #include "ad_a52.h" #include "libao2/afmt.h" #include "libao2/audio_out.h" @@ -41,60 +41,6 @@ LIBAD_EXTERN(a52) -static int (*a52_syncinfo_ptr) (uint8_t * buf, int * flags, - int * sample_rate, int * bit_rate); -#define a52_syncinfo(a,b,c,d) (*a52_syncinfo_ptr)(a,b,c,d) -static uint16_t (*crc16_block_ptr)(uint8_t *data,uint32_t num_bytes); -#define crc16_block(a,b) (*crc16_block_ptr)(a,b) -static a52_state_t * (*a52_init_ptr) (uint32_t mm_accel); -#define a52_init(a) (*a52_init_ptr)(a) -static int (*a52_frame_ptr)(a52_state_t * state, uint8_t * buf, int * flags, - sample_t * level, sample_t bias); -#define a52_frame(a,b,c,d,e) (*a52_frame_ptr)(a,b,c,d,e) - -static int (*a52_block_ptr) (a52_state_t * state); -#define a52_block(a) (*a52_block_ptr)(a) - -static void (*a52_dynrng_ptr) (a52_state_t * state, - sample_t (* call) (sample_t, void *), void * data); -#define a52_dynrng(a,b,c) (*a52_dynrng_ptr)(a,b,c) - -static sample_t* (*a52_samples_ptr) (a52_state_t * state); -#define a52_samples(a) (*a52_samples_ptr)(a) - -static void* (*a52_resample_init_ptr)(a52_state_t * state,uint32_t mm_accel,int flags,int chans); -#define a52_resample_init(a,b,c,d) (*a52_resample_init_ptr)(a,b,c,d) - -static int (** a52_resample_ptr) (float * _f, int16_t * s16); -#define a52_resample(a,b) (*a52_resample_ptr)(a,b) - -static void* (*a52_resample_init_float_ptr)(a52_state_t * state,uint32_t mm_accel,int flags,int chans); -#define a52_resample_init_float(a,b,c,d) (*a52_resample_init_float_ptr)(a,b,c,d) - -static int (** a52_resample32_ptr) (float * _f, float * s32); -#define a52_resample32(a,b) (*a52_resample32_ptr)(a,b) - -static void *dll_handle; -static int load_dll(const char *libname) -{ - if(!(dll_handle=ld_codec(libname,NULL))) return 0; - a52_syncinfo_ptr = ld_sym(dll_handle,"a52_syncinfo"); - a52_init_ptr = ld_sym(dll_handle,"a52_init"); - a52_frame_ptr = ld_sym(dll_handle,"a52_frame"); - a52_block_ptr = ld_sym(dll_handle,"a52_block"); - a52_resample_init_ptr = ld_sym(dll_handle,"a52_resample_init"); - a52_dynrng_ptr = ld_sym(dll_handle,"a52_dynrng"); - a52_samples_ptr = ld_sym(dll_handle,"a52_samples"); - a52_resample_ptr = ld_sym(dll_handle,"a52_resample"); - a52_resample_init_float_ptr = ld_sym(dll_handle,"a52_resample_init_float"); - a52_resample32_ptr = ld_sym(dll_handle,"a52_resample32"); - crc16_block_ptr = ld_sym(dll_handle,"crc16_block"); - return a52_syncinfo_ptr && crc16_block_ptr && a52_frame_ptr && - a52_init_ptr && a52_block_ptr && a52_resample_init_ptr && - a52_resample_ptr && a52_resample_init_float_ptr && a52_resample32_ptr && - a52_samples_ptr && a52_dynrng_ptr; -} - extern int audio_output_channels; int a52_fillbuff(sh_audio_t *sh_audio,float *pts){ @@ -130,7 +76,6 @@ a52_priv->last_pts=*pts=apts; if(crc16_block(sh_audio->a_in_buffer+2,length-2)!=0) MSG_STATUS("a52: CRC check failed! \n"); - return length; } @@ -184,7 +129,7 @@ sh->audio_out_minsize=audio_output_channels*sh->samplesize*256*6; sh->audio_in_minsize=MAX_AC3_FRAME; sh->context=malloc(sizeof(a52_priv_t)); - return load_dll(codec_name("liba52"SLIBSUFFIX)); + return 1; } int init(sh_audio_t *sh_audio) @@ -246,7 +191,6 @@ void uninit(sh_audio_t *sh) { free(sh->context); - dlclose(dll_handle); } int control(sh_audio_t *sh,int cmd,void* arg, ...) Modified: mplayerxp/libmpcodecs/ad_acm.c =================================================================== --- mplayerxp/libmpcodecs/ad_acm.c 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/ad_acm.c 2010-01-01 15:53:19 UTC (rev 58) @@ -148,7 +148,7 @@ MSG_ERR(MSGTR_ACMiniterror); return 0; } - MSG_V("INFO: Win32/DShow (%s) audio codec init OK!\n",CODECDIR"/wine/libloader"SLIBSUFFIX); + MSG_V("INFO: Win32/ACM init OK!\n"); return 1; } Modified: mplayerxp/libmpcodecs/ad_dca.c =================================================================== --- mplayerxp/libmpcodecs/ad_dca.c 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/ad_dca.c 2010-01-01 15:53:19 UTC (rev 58) @@ -11,7 +11,7 @@ #include "help_mp.h" #include "cpudetect.h" -#include "interface/dca.h" +#include "libdca/dca.h" #include "../mm_accel.h" #include "../mplayer.h" #include "../bswap.h" @@ -33,7 +33,7 @@ #include "bswap.h" -static const ad_info_t info = +static const ad_info_t info = { "DTS Coherent Acoustics", "libdca", @@ -47,64 +47,6 @@ LIBAD_EXTERN(dca) -static int (*dca_syncinfo_ptr) (dca_state_t *state, uint8_t * buf, int * flags, - int * sample_rate, int * bit_rate, int *frame_length); -#define dca_syncinfo(a,b,c,d,e,f) (*dca_syncinfo_ptr)(a,b,c,d,e,f) - -static dca_state_t * (*dca_init_ptr) (uint32_t mm_accel); -#define dca_init(a) (*dca_init_ptr)(a) - -static int (*dca_frame_ptr)(dca_state_t * state, uint8_t * buf, int * flags, - level_t * level, sample_t bias); -#define dca_frame(a,b,c,d,e) (*dca_frame_ptr)(a,b,c,d,e) - -static int (*dca_block_ptr) (dca_state_t * state); -#define dca_block(a) (*dca_block_ptr)(a) - -static int (*dca_blocks_num_ptr) (dca_state_t * state); -#define dca_blocks_num(a) (*dca_blocks_num_ptr)(a) - -static void (*dca_dynrng_ptr) (dca_state_t * state, - sample_t (* call) (sample_t, void *), void * data); -#define dca_dynrng(a,b,c) (*dca_dynrng_ptr)(a,b,c) - -static sample_t* (*dca_samples_ptr) (dca_state_t * state); -#define dca_samples(a) (*dca_samples_ptr)(a) - -static void* (*dca_resample_init_ptr)(dca_state_t * state,uint32_t mm_accel,int flags,int chans); -#define dca_resample_init(a,b,c,d) (*dca_resample_init_ptr)(a,b,c,d) - -static int (** dca_resample_ptr) (float * _f, int16_t * s16); -#define dca_resample(a,b) (*dca_resample_ptr)(a,b) - -static void* (*dca_resample_init_float_ptr)(dca_state_t * state,uint32_t mm_accel,int flags,int chans); -#define dca_resample_init_float(a,b,c,d) (*dca_resample_init_float_ptr)(a,b,c,d) - -static int (** dca_resample32_ptr) (float * _f, float * s32); -#define dca_resample32(a,b) (*dca_resample32_ptr)(a,b) - -static void *dll_handle; -static int load_dll(const char *libname) -{ - if(!(dll_handle=ld_codec(libname,NULL))) return 0; - dca_syncinfo_ptr = ld_sym(dll_handle,"dca_syncinfo"); - dca_init_ptr = ld_sym(dll_handle,"dca_init"); - dca_frame_ptr = ld_sym(dll_handle,"dca_frame"); - dca_block_ptr = ld_sym(dll_handle,"dca_block"); - dca_blocks_num_ptr = ld_sym(dll_handle,"dca_blocks_num"); - dca_dynrng_ptr = ld_sym(dll_handle,"dca_dynrng"); - dca_samples_ptr = ld_sym(dll_handle,"dca_samples"); - dca_resample_init_ptr = ld_sym(dll_handle,"dca_resample_init"); - dca_resample_ptr = ld_sym(dll_handle,"dca_resample"); - dca_resample_init_float_ptr = ld_sym(dll_handle,"dca_resample_init_float"); - dca_resample32_ptr = ld_sym(dll_handle,"dca_resample32"); - return dca_syncinfo_ptr && dca_frame_ptr && dca_init_ptr && - dca_block_ptr && dca_samples_ptr && dca_dynrng_ptr && - dca_blocks_num_ptr && dca_resample_init_float_ptr && - dca_resample32_ptr && dca_resample_init_ptr && - dca_resample_ptr; -} - extern int audio_output_channels; int dca_fillbuff(sh_audio_t *sh_audio,float *pts){ @@ -135,7 +77,7 @@ sh_audio->i_bps=bit_rate/8; demux_read_data_r(sh_audio->ds,sh_audio->a_in_buffer+16,length-16,apts?&null_pts:&apts); dca_priv->last_pts=*pts=apts; - + return length; } @@ -189,7 +131,7 @@ sh->audio_out_minsize=audio_output_channels*sh->samplesize*256*8; sh->audio_in_minsize=MAX_AC5_FRAME; sh->context=malloc(sizeof(dca_priv_t)); - return load_dll(codec_name("libdca"SLIBSUFFIX)); + return 1; } int init(sh_audio_t *sh_audio) @@ -213,14 +155,14 @@ sh_audio->channels=audio_output_channels; while(sh_audio->channels>0){ switch(sh_audio->channels){ - case 1: mpxp_dca_flags=DCA_MONO; break; - case 2: mpxp_dca_flags=DCA_STEREO; break; -/* case 2: mpxp_dca_flags=DCA_DOLBY; break; */ -/* case 3: mpxp_dca_flags=DCA_3F; break; */ - case 3: mpxp_dca_flags=DCA_2F1R; break; - case 4: mpxp_dca_flags=DCA_2F2R; break; /* 2+2*/ - case 5: mpxp_dca_flags=DCA_3F2R; break; - case 6: mpxp_dca_flags=DCA_3F2R|DCA_LFE; break; /* 5.1*/ + case 1: mpxp_dca_flags=DCA_MONO; break; + case 2: mpxp_dca_flags=DCA_STEREO; break; +/* case 2: mpxp_dca_flags=DCA_DOLBY; break; */ +/* case 3: mpxp_dca_flags=DCA_3F; break; */ + case 3: mpxp_dca_flags=DCA_2F1R; break; + case 4: mpxp_dca_flags=DCA_2F2R; break; /* 2+2*/ + case 5: mpxp_dca_flags=DCA_3F2R; break; + case 6: mpxp_dca_flags=DCA_3F2R|DCA_LFE; break; /* 5.1*/ } /* test:*/ flags=mpxp_dca_flags|DCA_ADJUST_LEVEL; @@ -250,7 +192,6 @@ void uninit(sh_audio_t *sh) { free(sh->context); - dlclose(dll_handle); } int control(sh_audio_t *sh,int cmd,void* arg, ...) Modified: mplayerxp/libmpcodecs/ad_dshow.c =================================================================== --- mplayerxp/libmpcodecs/ad_dshow.c 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/ad_dshow.c 2010-01-01 15:53:19 UTC (rev 58) @@ -50,7 +50,7 @@ sh_audio->audio_in_minsize=2*sh_audio->wf->nBlockAlign; if(sh_audio->audio_in_minsize<8192) sh_audio->audio_in_minsize=8192; sh_audio->audio_out_minsize=16384; - MSG_V("INFO: Win32/DShow (%s) audio codec init OK!\n",CODECDIR"/wine/DS_Filter"SLIBSUFFIX); + MSG_V("INFO: Win32/DShow init OK!\n"); return 1; } Modified: mplayerxp/libmpcodecs/ad_ffmp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_ffmp3.c 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/ad_ffmp3.c 2010-01-01 15:53:19 UTC (rev 58) @@ -36,56 +36,10 @@ LIBAD_EXTERN(ffmp3) -unsigned (*avcodec_version_ptr)(void); -void (*avcodec_init_ptr)(void); -void (*avcodec_register_all_ptr)(void); -AVCodec * (*avcodec_find_decoder_by_name_ptr)(const char *name); -int (*avcodec_open_ptr)(AVCodecContext *avctx, AVCodec *codec); -int (*avcodec_close_ptr)(AVCodecContext *avctx); -int (*avcodec_decode_audio_ptr)(AVCodecContext *avctx, INT16 *samples, - int *frame_size_ptr, - uint8_t *buf, int buf_size); -AVCodecContext* (*avcodec_alloc_context_ptr)(void); - -static void *dll_handle; -static int load_dll(const char *libname) -{ - if(!(dll_handle=ld_codec(libname,"http://ffmpeg.sf.net"))) return 0; - avcodec_init_ptr = ld_sym(dll_handle,"avcodec_init"); - avcodec_version_ptr = ld_sym(dll_handle,"avcodec_version"); - avcodec_register_all_ptr = ld_sym(dll_handle,"avcodec_register_all"); - avcodec_find_decoder_by_name_ptr = ld_sym(dll_handle,"avcodec_find_decoder_by_name"); - avcodec_alloc_context_ptr = ld_sym(dll_handle,"avcodec_alloc_context"); - avcodec_open_ptr = ld_sym(dll_handle,"avcodec_open"); - avcodec_close_ptr = ld_sym(dll_handle,"avcodec_close"); - avcodec_decode_audio_ptr = ld_sym(dll_handle,"avcodec_decode_audio2"); - return avcodec_init_ptr && avcodec_register_all_ptr && avcodec_find_decoder_by_name_ptr - && avcodec_open_ptr && avcodec_close_ptr && avcodec_decode_audio_ptr - && avcodec_version_ptr && avcodec_alloc_context_ptr; -} - -#define MIN_LIBAVCODEC_VERSION_INT ((51<<16)+(0<<8)+0) - int preinit(sh_audio_t *sh) { - unsigned avc_version; sh->audio_out_minsize=AVCODEC_MAX_AUDIO_FRAME_SIZE; - if(!load_dll(codec_name("libavcodec"SLIBSUFFIX))) /* try local copy first */ - if(!load_dll("libavcodec-0.4.9"SLIBSUFFIX)) - if(!load_dll("libavcodec"SLIBSUFFIX)) - { - MSG_ERR("Detected error during loading libffmpeg.so! Try to upgrade this codec\n"); - return 0; - } - avc_version = (*avcodec_version_ptr)(); - if(avc_version < MIN_LIBAVCODEC_VERSION_INT) - { - MSG_ERR("You have wrong version of libavcodec %06X < %06X\n", - avc_version,MIN_LIBAVCODEC_VERSION_INT); - return 0; - } - sh->audio_out_minsize=AVCODEC_MAX_AUDIO_FRAME_SIZE; - return 1; + return 1; } int init(sh_audio_t *sh_audio) @@ -94,16 +48,16 @@ float pts; MSG_V("FFmpeg's libavcodec audio codec\n"); if(!acodec_inited){ - (*avcodec_init_ptr)(); - (*avcodec_register_all_ptr)(); - acodec_inited=1; + avcodec_init(); + avcodec_register_all(); + acodec_inited=1; } - lavc_codec = (AVCodec *)(*avcodec_find_decoder_by_name_ptr)(sh_audio->codec->dll_name); + lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_audio->codec->dll_name); if(!lavc_codec){ MSG_ERR(MSGTR_MissingLAVCcodec,sh_audio->codec->dll_name); return 0; } - lavc_context = (*avcodec_alloc_context_ptr)(); + lavc_context = avcodec_alloc_context(); sh_audio->context = lavc_context; if(sh_audio->wf) { @@ -132,7 +86,7 @@ lavc_context->codec_type = lavc_codec->type; lavc_context->codec_id = lavc_codec->id; /* open it */ - if ((*avcodec_open_ptr)(lavc_context, lavc_codec) < 0) { + if (avcodec_open(lavc_context, lavc_codec) < 0) { MSG_ERR( MSGTR_CantOpenCodec); return 0; } @@ -160,8 +114,7 @@ void uninit(sh_audio_t *sh) { - (*avcodec_close_ptr)(lavc_context); - dlclose(dll_handle); + avcodec_close(lavc_context); if (lavc_context->extradata) free(lavc_context->extradata); free(lavc_context); acodec_inited=0; @@ -182,7 +135,7 @@ int x=ds_get_packet_r(sh_audio->ds,&start,apts?&null_pts:&apts); if(x<=0) break; // error if(sh_audio->format==mmioFOURCC('d','n','e','t')) swab(start,start,x&(~1)); - y=(*avcodec_decode_audio_ptr)(sh_audio->context,(INT16*)buf,&len2,start,x); + y=avcodec_decode_audio2(sh_audio->context,(INT16*)buf,&len2,start,x); if(y<0){ MSG_V("lavc_audio: error\n");break; } if(y<x) { Modified: mplayerxp/libmpcodecs/ad_hwac3.c =================================================================== --- mplayerxp/libmpcodecs/ad_hwac3.c 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/ad_hwac3.c 2010-01-01 15:53:19 UTC (rev 58) @@ -12,7 +12,6 @@ #include "codecs_ld.h" #include "cpudetect.h" -#include "interface/a52.h" #include "../libao2/afmt.h" #include "ad_a52.h" @@ -136,10 +135,11 @@ return 0; } +typedef struct a52_state_s a52_state_t; extern a52_state_t *mpxp_a52_state; extern uint32_t mpxp_a52_accel; extern uint32_t mpxp_a52_flags; -extern int a52_fillbuff(sh_audio_t *sh_audio,float *pts); +int a52_fillbuff(sh_audio_t *sh_audio,float *pts); static const ad_info_t info = { @@ -175,7 +175,7 @@ sh->audio_in_minsize=3840; sh->channels=2; sh->sample_format=AFMT_AC3; - return load_dll(codec_name("liba52"SLIBSUFFIX)); + return load_dll("liba52"SLIBSUFFIX); } int init(sh_audio_t *sh_audio) Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/ad_mp3.c 2010-01-01 15:53:19 UTC (rev 58) @@ -3,7 +3,6 @@ #include <unistd.h> #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "ad_internal.h" -#include "interface/mp3.h" #include "mp_config.h" #include "../mplayer.h" #include "../cpudetect.h" @@ -27,7 +26,158 @@ LIBAD_EXTERN(mp3) -extern int mplayer_audio_read(char *buf,int size); +/** Opaque structure for the libmpg123 decoder handle. */ +struct mpg123_handle_struct; +typedef struct mpg123_handle_struct mpg123_handle; + +/** Enumeration of the mode types of Variable Bitrate */ +enum mpg123_vbr { + MPG123_CBR=0, /**< Constant Bitrate Mode (default) */ + MPG123_VBR, /**< Variable Bitrate Mode */ + MPG123_ABR /**< Average Bitrate Mode */ +}; + +/** Enumeration of the MPEG Versions */ +enum mpg123_version { + MPG123_1_0=0, /**< MPEG Version 1.0 */ + MPG123_2_0, /**< MPEG Version 2.0 */ + MPG123_2_5 /**< MPEG Version 2.5 */ +}; + + +/** Enumeration of the MPEG Audio mode. + * Only the mono mode has 1 channel, the others have 2 channels. */ +enum mpg123_mode { + MPG123_M_STEREO=0, /**< Standard Stereo. */ + MPG123_M_JOINT, /**< Joint Stereo. */ + MPG123_M_DUAL, /**< Dual Channel. */ + MPG123_M_MONO /**< Single Channel. */ +}; + +/** Enumeration of the MPEG Audio flag bits */ +enum mpg123_flags { + MPG123_CRC=0x1, /**< The bitstream is error protected using 16-bit CRC. */ + MPG123_COPYRIGHT=0x2, /**< The bitstream is copyrighted. */ + MPG123_PRIVATE=0x4, /**< The private bit has been set. */ + MPG123_ORIGINAL=0x8 /**< The bitstream is an original, not a copy. */ +}; + +/** Data structure for storing information about a frame of MPEG Audio */ +struct mpg123_frameinfo +{ + enum mpg123_version version; /**< The MPEG version (1.0/2.0/2.5). */ + int layer; /**< The MPEG Audio Layer (MP1/MP2/MP3). */ + long rate; /**< The sampling rate in Hz. */ + enum mpg123_mode mode; /**< The audio mode (Mono, Stereo, Joint-stero, Dual Channel). */ + int mode_ext; /**< The mode extension bit flag. */ + int framesize; /**< The size of the frame (in bytes). */ + enum mpg123_flags flags; /**< MPEG Audio flag bits. */ + int emphasis; /**< The emphasis type. */ + int bitrate; /**< Bitrate of the frame (kbps). */ + int abr_rate; /**< The target average bitrate. */ + enum mpg123_vbr vbr; /**< The VBR mode. */ +}; + + +/** Enumeration of the parameters types that it is possible to set/get. */ +enum mpg123_parms +{ + MPG123_VERBOSE, /**< set verbosity value for enabling messages to stderr, >= 0 makes sense (integer) */ + MPG123_FLAGS, /**< set all flags, p.ex val = MPG123_GAPLESS|MPG123_MONO_MIX (integer) */ + MPG123_ADD_FLAGS, /**< add some flags (integer) */ + MPG123_FORCE_RATE, /**< when value > 0, force output rate to that value (integer) */ + MPG123_DOWN_SAMPLE, /**< 0=native rate, 1=half rate, 2=quarter rate (integer) */ + MPG123_RVA, /**< one of the RVA choices above (integer) */ + MPG123_DOWNSPEED, /**< play a frame N times (integer) */ + MPG123_UPSPEED, /**< play every Nth frame (integer) */ + MPG123_START_FRAME, /**< start with this frame (skip frames before that, integer) */ + MPG123_DECODE_FRAMES, /**< decode only this number of frames (integer) */ + MPG123_ICY_INTERVAL, /**< stream contains ICY metadata with this interval (integer) */ + MPG123_OUTSCALE, /**< the scale for output samples (amplitude - integer or float according to mpg123 output format, normally integer) */ + MPG123_TIMEOUT, /**< timeout for reading from a stream (not supported on win32, integer) */ + MPG123_REMOVE_FLAGS, /**< remove some flags (inverse of MPG123_ADD_FLAGS, integer) */ + MPG123_RESYNC_LIMIT, /**< Try resync on frame parsing for that many bytes or until end of stream (<0 ... integer). */ + MPG123_INDEX_SIZE /**< Set the frame index size (if supported). Values <0 mean that the index is allowed to grow dynamically in these steps (in positive direction, of course) -- Use this when you really want a full index with every individual frame. */ + ,MPG123_PREFRAMES /**< Decode/ignore that many frames in advance for layer 3. This is needed to fill bit reservoir after seeking, for example (but also at least one frame in advance is needed to have all "normal" data for layer 3). Give a positive integer value, please.*/ +}; + +/** Flag bits for MPG123_FLAGS, use the usual binary or to combine. */ +enum mpg123_param_flags +{ + MPG123_FORCE_MONO = 0x7 /**< 0111 Force some mono mode: This is a test bitmask for seeing if any mono forcing is active. */ + ,MPG123_MONO_LEFT = 0x1 /**< 0001 Force playback of left channel only. */ + ,MPG123_MONO_RIGHT = 0x2 /**< 0010 Force playback of right channel only. */ + ,MPG123_MONO_MIX = 0x4 /**< 0100 Force playback of mixed mono. */ + ,MPG123_FORCE_STEREO = 0x8 /**< 1000 Force stereo output. */ + ,MPG123_FORCE_8BIT = 0x10 /**< 00010000 Force 8bit formats. */ + ,MPG123_QUIET = 0x20 /**< 00100000 Suppress any printouts (overrules verbose). */ + ,MPG123_GAPLESS = 0x40 /**< 01000000 Enable gapless decoding (default on if libmpg123 has support). */ + ,MPG123_NO_RESYNC = 0x80 /**< 10000000 Disable resync stream after error. */ + ,MPG123_SEEKBUFFER = 0x100 /**< 000100000000 Enable small buffer on non-seekable streams to allow some peek-ahead (for better MPEG sync). */ + ,MPG123_FUZZY = 0x200 /**< 001000000000 Enable fuzzy seeks (guessing byte offsets or using approximate seek points from Xing TOC) */ + ,MPG123_FORCE_FLOAT = 0x400 /**< 010000000000 Force floating point output (32 or 64 bits depends on mpg123 internal precision). */ + ,MPG123_PLAIN_ID3TEXT = 0x800 /**< 100000000000 Do not translate ID3 text data to UTF-8. ID3 strings will contain the raw text data, with the first byte containing the ID3 encoding code. */ +}; + +/** choices for MPG123_RVA */ +enum mpg123_param_rva +{ + MPG123_RVA_OFF = 0 /**< RVA disabled (default). */ + ,MPG123_RVA_MIX = 1 /**< Use mix/track/radio gain. */ + ,MPG123_RVA_ALBUM = 2 /**< Use album/audiophile gain */ + ,MPG123_RVA_MAX = MPG123_RVA_ALBUM /**< The maximum RVA code, may increase in future. */ +}; + +/** Enumeration of the message and error codes and returned by libmpg123 functions. */ +enum mpg123_errors +{ + MPG123_DONE=-12, /**< Message: Track ended. Stop decoding. */ + MPG123_NEW_FORMAT=-11, /**< Message: Output format will be different on next call. Note that some libmpg123 versions between 1.4.3 and 1.8.0 insist on you calling mpg123_getformat() after getting this message code. Newer verisons behave like advertised: You have the chance to call mpg123_getformat(), but you can also just continue decoding and get your data. */ + MPG123_NEED_MORE=-10, /**< Message: For feed reader: "Feed me more!" (call mpg123_feed() or mpg123_decode() with some new input data). */ + MPG123_ERR=-1, /**< Generic Error */ + MPG123_OK=0, /**< Success */ + MPG123_BAD_OUTFORMAT, /**< Unable to set up output format! */ + MPG123_BAD_CHANNEL, /**< Invalid channel number specified. */ + MPG123_BAD_RATE, /**< Invalid sample rate specified. */ + MPG123_ERR_16TO8TABLE, /**< Unable to allocate memory for 16 to 8 converter table! */ + MPG123_BAD_PARAM, /**< Bad parameter id! */ + MPG123_BAD_BUFFER, /**< Bad buffer given -- invalid pointer or too small size. */ + MPG123_OUT_OF_MEM, /**< Out of memory -- some malloc() failed. */ + MPG123_NOT_INITIALIZED, /**< You didn't initialize the library! */ + MPG123_BAD_DECODER, /**< Invalid decoder choice. */ + MPG123_BAD_HANDLE, /**< Invalid mpg123 handle. */ + MPG123_NO_BUFFERS, /**< Unable to initialize frame buffers (out of memory?). */ + MPG123_BAD_RVA, /**< Invalid RVA mode. */ + MPG123_NO_GAPLESS, /**< This build doesn't support gapless decoding. */ + MPG123_NO_SPACE, /**< Not enough buffer space. */ + MPG123_BAD_TYPES, /**< Incompatible numeric data types. */ + MPG123_BAD_BAND, /**< Bad equalizer band. */ + MPG123_ERR_NULL, /**< Null pointer given where valid storage address needed. */ + MPG123_ERR_READER, /**< Error reading the stream. */ + MPG123_NO_SEEK_FROM_END,/**< Cannot seek from end (end is not known). */ + MPG123_BAD_WHENCE, /**< Invalid 'whence' for seek function.*/ + MPG123_NO_TIMEOUT, /**< Build does not support stream timeouts. */ + MPG123_BAD_FILE, /**< File access error. */ + MPG123_NO_SEEK, /**< Seek not supported by stream. */ + MPG123_NO_READER, /**< No stream opened. */ + MPG123_BAD_PARS, /**< Bad parameter handle. */ + MPG123_BAD_INDEX_PAR, /**< Bad parameters to mpg123_index() */ + MPG123_OUT_OF_SYNC, /**< Lost track in bytestream and did not try to resync. */ + MPG123_RESYNC_FAIL, /**< Resync failed to find valid MPEG data. */ + MPG123_NO_8BIT, /**< No 8bit encoding possible. */ + MPG123_BAD_ALIGN, /**< Stack aligmnent error */ + MPG123_NULL_BUFFER, /**< NULL input buffer with non-zero size... */ + MPG123_NO_RELSEEK, /**< Relative seek not possible (screwed up file offset) */ + MPG123_NULL_POINTER, /**< You gave a null pointer somewhere where you shouldn't have. */ + MPG123_BAD_KEY, /**< Bad key value given. */ + MPG123_NO_INDEX, /**< No frame index in this build. */ + MPG123_INDEX_FAIL, /**< Something with frame index went wrong. */ + MPG123_BAD_DECODER_SETUP, /**< Something prevents a proper decoder setup */ + MPG123_MISSING_FEATURE /**< This feature has not been built into libmpg123. */ + ,MPG123_BAD_VALUE /**< A bad value has been given, somewhere. */ + ,MPG123_LSEEK_FAILED /**< Low-level seek failed. */ +}; + extern int fakemono; static sh_audio_t* dec_audio_sh=NULL; @@ -95,7 +245,6 @@ sh->audio_out_minsize=9216; rval=0; rval = load_dll("libmpg123"SLIBSUFFIX); /* try standard libmpg123 first */ - if(!rval) rval = load_dll(codec_name("libMP3"SLIBSUFFIX)); /* if fail then fallback to internal codec */ return rval; } Modified: mplayerxp/libmpcodecs/ad_twin.c =================================================================== --- mplayerxp/libmpcodecs/ad_twin.c 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/ad_twin.c 2010-01-01 15:53:19 UTC (rev 58) @@ -5,7 +5,6 @@ #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "ad_internal.h" #include "codecs_ld.h" -#include "interface/vqf.h" #include "loader/ldt_keeper.h" #include "loader/wine/windef.h" #include "../libao2/afmt.h" @@ -27,10 +26,165 @@ LIBAD_EXTERN(twin) -extern void* WINAPI LoadLibraryA(char* name); -extern void* WINAPI GetProcAddress(void* handle, char* func); -extern int WINAPI FreeLibrary(void* handle); +/************************/ +/*** General settings ***/ +/************************/ +/* Initialization error code */ +enum INIT_ERROR_CODE { + TVQ_NO_ERROR = 0, // no error + TVQ_ERROR, // general + TVQ_ERROR_VERSION, // wrong version + TVQ_ERROR_CHANNEL, // channel setting error + TVQ_ERROR_MODE, // wrong coding mode + TVQ_ERROR_PARAM, // inner parameter setting error + TVQ_ERROR_N_CAN, // wrong number of VQ pre-selection candidates, used only in encoder +}; +/* version ID */ +#define TVQ_UNKNOWN_VERSION -1 +#define V2 0 +#define V2PP 1 + +#define N_VERSIONS 2 + +/* window types */ +enum WINDOW_TYPE { + ONLY_LONG_WINDOW = 0, + LONG_SHORT_WINDOW, + ONLY_SHORT_WINDOW, + SHORT_LONG_WINDOW, + SHORT_MEDIUM_WINDOW, + MEDIUM_LONG_WINDOW, + LONG_MEDIUM_WINDOW, + MEDIUM_SHORT_WINDOW, + ONLY_MEDIUM_WINDOW, +}; + +/* block types */ +enum BLOCK_TYPE { + BLK_SHORT = 0, + BLK_MEDIUM, + BLK_LONG, + BLK_PPC, +}; +#define N_BTYPE 3 // number of block types +#define N_INTR_TYPE 4 // number of interleave types, enum BLOCK_TYPE is commonly used for detecting interleave types. + +/* maximum number of channels */ +#define N_CH_MAX 2 + +/* type definition of code information interface */ +typedef struct { + /* block type */ + int w_type; + int btype; + + /* FBC info */ + int *segment_sw[ N_CH_MAX ]; + int *band_sw[ N_CH_MAX ]; + int *fg_intensity[ N_CH_MAX ]; + + /* VQ info */ + int *wvq; + + /* BSE info */ + int *fw; + int *fw_alf; + + /* gain info */ + int *pow; + + /* LSP info */ + int *lsp[ N_CH_MAX ]; + + /* PPC info */ + int pit[ N_CH_MAX ]; + int *pls; + int pgain[ N_CH_MAX ]; + + /* EBC info */ + int *bc[ N_CH_MAX ]; + + void *manager; +} INDEX; + +/***********************************************/ +/*** Definitions about program configuration ***/ +/***********************************************/ +/* type definition of tvqConfInfoSubBlock */ +typedef struct { + int sf_sz; // subframe size + int nsf; // number of subframes + int ndiv; // number of division of weighted interleave vector quantization + int ncrb; // number of Bark-scale subbands + int fw_ndiv; // number of division of BSE VQ + int fw_nbit; // number of bits for BSE VQ + int nsubg; // number of sub-blocks for gain coding + int ppc_enable; // PPC switch + int ebc_enable; // EBC switch + int ebc_crb_base; // EBC base band + int ebc_bits; // EBC bits + int fbc_enable; // FBC switch + int fbc_n_segment; // FBC number of segments + int fbc_nband; // FBC number of subbands + int *fbc_crb_tbl; // FBC subband table +} tvqConfInfoSubBlock; + +/* type definition of tvqConfInfo */ +typedef struct { + /* frame configuration */ + int N_CH; + /* window type coding */ + int BITS_WTYPE; + /* LSP coding */ + int LSP_BIT0; + int LSP_BIT1; + int LSP_BIT2; + int LSP_SPLIT; + /* Bark-scale envelope coding */ + int FW_ARSW_BITS; + /* gain coding */ + int GAIN_BITS; + int SUB_GAIN_BITS; + /* pitch excitation */ + int N_DIV_P; + int BASF_BIT; + int PGAIN_BIT; + + /* block type dependent parameters */ + tvqConfInfoSubBlock cfg[N_BTYPE]; + +} tvqConfInfo; + + +#define KEYWORD_BYTES 4 +#define VERSION_BYTES 8 +#define ELEM_BYTES sizeof(unsigned long) +/* + */ +typedef struct{ + char ID[KEYWORD_BYTES+VERSION_BYTES+1]; + int size; + /* Common Chunk */ + int channelMode; /* channel mode (mono:0/stereo:1) */ + int bitRate; /* bit rate (kbit/s) */ + int samplingRate; /* sampling rate (44.1 kHz -> 44) */ + int securityLevel; /* security level (always 0) */ + /* Text Chunk */ + char Name[BUFSIZ]; + char Comt[BUFSIZ]; + char Auth[BUFSIZ]; + char Cpyr[BUFSIZ]; + char File[BUFSIZ]; + char Extr[BUFSIZ]; // add by OKAMOTO 99.12.21 + /* Data size chunk*/ + int Dsiz; +} headerInfo; + +extern HMODULE WINAPI LoadLibraryA(LPCSTR); +extern FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR); +extern int WINAPI FreeLibrary(HMODULE); + static int (*TvqInitialize_ptr)( headerInfo *setupInfo, INDEX *index, int dispErrorMessageBox ); #define TvqInitialize(a,b,c) (*TvqInitialize_ptr)(a,b,c) static void (*TvqTerminate_ptr)( INDEX *index ); @@ -184,7 +338,7 @@ MSG_ERR("TWinVQ initialization fail\n"); return 0; } - MSG_V("INFO: TWinVQ (%s) audio codec init OK!\n",CODECDIR"/wine/libloader"SLIBSUFFIX); + MSG_V("INFO: TWinVQ audio codec init OK!\n"); return 1; } Modified: mplayerxp/libmpcodecs/ad_vorbis.c =================================================================== --- mplayerxp/libmpcodecs/ad_vorbis.c 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/ad_vorbis.c 2010-01-01 15:53:19 UTC (rev 58) @@ -23,7 +23,7 @@ LIBAD_EXTERN(vorbis) #include <math.h> -#include "interface/vorbis/codec.h" +#include <vorbis/codec.h> // This struct is also defined in demux_ogg.c => common header ? typedef struct ov_struct_st { @@ -34,50 +34,9 @@ vorbis_block vb; /* local working space for packet->PCM decode */ } ov_struct_t; -static void (*vorbis_info_init_ptr)(vorbis_info *vi); -#define vorbis_info_init(a) (*vorbis_info_init_ptr)(a) -static void (*vorbis_comment_init_ptr)(vorbis_comment *vc); -#define vorbis_comment_init(a) (*vorbis_comment_init_ptr)(a) -static int (*vorbis_synthesis_init_ptr)(vorbis_dsp_state *v,vorbis_info *vi); -#define vorbis_synthesis_init(a,b) (*vorbis_synthesis_init_ptr)(a,b) -static int (*vorbis_synthesis_headerin_ptr)(vorbis_info *vi,vorbis_comment *vc, - ogg_packet *op); -#define vorbis_synthesis_headerin(a,b,c) (*vorbis_synthesis_headerin_ptr)(a,b,c) -static int (*vorbis_synthesis_ptr)(vorbis_block *vb,ogg_packet *op); -#define vorbis_synthesis(a,b) (*vorbis_synthesis_ptr)(a,b) -static int (*vorbis_synthesis_blockin_ptr)(vorbis_dsp_state *v,vorbis_block *vb); -#define vorbis_synthesis_blockin(a,b) (*vorbis_synthesis_blockin_ptr)(a,b) -static int (*vorbis_synthesis_pcmout_ptr)(vorbis_dsp_state *v,float ***pcm); -#define vorbis_synthesis_pcmout(a,b) (*vorbis_synthesis_pcmout_ptr)(a,b) -static int (*vorbis_synthesis_read_ptr)(vorbis_dsp_state *v,int samples); -#define vorbis_synthesis_read(a,b) (*vorbis_synthesis_read_ptr)(a,b) -static int (*vorbis_block_init_ptr)(vorbis_dsp_state *v, vorbis_block *vb); -#define vorbis_block_init(a,b) (*vorbis_block_init_ptr)(a,b) - -static void *dll_handle; -static int load_lib( const char *libname ) -{ - if(!(dll_handle=ld_codec(libname,NULL))) return 0; - vorbis_info_init_ptr = ld_sym(dll_handle,"vorbis_info_init"); - vorbis_comment_init_ptr = ld_sym(dll_handle,"vorbis_comment_init"); - vorbis_synthesis_init_ptr = ld_sym(dll_handle,"vorbis_synthesis_init"); - vorbis_synthesis_headerin_ptr = ld_sym(dll_handle,"vorbis_synthesis_headerin"); - vorbis_synthesis_ptr = ld_sym(dll_handle,"vorbis_synthesis"); - vorbis_synthesis_blockin_ptr = ld_sym(dll_handle,"vorbis_synthesis_blockin"); - vorbis_synthesis_pcmout_ptr = ld_sym(dll_handle,"vorbis_synthesis_pcmout"); - vorbis_synthesis_read_ptr = ld_sym(dll_handle,"vorbis_synthesis_read"); - vorbis_block_init_ptr = ld_sym(dll_handle,"vorbis_block_init"); - return vorbis_info_init_ptr && vorbis_comment_init_ptr && - vorbis_synthesis_init_ptr && vorbis_synthesis_headerin_ptr && - vorbis_synthesis_ptr && vorbis_synthesis_blockin_ptr && - vorbis_synthesis_pcmout_ptr && vorbis_synthesis_read_ptr && - vorbis_block_init_ptr; -} - static int preinit(sh_audio_t *sh) { if(!(sh->context=malloc(sizeof(ov_struct_t)))) return 0; - if(!load_lib("libvorbis"SLIBSUFFIX)) return 0; sh->audio_out_minsize=1024*4; // 1024 samples/frame return 1; } @@ -160,18 +119,15 @@ static void uninit(sh_audio_t *sh) { free(sh->context); - dlclose(dll_handle); } 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; +#if 0 + case ADCTRL_RESYNC_STREAM: return CONTROL_TRUE; + case ADCTRL_SKIP_FRAME: return CONTROL_TRUE; #endif } return CONTROL_UNKNOWN; @@ -197,7 +153,7 @@ int clipflag=0; int convsize=(maxlen-len)/(2*ov->vi.channels); // max size! int bout=(samples<convsize?samples:convsize); - + if(bout<=0) break; if(sh->samplesize==4) Modified: mplayerxp/libmpcodecs/codecs_ld.c =================================================================== --- mplayerxp/libmpcodecs/codecs_ld.c 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/codecs_ld.c 2010-01-01 15:53:19 UTC (rev 58) @@ -24,6 +24,7 @@ return dll_handle; } +#if 0 /* this code should be called before thread creating */ static char cname[FILENAME_MAX]; char * codec_name( const char *name ) @@ -32,6 +33,7 @@ strcat(cname,name); return cname; } +#endif void * ld_sym(void *handle,const char *sym_name) { Modified: mplayerxp/libmpcodecs/codecs_ld.h =================================================================== --- mplayerxp/libmpcodecs/codecs_ld.h 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/codecs_ld.h 2010-01-01 15:53:19 UTC (rev 58) @@ -6,7 +6,7 @@ #define __CODECS_LD extern void * ld_codec(const char *name,const char *url_hint); -extern char * codec_name( const char *name ); +/*extern char * codec_name( const char *name );*/ extern void * ld_sym(void *handle,const char *sym_name); #if defined(__OpenBSD__) && !defined(__ELF__) Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/vd.c 2010-01-01 15:53:19 UTC (rev 58) @@ -61,7 +61,9 @@ &mpcodecs_vd_huffyuv, &mpcodecs_vd_xanim, &mpcodecs_vd_real, +#ifdef HAVE_LIBTHEORA &mpcodecs_vd_theora, +#endif NULL }; static unsigned int nddrivers=sizeof(mpcodecs_vd_drivers)/sizeof(vd_functions_t*); Modified: mplayerxp/libmpcodecs/vd_divx4.c =================================================================== --- mplayerxp/libmpcodecs/vd_divx4.c 2010-01-01 09:48:37 UTC (rev 57) +++ mplayerxp/libmpcodecs/vd_divx4.c 2010-01-01 15:53:19 UTC (rev 58) @@ -35,12 +35,98 @@ LIBVD_EXTERN(divx4) -#include "interface/divx4linux.h" - #define DIVX4LINUX_BETA 0 #define DIVX4LINUX 1 #define DIVX5LINUX 2 +#define DEC_OPT_INIT 0 ///< Initialize the decoder. See LibQDecoreFunction for example usage. +#define DEC_OPT_RELEASE 1 ///< Release the decoder. See LibQDecoreFunction for example usage. +#define DEC_OPT_INFO 2 ///< Obtain information about the video. See LibQDecoreFunction for example usage. +#define DEC_OPT_FRAME 3 ///< Decode a frame. See LibQDecoreFunction for example usage. +#define DEC_OPT_SET 4 ///< Specify a parameter to adjust/set. +#define DEC_OPT_FLUSH 5 ///< Flush the decoder status. + +// Decoder parameter specifier + +#define DEC_PAR_OUTPUT 0 ///< Specify a different output format. pParam2 will point to a DecInit structure +#define DEC_PAR_POSTPROCESSING 1 ///< pParam2 will specify a postprocessing level. +#define DEC_PAR_POSTPROCDEBLOC 2 ///< pParam2 will specify a deblocking level. +#define DEC_PAR_POSTPROCDERING 3 ///< pParam2 will specify a deringing level. +#define DEC_PAR_WARMTHLEVEL 4 ///< pParam2 will specify a level for the warmth filter (film effect). +#define DEC_PAR_CONTRAST 5 ///< pParam2 will specify the contrast of the output image. +#define DEC_PAR_BRIGHTNESS 6 ///< pParam2 will specify the brightness of the output image. +#define DEC_PAR_SATURATION 7 ///< pParam2 will specify the saturation of the output image. +#define DEC_PAR_LOGO 8 ///< Display the DivX logo on the bottom right... [truncated message content] |
From: <nic...@us...> - 2010-01-04 13:28:02
|
Revision: 67 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=67&view=rev Author: nickols_k Date: 2010-01-04 12:13:41 +0000 (Mon, 04 Jan 2010) Log Message: ----------- remove very old and linux-kernel specific stuff Modified Paths: -------------- mplayerxp/configure mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/stream.c Removed Paths: ------------- mplayerxp/libmpdemux/s_vcd.c Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2010-01-04 12:01:28 UTC (rev 66) +++ mplayerxp/configure 2010-01-04 12:13:41 UTC (rev 67) @@ -641,9 +641,7 @@ enabled libcdio && require2 libcdio "cdio/cdio.h" cdio_read_mode2_sectors -lcdio print_config HAVE_ mp_config.h mp_config.mak libcdio -enabled libcdio && inputmodules="vcd $inputmodules" || noinputmodules="vcd $noinputmodules" - enabled libcdio && require2 libcdio_cdda "cdio/cdda.h" cdio_cddap_read -lcdio_cdda print_config HAVE_ mp_config.h mp_config.mak libcdio_cdda enabled libcdio_cdda && inputmodules="cdda $inputmodules" || noinputmodules="cdda $noinputmodules" Modified: mplayerxp/libmpdemux/Makefile =================================================================== --- mplayerxp/libmpdemux/Makefile 2010-01-04 12:01:28 UTC (rev 66) +++ mplayerxp/libmpdemux/Makefile 2010-01-04 12:13:41 UTC (rev 67) @@ -26,9 +26,6 @@ ifeq ($(USE_LIBVCD),yes) SRCS += s_vcdnav.c endif -ifeq ($(HAVE_LIBCDIO),yes) -SRCS += s_vcd.c -endif SRCS += cache2.c dvdauth.c stream.c tvi_dummy.c tvi_v4l.c SRCS += tvi_bsdbt848.c frequencies.c mrl.c Deleted: mplayerxp/libmpdemux/s_vcd.c =================================================================== --- mplayerxp/libmpdemux/s_vcd.c 2010-01-04 12:01:28 UTC (rev 66) +++ mplayerxp/libmpdemux/s_vcd.c 2010-01-04 12:13:41 UTC (rev 67) @@ -1,118 +0,0 @@ -/* - s_vcd - VCD's stream interface -*/ -#include "../mp_config.h" -#ifdef HAVE_LIBCDIO -#include <unistd.h> -#include <fcntl.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <cdio/cdio.h> - -#include "stream.h" -#include "help_mp.h" -#include "mrl.h" -#include "demux_msg.h" - -typedef struct vcd_priv_s -{ - CdIo_t *cd; - off_t spos; - unsigned ssect,esect; -}vcd_priv_t; - -static int __FASTCALL__ _vcd_open(stream_t *stream,const char *filename,unsigned flags) -{ - int vcd_track; - vcd_priv_t *priv; - const char *param; - char *dev,*device=NULL; - UNUSED(flags); -/* originally was vcd:// but playtree parser replaced it */ - if(strcmp(filename,"help") == 0) - { - MSG_HINT("Usage: vcd://<@device><#trackno>\n"); - return 0; - } - param=mrl_parse_line(filename,NULL,NULL,&device,NULL); - vcd_track=atoi(param); - if(!device) dev=DEFAULT_CDROM_DEVICE; - else dev=device; - priv=stream->priv=malloc(sizeof(vcd_priv_t)); - cdio_init(); - priv->cd=cdio_open(dev,DRIVER_UNKNOWN); - if(device) free(device); - if(!priv->cd) - { - MSG_ERR(MSGTR_CdDevNotfound,device); - return 0; - } - vcd_track=cdio_get_num_tracks(priv->cd); - MSG_V("CD contains: %d tracks\n",vcd_track); - priv->ssect=cdio_get_track_pregap_lsn(priv->cd,2); - priv->esect=cdio_get_track_pregap_lsn(priv->cd,vcd_track)+cdio_get_track_sec_count(priv->cd,vcd_track); - - stream->type = STREAMTYPE_SEEKABLE|STREAMTYPE_PROGRAM; - stream->sector_size=VCD_SECTOR_SIZE; - stream->start_pos=priv->ssect*VCD_SECTOR_DATA; - stream->end_pos=priv->esect*VCD_SECTOR_DATA; - ((vcd_priv_t *)stream->priv)->spos=stream->start_pos; - return 1; -} - -static int __FASTCALL__ _vcd_read(stream_t *stream,stream_packet_t*sp) -{ - vcd_priv_t *p=stream->priv; - ssize_t len; - sp->type=0; - len=cdio_read(p->cd,sp->buf,sp->len); - p->spos += len; - return len; -} - -static off_t __FASTCALL__ _vcd_seek(stream_t *stream,off_t pos) -{ - vcd_priv_t *p=stream->priv; - off_t newpos=pos; - if(newpos<stream->start_pos) newpos=stream->start_pos; - if(newpos>stream->end_pos) newpos=stream->end_pos; - newpos=pos/VCD_SECTOR_DATA; - if(newpos<p->ssect) newpos=p->ssect; - if(newpos>p->esect) newpos=p->esect; - newpos=cdio_lseek(p->cd,newpos*VCD_SECTOR_DATA,SEEK_SET); - p->spos=newpos*VCD_SECTOR_DATA; - return p->spos; -} - -static off_t __FASTCALL__ _vcd_tell(stream_t *stream) -{ - vcd_priv_t *p=stream->priv; - return p->spos; -} - -static void __FASTCALL__ _vcd_close(stream_t*stream) -{ - vcd_priv_t *p=stream->priv; - cdio_destroy(p->cd); - free(stream->priv); -} -static int __FASTCALL__ _vcd_ctrl(stream_t *s,unsigned cmd,void *args) { - UNUSED(s); - UNUSED(cmd); - UNUSED(args); - return SCTRL_UNKNOWN; -} - -const stream_driver_t vcd_stream= -{ - "vcd://", - "reads multimedia stream using low-level Video-CD access", - _vcd_open, - _vcd_read, - _vcd_seek, - _vcd_tell, - _vcd_close, - _vcd_ctrl -}; -#endif Modified: mplayerxp/libmpdemux/stream.c =================================================================== --- mplayerxp/libmpdemux/stream.c 2010-01-04 12:01:28 UTC (rev 66) +++ mplayerxp/libmpdemux/stream.c 2010-01-04 12:13:41 UTC (rev 67) @@ -42,9 +42,6 @@ #ifdef USE_OSS_AUDIO extern const stream_driver_t oss_stream; #endif -#ifdef HAVE_LIBCDIO -extern const stream_driver_t vcd_stream; -#endif #ifdef USE_LIBVCD extern const stream_driver_t vcdnav_stream; #endif @@ -69,9 +66,6 @@ #ifdef USE_TV &tv_stream, #endif -#ifdef HAVE_LIBCDIO - &vcd_stream, -#endif #ifdef USE_LIBVCD &vcdnav_stream, #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2010-01-05 14:26:35
|
Revision: 75 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=75&view=rev Author: nickols_k Date: 2010-01-05 14:26:28 +0000 (Tue, 05 Jan 2010) Log Message: ----------- minor renaming Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.c mplayerxp/libvo/img_format.c mplayerxp/libvo/img_format.h mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/libvo/video_out_internal.h mplayerxp/libvo/vo_dga.c mplayerxp/libvo/vo_fbdev.c mplayerxp/libvo/vo_null.c mplayerxp/libvo/vo_opengl.c mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_vesa.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vo_xvidix.c mplayerxp/libvo/vosub_vidix.c mplayerxp/libvo/vosub_vidix.h mplayerxp/libvo/x11_common.c mplayerxp/libvo/x11_common.h mplayerxp/mplayer.c mplayerxp/postproc/vf.h mplayerxp/postproc/vf_vo.c Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libmpcodecs/dec_video.c 2010-01-05 14:26:28 UTC (rev 75) @@ -219,7 +219,7 @@ if(drop_frame) return 0; update_subtitle(pts); -vo_flush_frame(); +vo_flush_pages(); if(!(mpi->flags&(MP_IMGFLAG_DRAW_CALLBACK))){ MSG_DBG2("Put whole frame\n"); Modified: mplayerxp/libvo/img_format.c =================================================================== --- mplayerxp/libvo/img_format.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/img_format.c 2010-01-05 14:26:28 UTC (rev 75) @@ -158,7 +158,7 @@ return -1; } -int rgbfmt_depth(int fmt) +unsigned rgbfmt_depth(unsigned fmt) { switch(pixfmt_from_fourcc(fmt)) { case PIX_FMT_RGB48BE: Modified: mplayerxp/libvo/img_format.h =================================================================== --- mplayerxp/libvo/img_format.h 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/img_format.h 2010-01-05 14:26:28 UTC (rev 75) @@ -164,6 +164,6 @@ const char * __FASTCALL__ vo_format_name(int format); int pixfmt_from_fourcc(uint32_t fourcc); uint32_t fourcc_from_pixfmt(int pixfmt); -extern int rgbfmt_depth(int fmt); +extern unsigned rgbfmt_depth(unsigned fmt); #endif Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/video_out.c 2010-01-05 14:26:28 UTC (rev 75) @@ -670,7 +670,7 @@ { MSG_DBG3("dri_vo_dbg: vo_set_active_frame(%u)\n",*fr); active_frame = *fr; - vo_flip_page(); + vo_change_frame(); return VO_TRUE; } @@ -723,23 +723,23 @@ return -1; } -void vo_flip_page(void) +void vo_change_frame(void) { - MSG_DBG3("dri_vo_dbg: vo_flip_page [active_frame=%u]\n",active_frame); + MSG_DBG3("dri_vo_dbg: vo_change_frame [active_frame=%u]\n",active_frame); if(vo_doublebuffering || (dri_cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) { - video_out->flip_page(active_frame); + video_out->change_frame(active_frame); active_frame = (active_frame+1)%dri_nframes; if(!dri_has_thread) xp_frame = (xp_frame+1)%dri_nframes; } } -void vo_flush_frame(void) +void vo_flush_pages(void) { - MSG_DBG3("dri_vo_dbg: vo_flush_frame [active_frame=%u]\n",active_frame); + MSG_DBG3("dri_vo_dbg: vo_flush_pages [active_frame=%u]\n",active_frame); frame_counter++; if((dri_cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) - video_out->control(VOCTRL_FLUSH_FRAME,&xp_frame); + video_out->control(VOCTRL_FLUSH_PAGES,&xp_frame); } /* DRAW OSD */ Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/video_out.h 2010-01-05 14:26:28 UTC (rev 75) @@ -34,7 +34,7 @@ #define VOCTRL_CHECK_EVENTS 9 /**< Notification that user performs key pressing. Takes (vo_resize_t *)&vrest as arg. Must return at least VO_EVENT_RESIZE */ #define VOCTRL_GET_NUM_FRAMES 10/**< Query total number of allocated frames (multibuffering) */ #define VOCTRL_UNUSED3 12 -#define VOCTRL_FLUSH_FRAME 13 /**< Flush frame from RAM into video memory (bus mastering) */ +#define VOCTRL_FLUSH_PAGES 13 /**< Flush pages of frame from RAM into video memory (bus mastering) */ #define VOCTRL_UNUSED4 14 #define VOCTRL_SET_EQUALIZER 1000 /**< Set video equalizer */ #define VOCTRL_GET_EQUALIZER 1001 /**< Get video equalizer */ @@ -141,7 +141,7 @@ /** Blit/Flip buffer to the screen. Must be called after each frame! * @param idex index of frame to be selected as active frame **/ - void (* __FASTCALL__ flip_page)(unsigned idx); + void (* __FASTCALL__ change_frame)(unsigned idx); /** Closes driver. Should restore the original state of the system. **/ @@ -176,8 +176,8 @@ extern uint32_t __FASTCALL__ vo_draw_frame(const uint8_t *src[]); extern uint32_t __FASTCALL__ vo_draw_slice(const uint8_t *src[], unsigned stride[], unsigned w,unsigned h,unsigned x,unsigned y); -extern void vo_flip_page(void); -extern void vo_flush_frame(void); +extern void vo_change_frame(void); +extern void vo_flush_pages(void); extern void vo_draw_osd(void); extern void vo_uninit( void ); extern uint32_t __FASTCALL__ vo_control(uint32_t request, void *data); Modified: mplayerxp/libvo/video_out_internal.h =================================================================== --- mplayerxp/libvo/video_out_internal.h 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/video_out_internal.h 2010-01-05 14:26:28 UTC (rev 75) @@ -27,7 +27,7 @@ uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *); static const vo_info_t* get_info(void); -static void __FASTCALL__ flip_page(unsigned idx); +static void __FASTCALL__ change_frame(unsigned idx); static void uninit(void); static uint32_t __FASTCALL__ preinit(const char *); @@ -37,7 +37,7 @@ config,\ control,\ get_info,\ - flip_page,\ + change_frame,\ uninit\ }; Modified: mplayerxp/libvo/vo_dga.c =================================================================== --- mplayerxp/libvo/vo_dga.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_dga.c 2010-01-05 14:26:28 UTC (rev 75) @@ -240,7 +240,7 @@ #include "sub.h" -static void __FASTCALL__ flip_page( unsigned idx ) +static void __FASTCALL__ change_frame( unsigned idx ) { #ifdef HAVE_DGA2 XDGASetViewport (mDisplay, XDefaultScreen(mDisplay), Modified: mplayerxp/libvo/vo_fbdev.c =================================================================== --- mplayerxp/libvo/vo_fbdev.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_fbdev.c 2010-01-05 14:26:28 UTC (rev 75) @@ -1148,7 +1148,7 @@ return &vo_info; } -static void __FASTCALL__ flip_page(unsigned idx) +static void __FASTCALL__ change_frame(unsigned idx) { unsigned i, out_offset = 0, in_offset = 0; Modified: mplayerxp/libvo/vo_null.c =================================================================== --- mplayerxp/libvo/vo_null.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_null.c 2010-01-05 14:26:28 UTC (rev 75) @@ -56,7 +56,7 @@ static uint32_t offset_y,offset_u,offset_v; -static void __FASTCALL__ flip_page(unsigned idx) +static void __FASTCALL__ change_frame(unsigned idx) { UNUSED(idx); } @@ -231,7 +231,7 @@ case DRI_GET_SURFACE: null_dri_get_surface(data); return VO_TRUE; - case VOCTRL_FLUSH_FRAME: + case VOCTRL_FLUSH_PAGES: return VO_TRUE; } return VO_NOTIMPL; Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_opengl.c 2010-01-05 14:26:28 UTC (rev 75) @@ -79,24 +79,9 @@ static XVisualInfo vinfo; static unsigned depth,bpp,gl_out_mode; static unsigned num_buffers=1; // default -static XImage *myximage[MAX_DRI_BUFFERS]; static void *glx_context; static uint32_t gl_out_format=0,out_format=0; -#ifdef HAVE_SHM -#include <sys/ipc.h> -#include <sys/shm.h> -#include <X11/extensions/XShm.h> - -static int Shmem_Flag; -static XShmSegmentInfo Shminfo[MAX_DRI_BUFFERS]; -static int gXErrorFlag; -static int CompletionType=-1; - -/* since it doesn't seem to be defined on some platforms */ -extern int XShmGetEventBase( Display* ); -#endif - static XVisualInfo *get_visual_info(Display *dpy, Window win) { XWindowAttributes wattr; @@ -108,103 +93,6 @@ return XGetVisualInfo(dpy, VisualIDMask, &vi_template, &dummy); } -/* local data */ -#define ImageData(idx) ( uint8_t * ) myximage[idx]->data - -static void __FASTCALL__ getMyXImage(unsigned idx) -{ -#ifdef HAVE_SHM - if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag=1; - else - { - Shmem_Flag=0; - MSG_V( "Shared memory not supported\nReverting to normal Xlib\n" ); - } - if ( Shmem_Flag ) CompletionType=XShmGetEventBase( mDisplay ) + ShmCompletion; - - if ( Shmem_Flag ) - { - myximage[idx]=XShmCreateImage( mDisplay,vinfo.visual,depth,ZPixmap,NULL,&Shminfo[idx],image_width,image_height ); - if ( myximage[idx] == NULL ) - { - if ( myximage[idx] != NULL ) XDestroyImage( myximage[idx] ); - MSG_V( "Shared memory error,disabling ( Ximage error )\n" ); - goto shmemerror; - } - Shminfo[idx].shmid=shmget( IPC_PRIVATE, - myximage[idx]->bytes_per_line * myximage[idx]->height , - IPC_CREAT | 0777 ); - if ( Shminfo[idx].shmid < 0 ) - { - XDestroyImage( myximage[idx] ); - MSG_V( "%s\n",strerror( errno ) ); - MSG_V( "Shared memory error,disabling ( seg id error )\n" ); - goto shmemerror; - } - Shminfo[idx].shmaddr=( char * ) shmat( Shminfo[idx].shmid,0,0 ); - - if ( Shminfo[idx].shmaddr == ( ( char * ) -1 ) ) - { - XDestroyImage( myximage[idx] ); - if ( Shminfo[idx].shmaddr != ( ( char * ) -1 ) ) shmdt( Shminfo[idx].shmaddr ); - MSG_V( "Shared memory error,disabling ( address error )\n" ); - goto shmemerror; - } - myximage[idx]->data=Shminfo[idx].shmaddr; - Shminfo[idx].readOnly=False; - XShmAttach( mDisplay,&Shminfo[idx] ); - - XSync( mDisplay,False ); - - if ( gXErrorFlag ) - { - XDestroyImage( myximage[idx] ); - shmdt( Shminfo[idx].shmaddr ); - MSG_V( "Shared memory error,disabling.\n" ); - gXErrorFlag=0; - goto shmemerror; - } - else - shmctl( Shminfo[idx].shmid,IPC_RMID,0 ); - - { - static int firstTime=1; - if (firstTime){ - MSG_V( "Sharing memory.\n" ); - firstTime=0; - } - } - } - else - { - shmemerror: - Shmem_Flag=0; -#endif - myximage[idx]=XGetImage( mDisplay,vo_window,0,0, - image_width,image_height,AllPlanes,ZPixmap ); -#ifdef HAVE_SHM - } -#endif -} - -static void __FASTCALL__ freeMyXImage(unsigned idx) -{ -#ifdef HAVE_SHM - if ( Shmem_Flag ) - { - XShmDetach( mDisplay,&Shminfo[idx] ); - XDestroyImage( myximage[idx] ); - shmdt( Shminfo[idx].shmaddr ); - } - else -#endif - { - XDestroyImage( myximage[idx] ); - } - myximage[idx]=NULL; -} - - static void gl_init_fb(unsigned x,unsigned y,unsigned d_width,unsigned d_height) { float sx = (GLfloat) (d_width-x) / (GLfloat)image_width; @@ -329,7 +217,7 @@ 0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa); vo_x11_classhint( mDisplay,vo_window,"opengl" ); - vo_hidecursor(mDisplay,vo_window); + vo_x11_hidecursor(mDisplay,vo_window); XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | ((WinID==0) ? 0 : (PointerMotionMask @@ -379,11 +267,11 @@ #endif gl_init_fb(0,0,d_width,d_height); /* allocate multibuffers */ - for(i=0;i<num_buffers;i++) getMyXImage(i); + for(i=0;i<num_buffers;i++) vo_x11_getMyXImage(i,vinfo.visual,depth,image_width,image_height,0); gl_out_mode=GL_RGB; - is_bgr=(myximage[0]->blue_mask&0x01)!=0; - switch ((bpp=myximage[0]->bits_per_pixel)){ + is_bgr=(vo_x11_myximage[0]->blue_mask&0x01)!=0; + switch ((bpp=vo_x11_myximage[0]->bits_per_pixel)){ case 32:gl_out_mode=GL_RGBA; gl_out_format=is_bgr?GL_UNSIGNED_INT_8_8_8_8_REV:GL_UNSIGNED_INT_8_8_8_8; out_format = IMGFMT_RGB32; @@ -419,8 +307,8 @@ myximage->data); } -static void flip_page(unsigned idx) { - gl_display_Image( myximage[idx] ); +static void change_frame(unsigned idx) { + gl_display_Image( vo_x11_myximage[idx] ); if (num_buffers>1) glXSwapBuffers(mDisplay, vo_window); glFlush(); return; @@ -448,7 +336,7 @@ glFinish(); glXMakeCurrent(mDisplay, None, NULL); glXDestroyContext(mDisplay, glx_context); - for(i=0;i<num_buffers;i++) freeMyXImage(i); + for(i=0;i<num_buffers;i++) vo_x11_freeMyXImage(i); saver_on(mDisplay); // screen saver back on #ifdef HAVE_XF86VM vo_vm_close(mDisplay); @@ -481,7 +369,7 @@ static void __FASTCALL__ gl_dri_get_surface(dri_surface_t *surf) { - surf->planes[0] = ImageData(surf->idx); + surf->planes[0] = vo_x11_ImageData(surf->idx); surf->planes[1] = 0; surf->planes[2] = 0; surf->planes[3] = 0; Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_sdl.c 2010-01-05 14:26:28 UTC (rev 75) @@ -1155,7 +1155,7 @@ * returns : doesn't return **/ -static void __FASTCALL__ flip_page (unsigned idx) +static void __FASTCALL__ change_frame(unsigned idx) { struct sdl_priv_s *priv = &sdl_priv; Modified: mplayerxp/libvo/vo_vesa.c =================================================================== --- mplayerxp/libvo/vo_vesa.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_vesa.c 2010-01-05 14:26:28 UTC (rev 75) @@ -245,9 +245,9 @@ } } -static void __FASTCALL__ flip_page(unsigned idx) +static void __FASTCALL__ change_frame(unsigned idx) { - MSG_DBG3("vo_vesa: flip_page was called\n"); + MSG_DBG3("vo_vesa: change_frame was called\n"); if(!HAS_DGA()) __vbeCopyData(dga_buffer); else { Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_x11.c 2010-01-05 14:26:28 UTC (rev 75) @@ -62,37 +62,25 @@ "" }; + +#ifdef HAVE_SHM +#include <sys/ipc.h> +#include <sys/shm.h> +#include <X11/extensions/XShm.h> +#endif /* private prototypes */ static void __FASTCALL__ Display_Image ( XImage * myximage ); -/* local data */ -#define ImageData(idx) ( uint8_t * ) myximage[idx]->data - /*** X11 related variables ***/ /* xp related variables */ static unsigned num_buffers=1; // default -static XImage *myximage[MAX_DRI_BUFFERS]; -static int depth,bpp,mode; +static unsigned depth,bpp,mode; static XWindowAttributes attribs; static int Flip_Flag; static int zoomFlag; -#ifdef HAVE_SHM -#include <sys/ipc.h> -#include <sys/shm.h> -#include <X11/extensions/XShm.h> - -static int Shmem_Flag; -static XShmSegmentInfo Shminfo[MAX_DRI_BUFFERS]; -static int gXErrorFlag; -static int CompletionType=-1; - -/* since it doesn't seem to be defined on some platforms */ -extern int XShmGetEventBase( Display* ); -#endif - static uint32_t image_width; static uint32_t image_height; static uint32_t in_format; @@ -100,100 +88,6 @@ static int baseAspect; // 1<<16 based fixed point aspect, so that the aspect stays correct during resizing static XVisualInfo vinfo; -static void __FASTCALL__ getMyXImage(unsigned idx) -{ -#ifdef HAVE_SHM - if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag=1; - else - { - Shmem_Flag=0; - MSG_V( "Shared memory not supported\nReverting to normal Xlib\n" ); - } - if ( Shmem_Flag ) CompletionType=XShmGetEventBase( mDisplay ) + ShmCompletion; - - if ( Shmem_Flag ) - { - myximage[idx]=XShmCreateImage( mDisplay,vinfo.visual,depth,ZPixmap,NULL,&Shminfo[idx],image_width,image_height ); - if ( myximage[idx] == NULL ) - { - if ( myximage[idx] != NULL ) XDestroyImage( myximage[idx] ); - MSG_V( "Shared memory error,disabling ( Ximage error )\n" ); - goto shmemerror; - } - Shminfo[idx].shmid=shmget( IPC_PRIVATE, - myximage[idx]->bytes_per_line * myximage[idx]->height , - IPC_CREAT | 0777 ); - if ( Shminfo[idx].shmid < 0 ) - { - XDestroyImage( myximage[idx] ); - MSG_V( "%s\n",strerror( errno ) ); - MSG_V( "Shared memory error,disabling ( seg id error )\n" ); - goto shmemerror; - } - Shminfo[idx].shmaddr=( char * ) shmat( Shminfo[idx].shmid,0,0 ); - - if ( Shminfo[idx].shmaddr == ( ( char * ) -1 ) ) - { - XDestroyImage( myximage[idx] ); - if ( Shminfo[idx].shmaddr != ( ( char * ) -1 ) ) shmdt( Shminfo[idx].shmaddr ); - MSG_V( "Shared memory error,disabling ( address error )\n" ); - goto shmemerror; - } - myximage[idx]->data=Shminfo[idx].shmaddr; - Shminfo[idx].readOnly=False; - XShmAttach( mDisplay,&Shminfo[idx] ); - - XSync( mDisplay,False ); - - if ( gXErrorFlag ) - { - XDestroyImage( myximage[idx] ); - shmdt( Shminfo[idx].shmaddr ); - MSG_V( "Shared memory error,disabling.\n" ); - gXErrorFlag=0; - goto shmemerror; - } - else - shmctl( Shminfo[idx].shmid,IPC_RMID,0 ); - - { - static int firstTime=1; - if (firstTime){ - MSG_V( "Sharing memory.\n" ); - firstTime=0; - } - } - } - else - { - shmemerror: - Shmem_Flag=0; -#endif - myximage[idx]=XGetImage( mDisplay,vo_window,0,0, - image_width,image_height,AllPlanes,ZPixmap ); -#ifdef HAVE_SHM - } -#endif -} - -static void __FASTCALL__ freeMyXImage(unsigned idx) -{ -#ifdef HAVE_SHM - if ( Shmem_Flag ) - { - XShmDetach( mDisplay,&Shminfo[idx] ); - XDestroyImage( myximage[idx] ); - shmdt( Shminfo[idx].shmaddr ); - } - else -#endif - { - XDestroyImage( myximage[idx] ); - } - myximage[idx]=NULL; -} - - static uint32_t __FASTCALL__ check_events(int (* __FASTCALL__ adjust_size)(unsigned cw,unsigned ch,unsigned *w,unsigned *h)) { uint32_t ret = vo_x11_check_events(mDisplay,adjust_size); @@ -214,8 +108,8 @@ if(enable_xp) LOCK_VDECODING(); for(idx=0;idx<num_buffers;idx++) { - freeMyXImage(idx); - getMyXImage(idx); + vo_x11_freeMyXImage(idx); + vo_x11_getMyXImage(idx,vinfo.visual,depth,image_width,image_height,1); } } return ret; @@ -317,7 +211,7 @@ xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa ); vo_x11_classhint( mDisplay,vo_window,"x11" ); - vo_hidecursor(mDisplay,vo_window); + vo_x11_hidecursor(mDisplay,vo_window); if ( fullscreen ) vo_x11_decoration( mDisplay,vo_window,0 ); XSelectInput( mDisplay,vo_window,StructureNotifyMask ); XSetStandardProperties( mDisplay,vo_window,title,title,None,NULL,0,&hint ); @@ -347,9 +241,9 @@ XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); } #endif - for(i=0;i<num_buffers;i++) getMyXImage(i); + for(i=0;i<num_buffers;i++) vo_x11_getMyXImage(i,vinfo.visual,depth,image_width,image_height,1); - switch ((bpp=myximage[0]->bits_per_pixel)){ + switch ((bpp=vo_x11_myximage[0]->bits_per_pixel)){ case 24: out_format= IMGFMT_BGR24; break; case 32: out_format= IMGFMT_BGR32; break; case 15: out_format= IMGFMT_BGR15; break; @@ -358,14 +252,14 @@ } /* If we have blue in the lowest bit then obviously RGB */ - mode=( ( myximage[0]->blue_mask & 0x01 ) != 0 ) ? MODE_RGB : MODE_BGR; + mode=( ( vo_x11_myximage[0]->blue_mask & 0x01 ) != 0 ) ? MODE_RGB : MODE_BGR; #ifdef WORDS_BIGENDIAN - if ( myximage[0]->byte_order != MSBFirst ) + if ( vo_x11_myximage[0]->byte_order != MSBFirst ) #else - if ( myximage[0]->byte_order != LSBFirst ) + if ( vo_x11_myximage[0]->byte_order != LSBFirst ) #endif { - mode=( ( myximage[0]->blue_mask & 0x01 ) != 0 ) ? MODE_BGR : MODE_RGB; + mode=( ( vo_x11_myximage[0]->blue_mask & 0x01 ) != 0 ) ? MODE_BGR : MODE_RGB; } #ifdef WORDS_BIGENDIAN @@ -382,7 +276,7 @@ MSG_ERR("BGR not supported, please contact the developers\n"); return -1; } -#endif +#endif saver_off(mDisplay); return 0; } @@ -394,7 +288,7 @@ { #ifdef DISP #ifdef HAVE_SHM - if ( Shmem_Flag ) + if ( vo_x11_Shmem_Flag ) { XShmPutImage( mDisplay,vo_window,vo_gc,myximage, 0,0, @@ -412,8 +306,8 @@ #endif } -static void __FASTCALL__ flip_page( unsigned idx ){ - Display_Image( myximage[idx] ); +static void __FASTCALL__ change_frame( unsigned idx ){ + Display_Image( vo_x11_myximage[idx] ); if (num_buffers>1) XFlush(mDisplay); else XSync(mDisplay, False); return; @@ -440,7 +334,7 @@ static void uninit(void) { unsigned i; - for(i=0;i<num_buffers;i++) freeMyXImage(i); + for(i=0;i<num_buffers;i++) vo_x11_freeMyXImage(i); saver_on(mDisplay); // screen saver back on #ifdef HAVE_XF86VM @@ -489,7 +383,7 @@ static void __FASTCALL__ x11_dri_get_surface(dri_surface_t *surf) { - surf->planes[0] = ImageData(surf->idx); + surf->planes[0] = vo_x11_ImageData(surf->idx); surf->planes[1] = 0; surf->planes[2] = 0; surf->planes[3] = 0; Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_xv.c 2010-01-05 14:26:28 UTC (rev 75) @@ -369,7 +369,7 @@ 0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa); vo_x11_classhint( mDisplay,vo_window,"xv" ); - vo_hidecursor(mDisplay,vo_window); + vo_x11_hidecursor(mDisplay,vo_window); XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | ((WinID==0) ? 0 : (PointerMotionMask @@ -557,7 +557,7 @@ return e|VO_EVENT_FORCE_UPDATE; } -static void __FASTCALL__ flip_page(unsigned idx) +static void __FASTCALL__ change_frame(unsigned idx) { expose_idx=idx; XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[idx], Modified: mplayerxp/libvo/vo_xvidix.c =================================================================== --- mplayerxp/libvo/vo_xvidix.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vo_xvidix.c 2010-01-05 14:26:28 UTC (rev 75) @@ -301,7 +301,7 @@ vinfo.depth, InputOutput, vinfo.visual, xswamask, &xswa); vo_x11_classhint(mDisplay, vo_window, "xvidix"); - vo_hidecursor(mDisplay, vo_window); + vo_x11_hidecursor(mDisplay, vo_window); #ifdef X11_FULLSCREEN if (vo_fs) /* fullscreen */ @@ -382,12 +382,12 @@ return event; } -/* flip_page should be overwritten with vidix functions (vosub_vidix.c) */ +/* change_frame should be overwritten with vidix functions (vosub_vidix.c) */ -static void __FASTCALL__ flip_page(unsigned idx) +static void __FASTCALL__ change_frame(unsigned idx) { UNUSED(idx); - MSG_FATAL( "[xvidix] error: didn't used vidix flip_page!\n"); + MSG_FATAL( "[xvidix] error: didn't used vidix change_frame!\n"); return; } Modified: mplayerxp/libvo/vosub_vidix.c =================================================================== --- mplayerxp/libvo/vosub_vidix.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vosub_vidix.c 2010-01-05 14:26:28 UTC (rev 75) @@ -199,9 +199,9 @@ } } -void __FASTCALL__ vidix_flip_page(unsigned idx) +void __FASTCALL__ vidix_change_frame(unsigned idx) { - MSG_DBG2("vidix_flip_page() was called\n"); + MSG_DBG2("vidix_change_frame() was called\n"); if(vo_use_bm == 1) vidix_copy_dma(idx,0); else vdlPlaybackFrameSelect(vidix_handler,idx); } @@ -627,10 +627,10 @@ case DRI_GET_SURFACE_CAPS: vidix_dri_get_surface_caps(data); return VO_TRUE; - case DRI_GET_SURFACE: + case DRI_GET_SURFACE: vidix_dri_get_surface(data); return VO_TRUE; - case VOCTRL_FLUSH_FRAME: + case VOCTRL_FLUSH_PAGES: if(vo_use_bm > 1) vidix_copy_dma(*(uint32_t *)data,1); return VO_TRUE; case VOCTRL_GET_EQUALIZER: @@ -672,7 +672,7 @@ else MSG_V("Driver capability: %X\n",vidix_cap->flags); MSG_V("Using: %s by %s\n",vidix_cap->name,vidix_cap->author); /* we are able to tune up this stuff depend on fourcc format */ - ((vo_functions_t *)server)->flip_page=vidix_flip_page; + ((vo_functions_t *)server)->change_frame=vidix_change_frame; if(!reent) { server_control = ((vo_functions_t *)server)->control; Modified: mplayerxp/libvo/vosub_vidix.h =================================================================== --- mplayerxp/libvo/vosub_vidix.h 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/vosub_vidix.h 2010-01-05 14:26:28 UTC (rev 75) @@ -22,7 +22,7 @@ int vidix_stop(void); void vidix_term( void ); uint32_t __FASTCALL__ vidix_query_fourcc(vo_query_fourcc_t* fourcc); -void __FASTCALL__ vidix_flip_page(unsigned idx); +void __FASTCALL__ vidix_change_frame(unsigned idx); #include <vidix/vidix.h> /* graphic keys */ Modified: mplayerxp/libvo/x11_common.c =================================================================== --- mplayerxp/libvo/x11_common.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/x11_common.c 2010-01-05 14:26:28 UTC (rev 75) @@ -1,4 +1,4 @@ - +#include <errno.h> #include <stdio.h> #include <stdlib.h> @@ -64,13 +64,118 @@ XF86VidModeModeLine modeline; #endif -void __FASTCALL__ vo_hidecursor ( Display *disp , Window win ) +#ifdef HAVE_SHM +#include <sys/ipc.h> +#include <sys/shm.h> +#include <X11/extensions/XShm.h> + +int vo_x11_Shmem_Flag=0; +static XShmSegmentInfo Shminfo[MAX_DRI_BUFFERS]; +static int gXErrorFlag; +static int CompletionType=-1; + +/* since it doesn't seem to be defined on some platforms */ +extern int XShmGetEventBase( Display* ); +#endif + +XImage *vo_x11_myximage[MAX_DRI_BUFFERS]; + +void __FASTCALL__ vo_x11_getMyXImage(unsigned idx,Visual *visual,unsigned depth,unsigned w,unsigned h,int use_shmem) { +#ifdef HAVE_SHM + if ( mLocalDisplay && XShmQueryExtension( mDisplay )&& use_shmem ) vo_x11_Shmem_Flag=1; + else { + vo_x11_Shmem_Flag=0; + if(use_shmem) MSG_V( "Shared memory not supported\nReverting to normal Xlib\n" ); + } + if ( vo_x11_Shmem_Flag ) CompletionType=XShmGetEventBase( mDisplay ) + ShmCompletion; + if ( vo_x11_Shmem_Flag ) { + vo_x11_myximage[idx]=XShmCreateImage( mDisplay,visual,depth,ZPixmap,NULL,&Shminfo[idx],w,h); + if ( vo_x11_myximage[idx] == NULL ) { + if ( vo_x11_myximage[idx] != NULL ) XDestroyImage( vo_x11_myximage[idx] ); + MSG_V( "Shared memory error,disabling ( Ximage error )\n" ); + goto shmemerror; + } + Shminfo[idx].shmid=shmget( IPC_PRIVATE, + vo_x11_myximage[idx]->bytes_per_line * vo_x11_myximage[idx]->height , + IPC_CREAT | 0777 ); + if ( Shminfo[idx].shmid < 0 ) { + XDestroyImage( vo_x11_myximage[idx] ); + MSG_V( "%s\n",strerror( errno ) ); + MSG_V( "Shared memory error,disabling ( seg id error )\n" ); + goto shmemerror; + } + Shminfo[idx].shmaddr=( char * ) shmat( Shminfo[idx].shmid,0,0 ); + + if ( Shminfo[idx].shmaddr == ( ( char * ) -1 ) ) + { + XDestroyImage( vo_x11_myximage[idx] ); + if ( Shminfo[idx].shmaddr != ( ( char * ) -1 ) ) shmdt( Shminfo[idx].shmaddr ); + MSG_V( "Shared memory error,disabling ( address error )\n" ); + goto shmemerror; + } + vo_x11_myximage[idx]->data=Shminfo[idx].shmaddr; + Shminfo[idx].readOnly=False; + XShmAttach( mDisplay,&Shminfo[idx] ); + + XSync( mDisplay,False ); + + if ( gXErrorFlag ) + { + XDestroyImage( vo_x11_myximage[idx] ); + shmdt( Shminfo[idx].shmaddr ); + MSG_V( "Shared memory error,disabling.\n" ); + gXErrorFlag=0; + goto shmemerror; + } + else + shmctl( Shminfo[idx].shmid,IPC_RMID,0 ); + + { + static int firstTime=1; + if (firstTime){ + MSG_V( "Sharing memory.\n" ); + firstTime=0; + } + } + } + else + { + shmemerror: + vo_x11_Shmem_Flag=0; +#endif + vo_x11_myximage[idx]=XGetImage( mDisplay,vo_window,0,0, + w,h,AllPlanes,ZPixmap ); +#ifdef HAVE_SHM + } +#endif +} + +void __FASTCALL__ vo_x11_freeMyXImage(unsigned idx) +{ +#ifdef HAVE_SHM + if ( vo_x11_Shmem_Flag ) + { + XShmDetach( mDisplay,&Shminfo[idx] ); + XDestroyImage( vo_x11_myximage[idx] ); + shmdt( Shminfo[idx].shmaddr ); + } + else +#endif + { + XDestroyImage( vo_x11_myximage[idx] ); + } + vo_x11_myximage[idx]=NULL; +} + + +void __FASTCALL__ vo_x11_hidecursor ( Display *disp , Window win ) +{ Cursor no_ptr; Pixmap bm_no; XColor black,dummy; Colormap colormap; - static unsigned char bm_no_data[] = { 0,0,0,0, 0,0,0,0 }; + static char bm_no_data[] = { 0,0,0,0, 0,0,0,0 }; if(WinID==0) return; // do not hide, if we're playing at rootwin @@ -596,9 +701,9 @@ vo_dheight=nh; { Window root; - int foo; + unsigned foo; Window win; - XGetGeometry(mydisplay, vo_window, &root, &foo, &foo, + XGetGeometry(mydisplay, vo_window, &root, &foo, &foo, &foo/*width*/, &foo/*height*/, &foo, &foo); XTranslateCoordinates(mydisplay, vo_window, root, 0, 0, &vo_dx, &vo_dy, &win); @@ -780,12 +885,12 @@ #ifdef HAVE_XF86VM void __FASTCALL__ vo_vm_switch(uint32_t X, uint32_t Y, int* modeline_width, int* modeline_height) { - unsigned int vm_event, vm_error; - unsigned int vm_ver, vm_rev; + int vm_event, vm_error; + int vm_ver, vm_rev; int i,j,have_vm=0; int modecount; - + if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error)) { XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev); MSG_V("XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev); @@ -799,7 +904,7 @@ j=0; *modeline_width=vidmodes[0]->hdisplay; *modeline_height=vidmodes[0]->vdisplay; - + for (i=1; i<modecount; i++) if ((vidmodes[i]->hdisplay >= X) && (vidmodes[i]->vdisplay >= Y)) if ( (vidmodes[i]->hdisplay <= *modeline_width ) && (vidmodes[i]->vdisplay <= *modeline_height) ) @@ -808,7 +913,7 @@ *modeline_height=vidmodes[i]->vdisplay; j=i; } - + MSG_V("XF86VM: Selected video mode %dx%d for image size %dx%d.\n",*modeline_width, *modeline_height, X, Y); XF86VidModeLockModeSwitch(mDisplay,mScreen,0); XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]); Modified: mplayerxp/libvo/x11_common.h =================================================================== --- mplayerxp/libvo/x11_common.h 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/libvo/x11_common.h 2010-01-05 14:26:28 UTC (rev 75) @@ -6,6 +6,7 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> +#include "dri_vo.h" extern int vo_fs; @@ -15,9 +16,15 @@ extern int mScreen; extern int mLocalDisplay; extern int WinID; +extern XImage *vo_x11_myximage[MAX_DRI_BUFFERS]; +extern int vo_x11_Shmem_Flag; int vo_x11_init( void ); -void __FASTCALL__ vo_hidecursor ( Display* , Window ); +/* local data */ +#define vo_x11_ImageData(idx) ( uint8_t * ) vo_x11_myximage[idx]->data +void __FASTCALL__ vo_x11_getMyXImage(unsigned idx,Visual *visual,unsigned depth,unsigned w,unsigned h,int use_shmem); +void __FASTCALL__ vo_x11_freeMyXImage(unsigned idx); +void __FASTCALL__ vo_x11_hidecursor ( Display* , Window ); void __FASTCALL__ vo_x11_decoration( Display * vo_Display,Window w,int d ); void __FASTCALL__ vo_x11_classhint( Display * display,Window window,char *name ); int __FASTCALL__ vo_x11_uninit(Display *display, Window window); Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/mplayer.c 2010-01-05 14:26:28 UTC (rev 75) @@ -1376,7 +1376,7 @@ //====================== FLIP PAGE (VIDEO BLT): ========================= - pinfo[xp_id].current_module="flip_page1"; + pinfo[xp_id].current_module="change_frame1"; vo_check_events(); /* check events AST */ if(blit_frame && !frame_time_remaining){ @@ -1393,14 +1393,14 @@ vstat->too_slow_frame_cnt++; /* printf ("PANIC: too slow frame (%.3f)!\n", j); */ - vo_flip_page(); + vo_change_frame(); // usec_sleep(50000); // test only! t2=GetTimer()-t2; tt = t2*0.000001f; vout_time_usage+=tt; if(benchmark) { - /* we need compute draw_slice+flip_page here */ + /* we need compute draw_slice+change_frame here */ cur_vout_time_usage+=tt; if(cur_vout_time_usage > max_vout_time_usage) max_vout_time_usage = cur_vout_time_usage; if(cur_vout_time_usage < min_vout_time_usage) min_vout_time_usage = cur_vout_time_usage; @@ -1623,7 +1623,7 @@ pinfo[xp_id].current_module="sleep_usleep"; time_frame=SleepTime(rtc_fd,softsleep,time_frame); } - pinfo[xp_id].current_module="flip_page2"; + pinfo[xp_id].current_module="change_frame2"; vo_check_events(); /* don't flip if there is nothing new to display */ if(!blit_frame) @@ -1650,7 +1650,7 @@ { unsigned int t2=GetTimer(); double tt; - vo_flip_page(); + vo_change_frame(); MSG_D("\ndec_ahead_main: schedule %u on screen (abs_active: %u loc_active: %u abs_blitted %u)\n",dec_ahead_active_frame,abs_dec_ahead_active_frame,loc_dec_ahead_active_frame,ada_blitted_frame); LOCK_VDEC_ACTIVE(); dec_ahead_active_frame=(dec_ahead_active_frame+1)%xp_num_frames; @@ -1668,7 +1668,7 @@ vout_time_usage+=tt; if(benchmark) { - /* we need compute draw_slice+flip_page here */ + /* we need compute draw_slice+change_frame here */ cur_vout_time_usage+=tt; if((cur_video_time_usage + cur_vout_time_usage + cur_audio_time_usage)*vo_fps > 1) bench_dropped_frames ++; Modified: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/postproc/vf.h 2010-01-05 14:26:28 UTC (rev 75) @@ -76,16 +76,16 @@ int value; } vf_equalizer_t; -#define VFCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */ -#define VFCTRL_SET_PP_LEVEL 5 /* set postprocessing level */ -#define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */ -#define VFCTRL_GET_EQUALIZER 8 /* gset color options (brightness,contrast etc) */ -#define VFCTRL_START_FRAME 7 -#define VFCTRL_CHANGE_RECTANGLE 9 /* Change the rectangle boundaries */ -#define VFCTRL_FLIP_PAGE 10 /* Tell the vo to flip pages */ -#define VFCTRL_DUPLICATE_FRAME 11 /* For encoding - encode zero-change frame */ -#define VFCTRL_SKIP_NEXT_FRAME 12 /* For encoding - drop the next frame that passes thru */ -#define VFCTRL_FLUSH_FRAMES 13 /* For encoding - flush delayed frames */ +#define VFCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */ +#define VFCTRL_SET_PP_LEVEL 5 /* set postprocessing level */ +#define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */ +#define VFCTRL_GET_EQUALIZER 8 /* gset color options (brightness,contrast etc) */ +#define VFCTRL_START_FRAME 7 +#define VFCTRL_CHANGE_RECTANGLE 9 /* Change the rectangle boundaries */ +#define VFCTRL_CHANGE_FRAME 10 /* Tell the vo to flip pages */ +#define VFCTRL_DUPLICATE_FRAME 11 /* For encoding - encode zero-change frame */ +#define VFCTRL_SKIP_NEXT_FRAME 12 /* For encoding - drop the next frame that passes thru */ +#define VFCTRL_FLUSH_PAGES 13 /* For encoding - flush delayed frames */ #include "vfcap.h" Modified: mplayerxp/postproc/vf_vo.c =================================================================== --- mplayerxp/postproc/vf_vo.c 2010-01-05 12:04:25 UTC (rev 74) +++ mplayerxp/postproc/vf_vo.c 2010-01-05 14:26:28 UTC (rev 75) @@ -73,10 +73,10 @@ static int __FASTCALL__ control(struct vf_instance_s* vf, int request, void* data) { switch(request){ - case VFCTRL_FLIP_PAGE: + case VFCTRL_CHANGE_FRAME: { if(!vo_config_count) return CONTROL_FALSE; // vo not configured? - vo_flip_page(); + vo_change_frame(); return CONTROL_TRUE; } case VFCTRL_SET_EQUALIZER: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2010-01-09 16:01:53
|
Revision: 93 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=93&view=rev Author: nickols_k Date: 2010-01-09 16:01:47 +0000 (Sat, 09 Jan 2010) Log Message: ----------- code cleanups and bugfixes Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.c mplayerxp/mp_image.c mplayerxp/mp_image.h mplayerxp/postproc/vf_2xsai.c mplayerxp/postproc/vf_format.c mplayerxp/postproc/vf_il.c mplayerxp/postproc/vf_palette.c mplayerxp/postproc/vf_perspective.c mplayerxp/postproc/vf_rgb2bgr.c mplayerxp/postproc/vf_yuvcsp.c Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/libmpcodecs/dec_video.c 2010-01-09 16:01:47 UTC (rev 93) @@ -169,11 +169,8 @@ smp_num_cpus=omp_get_num_procs(); vf_flags=vf_query_flags(sh_video->vfilter); use_vf_threads=0; - MSG_V("[mpdec] vf_flags=%08X num_cpus=%u\n",vf_flags,smp_num_cpus); - if(((vf_flags&MPDEC_THREAD_COND)==MPDEC_THREAD_COND) && (smp_num_cpus>1)) { - MSG_OK("[VC] using %u threads for video filters\n",smp_num_cpus); - use_vf_threads=1; - } + MSG_DBG2("[mpdec] vf_flags=%08X num_cpus=%u\n",vf_flags,smp_num_cpus); + if(((vf_flags&MPDEC_THREAD_COND)==MPDEC_THREAD_COND) && (smp_num_cpus>1)) use_vf_threads=1; } #else MSG_V("[mpdec] GOMP was not compiled-in! Using single threaded video filtering!\n"); @@ -225,6 +222,11 @@ if(use_vf_threads) { unsigned i,y,h_step,h; mp_image_t ampi[smp_num_cpus]; + static int hello_printed=0; + if(!hello_printed) { + MSG_OK("[VC] using %u threads for video filters\n",smp_num_cpus); + hello_printed=1; + } h_step = mpi->h/smp_num_cpus; h=mpi->height; mpi->height=h_step; @@ -232,12 +234,13 @@ for(i=0;i<smp_num_cpus;i++) { ampi[i] = *mpi; ampi[i].y = y; - ampi[i].height = h_step+y; + ampi[i].height = h_step; + ampi[i].chroma_height = h_step >> mpi->chroma_y_shift; y+=h_step; } #pragma omp parallel for shared(vf) private(i) for(i=0;i<smp_num_cpus;i++) { - MSG_V("Put slice[%u %u] in threads\n",ampi[i].y,h_step); + MSG_DBG2("Put slice[%u %u] in threads\n",ampi[i].y,h_step); vf->put_slice(vf,&i[i]); } if(y<h) { Modified: mplayerxp/mp_image.c =================================================================== --- mplayerxp/mp_image.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/mp_image.c 2010-01-09 16:01:47 UTC (rev 93) @@ -199,14 +199,28 @@ void copy_mpi(mp_image_t *dmpi,const mp_image_t *mpi) { if(mpi->flags&MP_IMGFLAG_PLANAR){ memcpy_pic(dmpi->planes[0],mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0],mpi->stride[0]); + dmpi->stride[0],mpi->stride[0]); memcpy_pic(dmpi->planes[1],mpi->planes[1], mpi->chroma_width, mpi->chroma_height, - dmpi->stride[1],mpi->stride[1]); + dmpi->stride[1],mpi->stride[1]); memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->chroma_width, mpi->chroma_height, - dmpi->stride[2],mpi->stride[2]); + dmpi->stride[2],mpi->stride[2]); } else { - memcpy_pic(dmpi->planes[0],mpi->planes[0], - mpi->w*(dmpi->bpp/8), mpi->h, - dmpi->stride[0],mpi->stride[0]); + memcpy_pic(dmpi->planes[0],mpi->planes[0], + mpi->w*(dmpi->bpp/8), mpi->h, + dmpi->stride[0],mpi->stride[0]); } } + +void mpi_fake_slice(mp_image_t *dmpi,const mp_image_t *mpi,unsigned y,unsigned height) +{ + unsigned uv_off = (y>>mpi->chroma_y_shift); + *dmpi = *mpi; + dmpi->planes[0] = mpi->planes[0] + (mpi->stride[0]*y); + dmpi->planes[1] = mpi->planes[1] + (mpi->stride[1]*uv_off); + dmpi->planes[2] = mpi->planes[2] + (mpi->stride[2]*uv_off); + dmpi->planes[3] = mpi->planes[3] + (mpi->stride[3]*uv_off); + dmpi->qscale = mpi->qscale + (mpi->qstride*y); + dmpi->y = 0; + dmpi->h = height; + dmpi->chroma_height = (height >> mpi->chroma_y_shift); +} Modified: mplayerxp/mp_image.h =================================================================== --- mplayerxp/mp_image.h 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/mp_image.h 2010-01-09 16:01:47 UTC (rev 93) @@ -106,5 +106,6 @@ extern void free_mp_image(mp_image_t* mpi); extern mp_image_t* alloc_mpi(int w, int h, unsigned int fmt); extern void copy_mpi(mp_image_t *dmpi,const mp_image_t *mpi); +extern void mpi_fake_slice(mp_image_t *dmpi,const mp_image_t *mpi,unsigned y,unsigned height); #endif Modified: mplayerxp/postproc/vf_2xsai.c =================================================================== --- mplayerxp/postproc/vf_2xsai.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/postproc/vf_2xsai.c 2010-01-09 16:01:47 UTC (rev 93) @@ -35,7 +35,7 @@ // if (d != 15 && d != 16 && d != 24 && d != 32) // return -1; - /* Get lowest color bit */ + /* Get lowest color bit */ for (i = 0; i < 255; i++) { if (!minr) minr = makecol(i, 0, 0); @@ -65,7 +65,7 @@ // TRACE("Low Pixel Mask: 0x%lX\n", lowPixelMask); // TRACE("QColor Mask: 0x%lX\n", qcolorMask); // TRACE("QLow Pixel Mask: 0x%lX\n", qlowpixelMask); - + xsai_depth = d; return 0; @@ -83,12 +83,12 @@ static unsigned char *src_line[4]; static unsigned char *dst_line[2]; -void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, +void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, uint8_t *dst, uint32_t dst_pitch, uint32_t stx, uint32_t sty, uint32_t width, uint32_t height) { - unsigned int x, y; + unsigned int i,j,x, y; uint32_t color[16]; /* Point to the first 3 lines. */ @@ -123,15 +123,15 @@ #ifdef _OPENMP #pragma omp parallel for #endif - for (y = sty; y < height; y++) { - + for (j = 0; j < height; j++) { + y = j+sty; dst_line[0] = dst + dst_pitch*2*y; dst_line[1] = dst + dst_pitch*(2*y+1); - + /* Todo: x = width - 2, x = width - 1 */ - - for (x = stx; x < width; x++) { + for (i = 0; i < width; x++) { uint32_t product1a, product1b, product2a, product2b; + x = i+stx; //--------------------------------------- B0 B1 B2 B3 0 1 2 3 // 4 5* 6 S2 -> 4 5* 6 7 @@ -160,7 +160,6 @@ product1b = color[5]; else product1b = INTERPOLATE(color[5], color[6]); - product2b = product1b; } @@ -193,7 +192,7 @@ product1a = INTERPOLATE(color[9], color[5]); else product1a = color[5]; - + if (PixelsPerMask == 2) { *((uint32_t *) (&dst_line[0][x * 4])) = product1a | (product1b << 16); *((uint32_t *) (&dst_line[1][x * 4])) = product2a | (product2b << 16); @@ -204,16 +203,16 @@ *((uint32_t *) (&dst_line[1][x * 8])) = product2a; *((uint32_t *) (&dst_line[1][x * 8 + 4])) = product2b; } - + /* Move color matrix forward */ color[0] = color[1]; color[4] = color[5]; color[8] = color[9]; color[12] = color[13]; color[1] = color[2]; color[5] = color[6]; color[9] = color[10]; color[13] = color[14]; color[2] = color[3]; color[6] = color[7]; color[10] = color[11]; color[14] = color[15]; - + if (x < width - 3) { x += 3; if (PixelsPerMask == 2) { - color[3] = *(((unsigned short*)src_line[0]) + x); + color[3] = *(((unsigned short*)src_line[0]) + x); color[7] = *(((unsigned short*)src_line[1]) + x); color[11] = *(((unsigned short*)src_line[2]) + x); color[15] = *(((unsigned short*)src_line[3]) + x); @@ -231,14 +230,14 @@ /* We're done with one line, so we shift the source lines up */ src_line[0] = src_line[1]; src_line[1] = src_line[2]; - src_line[2] = src_line[3]; + src_line[2] = src_line[3]; /* Read next line */ if (y + 3 >= height) src_line[3] = src_line[2]; else src_line[3] = src_line[2] + src_pitch; - + /* Then shift the color matrix up */ if (PixelsPerMask == 2) { unsigned short *sbp; @@ -262,9 +261,9 @@ lbp = (uint32_t*)src_line[3]; color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2); } - + } // y loop - + } Modified: mplayerxp/postproc/vf_format.c =================================================================== --- mplayerxp/postproc/vf_format.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/postproc/vf_format.c 2010-01-09 16:01:47 UTC (rev 93) @@ -109,7 +109,7 @@ "format", "Nickols_K", "FIXME! get_image()/put_image()", - VF_FLAGS_THREADS, + VF_FLAGS_THREADS|VF_FLAGS_SLICES, vf_open }; Modified: mplayerxp/postproc/vf_il.c =================================================================== --- mplayerxp/postproc/vf_il.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/postproc/vf_il.c 2010-01-09 16:01:47 UTC (rev 93) @@ -103,7 +103,7 @@ interleave(dmpi->planes[2], mpi->planes[2], cw,ch, dmpi->stride[2], mpi->stride[2], chroma->interleave, luma->swap); } - + return vf_next_put_slice(vf,dmpi); } Modified: mplayerxp/postproc/vf_palette.c =================================================================== --- mplayerxp/postproc/vf_palette.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/postproc/vf_palette.c 2010-01-09 16:01:47 UTC (rev 93) @@ -75,7 +75,7 @@ static int __FASTCALL__ put_slice(struct vf_instance_s* vf, mp_image_t *mpi){ mp_image_t *dmpi; - + // hope we'll get DR buffer: dmpi=vf_get_image(vf->next,vf->priv->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, @@ -151,7 +151,7 @@ } } } - + return vf_next_put_slice(vf,dmpi); } Modified: mplayerxp/postproc/vf_perspective.c =================================================================== --- mplayerxp/postproc/vf_perspective.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/postproc/vf_perspective.c 2010-01-09 16:01:47 UTC (rev 93) @@ -219,7 +219,7 @@ index= u + v*srcStride; subUI= SUB_PIXELS - subU; subVI= SUB_PIXELS - subV; - + if((unsigned)u < (unsigned)(w - 1)){ if((unsigned)v < (unsigned)(h - 1)){ sum= subVI*(subUI*src[index ] + subU*src[index +1]) Modified: mplayerxp/postproc/vf_rgb2bgr.c =================================================================== --- mplayerxp/postproc/vf_rgb2bgr.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/postproc/vf_rgb2bgr.c 2010-01-09 16:01:47 UTC (rev 93) @@ -34,7 +34,7 @@ case IMGFMT_BGR24: return IMGFMT_RGB24; case IMGFMT_BGR32: return IMGFMT_RGB32; } - return 0; + return 0; } static int __FASTCALL__ config(struct vf_instance_s* vf, Modified: mplayerxp/postproc/vf_yuvcsp.c =================================================================== --- mplayerxp/postproc/vf_yuvcsp.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/postproc/vf_yuvcsp.c 2010-01-09 16:01:47 UTC (rev 93) @@ -31,7 +31,7 @@ } static int __FASTCALL__ put_slice(struct vf_instance_s* vf, mp_image_t *mpi){ - int i,j; + unsigned i,j,y,x; uint8_t *y_in, *cb_in, *cr_in; uint8_t *y_out, *cb_out, *cr_out; @@ -47,15 +47,19 @@ cb_out = vf->dmpi->planes[1]; cr_out = vf->dmpi->planes[2]; - for (i = mpi->y; i < mpi->height; i++) - for (j = mpi->x; j < mpi->width; j++) - y_out[i*vf->dmpi->stride[0]+j] = clamp_y(y_in[i*mpi->stride[0]+j]); - - for (i = (mpi->y)>>(mpi->chroma_y_shift); i < mpi->chroma_height; i++) + for (i = 0; i < mpi->height; i++) + for (j = mpi->x; j < mpi->width; j++) { + y = i+mpi->y; + x = j+mpi->x; + y_out[y*vf->dmpi->stride[0]+x] = clamp_y(y_in[y*mpi->stride[0]+x]); + } + for (i = 0; i < mpi->chroma_height; i++) for (j = (mpi->x)>>(mpi->chroma_x_shift); j < mpi->chroma_width; j++) { - cb_out[i*vf->dmpi->stride[1]+j] = clamp_c(cb_in[i*mpi->stride[1]+j]); - cr_out[i*vf->dmpi->stride[2]+j] = clamp_c(cr_in[i*mpi->stride[2]+j]); + y=i+(mpi->y>>mpi->chroma_y_shift); + x=j+(mpi->y>>mpi->chroma_x_shift); + cb_out[y*vf->dmpi->stride[1]+x] = clamp_c(cb_in[y*mpi->stride[1]+x]); + cr_out[y*vf->dmpi->stride[2]+x] = clamp_c(cr_in[y*mpi->stride[2]+x]); } return vf_next_put_slice(vf,vf->dmpi); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2010-01-16 15:33:13
|
Revision: 103 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=103&view=rev Author: nickols_k Date: 2010-01-16 15:33:05 +0000 (Sat, 16 Jan 2010) Log Message: ----------- fixes Modified Paths: -------------- mplayerxp/dec_ahead.c mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpdemux/stheader.h mplayerxp/libvo/osd_template.c mplayerxp/libvo/sub.c mplayerxp/libvo/video_out.c mplayerxp/libvo/vo_null.c mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/x11_common.c mplayerxp/mplayer.c Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2010-01-15 18:37:16 UTC (rev 102) +++ mplayerxp/dec_ahead.c 2010-01-16 15:33:05 UTC (rev 103) @@ -622,7 +622,7 @@ int asize; unsigned o_bps; unsigned min_reserv; - o_bps=sh_audio->afilter_inited?sh_audio->f_bps:sh_audio->o_bps; + o_bps=sh_audio->afilter_inited?sh_audio->af_bps:sh_audio->o_bps; if(has_xp_video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_num_frames/vo_fps))+MIN_BUFFER_RESERV; else asize = o_bps*ao_da_buffs; /* FIXME: get better indices from asize/real_audio_packet_size */ @@ -791,7 +791,7 @@ if(has_xp_video) { /* Match video buffer */ vbuf_size = abs_dec_ahead_locked_frame - abs_dec_ahead_active_frame; - pref_buf = vbuf_size / vo_fps * sh_audio->f_bps; + pref_buf = vbuf_size / vo_fps * sh_audio->af_bps; pref_buf -= len; if( pref_buf > 0 ) { len = min( pref_buf, free_buf ); @@ -817,7 +817,7 @@ struct timespec timeout; float d; int retval; - const float MAX_AUDIO_TIME = (float)ao_get_space() / sh_audio->f_bps + ao_get_delay(); + const float MAX_AUDIO_TIME = (float)ao_get_space() / sh_audio->af_bps + ao_get_delay(); float min_audio_time = MAX_AUDIO_TIME; float min_audio, max_audio; int samples, collect_samples; Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2010-01-15 18:37:16 UTC (rev 102) +++ mplayerxp/libmpcodecs/ad_mp3.c 2010-01-16 15:33:05 UTC (rev 103) @@ -179,8 +179,6 @@ }; extern int fakemono; -static sh_audio_t* dec_audio_sh=NULL; - static void (*mpg123_init_ptr)(void); #define mpg123_init() (*mpg123_init_ptr)() static void (*mpg123_exit_ptr)(void); @@ -258,7 +256,6 @@ int err=0,nch,enc; unsigned char *indata; struct mpg123_frameinfo fi; - dec_audio_sh=sh; // save sh_audio for the callback: sh->samplesize=4; sh->sample_format=AFMT_FLOAT32; mpg123_init(); Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2010-01-15 18:37:16 UTC (rev 102) +++ mplayerxp/libmpcodecs/dec_audio.c 2010-01-16 15:33:05 UTC (rev 103) @@ -32,14 +32,11 @@ static const ad_functions_t* mpadec; -static sh_audio_t *dec_audio_sh; - extern int force_srate; extern char *audio_codec; int init_audio(sh_audio_t *sh_audio) { unsigned i; - dec_audio_sh = sh_audio; for (i=0; mpcodecs_ad_drivers[i] != NULL; i++) if(strcmp(mpcodecs_ad_drivers[i]->info->driver_name,sh_audio->codec->driver_name)==0){ mpadec=mpcodecs_ad_drivers[i]; break; @@ -48,14 +45,14 @@ MSG_ERR(MSGTR_CODEC_BAD_AFAMILY,sh_audio->codec->codec_name, sh_audio->codec->driver_name); return 0; // no such driver } - + /* reset in/out buffer size/pointer: */ sh_audio->a_buffer_size=0; sh_audio->a_buffer=NULL; sh_audio->a_in_buffer_size=0; sh_audio->a_in_buffer=NULL; /* Set up some common usefull defaults. ad->preinit() can override these: */ - + sh_audio->samplesize=2; #ifdef WORDS_BIGENDIAN sh_audio->sample_format=AFMT_S16_BE; @@ -69,7 +66,7 @@ sh_audio->audio_out_minsize=8192;/* default size, maybe not enough for Win32/ACM*/ sh_audio->audio_in_minsize=0; - + if(!mpadec->preinit(sh_audio)) { MSG_ERR(MSGTR_CODEC_CANT_PREINITA); @@ -107,7 +104,7 @@ } sh_audio->inited=1; - + if(!sh_audio->channels || !sh_audio->samplerate){ MSG_WARN(MSGTR_UnknownAudio); uninit_audio(sh_audio); /* free buffers */ @@ -160,7 +157,7 @@ } /* Init audio filters */ -int preinit_audio_filters(sh_audio_t *sh_audio, +int preinit_audio_filters(sh_audio_t *sh_audio, int in_samplerate, int in_channels, int in_format, int in_bps, int* out_samplerate, int* out_channels, int* out_format, int out_bps){ char strbuf[200]; @@ -180,28 +177,28 @@ afs->output.format = afs->input.format; afs->output.bps = out_bps ? out_bps : afs->input.bps; } - // filter config: + // filter config: memcpy(&afs->cfg,&af_cfg,sizeof(af_cfg_t)); - + MSG_V("Checking audio filter chain for %dHz/%dch/%dbit...\n", afs->input.rate,afs->input.nch,afs->input.bps*8); - + // let's autoprobe it! if(0 != af_init(afs,0)){ free(afs); return 0; // failed :( } - + *out_samplerate=afs->output.rate; *out_channels=afs->output.nch; *out_format=af_format_encode((void*)(&afs->output)); - sh_audio->f_bps = afs->output.rate*afs->output.nch*afs->output.bps; - + sh_audio->af_bps = afs->output.rate*afs->output.nch*afs->output.bps; + MSG_V("AF_pre: af format: %d bps, %d ch, %d hz, %s\n", afs->output.bps, afs->output.nch, afs->output.rate, fmt2str(afs->output.format,afs->output.bps,strbuf,200)); - + sh_audio->afilter=(void*)afs; return 1; } @@ -226,23 +223,23 @@ // filter config: memcpy(&afs->cfg,&af_cfg,sizeof(af_cfg_t)); - + MSG_V("Building audio filter chain for %dHz/%dch/%dbit (%s) -> %dHz/%dch/%dbit (%s)...\n", afs->input.rate,afs->input.nch,afs->input.bps*8,ao_format_name(af_format_encode(&afs->input)), afs->output.rate,afs->output.nch,afs->output.bps*8,ao_format_name(af_format_encode(&afs->output))); - + // let's autoprobe it! if(0 != af_init(afs,1)){ sh_audio->afilter=NULL; free(afs); return 0; // failed :( } - + // allocate the a_out_* buffers: if(out_maxsize<out_minsize) out_maxsize=out_minsize; if(out_maxsize<8192) out_maxsize=MAX_OUTBURST; // not sure this is ok - sh_audio->f_bps = afs->output.rate*afs->output.nch*afs->output.bps; + sh_audio->af_bps = afs->output.rate*afs->output.nch*afs->output.bps; sh_audio->a_buffer_size=out_maxsize; sh_audio->a_buffer=malloc(sh_audio->a_buffer_size); @@ -282,29 +279,29 @@ if(!sh_audio->inited) return -1; // no codec MSG_DBG3("decode_audio(%p,%p,%i,%i,%i,%p)\n",sh_audio,buf,minlen,maxlen,buflen,pts); - + if(minlen>maxlen) MSG_WARN(MSGTR_CODEC_XP_INT_ERR,minlen,maxlen); - if(sh_audio->f_buffer_len) + if(sh_audio->af_buffer_len) { - cp_size=min(buflen,sh_audio->f_buffer_len); - memcpy(buf,sh_audio->f_buffer,cp_size); - *pts = sh_audio->f_pts; - cp_tile=sh_audio->f_buffer_len-cp_size; - MSG_DBG2("cache->buf %i bytes %f pts <PREDICTED PTS %f>\n",cp_size,*pts,*pts+(float)cp_tile/(float)sh_audio->f_bps); + cp_size=min(buflen,sh_audio->af_buffer_len); + memcpy(buf,sh_audio->af_buffer,cp_size); + *pts = sh_audio->af_pts; + cp_tile=sh_audio->af_buffer_len-cp_size; + MSG_DBG2("cache->buf %i bytes %f pts <PREDICTED PTS %f>\n",cp_size,*pts,*pts+(float)cp_tile/(float)sh_audio->af_bps); if(cp_tile) { - sh_audio->f_buffer=&sh_audio->f_buffer[cp_size]; - sh_audio->f_buffer_len=cp_tile; - sh_audio->f_pts += (float)cp_size/(float)sh_audio->f_bps; + sh_audio->af_buffer=&sh_audio->af_buffer[cp_size]; + sh_audio->af_buffer_len=cp_tile; + sh_audio->af_pts += (float)cp_size/(float)sh_audio->af_bps; } - else sh_audio->f_buffer_len=0; + else sh_audio->af_buffer_len=0; return cp_size; } - if(sh_audio->f_bps>sh_audio->o_bps) - maxlen=min(maxlen,(long long int)buflen*sh_audio->o_bps/sh_audio->f_bps); + if(sh_audio->af_bps>sh_audio->o_bps) + maxlen=min(maxlen,(long long int)buflen*sh_audio->o_bps/sh_audio->af_bps); len=mpadec->decode_audio(sh_audio,buf, minlen, maxlen,pts); if(len>buflen) MSG_WARN(MSGTR_CODEC_BUF_OVERFLOW,sh_audio->codec->driver_name,len,buflen); - MSG_DBG2("decaudio: %i bytes %f pts min %i max %i buflen %i o_bps=%i f_bps=%i\n",len,*pts,minlen,maxlen,buflen,sh_audio->o_bps,sh_audio->f_bps); + MSG_DBG2("decaudio: %i bytes %f pts min %i max %i buflen %i o_bps=%i f_bps=%i\n",len,*pts,minlen,maxlen,buflen,sh_audio->o_bps,sh_audio->af_bps); if(len<=0 || !sh_audio->afilter) return len; // EOF? // run the filters: afd.audio=buf; @@ -330,12 +327,12 @@ cp_tile=pafd->len-cp_size; if(cp_tile) { - sh_audio->f_buffer=&((char *)pafd->audio)[cp_size]; - sh_audio->f_buffer_len=cp_tile; - sh_audio->f_pts = *pts+(float)cp_size/(float)sh_audio->f_bps; + sh_audio->af_buffer=&((char *)pafd->audio)[cp_size]; + sh_audio->af_buffer_len=cp_tile; + sh_audio->af_pts = *pts+(float)cp_size/(float)sh_audio->af_bps; MSG_DBG2("decaudio: afilter->cache %i bytes %f pts\n",cp_tile,*pts); } - else sh_audio->f_buffer_len=0; + else sh_audio->af_buffer_len=0; } return cp_size; } Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2010-01-15 18:37:16 UTC (rev 102) +++ mplayerxp/libmpdemux/stheader.h 2010-01-16 15:33:05 UTC (rev 103) @@ -17,28 +17,28 @@ int inited; // output format: float timer; // value of old a_frame - int samplerate; - int samplesize; - int channels; - int o_bps; // == samplerate*samplesize*channels (uncompr. bytes/sec) - int i_bps; // == bitrate (compressed bytes/sec) + unsigned samplerate; + unsigned samplesize; + unsigned channels; + unsigned o_bps; // == samplerate*samplesize*channels (uncompr. bytes/sec) + unsigned i_bps; // == bitrate (compressed bytes/sec) // in buffers: char* a_in_buffer; int a_in_buffer_len; - int a_in_buffer_size; + unsigned a_in_buffer_size; // out buffers: char* a_buffer; int a_buffer_len; - int a_buffer_size; + unsigned a_buffer_size; - /* filter buffer */ + /* filter buffer */ void * afilter; int afilter_inited; - unsigned f_bps; // == samplerate*samplesize*channels (after filters bytes/sec) - char * f_buffer; - unsigned f_buffer_len; - float f_pts; + unsigned af_bps; // == samplerate*samplesize*channels (after filters bytes/sec) + char * af_buffer; + unsigned af_buffer_len; + float af_pts; int sample_format; float a_pts; @@ -48,12 +48,12 @@ AVIStreamHeader audio; WAVEFORMATEX *wf; // char wf_ext[64]; // in format - int audio_in_minsize; - int audio_out_minsize; + unsigned audio_in_minsize; + unsigned audio_out_minsize; // other codecs: void* context; // codec-specific stuff (usually HANDLE or struct pointer) unsigned char *codecdata; - int codecdata_len; + unsigned codecdata_len; } sh_audio_t; typedef struct { @@ -68,18 +68,18 @@ float fps; float frametime; // 1/fps int chapter_change; - int i_bps; // == bitrate (compressed bytes/sec) - int disp_w,disp_h; // display size (filled by fileformat parser) + unsigned i_bps; // == bitrate (compressed bytes/sec) + unsigned disp_w,disp_h;// display size (filled by fileformat parser) // int coded_w,coded_h; // coded size (filled by video codec) float aspect; unsigned int outfmtidx; - + void *vfilter; int vfilter_inited; // unsigned int bitrate; // buffers: float num_frames; // number of frames played - int num_frames_decoded; // number of frames decoded + int num_frames_decoded; // number of frames decoded mp_image_t *image; // win32 codec stuff: AVIStreamHeader video; Modified: mplayerxp/libvo/osd_template.c =================================================================== --- mplayerxp/libvo/osd_template.c 2010-01-15 18:37:16 UTC (rev 102) +++ mplayerxp/libvo/osd_template.c 2010-01-16 15:33:05 UTC (rev 103) @@ -57,20 +57,27 @@ #endif PROFILE_START(); for(y=0;y<(unsigned)h;y++){ - register int x=0; + int x; + x=0; #ifdef HAVE_INT_PVECTOR _ivec_prefetchw(&dstbase[x]); _ivec_prefetch(&src[x]); _ivec_prefetch(&srca[x]); - if(w>=__IVEC_SIZE) + /* MOVNTDQ: #GP(0) - If memory operand is not aligned on a 16-byte boundary */ + for(;x<w;x++){ + unsigned char *dst=&dstbase[x]; + if(srca[x]) *dst=((dstbase[x]*srca[x])>>8)+src[x]; + if((((long)dst)&(__IVEC_SIZE-1))==0) break; /* align on sizeof(MMREG) boundary */ + } + if((w-x)>=__IVEC_SIZE) for(;x<w;x+=__IVEC_SIZE){ __ivec vmsk,vdest,vsrc,vsrca,vt[4]; _ivec_prefetchw(&dstbase[x+__IVEC_SIZE*4]); _ivec_prefetch(&src[x+__IVEC_SIZE*4]); _ivec_prefetch(&srca[x+__IVEC_SIZE*4]); - vdest = _ivec_loadu(&dstbase[x]); - vsrc = _ivec_loada(&src[x]); - vsrca = _ivec_loada(&srca[x]); + vdest = _ivec_loada(&dstbase[x]); + vsrc = _ivec_loadu(&src[x]); + vsrca = _ivec_loadu(&srca[x]); vmsk = _ivec_not(_ivec_cmpeq_s8(vsrca,vzero)); vt[0] = _ivec_u16_from_lou8(vdest); vt[1] = _ivec_u16_from_hiu8(vdest); @@ -82,12 +89,12 @@ _ivec_stream(&dstbase[x],_ivec_blend_u8(vdest,vt[0],vmsk)); } #endif - for(;x<w;x++){ - if(srca[x]) dstbase[x]=((dstbase[x]*srca[x])>>8)+src[x]; - } - src+=srcstride; - srca+=srcstride; - dstbase+=dststride; + for(;x<w;x++){ + if(srca[x]) dstbase[x]=((dstbase[x]*srca[x])>>8)+src[x]; + } + src+=srcstride; + srca+=srcstride; + dstbase+=dststride; } #ifdef HAVE_INT_PVECTOR _ivec_empty(); Modified: mplayerxp/libvo/sub.c =================================================================== --- mplayerxp/libvo/sub.c 2010-01-15 18:37:16 UTC (rev 102) +++ mplayerxp/libvo/sub.c 2010-01-16 15:33:05 UTC (rev 103) @@ -138,7 +138,7 @@ inline static void __FASTCALL__ vo_draw_text_osd(mp_osd_obj_t* obj,draw_osd_f draw_alpha){ unsigned char *cp=(unsigned char *)vo_osd_text; - int font; + int font; int x=obj->x; while (*cp){ Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2010-01-15 18:37:16 UTC (rev 102) +++ mplayerxp/libvo/video_out.c 2010-01-16 15:33:05 UTC (rev 103) @@ -897,7 +897,7 @@ if(x0+w<=dri_cap.width&&y0+h<=dri_cap.height) { if(!draw_alpha) draw_alpha=get_draw_alpha(dri_cap.fourcc); - if(draw_alpha) + if(draw_alpha) (*draw_alpha)(w,h,src,srca,stride, dri_surf[active_frame].planes[0]+dri_cap.strides[0]*y0+x0*((dri_bpp+7)/8), dri_cap.strides[0]); Modified: mplayerxp/libvo/vo_null.c =================================================================== --- mplayerxp/libvo/vo_null.c 2010-01-15 18:37:16 UTC (rev 102) +++ mplayerxp/libvo/vo_null.c 2010-01-16 15:33:05 UTC (rev 103) @@ -183,7 +183,7 @@ static uint32_t __FASTCALL__ preinit(const char *arg) { - if(arg) + if(arg) { MSG_ERR("vo_null: Unknown subdevice: %s\n",arg); return ENOSYS; @@ -193,9 +193,9 @@ static void __FASTCALL__ null_dri_get_surface_caps(dri_surface_cap_t *caps) { - caps->caps = DRI_CAP_TEMP_VIDEO; - caps->caps |= DRI_CAP_HORZSCALER | DRI_CAP_VERTSCALER; - caps->caps |= DRI_CAP_DOWNSCALER | DRI_CAP_UPSCALER; + caps->caps =DRI_CAP_TEMP_VIDEO | + DRI_CAP_HORZSCALER | DRI_CAP_VERTSCALER | + DRI_CAP_DOWNSCALER | DRI_CAP_UPSCALER; caps->fourcc = null_fourcc; caps->width=null_image_width; caps->height=null_image_height; @@ -217,18 +217,63 @@ surf->planes[3] = 0; } +static int __FASTCALL__ null_query_format(vo_query_fourcc_t* format) { + /* we must avoid compressed-fourcc here */ + switch(format->fourcc) { + case IMGFMT_444P16_LE: + case IMGFMT_444P16_BE: + case IMGFMT_422P16_LE: + case IMGFMT_422P16_BE: + case IMGFMT_420P16_LE: + case IMGFMT_420P16_BE: + case IMGFMT_420A: + case IMGFMT_444P: + case IMGFMT_422P: + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YVU9: + case IMGFMT_IF09: + case IMGFMT_411P: + case IMGFMT_YUY2: + case IMGFMT_UYVY: +// RGB and grayscale (Y8 and Y800): + case IMGFMT_RGB48LE: + case IMGFMT_RGB48BE: + case IMGFMT_BGR32: + case IMGFMT_RGB32: + case IMGFMT_BGR24: + case IMGFMT_RGB24: + case IMGFMT_BGR16: + case IMGFMT_RGB16: + case IMGFMT_BGR15: + case IMGFMT_RGB15: + case IMGFMT_Y800: + case IMGFMT_Y8: + case IMGFMT_BGR8: + case IMGFMT_RGB8: + case IMGFMT_BGR4: + case IMGFMT_RGB4: + case IMGFMT_BG4B: + case IMGFMT_RG4B: + case IMGFMT_BGR1: + case IMGFMT_RGB1: return VO_TRUE; + } + return VO_FALSE; +} + static uint32_t __FASTCALL__ control(uint32_t request, void *data) { switch (request) { case VOCTRL_QUERY_FORMAT: - return VO_TRUE; + return null_query_format(data); case VOCTRL_GET_NUM_FRAMES: *(uint32_t *)data = null_num_frames; return VO_TRUE; case DRI_GET_SURFACE_CAPS: null_dri_get_surface_caps(data); return VO_TRUE; - case DRI_GET_SURFACE: + case DRI_GET_SURFACE: null_dri_get_surface(data); return VO_TRUE; case VOCTRL_FLUSH_PAGES: Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2010-01-15 18:37:16 UTC (rev 102) +++ mplayerxp/libvo/vo_sdl.c 2010-01-16 15:33:05 UTC (rev 103) @@ -26,22 +26,22 @@ * at http://slouken.devolution.com/SDL/ * * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. - * + * * mpeg2dec 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, or (at your option) * any later version. - * + * * mpeg2dec 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 GNU Make; see the file COPYING. If not, write to * the Free Software Foundation. * - * -- end old disclaimer -- + * -- end old disclaimer -- * * Changes: * Dominik Schnitzer <do...@sc...> - November 08, 2000. @@ -136,7 +136,7 @@ int sdl_forcexv; int sdl_forcegl; -static vo_info_t vo_info = +static vo_info_t vo_info = { "SDL YUV/RGB/BGR renderer (SDL v1.1.7+ !)" #ifdef CONFIG_VIDIX @@ -174,7 +174,7 @@ #define FS 0x01 #define VM 0x02 #define ZOOM 0x04 -#define FLIP 0x08 +#define FLIP 0x08 #ifdef SDL_ENABLE_LOCKS #define SDL_OVR_LOCK(x) if (SDL_LockYUVOverlay (priv->overlay[x])) { \ @@ -266,7 +266,7 @@ /* 1 if the OSD has changed otherwise 0 */ int osd_has_changed; - + /* source image format (YUV/RGB/...) */ uint32_t format; @@ -311,10 +311,10 @@ * Open and prepare SDL output. * * params : *plugin == - * *name == + * *name == * returns : 0 on success, -1 on failure **/ - + static int sdl_open ( void ) { struct sdl_priv_s *priv = &sdl_priv; @@ -393,7 +393,7 @@ /* non hardware accelerated fullscreen modes */ priv->sdlfullflags &= ~SDL_HWSURFACE; - priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags); + priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags); } /* test for normal resizeable & windowed hardware accellerated surfaces */ @@ -557,14 +557,14 @@ /* if creation of new surface was successfull, save it and hide mouse cursor */ if(newsurface) { if (priv->surface) - SDL_FreeSurface(priv->surface); + SDL_FreeSurface(priv->surface); priv->surface = newsurface; SDL_ShowCursor(0); SDL_SRF_LOCK(priv->surface, -1) SDL_FillRect(priv->surface, NULL, 0); SDL_SRF_UNLOCK(priv->surface) retval = setup_surfaces(); - } + } else MSG_ERR("set_fullmode: SDL_SetVideoMode failed: %s\n", SDL_GetError()); return retval; @@ -618,7 +618,7 @@ MSG_V("SDL: Using 0x%X (%s) image format\n", format, vo_format_name(format)); - + if(priv->mode != YUV) { priv->sdlflags |= SDL_ANYFORMAT; priv->sdlfullflags |= SDL_ANYFORMAT; @@ -700,10 +700,10 @@ aspect_save_screenres(priv->XWidth,priv->XHeight); aspect(&priv->dstwidth,&priv->dstheight,flags&VOFLAG_SWSCALE?A_ZOOM:A_NOZOOM); } - + priv->windowsize.w = priv->dstwidth; - priv->windowsize.h = priv->dstheight; - + priv->windowsize.h = priv->dstheight; + /* bit 0 (0x01) means fullscreen (-fs) * bit 1 (0x02) means mode switching (-vm) * bit 2 (0x04) enables software scaling (-zoom) @@ -719,7 +719,7 @@ priv->fulltype = FS; retval = set_fullmode(priv->fullmode); if(retval) return retval; - } else + } else if(flags&VM) { MSG_V("SDL: setting zoomed fullscreen with modeswitching\n"); priv->fulltype = VM; @@ -730,7 +730,7 @@ priv->fulltype = ZOOM; retval = set_fullmode(priv->fullmode); if(retval) return retval; - } + } else { if((strcmp(priv->driver, "x11") == 0) ||(strcmp(priv->driver, "windib") == 0) @@ -945,9 +945,9 @@ } break; case SDL_KEYUP: -#else +#else case SDL_KEYDOWN: -#endif +#endif keypressed = event.key.keysym.sym; MSG_V("SDL: Key pressed: '%i'\n", keypressed); @@ -963,9 +963,9 @@ } else if ( keypressed == SDLK_n ) { -#ifdef HAVE_X11 +#ifdef HAVE_X11 aspect(&priv->dstwidth, &priv->dstheight,softzoom?A_ZOOM:A_NOZOOM); -#endif +#endif if (priv->surface->w != priv->dstwidth || priv->surface->h != priv->dstheight) { if(enable_xp) LOCK_VDECODING(); if(set_video_mode(priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags)!=0) exit(EXIT_FAILURE); @@ -1028,7 +1028,7 @@ default: mplayer_put_key(keypressed); } - + break; case SDL_QUIT: SDL_ShowCursor(1); @@ -1048,12 +1048,12 @@ struct sdl_priv_s *priv = &sdl_priv; switch(priv->format) { - case IMGFMT_YV12: + case IMGFMT_YV12: case IMGFMT_I420: case IMGFMT_IYUV: { SDL_OVR_LOCK(idx) - + /* Erase Y plane */ erase_area_1(x, w, h, priv->overlay[idx]->pitches[0], 0, @@ -1064,12 +1064,12 @@ x /= 2; h /= 2; y /= 2; - + erase_area_1(x, w, h, priv->overlay[idx]->pitches[1], 128, priv->overlay[idx]->pixels[1] + priv->overlay[idx]->pitches[1]*y); - + erase_area_1(x, w, h, priv->overlay[idx]->pitches[2], 128, priv->overlay[idx]->pixels[2] + @@ -1096,7 +1096,7 @@ SDL_OVR_UNLOCK(idx) break; } - + case IMGFMT_RGB15: case IMGFMT_BGR15: case IMGFMT_RGB16: @@ -1126,7 +1126,7 @@ int x_end = x_start/4 + width/4; int x, y; uint32_t* data = (uint32_t*) pixels; - + x_start /= 4; pitch /= 4; @@ -1255,11 +1255,11 @@ static uint32_t __FASTCALL__ preinit(const char *arg) { struct sdl_priv_s *priv = &sdl_priv; -#ifdef HAVE_X11 +#ifdef HAVE_X11 static Display *XDisplay; static int XScreen; #endif - + memset(priv,0,sizeof(sdl_priv)); memset(priv->rgbsurface,0,sizeof(priv->rgbsurface)); memset(priv->overlay,0,sizeof(priv->overlay)); priv->num_buffs = 1; @@ -1301,7 +1301,7 @@ caps->w=priv->width; caps->h=priv->height; if(priv->mode == YUV) { - if(priv->overlay) + if(priv->overlay[0]) { int i,n; caps->width=priv->overlay[0]->w; @@ -1322,7 +1322,7 @@ } else { - if(priv->rgbsurface) + if(priv->rgbsurface[0]) { caps->width=priv->rgbsurface[0]->w; caps->height=priv->rgbsurface[0]->h; @@ -1375,7 +1375,7 @@ case DRI_GET_SURFACE_CAPS: sdl_dri_get_surface_caps(data); return VO_TRUE; - case DRI_GET_SURFACE: + case DRI_GET_SURFACE: sdl_dri_get_surface(data); return VO_TRUE; case VOCTRL_CHECK_EVENTS: Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2010-01-15 18:37:16 UTC (rev 102) +++ mplayerxp/libvo/vo_x11.c 2010-01-16 15:33:05 UTC (rev 103) @@ -138,13 +138,13 @@ title = strdup("MPlayerXP X11 (XImage/Shm) render"); in_format=format; - + if( flags&0x03 ) fullscreen = 1; if( flags&0x02 ) vm = 1; if( flags&0x08 ) Flip_Flag = 1; zoomFlag = flags&0x04; // if(!fullscreen) zoomFlag=1; //it makes no sense to avoid zooming on windowd mode - + XGetWindowAttributes( mDisplay,DefaultRootWindow( mDisplay ),&attribs ); depth=attribs.depth; Modified: mplayerxp/libvo/x11_common.c =================================================================== --- mplayerxp/libvo/x11_common.c 2010-01-15 18:37:16 UTC (rev 102) +++ mplayerxp/libvo/x11_common.c 2010-01-16 15:33:05 UTC (rev 103) @@ -375,7 +375,7 @@ vo_screenwidth,vo_screenheight, depth, vo_depthonscreen, dispName,mLocalDisplay?"local":"remote"); - + return 1; } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2010-01-15 18:37:16 UTC (rev 102) +++ mplayerxp/mplayer.c 2010-01-16 15:33:05 UTC (rev 103) @@ -99,7 +99,7 @@ #include "dec_ahead.h" int enable_xp=XP_VAPlay; -int enable_gomp=1; +int enable_gomp=0; /* currently it's experimental feature */ volatile int dec_ahead_active_frame=0; volatile unsigned abs_dec_ahead_active_frame=0; volatile unsigned loc_dec_ahead_active_frame=0; @@ -474,7 +474,7 @@ if( audio_buffer.indices[audio_buffer.index_tail].index != audio_buffer.tail ) { int buff_len = audio_buffer.len; MSG_DBG3("audio_ahead: orig idx %3i pts %.3f pos %i \n",audio_buffer.index_tail, audio_buffer.indices[audio_buffer.index_tail].pts,audio_buffer.indices[audio_buffer.index_tail].index ); - audio_buffer.indices[audio_buffer.index_tail].pts += (float)((audio_buffer.tail - audio_buffer.indices[audio_buffer.index_tail].index + buff_len) % buff_len) / (float)audio_buffer.sh_audio->f_bps; + audio_buffer.indices[audio_buffer.index_tail].pts += (float)((audio_buffer.tail - audio_buffer.indices[audio_buffer.index_tail].index + buff_len) % buff_len) / (float)audio_buffer.sh_audio->af_bps; audio_buffer.indices[audio_buffer.index_tail].index = audio_buffer.tail; MSG_DBG3("audio_ahead: read next_idx %3i next_pts %.3f pos %i \n", audio_buffer.index_tail,audio_buffer.indices[audio_buffer.index_tail].pts,audio_buffer.indices[audio_buffer.index_tail].index ); } @@ -490,7 +490,7 @@ int delay = audio_buffer.head - audio_buffer.tail; if( delay < 0 ) delay += audio_buffer.len; - return (float)delay / (float)audio_buffer.sh_audio->f_bps; + return (float)delay / (float)audio_buffer.sh_audio->af_bps; } int decode_audio_buffer(int len) @@ -1102,29 +1102,29 @@ if(use_pts_fix2) { if(sh_audio->a_pts != HUGE) { sh_audio->a_pts_pos-=playsize; - if(sh_audio->a_pts_pos > -ao_get_delay()*sh_audio->f_bps) { - sh_audio->timer+=playsize/(float)(sh_audio->f_bps); + if(sh_audio->a_pts_pos > -ao_get_delay()*sh_audio->af_bps) { + sh_audio->timer+=playsize/(float)(sh_audio->af_bps); } else { - sh_audio->timer=sh_audio->a_pts-(float)sh_audio->a_pts_pos/(float)sh_audio->f_bps; + sh_audio->timer=sh_audio->a_pts-(float)sh_audio->a_pts_pos/(float)sh_audio->af_bps; MSG_V("Audio chapter change detected\n"); sh_audio->chapter_change=1; sh_audio->a_pts = HUGE; } } else if(pts != HUGE) { if(pts < 1.0 && sh_audio->timer > 2.0) { - sh_audio->timer+=playsize/(float)(sh_audio->f_bps); + sh_audio->timer+=playsize/(float)(sh_audio->af_bps); sh_audio->a_pts=pts; sh_audio->a_pts_pos=sh_audio->a_buffer_len-ret; } else { - sh_audio->timer=pts+(ret-sh_audio->a_buffer_len)/(float)(sh_audio->f_bps); + sh_audio->timer=pts+(ret-sh_audio->a_buffer_len)/(float)(sh_audio->af_bps); sh_audio->a_pts=HUGE; } } else - sh_audio->timer+=playsize/(float)(sh_audio->f_bps); + sh_audio->timer+=playsize/(float)(sh_audio->af_bps); } else if(av_sync_pts && pts!=HUGE) - sh_audio->timer=pts+(ret-sh_audio->a_buffer_len)/(float)(sh_audio->f_bps); + sh_audio->timer=pts+(ret-sh_audio->a_buffer_len)/(float)(sh_audio->af_bps); else - sh_audio->timer+=playsize/(float)(sh_audio->f_bps); + sh_audio->timer+=playsize/(float)(sh_audio->af_bps); if(!av_sync_pts && enable_xp>=XP_VAPlay) pthread_mutex_unlock(&audio_timer_mutex); } @@ -1349,8 +1349,8 @@ /* DaP's AV-sync */ float SH_AV_delay; - /* SH_AV_delay = sh_video->timer - (sh_audio->timer - (float)((float)delay + sh_audio->a_buffer_len) / (float)sh_audio->f_bps); */ - SH_AV_delay = sh_video->timer - (sh_audio->timer - (float)((float)delay) / (float)sh_audio->f_bps); + /* SH_AV_delay = sh_video->timer - (sh_audio->timer - (float)((float)delay + sh_audio->a_buffer_len) / (float)sh_audio->af_bps); */ + SH_AV_delay = sh_video->timer - (sh_audio->timer - (float)((float)delay) / (float)sh_audio->af_bps); if(SH_AV_delay<-2*frame_time){ static int drop_message=0; drop_frame=frame_dropping; // tricky! @@ -1462,11 +1462,11 @@ float a_pts=0; // unplayed bytes in our and soundcard/dma buffer: - float delay=ao_get_delay()+(float)sh_audio->a_buffer_len/(float)sh_audio->f_bps; + float delay=ao_get_delay()+(float)sh_audio->a_buffer_len/(float)sh_audio->af_bps; if(pts_from_bps){ // PTS = sample_no / samplerate - unsigned int samples=(sh_audio->audio.dwSampleSize)? + unsigned int samples=(sh_audio->audio.dwSampleSize)? ((ds_tell(d_audio)-sh_audio->a_in_buffer_len)/sh_audio->audio.dwSampleSize) : (d_audio->pack_no); // <- used for VBR audio samples+=sh_audio->audio.dwStart; // offset @@ -1732,7 +1732,7 @@ float a_pts=0; // unplayed bytes in our and soundcard/dma buffer: - float delay=ao_get_delay()+(float)sh_audio->a_buffer_len/(float)sh_audio->f_bps; + float delay=ao_get_delay()+(float)sh_audio->a_buffer_len/(float)sh_audio->af_bps; if(enable_xp>=XP_VideoAudio) delay += get_delay_audio_buffer(); @@ -2614,7 +2614,7 @@ sh_audio=d_audio->sh=NULL; } else { MSG_V("AUDIO: srate=%d chans=%d bps=%d sfmt=0x%X ratio: %d->%d\n",sh_audio->samplerate,sh_audio->channels,sh_audio->samplesize, - sh_audio->sample_format,sh_audio->i_bps,sh_audio->f_bps); + sh_audio->sample_format,sh_audio->i_bps,sh_audio->af_bps); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2010-01-18 15:55:32
|
Revision: 107 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=107&view=rev Author: nickols_k Date: 2010-01-18 15:55:23 +0000 (Mon, 18 Jan 2010) Log Message: ----------- fastmemcpy-related improvements Modified Paths: -------------- DOCS/mplayerxp.1 mplayerxp/cfg-mplayer.h mplayerxp/dec_ahead.h mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libvo/aclib.c mplayerxp/libvo/aclib_template.c mplayerxp/libvo/dri_vo.h mplayerxp/libvo/fastmemcpy.h mplayerxp/libvo/osd.c mplayerxp/libvo/osd.h mplayerxp/libvo/osd_template.c mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vosub_vidix.c mplayerxp/mp_image.h mplayerxp/postproc/af_export.c mplayerxp/postproc/af_scaletempo.c mplayerxp/postproc/libmenu/menu.c mplayerxp/postproc/vf_delogo.c mplayerxp/postproc/vf_dint.c mplayerxp/postproc/vf_down3dright.c mplayerxp/postproc/vf_expand.c mplayerxp/postproc/vf_il.c mplayerxp/postproc/vf_mirror.c mplayerxp/postproc/vf_noise.c mplayerxp/postproc/vf_panscan.c mplayerxp/postproc/vf_rectangle.c mplayerxp/postproc/vf_scale.c mplayerxp/postproc/vf_softpulldown.c mplayerxp/postproc/vf_unsharp.c mplayerxp/postproc/vf_vo.c mplayerxp/postproc/vf_yvu9.c Removed Paths: ------------- mplayerxp/libvo/aclib_x86_64.h Modified: DOCS/mplayerxp.1 =================================================================== --- DOCS/mplayerxp.1 2010-01-17 18:46:44 UTC (rev 106) +++ DOCS/mplayerxp.1 2010-01-18 15:55:23 UTC (rev 107) @@ -210,7 +210,7 @@ .TP modprobe dhahelper .TP -mplayerxp -vo xvidix -core.xp -video.bm -video.fs -video.zoom videoout.avi +mplayerxp -vo xvidix -core.xp -video.bm -video.fs -video.aspect-ratio videoout.avi .SS .I Another ways to speedup playback: In general, there are two ways to increase performance of playback - @@ -666,13 +666,13 @@ -video.monitorpixelaspect=4:3 or 1.3333 .TP -.B \-video.x\ <x> -scale image to x width (if driver supports) +.B \-video.width\ <x> +scale image to width (if driver supports) .TP -.B \-video.y\ <y> -scale image to y height (if driver supports) +.B \-video.height\ <y> +scale image to height (if driver supports) .TP -.B \-video.xy\ <factor> +.B \-video.zoom\ <factor> scale image by <factor> .TP @@ -717,7 +717,7 @@ try to change to a different video mode. dga2, x11 (XF86VidMode) and sdl output drivers support it. .TP -.B \-video.zoom +.B \-video.aspect-ratio Keeps aspect ratio on the screen .I [default] .TP @@ -809,7 +809,7 @@ .TP .B \-video.sws\ <software\ scaler\ type> this option sets the quality (and speed, respectively) of the software scaler, -with the -zoom option. For example with x11 or other outputs which lack +with the -video.aspect-ratio option. For example with x11 or other outputs which lack hardware scaler. Possible settings are: 0 - fast bilinear (default) Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2010-01-17 18:46:44 UTC (rev 106) +++ mplayerxp/cfg-mplayer.h 2010-01-18 15:55:23 UTC (rev 107) @@ -132,12 +132,12 @@ */ static const config_t xpcore_config[]={ - {"xp", &enable_xp, CONF_TYPE_INT, CONF_RANGE, 0, 4, NULL, "starts MPlayerXP in multi-thread and multi-buffer XP mode"}, - {"noxp", &enable_xp, CONF_TYPE_FLAG, 0, 1, 0, NULL, "starts MPlayerXP in single-thread mode"}, + {"xp", &enable_xp, CONF_TYPE_INT, CONF_RANGE, 0, 4, NULL, "starts MPlayerXP in multi-thread and multi-buffer XP mode"}, + {"noxp", &enable_xp, CONF_TYPE_FLAG, 0, 1, 0, NULL, "starts MPlayerXP in single-thread mode"}, {"dump", &stream_dump, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies dump type and name for the dump of stream"}, - {"gomp", &enable_gomp, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables usage of OpenMP extensions"}, - {"nogomp", &enable_gomp, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables usage of OpenMP extensions"}, - {"da_buffs", &vo_da_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, NULL, "specifies number of buffers for decoding-ahead in XP mode"}, + {"gomp", &enable_gomp, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables usage of OpenMP extensions"}, + {"nogomp", &enable_gomp, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables usage of OpenMP extensions"}, + {"da_buffs", &vo_da_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, NULL, "specifies number of buffers for decoding-ahead in XP mode"}, {"double", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables double-buffering for single-thread decoding"}, {"nodouble", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 1, 0, NULL, "enables single-buffer for single-thread decoding"}, {"cache", &stream_cache_size, CONF_TYPE_INT, CONF_RANGE, 4, 65536, NULL,"specifies amount of memory for precaching a file/URL"}, @@ -168,32 +168,32 @@ #if defined( ARCH_X86 ) || defined(ARCH_X86_64) static const config_t cpu_config[]={ - {"mmx", &x86_mmx, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of MMX extensions of CPU"}, - {"nommx", &x86_mmx, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of MMX extensions of CPU"}, - {"mmx2", &x86_mmx2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of MMX2 extensions of CPU"}, - {"nommx2", &x86_mmx2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of MMX2 extensions of CPU"}, - {"3dnow", &x86_3dnow, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of 3DNow! extensions of CPU"}, - {"no3dnow", &x86_3dnow, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of 3DNow! extensions of CPU"}, - {"3dnow2", &x86_3dnow2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of 3DNow-2! extensions of CPU"}, - {"no3dnow2", &x86_3dnow2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of 3DNow-2! extensions of CPU"}, - {"sse", &x86_sse, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE extensions of CPU"}, - {"nosse", &x86_sse, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE extensions of CPU"}, - {"sse2", &x86_sse2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE2 extensions of CPU"}, - {"nosse2", &x86_sse2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE2 extensions of CPU"}, - {"sse3", &x86_sse3, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE3 extensions of CPU"}, - {"nosse3", &x86_sse3, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE3 extensions of CPU"}, - {"ssse3", &x86_ssse3, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSSE3 extensions of CPU"}, - {"nossse3", &x86_ssse3, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSSE3 extensions of CPU"}, - {"sse41", &x86_sse41, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE41 extensions of CPU"}, - {"nosse41", &x86_sse41, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE41 extensions of CPU"}, - {"sse42", &x86_sse42, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE42 extensions of CPU"}, - {"nosse42", &x86_sse42, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE42 extensions of CPU"}, - {"aes", &x86_aes, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of AES extensions of CPU"}, - {"noaes", &x86_aes, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of AES extensions of CPU"}, - {"avx", &x86_avx, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of AVX extensions of CPU"}, - {"noavx", &x86_avx, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of AVX extensions of CPU"}, - {"fma", &x86_fma, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of FMA extensions of CPU"}, - {"nofma", &x86_fma, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of FMA extensions of CPU"}, + {"mmx", &x86_mmx, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of MMX extensions of CPU"}, + {"nommx", &x86_mmx, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of MMX extensions of CPU"}, + {"mmx2", &x86_mmx2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of MMX2 extensions of CPU"}, + {"nommx2", &x86_mmx2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of MMX2 extensions of CPU"}, + {"3dnow", &x86_3dnow, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of 3DNow! extensions of CPU"}, + {"no3dnow", &x86_3dnow, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of 3DNow! extensions of CPU"}, + {"3dnow2", &x86_3dnow2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of 3DNow-2! extensions of CPU"}, + {"no3dnow2", &x86_3dnow2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of 3DNow-2! extensions of CPU"}, + {"sse", &x86_sse, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE extensions of CPU"}, + {"nosse", &x86_sse, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE extensions of CPU"}, + {"sse2", &x86_sse2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE2 extensions of CPU"}, + {"nosse2", &x86_sse2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE2 extensions of CPU"}, + {"sse3", &x86_sse3, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE3 extensions of CPU"}, + {"nosse3", &x86_sse3, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE3 extensions of CPU"}, + {"ssse3", &x86_ssse3, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSSE3 extensions of CPU"}, + {"nossse3", &x86_ssse3, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSSE3 extensions of CPU"}, + {"sse41", &x86_sse41, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE41 extensions of CPU"}, + {"nosse41", &x86_sse41, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE41 extensions of CPU"}, + {"sse42", &x86_sse42, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE42 extensions of CPU"}, + {"nosse42", &x86_sse42, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE42 extensions of CPU"}, + {"aes", &x86_aes, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of AES extensions of CPU"}, + {"noaes", &x86_aes, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of AES extensions of CPU"}, + {"avx", &x86_avx, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of AVX extensions of CPU"}, + {"noavx", &x86_avx, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of AVX extensions of CPU"}, + {"fma", &x86_fma, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of FMA extensions of CPU"}, + {"nofma", &x86_fma, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of FMA extensions of CPU"}, {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, }; #endif @@ -227,7 +227,6 @@ {"framedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables frame-dropping on slow systems: decodes all video frames, but skips displaying some ones"}, /*UD*/ {"hardframedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 2, NULL, "enables hard frame-dropping on slow systems: skips displaying and decoding of some frames"}, {"noframedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables frame dropping"}, - {"pts", &av_sync_pts, CONF_TYPE_FLAG, 0, 0, 1, NULL, "use PTS-based method of A/V synchronization"}, {"nopts", &av_sync_pts, CONF_TYPE_FLAG, 0, 1, 0, NULL, "use BPS-based method of A/V synchronization"}, {"dap", &dapsync, CONF_TYPE_FLAG, 0, 0, 1, NULL, "use alternative method of A/V synchronization"}, @@ -266,7 +265,7 @@ {"nounicode", &sub_unicode, CONF_TYPE_FLAG, 0, 1, 0, NULL, "tells MPlayerXP to handle the subtitle file as non-UNICODE"}, {"utf8", &sub_utf8, CONF_TYPE_FLAG, 0, 0, 1, NULL, "tells MPlayerXP to handle the subtitle file as UTF8"}, {"noutf8", &sub_utf8, CONF_TYPE_FLAG, 0, 1, 0, NULL, "tells MPlayerXP to handle the subtitle file as non-UTF8"}, - {"pos",&sub_pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL, "specifies vertical shift of subtitles"}, + {"pos",&sub_pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL, "specifies vertical shift of subtitles"}, #endif {"cc", &subcc_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enable DVD Closed Caption (CC) subtitles"}, {"nocc", &subcc_enabled, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable DVD Closed Caption (CC) subtitles"}, @@ -291,7 +290,7 @@ static const config_t audio_config[]={ {"on", &has_audio, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables audio-steam playback"}, {"off", &has_audio, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables audio-stream playback"}, - {"mixer", &oss_mixer_device, CONF_TYPE_STRING, 0, 0, 0, NULL, "select audio-mixer device"}, + {"mixer", &oss_mixer_device, CONF_TYPE_STRING, 0, 0, 0, NULL, "select audio-mixer device"}, {"channels", &audio_output_channels, CONF_TYPE_INT, CONF_RANGE, 2, 8, NULL, "select number of audio output channels to be used"}, {"rate", &force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, NULL, "specifies Hz for audio playback"}, {"lang", &audio_lang, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies language of DVD-audio stream as two-letter country code(s)"}, @@ -304,28 +303,28 @@ }; static const config_t video_config[]={ - {"x", &opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to x width (if driver supports)"}, - {"y", &opt_screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to y height (if driver supports)"}, - {"xy", &screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, NULL, "scale output image by given factor"}, + {"width", &opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to width (if driver supports)"}, + {"height", &opt_screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to height (if driver supports)"}, + {"zoom", &screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, NULL, "scale output image by given factor"}, {"screenw", &vo_screenwidth, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "specifies the horizontal resolution of the screen (if supported)"}, {"screenh", &vo_screenheight, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "specifies the vertical resolution of the screen (if supported)"}, {"speed", &playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, NULL, "sets playback speed factor"}, {"aspect", &movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, NULL, "sets aspect-ratio of movies (autodetect)"}, {"noaspect", &movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, NULL, "unsets aspect-ratio of movies"}, + {"aspect-ratio", &softzoom, CONF_TYPE_FLAG, 0, 0, 1, NULL, "keeps aspect-ratio of the movie during window resize"}, + {"noaspect-ratio", &softzoom, CONF_TYPE_FLAG, 0, 1, 0, NULL, "render movie to the user-defined window's geometry"}, {"monitorpixelaspect", &monitor_pixel_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 9.0, NULL, "sets the aspect-ratio of a single pixel of TV screen"}, - {"vm", &vidmode, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables video-mode changing during playback"}, + {"vm", &vidmode, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables video-mode changing during playback"}, {"novm", &vidmode, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video-mode changing during playback"}, {"fs", &fullscreen, CONF_TYPE_FLAG, 0, 0, 1, NULL, "fullscreen playback"}, {"nofs", &fullscreen, CONF_TYPE_FLAG, 0, 1, 0, NULL, "windowed playback"}, {"fsmode", &vo_fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 15, NULL, "enables workaround for some fullscreen related problems"}, - {"zoom", &softzoom, CONF_TYPE_FLAG, 0, 0, 1, NULL, "keeps aspect-ratio of the movie during window resize"}, - {"nozoom", &softzoom, CONF_TYPE_FLAG, 0, 1, 0, NULL, "render movie to the user-defined window's geometry"}, - {"flip", &flip, CONF_TYPE_FLAG, 0, -1, 1, NULL, "flip output image upside-down"}, - {"noflip", &flip, CONF_TYPE_FLAG, 0, -1, 0, NULL, "render output image as is"}, - {"bpp", &vo_dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32, NULL, "use different color depth than autodetect"}, - {"bm", &vo_use_bm, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of bus-mastering (if it available for given OS/videocard)"}, - {"bm2", &vo_use_bm, CONF_TYPE_FLAG, 0, 0, 2, NULL, "enables using of bus-mastering to store all decoded-ahead frames in video-memory"}, - {"nobm", &vo_use_bm, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of bus-mastering"}, + {"flip", &flip, CONF_TYPE_FLAG, 0, -1, 1, NULL, "flip output image upside-down"}, + {"noflip", &flip, CONF_TYPE_FLAG, 0, -1, 0, NULL, "render output image as is"}, + {"bpp", &vo_dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32, NULL, "use different color depth than autodetect"}, + {"bm", &vo_use_bm, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of bus-mastering (if it available for given OS/videocard)"}, + {"bm2", &vo_use_bm, CONF_TYPE_FLAG, 0, 0, 2, NULL, "enables using of bus-mastering to store all decoded-ahead frames in video-memory"}, + {"nobm", &vo_use_bm, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of bus-mastering"}, {"id", &video_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL, "selects video channel"}, {"pp", &npp_options, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies options of post-processing"}, {"sws", &sws_flags, CONF_TYPE_INT, 0, 0, 2, NULL, "specifies the quality of the software scaler"}, @@ -336,7 +335,7 @@ {"noxv", &sdl_noxv, CONF_TYPE_FLAG, 0, 0, 1, NULL, "disable XVideo hardware acceleration for SDL"}, {"forcexv", &sdl_forcexv, CONF_TYPE_FLAG, 0, 0, 1, NULL, "force XVideo hardware acceleration for SDL"}, {"forcegl", &sdl_forcegl, CONF_TYPE_FLAG, 0, 0, 1, NULL, "force OpenGL hardware acceleration for SDL"}, -#endif +#endif {"eq",&veq_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "Video-equalizer specific options"}, {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, }; @@ -346,8 +345,8 @@ {"ss", &seek_to_sec, CONF_TYPE_STRING, CONF_MIN, 0, 0, NULL, "seek to given time position before playback"}, {"loop", &loop_times, CONF_TYPE_INT, CONF_RANGE, -1, 10000, NULL, "loops movie playback given number of times. 0 means forever"}, {"noloop", &loop_times, CONF_TYPE_FLAG, 0, 0, -1, NULL, "disable loop of playback"}, - {"shuffle",&shuffle_playback, CONF_TYPE_FLAG, 0, 0, 1, NULL, "play files in random order"}, - {"noshuffle",&shuffle_playback, CONF_TYPE_FLAG, 0, 1, 0, NULL, "play files in regular order"}, + {"shuffle",&shuffle_playback, CONF_TYPE_FLAG, 0, 0, 1, NULL, "play files in random order"}, + {"noshuffle",&shuffle_playback, CONF_TYPE_FLAG, 0, 1, 0, NULL, "play files in regular order"}, {"list", NULL, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies playlist (1 file/row or Winamp or ASX format)"}, {"frames", &play_n_frames, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL, "play given number of frames and exit"}, {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, Modified: mplayerxp/dec_ahead.h =================================================================== --- mplayerxp/dec_ahead.h 2010-01-17 18:46:44 UTC (rev 106) +++ mplayerxp/dec_ahead.h 2010-01-18 15:55:23 UTC (rev 107) @@ -60,6 +60,8 @@ #define LOCK_VIDEO_DECODE() { MSG_D(DA_PREFIX"LOCK_VIDEO_DECODE\n"); pthread_mutex_lock(&video_decode_mutex); } #define UNLOCK_VIDEO_DECODE() { MSG_D(DA_PREFIX"UNLOCK_VIDEO_DECODE\n"); pthread_mutex_unlock(&video_decode_mutex); } +#define __MP_ATOMIC(OP) { pthread_mutex_t loc_mutex; pthread_mutex_lock(&loc_mutex); OP; pthread_mutex_unlock(&loc_mutex); } + typedef struct sh_video_attr { int eof; /* indicates last frame in stream */ Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2010-01-17 18:46:44 UTC (rev 106) +++ mplayerxp/libmpcodecs/ad_mp3.c 2010-01-18 15:55:23 UTC (rev 107) @@ -361,8 +361,10 @@ if(!((err==MPG123_OK)||(err==MPG123_NEED_MORE))) { MSG_ERR("mpg123_read = %s done = %u minlen = %u\n",mpg123_plain_strerror(err),done,minlen); } - else + else { + MSG_DBG2("ad_mp3.decode: copy %u bytes from %p\n",done,outdata); memcpy(buf,outdata,done); + } if(err==MPG123_NEED_MORE) { indata_size=ds_get_packet_r(sh->ds,&indata,pts); if(indata_size<0) return 0; Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2010-01-17 18:46:44 UTC (rev 106) +++ mplayerxp/libmpcodecs/dec_video.c 2010-01-18 15:55:23 UTC (rev 107) @@ -80,12 +80,10 @@ sh_video->inited=0; } -#ifdef _OPENMP #define MPDEC_THREAD_COND (VF_FLAGS_THREADS|VF_FLAGS_SLICES) static unsigned smp_num_cpus=1; static unsigned use_vf_threads=0; extern int enable_gomp; -#endif extern char *video_codec; int init_video(sh_video_t *sh_video,const char* codecname,const char * vfm,int status){ @@ -207,12 +205,12 @@ for(j=0;j<num_slices;j+=smp_num_cpus) { #pragma omp parallel for shared(vf) private(i) for(i=j;i<smp_num_cpus;i++) { - MSG_DBG2("Put slice[%u %u] in threads\n",ampi[i].y,ampi[i].h); + MSG_DBG2("parallel: dec_video.put_slice[%ux%u] %i %i %i %i\n",ampi[i].width,ampi[i].height,ampi[i].x,ampi[i].y,ampi[i].w,ampi[i].h); vf->put_slice(vf,&i[i]); } } for(;j<num_slices;j++) { - MSG_DBG2("Put slice[%u %u] in threads\n",ampi[j].y,h_step); + MSG_DBG2("par_tail: dec_video.put_slice[%ux%u] %i %i %i %i\n",ampi[i].width,ampi[i].height,ampi[i].x,ampi[i].y,ampi[i].w,ampi[i].h); vf->put_slice(vf,&i[j]); } } @@ -221,12 +219,12 @@ { /* execute slices instead of whole frame make faster multiple filters */ for(i=0;i<num_slices;i++) { - MSG_DBG2("vf(%s) Put slice[%u %u] in threads\n",vf->info->name,ampi[i].y,ampi[i].h); + MSG_DBG2("dec_video.put_slice[%ux%u] %i %i %i %i\n",ampi[i].width,ampi[i].height,ampi[i].x,ampi[i].y,ampi[i].w,ampi[i].h); vf->put_slice(vf,&i[i]); } } } else { - MSG_DBG2("Put whole frame\n"); + MSG_DBG2("Put whole frame[%ux%u]\n",mpi->width,mpi->height); vf->put_slice(vf,mpi); } } Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2010-01-17 18:46:44 UTC (rev 106) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2010-01-18 15:55:23 UTC (rev 107) @@ -5,6 +5,7 @@ #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "mp_config.h" +#include "../dec_ahead.h" #ifdef HAVE_GOMP #include <omp.h> #endif @@ -578,17 +579,18 @@ priv_t *vdff_ctx=sh->context; mp_image_t *mpi; if(vdff_ctx->use_dr1) { MSG_DBG2("Ignoring draw_slice due dr1\n"); return; } /* we may call vo_start_slice() here */ - mpi=mpcodecs_get_image(sh,MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_DIRECT,s->width,height); + mpi=mpcodecs_get_image(sh,MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_DIRECT,s->width,s->height); mpi->stride[0]=src->linesize[0]; mpi->stride[1]=src->linesize[1]; mpi->stride[2]=src->linesize[2]; - mpi->planes[0] = src->base[0]+offset[0]; - mpi->planes[1] = src->base[1]+offset[1]; - mpi->planes[2] = src->base[2]+offset[2]; + mpi->planes[0] = src->data[0]; + mpi->planes[1] = src->data[1]; + mpi->planes[2] = src->data[2]; mpi->w=s->width; mpi->y=y; mpi->h=height; + mpi->chroma_height = height >> mpi->chroma_y_shift; /* provide info for pp */ mpi->qscale=(QP_STORE_T *)vdff_ctx->lavc_picture->qscale_table; mpi->qstride=vdff_ctx->lavc_picture->qstride; @@ -607,14 +609,10 @@ mpi->stride[2]=mpi->stride[1]; mpi->stride[1]=ls; } - MSG_DBG2("ff_draw_callback %i %i %i %i\n",mpi->x,mpi->y,mpi->w,mpi->h); - pthread_mutex_lock(&sh->mutex); - sh->active_slices++; - pthread_mutex_unlock(&sh->mutex); + MSG_DBG2("ff_draw_callback[%ux%u] %i %i %i %i\n",mpi->width,mpi->height,mpi->x,mpi->y,mpi->w,mpi->h); + __MP_ATOMIC(sh->active_slices++); mpcodecs_draw_slice (sh, mpi); - pthread_mutex_lock(&sh->mutex); - sh->active_slices--; - pthread_mutex_unlock(&sh->mutex); + __MP_ATOMIC(sh->active_slices--); } /* copypaste from demux_real.c - it should match to get it working!*/ Modified: mplayerxp/libvo/aclib.c =================================================================== --- mplayerxp/libvo/aclib.c 2010-01-17 18:46:44 UTC (rev 106) +++ mplayerxp/libvo/aclib.c 2010-01-18 15:55:23 UTC (rev 107) @@ -8,110 +8,81 @@ #if defined(USE_FASTMEMCPY) #include "fastmemcpy.h" #include "../cpudetect.h" -/* - aclib - advanced C library ;) - This file contains functions which improve and expand standard C-library - see aclib_template.c ... this file only contains runtime cpu detection and config options stuff - runtime cpu detection by michael niedermayer (mic...@gm...) is under GPL -*/ -#if defined( CAN_COMPILE_MMX ) && defined (ARCH_X86) #define BLOCK_SIZE 4096 #define CONFUSION_FACTOR 0 -//Feel free to fine-tune the above 2, it might be possible to get some speedup with them :) -//#define STATISTICS +/* generic version */ +#undef OPTIMIZE_AVX +#undef OPTIMIZE_SSE4 +#undef OPTIMIZE_SSSE3 +#undef OPTIMIZE_SSE3 +#undef OPTIMIZE_SSE2 +#undef OPTIMIZE_SSE +#undef OPTIMIZE_MMX2 +#undef OPTIMIZE_MMX -#if defined( ARCH_X86 ) -#define CAN_COMPILE_X86_ASM -#endif - -//Note: we have MMX, MMX2, 3DNOW version there is no 3DNOW+MMX2 one -//Plain C versions -//#if !defined (HAVE_MMX) || defined (RUNTIME_CPUDETECT) -//#define COMPILE_C -//#endif - -#ifdef CAN_COMPILE_X86_ASM - -#undef HAVE_MMX -#undef HAVE_MMX2 -#undef HAVE_3DNOW -#undef HAVE_SSE - -//MMX versions -#ifdef CAN_COMPILE_MMX -#undef RENAME +#ifndef __x86_64__ +#ifdef __MMX__ +#define OPTIMIZE_MMX #undef CL_SIZE #define CL_SIZE 32 -#define HAVE_MMX -#undef HAVE_MMX2 -#undef HAVE_3DNOW +#undef RENAME #define RENAME(a) a ## _MMX #include "aclib_template.c" #endif - -//MMX2 versions 32-byte cache-line size -#ifdef CAN_COMPILE_MMX2 -#undef RENAME +#ifdef __MMX2__ +#define OPTIMIZE_MMX2 #undef CL_SIZE #define CL_SIZE 32 -#define HAVE_MMX -#define HAVE_MMX2 -#undef HAVE_3DNOW +#undef RENAME #define RENAME(a) a ## _MMX2_CL32 #include "aclib_template.c" #endif - -//MMX2 versions 64-byte cache-line size -#ifdef CAN_COMPILE_MMX2 -#undef RENAME +#ifdef __MMX2__ +#define OPTIMIZE_MMX2 #undef CL_SIZE #define CL_SIZE 64 -#define HAVE_MMX -#define HAVE_MMX2 -#undef HAVE_3DNOW +#undef RENAME #define RENAME(a) a ## _MMX2_CL64 #include "aclib_template.c" #endif - -//MMX2 versions 128-byte cache-line size -#ifdef CAN_COMPILE_MMX2 -#undef RENAME +#ifdef __MMX2__ +#define OPTIMIZE_MMX2 #undef CL_SIZE #define CL_SIZE 128 -#define HAVE_MMX -#define HAVE_MMX2 -#undef HAVE_3DNOW +#undef RENAME #define RENAME(a) a ## _MMX2_CL128 #include "aclib_template.c" #endif - -//3DNOW versions all K6 have 32-bit cache-line size -#ifdef CAN_COMPILE_3DNOW +#endif // __x86_64__ +#ifdef __SSE2__ +#define OPTIMIZE_SSE2 #undef RENAME #undef CL_SIZE -#define CL_SIZE 32 -#define HAVE_MMX -#undef HAVE_MMX2 -#define HAVE_3DNOW -#define RENAME(a) a ## _3DNow +#define CL_SIZE 128 +#define RENAME(a) a ## _SSE2 #include "aclib_template.c" #endif -#endif // CAN_COMPILE_X86_ASM +/* + aclib - advanced C library ;) + This file contains functions which improve and expand standard C-library + see aclib_template.c ... this file only contains runtime cpu detection and config options stuff + runtime cpu detection by michael niedermayer (mic...@gm...) is under GPL +*/ -#elif defined( ARCH_X86_64 ) -#define RENAME(a) a ## _x86_64 -#include "aclib_x86_64.h" -#endif - static void * init_fast_memcpy(void * to, const void * from, size_t len) { -#if defined( ARCH_X86_64 ) && defined( USE_FASTMEMCPY ) - fast_memcpy_ptr = fast_memcpy_x86_64; -#elif defined( CAN_COMPILE_X86_ASM ) - // ordered per speed fasterst first -#ifdef CAN_COMPILE_MMX2 +#ifdef __SSE2__ + if(gCpuCaps.hasSSE2) + { + MSG_V("Using SSE2 optimized memcpy\n"); + fast_memcpy_ptr = fast_memcpy_SSE2; + } + else +#endif +#ifndef __x86_64__ +#ifdef __MMX2__ if(gCpuCaps.hasMMX2) { MSG_V("Using MMX2 optimized memcpy\n"); @@ -123,14 +94,6 @@ } else #endif -#ifdef CAN_COMPILE_3DNOW - if(gCpuCaps.has3DNow) - { - MSG_V("Using 3DNow optimized memcpy\n"); - fast_memcpy_ptr = fast_memcpy_3DNow; - } - else -#endif #ifdef CAN_COMPILE_MMX if(gCpuCaps.hasMMX) { @@ -139,60 +102,54 @@ } else #endif -#else +#endif { MSG_V("Using generic memcpy\n"); fast_memcpy_ptr = memcpy; /* prior to mmx we use the standart memcpy */ } -#endif return (*fast_memcpy_ptr)(to,from,len); } -static void * init_mem2agpcpy(void * to, const void * from, size_t len) +static void * init_stream_copy(void * to, const void * from, size_t len) { -#if defined( ARCH_X86_64 ) && defined( USE_FASTMEMCPY ) - mem2agpcpy_ptr = mem2agpcpy_x86_64; -#elif defined ( CAN_COMPILE_X86_ASM ) - // ordered per speed fasterst first -#ifdef CAN_COMPILE_MMX2 +#ifdef __SSE2__ + if(gCpuCaps.hasSSE2) + { + MSG_V("Using SSE2 optimized agpcpy\n"); + fast_stream_copy_ptr = fast_stream_copy_SSE2; + } +#endif +#ifndef __x86_64__ +#ifdef __MMX2__ if(gCpuCaps.hasMMX2) { MSG_V("Using MMX2 optimized agpcpy\n"); - if(gCpuCaps.cl_size >= 128) mem2agpcpy_ptr = mem2agpcpy_MMX2_CL128; + if(gCpuCaps.cl_size >= 128) fast_stream_copy_ptr = fast_stream_copy_MMX2_CL128; else - if(gCpuCaps.cl_size == 64) mem2agpcpy_ptr = mem2agpcpy_MMX2_CL64; + if(gCpuCaps.cl_size == 64) fast_stream_copy_ptr = fast_stream_copy_MMX2_CL64; else - mem2agpcpy_ptr = mem2agpcpy_MMX2_CL32; + fast_stream_copy_ptr = fast_stream_copy_MMX2_CL32; } else #endif -#ifdef CAN_COMPILE_3DNOW - if(gCpuCaps.has3DNow) - { - MSG_V("Using 3DNow optimized agpcpy\n"); - mem2agpcpy_ptr = mem2agpcpy_3DNow; - } - else -#endif -#ifdef CAN_COMPILE_MMX +#ifdef __MMX__ if(gCpuCaps.hasMMX) { MSG_V("Using MMX optimized agpcpy\n"); - mem2agpcpy_ptr = mem2agpcpy_MMX; + fast_stream_copy_ptr = fast_stream_copy_MMX; } else #endif -#else +#endif { MSG_V("Using generic optimized agpcpy\n"); - mem2agpcpy_ptr = memcpy; /* prior to mmx we use the standart memcpy */ + fast_stream_copy_ptr = memcpy; /* prior to mmx we use the standart memcpy */ } -#endif - return (*mem2agpcpy_ptr)(to,from,len); + return (*fast_stream_copy_ptr)(to,from,len); } void *(*fast_memcpy_ptr)(void * to, const void * from, size_t len) = init_fast_memcpy; -void *(*mem2agpcpy_ptr)(void * to, const void * from, size_t len) = init_mem2agpcpy; +void *(*fast_stream_copy_ptr)(void * to, const void * from, size_t len) = init_stream_copy; #endif /* use fastmemcpy */ Modified: mplayerxp/libvo/aclib_template.c =================================================================== --- mplayerxp/libvo/aclib_template.c 2010-01-17 18:46:44 UTC (rev 106) +++ mplayerxp/libvo/aclib_template.c 2010-01-18 15:55:23 UTC (rev 107) @@ -2,102 +2,70 @@ aclib - advanced C library ;) This file contains functions which improve and expand standard C-library */ +#include "pvector/pvector.h" -#ifndef HAVE_SSE2 -/* - P3 processor has only one SSE decoder so can execute only 1 sse insn per - cpu clock, but it has 3 mmx decoders (include load/store unit) - and executes 3 mmx insns per cpu clock. - P4 processor has some chances, but after reading: - http://www.emulators.com/pentium4.htm - I have doubts. Anyway SSE2 version of this code can be written better. -*/ -#undef HAVE_SSE -#endif - - -/* - This part of code was taken by me from Linux-2.4.3 and slightly modified -for MMX, MMX2, SSE instruction set. I have done it since linux uses page aligned -blocks but mplayer uses weakly ordered data and original sources can not -speedup them. Only using PREFETCHNTA and MOVNTQ together have effect! - ->From IA-32 Intel Architecture Software Developer's Manual Volume 1, - -Order Number 245470: -"10.4.6. Cacheability Control, Prefetch, and Memory Ordering Instructions" - -Data referenced by a program can be temporal (data will be used again) or -non-temporal (data will be referenced once and not reused in the immediate -future). To make efficient use of the processor's caches, it is generally -desirable to cache temporal data and not cache non-temporal data. Overloading -the processor's caches with non-temporal data is sometimes referred to as -"polluting the caches". -The non-temporal data is written to memory with Write-Combining semantics. - -The PREFETCHh instructions permits a program to load data into the processor -at a suggested cache level, so that it is closer to the processors load and -store unit when it is needed. If the data is already present in a level of -the cache hierarchy that is closer to the processor, the PREFETCHh instruction -will not result in any data movement. -But we should you PREFETCHNTA: Non-temporal data fetch data into location -close to the processor, minimizing cache pollution. - -The MOVNTQ (store quadword using non-temporal hint) instruction stores -packed integer data from an MMX register to memory, using a non-temporal hint. -The MOVNTPS (store packed single-precision floating-point values using -non-temporal hint) instruction stores packed floating-point data from an -XMM register to memory, using a non-temporal hint. - -The SFENCE (Store Fence) instruction controls write ordering by creating a -fence for memory store operations. This instruction guarantees that the results -of every store instruction that precedes the store fence in program order is -globally visible before any store instruction that follows the fence. The -SFENCE instruction provides an efficient way of ensuring ordering between -procedures that produce weakly-ordered data and procedures that consume that -data. - -If you have questions please contact with me: Nickols_K <nic...@ma...>. -*/ - -/* 3dnow memcpy support from kernel 2.4.2 - by Pontscho/fresh!mindworkz */ - - /* for small memory blocks (<256 bytes) this version is faster */ +#ifdef __x86_64__ #define small_memcpy(to,from,n)\ {\ +register unsigned long int siz;\ register unsigned long int dummy;\ + siz=n&0x7; n>>=3;\ + if(siz)\ __asm__ __volatile__(\ "rep; movsb"\ :"=&D"(to), "=&S"(from), "=&c"(dummy)\ /* It's most portable way to notify compiler */\ /* that edi, esi and ecx are clobbered in asm block. */\ /* Thanks to A'rpi for hint!!! */\ + :"0" (to), "1" (from),"2" (siz)\ + : "memory","cc");\ + if(n)\ +__asm__ __volatile__(\ + "rep; movsq"\ + :"=&D"(to), "=&S"(from), "=&c"(dummy)\ +/* It's most portable way to notify compiler */\ +/* that edi, esi and ecx are clobbered in asm block. */\ +/* Thanks to A'rpi for hint!!! */\ :"0" (to), "1" (from),"2" (n)\ : "memory","cc");\ } +#else +#define small_memcpy(to,from,n)\ +{\ +register unsigned long int dummy;\ +__asm__ __volatile__(\ + "rep; movsb"\ + :"=&D"(to), "=&S"(from), "=&c"(dummy)\ +/* It's most portable way to notify compiler */\ +/* that edi, esi and ecx are clobbered in asm block. */\ +/* Thanks to A'rpi for hint!!! */\ + :"0" (to), "1" (from),"2" (n)\ + : "memory","cc");\ +} +#endif -#include "../mmx_defs.h" #undef MMREG_SIZE -#ifdef HAVE_SSE +#ifdef OPTIMIZE_SSE2 #define MMREG_SIZE 16 #else #define MMREG_SIZE 64 //8 #endif #undef MIN_LEN -#ifdef HAVE_MMX1 +#ifndef OPTIMIZE_MMX2 #define MIN_LEN 0x800 /* 2K blocks */ #else #define MIN_LEN 0x40 /* 64-byte blocks */ #endif -static inline void * RENAME(fast_memcpy)(void * to, const void * from, size_t len) +static inline void * RENAME(fast_memory_copy)(void * to, const void * from, size_t len,int final) { void *retval; const unsigned char *cfrom=from; unsigned char *tto=to; + const unsigned ivec_block_size = 8*__IVEC_SIZE; + __ivec iarr[8]; size_t i; retval = to; if(!len) return retval; @@ -114,45 +82,41 @@ MSG_V("freq < %8d %4d\n", 1<<i, freq[i]); } #endif -#ifndef HAVE_MMX1 - /* PREFETCH has effect even for MOVSB instruction ;) */ - __asm__ __volatile__ ( - PREFETCH" (%0)\n" + + _ivec_prefetch(cfrom); #if CL_SIZE == 32 - PREFETCH" 32(%0)\n" + _ivec_prefetch(&cfrom[32]); #endif #if CL_SIZE < 128 - PREFETCH" 64(%0)\n" + _ivec_prefetch(&cfrom[64]); #endif #if CL_SIZE == 32 - PREFETCH" 96(%0)\n" + _ivec_prefetch(&cfrom[96]); #endif - PREFETCH" 128(%0)\n" + _ivec_prefetch(&cfrom[128]); #if CL_SIZE == 32 - PREFETCH" 160(%0)\n" + _ivec_prefetch(&cfrom[160]); #endif #if CL_SIZE < 128 - PREFETCH" 192(%0)\n" + _ivec_prefetch(&cfrom[192]); #endif #if CL_SIZE == 32 - PREFETCH" 224(%0)\n" + _ivec_prefetch(&cfrom[224]); #endif - PREFETCH" 256(%0)\n" - : : "r" (cfrom) ); -#endif - if(len >= MIN_LEN) - { - register unsigned long int delta; - /* Align destinition to cache-line size -boundary */ - delta = ((unsigned long int)tto)&(CL_SIZE-1); - if(delta) - { + _ivec_prefetch(&cfrom[256]); + + if(len >= MIN_LEN) + { + register unsigned long int delta; + /* Align destinition to cache-line size -boundary */ + delta = ((unsigned long int)tto)&(CL_SIZE-1); + if(delta) { delta=MMREG_SIZE-delta; len -= delta; small_memcpy(tto, cfrom, delta); - } - i = len >> 6; /* len/64 */ - len&=63; + } + i = len/ivec_block_size; + len&=(ivec_block_size-1); /* This algorithm is top effective when the code consequently reads and writes blocks which have size of cache line. @@ -162,340 +126,73 @@ perform reading and writing to be multiple to a number of processor's decoders, but it's not always possible. */ -#ifdef HAVE_SSE /* Only P3 (may be Cyrix3) */ - if(((unsigned long)cfrom) & 15) - /* if SRC is misaligned */ for(; i>0; i--) { - __asm__ __volatile__ ( - PREFETCH" 320(%0)\n" + _ivec_prefetch(&cfrom[320]); #if CL_SIZE == 32 - PREFETCH" 352(%0)\n" + _ivec_prefetch(&cfrom[352]); #endif - "movups (%0), %%xmm0\n" - "movups 16(%0), %%xmm1\n" - "movups 32(%0), %%xmm2\n" - "movups 48(%0), %%xmm3\n" - "movntps %%xmm0, (%1)\n" - "movntps %%xmm1, 16(%1)\n" - "movntps %%xmm2, 32(%1)\n" - "movntps %%xmm3, 48(%1)\n" - :: "r" (cfrom), "r" (tto): - "memory" -#ifdef SSE_CLOBBERED - ,SSE_CLOBBERED -#endif - ); - cfrom+=64; - tto+=64; + if(((unsigned long)cfrom) & 15) { + /* if SRC is misaligned */ + iarr[0] = _ivec_loadu(&cfrom[__IVEC_SIZE*0]); + iarr[1] = _ivec_loadu(&cfrom[__IVEC_SIZE*1]); + iarr[2] = _ivec_loadu(&cfrom[__IVEC_SIZE*2]); + iarr[3] = _ivec_loadu(&cfrom[__IVEC_SIZE*3]); + iarr[4] = _ivec_loadu(&cfrom[__IVEC_SIZE*4]); + iarr[5] = _ivec_loadu(&cfrom[__IVEC_SIZE*5]); + iarr[6] = _ivec_loadu(&cfrom[__IVEC_SIZE*6]); + iarr[7] = _ivec_loadu(&cfrom[__IVEC_SIZE*7]); + } else { + iarr[0] = _ivec_loada(&cfrom[__IVEC_SIZE*0]); + iarr[1] = _ivec_loada(&cfrom[__IVEC_SIZE*1]); + iarr[2] = _ivec_loada(&cfrom[__IVEC_SIZE*2]); + iarr[3] = _ivec_loada(&cfrom[__IVEC_SIZE*3]); + iarr[4] = _ivec_loada(&cfrom[__IVEC_SIZE*4]); + iarr[5] = _ivec_loada(&cfrom[__IVEC_SIZE*5]); + iarr[6] = _ivec_loada(&cfrom[__IVEC_SIZE*6]); + iarr[7] = _ivec_loada(&cfrom[__IVEC_SIZE*7]); + } + if(final) { + _ivec_stream(&tto[__IVEC_SIZE*0],iarr[0]); + _ivec_stream(&tto[__IVEC_SIZE*1],iarr[1]); + _ivec_stream(&tto[__IVEC_SIZE*2],iarr[2]); + _ivec_stream(&tto[__IVEC_SIZE*3],iarr[3]); + _ivec_stream(&tto[__IVEC_SIZE*4],iarr[4]); + _ivec_stream(&tto[__IVEC_SIZE*5],iarr[5]); + _ivec_stream(&tto[__IVEC_SIZE*6],iarr[6]); + _ivec_stream(&tto[__IVEC_SIZE*7],iarr[7]); + } else { + _ivec_storea(&tto[__IVEC_SIZE*0],iarr[0]); + _ivec_storea(&tto[__IVEC_SIZE*1],iarr[1]); + _ivec_storea(&tto[__IVEC_SIZE*2],iarr[2]); + _ivec_storea(&tto[__IVEC_SIZE*3],iarr[3]); + _ivec_storea(&tto[__IVEC_SIZE*4],iarr[4]); + _ivec_storea(&tto[__IVEC_SIZE*5],iarr[5]); + _ivec_storea(&tto[__IVEC_SIZE*6],iarr[6]); + _ivec_storea(&tto[__IVEC_SIZE*7],iarr[7]); + } + cfrom+=ivec_block_size; + tto+=ivec_block_size; } - else - /* - Only if SRC is aligned on 16-byte boundary. - It allows to use movaps instead of movups, which required data - to be aligned or a general-protection exception (#GP) is generated. - */ - for(; i>0; i--) - { - __asm__ __volatile__ ( - PREFETCH" 320(%0)\n" -#if CL_SIZE == 32 - PREFETCH" 352(%0)\n" -#endif - "movaps (%0), %%xmm0\n" - "movaps 16(%0), %%xmm1\n" - "movaps 32(%0), %%xmm2\n" - "movaps 48(%0), %%xmm3\n" - "movntps %%xmm0, (%1)\n" - "movntps %%xmm1, 16(%1)\n" - "movntps %%xmm2, 32(%1)\n" - "movntps %%xmm3, 48(%1)\n" - :: "r" (cfrom), "r" (tto) - :"memory" -#ifdef SSE_CLOBBERED - ,SSE_CLOBBERED -#endif - ); - cfrom+=64; - tto+=64; - } -#else - // Align destination at BLOCK_SIZE boundary - for(; ((int)tto & (BLOCK_SIZE-1)) && i>0; i--) - { - __asm__ __volatile__ ( -#ifndef HAVE_MMX1 - PREFETCH" 320(%0)\n" -#if CL_SIZE == 32 - PREFETCH" 352(%0)\n" -#endif -#endif - "movq (%0), %%mm0\n" - "movq 8(%0), %%mm1\n" - "movq 16(%0), %%mm2\n" - "movq 24(%0), %%mm3\n" - "movq 32(%0), %%mm4\n" - "movq 40(%0), %%mm5\n" - "movq 48(%0), %%mm6\n" - "movq 56(%0), %%mm7\n" - MOVNTQ" %%mm0, (%1)\n" - MOVNTQ" %%mm1, 8(%1)\n" - MOVNTQ" %%mm2, 16(%1)\n" - MOVNTQ" %%mm3, 24(%1)\n" - MOVNTQ" %%mm4, 32(%1)\n" - MOVNTQ" %%mm5, 40(%1)\n" - MOVNTQ" %%mm6, 48(%1)\n" - MOVNTQ" %%mm7, 56(%1)\n" - :: "r" (cfrom), "r" (tto) - : "memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - cfrom+=64; - tto+=64; - } - - // Pure Assembly cuz gcc is a bit unpredictable ;) - if(i>=BLOCK_SIZE/64) - asm volatile( - "xorl %%"REG_a", %%"REG_a" \n\t" - ".balign 16 \n\t" - "1: \n\t" - "movl (%0, %%"REG_a"), %%"REG_b" \n\t" -#if CL_SIZE == 32 - "movl 32(%0, %%"REG_a"), %%"REG_b" \n\t" -#endif -#if CL_SIZE < 128 - "movl 64(%0, %%"REG_a"), %%"REG_b" \n\t" -#endif -#if CL_SIZE == 32 - "movl 96(%0, %%"REG_a"), %%"REG_b" \n\t" -#endif - "addl $128, %%"REG_a" \n\t" - "cmpl %3, %%"REG_a" \n\t" - " jb 1b \n\t" - - "xorl %%"REG_a", %%"REG_a" \n\t" - - ".balign 16 \n\t" - "2: \n\t" - "movq (%0, %%"REG_a"), %%mm0\n" - "movq 8(%0, %%"REG_a"), %%mm1\n" - "movq 16(%0, %%"REG_a"), %%mm2\n" - "movq 24(%0, %%"REG_a"), %%mm3\n" - "movq 32(%0, %%"REG_a"), %%mm4\n" - "movq 40(%0, %%"REG_a"), %%mm5\n" - "movq 48(%0, %%"REG_a"), %%mm6\n" - "movq 56(%0, %%"REG_a"), %%mm7\n" - MOVNTQ" %%mm0, (%1, %%"REG_a")\n" - MOVNTQ" %%mm1, 8(%1, %%"REG_a")\n" - MOVNTQ" %%mm2, 16(%1, %%"REG_a")\n" - MOVNTQ" %%mm3, 24(%1, %%"REG_a")\n" - MOVNTQ" %%mm4, 32(%1, %%"REG_a")\n" - MOVNTQ" %%mm5, 40(%1, %%"REG_a")\n" - MOVNTQ" %%mm6, 48(%1, %%"REG_a")\n" - MOVNTQ" %%mm7, 56(%1, %%"REG_a")\n" - "addl $64, %%"REG_a" \n\t" - "cmpl %3, %%"REG_a" \n\t" - "jb 2b \n\t" - -#if CONFUSION_FACTOR > 0 - // a few percent speedup on out of order executing CPUs - "movl %5, %%"REG_a" \n\t" - "2: \n\t" - "movl (%0), %%"REG_b" \n\t" - "movl (%0), %%"REG_b" \n\t" - "movl (%0), %%"REG_b" \n\t" - "movl (%0), %%"REG_b" \n\t" - "decl %%"REG_a" \n\t" - " jnz 2b \n\t" -#endif - - "xorl %%"REG_a", %%"REG_a" \n\t" - "addl %3, %0 \n\t" - "addl %3, %1 \n\t" - "subl %4, %2 \n\t" - "cmpl %4, %2 \n\t" - " jae 1b \n\t" - : "+r" (cfrom), "+r" (tto), "+r" (i) - : "r" (BLOCK_SIZE), "i" (BLOCK_SIZE/64), "i" (CONFUSION_FACTOR) - : "%"REG_a, "%"REG_b, "memory", "cc" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - - for(; i>0; i--) - { - __asm__ __volatile__ ( -#ifndef HAVE_MMX1 - PREFETCH" 320(%0)\n" -#if CL_SIZE == 32 - PREFETCH" 352(%0)\n" -#endif -#endif - "movq (%0), %%mm0\n" - "movq 8(%0), %%mm1\n" - "movq 16(%0), %%mm2\n" - "movq 24(%0), %%mm3\n" - "movq 32(%0), %%mm4\n" - "movq 40(%0), %%mm5\n" - "movq 48(%0), %%mm6\n" - "movq 56(%0), %%mm7\n" - MOVNTQ" %%mm0, (%1)\n" - MOVNTQ" %%mm1, 8(%1)\n" - MOVNTQ" %%mm2, 16(%1)\n" - MOVNTQ" %%mm3, 24(%1)\n" - MOVNTQ" %%mm4, 32(%1)\n" - MOVNTQ" %%mm5, 40(%1)\n" - MOVNTQ" %%mm6, 48(%1)\n" - MOVNTQ" %%mm7, 56(%1)\n" - :: "r" (cfrom), "r" (tto) - : "memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - cfrom+=64; - tto+=64; - } - -#endif /* Have SSE */ -#ifdef HAVE_MMX2 - /* since movntq is weakly-ordered, a "sfence" - * is needed to become ordered again. */ - __asm__ __volatile__ ("sfence":::"memory"); -#endif -#ifndef HAVE_SSE - /* enables to use FPU */ - __asm__ __volatile__ (EMMS:: - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#endif - } - /* - * Now do the tail of the block - */ - if(len) small_memcpy(tto, cfrom, len); - return retval; + _ivec_sfence(); + _ivec_empty(); + } + /* + * Now do the tail of the block + */ + if(len) small_memcpy(tto, cfrom, len); + return retval; } /** * special copy routine for mem -> agp/pci copy (based upon fast_memcpy) */ -static inline void * RENAME(mem2agpcpy)(void * to, const void * from, size_t len) +static inline void * RENAME(fast_memcpy)(void * to, const void * from, size_t len) { - void *retval; - const unsigned char *cfrom=from; - unsigned char *tto=to; - size_t i; - retval = to; - if(!len) return retval; -#ifdef STATISTICS - { - static int freq[33]; - static int t=0; - int i; - for(i=0; len>(1<<i); i++); - freq[i]++; - t++; - if(1024*1024*1024 % t == 0) - for(i=0; i<32; i++) - MSG_V("mem2agp freq < %8d %4d\n", 1<<i, freq[i]); - } -#endif - if(len >= MIN_LEN) - { - register unsigned long int delta; - /* Align destinition to cache-line size -boundary */ - delta = ((unsigned long int)tto)&(CL_SIZE-1); - if(delta) - { - delta=8-delta; - len -= delta; - small_memcpy(tto, cfrom, delta); - } - i = len >> 6; /* len/64 */ - len &= 63; - /* - This algorithm is top effective when the code consequently - reads and writes blocks which have size of cache line. - Size of cache line is processor-dependent. - It will, however, be a minimum of 32 bytes on any processors. - It would be better to have a number of instructions which - perform reading and writing to be multiple to a number of - processor's decoders, but it's not always possible. - */ - for(; i>0; i--) - { - __asm__ __volatile__ ( - PREFETCH" 320(%0)\n" -#if CL_SIZE == 32 - PREFETCH" 352(%0)\n" -#endif - "movq (%0), %%mm0\n" - "movq 8(%0), %%mm1\n" - "movq 16(%0), %%mm2\n" - "movq 24(%0), %%mm3\n" - "movq 32(%0), %%mm4\n" - "movq 40(%0), %%mm5\n" - "movq 48(%0), %%mm6\n" - "movq 56(%0), %%mm7\n" - MOVNTQ" %%mm0, (%1)\n" - MOVNTQ" %%mm1, 8(%1)\n" - MOVNTQ" %%mm2, 16(%1)\n" - MOVNTQ" %%mm3, 24(%1)\n" - MOVNTQ" %%mm4, 32(%1)\n" - MOVNTQ" %%mm5, 40(%1)\n" - MOVNTQ" %%mm6, 48(%1)\n" - MOVNTQ" %%mm7, 56(%1)\n" - :: "r" (cfrom), "r" (tto) - : "memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - cfrom+=64; - tto+=64; - } -#ifdef HAVE_MMX2 - /* since movntq is weakly-ordered, a "sfence" - * is needed to become ordered again. */ - __asm__ __volatile__ ("sfence":::"memory"); -#endif - /* enables to use FPU */ - __asm__ __volatile__ (EMMS:: - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - } - /* - * Now do the tail of the block - */ - if(len) small_memcpy(tto, cfrom, len); - return retval; + return RENAME(fast_memory_copy)(to,from,len,0); } + +static inline void * RENAME(fast_stream_copy)(void * to, const void * from, size_t len) +{ + return RENAME(fast_memory_copy)(to,from,len,1); +} Deleted: mplayerxp/libvo/aclib_x86_64.h =================================================================== --- mplayerxp/libvo/aclib_x86_64.h 2010-01-17 18:46:44 UTC (rev 106) +++ mplayerxp/libvo/aclib_x86_64.h 2010-01-18 15:55:23 UTC (rev 107) @@ -1,191 +0,0 @@ -/* - aclib - advanced C library ;) - This file contains functions which improve and expand standard C-library -*/ - -/* for small memory blocks (<256 bytes) this version is faster */ -#define small_memcpy(to,from,n)\ -{\ -register unsigned long int siz;\ -register unsigned long int dummy;\ - siz=n&0x7; n>>=3;\ - if(siz)\ -__asm__ __volatile__(\ - "rep; movsb"\ - :"=&D"(to), "=&S"(from), "=&c"(dummy)\ -/* It's most portable way to notify compiler */\ -/* that edi, esi and ecx are clobbered in asm block. */\ -/* Thanks to A'rpi for hint!!! */\ - :"0" (to), "1" (from),"2" (siz)\ - : "memory","cc");\ - if(n)\ -__asm__ __volatile__(\ - "rep; movsq"\ - :"=&D"(to), "=&S"(from), "=&c"(dummy)\ -/* It's most portable way to notify compiler */\ -/* that edi, esi and ecx are clobbered in asm block. */\ -/* Thanks to A'rpi for hint!!! */\ - :"0" (to), "1" (from),"2" (n)\ - : "memory","cc");\ -} - - -#define MMREG_SIZE 16ULL -#define MIN_LEN 257ULL -#define CL_SIZE 256ULL /*always align on 256 byte boundary */ - -static inline void * RENAME(fast_memcpy)(void * to, const void * from, size_t len) -{ - void *retval; - const unsigned char *cfrom=from; - unsigned char *tto=to; - size_t i=0; - retval = to; - if(!len) return retval; - /* PREFETCH has effect even for MOVSB instruction ;) */ - __asm__ __volatile__ ( - "prefetcht0 (%0)\n" - "prefetcht0 64(%0)\n" - "prefetcht0 128(%0)\n" - "prefetcht0 192(%0)\n" - :: "r" (cfrom)); - if(len >= MIN_LEN) - { - register unsigned long int delta; - /* Align destinition to cache-line size -boundary */ - delta = ((unsigned long int)tto)&(CL_SIZE-1ULL); - if(delta) - { - delta=CL_SIZE-delta; - len -=delta; - small_memcpy(tto, cfrom, delta); - } - i = len>>8; /* len/256 */ - len=len-(i<<8); - } - if(i) { - /* - This algorithm is top effective when the code consequently - reads and writes blocks which have size of cache line. - Size of cache line is processor-dependent. - It will, however, be a minimum of 32 bytes on any processors. - It would be better to have a number of instructions which - perform reading and writing to be multiple to a number of - processor's decoders, but it's not always possible. - */ - if(((unsigned long)cfrom) & 15) - /* if SRC is misaligned */ - for(; i>0; i--) - { - __asm__ __volatile__ ( - "prefetcht0 256(%0)\n" - "prefetcht0 320(%0)\n" - "movdqu (%0), %%xmm0\n" - "movdqu 16(%0), %%xmm1\n" - "movdqu 32(%0), %%xmm2\n" - "movdqu 48(%0), %%xmm3\n" - "movdqu 64(%0), %%xmm4\n" - "movdqu 80(%0), %%xmm5\n" - "movdqu 96(%0), %%xmm6\n" - "movdqu 112(%0), %%xmm7\n" - "prefetcht0 384(%0)\n" - "prefetcht0 448(%0)\n" - "movdqu 128(%0), %%xmm8\n" - "movdqu 144(%0), %%xmm9\n" - "movdqu 160(%0), %%xmm10\n" - "movdqu 176(%0), %%xmm11\n" - "movdqu 192(%0), %%xmm12\n" - "movdqu 208(%0), %%xmm13\n" - "movdqu 224(%0), %%xmm14\n" - "movdqu 240(%0), %%xmm15\n" - "movntdq %%xmm0, (%1)\n" - "movntdq %%xmm1, 16(%1)\n" - "movntdq %%xmm2, 32(%1)\n" - "movntdq %%xmm3, 48(%1)\n" - "movntdq %%xmm4, 64(%1)\n" - "movntdq %%xmm5, 80(%1)\n" - "movntdq %%xmm6, 96(%1)\n" - "movntdq %%xmm7, 112(%1)\n" - "movntdq %%xmm8, 128(%1)\n" - "movntdq %%xmm9, 144(%1)\n" - "movntdq %%xmm10, 160(%1)\n" - "movntdq %%xmm11, 176(%1)\n" - "movntdq %%xmm12, 192(%1)\n" - "movntdq %%xmm13, 208(%1)\n" - "movntdq %%xmm14, 224(%1)\n" - "movntdq %%xmm15, 240(%1)\n" - :: "r" (cfrom), "r" (tto): - "memory" - ,"xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7","xmm8","xmm9","xmm10","xmm11","xmm12","xmm13","xmm14","xmm15" - ); - cfrom+=256ULL; - tto+=256ULL; - } - else - /* - Only if SRC is aligned on 16-byte boundary. - It allows to use movdqa instead of movdqu, which required data - to be aligned or a general-protection exception (#GP) is generated. - */ - for(; i>0; i--) - { - __asm__ __volatile__ ( - "prefetcht0 256(%0)\n" - "prefetcht0 320(%0)\n" - "movdqa (%0), %%xmm0\n" - "movdqa 16(%0), %%xmm1\n" - "movdqa 32(%0), %%xmm2\n" - "movdqa 48(%0), %%xmm3\n" - "movdqa 64(%0), %%xmm4\n" - "movdqa 80(%0), %%xmm5\n" - "movdqa 96(%0), %%xmm6\n" - "movdqa 112(%0), %%xmm7\n" - "prefetcht0 384(%0)\n" - "prefetcht0 448(%0)\n" - "movdqa 128(%0), %%xmm8\n" - "movdqa 144(%0), %%xmm9\n" - "movdqa 160(%0), %%xmm10\n" - "movdqa 176(%0), %%xmm11\n" - "movdqa 192(%0), %%xmm12\n" - "movdqa 208(%0), %%xmm13\n" - "movdqa 224(%0), %%xmm14\n" - "movdqa 240(%0), %%xmm15\n" - "movntdq %%xmm0, (%1)\n" - "movntdq %%xmm1, 16(%1)\n" - "movntdq %%xmm2, 32(%1)\n" - "movntdq %%xmm3, 48(%1)\n" - "movntdq %%xmm4, 64(%1)\n" - "movntdq %%xmm5, 80(%1)\n" - "movntdq %%xmm6, 96(%1)\n" - "movntdq %%xmm7, 112(%1)\n" - "movntdq %%xmm8, 128(%1)\n" - "movntdq %%xmm9, 144(%1)\n" - "movntdq %%xmm10, 160(%1)\n" - "movntdq %%xmm11, 176(%1)\n" - "movntdq %%xmm12, 192(%1)\n" - "movntdq %%xmm13, 208(%1)\n" - "movntdq %%xmm14, 224(%1)\n" - "movntdq %%xmm15, 240(%1)\n" - :: "r" (cfrom), "r" (tto): - "memory" - ,"xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7","xmm8","xmm9","xmm10","xmm11","xmm12","xmm13","xmm14","xmm15" - ); - cfrom+=256ULL; - tto+=256ULL; - } - __asm__ __volatile__ ("sfence":::"memory"); - } - /* - * Now do the tail of the block - */ - if(len) small_memcpy(tto, cfrom, len); - return retval; -} - -/** - * special copy routine for mem -> agp/pci copy (based upon fast_memcpy) - */ -static inline void * RENAME(mem2agpcpy)(void * to, const void * from, size_t len) -{ - return memcpy(to,from,len); -} Modified: mplayerxp/libvo/dri_vo.h =================================================================== --- mplayerxp/libvo/dri_vo.h 2010-01-17 18:46:44 UTC (rev 106) +++ mplayerxp/libvo/dri_vo.h 2010-01-18 15:55:23 UTC (rev 107) @@ -20,6 +20,7 @@ #define DRI_CAP_HORZSCALER 0x00000040UL /**< Driver supports horizontal scaling */ #define DRI_CAP_VERTSCALER 0x00000080UL /**< Driver supports vertical scaling */ #define DRI_CAP_HWOSD 0x00000100UL /**< Driver supports OSD painting */ +#define DRI_CAP_BUSMASTERING 0x80000000UL /**< Means: final video buffer but allocated in RAM */ typedef struct dri_surface_cap_s { Modified: mplayerxp/libvo/fastmemcpy.h =================================================================== --- mplayerxp/libvo/fastmemcpy.h 2010-01-17 18:46:44 UTC (rev 106) +++ mplayerxp/libvo/fastmemcpy.h 2010-01-18 15:55:23 UTC (rev 107) @@ -7,24 +7,24 @@ #include <stddef.h> #include <string.h> /* memcpy prototypes */ extern void * (*fast_memcpy_ptr)(void * to, const void * from, size_t len); -extern void * (*mem2agpcpy_ptr)(void * to, const void * from, size_t len); +extern void * (*fast_stream_copy_ptr)(void * to, const void * from, size_t len); #define memcpy(a,b,c) (*fast_memcpy_ptr)(a,b,c) -#define mem2agpcpy(a,b,c) (*mem2agpcpy_ptr)(a,b,c) +#define stream_copy(a,b,c) (*fast_stream_copy_ptr)(a,b,c) #else -#define mem2agpcpy(a,b,c) memcpy(a,b,c) +#define stream_copy(a,b,c) memcpy(a,b,c) #endif -static inline void * mem2agpcpy_pic(void * dst, const void * src, int bytesPerLine, int height, int dstStride, int srcStride) +static inline void * stream_copy_pic(void * dst, const void * src, int bytesPerLine, int height, int dstStride, int srcStride) { int i; void *retval=dst; - if(dstStride == srcStride) mem2agpcpy(dst, src, srcStride*height); + if(dstStride == srcStride) stream_copy(dst, src, srcStride*height); else { for(i=0; i<height; i++) { - mem2agpcpy(dst, src, bytesPerLine); + stream_copy(dst, src, bytesPerLine); src+= srcStride; dst+= dstStride; } Modified: mplayerxp/libvo/osd.c =================================================================== --- mplayerxp/libvo/osd.c 2010-01-17 18:46:44 UTC (rev 106) +++ mplayerxp/libvo/osd.c 2010-01-18 15:55:23 UTC (rev 107) @@ -73,7 +73,7 @@ static unsigned short fast_osd_16bpp_table[256]; #endif -static void __FASTCALL__ vo_draw_alpha_rgb15_C(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ +static void __FASTCALL__ vo_draw_alpha_rgb15_C(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ int y; for(y=0;y<h;y++){ register unsigned short *dst = (unsigned short*) dstbase; @@ -105,7 +105,7 @@ return; } -static void __FASTCALL__ vo_draw_alpha_rgb16_C(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ +static void __FASTCALL__ vo_draw_alpha_rgb16_C(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ int y; for(y=0;y<h;y++){ register unsigned short *dst = (unsigned short*) dstbase; @@ -136,8 +136,8 @@ return; } -static void __FASTCALL__ vo_draw_alpha_uyvy_C(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ - (*vo_draw_alpha_yuy2_ptr)(w,h,src,srca,srcstride,dstbase+1,dststride); +static void __FASTCALL__ vo_draw_alpha_uyvy_C(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ + (*vo_draw_alpha_yuy2_ptr)(w,h,src,srca,srcstride,dstbase+1,dststride,finalize); } draw_alpha_f vo_draw_alpha_yv12_ptr=NULL; Modified: mplayerxp/libvo/osd.h =================================================================== --- mplayerxp/libvo/osd.h 2010-01-17 18:46:44 UTC (rev 106) +++ mplayerxp/libvo/osd.h 2010-01-18 15:55:23 UTC (rev 107) @@ -6,7 +6,7 @@ extern void vo_draw_alpha_init( void ); /* build tables */ -typedef void (* __FASTCALL__ draw_alpha_f)(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride); +typedef void (* __FASTCALL__ draw_alpha_f)(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize); extern draw_alpha_f vo_draw_alpha_yv12_ptr; extern draw_alpha_f vo_draw_alpha_yuy2_ptr; @@ -15,11 +15,11 @@ extern draw_alpha_f vo_draw_alpha_rgb32_ptr; extern draw_alpha_f vo_draw_alpha_rgb15_ptr; extern draw_alpha_f vo_draw_alpha_rgb16_ptr; -#define vo_draw_alpha_yv12(w,h,src,srca,srcstride,dstbase,dstrstride) (*vo_draw_alpha_yv12_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride) -#define vo_draw_alpha_yuy2(w,h,src,srca,srcstride,dstbase,dstrstride) (*vo_draw_alpha_yuy2_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride) -#define vo_draw_alpha_uyvy(w,h,src,srca,srcstride,dstbase,dstrstride) (*vo_draw_alpha_uyvy_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride) -#define vo_draw_alpha_rgb24(w,h,src,srca,srcstride,dstbase,dstrstride) (*vo_draw_alpha_rgb24_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride) -#define vo_draw_alpha_rgb32(w,h,src,srca,srcstride,dstbase,dstrstride) (*vo_draw_alpha_rgb32_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride) -#define vo_draw_alpha_rgb15(w,h,src,srca,srcstride,dstbase,dstrstride) (*vo_draw_alpha_rgb15_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride) -#define vo_draw_alpha_rgb16(w,h,src,srca,srcstride,dstbase,dstrstride) (*vo_draw_alpha_rgb16_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride) +#define vo_draw_alpha_yv12(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) (*vo_draw_alpha_yv12_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) +#define vo_draw_alpha_yuy2(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) (*vo_draw_alpha_yuy2_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) +#define vo_draw_alpha_uyvy(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) (*vo_draw_alpha_uyvy_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) +#define vo_draw_alpha_rgb24(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) (*vo_draw_alpha_rgb24_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) +#define vo_draw_alpha_rgb32(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) (*vo_draw_alpha_rgb32_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) +#define vo_draw_alpha_rgb15(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) (*vo_draw_alpha_rgb15_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) +#define vo_draw_alpha_rgb16(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) (*vo_draw_alpha_rgb16_ptr)(w,h,src,srca,srcstride,dstbase,dstrstride,finalize) #endif Modified: mplayerxp/libvo/osd_template.c =================================================================== --- mplayerxp/libvo/osd_template.c 2010-01-17 18:46:44 UTC (rev 106) +++ mplayerxp/libvo/osd_template.c 2010-01-18 15:55:23 UTC (rev 107) @@ -50,7 +50,7 @@ #endif -static inline void RENAME(vo_draw_alpha_yv12)(int w,int h,const unsigned char* src,const unsig... [truncated message content] |
From: <nic...@us...> - 2010-01-19 18:20:16
|
Revision: 113 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=113&view=rev Author: nickols_k Date: 2010-01-19 18:20:08 +0000 (Tue, 19 Jan 2010) Log Message: ----------- minor speedup due eliminating of debug-depended printfs from RELEASE compilation Modified Paths: -------------- mplayerxp/__mp_msg.h mplayerxp/codec-cfg.c mplayerxp/configure mplayerxp/input/in_msg.h mplayerxp/libao2/ao_msg.h mplayerxp/libmpcodecs/ad_msg.h mplayerxp/libmpcodecs/vd_msg.h mplayerxp/libmpdemux/demux_msg.h mplayerxp/libvo/vo_msg.h mplayerxp/nls/nls_msg.h mplayerxp/osdep/osdep_msg.h mplayerxp/postproc/pp_msg.h mplayerxp/subopt-helper.c Modified: mplayerxp/__mp_msg.h =================================================================== --- mplayerxp/__mp_msg.h 2010-01-19 17:51:18 UTC (rev 112) +++ mplayerxp/__mp_msg.h 2010-01-19 18:20:08 UTC (rev 113) @@ -19,7 +19,7 @@ #define MSG_OK(args...) mp_msg(MSGT_CLASS,MSGL_OK,__FILE__,__LINE__,##args ) #define MSG_HINT(args...) mp_msg(MSGT_CLASS,MSGL_HINT,__FILE__,__LINE__,##args ) #define MSG_STATUS(args...) mp_msg(MSGT_CLASS,MSGL_STATUS,__FILE__,__LINE__,##args ) -#ifndef NDEBUG +#ifdef MP_DEBUG #define MSG_DBG2(args...) mp_msg(MSGT_CLASS,MSGL_DBG2,__FILE__,__LINE__,##args ) #define MSG_DBG3(args...) mp_msg(MSGT_CLASS,MSGL_DBG3,__FILE__,__LINE__,##args ) #else Modified: mplayerxp/codec-cfg.c =================================================================== --- mplayerxp/codec-cfg.c 2010-01-19 17:51:18 UTC (rev 112) +++ mplayerxp/codec-cfg.c 2010-01-19 18:20:08 UTC (rev 113) @@ -9,11 +9,6 @@ * TODO: implement informat in CODECS2HTML too */ -#define DEBUG - -//disable asserts -#define NDEBUG - #include <stdio.h> #include <stdlib.h> #include <fcntl.h> Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2010-01-19 17:51:18 UTC (rev 112) +++ mplayerxp/configure 2010-01-19 18:20:08 UTC (rev 113) @@ -758,7 +758,7 @@ # (FIXME: 'echocheck "dynamic linking"' above and modify here accordingly) bsd && add_ldflags "-rdynamic" -test "$debug" && def_debug='#define MP_DEBUG 1' || def_debug='#undef MP_DEBUG' +test "$debug" != "0" && def_debug='#define MP_DEBUG 1' || def_debug='#undef MP_DEBUG' # Checking for VIDIX enabled vidix && require2 vidix vidix/vidixlib.h vdlAllocFourccS -lvidix Modified: mplayerxp/input/in_msg.h =================================================================== --- mplayerxp/input/in_msg.h 2010-01-19 17:51:18 UTC (rev 112) +++ mplayerxp/input/in_msg.h 2010-01-19 18:20:08 UTC (rev 113) @@ -18,7 +18,7 @@ #define MSG_V(args...) mp_msg(MSGT_INPUT,MSGL_V,__FILE__,__LINE__, ##args ) #define MSG_OK(args...) mp_msg(MSGT_INPUT,MSGL_OK,__FILE__,__LINE__, ##args ) #define MSG_HINT(args...) mp_msg(MSGT_INPUT,MSGL_HINT,__FILE__,__LINE__, ##args ) -#ifndef NDEBUG +#ifdef MP_DEBUG #define MSG_DBG2(args...) mp_msg(MSGT_INPUT,MSGL_DBG2,__FILE__,__LINE__, ##args ) #define MSG_DBG3(args...) mp_msg(MSGT_INPUT,MSGL_DBG3,__FILE__,__LINE__, ##args ) #else Modified: mplayerxp/libao2/ao_msg.h =================================================================== --- mplayerxp/libao2/ao_msg.h 2010-01-19 17:51:18 UTC (rev 112) +++ mplayerxp/libao2/ao_msg.h 2010-01-19 18:20:08 UTC (rev 113) @@ -18,7 +18,7 @@ #define MSG_V(args...) mp_msg(MSGT_AO,MSGL_V,__FILE__,__LINE__, ##args ) #define MSG_OK(args...) mp_msg(MSGT_AO,MSGL_OK,__FILE__,__LINE__, ##args ) #define MSG_HINT(args...) mp_msg(MSGT_AO,MSGL_HINT,__FILE__,__LINE__, ##args ) -#ifndef NDEBUG +#ifdef MP_DEBUG #define MSG_DBG2(args...) mp_msg(MSGT_AO,MSGL_DBG2,__FILE__,__LINE__, ##args ) #define MSG_DBG3(args...) mp_msg(MSGT_AO,MSGL_DBG3,__FILE__,__LINE__, ##args ) #else Modified: mplayerxp/libmpcodecs/ad_msg.h =================================================================== --- mplayerxp/libmpcodecs/ad_msg.h 2010-01-19 17:51:18 UTC (rev 112) +++ mplayerxp/libmpcodecs/ad_msg.h 2010-01-19 18:20:08 UTC (rev 113) @@ -16,7 +16,7 @@ #define MSG_V(args...) mp_msg(MSGT_DECAUDIO,MSGL_V,__FILE__,__LINE__, ##args ) #define MSG_OK(args...) mp_msg(MSGT_DECAUDIO,MSGL_OK,__FILE__,__LINE__, ##args ) #define MSG_HINT(args...) mp_msg(MSGT_DECAUDIO,MSGL_HINT,__FILE__,__LINE__, ##args ) -#ifndef NDEBUG +#ifdef MP_DEBUG #define MSG_DBG2(args...) mp_msg(MSGT_DECAUDIO,MSGL_DBG2,__FILE__,__LINE__, ##args ) #define MSG_DBG3(args...) mp_msg(MSGT_DECAUDIO,MSGL_DBG3,__FILE__,__LINE__, ##args ) #else Modified: mplayerxp/libmpcodecs/vd_msg.h =================================================================== --- mplayerxp/libmpcodecs/vd_msg.h 2010-01-19 17:51:18 UTC (rev 112) +++ mplayerxp/libmpcodecs/vd_msg.h 2010-01-19 18:20:08 UTC (rev 113) @@ -16,7 +16,7 @@ #define MSG_V(args...) mp_msg(MSGT_DECVIDEO,MSGL_V,__FILE__,__LINE__, ##args ) #define MSG_OK(args...) mp_msg(MSGT_DECVIDEO,MSGL_OK,__FILE__,__LINE__, ##args ) #define MSG_HINT(args...) mp_msg(MSGT_DECVIDEO,MSGL_HINT,__FILE__,__LINE__, ##args ) -#ifndef NDEBUG +#ifdef MP_DEBUG #define MSG_DBG2(args...) mp_msg(MSGT_DECVIDEO,MSGL_DBG2,__FILE__,__LINE__, ##args ) #define MSG_DBG3(args...) mp_msg(MSGT_DECVIDEO,MSGL_DBG3,__FILE__,__LINE__, ##args ) #else Modified: mplayerxp/libmpdemux/demux_msg.h =================================================================== --- mplayerxp/libmpdemux/demux_msg.h 2010-01-19 17:51:18 UTC (rev 112) +++ mplayerxp/libmpdemux/demux_msg.h 2010-01-19 18:20:08 UTC (rev 113) @@ -19,7 +19,7 @@ #define MSG_OK(args...) mp_msg(MSGT_DEMUXER,MSGL_OK,__FILE__,__LINE__,##args ) #define MSG_HINT(args...) mp_msg(MSGT_DEMUXER,MSGL_HINT,__FILE__,__LINE__,##args ) #define MSG_STATUS(args...) mp_msg(MSGT_DEMUXER,MSGL_STATUS,__FILE__,__LINE__,##args ) -#ifndef NDEBUG +#ifdef MP_DEBUG #define MSG_DBG2(args...) mp_msg(MSGT_DEMUXER,MSGL_DBG2,__FILE__,__LINE__,##args ) #define MSG_DBG3(args...) mp_msg(MSGT_DEMUXER,MSGL_DBG3,__FILE__,__LINE__,##args ) #else Modified: mplayerxp/libvo/vo_msg.h =================================================================== --- mplayerxp/libvo/vo_msg.h 2010-01-19 17:51:18 UTC (rev 112) +++ mplayerxp/libvo/vo_msg.h 2010-01-19 18:20:08 UTC (rev 113) @@ -18,7 +18,7 @@ #define MSG_V(args...) mp_msg(MSGT_VO,MSGL_V,__FILE__,__LINE__, ##args ) #define MSG_OK(args...) mp_msg(MSGT_VO,MSGL_OK,__FILE__,__LINE__, ##args ) #define MSG_HINT(args...) mp_msg(MSGT_VO,MSGL_HINT,__FILE__,__LINE__, ##args ) -#ifndef NDEBUG +#ifdef MP_DEBUG #define MSG_DBG2(args...) mp_msg(MSGT_VO,MSGL_DBG2,__FILE__,__LINE__, ##args ) #define MSG_DBG3(args...) mp_msg(MSGT_VO,MSGL_DBG3,__FILE__,__LINE__, ##args ) #else Modified: mplayerxp/nls/nls_msg.h =================================================================== --- mplayerxp/nls/nls_msg.h 2010-01-19 17:51:18 UTC (rev 112) +++ mplayerxp/nls/nls_msg.h 2010-01-19 18:20:08 UTC (rev 113) @@ -19,7 +19,7 @@ #define MSG_OK(args...) mp_msg(MSGT_NLS,MSGL_OK,__FILE__,__LINE__,##args ) #define MSG_HINT(args...) mp_msg(MSGT_NLS,MSGL_HINT,__FILE__,__LINE__,##args ) #define MSG_STATUS(args...) mp_msg(MSGT_NLS,MSGL_STATUS,__FILE__,__LINE__,##args ) -#ifndef NDEBUG +#ifdef MP_DEBUG #define MSG_DBG2(args...) mp_msg(MSGT_NLS,MSGL_DBG2,__FILE__,__LINE__,##args ) #define MSG_DBG3(args...) mp_msg(MSGT_NLS,MSGL_DBG3,__FILE__,__LINE__,##args ) #else Modified: mplayerxp/osdep/osdep_msg.h =================================================================== --- mplayerxp/osdep/osdep_msg.h 2010-01-19 17:51:18 UTC (rev 112) +++ mplayerxp/osdep/osdep_msg.h 2010-01-19 18:20:08 UTC (rev 113) @@ -18,7 +18,7 @@ #define MSG_V(args...) mp_msg(MSGT_OSDEP,MSGL_V,__FILE__,__LINE__, ##args ) #define MSG_OK(args...) mp_msg(MSGT_OSDEP,MSGL_OK,__FILE__,__LINE__, ##args ) #define MSG_HINT(args...) mp_msg(MSGT_OSDEP,MSGL_HINT,__FILE__,__LINE__, ##args ) -#ifndef NDEBUG +#ifdef MP_DEBUG #define MSG_DBG2(args...) mp_msg(MSGT_OSDEP,MSGL_DBG2,__FILE__,__LINE__, ##args ) #define MSG_DBG3(args...) mp_msg(MSGT_OSDEP,MSGL_DBG3,__FILE__,__LINE__, ##args ) #else Modified: mplayerxp/postproc/pp_msg.h =================================================================== --- mplayerxp/postproc/pp_msg.h 2010-01-19 17:51:18 UTC (rev 112) +++ mplayerxp/postproc/pp_msg.h 2010-01-19 18:20:08 UTC (rev 113) @@ -18,7 +18,7 @@ #define MSG_V(args...) mp_msg(MSGT_PP,MSGL_V,__FILE__,__LINE__, ##args ) #define MSG_OK(args...) mp_msg(MSGT_PP,MSGL_OK,__FILE__,__LINE__, ##args ) #define MSG_HINT(args...) mp_msg(MSGT_PP,MSGL_HINT,__FILE__,__LINE__, ##args ) -#ifndef NDEBUG +#ifdef MP_DEBUG #define MSG_DBG2(args...) mp_msg(MSGT_PP,MSGL_DBG2,__FILE__,__LINE__, ##args ) #define MSG_DBG3(args...) mp_msg(MSGT_PP,MSGL_DBG3,__FILE__,__LINE__, ##args ) #else Modified: mplayerxp/subopt-helper.c =================================================================== --- mplayerxp/subopt-helper.c 2010-01-19 17:51:18 UTC (rev 112) +++ mplayerxp/subopt-helper.c 2010-01-19 18:20:08 UTC (rev 113) @@ -26,7 +26,7 @@ #include "__mp_msg.h" -#ifndef MPDEBUG +#ifndef MP_DEBUG #define NDEBUG #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2010-01-23 13:25:36
|
Revision: 120 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=120&view=rev Author: nickols_k Date: 2010-01-23 13:25:30 +0000 (Sat, 23 Jan 2010) Log Message: ----------- cleanups Modified Paths: -------------- NEWS functions mplayerxp/configure mplayerxp/pvector/pvector_f32_x86.h mplayerxp/sig_hand.c Modified: NEWS =================================================================== --- NEWS 2010-01-22 16:43:32 UTC (rev 119) +++ NEWS 2010-01-23 13:25:30 UTC (rev 120) @@ -2,8 +2,9 @@ Version 0.8 -* significand acceleration of playback. Now it can scale 640x480->2000x1500 at 25 FPS in real-time without - framedropping with using of non-accelerated '-vo x11' driver on Quad-Core AMD Phenom-9550 running at 2.2GHz +* significand acceleration of playback. Now 64-bit version can scale 640x480 up to 2000x1500+ at 25 FPS + in real-time without framedropping with using of non-accelerated '-vo x11' driver + on Quad-Core AMD Phenom-9550 running at 2.2GHz * project migrated from CVS on SVN * Redesigned internal architecture of the player (now it being building statically with all internal libs) * new configure script Modified: functions =================================================================== --- functions 2010-01-22 16:43:32 UTC (rev 119) +++ functions 2010-01-23 13:25:30 UTC (rev 120) @@ -1149,45 +1149,26 @@ #check_cflags "-fno-tree-vectorize" disable mmx_test -x86_32 && enable mmx_test -def_mmx= -def_mmx2= -def_3dnow= -def_3dnow2= -def_sse= -def_sse2= -def_sse3= -def_ssse3= -def_sse3= -def_avx= +x86 && enable mmx_test + if enabled mmx_test ; then -check_cflags -mmmx && def_mmx='#define CAN_COMPILE_MMX 1' -check_cflags -m3dnow && def_3dnow='#define CAN_COMPILE_3DNOW 1' -check_cflags -msse && def_sse='#define CAN_COMPILE_SSE 1' -check_cflags -msse2 && def_sse2='#define CAN_COMPILE_SSE2 1' -check_cflags -msse3 && def_sse3='#define CAN_COMPILE_SSE3 1' -check_cflags -mssse3 && def_ssse3='#define CAN_COMPILE_SSSE3 1' -check_cflags -msse4 && def_sse4='#define CAN_COMPILE_SSE4 1' -check_cflags -mavx && def_avx='#define CAN_COMPILE_AVX 1' +check_cflags -mmmx +check_cflags -m3dnow +check_cflags -msse +check_cflags -msse2 +check_cflags -msse3 +check_cflags -mssse3 +check_cflags -msse4 +check_cflags -mpclmul +check_cflags -maes +check_cflags -mavx fpu_clob='#define FPU_CLOBBERED "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)"' mmx_clob='#define MMX_CLOBBERED "mm0","mm1","mm2","mm3","mm4","mm5","mm6","mm7"' sse_clob='#define SSE_CLOBBERED "xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7"' fi -if test -n "$def_3dnow" || test -n "$def_sse" ; then -def_mmx2='#define CAN_COMPILE_MMX2 1' -fi cat >> $config_h << EOF /* Extension defines */ -$def_mmx -$def_mmx2 -$def_3dnow -$def_sse -$def_sse2 -$def_sse3 -$def_ssse3 -$def_sse4 -$def_avx $fpu_clob $mmx_clob $sse_clob Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2010-01-22 16:43:32 UTC (rev 119) +++ mplayerxp/configure 2010-01-23 13:25:30 UTC (rev 120) @@ -358,7 +358,7 @@ ffmpeg_args="--enable-static --disable-shared --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-postproc --enable-gpl --enable-pthreads" if test -n $host ; then _arch=$host_arch -x86_32 && _arch="x86_32" +x86_32 && _arch="i686" x86_64 && _arch="x86_64" ffmpeg_args="--arch=$_arch $ffmpeg_args" fi Modified: mplayerxp/pvector/pvector_f32_x86.h =================================================================== --- mplayerxp/pvector/pvector_f32_x86.h 2010-01-22 16:43:32 UTC (rev 119) +++ mplayerxp/pvector/pvector_f32_x86.h 2010-01-23 13:25:30 UTC (rev 120) @@ -174,9 +174,9 @@ PVECTOR_RENAME(f32_to_s32u)(void *dst,__f32vec src) { #ifdef OPTIMIZE_AVX - return _mm256_storeu_si256(dst,_mm256_cvtps_epi32(src)); + _mm256_storeu_si256(dst,_mm256_cvtps_epi32(src)); #elif defined( OPTIMIZE_SSE2 ) - return _mm_storeu_si128(dst,_mm_cvtps_epi32(src)); + _mm_storeu_si128(dst,_mm_cvtps_epi32(src)); #elif defined( OPTIMIZE_SSE ) __m128 tmp; *(__m64 *)dst = _mm_cvtps_pi32(src); @@ -194,7 +194,7 @@ PVECTOR_RENAME(f32_to_s32a)(void *dst,__f32vec src) { #ifdef OPTIMIZE_AVX - return _mm256_store_si256(dst,_mm256_cvtps_epi32(src)); + _mm256_store_si256(dst,_mm256_cvtps_epi32(src)); #elif defined( OPTIMIZE_SSE2 ) _mm_store_si128(dst,_mm_cvtps_epi32(src)); #elif defined( OPTIMIZE_SSE ) @@ -213,7 +213,7 @@ PVECTOR_RENAME(f32_to_s32_stream)(void *dst,__f32vec src) { #ifdef OPTIMIZE_AVX - return _mm256_stream_si256(dst,_mm256_cvtps_epi32(src)); + _mm256_stream_si256(dst,_mm256_cvtps_epi32(src)); #elif defined( OPTIMIZE_SSE2 ) _mm_stream_si128(dst,_mm_cvtps_epi32(src)); #elif defined( OPTIMIZE_SSE ) Modified: mplayerxp/sig_hand.c =================================================================== --- mplayerxp/sig_hand.c 2010-01-22 16:43:32 UTC (rev 119) +++ mplayerxp/sig_hand.c 2010-01-23 13:25:30 UTC (rev 120) @@ -1,8 +1,9 @@ /* MplayerXP's Signal handling */ - +#ifndef _GNU_SOURCE #define _GNU_SOURCE /* to get definition of strsignal */ +#endif #include <string.h> #include <stdio.h> #include <signal.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2010-01-29 18:38:14
|
Revision: 136 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=136&view=rev Author: nickols_k Date: 2010-01-29 18:37:49 +0000 (Fri, 29 Jan 2010) Log Message: ----------- slightly descrease size of executable Modified Paths: -------------- mplayerxp/configure mplayerxp/libvo/osd.c mplayerxp/libvo/vo_opengl.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vo_xvidix.c mplayerxp/libvo/x11_common.c mplayerxp/libvo/x11_common.h mplayerxp/postproc/dsp_accel.h mplayerxp/pvector/pvector_inc.h Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2010-01-29 17:57:20 UTC (rev 135) +++ mplayerxp/configure 2010-01-29 18:37:49 UTC (rev 136) @@ -870,19 +870,9 @@ ** *---------------------------------------------------------------------------*/ -#ifdef CAN_COMPILE_MMX -#define USE_MMX_IDCT 1 -#endif - /* libvo options */ -#define SCREEN_SIZE_X 1 -#define SCREEN_SIZE_Y 1 $def_fbdev_nocopy -#if defined(HAVE_X11) || defined(HAVE_XV) -#define X11_FULLSCREEN 1 -#endif - /* Defined to some form of __attribute__ ((...)) if the compiler supports a different, more efficient calling convention. */ #if defined ( __USE_FASTCALL ) && defined ( ARCH_X86 ) Modified: mplayerxp/libvo/osd.c =================================================================== --- mplayerxp/libvo/osd.c 2010-01-29 17:57:20 UTC (rev 135) +++ mplayerxp/libvo/osd.c 2010-01-29 18:37:49 UTC (rev 136) @@ -182,18 +182,18 @@ } else #endif -#ifdef __MMX__ -if(gCpuCaps.hasMMX) -{ - MSG_V("Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); - vo_draw_alpha_yv12_ptr=vo_draw_alpha_yv12_MMX; - vo_draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_MMX; - vo_draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_MMX; - vo_draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_MMX; -} -else +//#ifdef __MMX__ +//if(gCpuCaps.hasMMX) +//{ +// MSG_V("Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); +// vo_draw_alpha_yv12_ptr=vo_draw_alpha_yv12_MMX; +// vo_draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_MMX; +// vo_draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_MMX; +// vo_draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_MMX; +//} +//else +//#endif #endif -#endif { MSG_V("Using generic OnScreenDisplay\n"); vo_draw_alpha_yv12_ptr=vo_draw_alpha_yv12_c; Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2010-01-29 17:57:20 UTC (rev 135) +++ mplayerxp/libvo/vo_opengl.c 2010-01-29 18:37:49 UTC (rev 136) @@ -182,16 +182,7 @@ aspect_save_screenres(vo_screenwidth,vo_screenheight); aspect(&d_width,&d_height,softzoom?A_ZOOM:A_NOZOOM); -#ifdef X11_FULLSCREEN - /* this code replaces X11_FULLSCREEN hack in mplayer.c - * aspect() is available through aspect.h for all vos. - * besides zooming should only be done with -zoom, - * but I leave the old -fs behaviour so users don't get - * irritated for now (and send lots o' mails ;) ::atmos - */ - - if( vo_fs ) aspect(&d_width,&d_height,A_ZOOM); -#endif + if( vo_fs ) aspect(&d_width,&d_height,A_ZOOM); vo_x11_calcpos(&hint,d_width,d_height,flags); hint.flags = PPosition | PSize; Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2010-01-29 17:57:20 UTC (rev 135) +++ mplayerxp/libvo/vo_x11.c 2010-01-29 18:37:49 UTC (rev 136) @@ -160,15 +160,8 @@ softzoom=flags&VOFLAG_SWSCALE; aspect(&d_width,&d_height,A_NOZOOM); -#ifdef X11_FULLSCREEN - /* this code replaces X11_FULLSCREEN hack in mplayer.c - * aspect() is available through aspect.h for all vos. - * besides zooming should only be done with -zoom, - * but I leave the old -fs behaviour so users don't get - * irritated for now (and send lots o' mails ;) ::atmos - */ - if( fullscreen ) aspect(&d_width,&d_height,A_ZOOM); -#endif + if( fullscreen ) aspect(&d_width,&d_height,A_ZOOM); + vo_x11_calcpos(&hint,d_width,d_height,flags); hint.flags=PPosition | PSize; Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2010-01-29 17:57:20 UTC (rev 135) +++ mplayerxp/libvo/vo_xv.c 2010-01-29 18:37:49 UTC (rev 136) @@ -334,17 +334,9 @@ aspect_save_screenres(vo_screenwidth,vo_screenheight); - aspect(&d_width,&d_height,softzoom?A_ZOOM:A_NOZOOM); -#ifdef X11_FULLSCREEN - /* this code replaces X11_FULLSCREEN hack in mplayer.c - * aspect() is available through aspect.h for all vos. - * besides zooming should only be done with -zoom, - * but I leave the old -fs behaviour so users don't get - * irritated for now (and send lots o' mails ;) ::atmos - */ + aspect(&d_width,&d_height,softzoom?A_ZOOM:A_NOZOOM); + if( vo_fs ) aspect(&d_width,&d_height,A_ZOOM); - if( vo_fs ) aspect(&d_width,&d_height,A_ZOOM); -#endif vo_x11_calcpos(&hint,d_width,d_height,flags); hint.flags = PPosition | PSize; Modified: mplayerxp/libvo/vo_xvidix.c =================================================================== --- mplayerxp/libvo/vo_xvidix.c 2010-01-29 17:57:20 UTC (rev 135) +++ mplayerxp/libvo/vo_xvidix.c 2010-01-29 18:37:49 UTC (rev 136) @@ -87,7 +87,6 @@ drwcX, drwcY, drwX, drwY, drwWidth, drwHeight); /* following stuff copied from vo_xmga.c */ -#if X11_FULLSCREEN if (vo_fs) { drwX = (vo_screenwidth - (dwidth > vo_screenwidth ? vo_screenwidth : dwidth)) / 2; @@ -99,7 +98,6 @@ MSG_V( "[xvidix-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n", drwcX, drwcY, drwX, drwY, drwWidth, drwHeight); } -#endif #ifdef HAVE_XINERAMA if (XineramaIsActive(mDisplay)) @@ -254,22 +252,21 @@ aspect(&d_width, &d_height,flags & VOFLAG_SWSCALE?A_ZOOM:A_NOZOOM); -#ifdef X11_FULLSCREEN if (vo_fs) /* fullscreen */ { - if (flags & VOFLAG_SWSCALE) - { - aspect(&d_width, &d_height, A_ZOOM); - } - else - { + if (flags & VOFLAG_SWSCALE) + { + aspect(&d_width, &d_height, A_ZOOM); + } + else + { d_width = vo_screenwidth; d_height = vo_screenheight; - } + } window_width = vo_screenwidth; window_height = vo_screenheight; } -#endif + dwidth = d_width; dheight = d_height; /* Make the window */ @@ -303,10 +300,7 @@ vo_x11_classhint(mDisplay, vo_window, "xvidix"); vo_x11_hidecursor(mDisplay, vo_window); -#ifdef X11_FULLSCREEN - if (vo_fs) /* fullscreen */ - vo_x11_decoration(mDisplay, vo_window, 0); -#endif + if (vo_fs) vo_x11_decoration(mDisplay, vo_window, 0); XGetNormalHints(mDisplay, vo_window, &hint); hint.x = window_x; Modified: mplayerxp/libvo/x11_common.c =================================================================== --- mplayerxp/libvo/x11_common.c 2010-01-29 17:57:20 UTC (rev 135) +++ mplayerxp/libvo/x11_common.c 2010-01-29 18:37:49 UTC (rev 136) @@ -4,7 +4,7 @@ #include "../mp_config.h" #include "../mplayer.h" -#ifdef X11_FULLSCREEN +#ifdef HAVE_X11 #include <string.h> #include <unistd.h> Modified: mplayerxp/libvo/x11_common.h =================================================================== --- mplayerxp/libvo/x11_common.h 2010-01-29 17:57:20 UTC (rev 135) +++ mplayerxp/libvo/x11_common.h 2010-01-29 18:37:49 UTC (rev 136) @@ -2,7 +2,7 @@ #ifndef X11_COMMON_H #define X11_COMMON_H -#ifdef X11_FULLSCREEN +#ifdef HAVE_X11 #include <X11/Xlib.h> #include <X11/Xutil.h> Modified: mplayerxp/postproc/dsp_accel.h =================================================================== --- mplayerxp/postproc/dsp_accel.h 2010-01-29 17:57:20 UTC (rev 135) +++ mplayerxp/postproc/dsp_accel.h 2010-01-29 18:37:49 UTC (rev 136) @@ -3,16 +3,20 @@ static void __FASTCALL__ PVECTOR_RENAME(int8_to_int16)(const int8_t* in_data, int16_t* out_data, unsigned len, int final) { +#ifdef HAVE_INT_PVECTOR + unsigned len_mm; +#endif unsigned i; i = 0; #ifdef HAVE_INT_PVECTOR + len_mm=len&(~(__IVEC_SIZE-1)); if(!IVEC_ALIGNED(out_data)) for(;i<len;i++) { ((uint16_t*)out_data)[i]=((uint16_t)((const uint8_t*)in_data)[i])<<8; if(IVEC_ALIGNED(out_data)) break; } - if((len-i)>=__IVEC_SIZE) - for(;i<len;i+=__IVEC_SIZE){ + if((len_mm-i)>=__IVEC_SIZE) + for(;i<len_mm;i+=__IVEC_SIZE){ __ivec ind,itmp[2]; if(IVEC_ALIGNED(in_data)) ind = _ivec_loada(&((const uint8_t *)in_data)[i]); @@ -36,16 +40,20 @@ static void __FASTCALL__ PVECTOR_RENAME(int16_to_int8)(const int16_t* in_data, int8_t* out_data, unsigned len, int final) { +#ifdef HAVE_INT_PVECTOR + unsigned len_mm; +#endif unsigned i; i = 0; #ifdef HAVE_INT_PVECTOR + len_mm=len&(~(__IVEC_SIZE-1)); if(!IVEC_ALIGNED(out_data)) for(;i<len;i++) { ((uint8_t*)out_data)[i]=(uint8_t)((((const uint16_t*)in_data)[i])>>8); if(IVEC_ALIGNED(out_data)) break; } - if((len-i)>=__IVEC_SIZE) - for(;i<len;i+=__IVEC_SIZE){ + if((len_mm-i)>=__IVEC_SIZE) + for(;i<len_mm;i+=__IVEC_SIZE){ __ivec outd,itmp[2]; if(IVEC_ALIGNED(in_data)) { itmp[0] = _ivec_loada(&((const uint16_t*)in_data)[i]); @@ -71,33 +79,32 @@ static void __FASTCALL__ PVECTOR_RENAME(int16_to_int32)(const int16_t* in_data, int32_t* out_data, unsigned len, int final) { #ifdef HAVE_INT_PVECTOR - unsigned len_mm,j; + unsigned len_mm; #endif unsigned i; i=0; #ifdef HAVE_INT_PVECTOR - j=0; len_mm=len&(~(__IVEC_SIZE-1)); if(!IVEC_ALIGNED(out_data)) - for(;i<len;i++,j+=2){ + for(;i<len;i++){ ((uint32_t*)out_data)[i]=((uint32_t)((const uint16_t*)in_data)[i])<<16; if(IVEC_ALIGNED(out_data)) break; } if((len_mm-i)>=__IVEC_SIZE) - for(;i<len_mm;i+=__IVEC_SIZE/2,j+=__IVEC_SIZE) + for(;i<len_mm;i+=__IVEC_SIZE) { __ivec ind,tmp[2]; if(IVEC_ALIGNED(in_data)) - ind = _ivec_loada(&((const uint8_t *)in_data)[j]); + ind = _ivec_loada(&((const uint8_t *)in_data)[i]); else - ind = _ivec_loadu(&((const uint8_t *)in_data)[j]); + ind = _ivec_loadu(&((const uint8_t *)in_data)[i]); tmp[0]= _ivec_scale_u32_from_u16(ind,&tmp[1]); if(final) { - _ivec_stream(&((uint8_t *)out_data)[j*2],tmp[0]); - _ivec_stream(&((uint8_t *)out_data)[j*2+__IVEC_SIZE],tmp[1]); + _ivec_stream(&((uint8_t *)out_data)[i*2],tmp[0]); + _ivec_stream(&((uint8_t *)out_data)[i*2+__IVEC_SIZE],tmp[1]); } else { - _ivec_storea(&((uint8_t *)out_data)[j*2],tmp[0]); - _ivec_storea(&((uint8_t *)out_data)[j*2+__IVEC_SIZE],tmp[1]); + _ivec_storea(&((uint8_t *)out_data)[i*2],tmp[0]); + _ivec_storea(&((uint8_t *)out_data)[i*2+__IVEC_SIZE],tmp[1]); } } if(final) _ivec_sfence(); @@ -110,33 +117,33 @@ static void __FASTCALL__ PVECTOR_RENAME(int32_to_int16)(const int32_t* in_data, int16_t* out_data, unsigned len, int final) { #ifdef HAVE_INT_PVECTOR - unsigned j; + unsigned len_mm; #endif unsigned i; i=0; #ifdef HAVE_INT_PVECTOR - j=0; + len_mm=len&(~(__IVEC_SIZE-1)); if(!IVEC_ALIGNED(out_data)) - for(;i<len;i++,j+=2){ + for(;i<len;i++){ ((uint16_t*)out_data)[i]=(uint16_t)((((const uint32_t*)in_data)[i])>>16); if(IVEC_ALIGNED(out_data)) break; } - if((len-i)>=__IVEC_SIZE) - for(;i<len;i+=__IVEC_SIZE/2,j+=__IVEC_SIZE) + if((len_mm-i)>=__IVEC_SIZE) + for(;i<len_mm;i+=__IVEC_SIZE) { __ivec ind[2],tmp; if(IVEC_ALIGNED(in_data)) { - ind[0]=_ivec_loada(&((const uint8_t *)in_data)[j*2]); - ind[1]=_ivec_loada(&((const uint8_t *)in_data)[j*2+__IVEC_SIZE]); + ind[0]=_ivec_loada(&((const uint8_t *)in_data)[i*2]); + ind[1]=_ivec_loada(&((const uint8_t *)in_data)[i*2+__IVEC_SIZE]); } else { - ind[0]=_ivec_loadu(&((const uint8_t *)in_data)[j*2]); - ind[1]=_ivec_loadu(&((const uint8_t *)in_data)[j*2+__IVEC_SIZE]); + ind[0]=_ivec_loadu(&((const uint8_t *)in_data)[i*2]); + ind[1]=_ivec_loadu(&((const uint8_t *)in_data)[i*2+__IVEC_SIZE]); } tmp = _ivec_scale_s16_from_s32(ind[0],ind[1]); if(final) - _ivec_stream(&((uint8_t *)out_data)[j],tmp); + _ivec_stream(&((uint8_t *)out_data)[i],tmp); else - _ivec_storea(&((uint8_t *)out_data)[j],tmp); + _ivec_storea(&((uint8_t *)out_data)[i],tmp); } if(final) _ivec_sfence(); _ivec_empty(); @@ -322,7 +329,7 @@ if(!F32VEC_ALIGNED(out)) for(;i<len;i++) { ftmp=((const float*)in)[i]; - SATURATE(ftmp,-1.0,+1.0); + SATURATE(ftmp,-0.999998,+0.999998); ((int32_t*)out)[i]=(int32_t)lrintf((INT_MAX-1)*ftmp); if(F32VEC_ALIGNED(out)) break; } @@ -347,7 +354,7 @@ #endif for(;i<len;i++) { ftmp=((const float*)in)[i]; - SATURATE(ftmp,-0.99,+0.99); + SATURATE(ftmp,-0.999998,+0.999998); ((int32_t*)out)[i]=(int32_t)lrintf((INT32_MAX-1)*ftmp); } } Modified: mplayerxp/pvector/pvector_inc.h =================================================================== --- mplayerxp/pvector/pvector_inc.h 2010-01-29 17:57:20 UTC (rev 135) +++ mplayerxp/pvector/pvector_inc.h 2010-01-29 18:37:49 UTC (rev 136) @@ -18,17 +18,18 @@ #include PVECTOR_ACCEL_H #if !defined( __x86_64__ ) || defined(PVECTOR_TESTING) -#if !defined( __i686__ ) || defined(PVECTOR_TESTING) +#if defined(COMPILE_FOR_OLD_PC) || defined(PVECTOR_TESTING) #ifdef __MMX__ #define OPTIMIZE_MMX #undef PVECTOR_RENAME #define PVECTOR_RENAME(a) a ## _MMX #include PVECTOR_ACCEL_H #endif -#endif // __i686__ +#endif // PVECTOR_TESTING #ifdef __3dNOW__ #define OPTIMIZE_3DNOW +#define OPTIMIZE_MMX2 #undef PVECTOR_RENAME #define PVECTOR_RENAME(a) a ## _3DNOW #include PVECTOR_ACCEL_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2010-02-15 17:22:56
|
Revision: 141 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=141&view=rev Author: nickols_k Date: 2010-02-15 17:22:49 +0000 (Mon, 15 Feb 2010) Log Message: ----------- new command line key + minor optimizations Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/cdda.c mplayerxp/libmpdemux/stream.c mplayerxp/mp_msg.c mplayerxp/mplayer.c Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2010-02-10 16:31:34 UTC (rev 140) +++ mplayerxp/cfg-mplayer.h 2010-02-15 17:22:49 UTC (rev 141) @@ -78,6 +78,7 @@ extern unsigned vo_use_bm; #if defined( ARCH_X86 ) || defined(ARCH_X86_64) +extern int x86_simd; extern int x86_mmx; extern int x86_mmx2; extern int x86_3dnow; @@ -168,6 +169,8 @@ #if defined( ARCH_X86 ) || defined(ARCH_X86_64) static const config_t cpu_config[]={ + {"simd", &x86_simd, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SIMD extensions of CPU"}, + {"nosimd", &x86_simd, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SIMD extensions of CPU"}, {"mmx", &x86_mmx, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of MMX extensions of CPU"}, {"nommx", &x86_mmx, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of MMX extensions of CPU"}, {"mmx2", &x86_mmx2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of MMX2 extensions of CPU"}, Modified: mplayerxp/libmpdemux/cache2.c =================================================================== --- mplayerxp/libmpdemux/cache2.c 2010-02-10 16:31:34 UTC (rev 140) +++ mplayerxp/libmpdemux/cache2.c 2010-02-15 17:22:49 UTC (rev 141) @@ -18,6 +18,7 @@ #include "../osdep/timer.h" #include "../cpudetect.h" #include "bswap.h" +#include "../libvo/fastmemcpy.h" #include "../help_mp.h" #include "mpdemux.h" #include "../mplayer.h" @@ -213,7 +214,7 @@ free(c); return 0; } - memset(c->packets,0,i); + memset(c->packets,0,i); pmem = c->mem; MSG_DBG2("For cache navigation was allocated %u bytes as %u packets (%u/%u)\n",i,num,size,sector); c->first=c->last=0; Modified: mplayerxp/libmpdemux/cdda.c =================================================================== --- mplayerxp/libmpdemux/cdda.c 2010-02-10 16:31:34 UTC (rev 140) +++ mplayerxp/libmpdemux/cdda.c 2010-02-15 17:22:49 UTC (rev 141) @@ -178,7 +178,10 @@ return -1; /* EOF */ } p->sector++; - if(p->sector == p->end_sector) return -1; /* EOF */ + if(p->sector == p->end_sector) { + MSG_DBG2("EOF was reached\n"); + return -1; /* EOF */ + } p->sector=map_sector(p,p->sector,&i); if(!p->sector) return -1; Modified: mplayerxp/libmpdemux/stream.c =================================================================== --- mplayerxp/libmpdemux/stream.c 2010-02-10 16:31:34 UTC (rev 140) +++ mplayerxp/libmpdemux/stream.c 2010-02-15 17:22:49 UTC (rev 141) @@ -14,6 +14,8 @@ #include "../mplayer.h" #include "help_mp.h" +#include "../libvo/fastmemcpy.h" + #include "stream.h" #include "demuxer.h" #include "demux_msg.h" @@ -81,7 +83,7 @@ &file_stream, }; -static unsigned int nsdrivers=sizeof(sdrivers)/sizeof(stream_driver_t*); +static const unsigned int nsdrivers=sizeof(sdrivers)/sizeof(stream_driver_t*); stream_t* __FASTCALL__ open_stream(const char* filename,int* file_format,stream_callback event_handler) { @@ -135,26 +137,23 @@ int __FASTCALL__ nc_stream_read_cbuffer(stream_t *s){ int len,legacy_eof; stream_packet_t sp; - sp.len=0; - sp.buf=s->buffer; - sp.type=0; if(s->eof){ s->buf_pos=s->buf_len=0; return 0; } while(1) { sp.type=0; sp.len=s->sector_size; - sp.buf=s->buffer; + sp.buf=(char *)s->buffer; if(s->type==STREAMTYPE_DS) len = demux_read_data((demux_stream_t*)s->priv,s->buffer,s->sector_size); else { if(!s->driver) { s->eof=1; return 0; } len = s->driver->read(s,&sp); } if(sp.type) - { + { if(s->event_handler) s->event_handler(s,&sp); continue; } if(s->driver->control(s,SCTRL_EOF,NULL)==SCTRL_OK) legacy_eof=1; else legacy_eof=0; if(sp.len<=0 || legacy_eof) - { + { MSG_DBG3("nc_stream_read_cbuffer: Guess EOF\n"); s->eof=1; s->buf_pos=s->buf_len=0; @@ -166,7 +165,7 @@ s->buf_pos=0; s->buf_len=sp.len; s->pos += sp.len; - MSG_DBG3("nc_stream_read_cbuffer done: pos=%llu buf_pos=%lu buf_len=%lu\n",s->pos,s->buf_pos,s->buf_len); + MSG_DBG3("nc_stream_read_cbuffer(%s) done[sector_size=%i len=%i]: buf_pos=%u buf_len=%u pos=%llu\n",s->driver->mrl,s->sector_size,len,s->buf_pos,s->buf_len,s->pos); return s->buf_len; } @@ -307,7 +306,7 @@ got_len=0; while(rlen) { - s->buffer=mem; + s->buffer=(unsigned char *)mem; s->buf_len=rlen; nc_stream_read_cbuffer(s); mem += min(rlen,(int)s->buf_len); Modified: mplayerxp/mp_msg.c =================================================================== --- mplayerxp/mp_msg.c 2010-02-10 16:31:34 UTC (rev 140) +++ mplayerxp/mp_msg.c 2010-02-15 17:22:49 UTC (rev 141) @@ -73,7 +73,6 @@ static int was_eol=1; if(level>verbose+MSGL_V-1) return; /* do not display */ if((mod&mp_msg_filter)==0) return; /* do not display */ - va_start(va, format); pthread_mutex_lock(&mp_msg_mutex); if(isatty(fileno(stderr))) fprintf(stderr,scol[level<9?level:8]); @@ -87,7 +86,9 @@ smod = msg_prefix[mod_name]; fprintf(stderr,"%s.%s(%u): ",smod?smod:"UNKNOWN",srcfile,linenum); } + va_start(va, format); ssize=vsprintf(sbuf,format, va); + va_end(va); if(strcmp(nls_get_screen_cp(),"UTF-8")!=0) { char *obuf; obuf=nls_recode2screen_cp("UTF-8",sbuf,ssize); @@ -99,7 +100,6 @@ else was_eol=0; fflush(stderr); pthread_mutex_unlock(&mp_msg_mutex); - va_end(va); } void mp_msg_flush(void) { fflush(stderr); } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2010-02-10 16:31:34 UTC (rev 140) +++ mplayerxp/mplayer.c 2010-02-15 17:22:49 UTC (rev 141) @@ -894,6 +894,7 @@ #if defined( ARCH_X86 ) || defined(ARCH_X86_64) +int x86_simd=-1; int x86_mmx=-1; int x86_mmx2=-1; int x86_3dnow=-1; @@ -910,19 +911,36 @@ static void get_mmx_optimizations( void ) { GetCpuCaps(&gCpuCaps); - if(x86_mmx != -1) gCpuCaps.hasMMX=x86_mmx; - if(x86_mmx2 != -1) gCpuCaps.hasMMX2=x86_mmx2; - if(x86_3dnow != -1) gCpuCaps.has3DNow=x86_3dnow; - if(x86_3dnow2 != -1) gCpuCaps.has3DNowExt=x86_3dnow2; - if(x86_sse != -1) gCpuCaps.hasSSE=x86_sse; - if(x86_sse2 != -1) gCpuCaps.hasSSE2=x86_sse2; - if(x86_sse3 != -1) gCpuCaps.hasSSE2=x86_sse3; - if(x86_ssse3 != -1) gCpuCaps.hasSSSE3=x86_ssse3; - if(x86_sse41 != -1) gCpuCaps.hasSSE2=x86_sse41; - if(x86_sse42 != -1) gCpuCaps.hasSSE2=x86_sse42; - if(x86_aes != -1) gCpuCaps.hasSSE2=x86_aes; - if(x86_avx != -1) gCpuCaps.hasSSE2=x86_avx; - if(x86_fma != -1) gCpuCaps.hasSSE2=x86_fma; + + if(x86_simd) { + if(x86_mmx != -1) gCpuCaps.hasMMX=x86_mmx; + if(x86_mmx2 != -1) gCpuCaps.hasMMX2=x86_mmx2; + if(x86_3dnow != -1) gCpuCaps.has3DNow=x86_3dnow; + if(x86_3dnow2 != -1) gCpuCaps.has3DNowExt=x86_3dnow2; + if(x86_sse != -1) gCpuCaps.hasSSE=x86_sse; + if(x86_sse2 != -1) gCpuCaps.hasSSE2=x86_sse2; + if(x86_sse3 != -1) gCpuCaps.hasSSE2=x86_sse3; + if(x86_ssse3 != -1) gCpuCaps.hasSSSE3=x86_ssse3; + if(x86_sse41 != -1) gCpuCaps.hasSSE41=x86_sse41; + if(x86_sse42 != -1) gCpuCaps.hasSSE42=x86_sse42; + if(x86_aes != -1) gCpuCaps.hasAES=x86_aes; + if(x86_avx != -1) gCpuCaps.hasAVX=x86_avx; + if(x86_fma != -1) gCpuCaps.hasFMA=x86_fma; + } else { + gCpuCaps.hasMMX= + gCpuCaps.hasMMX2= + gCpuCaps.has3DNow= + gCpuCaps.has3DNowExt= + gCpuCaps.hasSSE= + gCpuCaps.hasSSE2= + gCpuCaps.hasSSE2= + gCpuCaps.hasSSSE3= + gCpuCaps.hasSSE41= + gCpuCaps.hasSSE42= + gCpuCaps.hasAES= + gCpuCaps.hasAVX= + gCpuCaps.hasFMA=0; + } MSG_V("User corrected CPU flags: MMX=%d MMX2=%d 3DNow=%d 3DNow2=%d SSE=%d SSE2=%d SSE3=%d SSSE3=%d SSE41=%d SSE42=%d AES=%d AVX=%d FMA=%d\n", gCpuCaps.hasMMX, gCpuCaps.hasMMX2, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2010-02-22 18:29:14
|
Revision: 142 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=142&view=rev Author: nickols_k Date: 2010-02-22 18:29:08 +0000 (Mon, 22 Feb 2010) Log Message: ----------- add backtrace functionality Modified Paths: -------------- mplayerxp/configure mplayerxp/sig_hand.c Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2010-02-15 17:22:49 UTC (rev 141) +++ mplayerxp/configure 2010-02-22 18:29:08 UTC (rev 142) @@ -351,6 +351,9 @@ check_func2 time.h nanosleep print_config HAVE_ mp_config.h mp_config.mak nanosleep +check_func2 execinfo.h backtrace +print_config HAVE_ mp_config.h mp_config.mak backtrace + disable inet_pton if enabled streaming ; then disable socklib Modified: mplayerxp/sig_hand.c =================================================================== --- mplayerxp/sig_hand.c 2010-02-15 17:22:49 UTC (rev 141) +++ mplayerxp/sig_hand.c 2010-02-22 18:29:08 UTC (rev 142) @@ -1,6 +1,7 @@ /* MplayerXP's Signal handling */ +#include "mp_config.h" #ifndef _GNU_SOURCE #define _GNU_SOURCE /* to get definition of strsignal */ #endif @@ -22,7 +23,33 @@ extern pthread_t mplayer_pth_id; extern pid_t dec_ahead_pid; +#ifdef HAVE_BACKTRACE +#include <execinfo.h> +/* Obtain a backtrace and print it to stdout. */ +static void print_trace (void) +{ + void *array[10]; + size_t size; + char **strings; + size_t i; + size = backtrace (array, 10); + strings = backtrace_symbols (array, size); + + MSG_ERR ("Obtained %zd stack frames.\n", size); + + for (i = 0; i < size; i++) + MSG_ERR ("%s\n", strings[i]); + + free (strings); +} + +/* A dummy function to make the backtrace more interesting. */ +static void dump_trace (void) +{ + print_trace (); +} +#endif static void my_callback(int signo) { int i; @@ -32,8 +59,9 @@ } mp_msg(MSGT_CPLAYER,MSGL_FATAL,__FILE__,__LINE__,"catching signal: %s in thread: %s (%i) in module: %s\n",strsignal(signo),pinfo[i].thread_name,i,pinfo[i].current_module); - - +#ifdef HAVE_BACKTRACE + dump_trace(); +#endif pinfo[i].sig_handler(); signal(signo,SIG_DFL); @@ -51,7 +79,7 @@ pinfo[xp_threads].current_module = NULL; pinfo[xp_threads].unlink = _unlink; xp_threads++; -#if 0 +#if 1 /*========= Catch terminate signals: ================*/ /* terminate requests:*/ signal(SIGTERM,my_callback); /* kill*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-15 13:38:25
|
Revision: 159 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=159&view=rev Author: nickols_k Date: 2012-10-15 13:38:17 +0000 (Mon, 15 Oct 2012) Log Message: ----------- combine variables of VO susbsystem into structure Modified Paths: -------------- ffmpeg/doc/examples/pc-uninstalled/libavfilter.pc mplayerxp/cfg-mplayer.h mplayerxp/dec_ahead.c mplayerxp/libao2/ao_wav.c mplayerxp/libmpcodecs/vd.c mplayerxp/libvo/sub.c mplayerxp/libvo/sub.h mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/libvo/vo_dga.c mplayerxp/libvo/vo_fbdev.c mplayerxp/libvo/vo_null.c mplayerxp/libvo/vo_opengl.c mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_vesa.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vo_xvidix.c mplayerxp/libvo/vosub_vidix.c mplayerxp/libvo/x11_common.c mplayerxp/libvo/x11_common.h mplayerxp/mplayer.c mplayerxp/postproc/vf_scale.c Modified: ffmpeg/doc/examples/pc-uninstalled/libavfilter.pc =================================================================== --- ffmpeg/doc/examples/pc-uninstalled/libavfilter.pc 2012-10-15 11:06:19 UTC (rev 158) +++ ffmpeg/doc/examples/pc-uninstalled/libavfilter.pc 2012-10-15 13:38:17 UTC (rev 159) @@ -6,7 +6,7 @@ Name: libavfilter Description: FFmpeg video filtering library Version: 3.17.100 -Requires: libpostproc = 52.0.100, libswresample = 0.15.100, libswscale = 2.1.101, libavformat = 54.29.104, libavcodec = 54.59.100 +Requires: libpostproc = 52.0.100, libswscale = 2.1.101, libavformat = 54.29.104, libavcodec = 54.59.100 Conflicts: Libs: -L${libdir} -lavfilter -ljack -lasound -Wl,-rpath,/usr/X11/lib64 -L/usr/X11/lib64 -lSDL -lpthread -lm -pthread -lbz2 -lz -lrt Cflags: -I${includedir} Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/cfg-mplayer.h 2012-10-15 13:38:17 UTC (rev 159) @@ -22,18 +22,6 @@ extern int fakemono; // defined in dec_audio.c #endif -extern int vo_doublebuffering; -extern int vo_vsync; -extern int vo_fsmode; -/* gamma correction */ -extern int vo_gamma_brightness; -extern int vo_gamma_saturation; -extern int vo_gamma_contrast; -extern int vo_gamma_hue; -extern int vo_gamma_red_intensity; -extern int vo_gamma_green_intensity; -extern int vo_gamma_blue_intensity; - #ifdef USE_SUB extern int sub_unicode; extern int sub_utf8; @@ -74,8 +62,6 @@ extern int enable_xp; extern int enable_gomp; extern int enable_xp_audio; -extern unsigned vo_da_buffs; -extern unsigned vo_use_bm; #if defined( ARCH_X86 ) || defined(ARCH_X86_64) extern int x86_simd; @@ -138,9 +124,9 @@ {"dump", &stream_dump, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies dump type and name for the dump of stream"}, {"gomp", &enable_gomp, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables usage of OpenMP extensions"}, {"nogomp", &enable_gomp, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables usage of OpenMP extensions"}, - {"da_buffs", &vo_da_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, NULL, "specifies number of buffers for decoding-ahead in XP mode"}, - {"double", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables double-buffering for single-thread decoding"}, - {"nodouble", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 1, 0, NULL, "enables single-buffer for single-thread decoding"}, + {"da_buffs", &vo.da_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, NULL, "specifies number of buffers for decoding-ahead in XP mode"}, + {"double", &vo.doublebuffering, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables double-buffering for single-thread decoding"}, + {"nodouble", &vo.doublebuffering, CONF_TYPE_FLAG, 0, 1, 0, NULL, "enables single-buffer for single-thread decoding"}, {"cache", &stream_cache_size, CONF_TYPE_INT, CONF_RANGE, 4, 65536, NULL,"specifies amount of memory for precaching a file/URL"}, {"nocache", &stream_cache_size, CONF_TYPE_FLAG, 0, 1, 0, NULL,"disables precaching a file/URL"}, {"autoq", &auto_quality, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL, "dynamically changes the level of postprocessing depending on spare CPU time available"}, @@ -214,13 +200,13 @@ }; static const config_t veq_config[]={ - {"brightness",&vo_gamma_brightness, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies brightness-level for output image"}, - {"saturation",&vo_gamma_saturation, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies saturation-level for output image"}, - {"contrast",&vo_gamma_contrast, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies contrast-level for output image"}, - {"hue",&vo_gamma_hue, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies hue of gamma-correction for output image"}, - {"red",&vo_gamma_red_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies intensity of red component for output image"}, - {"green",&vo_gamma_green_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies intensity of green component for output image"}, - {"blue",&vo_gamma_blue_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies intensity of blue component for output image"}, + {"brightness",&vo.gamma.brightness, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies brightness-level for output image"}, + {"saturation",&vo.gamma.saturation, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies saturation-level for output image"}, + {"contrast",&vo.gamma.contrast, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies contrast-level for output image"}, + {"hue",&vo.gamma.hue, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies hue of gamma-correction for output image"}, + {"red",&vo.gamma.red_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies intensity of red component for output image"}, + {"green",&vo.gamma.green_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies intensity of green component for output image"}, + {"blue",&vo.gamma.blue_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies intensity of blue component for output image"}, {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, }; @@ -247,8 +233,8 @@ #endif {"mc", &default_max_pts_correction, CONF_TYPE_FLOAT, CONF_RANGE, 0, 10, NULL, "maximum sync correction per 5 frames (in seconds)"}, {"fps", &force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, NULL, "forces frame rate (if value is wrong in the header)"}, - {"vsync", &vo_vsync, CONF_TYPE_FLAG, 0, 0, 1, NULL, "forces video hardware to wait VSYNC signal before frame switching"}, - {"novsync", &vo_vsync, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video hardware to wait VSYNC signal before frame switching"}, + {"vsync", &vo.vsync, CONF_TYPE_FLAG, 0, 0, 1, NULL, "forces video hardware to wait VSYNC signal before frame switching"}, + {"novsync", &vo.vsync, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video hardware to wait VSYNC signal before frame switching"}, {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, }; @@ -306,28 +292,28 @@ }; static const config_t video_config[]={ - {"width", &opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to width (if driver supports)"}, - {"height", &opt_screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to height (if driver supports)"}, - {"zoom", &screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, NULL, "scale output image by given factor"}, - {"screenw", &vo_screenwidth, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "specifies the horizontal resolution of the screen (if supported)"}, - {"screenh", &vo_screenheight, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "specifies the vertical resolution of the screen (if supported)"}, + {"width", &vo.opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to width (if driver supports)"}, + {"height", &vo.opt_screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to height (if driver supports)"}, + {"zoom", &vo.screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, NULL, "scale output image by given factor"}, + {"screenw", &vo.screenwidth, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "specifies the horizontal resolution of the screen (if supported)"}, + {"screenh", &vo.screenheight, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "specifies the vertical resolution of the screen (if supported)"}, {"speed", &playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, NULL, "sets playback speed factor"}, - {"aspect", &movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, NULL, "sets aspect-ratio of movies (autodetect)"}, - {"noaspect", &movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, NULL, "unsets aspect-ratio of movies"}, - {"aspect-ratio", &softzoom, CONF_TYPE_FLAG, 0, 0, 1, NULL, "keeps aspect-ratio of the movie during window resize"}, - {"noaspect-ratio", &softzoom, CONF_TYPE_FLAG, 0, 1, 0, NULL, "render movie to the user-defined window's geometry"}, + {"aspect", &vo.movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, NULL, "sets aspect-ratio of movies (autodetect)"}, + {"noaspect", &vo.movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, NULL, "unsets aspect-ratio of movies"}, + {"aspect-ratio", &vo.softzoom, CONF_TYPE_FLAG, 0, 0, 1, NULL, "keeps aspect-ratio of the movie during window resize"}, + {"noaspect-ratio", &vo.softzoom, CONF_TYPE_FLAG, 0, 1, 0, NULL, "render movie to the user-defined window's geometry"}, {"monitorpixelaspect", &monitor_pixel_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 9.0, NULL, "sets the aspect-ratio of a single pixel of TV screen"}, - {"vm", &vidmode, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables video-mode changing during playback"}, - {"novm", &vidmode, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video-mode changing during playback"}, - {"fs", &fullscreen, CONF_TYPE_FLAG, 0, 0, 1, NULL, "fullscreen playback"}, - {"nofs", &fullscreen, CONF_TYPE_FLAG, 0, 1, 0, NULL, "windowed playback"}, - {"fsmode", &vo_fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 15, NULL, "enables workaround for some fullscreen related problems"}, - {"flip", &flip, CONF_TYPE_FLAG, 0, -1, 1, NULL, "flip output image upside-down"}, - {"noflip", &flip, CONF_TYPE_FLAG, 0, -1, 0, NULL, "render output image as is"}, - {"bpp", &vo_dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32, NULL, "use different color depth than autodetect"}, - {"bm", &vo_use_bm, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of bus-mastering (if it available for given OS/videocard)"}, - {"bm2", &vo_use_bm, CONF_TYPE_FLAG, 0, 0, 2, NULL, "enables using of bus-mastering to store all decoded-ahead frames in video-memory"}, - {"nobm", &vo_use_bm, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of bus-mastering"}, + {"vm", &vo.vidmode, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables video-mode changing during playback"}, + {"novm", &vo.vidmode, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video-mode changing during playback"}, + {"fs", &vo.fullscreen, CONF_TYPE_FLAG, 0, 0, 1, NULL, "fullscreen playback"}, + {"nofs", &vo.fullscreen, CONF_TYPE_FLAG, 0, 1, 0, NULL, "windowed playback"}, + {"fsmode", &vo.fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 15, NULL, "enables workaround for some fullscreen related problems"}, + {"flip", &vo.flip, CONF_TYPE_FLAG, 0, -1, 1, NULL, "flip output image upside-down"}, + {"noflip", &vo.flip, CONF_TYPE_FLAG, 0, -1, 0, NULL, "render output image as is"}, + {"bpp", &vo.dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32, NULL, "use different color depth than autodetect"}, + {"bm", &vo.use_bm, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of bus-mastering (if it available for given OS/videocard)"}, + {"bm2", &vo.use_bm, CONF_TYPE_FLAG, 0, 0, 2, NULL, "enables using of bus-mastering to store all decoded-ahead frames in video-memory"}, + {"nobm", &vo.use_bm, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of bus-mastering"}, {"id", &video_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL, "selects video channel"}, {"pp", &npp_options, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies options of post-processing"}, {"sws", &sws_flags, CONF_TYPE_INT, 0, 0, 2, NULL, "specifies the quality of the software scaler"}, Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/dec_ahead.c 2012-10-15 13:38:17 UTC (rev 159) @@ -78,7 +78,6 @@ static pthread_t pthread_id=0; static pthread_attr_t our_attr; static pthread_attr_t audio_attr; -extern float vo_fps; static sh_video_t *sh_video; static sh_audio_t *sh_audio; extern demux_stream_t *d_video; @@ -151,7 +150,7 @@ pinfo[xp_id].pth_id = pthread_self(); pinfo[xp_id].thread_name = (has_xp_audio && enable_xp < XP_VAFull) ? "video+audio decoding+filtering ahead" : "video decoding+vf ahead"; prev_delta=xp_num_frames; - drop_barrier=(float)(xp_num_frames/2)*(1/vo_fps); + drop_barrier=(float)(xp_num_frames/2)*(1/vo.fps); if(av_sync_pts == -1 && !use_pts_fix2) xp_is_bad_pts = d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG4_ES || @@ -188,7 +187,7 @@ while(2==xp_thread_decode_audio()) ; pinfo[xp_id].current_module = "dec_ahead 2"; } - in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,vo_fps); + in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,vo.fps); UNLOCK_VREADING(); if(dec_ahead_in_lseek==Seek) { @@ -261,7 +260,7 @@ int cur_time; cur_time = GetTimerMS(); /* Ugly solution: disable frame dropping right after seeking! */ - if(cur_time - mpxp_seek_time > (xp_num_frames/vo_fps)*100 && + if(cur_time - mpxp_seek_time > (xp_num_frames/vo.fps)*100 && ada_active_frame>=xp_num_frames) { float delta,max_frame_delay;/* delay for decoding of top slow frame */ @@ -285,7 +284,7 @@ delta=v_pts-xp_screen_pts; if(max_frame_delay*3 > drop_barrier) { - if(drop_barrier < (float)(xp_num_frames-2)/vo_fps) drop_barrier += 1/vo_fps; + if(drop_barrier < (float)(xp_num_frames-2)/vo.fps) drop_barrier += 1/vo.fps; else if(verbose) { @@ -299,7 +298,7 @@ "*********************************************\n" "Try increase number of buffer for decoding ahead\n" "Exist: %u, need: %u\n" - ,xp_num_frames,(unsigned)(max_frame_delay*3*vo_fps)+3); + ,xp_num_frames,(unsigned)(max_frame_delay*3*vo.fps)+3); prev_warn_delay=max_frame_delay; } } @@ -617,7 +616,7 @@ unsigned o_bps; unsigned min_reserv; o_bps=sh_audio->afilter_inited?sh_audio->af_bps:sh_audio->o_bps; - if(has_xp_video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_num_frames/vo_fps))+MIN_BUFFER_RESERV; + if(has_xp_video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_num_frames/vo.fps))+MIN_BUFFER_RESERV; else asize = o_bps*ao_da_buffs; /* FIXME: get better indices from asize/real_audio_packet_size */ min_reserv = sha->audio_out_minsize; @@ -776,7 +775,7 @@ if(has_xp_video) { /* Match video buffer */ vbuf_size = abs_dec_ahead_locked_frame - abs_dec_ahead_active_frame; - pref_buf = vbuf_size / vo_fps * sh_audio->af_bps; + pref_buf = vbuf_size / vo.fps * sh_audio->af_bps; pref_buf -= len; if( pref_buf > 0 ) { len = min( pref_buf, free_buf ); Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libao2/ao_wav.c 2012-10-15 13:38:17 UTC (rev 159) @@ -29,6 +29,7 @@ #include "afmt.h" #include "audio_out.h" #include "audio_out_internal.h" +#include "../libvo/video_out.h" #include "help_mp.h" #include "ao_msg.h" @@ -47,8 +48,6 @@ LIBAO_EXTERN(wav) -extern int vo_pts; - #define WAV_ID_RIFF 0x46464952 /* "RIFF" */ #define WAV_ID_WAVE 0x45564157 /* "WAVE" */ #define WAV_ID_FMT 0x20746d66 /* "fmt " */ @@ -213,8 +212,8 @@ // return: how many bytes can be played without blocking static unsigned get_space(void){ - if(vo_pts) - return ao_data.pts < vo_pts + wav.fast * 30000 ? ao_data.outburst : 0; + if(vo.pts) + return ao_data.pts < vo.pts + wav.fast * 30000 ? ao_data.outburst : 0; return ao_data.outburst; } Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libmpcodecs/vd.c 2012-10-15 13:38:17 UTC (rev 159) @@ -137,10 +137,10 @@ MSG_DBG2("vo_debug: codec[%s] query_format(%s) returned FALSE\n",mpvdec->info->driver_name,vo_format_name(out_fmt)); continue; } - j=i; vo_flags=flags; + j=i; vo.flags=flags; if(flags&VFCAP_CSP_SUPPORTED_BY_HW) break; } else - if(!palette && !(vo_flags&3) && (out_fmt==IMGFMT_RGB8||out_fmt==IMGFMT_BGR8)){ + if(!palette && !(vo.flags&3) && (out_fmt==IMGFMT_RGB8||out_fmt==IMGFMT_BGR8)){ sh->outfmtidx=j; // pass index to the control() function this way if(mpvdec->control(sh,VDCTRL_QUERY_FORMAT,&out_fmt)!=CONTROL_FALSE) palette=1; @@ -186,25 +186,25 @@ sh->vfilter=vf; // autodetect flipping - if(flip==-1){ - flip=0; + if(vo.flip==-1){ + vo.flip=0; if(sh->codec->outflags[j]&CODECS_FLAG_FLIP) if(!(sh->codec->outflags[j]&CODECS_FLAG_NOFLIP)) - flip=1; + vo.flip=1; } - if(vo_flags&VFCAP_FLIPPED) flip^=1; - if(flip && !(vo_flags&VFCAP_FLIP)){ + if(vo.flags&VFCAP_FLIPPED) vo.flip^=1; + if(vo.flip && !(vo.flags&VFCAP_FLIP)){ // we need to flip, but no flipping filter avail. sh->vfilter=vf=vf_open_filter(vf,sh,"mirror","x"); } // time to do aspect ratio corrections... - if(movie_aspect>-1.0) sh->aspect = movie_aspect; // cmdline overrides autodetect - if(opt_screen_size_x||opt_screen_size_y){ - screen_size_x = opt_screen_size_x; - screen_size_y = opt_screen_size_y; - if(!vidmode){ + if(vo.movie_aspect>-1.0) sh->aspect = vo.movie_aspect; // cmdline overrides autodetect + if(vo.opt_screen_size_x||vo.opt_screen_size_y){ + screen_size_x = vo.opt_screen_size_x; + screen_size_y = vo.opt_screen_size_y; + if(!vo.vidmode){ if(!screen_size_x) screen_size_x=1; if(!screen_size_y) screen_size_y=1; if(screen_size_x<=8) screen_size_x*=sh->disp_w; @@ -214,15 +214,15 @@ // check source format aspect, calculate prescale ::atmos screen_size_x=sh->disp_w; screen_size_y=sh->disp_h; - if(screen_size_xy>=0.001){ - if(screen_size_xy<=8){ + if(vo.screen_size_xy>=0.001){ + if(vo.screen_size_xy<=8){ // -xy means x+y scale - screen_size_x*=screen_size_xy; - screen_size_y*=screen_size_xy; + screen_size_x*=vo.screen_size_xy; + screen_size_y*=vo.screen_size_xy; } else { // -xy means forced width while keeping correct aspect - screen_size_x=screen_size_xy; - screen_size_y=screen_size_xy*sh->disp_h/sh->disp_w; + screen_size_x=vo.screen_size_xy; + screen_size_y=vo.screen_size_xy*sh->disp_h/sh->disp_w; } } if(sh->aspect>0.01){ @@ -231,7 +231,7 @@ sh->aspect); w=(int)((float)screen_size_y*sh->aspect); w+=w%2; // round // we don't like horizontal downscale || user forced width: - if(w<screen_size_x || screen_size_xy>8){ + if(w<screen_size_x || vo.screen_size_xy>8){ screen_size_y=(int)((float)screen_size_x*(1.0/sh->aspect)); screen_size_y+=screen_size_y%2; // round if(screen_size_y<sh->disp_h) // Do not downscale verticaly @@ -245,13 +245,13 @@ MSG_V("video_out->init(%dx%d->%dx%d,flags=%d,'%s',%s)\n", sh->disp_w,sh->disp_h, screen_size_x,screen_size_y, - fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3), + vo.fullscreen|(vo.vidmode<<1)|(vo.softzoom<<2)|(vo.flip<<3), "MPlayerXP",vo_format_name(out_fmt)); MSG_DBG2("vf configuring: %s\n",vf->info->name); if(vf->config(vf,sh->disp_w,sh->disp_h, screen_size_x,screen_size_y, - fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3), + vo.fullscreen|(vo.vidmode<<1)|(vo.softzoom<<2)|(vo.flip<<3), out_fmt,tune)==0){ MSG_WARN(MSGTR_CannotInitVO); sh->vfilter_inited=-1; Modified: mplayerxp/libvo/sub.c =================================================================== --- mplayerxp/libvo/sub.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/sub.c 2012-10-15 13:38:17 UTC (rev 159) @@ -19,7 +19,7 @@ #include "../__mp_msg.h" #define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */ -char * __sub_osd_names[]={ +static const char * __sub_osd_names[]={ "Seekbar", "Play", "Pause", @@ -33,7 +33,7 @@ "Brightness", "Hue" }; -char * __sub_osd_names_short[] ={ "", "|>", "||", "[]", "<<" , ">>", "", "", "", "", "", ""}; +static const char * __sub_osd_names_short[] ={ "", "|>", "||", "[]", "<<" , ">>", "", "", "", "", "", ""}; //static int vo_font_loaded=-1; font_desc_t* vo_font=NULL; Modified: mplayerxp/libvo/sub.h =================================================================== --- mplayerxp/libvo/sub.h 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/sub.h 2012-10-15 13:38:17 UTC (rev 159) @@ -93,10 +93,6 @@ #define OSD_PB_END 0x12 #define OSD_PB_1 0x13 -/* now in textform */ -extern char * __sub_osd_names[]; -extern char * __sub_osd_names_short[]; - extern int sub_unicode; extern int sub_utf8; Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/video_out.c 2012-10-15 13:38:17 UTC (rev 159) @@ -45,59 +45,11 @@ //int vo_flags=0; -// currect resolution/bpp on screen: (should be autodetected by vo_x11_init()) -unsigned vo_depthonscreen=0; -unsigned vo_screenwidth=0; -unsigned vo_screenheight=0; - -// requested resolution/bpp: (-x -y -bpp options) -unsigned vo_dx=0; -unsigned vo_dy=0; -unsigned vo_dwidth=0; -unsigned vo_dheight=0; -unsigned vo_dbpp=0; - -unsigned vo_old_x = 0; -unsigned vo_old_y = 0; -unsigned vo_old_width = 0; -unsigned vo_old_height = 0; - -int vo_doublebuffering = 0; -int vo_vsync = 0; -int vo_fs = 0; -int vo_fsmode = 0; - -int vo_pts=0; // for hw decoding -float vo_fps=0; // for mp1e rte - +vo_priv_t vo = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, + { 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0, -1, 0, 0, 0.0, -1.0, }; char *vo_subdevice = NULL; -unsigned vo_da_buffs=64; /* keep old value here */ -unsigned vo_use_bm=0; /* indicates user's agreement for using busmastering */ - static vo_format_desc vod; -/**************************************** -* GAMMA CORRECTION * -****************************************/ -int vo_gamma_brightness=0; -int vo_gamma_saturation=0; -int vo_gamma_contrast=0; -int vo_gamma_hue=0; -int vo_gamma_red_intensity=0; -int vo_gamma_green_intensity=0; -int vo_gamma_blue_intensity=0; - -// libvo opts: -int fullscreen=0; -int vidmode=0; -int softzoom=0; -int flip=-1; -int opt_screen_size_x=0; -int opt_screen_size_y=0; -float screen_size_xy=0; -float movie_aspect=-1.0; -int vo_flags=0; - // // Externally visible list of all vo drivers // @@ -720,7 +672,7 @@ void vo_change_frame(void) { MSG_DBG2("dri_vo_dbg: vo_change_frame [active_frame=%u]\n",active_frame); - if(vo_doublebuffering || (dri_cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) + if(vo.doublebuffering || (dri_cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) { video_out->change_frame(active_frame); active_frame = (active_frame+1)%dri_nframes; Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/video_out.h 2012-10-15 13:38:17 UTC (rev 159) @@ -202,54 +202,59 @@ // NULL terminated array of all drivers extern const vo_functions_t* video_out_drivers[]; -extern int vo_flags; +typedef struct vo_gamma_s{ + int brightness; + int saturation; + int contrast; + int hue; + int red_intensity; + int green_intensity; + int blue_intensity; +}vo_gamma_t; +typedef struct vo_priv_s { + int flags; // correct resolution/bpp on screen: (should be autodetected by vo_x11_init()) -extern unsigned vo_depthonscreen; -extern unsigned vo_screenwidth; -extern unsigned vo_screenheight; + unsigned depthonscreen; + unsigned screenwidth; + unsigned screenheight; // requested resolution/bpp: (-x -y -bpp options) -extern unsigned vo_dx; -extern unsigned vo_dy; -extern unsigned vo_dwidth; -extern unsigned vo_dheight; -extern unsigned vo_dbpp; + unsigned dx; + unsigned dy; + unsigned dwidth; + unsigned dheight; + unsigned dbpp; -extern unsigned vo_old_x; -extern unsigned vo_old_y; -extern unsigned vo_old_width; -extern unsigned vo_old_height; + unsigned old_x; + unsigned old_y; + unsigned old_width; + unsigned old_height; -extern int vo_doublebuffering; -extern int vo_vsync; -extern int vo_fs; -extern int vo_fsmode; + int doublebuffering; + int vsync; + int fs; + int fsmode; -extern int vo_pts; -extern float vo_fps; + int pts; + float fps; -extern char *vo_subdevice; + unsigned da_buffs; /**< contains number of buffers for decoding ahead */ + unsigned use_bm; /**< indicates user's agreement for using busmastering */ -extern int vo_gamma_brightness; -extern int vo_gamma_saturation; -extern int vo_gamma_contrast; -extern int vo_gamma_hue; -extern int vo_gamma_red_intensity; -extern int vo_gamma_green_intensity; -extern int vo_gamma_blue_intensity; + vo_gamma_t gamma; -extern unsigned vo_da_buffs; /**< contains number of buffers for decoding ahead */ -extern unsigned vo_use_bm; /**< indicates user's agreement for using busmastering */ + int fullscreen; + int vidmode; + int softzoom; + int flip; + int opt_screen_size_x; + int opt_screen_size_y; + float screen_size_xy; + float movie_aspect; +}vo_priv_t; -extern int fullscreen; -extern int vidmode; -extern int softzoom; -extern int flip; -extern int opt_screen_size_x; -extern int opt_screen_size_y; -extern float screen_size_xy; -extern float movie_aspect; -extern int vo_flags; +extern vo_priv_t vo; +extern char * vo_subdevice; #endif Modified: mplayerxp/libvo/vo_dga.c =================================================================== --- mplayerxp/libvo/vo_dga.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/vo_dga.c 2012-10-15 13:38:17 UTC (rev 159) @@ -276,21 +276,21 @@ MSG_ERR( "vo_dga: Can't open display!\n"); return 0; } - udf_screenw = vo_screenwidth; - udf_screenh = vo_screenheight; + udf_screenw = vo.screenwidth; + udf_screenh = vo.screenheight; if( !vo_x11_init() ){ MSG_ERR( "vo_dga: vo_x11_init() failed!\n"); - return 1; + return 1; } - vo_dga_XServer_mode = vd_ValidateMode(vo_depthonscreen); - + vo_dga_XServer_mode = vd_ValidateMode(vo.depthonscreen); + if(vo_dga_XServer_mode ==0){ #ifndef HAVE_DGA2 MSG_ERR( "vo_dga: Your X-Server is not running in a "); MSG_ERR( "resolution supported by DGA driver!\n"); -#endif +#endif } - + #ifdef HAVE_DGA2 modelines=XDGAQueryModes(qdisp, XDefaultScreen(qdisp),&modecount); if(modelines){ @@ -303,7 +303,7 @@ modelines[i].greenMask, modelines[i].blueMask, modelines[i].viewportWidth, - modelines[i].viewportHeight); + modelines[i].viewportHeight); vd_EnableMode( modelines[i].depth, modelines[i].bitsPerPixel, @@ -328,9 +328,9 @@ for(i=1; i<vo_dga_mode_num; i++){ MSG_V( "vo_dga: Mode: %s", vd_GetModeString(i)); - if(vo_dbpp && vo_dbpp != vo_dga_modes[i].vdm_mplayer_depth){ + if(vo.dbpp && vo.dbpp != vo_dga_modes[i].vdm_mplayer_depth){ vo_dga_modes[i].vdm_supported = 0; - MSG_V( " ...disabled by -bpp %d", vo_dbpp ); + MSG_V( " ...disabled by -bpp %d", vo.dbpp ); } MSG_V( "\n"); } @@ -605,17 +605,17 @@ if(!wanted_height) wanted_height = height; if(!wanted_width) wanted_width = width; - + if(udf_screenw) wanted_width = udf_screenw; if(udf_screenh) wanted_height = udf_screenh; if( !vo_x11_init() ){ MSG_ERR( "vo_dga: vo_x11_init() failed!\n"); - return 1; + return 1; } - if( !vo_dbpp ) vo_dga_src_mode = vo_dga_XServer_mode; - else vo_dga_src_mode = vd_ModeValid(vo_dbpp); + if( !vo.dbpp ) vo_dga_src_mode = vo_dga_XServer_mode; + else vo_dga_src_mode = vd_ModeValid(vo.dbpp); vo_dga_hw_mode = SRC_MODE.vdm_hw_mode; if(vo_dga_src_mode != vo_dga_hw_mode ){ @@ -740,7 +740,6 @@ MSG_DBG2( "vo_dga: vp_off=%d\n", vo_dga_vp_offset); - XGrabKeyboard (mDisplay, DefaultRootWindow(mDisplay), True, GrabModeAsync,GrabModeAsync, CurrentTime); XGrabPointer (mDisplay, DefaultRootWindow(mDisplay), True, @@ -753,12 +752,12 @@ vo_dga_dbf_mem_offset[0] = 0; dest_frame_size = vo_dga_width*HW_MODE.vdm_bytespp*vo_dga_vp_height; - if(vo_doublebuffering) + if(vo.doublebuffering) { num_buffers = (ram_size*1024)/dest_frame_size; - if(num_buffers > vo_da_buffs) num_buffers = vo_da_buffs; + if(num_buffers > vo.da_buffs) num_buffers = vo.da_buffs; if(num_buffers > MAX_DRI_BUFFERS) num_buffers = MAX_DRI_BUFFERS; - + for(freq=1;freq<num_buffers;freq++) { vo_dga_dbf_y_offset[freq] = vo_dga_dbf_y_offset[freq-1] + vo_dga_vp_height; Modified: mplayerxp/libvo/vo_fbdev.c =================================================================== --- mplayerxp/libvo/vo_fbdev.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/vo_fbdev.c 2012-10-15 13:38:17 UTC (rev 159) @@ -772,7 +772,7 @@ fb_bpp = fb_vinfo.bits_per_pixel; - if (fb_bpp == 8 && !vo_dbpp) { + if (fb_bpp == 8 && !vo.dbpp) { MSG_ERR(FBDEV "8 bpp output is not supported.\n"); goto err_out_tty_fd; } @@ -782,21 +782,21 @@ fb_bpp = fb_vinfo.red.length + fb_vinfo.green.length + fb_vinfo.blue.length; - if (vo_dbpp) { - if (vo_dbpp != 15 && vo_dbpp != 16 && vo_dbpp != 24 && - vo_dbpp != 32) { - MSG_ERR(FBDEV "can't switch to %d bpp\n", vo_dbpp); + if (vo.dbpp) { + if (vo.dbpp != 15 && vo.dbpp != 16 && vo.dbpp != 24 && + vo.dbpp != 32) { + MSG_ERR(FBDEV "can't switch to %d bpp\n", vo.dbpp); goto err_out_fd; } - fb_bpp = vo_dbpp; + fb_bpp = vo.dbpp; } fb_preinit_done = 1; fb_works = 1; return 1; err_out_tty_fd: - close(fb_tty_fd); - fb_tty_fd = -1; + close(fb_tty_fd); + fb_tty_fd = -1; err_out_fd: close(fb_dev_fd); fb_dev_fd = -1; @@ -896,8 +896,8 @@ int zoom = fullscreen & 0x04?1:0; unsigned x_offset,y_offset,i; UNUSED(title); - fs = fullscreen & 0x01; - flip = fullscreen & 0x08; + vo.fs = fullscreen & 0x01; + vo.flip = fullscreen & 0x08; if(fs) zoom++; srcFourcc = format; if((int)pre_init_err == -2) @@ -993,7 +993,7 @@ break; } - if (flip & ((((pixel_format & 0xff) + 7) / 8) != fb_pixel_size)) { + if (vo.flip & ((((pixel_format & 0xff) + 7) / 8) != fb_pixel_size)) { MSG_ERR(FBDEV "Flipped output with depth conversion is not " "supported\n"); return 1; @@ -1108,7 +1108,7 @@ MSG_DBG2(FBDEV "L123123875 @ %p\n", L123123875); MSG_V(FBDEV "pixel per line: %d\n", fb_line_len / fb_pixel_size); - total_fr=vo_doublebuffering?vo_da_buffs:1; + total_fr=vo.doublebuffering?vo.da_buffs:1; for(i=0;i<total_fr;i++) if (!(next_frame[i] = (uint8_t *) malloc(out_width * out_height * fb_pixel_size))) { MSG_ERR(FBDEV "Can't malloc next_frame: %s\n", strerror(errno)); Modified: mplayerxp/libvo/vo_null.c =================================================================== --- mplayerxp/libvo/vo_null.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/vo_null.c 2012-10-15 13:38:17 UTC (rev 159) @@ -67,7 +67,7 @@ size_t i; null_image_width = width; null_image_height = height; - null_num_frames = vo_da_buffs; + null_num_frames = vo.da_buffs; null_fourcc=format; UNUSED(d_width); UNUSED(d_height); Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/vo_opengl.c 2012-10-15 13:38:17 UTC (rev 159) @@ -67,7 +67,6 @@ static uint32_t image_width; static uint32_t image_height; static uint32_t image_format; -static int vo_flipped; static uint32_t dwidth,dheight; static const vo_info_t *get_info(void) @@ -126,7 +125,7 @@ glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); glRasterPos2i(x, y); - glPixelZoom(sx,vo_flipped?sy:-sy); + glPixelZoom(sx,vo.flip?sy:-sy); } static void resize(int x,int y){ @@ -134,10 +133,10 @@ if (WinID >= 0) { unsigned top = 0, left = 0, w = x, h = y; aspect(&w,&h,A_ZOOM); - left=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2; - top=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2; - w=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); - h=(dheight > vo_screenheight?vo_screenheight:dheight); + left=( vo.screenwidth - (dwidth > vo.screenwidth?vo.screenwidth:dwidth) ) / 2; + top=( vo.screenheight - (dheight > vo.screenheight?vo.screenheight:dheight) ) / 2; + w=(dwidth > vo.screenwidth?vo.screenwidth:dwidth); + h=(dheight > vo.screenheight?vo.screenheight:dheight); gl_init_fb(left,top,w,h); } else gl_init_fb( 0, 0, x, y ); @@ -168,21 +167,21 @@ image_width = width; image_format=format; - vo_fs=flags&VOFLAG_FULLSCREEN; - softzoom=flags&VOFLAG_SWSCALE; - if ( vo_fs ) - { vo_old_width=d_width; vo_old_height=d_height; } + vo.fs=flags&VOFLAG_FULLSCREEN; + vo.softzoom=flags&VOFLAG_SWSCALE; + if ( vo.fs ) + { vo.old_width=d_width; vo.old_height=d_height; } #ifdef HAVE_XF86VM if( flags&0x02 ) vm = 1; #endif - vo_flipped=flags&VOFLAG_FLIPPING; - num_buffers=vo_doublebuffering?vo_da_buffs:1; + vo.flip=flags&VOFLAG_FLIPPING; + num_buffers=vo.doublebuffering?vo.da_buffs:1; - aspect_save_screenres(vo_screenwidth,vo_screenheight); - aspect(&d_width,&d_height,softzoom?A_ZOOM:A_NOZOOM); - if( vo_fs ) aspect(&d_width,&d_height,A_ZOOM); + aspect_save_screenres(vo.screenwidth,vo.screenheight); + aspect(&d_width,&d_height,vo.softzoom?A_ZOOM:A_NOZOOM); + if( vo.fs ) aspect(&d_width,&d_height,A_ZOOM); vo_x11_calcpos(&hint,d_width,d_height,flags); hint.flags = PPosition | PSize; @@ -214,7 +213,7 @@ ((WinID==0) ? 0 : (PointerMotionMask | ButtonPressMask | ButtonReleaseMask ))); XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint); - if ( vo_fs ) vo_x11_decoration( mDisplay,vo_window,0 ); + if ( vo.fs ) vo_x11_decoration( mDisplay,vo_window,0 ); XMapWindow(mDisplay, vo_window); #ifdef HAVE_XINERAMA vo_x11_xinerama_move(mDisplay,vo_window,&hint); @@ -285,7 +284,7 @@ static uint32_t __FASTCALL__ check_events(int (* __FASTCALL__ adjust_size)(unsigned cw,unsigned ch,unsigned *w,unsigned *h)) { int e=vo_x11_check_events(mDisplay,adjust_size); - if(e&VO_EVENT_RESIZE) resize(vo_dwidth,vo_dheight); + if(e&VO_EVENT_RESIZE) resize(vo.dwidth,vo.dheight); return e|VO_EVENT_FORCE_UPDATE; } @@ -375,7 +374,7 @@ return query_format((vo_query_fourcc_t*)data); case VOCTRL_FULLSCREEN: vo_fullscreen(); - resize(vo_dwidth, vo_dheight); + resize(vo.dwidth, vo.dheight); return VO_TRUE; case VOCTRL_GET_NUM_FRAMES: *(uint32_t *)data = num_buffers; Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/vo_sdl.c 2012-10-15 13:38:17 UTC (rev 159) @@ -634,7 +634,7 @@ aspect_save_prescale(d_width ? d_width : width, d_height ? d_height : height); /* Save the original Image size */ - softzoom=flags&VOFLAG_SWSCALE; + vo.softzoom=flags&VOFLAG_SWSCALE; priv->X = 0; priv->width = width; priv->height = height; @@ -760,7 +760,7 @@ { struct sdl_priv_s *priv = &sdl_priv; unsigned i,retval; - priv->num_buffs=vo_doublebuffering?vo_da_buffs:1; + priv->num_buffs=vo.doublebuffering?vo.da_buffs:1; #ifdef CONFIG_VIDIX if(!vidix_name) { @@ -964,7 +964,7 @@ else if ( keypressed == SDLK_n ) { #ifdef HAVE_X11 - aspect(&priv->dstwidth, &priv->dstheight,softzoom?A_ZOOM:A_NOZOOM); + aspect(&priv->dstwidth, &priv->dstheight,vo.softzoom?A_ZOOM:A_NOZOOM); #endif if (priv->surface->w != priv->dstwidth || priv->surface->h != priv->dstheight) { if(enable_xp) LOCK_VDECODING(); Modified: mplayerxp/libvo/vo_vesa.c =================================================================== --- mplayerxp/libvo/vo_vesa.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/vo_vesa.c 2012-10-15 13:38:17 UTC (rev 159) @@ -252,7 +252,7 @@ else { int err; - if((err=vbeSetDisplayStart(multi_buff[idx],vo_vsync)) != VBE_OK) + if((err=vbeSetDisplayStart(multi_buff[idx],vo.vsync)) != VBE_OK) { vesa_term(); PRINT_VBE_ERR("vbeSetDisplayStart",err); @@ -482,25 +482,25 @@ } srcBpp = bpp; srcFourcc = format; - if(vo_dbpp) bpp = vo_dbpp; + if(vo.dbpp) bpp = vo.dbpp; switch(bpp) { - case 8: + case 8: dstFourcc = IMGFMT_BGR8; break; - case 15: + case 15: dstFourcc = IMGFMT_BGR15; break; - case 16: + case 16: dstFourcc = IMGFMT_BGR16; break; - case 24: + case 24: dstFourcc = IMGFMT_BGR24; break; - case 32: + case 32: dstFourcc = IMGFMT_BGR32; break; - default: + default: dstFourcc = IMGFMT_BGR16; break; } @@ -522,9 +522,9 @@ dstW = d_width; dstH = d_height; } - if(vo_screenwidth) w = vo_screenwidth; + if(vo.screenwidth) w = vo.screenwidth; else w = max(dstW,width); - if(vo_screenheight) h = vo_screenheight; + if(vo.screenheight) h = vo.screenheight; else h = max(dstH,height); for(i=0;i < num_modes;i++) { @@ -628,8 +628,8 @@ ,vsize); MSG_V(" at %08lXh",(unsigned long)lfb); MSG_V("\n"); - if(!(multi_size = fillMultiBuffer(vsize,vo_da_buffs))) return -1; - if(vo_doublebuffering && multi_size < 2) + if(!(multi_size = fillMultiBuffer(vsize,vo.da_buffs))) return -1; + if(vo.doublebuffering && multi_size < 2) MSG_ERR("vo_vesa: Can't use double buffering: not enough video memory\n"); else MSG_V("vo_vesa: using %u buffers for multi buffering\n",multi_size); @@ -728,7 +728,7 @@ return -1; } MSG_V("vo_vesa: VESA initialization complete\n"); - if(HAS_DGA() && vo_doublebuffering) + if(HAS_DGA() && vo.doublebuffering) { for(i=0;i<multi_size;i++) { Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/vo_x11.c 2012-10-15 13:38:17 UTC (rev 159) @@ -95,8 +95,8 @@ if (ret & VO_EVENT_RESIZE) { unsigned idx; - unsigned newW= vo_dwidth; - unsigned newH= vo_dheight; + unsigned newW= vo.dwidth; + unsigned newH= vo.dheight; int newAspect= (newW*(1<<16) + (newH>>1))/newH; if(newAspect>baseAspect) newW= (newH*baseAspect + (1<<15))>>16; else newH= ((newW<<16) + (baseAspect>>1)) /baseAspect; @@ -131,7 +131,7 @@ UNUSED(info); - num_buffers=vo_doublebuffering?vo_da_buffs:1; + num_buffers=vo.doublebuffering?vo.da_buffs:1; if (!title) title = strdup("MPlayerXP X11 (XImage/Shm) render"); @@ -155,9 +155,9 @@ aspect_save_orig(width,height); aspect_save_prescale(d_width,d_height); - aspect_save_screenres(vo_screenwidth,vo_screenheight); + aspect_save_screenres(vo.screenwidth,vo.screenheight); - softzoom=flags&VOFLAG_SWSCALE; + vo.softzoom=flags&VOFLAG_SWSCALE; aspect(&d_width,&d_height,A_NOZOOM); if( fullscreen ) aspect(&d_width,&d_height,A_ZOOM); @@ -167,8 +167,8 @@ bg=WhitePixel( mDisplay,mScreen ); fg=BlackPixel( mDisplay,mScreen ); - vo_dwidth=hint.width; - vo_dheight=hint.height; + vo.dwidth=hint.width; + vo.dheight=hint.height; image_width=d_width; image_height=d_height; @@ -282,7 +282,7 @@ { XShmPutImage( mDisplay,vo_window,vo_gc,myximage, 0,0, - ( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2, + ( vo.dwidth - myximage->width ) / 2,( vo.dheight - myximage->height ) / 2, myximage->width,myximage->height,True ); } else @@ -290,7 +290,7 @@ { XPutImage( mDisplay,vo_window,vo_gc,myximage, 0,0, - ( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2, + ( vo.dwidth - myximage->width ) / 2,( vo.dheight - myximage->height ) / 2, myximage->width,myximage->height); } #endif @@ -312,7 +312,7 @@ if (IMGFMT_IS_RGB(format->fourcc) && rgbfmt_depth(format->fourcc)<48) #endif { - if (rgbfmt_depth(format->fourcc) == (unsigned)vo_depthonscreen) + if (rgbfmt_depth(format->fourcc) == (unsigned)vo.depthonscreen) return 0x1|0x2|0x4; else return 0x1|0x4; Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/vo_xv.c 2012-10-15 13:38:17 UTC (rev 159) @@ -264,25 +264,25 @@ /* try all */ xv_reset_video_eq(); info.name=VO_EC_BRIGHTNESS; - info.value=vo_gamma_brightness; + info.value=vo.gamma.brightness; xv_set_video_eq(&info); info.name=VO_EC_CONTRAST; - info.value=vo_gamma_contrast; + info.value=vo.gamma.contrast; xv_set_video_eq(&info); info.name=VO_EC_SATURATION; - info.value=vo_gamma_saturation; + info.value=vo.gamma.saturation; xv_set_video_eq(&info); info.name=VO_EC_HUE; - info.value=vo_gamma_hue; + info.value=vo.gamma.hue; xv_set_video_eq(&info); info.name=VO_EC_RED_INTENSITY; - info.value=vo_gamma_red_intensity; + info.value=vo.gamma.red_intensity; xv_set_video_eq(&info); info.name=VO_EC_GREEN_INTENSITY; - info.value=vo_gamma_green_intensity; + info.value=vo.gamma.green_intensity; xv_set_video_eq(&info); info.name=VO_EC_BLUE_INTENSITY; - info.value=vo_gamma_blue_intensity; + info.value=vo.gamma.blue_intensity; xv_set_video_eq(&info); } @@ -320,22 +320,22 @@ image_width = width; image_format=format; - vo_fs=flags&VOFLAG_FULLSCREEN; - softzoom=flags&VOFLAG_SWSCALE; - if ( vo_fs ) - { vo_old_width=d_width; vo_old_height=d_height; } + vo.fs=flags&VOFLAG_FULLSCREEN; + vo.softzoom=flags&VOFLAG_SWSCALE; + if ( vo.fs ) + { vo.old_width=d_width; vo.old_height=d_height; } #ifdef HAVE_XF86VM if( flags&0x02 ) vm = 1; #endif flip_flag=flags&VOFLAG_FLIPPING; - num_buffers=vo_doublebuffering?vo_da_buffs:1; + num_buffers=vo.doublebuffering?vo.da_buffs:1; - aspect_save_screenres(vo_screenwidth,vo_screenheight); + aspect_save_screenres(vo.screenwidth,vo.screenheight); - aspect(&d_width,&d_height,softzoom?A_ZOOM:A_NOZOOM); - if( vo_fs ) aspect(&d_width,&d_height,A_ZOOM); + aspect(&d_width,&d_height,vo.softzoom?A_ZOOM:A_NOZOOM); + if( vo.fs ) aspect(&d_width,&d_height,A_ZOOM); vo_x11_calcpos(&hint,d_width,d_height,flags); hint.flags = PPosition | PSize; @@ -368,7 +368,7 @@ | ButtonPressMask | ButtonReleaseMask ))); XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint); - if ( vo_fs ) vo_x11_decoration( mDisplay,vo_window,0 ); + if ( vo.fs ) vo_x11_decoration( mDisplay,vo_window,0 ); XMapWindow(mDisplay, vo_window); #ifdef HAVE_XINERAMA vo_x11_xinerama_move(mDisplay,vo_window,&hint); @@ -464,16 +464,16 @@ XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot ); MSG_V( "[xv] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); - aspect(&dwidth,&dheight,softzoom?A_ZOOM:A_NOZOOM); - if ( vo_fs ) + aspect(&dwidth,&dheight,vo.softzoom?A_ZOOM:A_NOZOOM); + if ( vo.fs ) { aspect(&dwidth,&dheight,A_ZOOM); - drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2; + drwX=( vo.screenwidth - (dwidth > vo.screenwidth?vo.screenwidth:dwidth) ) / 2; drwcX+=drwX; - drwY=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2; + drwY=( vo.screenheight - (dheight > vo.screenheight?vo.screenheight:dheight) ) / 2; drwcY+=drwY; - drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); - drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight); + drwWidth=(dwidth > vo.screenwidth?vo.screenwidth:dwidth); + drwHeight=(dheight > vo.screenheight?vo.screenheight:dheight); MSG_V( "[xv-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); } saver_off(mDisplay); // turning off screen saver @@ -528,23 +528,23 @@ XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot ); MSG_V( "[xv-resize] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); - aspect(&dwidth,&dheight,softzoom?A_ZOOM:A_NOZOOM); - if ( vo_fs ) + aspect(&dwidth,&dheight,vo.softzoom?A_ZOOM:A_NOZOOM); + if ( vo.fs ) { aspect(&dwidth,&dheight,A_ZOOM); - drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2; + drwX=( vo.screenwidth - (dwidth > vo.screenwidth?vo.screenwidth:dwidth) ) / 2; drwcX+=drwX; - drwY=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2; + drwY=( vo.screenheight - (dheight > vo.screenheight?vo.screenheight:dheight) ) / 2; drwcY+=drwY; - drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); - drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight); + drwWidth=(dwidth > vo.screenwidth?vo.screenwidth:dwidth); + drwHeight=(dheight > vo.screenheight?vo.screenheight:dheight); MSG_V( "[xv-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); } } if ( e & VO_EVENT_EXPOSE ) { XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[expose_idx], 0, 0, image_width, image_height, drwX, drwY, 1, 1, False); - XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[expose_idx], 0, 0, image_width, image_height, drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight), False); + XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[expose_idx], 0, 0, image_width, image_height, drwX,drwY,drwWidth,(vo.fs?drwHeight - 1:drwHeight), False); } return e|VO_EVENT_FORCE_UPDATE; } @@ -554,7 +554,7 @@ expose_idx=idx; XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[idx], 0, 0, image_width, image_height, - drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight), + drwX,drwY,drwWidth,(vo.fs?drwHeight - 1:drwHeight), False); if (num_buffers>1) XFlush(mDisplay); else XSync(mDisplay, False); Modified: mplayerxp/libvo/vo_xvidix.c =================================================================== --- mplayerxp/libvo/vo_xvidix.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/vo_xvidix.c 2012-10-15 13:38:17 UTC (rev 159) @@ -82,19 +82,19 @@ XTranslateCoordinates(mDisplay, vo_window, mRoot, 0, 0, &drwcX, &drwcY, &mRoot); - if (!vo_fs) + if (!vo.fs) MSG_V( "[xvidix] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n", drwcX, drwcY, drwX, drwY, drwWidth, drwHeight); /* following stuff copied from vo_xmga.c */ - if (vo_fs) + if (vo.fs) { - drwX = (vo_screenwidth - (dwidth > vo_screenwidth ? vo_screenwidth : dwidth)) / 2; + drwX = (vo.screenwidth - (dwidth > vo.screenwidth ? vo.screenwidth : dwidth)) / 2; drwcX += drwX; - drwY = (vo_screenheight - (dheight > vo_screenheight ? vo_screenheight : dheight)) / 2; + drwY = (vo.screenheight - (dheight > vo.screenheight ? vo.screenheight : dheight)) / 2; drwcY += drwY; - drwWidth = (dwidth > vo_screenwidth ? vo_screenwidth : dwidth); - drwHeight = (dheight > vo_screenheight ? vo_screenheight : dheight); + drwWidth = (dwidth > vo.screenwidth ? vo.screenwidth : dwidth); + drwHeight = (dheight > vo.screenheight ? vo.screenheight : dheight); MSG_V( "[xvidix-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n", drwcX, drwcY, drwX, drwY, drwWidth, drwHeight); } @@ -135,8 +135,8 @@ /* FIXME: implement runtime resize/move if possible, this way is very ugly! */ vidix_stop(); if (vidix_init(image_width, image_height, window_x, window_y, - window_width, window_height, image_format, vo_depthonscreen, - vo_screenwidth, vo_screenheight,info) != 0) + window_width, window_height, image_format, vo.depthonscreen, + vo.screenwidth, vo.screenheight,info) != 0) { MSG_FATAL( "Can't initialize VIDIX driver: %s: %s\n", vidix_name, strerror(errno)); @@ -157,7 +157,7 @@ XClearWindow( mDisplay,vo_window ); XSetForeground(mDisplay, vo_gc, fgColor); XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth, - (vo_fs ? drwHeight - 1 : drwHeight)); + (vo.fs ? drwHeight - 1 : drwHeight)); /* flush, update drawable */ XFlush(mDisplay); @@ -219,21 +219,21 @@ } aspect_save_orig(width, height); aspect_save_prescale(d_width, d_height); - aspect_save_screenres(vo_screenwidth, vo_screenheight); + aspect_save_screenres(vo.screenwidth, vo.screenheight); window_x = 0; window_y = 0; window_width = d_width; window_height = d_height; - vo_fs = flags&0x01; - if (vo_fs) - { vo_old_width=d_width; vo_old_height=d_height; } + vo.fs = flags&0x01; + if (vo.fs) + { vo.old_width=d_width; vo.old_height=d_height; } X_already_started++; - + /* from xmga.c */ - switch(vo_depthonscreen) + switch(vo.depthonscreen) { case 32: case 24: @@ -247,12 +247,12 @@ break; default: MSG_ERR( "Sorry, this (%d) color depth is not supported\n", - vo_depthonscreen); + vo.depthonscreen); } aspect(&d_width, &d_height,flags & VOFLAG_SWSCALE?A_ZOOM:A_NOZOOM); - if (vo_fs) /* fullscreen */ + if (vo.fs) /* fullscreen */ { if (flags & VOFLAG_SWSCALE) { @@ -260,11 +260,11 @@ } else { - d_width = vo_screenwidth; - d_height = vo_screenheight; + d_width = vo.screenwidth; + d_height = vo.screenheight; } - window_width = vo_screenwidth; - window_height = vo_screenheight; + window_width = vo.screenwidth; + window_height = vo.screenheight; } dwidth = d_width; @@ -279,7 +279,7 @@ window_depth = 24; XMatchVisualInfo(mDisplay, mScreen, window_depth, TrueColor, &vinfo); - xswa.background_pixel = vo_fs ? BlackPixel(mDisplay, mScreen) : fgColor; + xswa.background_pixel = vo.fs ? BlackPixel(mDisplay, mScreen) : fgColor; xswa.border_pixel = 0; xswa.colormap = XCreateColormap(mDisplay, RootWindow(mDisplay, mScreen), vinfo.visual, AllocNone); @@ -300,7 +300,7 @@ vo_x11_classhint(mDisplay, vo_window, "xvidix"); vo_x11_hidecursor(mDisplay, vo_window); - if (vo_fs) vo_x11_decoration(mDisplay, vo_window, 0); + if (vo.fs) vo_x11_decoration(mDisplay, vo_window, 0); XGetNormalHints(mDisplay, vo_window, &hint); hint.x = window_x; Modified: mplayerxp/libvo/vosub_vidix.c =================================================================== --- mplayerxp/libvo/vosub_vidix.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/vosub_vidix.c 2012-10-15 13:38:17 UTC (rev 159) @@ -93,23 +93,23 @@ "vo_gamma_red_intensity=%i\n" "vo_gamma_green_intensity=%i\n" "vo_gamma_blue_intensity=%i\n" - ,vo_gamma_brightness - ,vo_gamma_saturation - ,vo_gamma_contrast - ,vo_gamma_hue - ,vo_gamma_red_intensity - ,vo_gamma_green_intensity - ,vo_gamma_blue_intensity); + ,vo.gamma.brightness + ,vo.gamma.saturation + ,vo.gamma.contrast + ,vo.gamma.hue + ,vo.gamma.red_intensity + ,vo.gamma.green_intensity + ,vo.gamma.blue_intensity); /* To use full set of vid_eq.cap */ if(vdlPlaybackGetEq(vidix_handler,&vid_eq) == 0) { - vid_eq.brightness = vo_gamma_brightness; - vid_eq.saturation = vo_gamma_saturation; - vid_eq.contrast = vo_gamma_contrast; - vid_eq.hue = vo_gamma_hue; - vid_eq.red_intensity = vo_gamma_red_intensity; - vid_eq.green_intensity = vo_gamma_green_intensity; - vid_eq.blue_intensity = vo_gamma_blue_intensity; + vid_eq.brightness = vo.gamma.brightness; + vid_eq.saturation = vo.gamma.saturation; + vid_eq.contrast = vo.gamma.contrast; + vid_eq.hue = vo.gamma.hue; + vid_eq.red_intensity = vo.gamma.red_intensity; + vid_eq.green_intensity = vo.gamma.green_intensity; + vid_eq.blue_intensity = vo.gamma.blue_intensity; vid_eq.flags = VEQ_FLG_ITU_R_BT_601; vdlPlaybackSetEq(vidix_handler,&vid_eq); } @@ -136,9 +136,9 @@ MSG_DBG2("vidix_term() was called\n"); vidix_stop(); vdlClose(vidix_handler); - if(vo_use_bm) + if(vo.use_bm) { - for(i=0;i<vo_da_buffs;i++) + for(i=0;i<vo.da_buffs;i++) { if(dma_mem_locked) munlock(bm_buffs[i],vidix_play->frame_size); free(bm_buffs[i]); @@ -202,7 +202,7 @@ void __FASTCALL__ vidix_change_frame(unsigned idx) { MSG_DBG2("vidix_change_frame() was called\n"); - if(vo_use_bm == 1) vidix_copy_dma(idx,0); + if(vo.use_bm == 1) vidix_copy_dma(idx,0); else vdlPlaybackFrameSelect(vidix_handler,idx); } @@ -417,8 +417,8 @@ vidix_play->dest.y = y_org; vidix_play->dest.w = dst_width; vidix_play->dest.h = dst_height; - vidix_play->num_frames=(vo_doublebuffering && vo_use_bm != 1)?NUM_FRAMES-1:1; - if(vidix_play->num_frames > vo_da_buffs) vidix_play->num_frames = vo_da_buffs; + vidix_play->num_frames=(vo.doublebuffering && vo.use_bm != 1)?NUM_FRAMES-1:1; + if(vidix_play->num_frames > vo.da_buffs) vidix_play->num_frames = vo.da_buffs; vidix_play->src.pitch.y = vidix_play->src.pitch.u = vidix_play->src.pitch.v = 0; if(info) { @@ -469,14 +469,14 @@ } MSG_V("using %d buffers\n", vidix_play->num_frames); /* configure busmastering */ - if(vo_use_bm) + if(vo.use_bm) { #ifdef HAVE_MEMALIGN if(vidix_cap->flags & FLAG_DMA) { int psize = getpagesize(); dma_mem_locked=1; - for(i=0;i<vo_da_buffs;i++) + for(i=0;i<vo.da_buffs;i++) { if(!bm_buffs[i]) bm_buffs[i] = memalign(psize, vidix_play->frame_size); if(!(bm_buffs[i])) @@ -501,10 +501,10 @@ #endif { MSG_ERR("Can not configure bus mastering: your driver is not DMA capable\n"); - vo_use_bm = 0; + vo.use_bm = 0; } } - if(vo_use_bm) MSG_OK("using BUSMASTERING\n"); + if(vo.use_bm) MSG_OK("using BUSMASTERING\n"); vidix_mem = vidix_play->dga_addr; if(!video_clean) @@ -573,7 +573,7 @@ static void __FASTCALL__ vidix_dri_get_surface_caps(dri_surface_cap_t *caps) { - caps->caps = vo_use_bm ? DRI_CAP_TEMP_VIDEO|DRI_CAP_BUSMASTERING : DRI_CAP_VIDEO_MMAPED; + caps->caps = vo.use_bm ? DRI_CAP_TEMP_VIDEO|DRI_CAP_BUSMASTERING : DRI_CAP_VIDEO_MMAPED; caps->caps |= DRI_CAP_HORZSCALER | DRI_CAP_VERTSCALER; if((vidix_cap->flags & FLAG_DOWNSCALER) == FLAG_DOWNSCALER) caps->caps |= DRI_CAP_DOWNSCALER; @@ -597,7 +597,7 @@ static void __FASTCALL__ vidix_dri_get_surface(dri_surface_t *surf) { - if(vo_use_bm) + if(vo.use_bm) { surf->planes[0] = bm_buffs[surf->idx] + vidix_play->offset.y; surf->planes[1] = bm_buffs[surf->idx] + vidix_play->offset.v; @@ -622,7 +622,7 @@ if(plugin_inited) return (*server_control)(request,data); break; case VOCTRL_GET_NUM_FRAMES: - *(uint32_t *)data = (vo_use_bm == 1) ? vo_da_buffs : vidix_play->num_frames; + *(uint32_t *)data = (vo.use_bm == 1) ? vo.da_buffs : vidix_play->num_frames; return VO_TRUE; case DRI_GET_SURFACE_CAPS: vidix_dri_get_surface_caps(data); @@ -631,7 +631,7 @@ vidix_dri_get_surface(data); return VO_TRUE; case VOCTRL_FLUSH_PAGES: - if(vo_use_bm > 1) vidix_copy_dma(*(uint32_t *)data,1); + if(vo.use_bm > 1) vidix_copy_dma(*(uint32_t *)data,1); return VO_TRUE; case VOCTRL_GET_EQUALIZER: if(!vidix_get_video_eq(data)) return VO_TRUE; Modified: mplayerxp/libvo/x11_common.c =================================================================== --- mplayerxp/libvo/x11_common.c 2012-10-15 11:06:19 UTC (rev 158) +++ mplayerxp/libvo/x11_common.c 2012-10-15 13:38:17 UTC (rev 159) @@ -267,7 +267,7 @@ XWindowAttributes attribs; char* dispName; - if(vo_depthonscreen) return 1; // already called + if(vo.depthonscreen) return 1; // already called XSetErrorHandler(x11_errorhandler); @@ -298,10 +298,10 @@ screens = XineramaQueryScreens(mDisplay, &num_screens); if(xinerama_screen >= num_screens) xinerama_screen = 0; - if (! vo_screenwidth) - vo_screenwidth=screens[xinerama_screen].width; - if (! vo_screenheight) - vo_screenheight=screens[xinerama_screen].height; + if (! vo.screenwidth) + vo.screenwidth=screens[xinerama_screen].width; + if (! vo.screenheight) + vo.screenheight=screens[xinerama_screen].height; xinerama_x = screens[xinerama_screen].x_org; xinerama_y = screens[xinerama_screen].y_org; @@ -313,15 +313,15 @@ { int clock; XF86VidModeGetModeLine( mDisplay,mScreen,&clock ,&modeline ); - if ( !vo_screenwidth ) vo_screenwidth=modeline.hdisplay; - if ( !vo_screenheight ) vo_screenheight=modeline.vdisplay; + if ( !vo.screenwidth ) vo.screenwidth=modeline.hdisplay; + if ( !vo.screenheight ) vo.screenheight=modeline.vdisplay; } #endif { - if (! vo_screenwidth) - vo_screenwidth=DisplayWidth( mDisplay,mScreen ); - if (! vo_screenheight) - vo_screenheight=DisplayHeight( mDisplay,mScreen ); + if (! vo.screenwidth) + vo.screenwidth=DisplayWidth( mDisplay,mScreen ); + if (! vo.screenheight) + vo.screenheight=DisplayHeight( mDisplay,mScreen ); } // get color depth (from root window, or the best visual): XGetWindowAttributes(mDisplay, mRootWin, &attribs); @@ -339,7 +339,7 @@ #endif mXImage=XGetImage( mDisplay,mRootWin,0,0,1,1,AllPlanes,ZPixmap ); - vo_depthonscreen = depth; // display depth on screen + vo.depthonscreen = depth; // display depth on screen // get bits/pixel from XImage structure: if (mXImage == NULL) { @@ -354,15 +354,15 @@ * Maybe we should rename vo_depthonscreen to (or add) vo_bpp? */ bpp=mXImage->bits_per_pixel; - if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi + if((vo.depthonscreen+7)/8 != (bpp+7)/8) vo.depthonscreen=bpp; // by A'rpi mask=mXImage->red_mask|mXImage->green_mask|mXImage->blue_mask; MSG_V("vo: X11 color mask: %X (R:%lX G:%lX B:%lX)\n", mask,mXImage->red_mask,mXImage->green_mask,mXImage->blue_mask); XDestroyImage( mXImage ); } - if(((vo_depthonscreen+7)/8)==2){ - if(mask==0x7FFF) vo_depthonscreen=15; else - if(mask==0xFFFF) vo_depthonscreen=16; + if(((vo.depthonscreen+7)/8)==2){ + if(mask==0x7FFF) vo.depthonscreen=15; else + if(mask==0xFFFF) vo.depthonscreen=16; } // XCloseDisplay( mDisplay ); /* slightly improved local display detection AST */ @@ -372,8 +372,8 @@ dispName += 9; if (*dispName==':') mLocalDisplay=1; else mLocalDisplay=0; MSG_V("vo: X11 running at %dx%d with depth %d and %d bits/pixel (\"%s\" => %s display)\n", - vo_screenwidth,vo_screenheight, - depth, vo_depthonscreen, + vo.screenwidth,vo.screenheight, + depth, vo.depthonscreen, dispName,mLocalDisplay?"local":"remote"); return 1; @@ -573,14 +573,14 @@ void __FASTCALL__ vo_x11_decoration( Display * vo_Display,Window w,int d ) { - if(vo_fsmode&1){ + if(vo.fsmode&1){ XSetWindowAttributes attr; attr.override_redirect = True; XChangeWindowAttributes(vo_Display, w, CWOverrideRedirect, &attr); // XMapWindow(vo_Display, w); } - if(vo_fsmode&8){ + if(vo.fsmode&8){ XSetTransientForHint (vo_Display, w, RootWindow(vo_Display,mScreen)); } @@ -595,12 +595,12 @@ d=MWM_DECOR_ALL; } #if 0 - vo_MotifWmHints.decorations=d|((vo_fsmode&2)?0:MWM_DECOR_MENU); + vo_MotifWmHints.decorations=d|((vo.fsmode&2)?0:MWM_DECOR_MENU); #else - vo_MotifWmHints.decorations=d|((vo_fsmode&2)?M... [truncated message content] |
From: <nic...@us...> - 2012-10-18 11:33:08
|
Revision: 168 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=168&view=rev Author: nickols_k Date: 2012-10-18 11:32:55 +0000 (Thu, 18 Oct 2012) Log Message: ----------- improve readability of source code Modified Paths: -------------- mplayerxp/dump.c mplayerxp/libmpdemux/demux_aiff.c mplayerxp/libmpdemux/demux_asf.c mplayerxp/libmpdemux/demux_audio.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_demuxers.c mplayerxp/libmpdemux/demux_dv.c mplayerxp/libmpdemux/demux_film.c mplayerxp/libmpdemux/demux_fli.c mplayerxp/libmpdemux/demux_lavf.c mplayerxp/libmpdemux/demux_mkv.c mplayerxp/libmpdemux/demux_mov.c mplayerxp/libmpdemux/demux_mpg.c mplayerxp/libmpdemux/demux_mpxp64.c mplayerxp/libmpdemux/demux_nsv.c mplayerxp/libmpdemux/demux_nuv.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demux_pva.c mplayerxp/libmpdemux/demux_ra.c mplayerxp/libmpdemux/demux_rawaudio.c mplayerxp/libmpdemux/demux_rawvideo.c mplayerxp/libmpdemux/demux_real.c mplayerxp/libmpdemux/demux_smjpeg.c mplayerxp/libmpdemux/demux_ts.c mplayerxp/libmpdemux/demux_ty.c mplayerxp/libmpdemux/demux_vqf.c mplayerxp/libmpdemux/demux_y4m.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_r.c mplayerxp/libmpdemux/demuxer_r.h mplayerxp/mplayer.c Modified: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/dump.c 2012-10-18 11:32:55 UTC (rev 168) @@ -332,6 +332,7 @@ if (seek_to_sec) { float d; float rel_seek_secs=0; + seek_args_t seek_p = { 0, 1}; int a,b; if (sscanf(seek_to_sec, "%d:%d:%f", &a,&b,&d)==3) rel_seek_secs += 3600*a +60*b +d ; @@ -342,7 +343,8 @@ seek_to_sec = NULL; MSG_INFO("seeking to %u seconds\n"); - demux_seek_r(demuxer,rel_seek_secs,1); + seek_p.secs=rel_seek_secs; + demux_seek_r(demuxer,&seek_p); } aeof=sh_audio?0:1; veof=sh_video?0:1; Modified: mplayerxp/libmpdemux/demux_aiff.c =================================================================== --- mplayerxp/libmpdemux/demux_aiff.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_aiff.c 2012-10-18 11:32:55 UTC (rev 168) @@ -197,13 +197,13 @@ return 1; } -static void aiff_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){ +static void aiff_seek(demuxer_t *demuxer,const seek_args_t* seeka){ stream_t* s = demuxer->stream; sh_audio_t* sh_audio = demuxer->audio->sh; off_t base,pos; - base = (flags&DEMUX_SEEK_SET) ? demuxer->movi_start : stream_tell(s); - pos=base+(flags&DEMUX_SEEK_PERCENTS?(demuxer->movi_end - demuxer->movi_start):sh_audio->i_bps)*rel_seek_secs; + base = (seeka->flags&DEMUX_SEEK_SET) ? demuxer->movi_start : stream_tell(s); + pos=base+(seeka->flags&DEMUX_SEEK_PERCENTS?(demuxer->movi_end - demuxer->movi_start):sh_audio->i_bps)*seeka->secs; pos -= (pos % (sh_audio->channels * sh_audio->samplesize) ); stream_seek(s,pos); resync_audio_stream(sh_audio); Modified: mplayerxp/libmpdemux/demux_asf.c =================================================================== --- mplayerxp/libmpdemux/demux_asf.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_asf.c 2012-10-18 11:32:55 UTC (rev 168) @@ -678,7 +678,7 @@ } -static void asf_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){ +static void asf_seek(demuxer_t *demuxer,const seek_args_t* seeka){ demux_stream_t *d_audio=demuxer->audio; demux_stream_t *d_video=demuxer->video; asf_priv_t *apriv=demuxer->priv; @@ -686,12 +686,12 @@ /*================= seek in ASF ==========================*/ float p_rate=apriv->asf_packetrate; // packets / sec - off_t rel_seek_packs=(flags&DEMUX_SEEK_PERCENTS)? // FIXME: int may be enough? - (rel_seek_secs*(demuxer->movi_end-demuxer->movi_start)/apriv->asf_packetsize): - (rel_seek_secs*p_rate); + off_t rel_seek_packs=(seeka->flags&DEMUX_SEEK_PERCENTS)? // FIXME: int may be enough? + (seeka->secs*(demuxer->movi_end-demuxer->movi_start)/apriv->asf_packetsize): + (seeka->secs*p_rate); off_t rel_seek_bytes=rel_seek_packs*apriv->asf_packetsize; off_t newpos; - newpos=((flags&DEMUX_SEEK_SET)?demuxer->movi_start:demuxer->filepos)+rel_seek_bytes; + newpos=((seeka->flags&DEMUX_SEEK_SET)?demuxer->movi_start:demuxer->filepos)+rel_seek_bytes; if(newpos<0 || newpos<demuxer->movi_start) newpos=demuxer->movi_start; stream_seek(demuxer->stream,newpos); Modified: mplayerxp/libmpdemux/demux_audio.c =================================================================== --- mplayerxp/libmpdemux/demux_audio.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_audio.c 2012-10-18 11:32:55 UTC (rev 168) @@ -1150,7 +1150,7 @@ sh_audio->wf->nAvgBytesPerSec = 32 * 1024; // dummy to make mplayerxp not hang sh_audio->wf->cbSize = 24; break; - } + } case RAW_VOC: { char chunk[4]; @@ -1186,7 +1186,6 @@ unsigned int chunk_type; unsigned int chunk_size; WAVEFORMATEX* w; - unsigned char *pfcc; int l; sh_audio->wf = w = (WAVEFORMATEX*)malloc(sizeof(WAVEFORMATEX)); do @@ -1538,8 +1537,8 @@ int bit_len; demux_packet_t* dp; sh_audio_t* sh_audio = ds->sh; - da_priv_t* priv = demux->priv; - stream_t* s = demux->stream; + priv = demux->priv; + s = demux->stream; sh_audio = ds->sh; if (s->eof) return 0; @@ -1630,7 +1629,7 @@ } } -static void audio_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){ +static void audio_seek(demuxer_t *demuxer,const seek_args_t* seeka){ sh_audio_t* sh_audio; stream_t* s; int base,pos,frmt; @@ -1642,11 +1641,11 @@ priv = demuxer->priv; if(priv->frmt==RAW_MUSEPACK) { - da_priv_t* priv = demuxer->priv; - stream_t* s = demuxer->stream; - float target = rel_seek_secs; - if (flags & DEMUX_SEEK_PERCENTS) target *= priv->length; - if (!(flags & DEMUX_SEEK_SET)) target += priv->last_pts; + priv = demuxer->priv; + s = demuxer->stream; + float target = seeka->secs; + if (seeka->flags & DEMUX_SEEK_PERCENTS) target *= priv->length; + if (!(seeka->flags & DEMUX_SEEK_SET)) target += priv->last_pts; if (target < priv->last_pts) { stream_seek(s, demuxer->movi_start); priv->pos = 32; // empty bit buffer @@ -1670,10 +1669,10 @@ { unsigned percents,cpercents,npercents; off_t newpos,spos; - percents = (unsigned)(rel_seek_secs*100.)/(float)demuxer->movi_length; + percents = (unsigned)(seeka->secs*100.)/(float)demuxer->movi_length; spos=stream_tell(demuxer->stream); cpercents=(unsigned)((float)spos*100./(float)priv->nbytes); - npercents=(flags&DEMUX_SEEK_SET)?percents:cpercents+percents; + npercents=(seeka->flags&DEMUX_SEEK_SET)?percents:cpercents+percents; if(npercents>100) npercents=100; newpos=demuxer->movi_start+(off_t)(((float)priv->toc[npercents]/256.0)*priv->nbytes); MSG_DBG2("xing seeking: secs=%f prcnts=%u cprcnts=%u spos=%llu newpos=%llu\n",rel_seek_secs,npercents,cpercents,spos,newpos); @@ -1681,8 +1680,8 @@ priv->last_pts=(((float)demuxer->movi_length*npercents)/100.)*1000.; return; } - if((priv->frmt == RAW_MP3 || priv->frmt == RAW_MP2 || priv->frmt == RAW_MP1) && hr_mp3_seek && !(flags & DEMUX_SEEK_PERCENTS)) { - len = (flags & DEMUX_SEEK_SET) ? rel_seek_secs - priv->last_pts : rel_seek_secs; + if((priv->frmt == RAW_MP3 || priv->frmt == RAW_MP2 || priv->frmt == RAW_MP1) && hr_mp3_seek && !(seeka->flags & DEMUX_SEEK_PERCENTS)) { + len = (seeka->flags & DEMUX_SEEK_SET) ? seeka->secs - priv->last_pts : seeka->secs; if(len < 0) { stream_seek(s,demuxer->movi_start); len = priv->last_pts + len; @@ -1695,8 +1694,8 @@ return; } - base = flags&DEMUX_SEEK_SET ? demuxer->movi_start : stream_tell(s); - pos=base+(flags&DEMUX_SEEK_PERCENTS?(demuxer->movi_end - demuxer->movi_start):sh_audio->i_bps)*rel_seek_secs; + base = seeka->flags&DEMUX_SEEK_SET ? demuxer->movi_start : stream_tell(s); + pos=base+(seeka->flags&DEMUX_SEEK_PERCENTS?(demuxer->movi_end - demuxer->movi_start):sh_audio->i_bps)*seeka->secs; if(demuxer->movi_end && pos >= demuxer->movi_end) { sh_audio->timer = (stream_tell(s) - demuxer->movi_start)/(float)sh_audio->i_bps; @@ -1706,7 +1705,7 @@ priv->last_pts = (pos-demuxer->movi_start)/(float)sh_audio->i_bps; sh_audio->timer = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - + frmt=priv->frmt; if(frmt==RAW_WAV) { @@ -1719,7 +1718,7 @@ } switch(frmt) { case RAW_AC3: { - len = (flags & DEMUX_SEEK_SET) ? rel_seek_secs - priv->last_pts : rel_seek_secs; + len = (seeka->flags & DEMUX_SEEK_SET) ? seeka->secs - priv->last_pts : seeka->secs; if(len < 0) { stream_seek(s,demuxer->movi_start); len = priv->last_pts + len; @@ -1732,7 +1731,7 @@ return; } case RAW_DCA: { - len = (flags & DEMUX_SEEK_SET) ? rel_seek_secs - priv->last_pts : rel_seek_secs; + len = (seeka->flags & DEMUX_SEEK_SET) ? seeka->secs - priv->last_pts : seeka->secs; if(len < 0) { stream_seek(s,demuxer->movi_start); len = priv->last_pts + len; Modified: mplayerxp/libmpdemux/demux_avi.c =================================================================== --- mplayerxp/libmpdemux/demux_avi.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_avi.c 2012-10-18 11:32:55 UTC (rev 168) @@ -1336,7 +1336,7 @@ return demuxer; } -static void avi_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){ +static void avi_seek(demuxer_t *demuxer,const seek_args_t* seeka){ avi_priv_t *priv=demuxer->priv; demux_stream_t *d_audio=demuxer->audio; demux_stream_t *d_video=demuxer->video; @@ -1346,17 +1346,17 @@ //FIXME: OFF_T - Didn't check AVI case yet (avi files can't be >2G anyway?) //================= seek in AVI ========================== - int rel_seek_frames=rel_seek_secs*sh_video->fps; + int rel_seek_frames=seeka->secs*sh_video->fps; int video_chunk_pos=d_video->pos; int i; - if(flags&DEMUX_SEEK_SET){ + if(seeka->flags&DEMUX_SEEK_SET){ // seek SOF video_chunk_pos=0; } - if(flags&DEMUX_SEEK_PERCENTS){ - rel_seek_frames=rel_seek_secs*priv->numberofframes; + if(seeka->flags&DEMUX_SEEK_PERCENTS){ + rel_seek_frames=seeka->secs*priv->numberofframes; } priv->skip_video_frames=0; @@ -1396,7 +1396,7 @@ sh_video->num_frames=sh_video->num_frames_decoded=d_video->pack_no; priv->avi_video_pts=d_video->pack_no*(float)sh_video->video.dwScale/(float)sh_video->video.dwRate; d_video->pos=video_chunk_pos; - + MSG_DBG2("V_SEEK: pack=%d pts=%5.3f chunk=%d \n",d_video->pack_no,priv->avi_video_pts,video_chunk_pos); // ------------ STEP 2: seek audio, find the right chunk & pos ------------ @@ -1448,12 +1448,12 @@ MSG_V("SEEK: i=%d (max:%d) dpos=%d (wanted:%d) \n", i,chunk_max,(int)d_audio->dpos,curr_audio_pos); - + } else { // VBR audio int chunks=(priv->avi_video_pts)*(float)sh_audio->audio.dwRate/(float)sh_audio->audio.dwScale; audio_chunk_pos=0; - + // find audio chunk pos: for(i=0;i<priv->idx_size && chunks>0;i++){ int id=((AVIINDEXENTRY *)priv->idx)[i].ckid; @@ -1474,9 +1474,9 @@ } } //if(audio_chunk_pos>chunk_max) audio_chunk_pos=chunk_max; - + } - + // Now we have: // audio_chunk_pos = chunk no in index table (it's <=chunk_max) // skip_audio_bytes = bytes to be skipped after chunk seek Modified: mplayerxp/libmpdemux/demux_demuxers.c =================================================================== --- mplayerxp/libmpdemux/demux_demuxers.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_demuxers.c 2012-10-18 11:32:55 UTC (rev 168) @@ -19,7 +19,7 @@ dd_priv_t* priv; ret = (demuxer_t*)calloc(1,sizeof(demuxer_t)); - + priv = (dd_priv_t*)malloc(sizeof(dd_priv_t)); priv->vd = vd; priv->ad = ad; @@ -30,15 +30,15 @@ // Video is the most important :-) ret->stream = vd->stream; ret->flags = (vd->flags&DEMUXF_SEEKABLE) && (ad->flags&DEMUXF_SEEKABLE) && (sd->flags&DEMUXF_SEEKABLE); - + ret->video = vd->video; ret->audio = ad->audio; ret->sub = sd->sub; - + return ret; } -int demux_demuxers_fill_buffer(demuxer_t *demux,demux_stream_t *ds) { +static int demux_demuxers_fill_buffer(demuxer_t *demux,demux_stream_t *ds) { dd_priv_t* priv; priv=demux->priv; @@ -49,27 +49,28 @@ return demux_fill_buffer(priv->ad,ds); else if(ds->demuxer == priv->sd) return demux_fill_buffer(priv->sd,ds); - + MSG_ERR("Demux demuxers fill_buffer error : bad demuxer : not vd, ad nor sd\n"); return 0; } -void demux_demuxers_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) { +static void demux_demuxers_seek(demuxer_t *demuxer,const seek_args_t* seeka) { dd_priv_t* priv; float pos; priv=demuxer->priv; + seek_args_t seek_p = { seeka->secs, 1 }; stream_set_eof(priv->ad->stream,0); stream_set_eof(priv->sd->stream,0); // Seek video - demux_seek(priv->vd,rel_seek_secs,flags); + demux_seek(priv->vd,seeka); // Get the new pos pos = demuxer->video->pts; if(priv->ad != priv->vd) { sh_audio_t* sh = (sh_audio_t*)demuxer->audio->sh; - demux_seek(priv->ad,pos,1); + demux_seek(priv->ad,&seek_p); // In case the demuxer don't set pts if(!demuxer->audio->pts) demuxer->audio->pts = pos-((ds_tell_pts(demuxer->audio)-sh->a_in_buffer_len)/(float)sh->i_bps); @@ -78,11 +79,11 @@ } if(priv->sd != priv->vd) - demux_seek(priv->sd,pos,1); + demux_seek(priv->sd,&seek_p); } -void demux_close_demuxers(demuxer_t* demuxer) { +static void demux_close_demuxers(demuxer_t* demuxer) { dd_priv_t* priv = demuxer->priv; if(priv->vd) @@ -96,4 +97,3 @@ demux_info_free(demuxer); free(demuxer); } - Modified: mplayerxp/libmpdemux/demux_dv.c =================================================================== --- mplayerxp/libmpdemux/demux_dv.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_dv.c 2012-10-18 11:32:55 UTC (rev 168) @@ -46,20 +46,17 @@ dv_decoder_t *decoder; } rawdv_frames_t; -static void dv_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags) +static void dv_seek(demuxer_t *demuxer,const seek_args_t* seeka) { rawdv_frames_t *frames = (rawdv_frames_t *)demuxer->priv; sh_video_t *sh_video = demuxer->video->sh; - off_t newpos=(flags&DEMUX_SEEK_SET)?0:frames->current_frame; - if(flags&DEMUX_SEEK_PERCENTS) - { + off_t newpos=(seeka->flags&DEMUX_SEEK_SET)?0:frames->current_frame; + if(seeka->flags&DEMUX_SEEK_PERCENTS) { // float 0..1 - newpos+=rel_seek_secs*frames->frame_number; - } - else - { + newpos+=seeka->secs*frames->frame_number; + } else { // secs - newpos+=rel_seek_secs*sh_video->fps; + newpos+=seeka->secs*sh_video->fps; } if(newpos<0) newpos=0; Modified: mplayerxp/libmpdemux/demux_film.c =================================================================== --- mplayerxp/libmpdemux/demux_film.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_film.c 2012-10-18 11:32:55 UTC (rev 168) @@ -49,16 +49,16 @@ unsigned int film_version; } film_data_t; -static void film_seek(demuxer_t *demuxer, float rel_seek_secs, int flags) +static void film_seek(demuxer_t *demuxer, const seek_args_t* seeka) { film_data_t *film_data = (film_data_t *)demuxer->priv; - int new_current_chunk=(flags&DEMUX_SEEK_SET)?0:film_data->current_chunk; + int new_current_chunk=(seeka->flags&DEMUX_SEEK_SET)?0:film_data->current_chunk; - new_current_chunk += rel_seek_secs *(flags&DEMUX_SEEK_PERCENTS?film_data->total_chunks:film_data->chunks_per_second); + new_current_chunk += seeka->secs *(seeka->flags&DEMUX_SEEK_PERCENTS?film_data->total_chunks:film_data->chunks_per_second); MSG_V("current, total chunks = %d, %d; seek %5.3f sec, new chunk guess = %d\n", film_data->current_chunk, film_data->total_chunks, - rel_seek_secs, new_current_chunk); + seeka->secs, new_current_chunk); // check if the new chunk number is valid if (new_current_chunk < 0) @@ -74,9 +74,9 @@ film_data->current_chunk = new_current_chunk; MSG_V(" (flags = %X) actual new chunk = %d (syncinfo1 = %08X)\n", - flags, film_data->current_chunk, film_data->chunks[film_data->current_chunk].syncinfo1); + seeka->flags, film_data->current_chunk, film_data->chunks[film_data->current_chunk].syncinfo1); demuxer->video->pts=film_data->chunks[film_data->current_chunk].pts; - + } // return value: Modified: mplayerxp/libmpdemux/demux_fli.c =================================================================== --- mplayerxp/libmpdemux/demux_fli.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_fli.c 2012-10-18 11:32:55 UTC (rev 168) @@ -25,11 +25,11 @@ unsigned int *frame_size; } fli_frames_t; -static void fli_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){ +static void fli_seek(demuxer_t *demuxer,const seek_args_t* seeka){ fli_frames_t *frames = (fli_frames_t *)demuxer->priv; sh_video_t *sh_video = demuxer->video->sh; - int newpos=(flags&DEMUX_SEEK_SET)?0:frames->current_frame; - newpos+=rel_seek_secs*(flags&DEMUX_SEEK_PERCENTS?frames->num_frames:sh_video->fps); + int newpos=(seeka->flags&DEMUX_SEEK_SET)?0:frames->current_frame; + newpos+=seeka->secs*(seeka->flags&DEMUX_SEEK_PERCENTS?frames->num_frames:sh_video->fps); if(newpos<0) newpos=0; else if(newpos>frames->num_frames) newpos=frames->num_frames; frames->current_frame=newpos; Modified: mplayerxp/libmpdemux/demux_lavf.c =================================================================== --- mplayerxp/libmpdemux/demux_lavf.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_lavf.c 2012-10-18 11:32:55 UTC (rev 168) @@ -473,11 +473,11 @@ return 1; } -static void lavf_seek(demuxer_t *demuxer, float rel_seek_secs, int flags){ +static void lavf_seek(demuxer_t *demuxer,const seek_args_t* seeka){ lavf_priv_t *priv = demuxer->priv; - MSG_DBG2("lavf_demux(%p, %f, %d)\n", demuxer, rel_seek_secs, flags); + MSG_DBG2("lavf_demux(%p, %f, %d)\n", demuxer, seeka->secs, seeka->flags); - av_seek_frame(priv->avfc, -1, priv->last_pts + rel_seek_secs*AV_TIME_BASE, rel_seek_secs < 0 ? AVSEEK_FLAG_BACKWARD : 0); + av_seek_frame(priv->avfc, -1, priv->last_pts + seeka->secs*AV_TIME_BASE, seeka->secs < 0 ? AVSEEK_FLAG_BACKWARD : 0); } static int lavf_control(demuxer_t *demuxer, int cmd, any_t*arg) Modified: mplayerxp/libmpdemux/demux_mkv.c =================================================================== --- mplayerxp/libmpdemux/demux_mkv.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_mkv.c 2012-10-18 11:32:55 UTC (rev 168) @@ -2698,7 +2698,7 @@ return 0; } -static void mkv_seek (demuxer_t *demuxer, float rel_seek_secs, int flags); +static void mkv_seek (demuxer_t *demuxer,const seek_args_t* seeka); /** \brief Given a matroska track number and type, find the id that mplayer would ask for. * \param d The demuxer for which the subtitle id should be returned. @@ -2989,12 +2989,15 @@ demuxer->flags |= DEMUXF_SEEKABLE; if (mkv_d->chapters && dvd_chapter>1 && dvd_chapter<=mkv_d->num_chapters) { + seek_args_t seeka; if (!mkv_d->has_first_tc) { mkv_d->first_tc = 0; mkv_d->has_first_tc = 1; } - mkv_seek (demuxer, mkv_d->chapters[dvd_chapter-1].start/1000.0, 1); + seeka.secs=mkv_d->chapters[dvd_chapter-1].start/1000.0; + seeka.flags=1; + mkv_seek (demuxer, &seeka); } } @@ -3473,7 +3476,7 @@ uint64_t old_length; int64_t tc; uint32_t *lace_size; - uint8_t laces, flags; + uint8_t laces=0, flags; int i, num, tmp, use_this_block = 1; float current_pts; int16_t time; @@ -3776,19 +3779,19 @@ return 0; } -static void mkv_seek (demuxer_t *demuxer, float rel_seek_secs, int flags) +static void mkv_seek (demuxer_t *demuxer,const seek_args_t* seeka) { free_cached_dps (demuxer); - if (!(flags & 2)) /* time in secs */ + if (!(seeka->flags & 2)) /* time in secs */ { mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; stream_t *s = demuxer->stream; int64_t target_timecode = 0, diff, min_diff=0xFFFFFFFFFFFFFFFLL; int i; - if (!(flags & 1)) /* relative seek */ + if (!(seeka->flags & 1)) /* relative seek */ target_timecode = (int64_t) (mkv_d->last_pts * 1000.0); - target_timecode += (int64_t)(rel_seek_secs * 1000.0); + target_timecode += (int64_t)(seeka->secs * 1000.0); if (target_timecode < 0) target_timecode = 0; @@ -3832,12 +3835,12 @@ for (i=0; i < mkv_d->num_cluster_pos; i++) { diff = mkv_d->cluster_positions[i] - target_filepos; - if (rel_seek_secs < 0 && diff < 0 && -diff < min_diff) + if (seeka->secs < 0 && diff < 0 && -diff < min_diff) { cluster_pos = mkv_d->cluster_positions[i]; min_diff = -diff; } - else if (rel_seek_secs > 0 + else if (seeka->secs > 0 && (diff < 0 ? -1 * diff : diff) < min_diff) { cluster_pos = mkv_d->cluster_positions[i]; @@ -3850,10 +3853,10 @@ } else { - mkv_index_t *index = NULL; - int seek_id = (demuxer->video->id < 0) ? demuxer->audio->id : demuxer->video->id; + mkv_index_t *_index = NULL; + int seek_id = (demuxer->video->id < 0) ? demuxer->audio->id : demuxer->video->id; - /* let's find the entry in the indexes with the smallest */ + /* let's find the entry in the _indexes with the smallest */ /* difference to the wanted timecode. */ for (i=0; i < mkv_d->num_indexes; i++) if (mkv_d->indexes[i].tnum == seek_id) @@ -3861,15 +3864,15 @@ diff = target_timecode + mkv_d->first_tc - (int64_t) mkv_d->indexes[i].timecode * mkv_d->tc_scale / 1000000.0; - if ((flags & 1 || target_timecode <= mkv_d->last_pts*1000)) { - // SOF seek or seek backward: find the last index + if ((seeka->flags & 1 || target_timecode <= mkv_d->last_pts*1000)) { + // SOF seek or seek backward: find the last _index // position before target time if (diff < 0 || diff >= min_diff) continue; } else { - // Relative seek forward: find the first index position - // after target time. If no such index exists, find last + // Relative seek forward: find the first _index position + // after target time. If no such _index exists, find last // position between current position and target time. if (diff <= 0) { if (min_diff <= 0 && diff <= min_diff) @@ -3880,58 +3883,58 @@ continue; } min_diff = diff; - index = mkv_d->indexes + i; + _index = mkv_d->indexes + i; } - if (index) /* We've found an entry. */ + if (_index) /* We've found an entry. */ { mkv_d->cluster_size = mkv_d->blockgroup_size = 0; - stream_seek (s, index->filepos); + stream_seek (s, _index->filepos); } } if (demuxer->video->id >= 0) mkv_d->v_skip_to_keyframe = 1; - if (rel_seek_secs > 0.0) + if (seeka->secs > 0.0) mkv_d->skip_to_timecode = target_timecode; mkv_d->a_skip_to_keyframe = 1; mkv_demux(demuxer, NULL); } - else if ((demuxer->movi_end <= 0) || !(flags & 1)) + else if ((demuxer->movi_end <= 0) || !(seeka->flags & 1)) MSG_V( "[mkv] seek unsupported flags\n"); else { mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; stream_t *s = demuxer->stream; uint64_t target_filepos; - mkv_index_t *index = NULL; + mkv_index_t *_index = NULL; int i; - if (mkv_d->indexes == NULL) /* no index was found */ + if (mkv_d->indexes == NULL) /* no _index was found */ { /* I'm lazy... */ MSG_V( "[mkv] seek unsupported flags\n"); return; } - target_filepos = (uint64_t)(demuxer->movi_end * rel_seek_secs); + target_filepos = (uint64_t)(demuxer->movi_end * seeka->secs); for (i=0; i < mkv_d->num_indexes; i++) if (mkv_d->indexes[i].tnum == demuxer->video->id) - if ((index == NULL) || + if ((_index == NULL) || ((mkv_d->indexes[i].filepos >= target_filepos) && - ((index->filepos < target_filepos) || - (mkv_d->indexes[i].filepos < index->filepos)))) - index = &mkv_d->indexes[i]; + ((_index->filepos < target_filepos) || + (mkv_d->indexes[i].filepos < _index->filepos)))) + _index = &mkv_d->indexes[i]; - if (!index) + if (!_index) return; mkv_d->cluster_size = mkv_d->blockgroup_size = 0; - stream_seek (s, index->filepos); + stream_seek (s, _index->filepos); if (demuxer->video->id >= 0) mkv_d->v_skip_to_keyframe = 1; - mkv_d->skip_to_timecode = index->timecode; + mkv_d->skip_to_timecode = _index->timecode; mkv_d->a_skip_to_keyframe = 1; mkv_demux(demuxer, NULL); Modified: mplayerxp/libmpdemux/demux_mov.c =================================================================== --- mplayerxp/libmpdemux/demux_mov.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_mov.c 2012-10-18 11:32:55 UTC (rev 168) @@ -639,9 +639,9 @@ // --- // optional additional atom-based fields // ([int32_t size,int32_t type,some data ],repeat) - } my_stdata; + } my_stdata; #endif - int version, adjust; + int version=0, adjust; int is_vorbis = 0; sh_audio_t* sh=new_sh_audio(demuxer,priv->track_db); sh->format=trak->fourcc; @@ -1070,7 +1070,7 @@ // AVC decoder configuration record MSG_V("MOV: AVC decoder configuration record atom (%d)!\n", atom_len); if(atom_len > 8) { - int i, poffs, cnt; + int i, poffs, cnt=0; // Parse some parts of avcC, just for fun :) // real parsing is done by avc1 decoder MSG_V("MOV: avcC version: %d\n", *(trak->stdata+pos+8)); @@ -1999,26 +1999,26 @@ ds_add_packet(ds,dp); } else ds_read_packet(ds,demuxer->stream,x,pts,pos,DP_NONKEYFRAME); - + ++trak->pos; return 1; - + } -static float mov_seek_track(mov_track_t* trak,float pts,int flags){ +static float mov_seek_track(mov_track_t* trak,const seek_args_t* seeka){ + float pts=seeka->secs; + pts*=(seeka->flags&DEMUX_SEEK_PERCENTS?trak->length:(float)trak->timescale); - pts*=(flags&DEMUX_SEEK_PERCENTS?trak->length:(float)trak->timescale); - if(trak->samplesize){ int sample=pts/trak->duration; - if(!(flags&DEMUX_SEEK_SET)) sample+=trak->chunks[trak->pos].sample; // relative + if(!(seeka->flags&DEMUX_SEEK_SET)) sample+=trak->chunks[trak->pos].sample; // relative trak->pos=0; while(trak->pos<trak->chunks_size && trak->chunks[trak->pos].sample<sample) ++trak->pos; if (trak->pos == trak->chunks_size) return -1; pts=(float)(trak->chunks[trak->pos].sample*trak->duration)/(float)trak->timescale; } else { unsigned int ipts; - if(!(flags&DEMUX_SEEK_SET)) pts+=trak->samples[trak->pos].pts; + if(!(seeka->flags&DEMUX_SEEK_SET)) pts+=trak->samples[trak->pos].pts; if(pts<0) pts=0; ipts=pts; for(trak->pos=0;trak->pos<trak->samples_size;++trak->pos){ @@ -2042,7 +2042,7 @@ return pts; } -static void mov_seek(demuxer_t *demuxer,float pts,int flags){ +static void mov_seek(demuxer_t *demuxer,const seek_args_t* seeka){ mov_priv_t* priv=demuxer->priv; demux_stream_t* ds; mov_track_t* trak; @@ -2052,10 +2052,10 @@ if (trak) { //if(flags&2) pts*=(float)trak->length/(float)trak->timescale; //if(!(flags&1)) pts+=ds->pts; - ds->pts=mov_seek_track(trak,pts,flags); + ds->pts=mov_seek_track(trak,seeka); if (ds->pts < 0) ds->eof = 1; - else pts = ds->pts; - flags=DEMUX_SEEK_SET|DEMUX_SEEK_SECONDS; +// else pts = ds->pts; +// flags=DEMUX_SEEK_SET|DEMUX_SEEK_SECONDS; } ds=demuxer->audio; @@ -2063,7 +2063,7 @@ if (trak) { //if(flags&2) pts*=(float)trak->length/(float)trak->timescale; //if(!(flags&1)) pts+=ds->pts; - ds->pts=mov_seek_track(trak,pts,flags); + ds->pts=mov_seek_track(trak,seeka); if (ds->pts < 0) ds->eof = 1; } } Modified: mplayerxp/libmpdemux/demux_mpg.c =================================================================== --- mplayerxp/libmpdemux/demux_mpg.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_mpg.c 2012-10-18 11:32:55 UTC (rev 168) @@ -546,24 +546,24 @@ return 1; } -static void mpgps_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){ +static void mpgps_seek(demuxer_t *demuxer,const seek_args_t* seeka){ demux_stream_t *d_audio=demuxer->audio; demux_stream_t *d_video=demuxer->video; sh_audio_t *sh_audio=d_audio->sh; sh_video_t *sh_video=d_video->sh; //================= seek in MPEG ========================== - off_t newpos=(flags&DEMUX_SEEK_SET)?demuxer->movi_start:demuxer->filepos; + off_t newpos=(seeka->flags&DEMUX_SEEK_SET)?demuxer->movi_start:demuxer->filepos; - if(flags&DEMUX_SEEK_PERCENTS){ + if(seeka->flags&DEMUX_SEEK_PERCENTS){ // float seek 0..1 - newpos+=(demuxer->movi_end-demuxer->movi_start)*rel_seek_secs; + newpos+=(demuxer->movi_end-demuxer->movi_start)*seeka->secs; } else { // time seek (secs) if(!sh_video->i_bps) // unspecified or VBR - newpos+=2324*75*rel_seek_secs; // 174.3 kbyte/sec + newpos+=2324*75*seeka->secs; // 174.3 kbyte/sec else - newpos+=sh_video->i_bps*rel_seek_secs; + newpos+=sh_video->i_bps*seeka->secs; } if(newpos<demuxer->movi_start){ @@ -591,7 +591,7 @@ int i; if(sh_audio && !d_audio->eof && d_video->pts && d_audio->pts){ float a_pts=d_audio->pts; - a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; if(d_video->pts>a_pts){ skip_audio_frame(sh_audio); // sync audio continue; Modified: mplayerxp/libmpdemux/demux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-18 11:32:55 UTC (rev 168) @@ -794,16 +794,16 @@ } #define USE_INDEXES 1 -static void mpxpav64_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){ +static void mpxpav64_seek(demuxer_t *demuxer,const seek_args_t* seeka){ mpxpav64_priv_t *priv=demuxer->priv; float brate=priv->fprop.AveBitrate; - off_t rel_seek_bytes=(flags&DEMUX_SEEK_PERCENTS)? - (rel_seek_secs*(demuxer->movi_end-demuxer->movi_start)): - (rel_seek_secs*brate); + off_t rel_seek_bytes=(seeka->flags&DEMUX_SEEK_PERCENTS)? + (seeka->secs*(demuxer->movi_end-demuxer->movi_start)): + (seeka->secs*brate); uint64_t newpos,cpos; int has_idx; cpos=stream_tell(demuxer->stream); - newpos=((flags&DEMUX_SEEK_SET)?demuxer->movi_start:demuxer->filepos)+rel_seek_bytes; + newpos=((seeka->flags&DEMUX_SEEK_SET)?demuxer->movi_start:demuxer->filepos)+rel_seek_bytes; MSG_V("MPXPAV64_SEEK: We want %016llX newpos\n",newpos); /* have indexes */ has_idx=0; Modified: mplayerxp/libmpdemux/demux_nsv.c =================================================================== --- mplayerxp/libmpdemux/demux_nsv.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_nsv.c 2012-10-18 11:32:55 UTC (rev 168) @@ -33,7 +33,7 @@ /** * Seeking still to be implemented */ -static void nsv_seek ( demuxer_t *demuxer, float rel_seek_secs, int flags ) +static void nsv_seek ( demuxer_t *demuxer, const seek_args_t* seeka ) { // seeking is not yet implemented } Modified: mplayerxp/libmpdemux/demux_nuv.c =================================================================== --- mplayerxp/libmpdemux/demux_nuv.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_nuv.c 2012-10-18 11:32:55 UTC (rev 168) @@ -51,7 +51,7 @@ /** * Seek to a position relative to the current position, indicated in time. */ -static void nuv_seek ( demuxer_t *demuxer, float rel_seek_secs, int flags ) +static void nuv_seek ( demuxer_t *demuxer, const seek_args_t* seeka ) { #define MAX_TIME 1000000 nuv_priv_t* priv = demuxer->priv; @@ -60,11 +60,11 @@ off_t curr_pos; float current_time = 0; float start_time = MAX_TIME; - float target_time = start_time + rel_seek_secs * 1000; /* target_time, start_time are ms, rel_seek_secs s */ + float target_time = start_time + seeka->secs * 1000; /* target_time, start_time are ms, rel_seek_secs s */ orig_pos = stream_tell ( demuxer->stream ); - if ( rel_seek_secs > 0 ) + if ( seeka->secs > 0 ) { /* Seeking forward */ @@ -88,7 +88,7 @@ { start_time = rtjpeg_frameheader.timecode; /* Recalculate target time with real start time */ - target_time = start_time + rel_seek_secs*1000; + target_time = start_time + seeka->secs*1000; } current_time = rtjpeg_frameheader.timecode; @@ -104,7 +104,7 @@ { start_time = rtjpeg_frameheader.timecode; /* Recalculate target time with real start time */ - target_time = start_time + rel_seek_secs * 1000; + target_time = start_time + seeka->secs * 1000; } current_time = rtjpeg_frameheader.timecode; @@ -121,7 +121,7 @@ start_time = priv->current_position->time; /* Recalculate target time with real start time */ - target_time = start_time + rel_seek_secs * 1000; + target_time = start_time + seeka->secs * 1000; if(target_time < 0) Modified: mplayerxp/libmpdemux/demux_ogg.c =================================================================== --- mplayerxp/libmpdemux/demux_ogg.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_ogg.c 2012-10-18 11:32:55 UTC (rev 168) @@ -1250,7 +1250,7 @@ } -static void ogg_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) { +static void ogg_seek(demuxer_t *demuxer,const seek_args_t* seeka) { ogg_demuxer_t* ogg_d = demuxer->priv; ogg_sync_state* sync = &ogg_d->sync; ogg_page* page= &ogg_d->page; @@ -1294,14 +1294,14 @@ old_pos = ogg_d->pos; //calculate the granulepos to seek to - gp = flags & DEMUX_SEEK_SET ? 0 : os->lastpos; - if(flags & DEMUX_SEEK_PERCENTS) { + gp = seeka->flags & DEMUX_SEEK_SET ? 0 : os->lastpos; + if(seeka->flags & DEMUX_SEEK_PERCENTS) { if (ogg_d->final_granulepos > 0) - gp += ogg_d->final_granulepos * rel_seek_secs; + gp += ogg_d->final_granulepos * seeka->secs; else - gp += rel_seek_secs * (demuxer->movi_end - demuxer->movi_start) * os->lastpos / ogg_d->pos; + gp += seeka->secs * (demuxer->movi_end - demuxer->movi_start) * os->lastpos / ogg_d->pos; } else - gp += rel_seek_secs * rate; + gp += seeka->secs * rate; if (gp < 0) gp = 0; //calculate the filepos to seek to @@ -1320,14 +1320,14 @@ pos = ogg_d->syncpoints[sp].page_pos; precision = 0; } else { - pos = flags & DEMUX_SEEK_SET ? 0 : ogg_d->pos; - if(flags & DEMUX_SEEK_PERCENTS) - pos += (demuxer->movi_end - demuxer->movi_start) * rel_seek_secs; + pos = seeka->flags & DEMUX_SEEK_SET ? 0 : ogg_d->pos; + if(seeka->flags & DEMUX_SEEK_PERCENTS) + pos += (demuxer->movi_end - demuxer->movi_start) * seeka->secs; else { if (ogg_d->final_granulepos > 0) { - pos += rel_seek_secs * (demuxer->movi_end - demuxer->movi_start) / (ogg_d->final_granulepos / rate); + pos += seeka->secs * (demuxer->movi_end - demuxer->movi_start) / (ogg_d->final_granulepos / rate); } else if (os->lastpos > 0) { - pos += rel_seek_secs * ogg_d->pos / (os->lastpos / rate); + pos += seeka->secs * ogg_d->pos / (os->lastpos / rate); } } if (pos < 0) pos = 0; Modified: mplayerxp/libmpdemux/demux_pva.c =================================================================== --- mplayerxp/libmpdemux/demux_pva.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_pva.c 2012-10-18 11:32:55 UTC (rev 168) @@ -471,7 +471,7 @@ return 1; } -static void pva_seek(demuxer_t * demuxer,float rel_seek_secs,int flags) +static void pva_seek(demuxer_t * demuxer,const seek_args_t* seeka) { int total_bitrate=0; off_t dest_offset; @@ -487,7 +487,7 @@ * If the calculated SOF offset is negative, seek to the beginning of the file. */ - dest_offset=(flags&DEMUX_SEEK_SET?demuxer->movi_start:stream_tell(demuxer->stream))+rel_seek_secs*total_bitrate; + dest_offset=(seeka->flags&DEMUX_SEEK_SET?demuxer->movi_start:stream_tell(demuxer->stream))+seeka->secs*total_bitrate; if(dest_offset<0) dest_offset=0; stream_seek(demuxer->stream,dest_offset); Modified: mplayerxp/libmpdemux/demux_ra.c =================================================================== --- mplayerxp/libmpdemux/demux_ra.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_ra.c 2012-10-18 11:32:55 UTC (rev 168) @@ -287,7 +287,7 @@ #if 0 /* please upload RV10 samples WITH INDEX CHUNK */ -int demux_seek_ra(demuxer_t *demuxer, float rel_seek_secs, int flags) +int demux_seek_ra(demuxer_t *demuxer,const seek_args_t* seeka) { real_priv_t *priv = demuxer->priv; demux_stream_t *d_audio = demuxer->audio; Modified: mplayerxp/libmpdemux/demux_rawaudio.c =================================================================== --- mplayerxp/libmpdemux/demux_rawaudio.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_rawaudio.c 2012-10-18 11:32:55 UTC (rev 168) @@ -92,13 +92,13 @@ return 1; } -static void rawaudio_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){ +static void rawaudio_seek(demuxer_t *demuxer,const seek_args_t* seeka){ stream_t* s = demuxer->stream; sh_audio_t* sh_audio = demuxer->audio->sh; off_t base,pos; - base = (flags & DEMUX_SEEK_SET) ? demuxer->movi_start : stream_tell(s); - pos=base+(flags&DEMUX_SEEK_PERCENTS?demuxer->movi_end-demuxer->movi_start:sh_audio->i_bps)*rel_seek_secs; + base = (seeka->flags & DEMUX_SEEK_SET) ? demuxer->movi_start : stream_tell(s); + pos=base+(seeka->flags&DEMUX_SEEK_PERCENTS?demuxer->movi_end-demuxer->movi_start:sh_audio->i_bps)*seeka->secs; pos -= (pos % (sh_audio->channels * sh_audio->samplesize) ); stream_seek(s,pos); resync_audio_stream(sh_audio); Modified: mplayerxp/libmpdemux/demux_rawvideo.c =================================================================== --- mplayerxp/libmpdemux/demux_rawvideo.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_rawvideo.c 2012-10-18 11:32:55 UTC (rev 168) @@ -128,13 +128,13 @@ return 1; } -static void rawvideo_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){ +static void rawvideo_seek(demuxer_t *demuxer,const seek_args_t* seeka){ stream_t* s = demuxer->stream; sh_video_t* sh_video = demuxer->video->sh; off_t pos; - pos =(flags & DEMUX_SEEK_SET)?demuxer->movi_start:stream_tell(s); - pos+=(flags&DEMUX_SEEK_PERCENTS?demuxer->movi_end-demuxer->movi_start:sh_video->i_bps)*rel_seek_secs; + pos =(seeka->flags & DEMUX_SEEK_SET)?demuxer->movi_start:stream_tell(s); + pos+=(seeka->flags&DEMUX_SEEK_PERCENTS?demuxer->movi_end-demuxer->movi_start:sh_video->i_bps)*seeka->secs; pos/=imgsize; stream_seek(s,pos*imgsize); sh_video->timer=pos * sh_video->frametime; Modified: mplayerxp/libmpdemux/demux_real.c =================================================================== --- mplayerxp/libmpdemux/demux_real.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_real.c 2012-10-18 11:32:55 UTC (rev 168) @@ -1499,7 +1499,7 @@ } /* please upload RV10 samples WITH INDEX CHUNK */ -static void real_seek(demuxer_t *demuxer, float rel_seek_secs, int flags) +static void real_seek(demuxer_t *demuxer,const seek_args_t* seeka) { real_priv_t *priv = demuxer->priv; demux_stream_t *d_audio = demuxer->audio; @@ -1523,7 +1523,7 @@ if (!streams) return; - if (flags & DEMUX_SEEK_SET) + if (seeka->flags & DEMUX_SEEK_SET) /* seek SOF */ priv->current_apacket = priv->current_vpacket = 0; @@ -1533,52 +1533,52 @@ priv->current_apacket = priv->index_table_size[aid] - 1; // if (index_mode == 1 || index_mode == 2) { - if (streams & 1) {// use the video index if we have one + if (streams & 1) {// use the video index if we have one cur_timestamp = priv->index_table[vid][priv->current_vpacket].timestamp; - if (rel_seek_secs > 0) - while ((priv->index_table[vid][priv->current_vpacket].timestamp - cur_timestamp) < rel_seek_secs * 1000){ - priv->current_vpacket += 1; - if (priv->current_vpacket >= priv->index_table_size[vid]) { - priv->current_vpacket = priv->index_table_size[vid] - 1; + if (seeka->secs > 0) + while ((priv->index_table[vid][priv->current_vpacket].timestamp - cur_timestamp) < seeka->secs * 1000){ + priv->current_vpacket += 1; + if (priv->current_vpacket >= priv->index_table_size[vid]) { + priv->current_vpacket = priv->index_table_size[vid] - 1; if (!retried) { stream_seek(demuxer->stream, priv->index_table[vid][priv->current_vpacket].offset); - add_index_segment(demuxer, vid, cur_timestamp + rel_seek_secs * 1000); + add_index_segment(demuxer, vid, cur_timestamp + seeka->secs * 1000); retried = 1; } else - break; - } - } - else if (rel_seek_secs < 0) - while ((cur_timestamp - priv->index_table[vid][priv->current_vpacket].timestamp) < - rel_seek_secs * 1000){ - priv->current_vpacket -= 1; - if (priv->current_vpacket < 0) { - priv->current_vpacket = 0; - break; - } - } + break; + } + } + else if (seeka->secs < 0) + while ((cur_timestamp - priv->index_table[vid][priv->current_vpacket].timestamp) < - seeka->secs * 1000){ + priv->current_vpacket -= 1; + if (priv->current_vpacket < 0) { + priv->current_vpacket = 0; + break; + } + } next_offset = priv->index_table[vid][priv->current_vpacket].offset; priv->audio_need_keyframe = 1; priv->video_after_seek = 1; - } - else if (streams & 2) { - cur_timestamp = priv->index_table[aid][priv->current_apacket].timestamp; - if (rel_seek_secs > 0) - while ((priv->index_table[aid][priv->current_apacket].timestamp - cur_timestamp) < rel_seek_secs * 1000){ - priv->current_apacket += 1; - if (priv->current_apacket >= priv->index_table_size[aid]) { - priv->current_apacket = priv->index_table_size[aid] - 1; - break; - } - } - else if (rel_seek_secs < 0) - while ((cur_timestamp - priv->index_table[aid][priv->current_apacket].timestamp) < - rel_seek_secs * 1000){ - priv->current_apacket -= 1; - if (priv->current_apacket < 0) { - priv->current_apacket = 0; - break; - } - } + } + else if (streams & 2) { + cur_timestamp = priv->index_table[aid][priv->current_apacket].timestamp; + if (seeka->secs > 0) + while ((priv->index_table[aid][priv->current_apacket].timestamp - cur_timestamp) < seeka->secs * 1000){ + priv->current_apacket += 1; + if (priv->current_apacket >= priv->index_table_size[aid]) { + priv->current_apacket = priv->index_table_size[aid] - 1; + break; + } + } + else if (seeka->secs < 0) + while ((cur_timestamp - priv->index_table[aid][priv->current_apacket].timestamp) < - seeka->secs * 1000){ + priv->current_apacket -= 1; + if (priv->current_apacket < 0) { + priv->current_apacket = 0; + break; + } + } next_offset = priv->index_table[aid][priv->current_apacket].offset; } // } Modified: mplayerxp/libmpdemux/demux_smjpeg.c =================================================================== --- mplayerxp/libmpdemux/demux_smjpeg.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_smjpeg.c 2012-10-18 11:32:55 UTC (rev 168) @@ -166,7 +166,7 @@ } demuxer->flags &= ~DEMUXF_SEEKABLE; - + return demuxer; } Modified: mplayerxp/libmpdemux/demux_ts.c =================================================================== --- mplayerxp/libmpdemux/demux_ts.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_ts.c 2012-10-18 11:32:55 UTC (rev 168) @@ -3059,7 +3059,7 @@ extern int sync_video_packet(demux_stream_t *); extern int skip_video_packet(demux_stream_t *); -static void ts_seek(demuxer_t *demuxer, float rel_seek_secs, int flags) +static void ts_seek(demuxer_t *demuxer,const seek_args_t* seeka) { demux_stream_t *d_audio=demuxer->audio; demux_stream_t *d_video=demuxer->video; @@ -3094,16 +3094,16 @@ video_stats = sh_video->i_bps; } - newpos = (flags & DEMUX_SEEK_SET) ? demuxer->movi_start : demuxer->filepos; - if(flags & DEMUX_SEEK_PERCENTS) // float seek 0..1 - newpos+=(demuxer->movi_end-demuxer->movi_start)*rel_seek_secs; + newpos = (seeka->flags & DEMUX_SEEK_SET) ? demuxer->movi_start : demuxer->filepos; + if(seeka->flags & DEMUX_SEEK_PERCENTS) // float seek 0..1 + newpos+=(demuxer->movi_end-demuxer->movi_start)*seeka->secs; else { // time seek (secs) if(! video_stats) // unspecified or VBR - newpos += 2324*75*rel_seek_secs; // 174.3 kbyte/sec + newpos += 2324*75*seeka->secs; // 174.3 kbyte/sec else - newpos += video_stats*rel_seek_secs; + newpos += video_stats*seeka->secs; } Modified: mplayerxp/libmpdemux/demux_ty.c =================================================================== --- mplayerxp/libmpdemux/demux_ty.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_ty.c 2012-10-18 11:32:55 UTC (rev 168) @@ -744,7 +744,7 @@ return 1; } -static void ty_seek( demuxer_t *demuxer, float rel_seek_secs, int flags ) +static void ty_seek( demuxer_t *demuxer, const seek_args_t* seeka ) { demux_stream_t *d_audio = demuxer->audio; demux_stream_t *d_video = demuxer->video; @@ -763,24 +763,24 @@ //================= seek in MPEG ========================== demuxer->filepos = stream_tell( demuxer->stream ); - newpos = ( flags & 1 ) ? demuxer->movi_start : demuxer->filepos; + newpos = ( seeka->flags & 1 ) ? demuxer->movi_start : demuxer->filepos; - if( flags & 2 ) + if( seeka->flags & 2 ) // float seek 0..1 - newpos += ( demuxer->movi_end - demuxer->movi_start ) * rel_seek_secs; + newpos += ( demuxer->movi_end - demuxer->movi_start ) * seeka->secs; else { // time seek (secs) if( ! sh_video->i_bps ) // unspecified or VBR - newpos += 2324 * 75 * rel_seek_secs; // 174.3 kbyte/sec + newpos += 2324 * 75 * seeka->secs; // 174.3 kbyte/sec else - newpos += sh_video->i_bps * rel_seek_secs; + newpos += sh_video->i_bps * seeka->secs; } if ( newpos < demuxer->movi_start ) newpos = demuxer->movi_start; res = newpos / CHUNKSIZE; - if ( rel_seek_secs >= 0 ) + if ( seeka->secs >= 0 ) newpos = ( res + 1 ) * CHUNKSIZE; else newpos = res * CHUNKSIZE; Modified: mplayerxp/libmpdemux/demux_vqf.c =================================================================== --- mplayerxp/libmpdemux/demux_vqf.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_vqf.c 2012-10-18 11:32:55 UTC (rev 168) @@ -203,13 +203,13 @@ return 1; } -static void vqf_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){ +static void vqf_seek(demuxer_t *demuxer,const seek_args_t* seeka){ stream_t* s = demuxer->stream; sh_audio_t* sh_audio = demuxer->audio->sh; off_t base,pos; - base = (flags&DEMUX_SEEK_SET) ? demuxer->movi_start : stream_tell(s); - pos=base+(flags&DEMUX_SEEK_PERCENTS?demuxer->movi_end-demuxer->movi_start:sh_audio->i_bps)*rel_seek_secs; + base = (seeka->flags&DEMUX_SEEK_SET) ? demuxer->movi_start : stream_tell(s); + pos=base+(seeka->flags&DEMUX_SEEK_PERCENTS?demuxer->movi_end-demuxer->movi_start:sh_audio->i_bps)*seeka->secs; pos -= (pos % (sh_audio->channels * sh_audio->samplesize) ); stream_seek(s,pos); resync_audio_stream(sh_audio); Modified: mplayerxp/libmpdemux/demux_y4m.c =================================================================== --- mplayerxp/libmpdemux/demux_y4m.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demux_y4m.c 2012-10-18 11:32:55 UTC (rev 168) @@ -228,10 +228,10 @@ return demuxer; } -static void y4m_seek(demuxer_t *demuxer, float rel_seek_secs, int flags) { +static void y4m_seek(demuxer_t *demuxer,const seek_args_t* seeka) { sh_video_t* sh = demuxer->video->sh; y4m_priv_t* priv = demuxer->priv; - int rel_seek_frames = sh->fps*rel_seek_secs; + int rel_seek_frames = sh->fps*seeka->secs; int size = 3*sh->disp_w*sh->disp_h/2; off_t curr_pos = stream_tell(demuxer->stream); Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demuxer.c 2012-10-18 11:32:55 UTC (rev 168) @@ -642,7 +642,7 @@ return vd; } -int demux_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){ +int demux_seek(demuxer_t *demuxer,const seek_args_t* seeka){ demux_stream_t *d_audio=demuxer->audio; demux_stream_t *d_video=demuxer->video; sh_audio_t *sh_audio=d_audio->sh; @@ -662,7 +662,7 @@ // clear demux buffers: if(sh_audio){ ds_free_packs(d_audio);sh_audio->a_buffer_len=0;} ds_free_packs(d_video); - + stream_set_eof(demuxer->stream,0); // clear eof flag demuxer->video->eof=0; demuxer->audio->eof=0; @@ -675,7 +675,7 @@ if(sh_audio) sh_audio->timer=0; if(sh_video) sh_video->timer=0; // !!!!!! #endif - if(demuxer->driver->seek) demuxer->driver->seek(demuxer,rel_seek_secs,flags); + if(demuxer->driver->seek) demuxer->driver->seek(demuxer,seeka); else MSG_WARN("Demuxer seek error\n"); return 1; } Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demuxer.h 2012-10-18 11:32:55 UTC (rev 168) @@ -130,6 +130,15 @@ #define DEMUX_FALSE 0 #define DEMUX_OK 1 +#define DEMUX_SEEK_CUR 0x00 +#define DEMUX_SEEK_SET 0x01 +#define DEMUX_SEEK_SECONDS 0x00 +#define DEMUX_SEEK_PERCENTS 0x02 +typedef struct seek_args_s { + float secs; + unsigned flags; +}seek_args_t; + /* Commands for control interface */ #define DEMUX_CMD_SWITCH_AUDIO 1 #define DEMUX_CMD_SWITCH_VIDEO 2 @@ -161,7 +170,7 @@ * @param flags 0x01 - seek from start else seek_cur, 0x02 - rel_seek_secs indicates pos in percents/100 else in seconds * @note this function is optional and maybe NULL **/ - void (*seek)(demuxer_t *d,float rel_seek_secs,int flags); + void (*seek)(demuxer_t *d,const seek_args_t* seeka); /** Closes driver * @param d _this demuxer **/ @@ -258,11 +267,7 @@ } demuxer_t* demux_open(stream_t *stream,int file_format,int aid,int vid,int sid); -#define DEMUX_SEEK_CUR 0x00 -#define DEMUX_SEEK_SET 0x01 -#define DEMUX_SEEK_SECONDS 0x00 -#define DEMUX_SEEK_PERCENTS 0x02 -int demux_seek(demuxer_t *demuxer,float rel_seek_secs,int flags); +int demux_seek(demuxer_t *demuxer,const seek_args_t* seeka); demuxer_t* new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd); /* AVI demuxer params: */ Modified: mplayerxp/libmpdemux/demuxer_r.c =================================================================== --- mplayerxp/libmpdemux/demuxer_r.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demuxer_r.c 2012-10-18 11:32:55 UTC (rev 168) @@ -147,7 +147,7 @@ /* TODO : FIXME we need to redesign blocking of mutexes before enabling this function*/ -int demux_seek_r(demuxer_t *demuxer,float rel_seek_secs,int flags) +int demux_seek_r(demuxer_t *demuxer,const seek_args_t* seeka) { int retval; unsigned int t=0; @@ -155,7 +155,7 @@ double tt; // LOCK_DEMUXER(); if(benchmark) t=GetTimer(); - retval = demux_seek(demuxer,rel_seek_secs,flags); + retval = demux_seek(demuxer,seeka); if(benchmark) { t2=GetTimer();t=t2-t; Modified: mplayerxp/libmpdemux/demuxer_r.h =================================================================== --- mplayerxp/libmpdemux/demuxer_r.h 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/libmpdemux/demuxer_r.h 2012-10-18 11:32:55 UTC (rev 168) @@ -22,7 +22,7 @@ extern int demux_read_data_r(demux_stream_t *ds,unsigned char* mem,int len,float *pts); extern int ds_get_packet_r(demux_stream_t *ds,unsigned char **start,float *pts); -extern int demux_seek_r(demuxer_t *demuxer,float rel_seek_secs,int flags); +extern int demux_seek_r(demuxer_t *demuxer,const seek_args_t* seeka); extern int demuxer_switch_audio_r(demuxer_t *, int id); extern int demuxer_switch_video_r(demuxer_t *, int id); Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-17 17:33:30 UTC (rev 167) +++ mplayerxp/mplayer.c 2012-10-18 11:32:55 UTC (rev 168) @@ -1581,6 +1581,11 @@ fflush(stdout); } +typedef struct osd_args_s { + int visible; + int info_factor; +}osd_args_t; + int xp_decore_video( int rtc_fd, video_stat_t *vstat, float *aq_sleep_time, float *v_pts ) { float time_frame=0; @@ -1815,12 +1820,12 @@ return 0; } -void mpxp_seek( int _xp_id, video_stat_t *vstat, int *osd_visible,float v_pts,float pos,int flags) +void mpxp_seek( int _xp_id, video_stat_t *vstat, osd_args_t *osd,float v_pts,const seek_args_t* seek) { int seek_rval=1; audio_eof=0; - if(pos || flags&DEMUX_SEEK_SET) { - seek_rval=demux_seek_r(demuxer,pos,flags); + if(seek->secs || seek->flags&DEMUX_SEEK_SET) { + seek_rval=demux_seek_r(demuxer,seek); mpxp_after_seek=25; /* 1 sec delay */ } if(seek_rval){ @@ -1875,7 +1880,7 @@ if(osd_level){ int len=((demuxer->movi_end-demuxer->movi_start)>>8); if (len>0){ - if(osd_visible) *osd_visible=sh_video->fps<=60?sh_video->fps:25; + if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; vo.osd_progbar_type=0; vo.osd_progbar_value=(demuxer->filepos-demuxer->movi_start)/len; vo_osd_changed(OSDTYPE_PROGBAR); @@ -1885,7 +1890,7 @@ if(sh_video) { c_total=0; max_pts_correction=0.1; - if(osd_visible) *osd_visible=sh_video->fps<=60?sh_video->fps:25; // to rewert to PLAY pointer after 1 sec + if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; // to rewert to PLAY pointer after 1 sec audio_time_usage=0; audio_decode_time_usage=0; video_time_usage=0; vout_time_usage=0; if(vstat) { @@ -1906,8 +1911,9 @@ void mpxp_reset_vcache(void) { unsigned i; + seek_args_t seek = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; for(i=0;i<xp_threads;i++) if(strcmp(pinfo[i].thread_name,"main")==0) break; - if(shva) mpxp_seek(i,NULL,NULL,shva[dec_ahead_active_frame].v_pts,0,DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS); + if(shva) mpxp_seek(i,NULL,NULL,shva[dec_ahead_active_frame].v_pts,&seek); return; } @@ -2057,7 +2063,7 @@ // for multifile support: play_tree_iter_t* playtree_iter = NULL; -static void init_keyboard_fifo(void) +static void mpxp_init_keyboard_fifo(void) { #ifdef HAVE_TERMCAP load_termcap(NULL); // load key-codes @@ -2075,7 +2081,7 @@ inited_flags|=INITED_INPUT; } -static void init_fond_menu_osd(void) { +static void mpxp_init_osd(void) { // check font #ifdef USE_OSD if(font_name){ @@ -2106,7 +2112,7 @@ vo_init_osd(); } -static void init_output_sub_systems(void) { +static void mpxp_init_output_subsystems(void) { unsigned i; // check video_out driver name: if (video_driver) @@ -2155,7 +2161,7 @@ } } -static int init_vobsub(const char *filename) { +static int mpxp_init_vobsub(const char *filename) { int forced_subs_only=0; pinfo[xp_id].current_module="vobsub"; if (vobsub_name){ @@ -2181,9 +2187,44 @@ sub_auto=0; // don't do autosub for textsubs if vobsub found inited_flags|=INITED_VOBSUB; } + return forced_subs_only; } -static void init_nls(void) { +static int mpxp_handle_playlist(const char *filename) { + int eof=0; + play_tree_t* entry; + // Handle playlist + pinfo[xp_id].current_module="handle_playlist"; + MSG_V("Parsing playlist %s...\n",filename); + entry = parse_playtree(stream); + if(!entry) { + entry = playtree_iter->tree; + if(play_tree_iter_step(playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) { + eof = PT_NEXT_ENTRY; + return eof; + } + if(playtree_iter->tree == entry ) { // Loop with a single file + if(play_tree_iter_up_step(playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) { + eof = PT_NEXT_ENTRY; + return eof; + } + } + play_tree_remove(entry,1,1); + eof = PT_NEXT_SRC; + return eof; + } + play_tree_insert_entry(playtree_iter->tree,entry); + entry = playtree_iter->tree; + if(play_tree_iter_step(playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) { + eof = PT_NEXT_ENTRY; + return eof; + } + play_tree_remove(entry,1,1); + eof = PT_NEXT_SRC; + return eof; +} + +static void mpxp_init_dvd_nls(void) { /* Add NLS support here */ char *lang; if(!audio_lang) audio_lang=nls_get_screen_cp(); @@ -2207,7 +2248,7 @@ } #ifdef HAVE_LIBCSS -static void init_dvd_key(void) { +static void mpxp_init_dvdkey(void) { pinfo[xp_id].current_module="libcss"; if (dvdimportkey) { if (dvd_import_key(dvdimportkey)) { @@ -2226,242 +2267,22 @@ } #endif -/******************************************\ -* MAIN MPLAYERXP FUNCTION !!! * -\******************************************/ -int main(int argc,char* argv[], char *envp[]){ - -int stream_dump_type=0; -int after_dvdmenu=0; -char* filename=NULL; //"MI2-Trailer.avi"; -int file_format=DEMUXER_TYPE_UNKNOWN; -int (*decore_video_ptr)( int rtc_fd, video_stat_t *vstat, float *aq_sleep_time, float *v_pts ) - = mp09_decore_video; - -// movie info: -int eof=0; - -int osd_visible=100; -int osd_info_factor=9; -video_stat_t vstat; -int rtc_fd=-1; -int i; -int forced_subs_only=0; -float seek_secs=0; -int seek_flags=DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS; - - vo_preinit_structs(); - - mplayer_pid= - pinfo[xp_id].pid=getpid(); - mplayer_pth_id= - pinfo[xp_id].pth_id=pthread_self(); - pinfo[xp_id].thread_name = "main"; - memset(&vstat,0,sizeof(video_stat_t)); - - mp_msg_init(MSGL_STATUS); - MSG_INFO("%s",banner_text); -// memset(&vtune,0,sizeof(vo_tune_info_t)); - /* Test for cpu capabilities (and corresponding OS support) for optimizing */ - - playtree = play_tree_new(); - - mconfig = m_config_new(playtree); - m_config_register_options(mconfig,mplayer_opts); - // TODO : add something to let modules register their options - mp_register_options(mconfig); - parse_cfgfiles(mconfig); - - if(m_config_parse_command_line(mconfig, argc, argv, envp) < 0) exit(1); // error parsing cmdline - - xp_num_cpu=get_number_cpu(); -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) - get_mmx_optimizations(); -#endif - if(!sws_init()) { - MSG_ERR("MPlayerXP requires working copy of libswscaler\n"); - return 0; - } - if(shuffle_playback) playtree->flags|=PLAY_TREE_RND; - else playtree->flags&=~PLAY_TREE_RND; - pla... [truncated message content] |
From: <nic...@us...> - 2012-10-18 14:27:35
|
Revision: 171 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=171&view=rev Author: nickols_k Date: 2012-10-18 14:27:24 +0000 (Thu, 18 Oct 2012) Log Message: ----------- new option: -sub.on(off) Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/mplayer.c Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-18 14:08:52 UTC (rev 170) +++ mplayerxp/cfg-mplayer.h 2012-10-18 14:27:24 UTC (rev 171) @@ -224,6 +224,8 @@ static const config_t subtitle_config[]={ + {"on", &has_dvdsub, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables subtitle-steam playback"}, + {"off", &has_dvdsub, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables subtitle-stream playback"}, {"vob", &vobsub_name, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies the VobSub files that are to be used for subtitle"}, {"vobid", &vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL, "specifies the VobSub subtitle id"}, #ifdef USE_SUB Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-18 14:08:52 UTC (rev 170) +++ mplayerxp/mplayer.c 2012-10-18 14:27:24 UTC (rev 171) @@ -217,6 +217,7 @@ /* codecs: */ int has_audio=1; int has_video=1; +int has_dvdsub=1; char *audio_codec=NULL; /* override audio codec */ char *audio_codec_param=NULL; char *video_codec=NULL; /* override video codec */ @@ -2702,8 +2703,9 @@ //============ Open DEMUXERS --- DETECT file type ======================= initial_audio_pts=HUGE; - if(!has_audio) audio_id=-2; // do NOT read audio packets... - if(!has_video) video_id=-2; // do NOT read video packets... + if(!has_audio) audio_id=-2; // do NOT read audio packets... + if(!has_video) video_id=-2; // do NOT read video packets... + if(!has_dvdsub) dvdsub_id=-2;// do NOT read subtitle packets... pinfo[xp_id].current_module="demux_open"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-19 14:22:28
|
Revision: 174 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=174&view=rev Author: nickols_k Date: 2012-10-19 14:22:17 +0000 (Fri, 19 Oct 2012) Log Message: ----------- remove obsolete libcss support Modified Paths: -------------- DOCS/mplayerxp.1 mplayerxp/cfg-mplayer.h mplayerxp/configure mplayerxp/input/input.h mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/demux_mpg.c mplayerxp/mplayer.c mplayerxp/nls/help_mp-cz.h mplayerxp/nls/help_mp-de.h mplayerxp/nls/help_mp-dk.h mplayerxp/nls/help_mp-en.h mplayerxp/nls/help_mp-es.h mplayerxp/nls/help_mp-fr.h mplayerxp/nls/help_mp-hu.h mplayerxp/nls/help_mp-it.h mplayerxp/nls/help_mp-ko.h mplayerxp/nls/help_mp-nl.h mplayerxp/nls/help_mp-no.h mplayerxp/nls/help_mp-pl.h mplayerxp/nls/help_mp-ro.h mplayerxp/nls/help_mp-ru.h mplayerxp/nls/help_mp-sk.h Removed Paths: ------------- mplayerxp/libmpdemux/dvdauth.c mplayerxp/libmpdemux/dvdauth.h Modified: DOCS/mplayerxp.1 =================================================================== --- DOCS/mplayerxp.1 2012-10-19 13:51:44 UTC (rev 173) +++ DOCS/mplayerxp.1 2012-10-19 14:22:17 UTC (rev 174) @@ -587,16 +587,6 @@ some DVD discs contain scenes that can be viewed from multiple angles. Examples can be found below. .TP -.B \-dvdauth\ <device> -provides authentification of encrypted DVD disk with using of libcss -.TP -.B \-dvdkey key -key to decrypt stream encrypted with CSS. For example : -dvdkey F169072699 -(this is NOT for DVD playing! For DVD use the dvdnav:// option!) -.TP -.B \-csslib\ <path to libcss.so> -This option is useful only if libcss.so can't be autodetected -.TP .B \-audio.lang\ <audio\ stream\ language> Used when playing DVD disks. Expects a two-letter country code(s) as parameter, and always tries to playback audio streams those language Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/cfg-mplayer.h 2012-10-19 14:22:17 UTC (rev 174) @@ -347,11 +347,6 @@ {"slave", &slave_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, NULL, "turns MPlayerXP into slave mode as a backend for other programs"}, {"use-stdin", &use_stdin, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL, "forces reading of keyboard codes from STDIN instead of terminal's console"}, {"msgfilter", &mp_msg_filter, CONF_TYPE_INT, CONF_RANGE, 0, 0xFFFFFFFF, NULL, "specifies filter for verbosed messages"}, -#ifdef HAVE_LIBCSS - {"dvdauth", &dvd_auth_device, CONF_TYPE_STRING, 0, 0, 0, NULL,"provides authentification of encrypted DVD disk"}, - {"dvdkey", &dvdimportkey, CONF_TYPE_STRING, 0, 0, 0, NULL,"specifies key to decrypt stream encrypted with CSS"}, - {"csslib", &css_so, CONF_TYPE_STRING, 0, 0, 0, NULL,"specifies path to libcss.so"}, -#endif {"core", &xpcore_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "XP-core related options" }, {"play", &playback_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "Playback specific options" }, Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/configure 2012-10-19 14:22:17 UTC (rev 174) @@ -77,7 +77,6 @@ "lirc|build with LIRC (remote control) support|http://www.lirc.org", "lircc|build with LIRCC (remote daemon control) support|http://www.lirc.org", "joystick|build with joystick support", - "libcss|build with libcss support|http://download.videolan.org/pub/videolan/libdvdcss", "libdvdread|build with libdvdread support|http://www.dtek.chalmers.se/groups/dvd/downloads.shtml", "libdvdnav|build with libdvdnav support|http://dvd.sourceforge.net", "libdv|build with libdv support|http://libdv.sourceforge.net/", @@ -670,10 +669,6 @@ print_config HAVE_ mp_config.h mp_config.mak jack enabled jack && aomodules="jack $aomodules" || noaomodules="jack $noaomodules" -enabled libcss && require2 libcss css.h CSSisEncrypted -lcss -print_config HAVE_ mp_config.h mp_config.mak libcss -enabled libcss && inputmodules="libcss $inputmodules" || noinputmodules="libcss $noinputmodules" - enabled libdvdread && require2 libdvdread "stdint.h dvdread/dvd_reader.h dvdread/ifo_types.h dvdread/ifo_read.h dvdread/nav_read.h" DVDOpenFile -ldvdread dvdread=$libdvdread print_config USE_ mp_config.h mp_config.mak dvdread Modified: mplayerxp/input/input.h =================================================================== --- mplayerxp/input/input.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/input/input.h 2012-10-19 14:22:17 UTC (rev 174) @@ -1,6 +1,6 @@ // All commands id #define MP_CMD_SEEK 0 -#define MP_CMD_RESERVED 1 +#define MP_CMD_RESERVED_0 1 #define MP_CMD_QUIT 2 #define MP_CMD_PAUSE 3 #define MP_CMD_SOFT_QUIT 4 Modified: mplayerxp/libmpdemux/Makefile =================================================================== --- mplayerxp/libmpdemux/Makefile 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/libmpdemux/Makefile 2012-10-19 14:22:17 UTC (rev 174) @@ -29,7 +29,7 @@ ifeq ($(HAVE_LIBDV),yes) SRCS += demux_dv.c endif -SRCS += cache2.c dvdauth.c stream.c tvi_dummy.c tvi_v4l.c +SRCS += cache2.c stream.c tvi_dummy.c tvi_v4l.c SRCS += tvi_bsdbt848.c frequencies.c mrl.c SRCS += demuxer_r.c mp3_hdr.c video.c mpeg_hdr.c aviprint.c demux_asf.c Modified: mplayerxp/libmpdemux/demux_mpg.c =================================================================== --- mplayerxp/libmpdemux/demux_mpg.c 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/libmpdemux/demux_mpg.c 2012-10-19 14:22:17 UTC (rev 174) @@ -20,7 +20,6 @@ #include "stheader.h" #include "mp3_hdr.h" -#include "dvdauth.h" #include "../libmpcodecs/dec_audio.h" #include "demux_msg.h" //#define MAX_PS_PACKETSIZE 2048 @@ -184,15 +183,12 @@ static int demux_mpg_read_packet(demuxer_t *demux,int id){ int d; int len; -#ifdef HAVE_LIBCSS - int css=0; -#endif unsigned char c=0; int pts=MPGPES_BAD_PTS; unsigned int dts=0; demux_stream_t *ds=NULL; mpg_demuxer_t *priv = (mpg_demuxer_t *) demux->priv; - + MSG_DBG3("demux_read_packet: %X\n",id); // if(id==0x1F0){ @@ -246,13 +242,8 @@ int pts_flags; int hdrlen; // System-2 (.VOB) stream: - if((c>>4)&3) { -#ifdef HAVE_LIBCSS - css=1; -#else - MSG_WARN(MSGTR_EncryptedVOB); -#endif - } + if((c>>4)&3) MSG_WARN("Encrypted VOB found! That should never happens"); + c=stream_read_char(demux->stream); pts_flags=c>>6; c=stream_read_char(demux->stream); hdrlen=c; len-=2; @@ -389,12 +380,7 @@ if(ds){ MSG_DBG2("DEMUX_MPG: Read %d data bytes from packet %04X\n",len,id); -#ifdef HAVE_LIBCSS - if (css) { - if (descrambling) dvd_css_descramble(demux->stream->buffer,key_title); - else MSG_WARN(MSGTR_EncryptedVOBauth); - } -#endif + if(ds==ds->demuxer->sub) { if (pts == MPGPES_BAD_PTS) { pts = priv->last_sub_pts; Deleted: mplayerxp/libmpdemux/dvdauth.c =================================================================== --- mplayerxp/libmpdemux/dvdauth.c 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/libmpdemux/dvdauth.c 2012-10-19 14:22:17 UTC (rev 174) @@ -1,283 +0,0 @@ -/* (C)2001,2002 by LGB (Gabor Lenart), based on example programs in libcss - lg...@lg... - - This source is part of MPlayer project. This source is copyrighted by - the author according to rules declared in GNU/GPL license. - - 2001 Inital version (LGB) - 2001 fibmap_mplayer to avoid uid=0 mplayer need (LGB) - 2001 Support for libcss with the new API (by ???) - 2002/Jan/04 Use dlopen to access libcss.so to avoid conflict with - libdvdread [now with only libcss with old API (LGB) - - TODO: - support for libcss libraries with new API */ - -/* don't do anything with this source if css support was not requested */ -#include "../mp_config.h" -#ifdef HAVE_LIBCSS - -#warning FIXME: Dynamic loading of libcss.so with newer (ver>0.1) libcss API is not supported in this version! - -#include <stdio.h> -#include <stdlib.h> -//#include <string.h> // FIXME: conflicts with fs.h -#include <errno.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/ioctl.h> -#include <sys/stat.h> -#include <sys/wait.h> -// #include <css.h> - -#if defined(__FreeBSD__) || defined(__NetBSD__) -# include <sys/dvdio.h> -#elif defined(__OpenBSD__) -# include <sys/cdio.h> -# define RTLD_NOW RTLD_LAZY -#elif defined(__linux__) -# include <linux/cdrom.h> -#elif defined(__sun) -# include <sun/dvdio.h> -#elif defined(__bsdi__) -# include <dvd.h> -#else -# error "Need the DVD ioctls" -#endif - -#include <dlfcn.h> -#include "dvdauth.h" -#include "demux_msg.h" - -// #if OLD_CSS_API -/* - * provide some backward compatibiliy macros to compile this - * code using the old libcss-0.1 - */ -#define DVDHandle int -#define DVDOpenFailed (-1) - -#define DVDAuth(hdl, s) ioctl(hdl, DVD_AUTH, s) -#define DVDOpenDevice(path) open(path, O_RDONLY) -#define DVDCloseDevice(hdl) close(hdl) -// #define CSSDVDisEncrypted(hdl) CSSisEncrypted(hdl) -// #define CSSDVDAuthDisc CSSAuthDisc - - -char *dvd_auth_device=NULL; -char *dvd_raw_device=NULL; -char *css_so=NULL; -unsigned char key_disc[2048]; -unsigned char key_title[5]; -unsigned char *dvdimportkey=NULL; -int descrambling=0; - -static any_t*dlid; -static int (*dl_CSSisEncrypted)(int); -static int (*dl_CSSAuthDisc)(int,char *); -static int (*dl_CSSAuthTitle)(int, char *,int); -static int (*dl_CSSGetASF)(int); -static int (*dl_CSSDecryptTitleKey)(char *, char *); -static void (*dl_CSSDescramble)(u_char *, u_char *); - -int dvd_css_descramble ( u_char *sec , u_char *key ) -{ - (*dl_CSSDescramble)(sec,key); - return 0; -} - - -#ifdef __linux__ -#include <linux/fs.h> - -#ifndef FIBMAP -#define FIBMAP 1 -#endif - - -static int path_to_lba (char *path) -{ - int lba = 0; - char cmd[100]; - FILE *fp; - - snprintf(cmd,sizeof(cmd),"fibmap_mplayer %s",path); - fp=popen(cmd,"r"); - if (fp) { - int ret; - memset(cmd,0,sizeof(cmd)); - fgets(cmd,99,fp); - if ((ret=pclose(fp))) - MSG_V("DVD: fibmap_mplayer: %s\n",*cmd?cmd:"no error info"); - if (cmd[0]<'0'||cmd[0]>'9') fp=NULL; else { - if(WIFEXITED(ret) && !WEXITSTATUS(ret)) { - lba=atoi(cmd); - MSG_OK("DVD: fibmap_mplayer is being used\n"); - } else - fp=NULL; - } - } - if (!fp) { - int fd; - MSG_ERR("DVD: fibmap_mplayer could not run, trying with ioctl() ...\n"); - if ((fd = open(path, O_RDONLY)) == -1) { - MSG_ERR( "DVD: Cannot open file %s: %s", - path ? path : "(NULL)", strerror(errno)); - return -1; - } - if (ioctl(fd, FIBMAP, &lba) != 0) { - perror("DVD: ioctl FIBMAP"); - MSG_HINT(" Hint: run mplayer as root (or better to install fibmap_mplayer as suid root)!\n"); - close(fd); - return -1; - } - close(fd); - } - MSG_V("DVD: LBA: %d\n",lba); - return lba; -} - -#else /*linux*/ - -static int path_to_lba (char *path) -{ -#warning translating pathname to iso9660 LBA is not supported on this platform - MSG_ERR( "DVD: Translating pathname to iso9660 LBA is not supported on this platform\n"); - return -1; -} - -#endif /*linux*/ - - -static int CSSDVDAuthTitlePath(DVDHandle hdl,unsigned char *key_title,char *path) -{ - int lba=path_to_lba(path); - if (lba==-1) return -1; - return (*dl_CSSAuthTitle)(hdl,key_title,lba); -} - - - -static void reset_agids ( DVDHandle dvd ) -{ -#if !defined(DVD_AUTH) && defined(DVDIOCREPORTKEY) - struct dvd_authinfo ai; - int i; - for (i = 0; i < 4; i++) { - memset(&ai, 0, sizeof(ai)); - ai.format = DVD_INVALIDATE_AGID; - ai.agid = i; - ioctl(dvd, DVDIOCREPORTKEY, &ai); - } -#else -#if defined(__OpenBSD__) - union -#endif - dvd_authinfo ai; - int i; - for (i = 0; i < 4; i++) { - memset(&ai, 0, sizeof(ai)); - ai.type = DVD_INVALIDATE_AGID; - ai.lsa.agid = i; - DVDAuth(dvd, &ai); - } -#endif -} - - -int dvd_import_key ( unsigned char *hexkey ) -{ - unsigned char *t=key_title; - int digit=4,len; - memset(key_title,0,sizeof(key_title)); - for (len=0;len<10;len++) { - if (!*hexkey) return 1; - if (*hexkey>='A'&&*hexkey<='F') *t|=(*hexkey-'A'+10)<<digit; - else if (*hexkey>='0'&&*hexkey<='9') *t|=(*hexkey-'0')<<digit; - else return 1; - if (digit) digit=0; else { - digit=4; - t++; - } - hexkey++; - } - if (*hexkey) return 1; - MSG_V("DVD: DVD key (requested): %02X%02X%02X%02X%02X\n",key_title[0],key_title[1],key_title[2],key_title[3],key_title[4]); - descrambling=1; - return 0; -} - - - -int dvd_auth ( char *dev , char *filename ) -{ - DVDHandle dvd; /* DVD device handle */ - - if (!css_so) css_so=(char *)strdup("libcss"SLIBSUFFIX); - MSG_V("DVD: opening libcss.so as %s ...\n",css_so); - dlid=dlopen(css_so,RTLD_NOW); - if (!dlid) { - MSG_ERR("DVD: dlopen: %s\n",dlerror()); - return 1; - } MSG_V("DVD: dlopen OK!\n"); - -#ifdef __OpenBSD__ -#define CSS_DLSYM(v,s) if (!(v=ld_sym(dlid,"_" s))) {\ -MSG_HINT("DVD: %s\n Hint: use libcss version 0.1!\n",dlerror());\ -return 1; } -#else -#define CSS_DLSYM(v,s) if (!(v=ld_sym(dlid,s))) {\ -MSG_HINT("DVD: %s\n Hint: use libcss version 0.1!\n",dlerror());\ -return 1; } -#endif - - CSS_DLSYM(dl_CSSisEncrypted,"CSSisEncrypted"); - CSS_DLSYM(dl_CSSAuthDisc,"CSSAuthDisc"); - CSS_DLSYM(dl_CSSAuthTitle,"CSSAuthTitle"); - CSS_DLSYM(dl_CSSGetASF,"CSSGetASF"); - CSS_DLSYM(dl_CSSDecryptTitleKey,"CSSDecryptTitleKey"); - CSS_DLSYM(dl_CSSDescramble,"CSSDescramble"); - -#undef CSS_DLSYM - - if ((dvd=DVDOpenDevice(dev)) == DVDOpenFailed) { - MSG_ERR("DVD: cannot open DVD device \"%s\": %s.\n", - dev, strerror(errno)); - return 1; - } - - if (!(*dl_CSSisEncrypted)(dvd)) { - MSG_V("DVD: DVD is unencrypted! Skipping authentication!\n(note: you should not use -dvd switch for unencrypted discs!)\n"); - DVDCloseDevice(dvd); - return 0; - } else MSG_V("DVD: DVD is encrypted, issuing authentication ...\n"); - /* reset AGIDs */ - reset_agids(dvd); - /* authenticate disc */ - if ((*dl_CSSAuthDisc)(dvd,key_disc)) { - MSG_ERR("DVD: CSSDVDAuthDisc() failed.\n"); - DVDCloseDevice(dvd); - return 1; - } - if (CSSDVDAuthTitlePath(dvd,key_title,filename)) { - MSG_ERR("DVD: CSSDVDAuthTitle() failed.\n"); - DVDCloseDevice(dvd); - return 1; - } - - /* decrypting title */ - if ((*dl_CSSDecryptTitleKey)(key_title, key_disc) < 0) { - MSG_ERR("DVD: CSSDecryptTitleKey() failed.\n"); - DVDCloseDevice(dvd); - return 1; - } - - DVDCloseDevice(dvd); - MSG_V("DVD: DVD title key is: %02X%02X%02X%02X%02X\n",key_title[0],key_title[1],key_title[2],key_title[3],key_title[4]); - descrambling=1; - return 0; -} - - -#endif Deleted: mplayerxp/libmpdemux/dvdauth.h =================================================================== --- mplayerxp/libmpdemux/dvdauth.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/libmpdemux/dvdauth.h 2012-10-19 14:22:17 UTC (rev 174) @@ -1,17 +0,0 @@ -#ifdef HAVE_LIBCSS -#ifndef _MPLAYER_CSS_H -#define _MPLAYER_CSS_H - -extern char *dvd_auth_device; -extern unsigned char key_disc[]; -extern unsigned char key_title[]; -extern unsigned char *dvdimportkey; -extern int descrambling; -extern char *css_so; - -int dvd_auth ( char *, char * ); -int dvd_import_key ( unsigned char * ); -int dvd_css_descramble ( u_char *, u_char * ); - -#endif -#endif Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/mplayer.c 2012-10-19 14:22:17 UTC (rev 174) @@ -46,7 +46,6 @@ #include "libvo/sub.h" #include "libao2/audio_out.h" #include "codec-cfg.h" -#include "dvdauth.h" #include "spudec.h" #include "vobsub.h" @@ -1875,26 +1874,6 @@ } } -#ifdef HAVE_LIBCSS -static void mpxp_init_dvdkey(void) { - pinfo[xp_id].current_module="libcss"; - if (dvdimportkey) { - if (dvd_import_key(dvdimportkey)) { - MSG_FATAL(MSGTR_ErrorDVDkey); - exit_player(MSGTR_Exit_error); - } - MSG_INFO(MSGTR_CmdlineDVDkey); - } - if (dvd_auth_device) { - if (dvd_auth(dvd_auth_device,filename)) { - MSG_FATAL("Error in DVD auth...\n"); - exit_player(MSGTR_Exit_error); - } - MSG_INFO(MSGTR_DVDauthOk); - } -} -#endif - static void mpxp_print_stream_formats(void) { int fmt; char *c; @@ -2627,10 +2606,6 @@ goto goto_next_file; } -#ifdef HAVE_LIBCSS - mpxp_init_dvdkey(); -#endif - /* Add NLS support here */ mpxp_init_dvd_nls(); Modified: mplayerxp/nls/help_mp-cz.h =================================================================== --- mplayerxp/nls/help_mp-cz.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-cz.h 2012-10-19 14:22:17 UTC (rev 174) @@ -139,9 +139,6 @@ #define MSGTR_CantSeekRawAVI "Nelze se posouvat v surových (raw) .AVI proudech! (Potřebuji index, zkuste použít volbu -idx !) \n" #define MSGTR_CantSeekFile "Nemohu posouvat v tomto souboru! \n" -#define MSGTR_EncryptedVOB "Kódovaný VOB soubor (přeloženo bez podpory libcss)! Přečtěte si DOCS/DVD\n" -#define MSGTR_EncryptedVOBauth "Zakódovaný proud, ale autentikaci jste nepožadoval!!\n" - #define MSGTR_MOVcomprhdr "MOV: Komprimované hlavičky nejsou (ještě) podporovány!\n" #define MSGTR_MOVvariableFourCC "MOV: Upozornění! proměnná FOURCC detekována!?\n" #define MSGTR_MOVtooManyTrk "MOV: Upozornění! Příliš mnoho stop!" Modified: mplayerxp/nls/help_mp-de.h =================================================================== --- mplayerxp/nls/help_mp-de.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-de.h 2012-10-19 14:22:17 UTC (rev 174) @@ -136,9 +136,6 @@ #define MSGTR_CantSeekRawAVI "Kann keine RAW .AVI-Streams durchsuchen! (Index erforderlich, versuche es mit der -idx Option!) \n" #define MSGTR_CantSeekFile "Kann diese Datei nicht durchsuchen! \n" -#define MSGTR_EncryptedVOB "Verschlüsselte VOB-Datei (wurde ohne libcss Unterstützung kompiliert)! Lese DOCS\n" -#define MSGTR_EncryptedVOBauth "Verschlüsselter Stream, jedoch wurde die Authentifizierung nicht von dir gefordert!!\n" - #define MSGTR_MOVcomprhdr "MOV: Komprimierte Header werden (zur Zeit) nicht unterstützt!\n" #define MSGTR_MOVvariableFourCC "MOV: Warnung! Variable FOURCC erkannt!?\n" #define MSGTR_MOVtooManyTrk "MOV: Warnung! Zu viele Tracks!" Modified: mplayerxp/nls/help_mp-dk.h =================================================================== --- mplayerxp/nls/help_mp-dk.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-dk.h 2012-10-19 14:22:17 UTC (rev 174) @@ -136,8 +136,6 @@ #define MSGTR_CouldntDetFNo "Kunne ikke finde antallet af billeder (for en SOF søgning) \n" #define MSGTR_CantSeekRawAVI "Kan ikke søge i rå .AVI streams! (manglende index, prøv med -idx!) \n" #define MSGTR_CantSeekFile "Kan ikke søge i denne fil! \n" -#define MSGTR_EncryptedVOB "Krypteret VOB fil (ikke kompileret med libcss support)! Læs filen DOCS/cd-dvd.html\n" -#define MSGTR_EncryptedVOBauth "Krypteret stream men autoriseringen blev ikke påbegyndt af dig!!\n" #define MSGTR_MOVcomprhdr "MOV: Komprimeret header (endnu) ikke supported!\n" #define MSGTR_MOVvariableFourCC "MOV: Advarsel! variablen FOURCC detecteret!?\n" Modified: mplayerxp/nls/help_mp-en.h =================================================================== --- mplayerxp/nls/help_mp-en.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-en.h 2012-10-19 14:22:17 UTC (rev 174) @@ -385,13 +385,6 @@ #define MSGTR_CantSeekFile "Can't seek in this file! \n" #endif -#ifndef MSGTR_EncryptedVOB -#define MSGTR_EncryptedVOB "Encrypted VOB file (not compiled with libcss support)! Read file DOCS/cd-dvd.html\n" -#endif -#ifndef MSGTR_EncryptedVOBauth -#define MSGTR_EncryptedVOBauth "Encrypted stream but authentication was not requested by you!!\n" -#endif - #ifndef MSGTR_MOVcomprhdr #define MSGTR_MOVcomprhdr "MOV: Compressed headers not (yet) supported!\n" #endif Modified: mplayerxp/nls/help_mp-es.h =================================================================== --- mplayerxp/nls/help_mp-es.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-es.h 2012-10-19 14:22:17 UTC (rev 174) @@ -137,9 +137,6 @@ #define MSGTR_CantSeekRawAVI "No se puede avanzar/retroceder en un stream crudo .AVI! (se requiere índice, pruebe con -idx!) \n" #define MSGTR_CantSeekFile "No se puede avanzar/retroceder en este archivo! \n" -#define MSGTR_EncryptedVOB "Archivos VOB encriptados (no se compiló con soporte de libcss)! Lea DOCS/cd-dvd.html\n" -#define MSGTR_EncryptedVOBauth "Stream encriptado pero usted no pidió autenticación!!\n" - #define MSGTR_MOVcomprhdr "MOV: Cabecera comprimida no suportada (por ahora)!\n" #define MSGTR_MOVvariableFourCC "MOV: Advertencia! FOURCC variable detectada!?\n" #define MSGTR_MOVtooManyTrk "MOV: Advertencia! demasiadas pistas!" Modified: mplayerxp/nls/help_mp-fr.h =================================================================== --- mplayerxp/nls/help_mp-fr.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-fr.h 2012-10-19 14:22:17 UTC (rev 174) @@ -141,9 +141,6 @@ #define MSGTR_CantSeekRawAVI "Ne peut chercher dans un flux .AVI brut! (index requis, essayez l'option -idx!)\n" #define MSGTR_CantSeekFile "Ne peut chercher dans ce fichier! \n" -#define MSGTR_EncryptedVOB "Fichier VOB encrypté (support libcss NON compilé!) Lire DOCS/cd-dvd.html\n" -#define MSGTR_EncryptedVOBauth "Flux encrypté mais l'authentification n'a pas été demandée par vous!!\n" - #define MSGTR_MOVcomprhdr "MOV: Les entêtes compressées ne sont pas (encore) supportés!\n" #define MSGTR_MOVvariableFourCC "MOV: Attention! Variable FOURCC détectée!?\n" #define MSGTR_MOVtooManyTrk "MOV: Attention! Trop de pistes!" Modified: mplayerxp/nls/help_mp-hu.h =================================================================== --- mplayerxp/nls/help_mp-hu.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-hu.h 2012-10-19 14:22:17 UTC (rev 174) @@ -135,9 +135,6 @@ #define MSGTR_CantSeekRawAVI "Nem tudok nyers .AVI-kban tekerni! (index kell, próbáld az -idx kapcsolóval!)\n" #define MSGTR_CantSeekFile "Nem tudok ebben a fileban tekerni! \n" -#define MSGTR_EncryptedVOB "Kódolt VOB file (libcss támogatás nincs befordítva!) Olvasd el a doksit\n" -#define MSGTR_EncryptedVOBauth "Kódolt folyam, de nem kértél autentikálást!!\n" - #define MSGTR_MOVcomprhdr "MOV: Tömörített fejlécek (még) nincsenek támogatva!\n" #define MSGTR_MOVvariableFourCC "MOV: Vigyázat! változó FOURCC detektálva!?\n" #define MSGTR_MOVtooManyTrk "MOV: Vigyázat! túl sok sáv!" Modified: mplayerxp/nls/help_mp-it.h =================================================================== --- mplayerxp/nls/help_mp-it.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-it.h 2012-10-19 14:22:17 UTC (rev 174) @@ -139,9 +139,6 @@ #define MSGTR_CantSeekRawAVI "Impossibile spostarsi nei flussi .AVI grezzi! (richiesto un indice, prova con l\'opzione -idx !) \n" #define MSGTR_CantSeekFile "Impossibile spostarsi in questo file! \n" -#define MSGTR_EncryptedVOB "File VOB criptato (non compilato con il supporto delle libcss)! Leggi il file DOCS/cd-dvd.html\n" -#define MSGTR_EncryptedVOBauth "Flusso criptato di cui non è stata chiesta l\'autenticazione!\n" - #define MSGTR_MOVcomprhdr "MOV: Intestazioni compresse non (ancora) supportate!\n" #define MSGTR_MOVvariableFourCC "MOV: Avvertimento! Rilevata variabile FOURCC !?\n" #define MSGTR_MOVtooManyTrk "MOV: Avvertimento! troppe tracce!" Modified: mplayerxp/nls/help_mp-ko.h =================================================================== --- mplayerxp/nls/help_mp-ko.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-ko.h 2012-10-19 14:22:17 UTC (rev 174) @@ -139,9 +139,6 @@ #define MSGTR_CantSeekRawAVI "raw .AVI 스트림에서는 탐색할 수 없습니다! (인덱스가 필요합니다, -idx 스위치로 시도해보세요!) \n" #define MSGTR_CantSeekFile "이 파일에서는 탐색할 수 없습니다! \n" -#define MSGTR_EncryptedVOB "암호화된 VOB 파일입니다(libcss 지원없이 컴파일되었음)! DOCS/cd-dvd.html을 참조하세요\n" -#define MSGTR_EncryptedVOBauth "암호화된 스트림인데, 인증 신청을 하지않았습니다!!\n" - #define MSGTR_MOVcomprhdr "MOV: 압축된 헤더는 (아직) 지원되지않습니다!\n" #define MSGTR_MOVvariableFourCC "MOV: 경고! FOURCC 변수 발견!?\n" #define MSGTR_MOVtooManyTrk "MOV: 경고! 트랙이 너무 많습니다!" Modified: mplayerxp/nls/help_mp-nl.h =================================================================== --- mplayerxp/nls/help_mp-nl.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-nl.h 2012-10-19 14:22:17 UTC (rev 174) @@ -135,9 +135,6 @@ #define MSGTR_CantSeekRawAVI "Kan niet in raw .AVI streams verplaatsen! (index nodig, probeer met de -idx optie!) \n" #define MSGTR_CantSeekFile "Kan niet verplaatsen in dit bestand! \n" -#define MSGTR_EncryptedVOB "Geencrypteerd VOB bestand (niet gecompileerd met libcss ondersteuning)! Lees DOCS/cd-dvd.html bestand\n" -#define MSGTR_EncryptedVOBauth "Geencrypteerde stream maar authenticatie was niet aangevraagd door u!!\n" - #define MSGTR_MOVcomprhdr "MOV: Gecomprimeerde headers (nog) niet ondersteund!\n" #define MSGTR_MOVvariableFourCC "MOV: Waarschuwing! variabele FOURCC gedetecteerd!?\n" #define MSGTR_MOVtooManyTrk "MOV: Waarschuwing! te veel tracks!" Modified: mplayerxp/nls/help_mp-no.h =================================================================== --- mplayerxp/nls/help_mp-no.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-no.h 2012-10-19 14:22:17 UTC (rev 174) @@ -136,9 +136,6 @@ #define MSGTR_CantSeekRawAVI "Kan ikke søke i rå .AVI streams! (index behøves, prøv med -idx valget!) \n" #define MSGTR_CantSeekFile "Kan ikke søke i denne filen! \n" -#define MSGTR_EncryptedVOB "Kryptert VOB fil (ikke kompilert med libcss støtte)! Les filen DOCS/DVD\n" -#define MSGTR_EncryptedVOBauth "Kryptert stream men autentikasjon var ikke forespurt av deg!!\n" - #define MSGTR_MOVcomprhdr "MOV: Komprimerte headere ikke støttet (enda)!\n" #define MSGTR_MOVvariableFourCC "MOV: Advarsel! variabel FOURCC detektert!?\n" #define MSGTR_MOVtooManyTrk "MOV: Advarsel! for mange sport!" Modified: mplayerxp/nls/help_mp-pl.h =================================================================== --- mplayerxp/nls/help_mp-pl.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-pl.h 2012-10-19 14:22:17 UTC (rev 174) @@ -137,9 +137,6 @@ #define MSGTR_CantSeekRawAVI "Nie mogę przeszukiwać nieindeksowanych strumieni .AVI! (sprawdź opcję -idx !)\n" #define MSGTR_CantSeekFile "Nie mogę przeszukiwać tego pliku! \n" -#define MSGTR_EncryptedVOB "Zaszyfrowany plik VOB (nie wkompilowano obsługi libcss)! Przeczytaj plik DOCS/cd-dvd.html\n" -#define MSGTR_EncryptedVOBauth "Zaszyfrowany strumień, nie zażyczyłeś sobie autentykacji!!\n" - #define MSGTR_MOVcomprhdr "MOV: Spakowane nagłówki nie są obsługiwane (na razie)!\n" #define MSGTR_MOVvariableFourCC "MOV: Uwaga! wykryto zmienną FOURCC!?\n" #define MSGTR_MOVtooManyTrk "MOV: Uwaga! zbyt dużo scieżek!" Modified: mplayerxp/nls/help_mp-ro.h =================================================================== --- mplayerxp/nls/help_mp-ro.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-ro.h 2012-10-19 14:22:17 UTC (rev 174) @@ -134,9 +134,6 @@ #define MSGTR_CantSeekRawAVI "Nu pot căuta în fişiere .AVI neindexate! (am nevoie de index, încercaţi cu -idx!) \n" #define MSGTR_CantSeekFile "Nu pot căuta în fişier! \n" -#define MSGTR_EncryptedVOB "Fişier VOB encriptat (necompilat cu suport libcss)! Citiţi fişierul DOCS/DVD\n" -#define MSGTR_EncryptedVOBauth "Fişier encriptat dar autentificarea nu a fost cerută de dumneavoastră.!!\n" - #define MSGTR_MOVcomprhdr "MOV: Antetele compresate nu sunt (încă) suportate!\n" #define MSGTR_MOVvariableFourCC "MOV: Atenţie! variabilă FOURCC detectată!?\n" #define MSGTR_MOVtooManyTrk "MOV: Atenţie! prea multe piste!" Modified: mplayerxp/nls/help_mp-ru.h =================================================================== --- mplayerxp/nls/help_mp-ru.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-ru.h 2012-10-19 14:22:17 UTC (rev 174) @@ -175,9 +175,6 @@ #define MSGTR_CantSeekRawAVI "Не могу переместиться в сыром потоке .AVI! (требуется индекс, попробуйте с ключом -idx!)\n" #define MSGTR_CantSeekFile "Не могу перемещаться в этом файле!\n" -#define MSGTR_EncryptedVOB "Шифрованный VOB файл (не компилили с поддержкой libcss)! См. DOCS/cd-dvd.html\n" -#define MSGTR_EncryptedVOBauth "Шифрованный поток, но авторизация Вами не была затребована!!\n" - #define MSGTR_MOVcomprhdr "MOV: Сжатые заголовки (пока) не поддерживаются!\n" #define MSGTR_MOVvariableFourCC "MOV: Предупреждение! Обнаружен переменный FOURCC!?\n" #define MSGTR_MOVtooManyTrk "MOV: Предупреждение! слишком много треков!" Modified: mplayerxp/nls/help_mp-sk.h =================================================================== --- mplayerxp/nls/help_mp-sk.h 2012-10-19 13:51:44 UTC (rev 173) +++ mplayerxp/nls/help_mp-sk.h 2012-10-19 14:22:17 UTC (rev 174) @@ -137,9 +137,6 @@ #define MSGTR_CantSeekRawAVI "Nemôžem sa posúvať v surových (raw) .AVI prúdoch! (Potrebujem index, zkuste použíť voľbu -idx !) \n" #define MSGTR_CantSeekFile "Nemôžem sa posúvať v tomto súbore! \n" -#define MSGTR_EncryptedVOB "Kódovaný VOB súbor (preložené bez podpory libcss)! Prečítajte si DOCS/DVD\n" -#define MSGTR_EncryptedVOBauth "Zakódovaný prúd, ale overenie autenticity ste nepožadovali!!\n" - #define MSGTR_MOVcomprhdr "MOV: Komprimované hlavičky nie sú (ešte) podporované!\n" #define MSGTR_MOVvariableFourCC "MOV: Upozornenie! premenná FOURCC detekovaná!?\n" #define MSGTR_MOVtooManyTrk "MOV: Upozornenie! Príliš veľa stôp!" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-19 17:07:03
|
Revision: 177 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=177&view=rev Author: nickols_k Date: 2012-10-19 17:06:52 +0000 (Fri, 19 Oct 2012) Log Message: ----------- decode and paint SUBTITLE within XP-thread Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.c mplayerxp/libvo/sub.c mplayerxp/libvo/sub.h mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/mplayer.c mplayerxp/spudec.c mplayerxp/spudec.h Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-19 14:37:49 UTC (rev 176) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-19 17:06:52 UTC (rev 177) @@ -19,6 +19,7 @@ #include "stream.h" #include "demuxer.h" #include "parse_es.h" +#include "sig_hand.h" #include "codec-cfg.h" @@ -30,6 +31,9 @@ #include "dec_ahead.h" #include "dec_video.h" +#include "spudec.h" +#include "vobsub.h" + // =================================================================== vf_cfg_t vf_cfg; // Configuration for audio filters @@ -230,7 +234,7 @@ } } -extern void update_subtitle(float v_pts); +static void update_subtitle(sh_video_t *sh_video,float v_pts,unsigned idx); int decode_video(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame, float pts){ vf_instance_t* vf; mp_image_t *mpi=NULL; @@ -262,7 +266,7 @@ } if(drop_frame) return 0; - update_subtitle(pts); + update_subtitle(sh_video,pts,mpi->xp_idx); vo_flush_page(dae_curr_vdecoded()); t2=GetTimer()-t2; @@ -284,3 +288,66 @@ if(sh_video->inited && mpvdec) mpvdec->control(sh_video,VDCTRL_RESYNC_STREAM,NULL); } +extern float sub_fps; +#ifdef USE_SUB +extern subtitle* mp_subtitles; +static float sub_last_pts = -303; +#endif +static void update_subtitle(sh_video_t *sh_video,float v_pts,unsigned xp_idx) +{ +#ifdef USE_SUB + // find sub + if(mp_subtitles && v_pts>0){ + float pts=v_pts; + if(sub_fps==0) sub_fps=sh_video->fps; + pinfo[xp_id].current_module="find_sub"; + if (pts > sub_last_pts || pts < sub_last_pts-1.0 ) { + find_sub(mp_subtitles,sub_uses_time?(100*pts):(pts*sub_fps)); // FIXME! frame counter... + sub_last_pts = pts; + } + pinfo[xp_id].current_module=NULL; + } +#endif + + // DVD sub: +#if 0 + if(vo_flags & 0x08){ + static vo_mpegpes_t packet; + static vo_mpegpes_t *pkg=&packet; + packet.timestamp=sh_video->timer*90000.0; + packet.id=0x20; /* Subpic */ + while((packet.size=ds_get_packet_sub(d_dvdsub,&packet.data))>0){ + MSG_V("\rDVD sub: len=%d v_pts=%5.3f s_pts=%5.3f \n",packet.size,v_pts,d_dvdsub->pts); + vo_draw_frame(&pkg); + } + }else +#endif + if(vo.spudec){ + unsigned char* packet=NULL; + int len,timestamp; + pinfo[xp_id].current_module="spudec"; + spudec_now_pts(vo.spudec,90000*v_pts); + if(spudec_visible(vo.spudec)) { + vo_draw_spudec_direct(xp_idx); + } else { + spudec_heartbeat(vo.spudec,90000*v_pts); + if (vo.vobsub) { + if (v_pts >= 0) { + while((len=vobsub_get_packet(vo.vobsub, v_pts,(any_t**)&packet, ×tamp))>0){ + timestamp -= (v_pts - sh_video->timer)*90000; + MSG_V("\rVOB sub: len=%d v_pts=%5.3f v_timer=%5.3f sub=%5.3f ts=%d \n",len,v_pts,sh_video->timer,timestamp / 90000.0,timestamp); + spudec_assemble(vo.spudec,packet,len,90000*d_dvdsub->pts); + } + } + } else { + while((len=ds_get_packet_sub(d_dvdsub,&packet))>0){ + MSG_V("\rDVD sub: len=%d v_pts=%5.3f s_pts=%5.3f \n",len,v_pts,d_dvdsub->pts); + spudec_assemble(vo.spudec,packet,len,90000*d_dvdsub->pts); + } + } + /* detect wether the sub has changed or not */ + if(spudec_changed(vo.spudec)) vo_draw_spudec_direct(xp_idx); + pinfo[xp_id].current_module=NULL; + } + } +} Modified: mplayerxp/libvo/sub.c =================================================================== --- mplayerxp/libvo/sub.c 2012-10-19 14:37:49 UTC (rev 176) +++ mplayerxp/libvo/sub.c 2012-10-19 17:06:52 UTC (rev 177) @@ -531,6 +531,10 @@ } } +void __FASTCALL__ vo_draw_spudec(unsigned idx,int dxs,int dys,draw_osd_f draw_alpha){ + spudec_draw_scaled(vo.spudec, dxs, dys, draw_alpha); // FIXME +} + void __FASTCALL__ vo_draw_text(unsigned idx,int dxs,int dys,draw_osd_f draw_alpha){ mp_osd_obj_t* obj=vo_osd_list; vo_update_osd(dxs,dys); Modified: mplayerxp/libvo/sub.h =================================================================== --- mplayerxp/libvo/sub.h 2012-10-19 14:37:49 UTC (rev 176) +++ mplayerxp/libvo/sub.h 2012-10-19 17:06:52 UTC (rev 177) @@ -91,6 +91,9 @@ typedef void (* __FASTCALL__ draw_osd_f)(unsigned idx,int x0,int y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride); typedef void (* __FASTCALL__ clear_osd_f)(unsigned idx,int x0,int y0, int w,int h); +/* for direct calll from XP-thread*/ +extern void __FASTCALL__ vo_draw_spudec(unsigned idx,int dxs,int dys,draw_osd_f draw_alpha); + extern void __FASTCALL__ vo_draw_text(unsigned idx,int dxs,int dys, draw_osd_f draw_alpha); extern void __FASTCALL__ vo_remove_text(unsigned idx,int dxs,int dys,clear_osd_f remove); Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-10-19 14:37:49 UTC (rev 176) +++ mplayerxp/libvo/video_out.c 2012-10-19 17:06:52 UTC (rev 177) @@ -828,6 +828,18 @@ } } +void vo_draw_spudec_direct(unsigned idx) +{ + MSG_DBG3("dri_vo_dbg: vo_draw_osd\n"); + if(dri.has_dri && !(dri.cap.caps & DRI_CAP_HWOSD)) + { +// if( dri.cap.x || dri.cap.y || +// dri.cap.w != dri.cap.width || dri.cap.h != dri.cap.height) +// vo_remove_text(idx,dri.cap.width,dri.cap.height,dri_remove_osd); + vo_draw_spudec(idx,dri.cap.width,dri.cap.height,dri_draw_osd); + } +} + void vo_uninit( void ) { MSG_DBG3("dri_vo_dbg: vo_uninit\n"); Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-10-19 14:37:49 UTC (rev 176) +++ mplayerxp/libvo/video_out.h 2012-10-19 17:06:52 UTC (rev 177) @@ -179,6 +179,7 @@ extern void vo_select_frame(unsigned idx); extern void vo_flush_page(unsigned decoder_idx); extern void vo_draw_osd(unsigned idx); +extern void vo_draw_spudec_direct(unsigned idx); extern void vo_uninit( void ); extern uint32_t __FASTCALL__ vo_control(uint32_t request, any_t*data); extern int __FASTCALL__ vo_is_final(void); Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-19 14:37:49 UTC (rev 176) +++ mplayerxp/mplayer.c 2012-10-19 17:06:52 UTC (rev 177) @@ -110,6 +110,9 @@ static int osd_show_framedrop = 0; static int osd_function=OSD_PLAY; int output_quality=0; +#ifdef USE_SUB +subtitle* mp_subtitles=NULL; +#endif int xp_id=0; pid_t mplayer_pid; @@ -286,10 +289,6 @@ static sh_video_t *sh_video=NULL; static demuxer_t *demuxer=NULL; pthread_mutex_t audio_timer_mutex=PTHREAD_MUTEX_INITIALIZER; -#ifdef USE_SUB -static subtitle* subtitles=NULL; -static float sub_last_pts = -303; -#endif /* XP audio buffer */ typedef struct audio_buffer_index_s { float pts; @@ -719,10 +718,10 @@ inited_flags&=~INITED_SUBTITLE; pinfo[xp_id].current_module="sub_free"; mp_input_uninit(); - sub_free( subtitles ); + sub_free( mp_subtitles ); sub_name=NULL; vo.sub=NULL; - subtitles=NULL; + mp_subtitles=NULL; } #endif pinfo[xp_id].current_module=NULL; @@ -1177,63 +1176,6 @@ #endif //================= Update OSD ==================== -void update_subtitle(float v_pts) -{ - -#ifdef USE_SUB - // find sub - if(subtitles && v_pts>0){ - float pts=v_pts; - if(sub_fps==0) sub_fps=sh_video->fps; - pinfo[xp_id].current_module="find_sub"; - if (pts > sub_last_pts || pts < sub_last_pts-1.0 ) { - find_sub(subtitles,sub_uses_time?(100*pts):(pts*sub_fps)); // FIXME! frame counter... - sub_last_pts = pts; - } - pinfo[xp_id].current_module=NULL; - } -#endif 8 - - // DVD sub: -#if 0 - if(vo_flags & 0x08){ - static vo_mpegpes_t packet; - static vo_mpegpes_t *pkg=&packet; - packet.timestamp=sh_video->timer*90000.0; - packet.id=0x20; /* Subpic */ - while((packet.size=ds_get_packet_sub(d_dvdsub,&packet.data))>0){ - MSG_V("\rDVD sub: len=%d v_pts=%5.3f s_pts=%5.3f \n",packet.size,v_pts,d_dvdsub->pts); - vo_draw_frame(&pkg); - } - }else -#endif - if(vo.spudec){ - unsigned char* packet=NULL; - int len,timestamp; - pinfo[xp_id].current_module="spudec"; - spudec_heartbeat(vo.spudec,90000*v_pts); - if (vo.vobsub) { - if (v_pts >= 0) { - while((len=vobsub_get_packet(vo.vobsub, v_pts,(any_t**)&packet, ×tamp))>0){ - timestamp -= (v_pts - sh_video->timer)*90000; - MSG_V("\rVOB sub: len=%d v_pts=%5.3f v_timer=%5.3f sub=%5.3f ts=%d \n",len,v_pts,sh_video->timer,timestamp / 90000.0,timestamp); - spudec_assemble(vo.spudec,packet,len,90000*d_dvdsub->pts); - - } - } - } else { - while((len=ds_get_packet_sub(d_dvdsub,&packet))>0){ - MSG_V("\rDVD sub: len=%d v_pts=%5.3f s_pts=%5.3f \n",len,v_pts,d_dvdsub->pts); - spudec_assemble(vo.spudec,packet,len,90000*d_dvdsub->pts); - } - } - /* detect wether the sub has changed or not */ - if(spudec_changed(vo.spudec)) - vo_osd_changed(OSDTYPE_SPU); - pinfo[xp_id].current_module=NULL; - } -} - static void __show_status_line(float a_pts,float video_pts,float delay,float AV_delay,video_stat_t *vstat) { MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d %d [frms: [%i]]\n", a_pts-delay,video_pts,AV_delay,c_total, @@ -1953,17 +1895,17 @@ // check .sub pinfo[xp_id].current_module="read_subtitles_file"; if(sub_name){ - subtitles=sub_read_file(sub_name, sh_video->fps); - if(!subtitles) MSG_ERR(MSGTR_CantLoadSub,sub_name); + mp_subtitles=sub_read_file(sub_name, sh_video->fps); + if(!mp_subtitles) MSG_ERR(MSGTR_CantLoadSub,sub_name); } else if(sub_auto) { // auto load sub file ... - subtitles=sub_read_file( filename ? sub_filename( get_path("sub/"), filename ) + mp_subtitles=sub_read_file( filename ? sub_filename( get_path("sub/"), filename ) : "default.sub", sh_video->fps ); } - if(subtitles) + if(mp_subtitles) { inited_flags|=INITED_SUBTITLE; - if(stream_dump_type>1) list_sub_file(subtitles); + if(stream_dump_type>1) list_sub_file(mp_subtitles); } #endif } Modified: mplayerxp/spudec.c =================================================================== --- mplayerxp/spudec.c 2012-10-19 14:37:49 UTC (rev 176) +++ mplayerxp/spudec.c 2012-10-19 17:06:52 UTC (rev 177) @@ -578,6 +578,12 @@ spu->packet_size = spu->packet_offset = 0; } +void __FASTCALL__ spudec_now_pts(any_t*this, unsigned int pts100) +{ + spudec_handle_t *spu = (spudec_handle_t*) this; + spu->now_pts = pts100; +} + void __FASTCALL__ spudec_heartbeat(any_t*this, unsigned int pts100) { spudec_handle_t *spu = (spudec_handle_t*) this; Modified: mplayerxp/spudec.h =================================================================== --- mplayerxp/spudec.h 2012-10-19 14:37:49 UTC (rev 176) +++ mplayerxp/spudec.h 2012-10-19 17:06:52 UTC (rev 177) @@ -9,6 +9,7 @@ extern float spu_gaussvar; void __FASTCALL__ spudec_heartbeat(any_t*_this, unsigned int pts100); +void __FASTCALL__ spudec_now_pts(any_t*_this, unsigned int pts100); void __FASTCALL__ spudec_assemble(any_t*_this, unsigned char *packet, unsigned int len, unsigned int pts100); void __FASTCALL__ spudec_draw(any_t*this, draw_osd_f draw_alpha); void __FASTCALL__ spudec_draw_scaled(any_t*_this, unsigned int dxs, unsigned int dys,draw_osd_f draw_alpha); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-20 07:53:43
|
Revision: 179 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=179&view=rev Author: nickols_k Date: 2012-10-20 07:53:37 +0000 (Sat, 20 Oct 2012) Log Message: ----------- mplayerxp needs only one demuxer per all threads Modified Paths: -------------- mplayerxp/dec_ahead.c mplayerxp/dec_ahead.h mplayerxp/libmpdemux/demuxer_r.c mplayerxp/libmpdemux/demuxer_r.h mplayerxp/mplayer.c Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-20 07:45:14 UTC (rev 178) +++ mplayerxp/dec_ahead.c 2012-10-20 07:53:37 UTC (rev 179) @@ -37,18 +37,12 @@ xp_core_t xp_core; void xp_core_init(void) { - pthread_mutexattr_t attr; memset(&xp_core,0,sizeof(xp_core_t)); xp_core.in_lseek=NoSeek; - pthread_mutexattr_init(&attr); - pthread_mutex_init(&xp_core.seek_mutex, &attr); } void xp_core_uninit(void) {} -void xp_core_lock_seeking(void) { pthread_mutex_lock(&xp_core.seek_mutex); } -void xp_core_unlock_seeking(void) { pthread_mutex_unlock(&xp_core.seek_mutex); } - void dae_reset(dec_ahead_engine_t* it) { it->player_idx=0; it->decoder_idx=0; @@ -318,7 +312,6 @@ sh_video->num_frames_decoded = dec_ahead_seek_num_frames_decoded; } /* get it! */ - xp_core_lock_seeking(); #if 0 /* prevent reent access to non-reent demuxer */ //if(sh_video->num_frames>200) *((char*)0x100) = 1; // Testing crash @@ -330,7 +323,6 @@ #endif /*-------------------- Decode a frame: -----------------------*/ in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,vo.fps); - xp_core_unlock_seeking(); if(xp_core.in_lseek==Seek) { pinfo[_xp_id].current_module = "Post seek"; /* reset counters */ @@ -947,8 +939,6 @@ Unlock all mutex ( man page says it may deadlock, but what is worse deadlock here or later? ) */ - xp_core_unlock_seeking(); - pthread_is_living=0; xp_core.in_lseek=NoSeek; killall_threads(pthread_self()); Modified: mplayerxp/dec_ahead.h =================================================================== --- mplayerxp/dec_ahead.h 2012-10-20 07:45:14 UTC (rev 178) +++ mplayerxp/dec_ahead.h 2012-10-20 07:53:37 UTC (rev 179) @@ -48,7 +48,6 @@ int has_video; int has_audio; dec_ahead_engine_t* video; - pthread_mutex_t seek_mutex; volatile enum seek_states in_lseek; volatile int in_pause; volatile int in_resize; @@ -58,9 +57,6 @@ extern void xp_core_init(void); extern void xp_core_uninit(void); -extern void xp_core_lock_seeking(void); -extern void xp_core_unlock_seeking(void); - extern void dae_init(dec_ahead_engine_t* it,unsigned nframes); extern void dae_uninit(dec_ahead_engine_t* it); extern void dae_reset(dec_ahead_engine_t* it); /* after mpxp_seek */ Modified: mplayerxp/libmpdemux/demuxer_r.c =================================================================== --- mplayerxp/libmpdemux/demuxer_r.c 2012-10-20 07:45:14 UTC (rev 178) +++ mplayerxp/libmpdemux/demuxer_r.c 2012-10-20 07:53:37 UTC (rev 179) @@ -7,6 +7,7 @@ #include "demuxer.h" #include "stheader.h" #include "demuxer_r.h" +#include "vobsub.h" #include "../osdep/timer.h" #include "../mplayer.h" #include "../dec_ahead.h" @@ -155,7 +156,7 @@ unsigned int t=0; unsigned int t2=0; double tt; -// LOCK_DEMUXER(); + LOCK_DEMUXER(); if(benchmark) t=GetTimer(); retval = demux_seek(demuxer,seeka); if(benchmark) @@ -166,10 +167,16 @@ if(tt > max_demux_time_usage) max_demux_time_usage=tt; if(tt < min_demux_time_usage) min_demux_time_usage=tt; } -// UNLOCK_DEMUXER(); + UNLOCK_DEMUXER(); return retval; } +void vobsub_seek_r(any_t* vobhandle, float pts) { + LOCK_DEMUXER(); + vobsub_seek(vobhandle,pts); + UNLOCK_DEMUXER(); +} + int demuxer_switch_audio_r(demuxer_t *d, int id) { int retval; Modified: mplayerxp/libmpdemux/demuxer_r.h =================================================================== --- mplayerxp/libmpdemux/demuxer_r.h 2012-10-20 07:45:14 UTC (rev 178) +++ mplayerxp/libmpdemux/demuxer_r.h 2012-10-20 07:53:37 UTC (rev 179) @@ -19,6 +19,7 @@ extern int ds_get_packet_r(demux_stream_t *ds,unsigned char **start,float *pts); extern int demux_seek_r(demuxer_t *demuxer,const seek_args_t* seeka); +extern void vobsub_seek_r(any_t* vobhandle, float pts); extern int demuxer_switch_audio_r(demuxer_t *, int id); extern int demuxer_switch_video_r(demuxer_t *, int id); Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-20 07:45:14 UTC (rev 178) +++ mplayerxp/mplayer.c 2012-10-20 07:53:37 UTC (rev 179) @@ -1452,7 +1452,6 @@ void mpxp_seek( int _xp_id, video_stat_t *vstat, osd_args_t *osd,float v_pts,const seek_args_t* seek) { int seek_rval=1; - xp_core_lock_seeking(); xp_core.in_lseek=Seek; audio_eof=0; if(seek->secs || seek->flags&DEMUX_SEEK_SET) { @@ -1501,7 +1500,7 @@ if (vo.vobsub) { pinfo[_xp_id].current_module = "seek_vobsub_reset"; - vobsub_seek(vo.vobsub, v_pts); + vobsub_seek_r(vo.vobsub, v_pts); } #ifdef USE_OSD @@ -1533,7 +1532,6 @@ } } } - xp_core_unlock_seeking(); } void mpxp_reset_vcache(void) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-20 08:01:39
|
Revision: 180 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=180&view=rev Author: nickols_k Date: 2012-10-20 08:01:33 +0000 (Sat, 20 Oct 2012) Log Message: ----------- more re-enter calls Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpdemux/demuxer_r.c mplayerxp/libmpdemux/demuxer_r.h mplayerxp/mplayer.c Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-20 07:53:37 UTC (rev 179) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-20 08:01:33 UTC (rev 180) @@ -316,7 +316,7 @@ static vo_mpegpes_t *pkg=&packet; packet.timestamp=sh_video->timer*90000.0; packet.id=0x20; /* Subpic */ - while((packet.size=ds_get_packet_sub(d_dvdsub,&packet.data))>0){ + while((packet.size=ds_get_packet_sub_r(d_dvdsub,&packet.data))>0){ MSG_V("\rDVD sub: len=%d v_pts=%5.3f s_pts=%5.3f \n",packet.size,v_pts,d_dvdsub->pts); vo_draw_frame(&pkg); } @@ -340,7 +340,7 @@ } } } else { - while((len=ds_get_packet_sub(d_dvdsub,&packet))>0){ + while((len=ds_get_packet_sub_r(d_dvdsub,&packet))>0){ MSG_V("\rDVD sub: len=%d v_pts=%5.3f s_pts=%5.3f \n",len,v_pts,d_dvdsub->pts); spudec_assemble(vo.spudec,packet,len,90000*d_dvdsub->pts); } Modified: mplayerxp/libmpdemux/demuxer_r.c =================================================================== --- mplayerxp/libmpdemux/demuxer_r.c 2012-10-20 07:53:37 UTC (rev 179) +++ mplayerxp/libmpdemux/demuxer_r.c 2012-10-20 08:01:33 UTC (rev 180) @@ -148,6 +148,13 @@ return retval; } +int ds_get_packet_sub_r(demux_stream_t *ds,unsigned char **start) { + int rc; + LOCK_DEMUXER(); + rc=ds_get_packet_sub(ds,start); + UNLOCK_DEMUXER(); + return rc; +} /* TODO : FIXME we need to redesign blocking of mutexes before enabling this function*/ int demux_seek_r(demuxer_t *demuxer,const seek_args_t* seeka) Modified: mplayerxp/libmpdemux/demuxer_r.h =================================================================== --- mplayerxp/libmpdemux/demuxer_r.h 2012-10-20 07:53:37 UTC (rev 179) +++ mplayerxp/libmpdemux/demuxer_r.h 2012-10-20 08:01:33 UTC (rev 180) @@ -17,6 +17,7 @@ extern int video_read_frame_r(sh_video_t* sh_video,float* frame_time_ptr,float *v_pts,unsigned char** start,int force_fps); extern int demux_read_data_r(demux_stream_t *ds,unsigned char* mem,int len,float *pts); extern int ds_get_packet_r(demux_stream_t *ds,unsigned char **start,float *pts); +extern int ds_get_packet_sub_r(demux_stream_t *ds,unsigned char **start); extern int demux_seek_r(demuxer_t *demuxer,const seek_args_t* seeka); extern void vobsub_seek_r(any_t* vobhandle, float pts); Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-20 07:53:37 UTC (rev 179) +++ mplayerxp/mplayer.c 2012-10-20 08:01:33 UTC (rev 180) @@ -1527,7 +1527,7 @@ } if(vo.spudec) { unsigned char* packet=NULL; - while(ds_get_packet_sub(d_dvdsub,&packet)>0) ; // Empty stream + while(ds_get_packet_sub_r(d_dvdsub,&packet)>0) ; // Empty stream spudec_reset(vo.spudec); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-25 06:52:50
|
Revision: 198 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=198&view=rev Author: nickols_k Date: 2012-10-25 06:52:41 +0000 (Thu, 25 Oct 2012) Log Message: ----------- reorder source tree Modified Paths: -------------- mplayerxp/Makefile mplayerxp/cfgparser.h mplayerxp/mplayer.c mplayerxp/postproc/libmenu/Makefile mplayerxp/postproc/libmenu/menu.c mplayerxp/postproc/libmenu/menu_cmdlist.c mplayerxp/postproc/libmenu/menu_param.c mplayerxp/postproc/libmenu/menu_pt.c Added Paths: ----------- mplayerxp/libplaytree/ mplayerxp/libplaytree/asxparser.c mplayerxp/libplaytree/asxparser.h mplayerxp/libplaytree/playtree.c mplayerxp/libplaytree/playtree.h mplayerxp/libplaytree/playtreeparser.c mplayerxp/libplaytree/playtreeparser.h Removed Paths: ------------- mplayerxp/asxparser.c mplayerxp/asxparser.h mplayerxp/playtree.c mplayerxp/playtree.h mplayerxp/playtreeparser.c mplayerxp/playtreeparser.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-10-25 06:26:33 UTC (rev 197) +++ mplayerxp/Makefile 2012-10-25 06:52:41 UTC (rev 198) @@ -13,7 +13,7 @@ PRG_FIBMAP = fibmap_mplayerxp PRG_CFG = codec-cfg-xp # these subdirectories required installation due binaries within them -SUBDIRS = libmpdemux libmpsub libmpcodecs libao2 osdep postproc input nls libvo +SUBDIRS = libmpdemux libmpsub libplaytree libmpcodecs libao2 osdep postproc input nls libvo ifeq ($(TARGET_ARCH_X86),yes) SUBDIRS+=loader endif @@ -23,7 +23,7 @@ MANDIR = ${prefix}/man LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs -SRCS_COMMON = cpudetect.c mp_msg.c codec-cfg.c cfgparser.c my_profile.c my_malloc.c playtree.c playtreeparser.c asxparser.c mp_image.c subopt-helper.c +SRCS_COMMON = cpudetect.c mp_msg.c codec-cfg.c cfgparser.c my_profile.c my_malloc.c mp_image.c subopt-helper.c SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c sig_hand.c dump.c dec_ahead.c m_option.c m_property.c m_struct.c OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) @@ -37,6 +37,7 @@ MP_LIBS = libmpdemux/libmpdemux.a \ libmpcodecs/libmpcodecs.a \ libmpsub/libmpsub.a \ + libplaytree/libplaytree.a \ libao2/libao2.a \ postproc/libpostproc.a \ input/libinput.a \ Deleted: mplayerxp/asxparser.c =================================================================== --- mplayerxp/asxparser.c 2012-10-25 06:26:33 UTC (rev 197) +++ mplayerxp/asxparser.c 2012-10-25 06:52:41 UTC (rev 198) @@ -1,717 +0,0 @@ - -#include <stdlib.h> -#include <stdio.h> -#include <stdarg.h> -#include <string.h> -#include <unistd.h> - -#include "libmpdemux/stream.h" -#include "playtreeparser.h" -#include "asxparser.h" -#include "cfgparser.h" -#include "../mplayer.h" -#define MSGT_CLASS MSGT_PLAYTREE -#include "__mp_msg.h" - -////// List utils - -static void __FASTCALL__ asx_list_add(any_t* list_ptr,any_t* entry){ - any_t** list = *(any_t***)list_ptr; - int c = 0; - - if(list != NULL) - for( ; list[c] != NULL; c++) ; - - list = (any_t*)realloc(list,sizeof(any_t*)*(c+2)); - - list[c] = entry; - list[c+1] = NULL; - - *(any_t***)list_ptr = list; -} - - -static void __FASTCALL__ asx_list_remove(any_t* list_ptr,any_t* entry,ASX_FreeFunc free_func) { - any_t** list = *(any_t***)list_ptr; - int c,e = -1; - - if(list == NULL) return; - - for(c = 0 ; list[c] != NULL; c++){ - if(list[c] == entry) e = c; - } - - if(e == -1) return; // Not found - - if(free_func != NULL) free_func(list[e]); - - if(c == 1) { // Only one entry, we drop all - free(list); - *(any_t**)list_ptr = NULL; - return; - } - - if(c > e) // If c==e the memmove is not needed - memmove(list+e,list+e+1,(c-e)*sizeof(any_t*)); - - list = (any_t*)realloc(list,(c-1)*sizeof(any_t*)); - list[c-1] = NULL; - - *(any_t***)list_ptr = list; -} - -void __FASTCALL__ asx_list_free(any_t* list_ptr,ASX_FreeFunc free_func) { - any_t** ptr = *(any_t***)list_ptr; - if(ptr == NULL) return; - if(free_func != NULL) { - for( ; *ptr != NULL ; ptr++) - free_func(*ptr); - } - free(*(any_t**)list_ptr); - *(any_t**)list_ptr = NULL; -} - -/////// Attribs utils - -char* __FASTCALL__ asx_get_attrib(const char* attrib,char** attribs) { - char** ptr; - - if(attrib == NULL || attribs == NULL) return NULL; - for(ptr = attribs; ptr[0] != NULL; ptr += 2){ - if(strcasecmp(ptr[0],attrib) == 0) - return strdup(ptr[1]); - } - return NULL; -} - -int __FASTCALL__ asx_attrib_to_enum(const char* val,char** valid_vals) { - char** ptr; - int r = 0; - - if(valid_vals == NULL || val == NULL) return -2; - for(ptr = valid_vals ; ptr[0] != NULL ; ptr++) { - if(strcasecmp(val,ptr[0]) == 0) return r; - r++; - } - - return -1; -} - -static void __FASTCALL__ asx_warning_attrib_invalid(ASX_Parser_t* parser, char* elem, char* attrib, - char** valid_vals,char* val) { - char *str,*vals,**ptr; - int len; - - if(valid_vals == NULL || valid_vals[0] == NULL) return; - - len = strlen(valid_vals[0]) + 1; - for(ptr = valid_vals+1 ; ptr[0] != NULL; ptr++) { - len += strlen(ptr[0]); - len += ((ptr[1] == NULL) ? 4 : 2); - } - str = vals = (char*)malloc(len); - vals += sprintf(vals,"%s",valid_vals[0]); - for(ptr = valid_vals + 1 ; ptr[0] != NULL ; ptr++) { - if(ptr[1] == NULL) - vals += sprintf(vals," or %s",ptr[0]); - else - vals += sprintf(vals,", %s",ptr[0]); - } - MSG_ERR("at line %d : attribute %s of element %s is invalid (%s). Valid values are %s", - parser->line,attrib,elem,val,str); - free(str); -} - -static int __FASTCALL__ asx_get_yes_no_attrib(ASX_Parser_t* parser, char* element, char* attrib,char** attribs,int def) { - char* val = asx_get_attrib(attrib,attribs); - char* valids[] = { "NO", "YES", NULL }; - int r; - - if(val == NULL) return def; - r = asx_attrib_to_enum(val,valids); - - if(r < 0) { - asx_warning_attrib_invalid(parser,element,attrib,valids,val); - r = def; - } - - free(val); - return r; -} - -#define asx_warning_attrib_required(p,e,a) MSG_WARN("At line %d : element %s don't have the required attribute %s",p->line,e,a) -#define asx_warning_body_parse_error(p,e) MSG_WARN("At line %d : error while parsing %s body",p->line,e) - -ASX_Parser_t* asx_parser_new(void) { - ASX_Parser_t* parser = calloc(1,sizeof(ASX_Parser_t)); - return parser; -} - -void __FASTCALL__ asx_parser_free(ASX_Parser_t* parser) { - if(!parser) return; - if(parser->ret_stack) free(parser->ret_stack); - free(parser); - -} - -#define LETTER "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" -#define SPACE " \n\t\r" - -int __FASTCALL__ asx_parse_attribs(ASX_Parser_t* parser,char* buffer,char*** _attribs) { - char *ptr1, *ptr2, *ptr3; - int n_attrib = 0; - char **attribs = NULL; - char *attrib, *val; - - ptr1 = buffer; - while(1) { - for( ; strchr(SPACE,*ptr1) != NULL; ptr1++) { // Skip space - if(*ptr1 == '\0') break; - } - ptr3 = strchr(ptr1,'='); - if(ptr3 == NULL) break; - for(ptr2 = ptr3-1; strchr(SPACE,*ptr2) != NULL; ptr2--) { - if (ptr2 == ptr1) { - MSG_ERR("At line %d : this should never append, back to attribute begin while skipping end space",parser->line); - break; - } - } - attrib = (char*)malloc(ptr2-ptr1+2); - strncpy(attrib,ptr1,ptr2-ptr1+1); - attrib[ptr2-ptr1+1] = '\0'; - - ptr1 = strchr(ptr3,'"'); - if(ptr1 == NULL || ptr1[1] == '\0') { - MSG_WARN("At line %d : can't find attribute %s value",parser->line,attrib); - free(attrib); - break; - } - ptr1++; - ptr2 = strchr(ptr1,'"'); - if (ptr2 == NULL) { - MSG_WARN("At line %d : value of attribute %s isn't finished",parser->line,attrib); - free(attrib); - break; - } - val = (char*)malloc(ptr2-ptr1+1); - strncpy(val,ptr1,ptr2-ptr1); - val[ptr2-ptr1] = '\0'; - n_attrib++; - - attribs = (char**)realloc(attribs,2*n_attrib*sizeof(char*)+1); - attribs[n_attrib*2-2] = attrib; - attribs[n_attrib*2-1] = val; - - ptr1 = ptr2+2; - } - - if(n_attrib > 0) - attribs[n_attrib*2] = NULL; - - *_attribs = attribs; - - return n_attrib; -} - -/* - * Return -1 on error, 0 when nothing is found, 1 on sucess - */ -int __FASTCALL__ asx_get_element(ASX_Parser_t* parser,char** _buffer, - char** _element,char** _body,char*** _attribs) { - char *ptr1,*ptr2, *ptr3, *ptr4; - char *attribs = NULL; - char *element = NULL, *body = NULL, *ret = NULL, *buffer; - int n_attrib = 0; - int body_line = 0,attrib_line,ret_line,in = 0; - - if(_buffer == NULL || _element == NULL || _body == NULL || _attribs == NULL) { - MSG_ERR("At line %d : asx_get_element called with invalid value",parser->line); - return -1; - } - - *_body = *_element = NULL; - *_attribs = NULL; - buffer = *_buffer; - - if(buffer == NULL) return 0; - - if(parser->ret_stack && /*parser->last_body && */buffer != parser->last_body) { - ASX_LineSave_t* ls = parser->ret_stack; - int i; - for(i = 0 ; i < parser->ret_stack_size ; i++) { - if(buffer == ls[i].buffer) { - parser->line = ls[i].line; - break; - } - - } - if( i < parser->ret_stack_size) { - i++; - if( i < parser->ret_stack_size) - memmove(parser->ret_stack,parser->ret_stack+i, (parser->ret_stack_size - i)*sizeof(ASX_LineSave_t)); - parser->ret_stack_size -= i; - if(parser->ret_stack_size > 0) - parser->ret_stack = (ASX_LineSave_t*)realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); - else { - free(parser->ret_stack); - parser->ret_stack = NULL; - } - } - } - - ptr1 = buffer; - while(1) { - for( ; ptr1[0] != '<' ; ptr1++) { - if(ptr1[0] == '\0') { - ptr1 = NULL; - break; - } - if(ptr1[0] == '\n') parser->line++; - } - //ptr1 = strchr(ptr1,'<'); - if(!ptr1 || ptr1[1] == '\0') return 0; // Nothing found - - if(strncmp(ptr1,"<!--",4) == 0) { // Comments - for( ; strncmp(ptr1,"-->",3) != 0 ; ptr1++) { - if(ptr1[0] == '\0') { - ptr1 = NULL; - break; - } - if(ptr1[0] == '\n') parser->line++; - } - //ptr1 = strstr(ptr1,"-->"); - if(!ptr1) { - MSG_ERR("At line %d : unfinished comment",parser->line); - return -1; - } - } else { - break; - } - } - - // Is this space skip very useful ?? - for(ptr1++; strchr(SPACE,ptr1[0]) != NULL; ptr1++) { // Skip space - if(ptr1[0] == '\0') { - MSG_ERR("At line %d : EOB reached while parsing element start",parser->line); - return -1; - } - if(ptr1[0] == '\n') parser->line++; - } - - for(ptr2 = ptr1; strchr(LETTER,*ptr2) != NULL;ptr2++) { // Go to end of name - if(*ptr2 == '\0'){ - MSG_ERR("At line %d : EOB reached while parsing element start",parser->line); - return -1; - } - if(ptr2[0] == '\n') parser->line++; - } - - element = (char*)malloc(ptr2-ptr1+1); - strncpy(element,ptr1,ptr2-ptr1); - element[ptr2-ptr1] = '\0'; - - for( ; strchr(SPACE,*ptr2) != NULL; ptr2++) { // Skip space - if(ptr2[0] == '\0') { - MSG_ERR("At line %d : EOB reached while parsing element start",parser->line); - free(element); - return -1; - } - if(ptr2[0] == '\n') parser->line++; - } - attrib_line = parser->line; - - - - for(ptr3 = ptr2; ptr3[0] != '\0'; ptr3++) { // Go to element end - if(ptr3[0] == '>' || strncmp(ptr3,"/>",2) == 0) - break; - if(ptr3[0] == '\n') parser->line++; - } - if(ptr3[0] == '\0' || ptr3[1] == '\0') { // End of file - MSG_ERR("At line %d : EOB reached while parsing element start",parser->line); - free(element); - return -1; - } - - // Save attribs string - if(ptr3-ptr2 > 0) { - attribs = (char*)malloc(ptr3-ptr2+1); - strncpy(attribs,ptr2,ptr3-ptr2); - attribs[ptr3-ptr2] = '\0'; - } - //bs_line = parser->line; - if(ptr3[0] != '/') { // Not Self closed element - ptr3++; - for( ; strchr(SPACE,*ptr3) != NULL; ptr3++) { // Skip space on body begin - if(*ptr3 == '\0') { - MSG_ERR("At line %d : EOB reached while parsing %s element body",parser->line,element); - free(element); - if(attribs) free(attribs); - return -1; - } - if(ptr3[0] == '\n') parser->line++; - } - ptr4 = ptr3; - body_line = parser->line; - while(1) { // Find closing element - for( ; ptr4[0] != '<' ; ptr4++) { - if(ptr4[0] == '\0') { - ptr4 = NULL; - break; - } - if(ptr4[0] == '\n') parser->line++; - } - if(strncmp(ptr4,"<!--",4) == 0) { // Comments - for( ; strncmp(ptr4,"-->",3) != 0 ; ptr4++) { - if(ptr4[0] == '\0') { - ptr4 = NULL; - break; - } - if(ptr1[0] == '\n') parser->line++; - } - continue; - } - if(ptr4 == NULL || ptr4[1] == '\0') { - MSG_ERR("At line %d : EOB reached while parsing %s element body",parser->line,element); - free(element); - if(attribs) free(attribs); - return -1; - } - if(ptr4[1] != '/' && strncasecmp(element,ptr4+1,strlen(element)) == 0) { - in++; - ptr4+=2; - continue; - } else if(strncasecmp(element,ptr4+2,strlen(element)) == 0) { // Extract body - if(in > 0) { - in--; - ptr4 += 2+strlen(element); - continue; - } - ret = ptr4+strlen(element)+3; - if(ptr4 != ptr3) { - ptr4--; - for( ; ptr4 != ptr3 && strchr(SPACE,*ptr4) != NULL; ptr4--) ;// Skip space on body end - // if(ptr4[0] == '\0') parser->line--; - //} - ptr4++; - body = (char*)malloc(ptr4-ptr3+1); - strncpy(body,ptr3,ptr4-ptr3); - body[ptr4-ptr3] = '\0'; - } - break; - } else { - ptr4 += 2; - } - } - } else { - ret = ptr3 + 2; // 2 is for /> - } - - for( ; ret[0] != '\0' && strchr(SPACE,ret[0]) != NULL; ret++) { // Skip space - if(ret[0] == '\n') parser->line++; - } - - ret_line = parser->line; - - if(attribs) { - parser->line = attrib_line; - n_attrib = asx_parse_attribs(parser,attribs,_attribs); - free(attribs); - if(n_attrib < 0) { - MSG_WARN("At line %d : error while parsing element %s attributes",parser->line,element); - free(element); - free(body); - return -1; - } - } else - *_attribs = NULL; - - *_element = element; - *_body = body; - - parser->last_body = body; - parser->ret_stack_size++; - parser->ret_stack = (ASX_LineSave_t*)realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); - if(parser->ret_stack_size > 1) - memmove(parser->ret_stack+1,parser->ret_stack,(parser->ret_stack_size-1)*sizeof(ASX_LineSave_t)); - parser->ret_stack[0].buffer = ret; - parser->ret_stack[0].line = ret_line; - parser->line = body ? body_line : ret_line; - - *_buffer = ret; - return 1; - -} - -static void __FASTCALL__ asx_parse_param(ASX_Parser_t* parser, char** attribs, play_tree_t* pt) { - char *name,*val; - - name = asx_get_attrib("NAME",attribs); - if(!name) { - asx_warning_attrib_required(parser,"PARAM" ,"NAME" ); - return; - } - val = asx_get_attrib("VALUE",attribs); - if(m_config_get_option(mconfig,name) == NULL) { - MSG_WARN("Found unknow param in asx: %s",name); - if(val) - MSG_WARN("=%s\n",val); - else - MSG_WARN("\n"); - return; - } - play_tree_set_param(pt,name,val); -} - -static void __FASTCALL__ asx_parse_ref(ASX_Parser_t* parser, char** attribs, play_tree_t* pt) { - char *href; - - href = asx_get_attrib("HREF",attribs); - if(href == NULL) { - asx_warning_attrib_required(parser,"REF" ,"HREF" ); - return; - } - // replace http my mmshttp to avoid infinite loops - if (strncmp(href, "http://", 7) == 0) { - char *newref = malloc(3 + strlen(href) + 1); - strcpy(newref, "mms"); - strcpy(newref + 3, href); - free(href); - href = newref; - } - - play_tree_add_file(pt,href); - - MSG_V("Adding file %s to element entry\n",href); - - free(href); - -} - -static play_tree_t* __FASTCALL__ asx_parse_entryref(ASX_Parser_t* parser,char* buffer,char** _attribs) { - play_tree_t* pt; - char *href; - stream_t* stream; - play_tree_parser_t* ptp; - int f; - - if(parser->deep > 0) - return NULL; - - href = asx_get_attrib("HREF",_attribs); - if(href == NULL) { - asx_warning_attrib_required(parser,"ENTRYREF" ,"HREF" ); - return NULL; - } - stream=open_stream(href,&f,NULL); - if(!stream) { - MSG_WARN("Can't open playlist %s\n",href); - return NULL; - } - if(!(stream->type & STREAMTYPE_TEXT)) { - MSG_WARN("URL %s dont point to a playlist\n",href); - free_stream(stream); - return NULL; - } - - MSG_V("Adding playlist %s to element entryref\n",href); - - ptp = play_tree_parser_new(stream,parser->deep+1); - - pt = play_tree_parser_get_play_tree(ptp); - - play_tree_parser_free(ptp); - free_stream(stream); - - //MSG_INFO("Need to implement entryref\n"); - - return pt; -} - -static play_tree_t* __FASTCALL__ asx_parse_entry(ASX_Parser_t* parser,char* buffer,char** _attribs) { - char *element,*body,**attribs; - int r,nref=0; - play_tree_t *ref; - - ref = play_tree_new(); - - while(buffer && buffer[0] != '\0') { - r = asx_get_element(parser,&buffer,&element,&body,&attribs); - if(r < 0) { - asx_warning_body_parse_error(parser,"ENTRY"); - return NULL; - } else if (r == 0) { // No more element - break; - } - if(strcasecmp(element,"REF") == 0) { - asx_parse_ref(parser,attribs,ref); - MSG_DBG2("Adding element %s to entry\n",element); - nref++; - } else - MSG_DBG2("Ignoring element %s\n",element); - if(body) free(body); - asx_free_attribs(attribs); - } - - if(nref <= 0) { - play_tree_free(ref,1); - return NULL; - } - return ref; - -} - -static play_tree_t* __FASTCALL__ asx_parse_repeat(ASX_Parser_t* parser,char* buffer,char** _attribs) { - char *element,*body,**attribs; - play_tree_t *repeat, *list=NULL, *entry; - char* count; - int r; - - repeat = play_tree_new(); - - count = asx_get_attrib("COUNT",_attribs); - if(count == NULL) { - MSG_DBG2("Setting element repeat loop to infinit\n"); - repeat->loop = -1; // Infinit - } else { - repeat->loop = atoi(count); - free(count); - if(repeat->loop == 0) repeat->loop = 1; - MSG_DBG2("Setting element repeat loop to %d\n",repeat->loop); - } - - while(buffer && buffer[0] != '\0') { - r = asx_get_element(parser,&buffer,&element,&body,&attribs); - if(r < 0) { - asx_warning_body_parse_error(parser,"REPEAT"); - return NULL; - } else if (r == 0) { // No more element - break; - } - if(strcasecmp(element,"ENTRY") == 0) { - entry = asx_parse_entry(parser,body,attribs); - if(entry) { - if(!list) list = entry; - else play_tree_append_entry(list,entry); - MSG_DBG2("Adding element %s to repeat\n",element); - } - } else if(strcasecmp(element,"ENTRYREF") == 0) { - entry = asx_parse_entryref(parser,body,attribs); - if(entry) { - if(!list) list = entry; - else play_tree_append_entry(list,entry); - MSG_DBG2("Adding element %s to repeat\n",element); - } - } else if(strcasecmp(element,"REPEAT") == 0) { - entry = asx_parse_repeat(parser,body,attribs); - if(entry) { - if(!list) list = entry; - else play_tree_append_entry(list,entry); - MSG_DBG2("Adding element %s to repeat\n",element); - } - } else if(strcasecmp(element,"PARAM") == 0) { - asx_parse_param(parser,attribs,repeat); - } else - MSG_DBG2("Ignoring element %s\n",element); - if(body) free(body); - asx_free_attribs(attribs); - } - - if(!list) { - play_tree_free(repeat,1); - return NULL; - } - play_tree_set_child(repeat,list); - - return repeat; - -} - -play_tree_t* __FASTCALL__ asx_parser_build_tree(char* buffer,int deep) { - char *element,*asx_body,**asx_attribs,*body, **attribs; - int r; - play_tree_t *asx,*entry,*list = NULL; - ASX_Parser_t* parser = asx_parser_new(); - - parser->line = 1; - parser->deep = deep; - - r = asx_get_element(parser,&buffer,&element,&asx_body,&asx_attribs); - if(r < 0) { - MSG_ERR("At line %d : Syntax error ???",parser->line); - asx_parser_free(parser); - return NULL; - } else if(r == 0) { // No contents - MSG_ERR("empty asx element"); - asx_parser_free(parser); - return NULL; - } - - if(strcasecmp(element,"ASX") != 0) { - MSG_ERR("first element isn't ASX, it's %s\n",element); - asx_free_attribs(asx_attribs); - if(body) free(body); - asx_parser_free(parser); - return NULL; - } - - if(!asx_body) { - MSG_ERR("ASX element is empty"); - asx_free_attribs(asx_attribs); - asx_parser_free(parser); - return NULL; - } - - asx = play_tree_new(); - buffer = asx_body; - while(buffer && buffer[0] != '\0') { - r = asx_get_element(parser,&buffer,&element,&body,&attribs); - if(r < 0) { - asx_warning_body_parse_error(parser,"ASX"); - asx_parser_free(parser); - return NULL; - } else if (r == 0) { // No more element - break; - } - if(strcasecmp(element,"ENTRY") == 0) { - entry = asx_parse_entry(parser,body,attribs); - if(entry) { - if(!list) list = entry; - else play_tree_append_entry(list,entry); - MSG_DBG2("Adding element %s to asx\n",element); - } - } else if(strcasecmp(element,"ENTRYREF") == 0) { - entry = asx_parse_entryref(parser,body,attribs); - if(entry) { - if(!list) list = entry; - else play_tree_append_entry(list,entry); - MSG_DBG2("Adding element %s to asx\n",element); - } - } else if(strcasecmp(element,"REPEAT") == 0) { - entry = asx_parse_repeat(parser,body,attribs); - if(entry) { - if(!list) list = entry; - else play_tree_append_entry(list,entry); - MSG_DBG2("Adding element %s to asx\n",element); - } - } else - MSG_DBG2("Ignoring element %s\n",element); - if(body) free(body); - asx_free_attribs(attribs); - } - - free(asx_body); - asx_free_attribs(asx_attribs); - asx_parser_free(parser); - - - if(!list) { - play_tree_free(asx,1); - - return NULL; - } - - play_tree_set_child(asx,list); - - return asx; -} Deleted: mplayerxp/asxparser.h =================================================================== --- mplayerxp/asxparser.h 2012-10-25 06:26:33 UTC (rev 197) +++ mplayerxp/asxparser.h 2012-10-25 06:52:41 UTC (rev 198) @@ -1,49 +0,0 @@ -#ifndef ASXPARSER_H -#define ASXPARSER_H 1 - -#include "playtree.h" - -typedef struct _ASX_Parser_t ASX_Parser_t; - -typedef struct { - char* buffer; - int line; -} ASX_LineSave_t; - -struct _ASX_Parser_t { - int line; // Curent line - ASX_LineSave_t *ret_stack; - int ret_stack_size; - char* last_body; - int deep; -}; - -extern play_tree_t* __FASTCALL__ asx_parser_build_tree(char* buffer, int ref); - -extern ASX_Parser_t* asx_parser_new(void); - -extern void __FASTCALL__ asx_parser_free(ASX_Parser_t* parser); - -/* - * Return -1 on error, 0 when nothing is found, 1 on sucess - */ -extern int __FASTCALL__ asx_get_element(ASX_Parser_t* parser,char** _buffer, - char** _element,char** _body,char*** _attribs); - -extern int __FASTCALL__ asx_parse_attribs(ASX_Parser_t* parser,char* buffer,char*** _attribs); - -/////// Attribs utils - -extern char* __FASTCALL__ asx_get_attrib(const char* attrib,char** attribs); - -extern int __FASTCALL__ asx_attrib_to_enum(const char* val,char** valid_vals); - -#define asx_free_attribs(a) asx_list_free(&a,free) - -////// List utils - -typedef void (* __FASTCALL__ ASX_FreeFunc)(any_t* arg); - -extern void __FASTCALL__ asx_list_free(any_t* list_ptr,ASX_FreeFunc free_func); - -#endif Modified: mplayerxp/cfgparser.h =================================================================== --- mplayerxp/cfgparser.h 2012-10-25 06:26:33 UTC (rev 197) +++ mplayerxp/cfgparser.h 2012-10-25 06:52:41 UTC (rev 198) @@ -36,7 +36,7 @@ typedef struct m_config m_config_t; typedef struct config_save config_save_t; -#include "playtree.h" +#include "libplaytree/playtree.h" typedef void (*cfg_default_func_t)(config_t *,const char*); Copied: mplayerxp/libplaytree/asxparser.c (from rev 184, mplayerxp/asxparser.c) =================================================================== --- mplayerxp/libplaytree/asxparser.c (rev 0) +++ mplayerxp/libplaytree/asxparser.c 2012-10-25 06:52:41 UTC (rev 198) @@ -0,0 +1,717 @@ + +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <string.h> +#include <unistd.h> + +#include "libmpdemux/stream.h" +#include "playtreeparser.h" +#include "asxparser.h" +#include "cfgparser.h" +#include "../mplayer.h" +#define MSGT_CLASS MSGT_PLAYTREE +#include "__mp_msg.h" + +////// List utils + +static void __FASTCALL__ asx_list_add(any_t* list_ptr,any_t* entry){ + any_t** list = *(any_t***)list_ptr; + int c = 0; + + if(list != NULL) + for( ; list[c] != NULL; c++) ; + + list = (any_t*)realloc(list,sizeof(any_t*)*(c+2)); + + list[c] = entry; + list[c+1] = NULL; + + *(any_t***)list_ptr = list; +} + + +static void __FASTCALL__ asx_list_remove(any_t* list_ptr,any_t* entry,ASX_FreeFunc free_func) { + any_t** list = *(any_t***)list_ptr; + int c,e = -1; + + if(list == NULL) return; + + for(c = 0 ; list[c] != NULL; c++){ + if(list[c] == entry) e = c; + } + + if(e == -1) return; // Not found + + if(free_func != NULL) free_func(list[e]); + + if(c == 1) { // Only one entry, we drop all + free(list); + *(any_t**)list_ptr = NULL; + return; + } + + if(c > e) // If c==e the memmove is not needed + memmove(list+e,list+e+1,(c-e)*sizeof(any_t*)); + + list = (any_t*)realloc(list,(c-1)*sizeof(any_t*)); + list[c-1] = NULL; + + *(any_t***)list_ptr = list; +} + +void __FASTCALL__ asx_list_free(any_t* list_ptr,ASX_FreeFunc free_func) { + any_t** ptr = *(any_t***)list_ptr; + if(ptr == NULL) return; + if(free_func != NULL) { + for( ; *ptr != NULL ; ptr++) + free_func(*ptr); + } + free(*(any_t**)list_ptr); + *(any_t**)list_ptr = NULL; +} + +/////// Attribs utils + +char* __FASTCALL__ asx_get_attrib(const char* attrib,char** attribs) { + char** ptr; + + if(attrib == NULL || attribs == NULL) return NULL; + for(ptr = attribs; ptr[0] != NULL; ptr += 2){ + if(strcasecmp(ptr[0],attrib) == 0) + return strdup(ptr[1]); + } + return NULL; +} + +int __FASTCALL__ asx_attrib_to_enum(const char* val,char** valid_vals) { + char** ptr; + int r = 0; + + if(valid_vals == NULL || val == NULL) return -2; + for(ptr = valid_vals ; ptr[0] != NULL ; ptr++) { + if(strcasecmp(val,ptr[0]) == 0) return r; + r++; + } + + return -1; +} + +static void __FASTCALL__ asx_warning_attrib_invalid(ASX_Parser_t* parser, char* elem, char* attrib, + char** valid_vals,char* val) { + char *str,*vals,**ptr; + int len; + + if(valid_vals == NULL || valid_vals[0] == NULL) return; + + len = strlen(valid_vals[0]) + 1; + for(ptr = valid_vals+1 ; ptr[0] != NULL; ptr++) { + len += strlen(ptr[0]); + len += ((ptr[1] == NULL) ? 4 : 2); + } + str = vals = (char*)malloc(len); + vals += sprintf(vals,"%s",valid_vals[0]); + for(ptr = valid_vals + 1 ; ptr[0] != NULL ; ptr++) { + if(ptr[1] == NULL) + vals += sprintf(vals," or %s",ptr[0]); + else + vals += sprintf(vals,", %s",ptr[0]); + } + MSG_ERR("at line %d : attribute %s of element %s is invalid (%s). Valid values are %s", + parser->line,attrib,elem,val,str); + free(str); +} + +static int __FASTCALL__ asx_get_yes_no_attrib(ASX_Parser_t* parser, char* element, char* attrib,char** attribs,int def) { + char* val = asx_get_attrib(attrib,attribs); + char* valids[] = { "NO", "YES", NULL }; + int r; + + if(val == NULL) return def; + r = asx_attrib_to_enum(val,valids); + + if(r < 0) { + asx_warning_attrib_invalid(parser,element,attrib,valids,val); + r = def; + } + + free(val); + return r; +} + +#define asx_warning_attrib_required(p,e,a) MSG_WARN("At line %d : element %s don't have the required attribute %s",p->line,e,a) +#define asx_warning_body_parse_error(p,e) MSG_WARN("At line %d : error while parsing %s body",p->line,e) + +ASX_Parser_t* asx_parser_new(void) { + ASX_Parser_t* parser = calloc(1,sizeof(ASX_Parser_t)); + return parser; +} + +void __FASTCALL__ asx_parser_free(ASX_Parser_t* parser) { + if(!parser) return; + if(parser->ret_stack) free(parser->ret_stack); + free(parser); + +} + +#define LETTER "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define SPACE " \n\t\r" + +int __FASTCALL__ asx_parse_attribs(ASX_Parser_t* parser,char* buffer,char*** _attribs) { + char *ptr1, *ptr2, *ptr3; + int n_attrib = 0; + char **attribs = NULL; + char *attrib, *val; + + ptr1 = buffer; + while(1) { + for( ; strchr(SPACE,*ptr1) != NULL; ptr1++) { // Skip space + if(*ptr1 == '\0') break; + } + ptr3 = strchr(ptr1,'='); + if(ptr3 == NULL) break; + for(ptr2 = ptr3-1; strchr(SPACE,*ptr2) != NULL; ptr2--) { + if (ptr2 == ptr1) { + MSG_ERR("At line %d : this should never append, back to attribute begin while skipping end space",parser->line); + break; + } + } + attrib = (char*)malloc(ptr2-ptr1+2); + strncpy(attrib,ptr1,ptr2-ptr1+1); + attrib[ptr2-ptr1+1] = '\0'; + + ptr1 = strchr(ptr3,'"'); + if(ptr1 == NULL || ptr1[1] == '\0') { + MSG_WARN("At line %d : can't find attribute %s value",parser->line,attrib); + free(attrib); + break; + } + ptr1++; + ptr2 = strchr(ptr1,'"'); + if (ptr2 == NULL) { + MSG_WARN("At line %d : value of attribute %s isn't finished",parser->line,attrib); + free(attrib); + break; + } + val = (char*)malloc(ptr2-ptr1+1); + strncpy(val,ptr1,ptr2-ptr1); + val[ptr2-ptr1] = '\0'; + n_attrib++; + + attribs = (char**)realloc(attribs,2*n_attrib*sizeof(char*)+1); + attribs[n_attrib*2-2] = attrib; + attribs[n_attrib*2-1] = val; + + ptr1 = ptr2+2; + } + + if(n_attrib > 0) + attribs[n_attrib*2] = NULL; + + *_attribs = attribs; + + return n_attrib; +} + +/* + * Return -1 on error, 0 when nothing is found, 1 on sucess + */ +int __FASTCALL__ asx_get_element(ASX_Parser_t* parser,char** _buffer, + char** _element,char** _body,char*** _attribs) { + char *ptr1,*ptr2, *ptr3, *ptr4; + char *attribs = NULL; + char *element = NULL, *body = NULL, *ret = NULL, *buffer; + int n_attrib = 0; + int body_line = 0,attrib_line,ret_line,in = 0; + + if(_buffer == NULL || _element == NULL || _body == NULL || _attribs == NULL) { + MSG_ERR("At line %d : asx_get_element called with invalid value",parser->line); + return -1; + } + + *_body = *_element = NULL; + *_attribs = NULL; + buffer = *_buffer; + + if(buffer == NULL) return 0; + + if(parser->ret_stack && /*parser->last_body && */buffer != parser->last_body) { + ASX_LineSave_t* ls = parser->ret_stack; + int i; + for(i = 0 ; i < parser->ret_stack_size ; i++) { + if(buffer == ls[i].buffer) { + parser->line = ls[i].line; + break; + } + + } + if( i < parser->ret_stack_size) { + i++; + if( i < parser->ret_stack_size) + memmove(parser->ret_stack,parser->ret_stack+i, (parser->ret_stack_size - i)*sizeof(ASX_LineSave_t)); + parser->ret_stack_size -= i; + if(parser->ret_stack_size > 0) + parser->ret_stack = (ASX_LineSave_t*)realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); + else { + free(parser->ret_stack); + parser->ret_stack = NULL; + } + } + } + + ptr1 = buffer; + while(1) { + for( ; ptr1[0] != '<' ; ptr1++) { + if(ptr1[0] == '\0') { + ptr1 = NULL; + break; + } + if(ptr1[0] == '\n') parser->line++; + } + //ptr1 = strchr(ptr1,'<'); + if(!ptr1 || ptr1[1] == '\0') return 0; // Nothing found + + if(strncmp(ptr1,"<!--",4) == 0) { // Comments + for( ; strncmp(ptr1,"-->",3) != 0 ; ptr1++) { + if(ptr1[0] == '\0') { + ptr1 = NULL; + break; + } + if(ptr1[0] == '\n') parser->line++; + } + //ptr1 = strstr(ptr1,"-->"); + if(!ptr1) { + MSG_ERR("At line %d : unfinished comment",parser->line); + return -1; + } + } else { + break; + } + } + + // Is this space skip very useful ?? + for(ptr1++; strchr(SPACE,ptr1[0]) != NULL; ptr1++) { // Skip space + if(ptr1[0] == '\0') { + MSG_ERR("At line %d : EOB reached while parsing element start",parser->line); + return -1; + } + if(ptr1[0] == '\n') parser->line++; + } + + for(ptr2 = ptr1; strchr(LETTER,*ptr2) != NULL;ptr2++) { // Go to end of name + if(*ptr2 == '\0'){ + MSG_ERR("At line %d : EOB reached while parsing element start",parser->line); + return -1; + } + if(ptr2[0] == '\n') parser->line++; + } + + element = (char*)malloc(ptr2-ptr1+1); + strncpy(element,ptr1,ptr2-ptr1); + element[ptr2-ptr1] = '\0'; + + for( ; strchr(SPACE,*ptr2) != NULL; ptr2++) { // Skip space + if(ptr2[0] == '\0') { + MSG_ERR("At line %d : EOB reached while parsing element start",parser->line); + free(element); + return -1; + } + if(ptr2[0] == '\n') parser->line++; + } + attrib_line = parser->line; + + + + for(ptr3 = ptr2; ptr3[0] != '\0'; ptr3++) { // Go to element end + if(ptr3[0] == '>' || strncmp(ptr3,"/>",2) == 0) + break; + if(ptr3[0] == '\n') parser->line++; + } + if(ptr3[0] == '\0' || ptr3[1] == '\0') { // End of file + MSG_ERR("At line %d : EOB reached while parsing element start",parser->line); + free(element); + return -1; + } + + // Save attribs string + if(ptr3-ptr2 > 0) { + attribs = (char*)malloc(ptr3-ptr2+1); + strncpy(attribs,ptr2,ptr3-ptr2); + attribs[ptr3-ptr2] = '\0'; + } + //bs_line = parser->line; + if(ptr3[0] != '/') { // Not Self closed element + ptr3++; + for( ; strchr(SPACE,*ptr3) != NULL; ptr3++) { // Skip space on body begin + if(*ptr3 == '\0') { + MSG_ERR("At line %d : EOB reached while parsing %s element body",parser->line,element); + free(element); + if(attribs) free(attribs); + return -1; + } + if(ptr3[0] == '\n') parser->line++; + } + ptr4 = ptr3; + body_line = parser->line; + while(1) { // Find closing element + for( ; ptr4[0] != '<' ; ptr4++) { + if(ptr4[0] == '\0') { + ptr4 = NULL; + break; + } + if(ptr4[0] == '\n') parser->line++; + } + if(strncmp(ptr4,"<!--",4) == 0) { // Comments + for( ; strncmp(ptr4,"-->",3) != 0 ; ptr4++) { + if(ptr4[0] == '\0') { + ptr4 = NULL; + break; + } + if(ptr1[0] == '\n') parser->line++; + } + continue; + } + if(ptr4 == NULL || ptr4[1] == '\0') { + MSG_ERR("At line %d : EOB reached while parsing %s element body",parser->line,element); + free(element); + if(attribs) free(attribs); + return -1; + } + if(ptr4[1] != '/' && strncasecmp(element,ptr4+1,strlen(element)) == 0) { + in++; + ptr4+=2; + continue; + } else if(strncasecmp(element,ptr4+2,strlen(element)) == 0) { // Extract body + if(in > 0) { + in--; + ptr4 += 2+strlen(element); + continue; + } + ret = ptr4+strlen(element)+3; + if(ptr4 != ptr3) { + ptr4--; + for( ; ptr4 != ptr3 && strchr(SPACE,*ptr4) != NULL; ptr4--) ;// Skip space on body end + // if(ptr4[0] == '\0') parser->line--; + //} + ptr4++; + body = (char*)malloc(ptr4-ptr3+1); + strncpy(body,ptr3,ptr4-ptr3); + body[ptr4-ptr3] = '\0'; + } + break; + } else { + ptr4 += 2; + } + } + } else { + ret = ptr3 + 2; // 2 is for /> + } + + for( ; ret[0] != '\0' && strchr(SPACE,ret[0]) != NULL; ret++) { // Skip space + if(ret[0] == '\n') parser->line++; + } + + ret_line = parser->line; + + if(attribs) { + parser->line = attrib_line; + n_attrib = asx_parse_attribs(parser,attribs,_attribs); + free(attribs); + if(n_attrib < 0) { + MSG_WARN("At line %d : error while parsing element %s attributes",parser->line,element); + free(element); + free(body); + return -1; + } + } else + *_attribs = NULL; + + *_element = element; + *_body = body; + + parser->last_body = body; + parser->ret_stack_size++; + parser->ret_stack = (ASX_LineSave_t*)realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); + if(parser->ret_stack_size > 1) + memmove(parser->ret_stack+1,parser->ret_stack,(parser->ret_stack_size-1)*sizeof(ASX_LineSave_t)); + parser->ret_stack[0].buffer = ret; + parser->ret_stack[0].line = ret_line; + parser->line = body ? body_line : ret_line; + + *_buffer = ret; + return 1; + +} + +static void __FASTCALL__ asx_parse_param(ASX_Parser_t* parser, char** attribs, play_tree_t* pt) { + char *name,*val; + + name = asx_get_attrib("NAME",attribs); + if(!name) { + asx_warning_attrib_required(parser,"PARAM" ,"NAME" ); + return; + } + val = asx_get_attrib("VALUE",attribs); + if(m_config_get_option(mconfig,name) == NULL) { + MSG_WARN("Found unknow param in asx: %s",name); + if(val) + MSG_WARN("=%s\n",val); + else + MSG_WARN("\n"); + return; + } + play_tree_set_param(pt,name,val); +} + +static void __FASTCALL__ asx_parse_ref(ASX_Parser_t* parser, char** attribs, play_tree_t* pt) { + char *href; + + href = asx_get_attrib("HREF",attribs); + if(href == NULL) { + asx_warning_attrib_required(parser,"REF" ,"HREF" ); + return; + } + // replace http my mmshttp to avoid infinite loops + if (strncmp(href, "http://", 7) == 0) { + char *newref = malloc(3 + strlen(href) + 1); + strcpy(newref, "mms"); + strcpy(newref + 3, href); + free(href); + href = newref; + } + + play_tree_add_file(pt,href); + + MSG_V("Adding file %s to element entry\n",href); + + free(href); + +} + +static play_tree_t* __FASTCALL__ asx_parse_entryref(ASX_Parser_t* parser,char* buffer,char** _attribs) { + play_tree_t* pt; + char *href; + stream_t* stream; + play_tree_parser_t* ptp; + int f; + + if(parser->deep > 0) + return NULL; + + href = asx_get_attrib("HREF",_attribs); + if(href == NULL) { + asx_warning_attrib_required(parser,"ENTRYREF" ,"HREF" ); + return NULL; + } + stream=open_stream(href,&f,NULL); + if(!stream) { + MSG_WARN("Can't open playlist %s\n",href); + return NULL; + } + if(!(stream->type & STREAMTYPE_TEXT)) { + MSG_WARN("URL %s dont point to a playlist\n",href); + free_stream(stream); + return NULL; + } + + MSG_V("Adding playlist %s to element entryref\n",href); + + ptp = play_tree_parser_new(stream,parser->deep+1); + + pt = play_tree_parser_get_play_tree(ptp); + + play_tree_parser_free(ptp); + free_stream(stream); + + //MSG_INFO("Need to implement entryref\n"); + + return pt; +} + +static play_tree_t* __FASTCALL__ asx_parse_entry(ASX_Parser_t* parser,char* buffer,char** _attribs) { + char *element,*body,**attribs; + int r,nref=0; + play_tree_t *ref; + + ref = play_tree_new(); + + while(buffer && buffer[0] != '\0') { + r = asx_get_element(parser,&buffer,&element,&body,&attribs); + if(r < 0) { + asx_warning_body_parse_error(parser,"ENTRY"); + return NULL; + } else if (r == 0) { // No more element + break; + } + if(strcasecmp(element,"REF") == 0) { + asx_parse_ref(parser,attribs,ref); + MSG_DBG2("Adding element %s to entry\n",element); + nref++; + } else + MSG_DBG2("Ignoring element %s\n",element); + if(body) free(body); + asx_free_attribs(attribs); + } + + if(nref <= 0) { + play_tree_free(ref,1); + return NULL; + } + return ref; + +} + +static play_tree_t* __FASTCALL__ asx_parse_repeat(ASX_Parser_t* parser,char* buffer,char** _attribs) { + char *element,*body,**attribs; + play_tree_t *repeat, *list=NULL, *entry; + char* count; + int r; + + repeat = play_tree_new(); + + count = asx_get_attrib("COUNT",_attribs); + if(count == NULL) { + MSG_DBG2("Setting element repeat loop to infinit\n"); + repeat->loop = -1; // Infinit + } else { + repeat->loop = atoi(count); + free(count); + if(repeat->loop == 0) repeat->loop = 1; + MSG_DBG2("Setting element repeat loop to %d\n",repeat->loop); + } + + while(buffer && buffer[0] != '\0') { + r = asx_get_element(parser,&buffer,&element,&body,&attribs); + if(r < 0) { + asx_warning_body_parse_error(parser,"REPEAT"); + return NULL; + } else if (r == 0) { // No more element + break; + } + if(strcasecmp(element,"ENTRY") == 0) { + entry = asx_parse_entry(parser,body,attribs); + if(entry) { + if(!list) list = entry; + else play_tree_append_entry(list,entry); + MSG_DBG2("Adding element %s to repeat\n",element); + } + } else if(strcasecmp(element,"ENTRYREF") == 0) { + entry = asx_parse_entryref(parser,body,attribs); + if(entry) { + if(!list) list = entry; + else play_tree_append_entry(list,entry); + MSG_DBG2("Adding element %s to repeat\n",element); + } + } else if(strcasecmp(element,"REPEAT") == 0) { + entry = asx_parse_repeat(parser,body,attribs); + if(entry) { + if(!list) list = entry; + else play_tree_append_entry(list,entry); + MSG_DBG2("Adding element %s to repeat\n",element); + } + } else if(strcasecmp(element,"PARAM") == 0) { + asx_parse_param(parser,attribs,repeat); + } else + MSG_DBG2("Ignoring element %s\n",element); + if(body) free(body); + asx_free_attribs(attribs); + } + + if(!list) { + play_tree_free(repeat,1); + return NULL; + } + play_tree_set_child(repeat,list); + + return repeat; + +} + +play_tree_t* __FASTCALL__ asx_parser_build_tree(char* buffer,int deep) { + char *element,*asx_body,**asx_attribs,*body, **attribs; + int r; + play_tree_t *asx,*entry,*list = NULL; + ASX_Parser_t* parser = asx_parser_new(); + + parser->line = 1; + parser->deep = deep; + + r = asx_get_element(parser,&buffer,&element,&asx_body,&asx_attribs); + if(r < 0) { + MSG_ERR("At line %d : Syntax error ???",parser->line); + asx_parser_free(parser); + return NULL; + } else if(r == 0) { // No contents + MSG_ERR("empty asx element"); + asx_parser_free(parser); + return NULL; + } + + if(strcasecmp(element,"ASX") != 0) { + MSG_ERR("first element isn't ASX, it's %s\n",element); + asx_free_attribs(asx_attribs); + if(body) free(body); + asx_parser_free(parser); + return NULL; + } + + if(!asx_body) { + MSG_ERR("ASX element is empty"); + asx_free_attribs(asx_attribs); + asx_parser_free(parser); + return NULL; + } + + asx = play_tree_new(); + buffer = asx_body; + while(buffer && buffer[0] != '\0') { + r = asx_get_element(parser,&buffer,&element,&body,&attribs); + if(r < 0) { + asx_warning_body_parse_error(parser,"ASX"); + asx_parser_free(parser); + return NULL; + } else if (r == 0) { // No more element + break; + } + if(strcasecmp(element,"ENTRY") == 0) { + entry = asx_parse_entry(parser,body,attribs); + if(entry) { + if(!list) list = entry; + else play_tree_append_entry(list,entry); + MSG_DBG2("Adding element %s to asx\n",element); + } + } else if(strcasecmp(element,"ENTRYREF") == 0) { + entry = asx_parse_entryref(parser,body,attribs); + if(entry) { + if(!list) list = entry; + else play_tree_append_entry(list,entry); + MSG_DBG2("Adding element %s to asx\n",element); + } + } else if(strcasecmp(element,"REPEAT") == 0) { + entry = asx_parse_repeat(parser,body,attribs); + if(entry) { + if(!list) list = entry; + else play_tree_append_entry(list,entry); + MSG_DBG2("Adding element %s to asx\n",element); + } + } else + MSG_DBG2("Ignoring element %s\n",element); + if(body) free(body); + asx_free_attribs(attribs); + } + + free(asx_body); + asx_free_attribs(asx_attribs); + asx_parser_free(parser); + + + if(!list) { + play_tree_free(asx,1); + + return NULL; + } + + play_tree_set_child(asx,list); + + return asx; +} Copied: mplayerxp/libplaytree/asxparser.h (from rev 184, mplayerxp/asxparser.h) =================================================================== --- mplayerxp/libplaytree/asxparser.h (rev 0) +++ mplayerxp/libplaytree/asxparser.h 2012-10-25 06:52:41 UTC (rev 198) @@ -0,0 +1,49 @@ +#ifndef ASXPARSER_H +#define ASXPARSER_H 1 + +#include "playtree.h" + +typedef struct _ASX_Parser_t ASX_Parser_t; + +typedef struct { + char* buffer; + int line; +} ASX_LineSave_t; + +struct _ASX_Parser_t { + int line; // Curent line + ASX_LineSave_t *ret_stack; + int ret_stack_size; + char* last_body; + int deep; +}; + +extern play_tree_t* __FASTCALL__ asx_parser_build_tree(char* buffer, int ref); + +extern ASX_Parser_t* asx_parser_new(void); + +extern void __FASTCALL__ asx_parser_free(ASX_Parser_t* parser); + +/* + * Return -1 on error, 0 when nothing is found, 1 on sucess + */ +extern int __FASTCALL__ asx_get_element(ASX_Parser_t* parser,char** _buffer, + char** _element,char** _body,char*** _attribs); + +extern int __FASTCALL__ asx_parse_attribs(ASX_Parser_t* parser,char* buffer,char*** _attribs); + +/////// Attribs utils + +extern char* __FASTCALL__ asx_get_attrib(const char* attrib,char** attribs); + +extern int __FASTCALL__ asx_attrib_to_enum(const char* val,char** valid_vals); + +#define asx_free_attribs(a) asx_list_free(&a,free) + +////// List utils + +typedef void (* __FASTCALL__ ASX_FreeFunc)(any_t* arg); + +extern void __FASTCALL__ asx_list_free(any_t* list_ptr,ASX_FreeFunc free_func); + +#endif Copied: mplayerxp/libplaytree/playtree.c (from rev 184, mplayerxp/playtree.c) =================================================================== --- mplayerxp/libplaytree/playtree.c (rev 0) +++ mplayerxp/libplaytree/playtree.c 2012-10-25 06:52:41 UTC (rev 198) @@ -0,0 +1,1006 @@ + +#include "mp_config.h" +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <unistd.h> +#include <errno.h> +#include <time.h> +#ifdef MP_DEBUG +#include <assert.h> +#endif +#include "libmpdemux/stream.h" +#include "playtree.h" +#define MSGT_CLASS MSGT_PLAYTREE +#include "__mp_msg.h" + +static int +play_tree_is_valid(play_tree_t* pt); + +play_tree_t* +play_tree_new(void) { + play_tree_t* r = (play_tree_t*)calloc(1,sizeof(play_tree_t)); + if(r == NULL) + MSG_ERR("Can't allocate %d bytes of memory\n",sizeof(play_tree_t)); + r->entry_type = PLAY_TREE_ENTRY_NODE; + return r; +} + +void +play_tree_free(play_tree_t* pt, int childs) { + play_tree_t* iter; + +#ifdef MP_DEBUG + assert(pt != NULL); +#endif + + if(childs) { + for(iter = pt->child; iter != NULL; ) { + play_tree_t* nxt=iter->next; + play_tree_free(iter,1); + iter = nxt; + } + pt->child = NULL; + } + + play_tree_remove(pt,0,0); + + for(iter = pt->child ; iter != NULL ; iter = iter->next) + iter->parent = NULL; + + //if(pt->params) free(pt->params); + if(pt->files) { + int i; + for(i = 0 ; pt->files[i] != NULL ; i++) + free(pt->files[i]); + free(pt->files); + } + + free(pt); +} + +void +play_tree_free_list(play_tree_t* pt, int childs) { + play_tree_t* iter; + +#ifdef MP_DEBUG + assert(pt != NULL); +#endif + + for(iter = pt ; iter->prev != NULL ; iter = iter->prev) + /* NOTHING */; + + while(iter) { + play_tree_t* nxt = iter->next; + play_tree_free(iter, childs); + iter = nxt; + } + +} + +void +play_tree_append_entry(play_tree_t* pt, play_tree_t* entry) { + play_tree_t* iter; + +#ifdef MP_DEBUG + assert(pt != NULL); + assert(entry != NULL); +#endif + + if(pt == entry) + return; + + for(iter = pt ; iter->next != NULL ; iter = iter->next) + /* NOTHING */; + + entry->parent = iter->parent; + entry->prev = iter; + entry->next = NULL; + iter->next = entry; +} + +void +play_tree_prepend_entry(play_tree_t* pt, play_tree_t* entry) { + play_tree_t* iter; + +#ifdef MP_DEBUG + assert(pt != NULL); + assert(entry != NULL); +#endif + + for(iter = pt ; iter->prev != NULL; iter = iter->prev) + /* NOTHING */; + + entry->prev = NULL; + entry->next = iter; + entry->parent = iter->parent; + + iter->prev = entry; + if(entry->parent) { +#ifdef MP_DEBUG + assert(entry->parent->child == iter); +#endif + entry->parent->child = entry; + } +} + +void +play_tree_insert_entry(play_tree_t* pt, play_tree_t* entry) { + +#ifdef MP_DEBUG + assert(pt != NULL); + assert(entry != NULL); +#endif + + entry->parent = pt->parent; + entry->prev = pt; + if(pt->next) { +#ifdef MP_DEBUG + assert(pt->next->prev == pt); +#endif + entry->next = pt->next; + entry->next->prev = entry; + } else + entry->next = NULL; + pt->next = entry; + +} + +void +play_tree_remove(play_tree_t* pt, int free_it,int with_childs) { + +#ifdef MP_DEBUG + assert(pt != NULL); +#endif + + // Middle of list + if(pt->prev && pt->next) { +#ifdef MP_DEBUG + assert(pt->prev->next == pt); + assert(pt->next->prev == pt); +#endif + pt->prev->next = pt->next; + pt->next->prev = pt->prev; + } // End of list + else if(pt->prev) { +#ifdef MP_DEBUG + assert(pt->prev->next == pt); +#endif + pt->prev->next = NULL; + } // Begining of list + else if(pt->next) { +#ifdef MP_DEBUG + assert(pt->next->prev == pt); +#endif + pt->next->prev = NULL; + if(pt->parent) { +#ifdef MP_DEBUG + assert(pt->parent->child == pt); +#endif + pt->parent->child = pt->next; + } + } // The only one + else if(pt->parent) { +#ifdef MP_DEBUG + assert(pt->parent->child == pt); +#endif + pt->parent->child = NULL; + } + + pt->prev = pt->next = pt->parent = NULL; + if(free_it) + play_tree_free(pt,with_childs); + +} + +void +play_tree_set_child(play_tree_t* pt, play_tree_t* child) { + play_tree_t* iter; + +#ifdef MP_DEBUG + assert(pt != NULL); + assert(pt->entry_type == PLAY_TREE_ENTRY_NODE); +#endif + + for(iter = pt->child ; iter != NULL ; iter = iter->next) + iter->parent = NULL; + + // Go back to first one + for(iter = child ; iter->prev != NULL ; iter = iter->prev) + /* NOTHING */; + + pt->child = iter; + + for( ; iter != NULL ; iter= iter->next) + iter->parent = pt; + +} + +void +play_tree_set_parent(play_tree_t* pt, play_tree_t* parent) { + play_tree_t* iter; + +#ifdef MP_DEBUG + assert(pt != NULL); +#endif + + if(pt->parent) + pt->parent->child = NULL; + + for(iter = pt ; iter != NULL ; iter = iter->next) + iter->parent = parent; + + if(pt->prev) { + for(iter = pt->prev ; iter->prev != NULL ; iter = iter->prev) + iter->parent = parent; + iter->parent = parent; + parent->child = iter; + } else + parent->child = pt; + +} + + +void +play_tree_add_file(play_tree_t* pt,const char* file) { + int n = 0; + char* e; + +#ifdef MP_DEBUG + assert(pt != NULL); + assert(pt->child == NULL); + assert(file != NULL); +#endif + + if(pt->entry_type != PLAY_TREE_ENTRY_NODE && + pt->entry_type != PLAY_TREE_ENTRY_FILE) + return; + + if(pt->files) { + for(n = 0 ; pt->files[n] != NULL ; n++) + /* NOTHING */; + } + pt->files = (char**)realloc(pt->files,(n+2)*sizeof(char*)); + if(pt->files ==NULL) { + MSG_ERR("Can't allocate %d bytes of memory\n",(n+2)*sizeof(char*)); + return; + } + + e = pt->files[n] = strdup(file); + pt->files[n+1] = NULL; + + if(strncasecmp(e,"vcd://",6) == 0) { + pt->entry_type = PLAY_TREE_ENTRY_VCD; + memmove(e,e + 6,strlen(&e[6])+1); + } else if(strncasecmp(e,"dvd://",6) == 0) { + pt->entry_type = PLAY_TREE_ENTRY_DVD; + memmove(e,&e[6],strlen(&e[6])+1); + } else if(strncasecmp(e,"tv://",5) == 0) { + pt->entry_type = PLAY_TREE_ENTRY_TV; + memmove(e,&e[5],strlen(&e[5])+1); + } else + pt->entry_type = PLAY_TREE_ENTRY_FILE; + +} + +int +play_tree_remove_file(play_tree_t* pt,const char* file) { + int n,f = -1; + +#ifdef MP_DEBUG + assert(pt != NULL); + assert(file != NULL); + assert(pt->entry_type != PLAY_TREE_ENTRY_NODE); +#endif + + for(n=0 ; pt->files[n] != NULL ; n++) { + if(strcmp(file,pt->files[n]) == 0) + f = n; + } + + if(f < 0) // Not found + return 0; + +#ifdef MP_DEBUG + assert(n > f); +#endif + + free(pt->files[f]); + + if(n > 1) { + memmove(&pt->files[f],&pt->files[f+1],(n-f)*sizeof(char*)); + pt->files = (char**)realloc(pt->files,n*sizeof(char*)); + if(pt->files == NULL) { + MSG_ERR("Can't allocate %d bytes of memory\n",(n+2)*sizeof(char*)); + return -1; + } + } else { + free(pt->files); + pt->files = NULL; + } + + return 1; +} + +void play_tree_set_param(play_tree_t* pt,const char* name,const char* val) { + int n = 0,ni = -1; + +#ifdef MP_DEBUG + assert(pt != NULL); + assert(name != NULL); +#endif + + if(pt->params) { + for( ; pt->params[n].name != NULL ; n++) { + if(strcasecmp(pt->params[n].name,name) == 0) + ni = n; + } + } + + if(ni > 0) { + if(pt->params[n].value != NULL) free(pt->params[n].value); + pt->params[n].value = val != NULL ? strdup(val) : NULL; + return; + } + + pt->params = (play_tree_param_t*)realloc(pt->params,(n+2)*sizeof(play_tree_param_t)); + if(pt->params == NULL) + { + MSG_FATAL("Can't realloc params\n"); + return; + } + pt->params[n].name = strdup(name); + pt->params[n].value = val != NULL ? strdup(val) : NULL; + memset(&pt->params[n+1],0,sizeof(play_tree_param_t)); + + return; +} + +int play_tree_unset_param(play_tree_t* pt,const char* name) { + int n,ni = -1; + +#ifdef MP_DEBUG + assert(pt != NULL); + assert(name != NULL); + assert(pt->params != NULL); +#endif + + for(n = 0 ; pt->params[n].name != NULL ; n++) { + if(strcasecmp(pt->params[n].name,name) == 0) + ni = n; + } + + if(ni < 0) + return 0; + + if(pt->params[ni].name) free(pt->params[ni].name); + if(pt->params[ni].value) free(pt->params[ni].value); + + if(n > 1) { + memmove(&pt->params[ni],&pt->params[ni+1],(n-ni)*sizeof(play_tree_param_t)); + pt->params = (play_tree_param_t*)realloc(pt->params,n*sizeof(play_tree_param_t)); + if(pt->params == NULL) { + MSG_ERR("Can't allocate %d bytes of memory\n",n*sizeof(play_tree_param_t)); + return -1; + } + } else { + free(pt->params); + pt->params = NULL; + } + + return 1; +} + +void play_tree_set_params_from(play_tree_t* dest,const play_tree_t* src) { + int i; + +#ifdef MP_DEBUG + assert(dest != NULL); + assert(src != NULL); +#endif + + if(!src->params) + return; + + for(i = 0; src->params[i].name != NULL ; i++) + play_tree_set_param(dest,src->params[i].name,src->params[i].value); + if(src->flags & PLAY_TREE_RND) // pass the random flag too + dest->flags |= PLAY_TREE_RND; + +} + +// all children if deep < 0 +void play_tree_set_flag(play_tree_t* pt, int flags , int deep) { + play_tree_t* i; + + pt->flags |= flags; + + if(deep && pt->child) { + if(deep > 0) deep--; + for(i = pt->child ; i ; i = i->next) + play_tree_set_flag(i,flags,deep); + } +} + +void play_tree_unset_flag(play_tree_t* pt, int flags , int deep) { + play_tree_t* i; + + pt->flags &= ~flags; + + if(deep && pt->child) { + if(deep > 0) deep--; + for(i = pt->child ; i ; i = i->next) + play_tree_unset_flag(i,flags,deep); + } +} + +static void +play_tree_iter_push_params(play_tree_iter_t* iter) { + int n; + play_tree_t* pt; +#ifdef MP_DEBUG + assert(iter != NULL); + assert(iter->config != NULL); + assert(iter->tree != NULL); +#endif + + pt = iter->tree; + + // We always push a config because we can set some option + // while playing + m_config_push(iter->config); + + if(pt->params == NULL) + return; + + + for(n = 0; pt->params[n].name != NULL ; n++) { + int e; + if((e = m_config_set_option(iter->config,pt->params[n].name,pt->params[n].value)) < 0) { + MSG_ERR("Error %d while setting option '%s' with value '%s'\n",e, + pt->params[n].name,pt->params[n].value); + } + } + + if(!pt->child) + iter->entry_pushed = 1; + return; +} + +play_tree_iter_t* +play_tree_iter_new(play_tree_t* pt,m_config_t* config) { + play_tree_iter_t* iter; + +#ifdef MP_DEBUG + assert(pt != NULL); + assert(config != NULL); +#endif + + if( ! play_tree_is_valid(pt)) + return NULL; + + iter = (play_tree_iter_t*)calloc(1,sizeof(play_tree_iter_t)); + if(! iter) return NULL; + iter->root = pt; + iter->tree = NULL; + iter->config = config; + + if(pt->parent) + iter->loop = pt->parent->loop; + + return iter; +} + +void +play_tree_iter_free(play_tree_iter_t* iter) { + +#ifdef MP_DEBUG + assert(iter != NULL); +#endif + + if(iter->status_stack) { +#ifdef MP_DEBUG + assert(iter->stack_size > 0); +#endif + free(iter->status_stack); + } + + free(iter); +} + +static play_tree_t* +play_tree_rnd_step(play_tree_t* pt) { + int count = 0; + int r,rnd; + time_t tim; + play_tree_t *i,*head; + + // Count how many free choice we have + for(i = pt ; i->prev ; i = i->prev) + if(!(i->flags & PLAY_TREE_RND_PLAYED)) count++; + head = i; + if(!(i->flags & PLAY_TREE_RND_PLAYED)) count++; + if(pt->next) + for(i = pt->next ; i ; i = i->next) + if(!(i->flags & PLAY_TREE_RND_PLAYED)) count++; + + if(!count) return NULL; + /* make it time depended */ + time(&tim); + /* integer between 0 and RAND_MAX inclusive. */ + rnd=rand(); + r = (int)(((float)(count) * rnd) / (RAND_MAX + 1.0)); + if(r) rnd = r = count - (tim%r); + + for(i = head ; i ; i=i->next) { + if(!(i->flags & PLAY_TREE_RND_PLAYED)) r--; + if(r < 0) return i; + } + for(i = head ; i ; i=i->next) { + if(!(i->flags & PLAY_TREE_RND_PLAYED)) return i; + } + + MSG_ERR("Random stepping error r=%i\n",rnd); + return NULL; +} + +int +play_tree_iter_step(play_tree_iter_t* iter, int d,int with_nodes) { + play_tree_t* pt; + int rnd; +#ifdef MP_DEBUG + assert(iter != NULL); + assert(iter->root != NULL); +#endif + + if(iter->tree == NULL) { + iter->tree = iter->root; + return play_tree_iter_step(iter,0,with_nodes); + } + + if(iter->config && iter->entry_pushed > 0) { + iter->entry_pushed = 0; + m_config_pop(iter->config); + } + + if(iter->tree->parent && (iter->tree->parent->flags & PLAY_TREE_RND)) + rnd=iter->mode = PLAY_TREE_ITER_RND; + else + rnd=iter->mode = PLAY_TREE_ITER_NORMAL; + + iter->file = -1; + if(iter->mode == PLAY_TREE_ITER_RND) + pt = play_tree_rnd_step(iter->tree); + else if( d > 0 ) { + int i; + pt = iter->tree; + for(i = d ; i > 0 && pt ; i--) + pt = pt->next; + d = i ? i : 1; + } else if(d < 0) { + int i; + pt = iter->tree; + for(i = d ; i < 0 && pt ; i++) + pt = pt->prev; + d = i ? i : -1; + } else + pt = iter->tree; + + if(pt == NULL) { // No next + // Must we loop? + if (iter->mode == PLAY_TREE_ITER_RND) { + if (iter->root->loop == 0) + return PLAY_TREE_ITER_END; + play_tree_unset_flag(iter->root, PLAY_TREE_RND_PLAYED, -1); + if (iter->root->loop > 0) iter->root->loop--; + // try again + return play_tree_iter_step(iter, 0, with_nodes); + } else + if(iter->tree->parent && iter->tree->parent->loop != 0 && ((d > 0 && iter->loop != 0) || ( d < 0 && (iter->loop < 0 || iter->loop < iter->tree->parent->loop) ) ) ) { + if(d > 0) { // Go back to the first one + for(pt = iter->tree ; pt->prev != NULL; pt = pt->prev) + /* NOTHNG */; + if(iter->loop > 0) iter->loop--; + } else if( d < 0 ) { // Or the last one + for(pt = iter->tree ; pt->next != NULL; pt = pt->next) + /* NOTHNG */; + if(iter->loop >= 0 && iter->loop < iter->tree->parent->loop) iter->loop++; + } + iter->tree = pt; + return play_tree_iter_step(iter,0,with_nodes); + } + // Go up one level + return play_tree_iter_up_step(iter,d,with_nodes); + + } + + // Is there any valid child? + if(pt->child && play_tree_is_valid(pt->child)) { + iter->tree = pt; + if(with_nodes) { // Stop on the node + return PLAY_TREE_ITER_NODE; + } else // Or follow it + return play_tree_iter_down_step(iter,d,with_nodes); + } + + // Is it a valid entry? + if(! play_tree_is_valid(pt)) { + if(d == 0 && rnd==PLAY_TREE_ITER_NORMAL) { // Can this happen ? FF: Yes! + MSG_ERR("What to do now ???? Infinite loop if we continue\n"); + return PLAY_TREE_ITER_ERROR; + } // Not a valid entry : go to next one + return play_tree_iter_step(iter,d,with_nodes); + } + +#ifdef MP_DEBUG + assert(pt->files != NULL); +#endif + + iter->tree = pt; + + for(d = 0 ; iter->tree->files[d] != NULL ; d++) + /* NOTHING */; + iter->num_files = d; + + if(iter->config) { + play_tree_iter_push_params(iter); + iter->entry_pushed = 1; + if(iter->mode == PLAY_TREE_ITER_RND) + pt->flags |= PLAY_TREE_RND_PLAYED; + } + + return PLAY_TREE_ITER_ENTRY; + +} + +static int +play_tree_is_valid(play_tree_t* pt) { + play_tree_t* iter; + +#ifdef MP_DEBUG + assert(pt != NULL); +#endif + + if(pt->entry_type != PLAY_TREE_ENTRY_NODE) { +#ifdef MP_DEBUG + assert(pt->child == NULL); +#endif + return 1; + } + el... [truncated message content] |
From: <nic...@us...> - 2012-10-25 07:50:25
|
Revision: 199 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=199&view=rev Author: nickols_k Date: 2012-10-25 07:50:09 +0000 (Thu, 25 Oct 2012) Log Message: ----------- reorder source tree Modified Paths: -------------- mplayerxp/Makefile mplayerxp/dump.c mplayerxp/input/Makefile mplayerxp/input/input.c mplayerxp/libmpcodecs/Makefile mplayerxp/libmpcodecs/ad.c mplayerxp/libmpcodecs/ad.h mplayerxp/libmpcodecs/ad_internal.h mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd.c mplayerxp/libmpcodecs/vd.h mplayerxp/libmpcodecs/vd_internal.h mplayerxp/libmpcodecs/vd_xanim.c mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/cdd.h mplayerxp/libmpdemux/cdda.c mplayerxp/libmpdemux/cddb.c mplayerxp/libmpdemux/demux_aiff.c mplayerxp/libmpdemux/demux_audio.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_lavf.c mplayerxp/libmpdemux/demux_mkv.c mplayerxp/libmpdemux/demux_mpxp64.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demux_rawaudio.c mplayerxp/libmpdemux/demux_rawvideo.c mplayerxp/libmpdemux/demux_viv.c mplayerxp/libmpdemux/demux_vqf.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_r.c mplayerxp/libmpdemux/network.c mplayerxp/libmpdemux/s_dvdnav.c mplayerxp/libmpdemux/stream.h mplayerxp/libmpdemux/sub_cc.c mplayerxp/libplaytree/asxparser.c mplayerxp/libplaytree/playtree.h mplayerxp/libvo/vo_opengl.c mplayerxp/mp-opt-reg.c mplayerxp/mplayer.c mplayerxp/postproc/libmenu/Makefile mplayerxp/postproc/libmenu/menu.c mplayerxp/postproc/libmenu/menu_cmdlist.c mplayerxp/postproc/libmenu/menu_console.c mplayerxp/postproc/libmenu/menu_filesel.c mplayerxp/postproc/libmenu/menu_list.c mplayerxp/postproc/libmenu/menu_param.c mplayerxp/postproc/libmenu/menu_pt.c mplayerxp/postproc/libmenu/menu_txt.c mplayerxp/postproc/vf.c mplayerxp/postproc/vf.h mplayerxp/postproc/vf_menu.c Added Paths: ----------- mplayerxp/libmpconf/ mplayerxp/libmpconf/cfgparser.c mplayerxp/libmpconf/cfgparser.h mplayerxp/libmpconf/codec-cfg.c mplayerxp/libmpconf/codec-cfg.h mplayerxp/libmpconf/m_option.c mplayerxp/libmpconf/m_option.h mplayerxp/libmpconf/m_property.c mplayerxp/libmpconf/m_property.h mplayerxp/libmpconf/m_struct.c mplayerxp/libmpconf/m_struct.h mplayerxp/libmpconf/subopt-helper.c mplayerxp/libmpconf/subopt-helper.h Removed Paths: ------------- mplayerxp/cfgparser.c mplayerxp/cfgparser.h mplayerxp/codec-cfg.c mplayerxp/codec-cfg.h mplayerxp/m_option.c mplayerxp/m_option.h mplayerxp/m_property.c mplayerxp/m_property.h mplayerxp/m_struct.c mplayerxp/m_struct.h mplayerxp/subopt-helper.c mplayerxp/subopt-helper.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-10-25 06:52:41 UTC (rev 198) +++ mplayerxp/Makefile 2012-10-25 07:50:09 UTC (rev 199) @@ -13,7 +13,7 @@ PRG_FIBMAP = fibmap_mplayerxp PRG_CFG = codec-cfg-xp # these subdirectories required installation due binaries within them -SUBDIRS = libmpdemux libmpsub libplaytree libmpcodecs libao2 osdep postproc input nls libvo +SUBDIRS = libmpdemux libmpsub libplaytree libmpcodecs libmpconf libao2 osdep postproc input nls libvo ifeq ($(TARGET_ARCH_X86),yes) SUBDIRS+=loader endif @@ -23,8 +23,8 @@ MANDIR = ${prefix}/man LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs -SRCS_COMMON = cpudetect.c mp_msg.c codec-cfg.c cfgparser.c my_profile.c my_malloc.c mp_image.c subopt-helper.c -SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c sig_hand.c dump.c dec_ahead.c m_option.c m_property.c m_struct.c +SRCS_COMMON = cpudetect.c mp_msg.c my_profile.c my_malloc.c mp_image.c +SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c sig_hand.c dump.c dec_ahead.c OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) @@ -43,13 +43,14 @@ input/libinput.a \ libvo/libvo.a \ osdep/libosdep.a \ - nls/libnls.a + nls/libnls.a \ + libmpconf/libmpconf.a ifeq ($(TARGET_ARCH_X86),yes) MP_LIBS += loader/libloader.a endif COMMON_LIBS = $(MP_LIBS) $(FF_LIBS) $(EXTRALIBS) -lm -CFLAGS = $(OPTFLAGS) -Ilibmpsub -Ilibmpdemux -Ilibvo $(EXTRA_INC) +CFLAGS = $(OPTFLAGS) $(EXTRA_INC) ALL_PRG = $(PRG) ifeq ($(HAVE_CSS),yes) Deleted: mplayerxp/cfgparser.c =================================================================== --- mplayerxp/cfgparser.c 2012-10-25 06:52:41 UTC (rev 198) +++ mplayerxp/cfgparser.c 2012-10-25 07:50:09 UTC (rev 199) @@ -1,1395 +0,0 @@ -/* - * command line and config file parser - * by Szabolcs Berecz <sz...@in...> - * (C) 2001 - * - * subconfig support by alex - */ - -//#define DEBUG - -#include <stdlib.h> -#include <stdio.h> -#include <ctype.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <errno.h> -#include "mp_config.h" - -#define COMMAND_LINE 0 -#define CONFIG_FILE 1 - -#define CONFIG_GLOBAL (1<<0) -#define CONFIG_RUNNING (1<<1) - -#define SET_GLOBAL(c) (c->flags |= CONFIG_GLOBAL) -#define UNSET_GLOBAL(c) (c->flags &= (!CONFIG_GLOBAL)) -#define IS_GLOBAL(c) (c->flags & CONFIG_GLOBAL) -#define SET_RUNNING(c) (c->flags |= CONFIG_RUNNING) -#define IS_RUNNING(c) (c->flags & CONFIG_RUNNING) - -#define MAX_RECURSION_DEPTH 8 - -#ifdef MP_DEBUG -#include <assert.h> -#endif - -#include "libmpdemux/stream.h" -#include "cfgparser.h" -#define MSGT_CLASS MSGT_CFGPARSER -#include "__mp_msg.h" - -typedef int (*cfg_func_arg_param_t)(config_t *,const char *,const char *); -typedef int (*cfg_func_param_t)(config_t *,const char *); -typedef int (*cfg_func_t)(config_t *); - -static void -m_config_save_option(m_config_t* config, config_t* conf,const char* opt,const char *param) { - config_save_t* save; - int sl=0; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(config->cs_level >= 0); - assert(conf != NULL); - assert(opt != NULL); - assert( ! (conf->flags & CONF_NOSAVE)); -#endif - - switch(conf->type) { - case CONF_TYPE_PRINT : - case CONF_TYPE_SUBCONFIG : - return; - default : - ; - } - - MSG_DBG2("Saving option %s\n",opt); - - save = config->config_stack[config->cs_level]; - - if(save) { - for(sl = 0; save[sl].opt != NULL; sl++){ - // Check to not save the same arg two times - if(save[sl].opt == conf && (save[sl].opt_name == NULL || strcasecmp(save[sl].opt_name,opt) == 0)) - break; - } - if(save[sl].opt) - return; - } - - save = (config_save_t*)realloc(save,(sl+2)*sizeof(config_save_t)); - if(save == NULL) { - MSG_ERR( "Can't allocate %d bytes of memory : %s\n",(sl+2)*sizeof(config_save_t),strerror(errno)); - return; - } - memset(&save[sl],0,2*sizeof(config_save_t)); - save[sl].opt = conf; - - switch(conf->type) { - case CONF_TYPE_FLAG : - case CONF_TYPE_INT : - save[sl].param.as_int = *((int*)conf->p); - break; - case CONF_TYPE_FLOAT : - save[sl].param.as_float = *((float*)conf->p); - break; - case CONF_TYPE_STRING : - save[sl].param.as_pointer = *((char**)conf->p); - break; - case CONF_TYPE_FUNC_FULL : - if(strcasecmp(conf->name,opt) != 0) save->opt_name = strdup(opt); - case CONF_TYPE_FUNC_PARAM : - if(param) - save->param.as_pointer = strdup(param); - case CONF_TYPE_FUNC : - break; - default : - MSG_ERR("Should never append in m_config_save_option : conf->type=%d\n",conf->type); - } - - config->config_stack[config->cs_level] = save; -} - -static int m_config_revert_option(m_config_t* config, config_save_t* save) { - const char* arg = NULL; - config_save_t* iter=NULL; - int i=-1; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(config->cs_level >= 0); - assert(save != NULL); -#endif - - - arg = save->opt_name ? save->opt_name : save->opt->name; - MSG_DBG2("Reverting option %s\n",arg); - - if(save->opt->default_func) - save->opt->default_func(save->opt,arg); - - switch(save->opt->type) { - case CONF_TYPE_FLAG : - case CONF_TYPE_INT : - *((int*)save->opt->p) = save->param.as_int; - break; - case CONF_TYPE_FLOAT : - *((float*)save->opt->p) = save->param.as_float; - break; - case CONF_TYPE_STRING : - *((char**)save->opt->p) = save->param.as_pointer; - break; - case CONF_TYPE_FUNC_PARAM : - case CONF_TYPE_FUNC_FULL : - case CONF_TYPE_FUNC : - if(config->cs_level > 0) { - for(i = config->cs_level - 1 ; i >= 0 ; i--){ - if(config->config_stack[i] == NULL) continue; - for(iter = config->config_stack[i]; iter != NULL && iter->opt != NULL ; iter++) { - if(iter->opt == save->opt && - ((save->param.as_pointer == NULL || iter->param.as_pointer == NULL) || strcasecmp(save->param.as_pointer,iter->param.as_pointer) == 0) && - (save->opt_name == NULL || - (iter->opt_name && strcasecmp(save->opt_name,iter->opt_name)))) break; - } - } - } - free(save->param.as_pointer); - if(save->opt_name) free(save->opt_name); - save->opt_name = save->param.as_pointer = NULL; - if(i < 0) break; - arg = iter->opt_name ? iter->opt_name : iter->opt->name; - switch(iter->opt->type) { - case CONF_TYPE_FUNC : - if ((((cfg_func_t) iter->opt->p)(iter->opt)) < 0) - return -1; - break; - case CONF_TYPE_FUNC_PARAM : - if (iter->param.as_pointer == NULL) { - MSG_ERR("We lost param for option %s?\n",iter->opt->name); - return -1; - } - if ((((cfg_func_param_t) iter->opt->p)(iter->opt, (char*)iter->param.as_pointer)) < 0) - return -1; - break; - case CONF_TYPE_FUNC_FULL : - if (iter->param.as_pointer != NULL && ((char*)iter->param.as_pointer)[0]=='-'){ - if( ((cfg_func_arg_param_t) iter->opt->p)(iter->opt, arg, NULL) < 0) - return -1; - }else { - if (((cfg_func_arg_param_t) save->opt->p)(iter->opt, arg, (char*)iter->param.as_pointer) < 0) - return -1; - - } - break; - } - break; - default : - MSG_ERR("Why do we reverse this : name=%s type=%d ?\n",save->opt->name,save->opt->type); - } - - return 1; -} - -void m_config_push(m_config_t* config) { - -#ifdef MP_DEBUG - assert(config != NULL); - assert(config->cs_level >= 0); -#endif - - config->cs_level++; - config->config_stack = (config_save_t**)realloc(config->config_stack ,sizeof(config_save_t*)*(config->cs_level+1)); - if(config->config_stack == NULL) { - MSG_ERR( "Can't allocate %d bytes of memory : %s\n",sizeof(config_save_t*)*(config->cs_level+1),strerror(errno)); - config->cs_level = -1; - return; - } - config->config_stack[config->cs_level] = NULL; - MSG_DBG2("Config pushed level=%d\n",config->cs_level); -} - -int m_config_pop(m_config_t* config) { - int i,ret= 1; - config_save_t* cs; - -#ifdef MP_DEBUG - assert(config != NULL); - //assert(config->cs_level > 0); -#endif - - if(config->config_stack[config->cs_level] != NULL) { - cs = config->config_stack[config->cs_level]; - for(i=0; cs[i].opt != NULL ; i++ ) { - if (m_config_revert_option(config,&cs[i]) < 0) - ret = -1; - } - free(config->config_stack[config->cs_level]); - } - config->config_stack = (config_save_t**)realloc(config->config_stack ,sizeof(config_save_t*)*config->cs_level); - config->cs_level--; - if(config->cs_level > 0 && config->config_stack == NULL) { - MSG_ERR( "Can't allocate %d bytes of memory : %s\n",sizeof(config_save_t*)*config->cs_level,strerror(errno)); - config->cs_level = -1; - return -1; - } - MSG_DBG2("Config poped level=%d\n",config->cs_level); - return ret; -} - -m_config_t* m_config_new(play_tree_t* pt) { - m_config_t* config; - -#ifdef MP_DEBUG - assert(pt != NULL); -#endif - - config = (m_config_t*)calloc(1,sizeof(m_config_t)); - if(config == NULL) { - MSG_ERR( "Can't allocate %d bytes of memory : %s\n",sizeof(m_config_t),strerror(errno)); - return NULL; - } - config->config_stack = (config_save_t**)calloc(1,sizeof(config_save_t*)); - if(config->config_stack == NULL) { - MSG_ERR( "Can't allocate %d bytes of memory : %s\n",sizeof(config_save_t*),strerror(errno)); - free(config); - return NULL; - } - SET_GLOBAL(config); // We always start with global options - config->pt = pt; - return config; -} - -static void m_config_add_dynamic(m_config_t *conf,any_t*ptr) { - if(!conf->dynasize) conf->dynamics = malloc(sizeof(any_t*)); - else conf->dynamics = realloc(conf->dynamics,(conf->dynasize+1)*sizeof(any_t*)); - conf->dynamics[conf->dynasize] = ptr; - conf->dynasize++; -} - -void m_config_free(m_config_t* config) { - unsigned i; -#ifdef MP_DEBUG - assert(config != NULL); -#endif - for(i=0;i<config->dynasize;i++) free(config->dynamics[i]); - free(config->dynamics); - config->dynasize=0; - free(config->opt_list); - free(config->config_stack); - free(config); -} - - -static int init_conf(m_config_t *config, int mode) -{ -#ifdef MP_DEBUG - assert(config != NULL); - assert(config->pt != NULL); - assert(config->last_entry == NULL || config->last_entry->parent == config->pt); - - if (mode != COMMAND_LINE && mode != CONFIG_FILE) { - MSG_ERR( "init_conf: wrong mode!\n"); - return -1; - } -#endif - config->parser_mode = mode; - config->dynamics=NULL; - config->dynasize=0; - - return 1; -} - -static int config_is_entry_option(m_config_t *config,const char *opt,const char *param) { - play_tree_t* entry = NULL; - -#ifdef MP_DEBUG - assert(config->pt != NULL); -#endif - - if(strcasecmp(opt,"playlist") == 0) { // We handle playlist here - if(!param) - return ERR_MISSING_PARAM; - entry = parse_playlist_file(param); - if(!entry) { - MSG_ERR( "Playlist parsing failed: %s\n",param); - return 1; - } - } - - if(entry) { - if(config->last_entry) - play_tree_append_entry(config->last_entry,entry); - else - play_tree_set_child(config->pt,entry); - config->last_entry = entry; - if(config->parser_mode == COMMAND_LINE) - UNSET_GLOBAL(config); - return 1; - } else - return 0; -} - -static int config_read_option(m_config_t *config,config_t** conf_list,const char *opt,const char *param) -{ - int i=0,nconf = 0; - long tmp_int; - double tmp_float; - int ret = -1; - char *endptr; - config_t* conf=NULL; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(conf_list != NULL); - assert(opt != NULL); -#endif - - MSG_DBG3( "read_option: conf=%p opt='%s' param='%s'\n", - conf, opt, param); - for(nconf = 0 ; conf_list[nconf] != NULL; nconf++) { - conf = conf_list[nconf]; - for (i = 0; conf[i].name != NULL; i++) { - int namelength; - /* allow 'aa*' in config.name */ -// MSG_DBG3( "cmp_option: conf=%s opt='%s'\n",conf[i].name,opt); - namelength=strlen(conf[i].name); - if ( (conf[i].name[namelength-1]=='*') && - !memcmp(opt, conf[i].name, namelength-1)) - goto option_found; - if (!strcasecmp(opt, conf[i].name)) - goto option_found; - } - } - MSG_ERR( "invalid option: %s\n",opt); - ret = ERR_NOT_AN_OPTION; - goto out; - option_found : - MSG_DBG3( "read_option: name='%s' p=%p type=%d\n", - conf[i].name, conf[i].p, conf[i].type); - - if (conf[i].flags & CONF_NOCFG && config->parser_mode == CONFIG_FILE) { - MSG_ERR( "this option can only be used on command line:\n", opt); - ret = ERR_NOT_AN_OPTION; - goto out; - } - if (conf[i].flags & CONF_NOCMD && config->parser_mode == COMMAND_LINE) { - MSG_ERR( "this option can only be used in config file:\n", opt); - ret = ERR_NOT_AN_OPTION; - goto out; - } - ret = config_is_entry_option(config,opt,param); - if(ret != 0) - return ret; - else - ret = -1; - if(! IS_RUNNING(config) && ! IS_GLOBAL(config) && - ! (conf[i].flags & CONF_GLOBAL) && conf[i].type != CONF_TYPE_SUBCONFIG ) - m_config_push(config); - if( !(conf[i].flags & CONF_NOSAVE) && ! (conf[i].flags & CONF_GLOBAL) ) - m_config_save_option(config,&conf[i],opt,param); - switch (conf[i].type) { - case CONF_TYPE_FLAG: - /* flags need a parameter in config file */ - if (config->parser_mode == CONFIG_FILE) { - if (!strcasecmp(param, "yes") || /* any other language? */ - !strcasecmp(param, "ja") || - !strcasecmp(param, "si") || - !strcasecmp(param, "igen") || - !strcasecmp(param, "y") || - !strcasecmp(param, "j") || - !strcasecmp(param, "i") || - !strcmp(param, "1")) - *((int *) conf[i].p) = conf[i].max; - else if (!strcasecmp(param, "no") || - !strcasecmp(param, "nein") || - !strcasecmp(param, "nicht") || - !strcasecmp(param, "nem") || - !strcasecmp(param, "n") || - !strcmp(param, "0")) - *((int *) conf[i].p) = conf[i].min; - else { - MSG_ERR( "invalid parameter for flag: %s\n", param); - ret = ERR_OUT_OF_RANGE; - goto out; - } - ret = 1; - } else { /* parser_mode == COMMAND_LINE */ - *((int *) conf[i].p) = conf[i].max; - MSG_DBG3("assigning %s=%i as flag value\n",conf[i].name,conf[i].max); - ret = 0; - } - break; - case CONF_TYPE_INT: - if (param == NULL) - goto err_missing_param; - - tmp_int = strtol(param, &endptr, 0); - if (*endptr) { - MSG_ERR( "parameter must be an integer: %s\n", param); - ret = ERR_OUT_OF_RANGE; - goto out; - } - - if (conf[i].flags & CONF_MIN) - if (tmp_int < conf[i].min) { - MSG_ERR( "parameter must be >= %d: %s\n", (int) conf[i].min, param); - ret = ERR_OUT_OF_RANGE; - goto out; - } - - if (conf[i].flags & CONF_MAX) - if (tmp_int > conf[i].max) { - MSG_ERR( "parameter must be <= %d: %s\n", (int) conf[i].max, param); - ret = ERR_OUT_OF_RANGE; - goto out; - } - - *((int *) conf[i].p) = tmp_int; - MSG_DBG3("assigning %s=%i as int value\n",conf[i].name,tmp_int); - ret = 1; - break; - case CONF_TYPE_FLOAT: - if (param == NULL) - goto err_missing_param; - - tmp_float = strtod(param, &endptr); - - if ((*endptr == ':') || (*endptr == '/')) - tmp_float /= strtod(endptr+1, &endptr); - - if (*endptr) { - MSG_ERR( "parameter must be a floating point number" - " or a ratio (numerator[:/]denominator): %s\n", param); - ret = ERR_MISSING_PARAM; - goto out; - } - - if (conf[i].flags & CONF_MIN) - if (tmp_float < conf[i].min) { - MSG_ERR( "parameter must be >= %f: %s\n", conf[i].min, param); - ret = ERR_OUT_OF_RANGE; - goto out; - } - - if (conf[i].flags & CONF_MAX) - if (tmp_float > conf[i].max) { - MSG_ERR( "parameter must be <= %f: %s\n", conf[i].max, param); - ret = ERR_OUT_OF_RANGE; - goto out; - } - - *((float *) conf[i].p) = tmp_float; - MSG_DBG3("assigning %s=%f as float value\n",conf[i].name,tmp_float); - ret = 1; - break; - case CONF_TYPE_STRING: - if (param == NULL) - goto err_missing_param; - - if (conf[i].flags & CONF_MIN) - if (strlen(param) < conf[i].min) { - MSG_ERR( "parameter must be >= %d chars: %s\n", - (int) conf[i].min, param); - ret = ERR_OUT_OF_RANGE; - goto out; - } - - if (conf[i].flags & CONF_MAX) - if (strlen(param) > conf[i].max) { - MSG_ERR( "parameter must be <= %d chars: %s\n", - (int) conf[i].max, param); - ret = ERR_OUT_OF_RANGE; - goto out; - } - *((char **) conf[i].p) = strdup(param); - m_config_add_dynamic(config,*((char **) conf[i].p)); - MSG_DBG3("assigning %s=%s as string value\n",conf[i].name,param); - ret = 1; - break; - case CONF_TYPE_FUNC_PARAM: - if (param == NULL) - goto err_missing_param; - if ((((cfg_func_param_t) conf[i].p)(conf + i, param)) < 0) { - ret = ERR_FUNC_ERR; - goto out; - } - ret = 1; - break; - case CONF_TYPE_FUNC_FULL: - if (param!=NULL && param[0]=='-'){ - ret=((cfg_func_arg_param_t) conf[i].p)(conf + i, opt, NULL); - if (ret>=0) ret=0; - /* if we return >=0: param is processed again (if there is any) */ - }else{ - ret=((cfg_func_arg_param_t) conf[i].p)(conf + i, opt, param); - /* if we return 0: need no param, precess it again */ - /* if we return 1: accepted param */ - } - break; - case CONF_TYPE_FUNC: - if ((((cfg_func_t) conf[i].p)(conf + i)) < 0) { - ret = ERR_FUNC_ERR; - goto out; - } - ret = 0; - break; -#if 0 -// we have handled it in other function - case CONF_TYPE_SUBCONFIG: - { - char *subparam; - char *subopt; - int subconf_optnr; - config_t *subconf; - config_t *sublist[] = { NULL , NULL }; - char *token; - char *p; - - if (param == NULL) - goto err_missing_param; - - subparam = malloc(strlen(param)+1); - subopt = malloc(strlen(param)+1); - p = strdup(param); // In case that param is a static string (cf man strtok) - - subconf = conf[i].p; - sublist[0] = subconf; - for (subconf_optnr = 0; subconf[subconf_optnr].name != NULL; subconf_optnr++) - /* NOTHING */; - config->sub_conf = opt; - token = strtok(p, (char *)&(":")); - while(token) - { - int sscanf_ret; - /* clear out */ - subopt[0] = subparam[0] = 0; - - sscanf_ret = sscanf(token, "%[^=]=%s", subopt, subparam); - - MSG_DBG3( "token: '%s', i=%d, subopt='%s', subparam='%s' (ret: %d)\n", token, i, subopt, subparam, sscanf_ret); - switch(sscanf_ret) - { - case 1: - subparam[0] = 0; - case 2: - if ((ret = config_read_option(config,sublist, subopt, subparam)) < 0) - { - MSG_ERR( "Subconfig parsing returned error: %d in token: %s\n", - ret, token); - goto out; - } - break; - default: - MSG_ERR( "Invalid subconfig argument! ('%s')\n", token); - ret = ERR_NOT_AN_OPTION; - goto out; - } - token = strtok(NULL, (char *)&(":")); - } - config->sub_conf = NULL; - free(subparam); - free(subopt); - free(p); - ret = 1; - break; - } -#endif - case CONF_TYPE_PRINT: - MSG_INFO("%s", (char *) conf[i].p); - exit(1); - default: - MSG_ERR( "Unknown config type specified in conf-mplayer.h!\n"); - break; - } -out: - if(ret >= 0 && ! IS_RUNNING(config) && ! IS_GLOBAL(config) && ! (conf[i].flags & CONF_GLOBAL) && conf[i].type != CONF_TYPE_SUBCONFIG ) { - play_tree_t* dest = config->last_entry ? config->last_entry : config->last_parent; - char* o; -#ifdef MP_DEBUG - assert(dest != NULL); -#endif - if(config->sub_conf) { - o = (char*)malloc((strlen(config->sub_conf) + 1 + strlen(opt) + 1)*sizeof(char)); - sprintf(o,"%s:%s",config->sub_conf,opt); - } else - o =strdup(opt); - - if(ret == 0) - play_tree_set_param(dest,o,NULL); - else if(ret > 0) - play_tree_set_param(dest,o,param); - free(o); - m_config_pop(config); - } - return ret; -err_missing_param: - MSG_ERR( "missing parameter for option: %s\n", opt); - ret = ERR_MISSING_PARAM; - goto out; -} - -static const config_t* m_config_find_option(const config_t **list,const char *name); - -int m_config_set_option(m_config_t *config,const char *opt,const char *param) { - char *e; - const config_t **clist=config->opt_list; -#ifdef MP_DEBUG - assert(config != NULL); - assert(config->opt_list != NULL); - assert(opt != NULL); -#endif - MSG_DBG2( "Setting option %s=%s\n",opt,param); - clist = config->opt_list; -#if 1 - if(strchr(opt,'.')) { - int flg,ret; - const config_t *subconf=NULL; - config_t* olist[] = { NULL, NULL }; - MSG_DBG2("Parsing %s as subconfig\n",opt); - do { - if(!(e = strchr(opt,'.'))) break; - if((e-opt)>0) { - char* s = (char*)malloc((e-opt+1)*sizeof(char)); - strncpy(s,opt,e-opt); - s[e-opt] = '\0'; - MSG_DBG2("Treat %s as subconfig name\n",s); - subconf = m_config_find_option(clist?clist:olist,s); - clist=NULL; - free(s); - MSG_DBG2("returned %p as subconfig name\n",subconf); - if(!subconf) return ERR_NO_SUBCONF; - if(subconf->type!=CONF_TYPE_SUBCONFIG) return ERR_NO_SUBCONF; - olist[0] = subconf->p; - opt = e+1; - MSG_DBG2("switching next subconf=%s\n",subconf->name); - } - }while(1); - flg=config->flags; - config->flags|=CONFIG_GLOBAL; - ret=config_read_option(config,olist,opt,param); - config->flags=flg; - return ret; - } -#endif - e = strchr(opt,':'); - if(e && e[1] != '\0') { - int ret; - config_t* opt_list[] = { NULL, NULL }; - char* s = (char*)malloc((e-opt+1)*sizeof(char)); - strncpy(s,opt,e-opt); - s[e-opt] = '\0'; - opt_list[0] = m_config_get_option_ptr(config,s); - if(!opt_list[0]) { - MSG_ERR("m_config_set_option %s=%s : no %s subconfig\n",opt,param,s); - free(s); - return ERR_NOT_AN_OPTION; - } - e++; - s = (char*)realloc(s,strlen(e) + 1); - strcpy(s,e); - ret = config_read_option(config,opt_list,s,param); - free(s); - return ret; - } - - return config_read_option(config,config->opt_list,opt,param); -} - -int m_config_parse_config_file(m_config_t *config, char *conffile) -{ -#define PRINT_LINENUM MSG_ERR("%s(%d): ", conffile, line_num) -#define MAX_LINE_LEN 1000 -#define MAX_OPT_LEN 100 -#define MAX_PARAM_LEN 100 - FILE *fp; - char *line; - char opt[MAX_OPT_LEN + 1]; - char param[MAX_PARAM_LEN + 1]; - char c; /* for the "" and '' check */ - int tmp; - int line_num = 0; - int line_pos; /* line pos */ - int opt_pos; /* opt pos */ - int param_pos; /* param pos */ - int ret = 1; - int errors = 0; - -#ifdef MP_DEBUG - assert(config != NULL); - // assert(conf_list != NULL); -#endif - if (++config->recursion_depth > 1) - MSG_INFO("Reading config file: %s", conffile); - - if (config->recursion_depth > MAX_RECURSION_DEPTH) { - MSG_FATAL(": too deep 'include'. check your configfiles\n"); - ret = -1; - goto out; - } - - if (init_conf(config, CONFIG_FILE) == -1) { - ret = -1; - goto out; - } - - if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) { - MSG_FATAL("\ncan't get memory for 'line': %s", strerror(errno)); - ret = -1; - goto out; - } - - if ((fp = fopen(conffile, "r")) == NULL) { - if (config->recursion_depth > 1) - MSG_ERR(": %s\n", strerror(errno)); - free(line); - ret = 0; - goto out; - } - if (config->recursion_depth > 1) - MSG_FATAL("\n"); - - while (fgets(line, MAX_LINE_LEN, fp)) { - if (errors >= 16) { - MSG_FATAL("too many errors\n"); - goto out; - } - - line_num++; - line_pos = 0; - - /* skip whitespaces */ - while (isspace(line[line_pos])) - ++line_pos; - - /* EOL / comment */ - if (line[line_pos] == '\0' || line[line_pos] == '#') - continue; - - /* read option. */ - for (opt_pos = 0; isprint(line[line_pos]) && - line[line_pos] != ' ' && - line[line_pos] != '#' && - line[line_pos] != '='; /* NOTHING */) { - opt[opt_pos++] = line[line_pos++]; - if (opt_pos >= MAX_OPT_LEN) { - PRINT_LINENUM; - MSG_ERR("too long option\n"); - errors++; - ret = -1; - goto nextline; - } - } - if (opt_pos == 0) { - PRINT_LINENUM; - MSG_ERR("parse error\n"); - ret = -1; - errors++; - continue; - } - opt[opt_pos] = '\0'; - -#ifdef MP_DEBUG - PRINT_LINENUM; - MSG_DBG2("option: %s\n", opt); -#endif - - /* skip whitespaces */ - while (isspace(line[line_pos])) - ++line_pos; - - /* check '=' */ - if (line[line_pos++] != '=') { - PRINT_LINENUM; - MSG_ERR("option without parameter\n"); - ret = -1; - errors++; - continue; - } - - /* whitespaces... */ - while (isspace(line[line_pos])) - ++line_pos; - - /* read the parameter */ - if (line[line_pos] == '"' || line[line_pos] == '\'') { - c = line[line_pos]; - ++line_pos; - for (param_pos = 0; line[line_pos] != c; /* NOTHING */) { - param[param_pos++] = line[line_pos++]; - if (param_pos >= MAX_PARAM_LEN) { - PRINT_LINENUM; - MSG_ERR("too long parameter\n"); - ret = -1; - errors++; - goto nextline; - } - } - line_pos++; /* skip the closing " or ' */ - } else { - for (param_pos = 0; isprint(line[line_pos]) && !isspace(line[line_pos]) - && line[line_pos] != '#'; /* NOTHING */) { - param[param_pos++] = line[line_pos++]; - if (param_pos >= MAX_PARAM_LEN) { - PRINT_LINENUM; - MSG_ERR("too long parameter\n"); - ret = -1; - errors++; - goto nextline; - } - } - } - param[param_pos] = '\0'; - - /* did we read a parameter? */ - if (param_pos == 0) { - PRINT_LINENUM; - MSG_ERR("option without parameter\n"); - ret = -1; - errors++; - continue; - } - -#ifdef MP_DEBUG - PRINT_LINENUM; - MSG_DBG2("parameter: %s\n", param); -#endif - - /* now, check if we have some more chars on the line */ - /* whitespace... */ - while (isspace(line[line_pos])) - ++line_pos; - - /* EOL / comment */ - if (line[line_pos] != '\0' && line[line_pos] != '#') { - PRINT_LINENUM; - MSG_ERR("extra characters on line: %s\n", line+line_pos); - ret = -1; - } - - tmp = m_config_set_option(config, opt, param); - switch (tmp) { - case ERR_NOT_AN_OPTION: - case ERR_MISSING_PARAM: - case ERR_OUT_OF_RANGE: - case ERR_NO_SUBCONF: - case ERR_FUNC_ERR: - PRINT_LINENUM; - MSG_ERR("%s\n", opt); - ret = -1; - errors++; - continue; - /* break */ - } -nextline: - ; - } - - free(line); - fclose(fp); -out: - --config->recursion_depth; - return ret; -} - -extern void show_help(void); -extern void show_long_help(void); -int m_config_parse_command_line(m_config_t *config, int argc, char **argv, char **envp) -{ - int i; - int tmp; - char *opt; - int no_more_opts = 0; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(config->pt != NULL); - assert(argv != NULL); - assert(envp != NULL); - assert(argc >= 1); -#endif - - if (init_conf(config, COMMAND_LINE) == -1) - return -1; - if(config->last_parent == NULL) - config->last_parent = config->pt; - /* in order to work recursion detection properly in parse_config_file */ - ++config->recursion_depth; - - for (i = 1; i < argc; i++) { - //next: - opt = argv[i]; - if(strcmp(opt,"--help")==0) { - show_help(); - exit(0); - } - if(strcmp(opt,"--long-help")==0) { - show_long_help(); - exit(0); - } - /* check for -- (no more options id.) except --help! */ - if ((*opt == '-') && (*(opt+1) == '-')) - { - no_more_opts = 1; - if (i+1 >= argc) - { - MSG_ERR( "You added '--' but no filenames presented!\n"); - goto err_out; - } - continue; - } - if((opt[0] == '{') && (opt[1] == '\0')) - { - play_tree_t* entry = play_tree_new(); - UNSET_GLOBAL(config); - if(config->last_entry == NULL) { - play_tree_set_child(config->last_parent,entry); - } else { - play_tree_append_entry(config->last_entry,entry); - config->last_entry = NULL; - } - config->last_parent = entry; - continue; - } - - if((opt[0] == '}') && (opt[1] == '\0')) - { - if( ! config->last_parent || ! config->last_parent->parent) { - MSG_ERR( "too much }-\n"); - goto err_out; - } - config->last_entry = config->last_parent; - config->last_parent = config->last_entry->parent; - continue; - } - - if ((no_more_opts == 0) && (*opt == '-') && (*(opt+1) != 0)) /* option */ - { - /* remove leading '-' */ - char *assign,*item,*parm; - opt++; - - MSG_DBG2( "this_option: %s\n", opt); - parm = argv[i+1]; - item=opt; - assign = strchr(opt,'='); - if(assign) { - item = malloc(assign-opt); - memcpy(item,opt,assign-opt); - item[assign-opt]='\0'; - parm = strdup(assign+1); - } - tmp = m_config_set_option(config, item, parm); - if(!tmp && assign) - MSG_ERR("Option '%s' doesn't require arguments\n",item); - if(assign) { - free(item); - free(parm); - } - if(!tmp && assign) goto err_out; - - switch (tmp) { - case ERR_NOT_AN_OPTION: - case ERR_MISSING_PARAM: - case ERR_OUT_OF_RANGE: - case ERR_NO_SUBCONF: - case ERR_FUNC_ERR: - MSG_ERR( "Error '%s' while parsing option: '%s'!\n" - ,tmp==ERR_NOT_AN_OPTION?"no-option": - tmp==ERR_MISSING_PARAM?"missing-param": - tmp==ERR_OUT_OF_RANGE?"out-of-range": - tmp==ERR_NO_SUBCONF?"no-subconfig": - "func-error" - ,opt); - goto err_out; - default: - i += tmp; - if(assign) i--; - break; - } - } - else /* filename */ - { - play_tree_t* entry = play_tree_new(); - MSG_DBG2("Adding file %s\n",argv[i]); - play_tree_add_file(entry,argv[i]); - if(strcasecmp(argv[i],"-") == 0) - m_config_set_option(config,"use-stdin",NULL); - /* opt is not an option -> treat it as a filename */ - UNSET_GLOBAL(config); // We start entry specific options - if(config->last_entry == NULL) - play_tree_set_child(config->last_parent,entry); - else - play_tree_append_entry(config->last_entry,entry); - config->last_entry = entry; - } - } - - --config->recursion_depth; - if(config->last_parent != config->pt) - MSG_ERR("Missing }- ?\n"); - UNSET_GLOBAL(config); - SET_RUNNING(config); - return 1; -#if 0 -err_out_mem: - MSG_ERR( "can't allocate memory for filenames (%s)\n", strerror(errno)); -#endif -err_out: - --config->recursion_depth; - MSG_ERR( "command line: %s\n", argv[i]); - return -1; -} - - - -int m_config_register_options(m_config_t *config,const config_t *args) { - int list_len = 0; - const config_t** conf_list = config->opt_list; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(args != NULL); -#endif - - if(conf_list) { - for ( ; conf_list[list_len] != NULL; list_len++) - /* NOTHING */; - } - - conf_list = (config_t**)realloc(conf_list,sizeof(struct conf*)*(list_len+2)); - if(conf_list == NULL) { - MSG_ERR( "Can't allocate %d bytes of memory : %s\n",sizeof(struct conf*)*(list_len+2),strerror(errno)); - return 0; - } - conf_list[list_len] = args; - conf_list[list_len+1] = NULL; - - config->opt_list = conf_list; - - return 1; -} - -static const config_t* m_config_find_option(const config_t **list,const char *name) { - unsigned i,j; - const config_t *conf; - if(list) { - for(j = 0; list[j] != NULL ; j++) { - conf = list[j]; - for(i=0; conf[i].name != NULL; i++) { - if(strcasecmp(conf[i].name,name) == 0) - return &conf[i]; - } - } - } - return NULL; -} - -config_t* m_config_get_option(m_config_t const*config,const char* arg) { - char *e; - const config_t **conf_list; - const config_t* cl[] = { NULL, NULL }; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(arg != NULL); -#endif - - e = strchr(arg,':'); - - if(e) { - char *s; - s = (char*)malloc((e-arg+1)*sizeof(char)); - strncpy(s,arg,e-arg); - s[e-arg] = '\0'; - cl[0] = m_config_get_option(config,s); - conf_list = cl; - free(s); - } else - conf_list = config->opt_list; - return m_config_find_option(conf_list,arg); -} - -any_t* m_config_get_option_ptr(m_config_t const*config,const char* arg) { - config_t* conf; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(arg != NULL); -#endif - - conf = m_config_get_option(config,arg); - if(!conf) return NULL; - return conf->p; -} - -int m_config_get_int (m_config_t const *config,const char* arg,int* err_ret) { - int *ret; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(arg != NULL); -#endif - - ret = m_config_get_option_ptr(config,arg); - if(err_ret) - *err_ret = 0; - if(!ret) { - if(err_ret) - *err_ret = 1; - return -1; - } else - return (*ret); -} - -float m_config_get_float (m_config_t const *config,const char* arg,int* err_ret) { - float *ret; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(arg != NULL); -#endif - - ret = m_config_get_option_ptr(config,arg); - if(err_ret) - *err_ret = 0; - if(!ret) { - if(err_ret) - *err_ret = 1; - return -1; - } else - return (*ret); -} - -#define AS_INT(c) (*((int*)c->p)) - -int m_config_set_int(m_config_t *config,const char* arg,int val) { - config_t* opt; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(arg != NULL); -#endif - - opt = m_config_get_option(config,arg); - - if(!opt || opt->type != CONF_TYPE_INT) - return ERR_NOT_AN_OPTION; - - if(opt->flags & CONF_MIN && val < opt->min) - return ERR_OUT_OF_RANGE; - if(opt->flags & CONF_MAX && val > opt->max) - return ERR_OUT_OF_RANGE; - - m_config_save_option(config,opt,arg,NULL); - AS_INT(opt) = val; - - return 1; -} - -int m_config_set_float(m_config_t *config,const char* arg,float val) { - config_t* opt; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(arg != NULL); -#endif - - opt = m_config_get_option(config,arg); - - if(!opt || opt->type != CONF_TYPE_FLOAT) - return ERR_NOT_AN_OPTION; - - if(opt->flags & CONF_MIN && val < opt->min) - return ERR_OUT_OF_RANGE; - if(opt->flags & CONF_MAX && val > opt->max) - return ERR_OUT_OF_RANGE; - - m_config_save_option(config,opt,arg,NULL); - *((float*)opt->p) = val; - - return 1; -} - - -int -m_config_switch_flag(m_config_t *config,const char* opt) { - config_t *conf; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(opt != NULL); -#endif - - conf = m_config_get_option(config,opt); - if(!conf || conf->type != CONF_TYPE_FLAG) return 0; - if( AS_INT(conf) == conf->min) AS_INT(conf) = conf->max; - else if(AS_INT(conf) == conf->max) AS_INT(conf) = conf->min; - else return 0; - - return 1; -} - -int m_config_set_flag(m_config_t* config,const char* opt, int state) { - config_t *conf; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(opt != NULL); -#endif - - conf = m_config_get_option(config,opt); - if(!conf || conf->type != CONF_TYPE_FLAG) return 0; - if(state) AS_INT(conf) = conf->max; - else AS_INT(conf) = conf->min; - return 1; -} - -int m_config_get_flag(m_config_t const *config,const char* opt) { - config_t *conf; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(opt != NULL); -#endif - - conf = m_config_get_option(config,opt); - if(!conf || conf->type != CONF_TYPE_FLAG) return -1; - if(AS_INT(conf) == conf->max) - return 1; - else if(AS_INT(conf) == conf->min) - return 0; - else - return -1; -} - -int m_config_is_option_set(m_config_t const*config,const char* arg) { - config_t* opt; - config_save_t* save; - int l,i; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(arg != NULL); -#endif - - opt = m_config_get_option(config,arg); - - if(!opt) - return -1; - - for(l = config->cs_level ; l >= 0 ; l--) { - save = config->config_stack[l]; - if(!save) - continue; - for(i = 0 ; save[i].opt != NULL ; i++) { - if(save[i].opt == opt) - return 1; - } - } - - return 0; -} - -static void __m_config_show_options(unsigned ntabs,const char *pfx,const config_t *opts) { - unsigned i,n; - i=0; - while(opts[i].name) { - if(opts[i].type==CONF_TYPE_SUBCONFIG && opts[i].p) { - char *newpfx; - unsigned pfxlen; - for(n=0;n<ntabs;n++) MSG_INFO(" "); - MSG_INFO("%s:\n",opts[i].help); - pfxlen=strlen(opts[i].name)+1; - if(pfx) pfxlen+=strlen(pfx); - newpfx=malloc(pfxlen+1); - if(pfx) strcpy(newpfx,pfx); - else newpfx[0]='\0'; - strcat(newpfx,opts[i].name); - strcat(newpfx,"."); - __m_config_show_options(ntabs+2,newpfx,(const config_t *)opts[i].p); - free(newpfx); - } - else - if(opts[i].type<=CONF_TYPE_PRINT) { - for(n=0;n<ntabs;n++) MSG_INFO(" "); - if(pfx) MSG_INFO("-%-s",pfx); - else MSG_INFO("-"); - MSG_INFO("%-11s %s" - ,opts[i].name - ,(opts[i].type==CONF_TYPE_PRINT && strcmp(opts[i].help,"show help")!=0)?opts[i].p:opts[i].help); - if((opts[i].flags&CONF_NOCFG)==0) { - MSG_INFO(" {%s=", - opts[i].type==CONF_TYPE_FLAG?"flg": - opts[i].type==CONF_TYPE_INT?"int": - opts[i].type==CONF_TYPE_FLOAT?"flt": - opts[i].type==CONF_TYPE_STRING?"str":""); - switch(opts[i].type) { - case CONF_TYPE_FLAG: { - int defv = (*((int*)(opts[i].p)))?1:0; - int max = opts[i].max ? 1:0; - int res = !(defv^max); - MSG_INFO("%s",res?"ON":"OFF"); - } - break; - case CONF_TYPE_STRING: { - const char **defv = (const char**)(opts[i].p); - if(defv) MSG_INFO("\"%s\"",*defv); - } - break; - case CONF_TYPE_INT: { - int defv = *((int*)(opts[i].p)); - MSG_INFO("%i",defv); - if((opts[i].flags&CONF_RANGE)==CONF_RANGE) { - MSG_INFO(" [%i...%i]",(int)opts[i].min,(int)opts[i].max); - } - else - if((opts[i].flags&CONF_MIN)==CONF_MIN) { - MSG_INFO(" <min=%i>",(int)opts[i].min); - } - else - if((opts[i].flags&CONF_MAX)==CONF_MAX) { - MSG_INFO(" <max=%i>",(int)opts[i].max); - } - } - break; - case CONF_TYPE_FLOAT: { - float defv = *((float*)(opts[i].p)); - MSG_INFO("%f",defv); - if((opts[i].flags&CONF_RANGE)==CONF_RANGE) { - MSG_INFO(" [%f...%f]",(float)opts[i].min,(float)opts[i].max); - } - else - if((opts[i].flags&CONF_MIN)==CONF_MIN) { - MSG_INFO(" <min=%f>",(float)opts[i].min); - } - else - if((opts[i].flags&CONF_MAX)==CONF_MAX) { - MSG_INFO(" <max=%f>",(float)opts[i].max); - } - } - break; - default: - break; - } - MSG_INFO("}"); - } - MSG_INFO("\n"); - } - i++; - }; -} - -void m_config_show_options(const m_config_t *args) { - unsigned j; - const config_t *opts; - j=0; - MSG_INFO("List of available command-line options:\n"); - while((opts=args->opt_list[j])!=NULL) { - __m_config_show_options(2,NULL,opts); - j++; - }; -} - -#undef AS_INT Deleted: mplayerxp/cfgparser.h =================================================================== --- mplayerxp/cfgparser.h 2012-10-25 06:52:41 UTC (rev 198) +++ mplayerxp/cfgparser.h 2012-10-25 07:50:09 UTC (rev 199) @@ -1,172 +0,0 @@ -/* - * command line and config file parser - */ - -#ifndef __CONFIG_H -#define __CONFIG_H - -/* config types */ -#define CONF_TYPE_FLAG 0 -#define CONF_TYPE_INT 1 -#define CONF_TYPE_FLOAT 2 -#define CONF_TYPE_STRING 3 -#define CONF_TYPE_PRINT 4 -#define CONF_TYPE_FUNC 5 -#define CONF_TYPE_FUNC_PARAM 6 -#define CONF_TYPE_FUNC_FULL 7 -#define CONF_TYPE_SUBCONFIG 8 - - -#define ERR_NOT_AN_OPTION -1 -#define ERR_MISSING_PARAM -2 -#define ERR_OUT_OF_RANGE -3 -#define ERR_FUNC_ERR -4 -#define ERR_NO_SUBCONF -5 - -/* config flags */ -#define CONF_MIN (1<<0) -#define CONF_MAX (1<<1) -#define CONF_RANGE (CONF_MIN|CONF_MAX) -#define CONF_NOCFG (1<<2) -#define CONF_NOCMD (1<<3) -#define CONF_GLOBAL (1<<4) -#define CONF_NOSAVE (1<<5) - -typedef struct config config_t; -typedef struct m_config m_config_t; -typedef struct config_save config_save_t; - -#include "libplaytree/playtree.h" - -typedef void (*cfg_default_func_t)(config_t *,const char*); - -struct config { - const char *name; - any_t* const p; - unsigned int type; - unsigned int flags; - float min,max; - /* Use this field when your need to do something before a new value is - assigned to your option */ - cfg_default_func_t default_func; - const char *help; -}; - -struct m_config { - const config_t** opt_list; - config_save_t** config_stack; - any_t**dynamics; - unsigned dynasize; - int cs_level; - int parser_mode; /* COMMAND_LINE or CONFIG_FILE */ - int flags; - const char* sub_conf; // When we save a subconfig - play_tree_t* pt; // play tree we use for playlist option, etc - play_tree_t* last_entry; // last added entry - play_tree_t* last_parent; // if last_entry is NULL we must create child of this - int recursion_depth; -}; - -struct config_save { - config_t* opt; - union { - int as_int; - float as_float; - any_t* as_pointer; - } param; - char* opt_name; -}; - -extern m_config_t* mconfig; - -/* parse_config_file returns: - * -1 on error (can't malloc, invalid option...) - * 0 if can't open configfile - * 1 on success - */ -int m_config_parse_config_file(m_config_t *config, char *conffile); - -/* parse_command_line returns: - * -1 on error (invalid option...) - * 1 otherwise - */ -int m_config_parse_command_line(m_config_t* config, int argc, char **argv, char **envp); - -m_config_t* m_config_new(play_tree_t* pt); - -void m_config_free(m_config_t* config); - -void m_config_push(m_config_t* config); - -/* - * Return 0 on error 1 on success - */ -int m_config_pop(m_config_t* config); - -/* - * Return 0 on error 1 on success - */ -int m_config_register_options(m_config_t *config,const config_t *args); - -void m_config_show_options(const m_config_t* args); - -/* - * For all the following function when it's a subconfig option - * you must give an option name like 'tv:channel' and not just - * 'channel' - */ - -/** Return 1 on sucess 0 on failure -**/ -int m_config_set_option(m_config_t *config,const char *opt,const char *param); - -/** Get the config struct defining an option - * @return NULL on error -**/ -config_t* m_config_get_option(m_config_t const *config,const char* arg); - -/** Get the p field of the struct defining an option - * @return NULL on error -**/ -any_t* m_config_get_option_ptr(m_config_t const *config,const char* arg); - -/** Tell is an option is alredy set or not - * @return -1 one error (requested option arg exist) otherwise 0 or 1 -**/ -int m_config_is_option_set(m_config_t const*config,const char* arg); - -/** Return 0 on error 1 on success -**/ -int m_config_switch_flag(m_config_t *config,const char* opt); - -/** Return 0 on error 1 on success -**/ -int m_config_set_flag(m_config_t *config,const char* opt, int max); - -/** Return the value of a flag (O or 1) and -1 on error -**/ -int m_config_get_flag(m_config_t const *config,const char* opt); - -/** Set the value of an int option - * @return 0 on error 1 on success -**/ -int m_config_set_int(m_config_t *config,const char* arg,int val); - -/** Get the value of an int option - * @param err_ret If it is not NULL it's set to 1 on error - * @return the option value or -1 on error -**/ -int m_config_get_int (m_config_t const *config,const char* arg,int* err_ret); - -/** Set the value of a float option - * @return 0 on error 1 on success -**/ -int m_config_set_float(m_config_t *config,const char* arg,float val); - -/** Get the value of a float option - * @param err_ret If it is not NULL it's set to 1 on error - * @return the option value or -1 on error -**/ -float m_config_get_float (m_config_t const *config,const char* arg,int* err_ret); - -#endif /* __CONFIG_H */ Deleted: mplayerxp/codec-cfg.c =================================================================== --- mplayerxp/codec-cfg.c 2012-10-25 06:52:41 UTC (rev 198) +++ mplayerxp/codec-cfg.c 2012-10-25 07:50:09 UTC (rev 199) @@ -1,968 +0,0 @@ -/* - * codec.conf parser - * by Szabolcs Berecz <sz...@in...> - * (C) 2001 - * - * to compile tester app: gcc -Iloader/ -DTESTING -o codec-cfg codec-cfg.c - * to compile CODECS2HTML: gcc -Iloader/ -DCODECS2HTML -o codecs2html codecs-cfg.c - * - * TODO: implement informat in CODECS2HTML too - */ - -#include <stdio.h> -#include <stdlib.h> -#include <fcntl.h> -#include <unistd.h> -#include <errno.h> -#include <ctype.h> -#include <assert.h> -#include <string.h> - -// for mmioFOURCC: -#include "loader/wine/avifmt.h" -#include "libvo/img_format.h" -#include "codec-cfg.h" -#define MSGT_CLASS MSGT_CODECCFG -#include "__mp_msg.h" - - -#define MAX_NR_TOKEN 16 - -#define MAX_LINE_LEN 1000 - -#define RET_EOF -1 -#define RET_EOL -2 - -#define TYPE_VIDEO 0 -#define TYPE_AUDIO 1 - -#define PRINT_LINENUM MSG_ERR(" at line %d\n", line_num) - -static int add_to_fourcc(const char *s, char *alias, unsigned int *fourcc, - unsigned int *map) -{ - int i, j, freeslots; - unsigned int tmp; - - /* find first unused slot */ - for (i = 0; i < CODECS_MAX_FOURCC && fourcc[i] != 0xffffffff; i++) - /* NOTHING */; - freeslots = CODECS_MAX_FOURCC - i; - if (!freeslots) - goto err_out_too_many; - - do { - tmp = mmioFOURCC(s[0], s[1], s[2], s[3]); - for (j = 0; j < i; j++) - if (tmp == fourcc[j]) - goto err_out_duplicated; - fourcc[i] = tmp; - map[i] = alias ? mmioFOURCC(alias[0], alias[1], alias[2], alias[3]) : tmp; - s += 4; - i++; - } while ((*(s++) == ',') && --freeslots); - - if (!freeslots) - goto err_out_too_many; - if (*(--s) != '\0') - goto err_out_parse_error; - return 1; -err_out_duplicated: - MSG_ERR("duplicated fourcc/format"); - return 0; -err_out_too_many: - MSG_ERR("too many fourcc/format..."); - return 0; -err_out_parse_error: - MSG_ERR("parse error"); - return 0; -} - -static int add_to_format(const char *s, unsigned int *fourcc, unsigned int *fourccmap) -{ - int i, j; - char *endptr; - - /* find first unused slot */ - for (i = 0; i < CODECS_MAX_FOURCC && fourcc[i] != 0xffffffff; i++) - /* NOTHING */; - if (i == CODECS_MAX_FOURCC) { - MSG_ERR("too many fourcc/format..."); - return 0; - } - - fourcc[i]=fourccmap[i]=strtoul(s,&endptr,0); - if (*endptr != '\0') { - MSG_ERR("parse error"); - return 0; - } - for (j = 0; j < i; j++) - if (fourcc[j] == fourcc[i]) { - MSG_ERR("duplicated fourcc/format"); - return 0; - } - - return 1; -} - -static const struct { - const char *name; - const uint32_t num; -} fmt_table[] = { - -{"Y800", IMGFMT_Y800}, - -{"YVU9", IMGFMT_YVU9}, -{"IF09", IMGFMT_IF09}, - -{"YV12", IMGFMT_YV12}, -{"I420", IMGFMT_I420}, -{"IYUV", IMGFMT_IYUV}, - -{"YUY2", IMGFMT_YUY2}, -{"UYVY", IMGFMT_UYVY}, -{"YVYU", IMGFMT_YVYU}, - -{"CLPL", IMGFMT_CLPL}, -{"CLJR", IMGFMT_CLJR}, -{"CYUV", IMGFMT_cyuv}, - -{"444P16BE", IMGFMT_444P16_BE}, -{"444P16LE", IMGFMT_444P16_LE}, -{"444P16", IMGFMT_444P16}, -{"422P16BE", IMGFMT_422P16_BE}, -{"422P16LE", IMGFMT_422P16_LE}, -{"422P16", IMGFMT_422P16}, -{"420P16BE", IMGFMT_420P16_BE}, -{"420P16LE", IMGFMT_420P16_LE}, -{"420P16", IMGFMT_420P16}, -{"444P", IMGFMT_444P}, -{"422P", IMGFMT_422P}, -{"411P", IMGFMT_411P}, -{"420A", IMGFMT_420A}, - -{"NV12", IMGFMT_NV12}, -{"NV21", IMGFMT_NV21}, -{"HM12", IMGFMT_HM12}, - -{"IY41", IMGFMT_IY41}, -{"IYU1", IMGFMT_IYU1}, -{"IYU2", IMGFMT_IYU2}, - -{"Y422", IMGFMT_Y422}, -{"Y211", IMGFMT_Y211}, -{"Y41P", IMGFMT_Y41P}, -{"Y41T", IMGFMT_Y41T}, -{"Y42T", IMGFMT_Y42T}, -{"YUNV", IMGFMT_YUNV}, -{"IYU2", IMGFMT_IYU2}, -{"V422", IMGFMT_V422}, -{"V655", IMGFMT_V655}, -{"YUVP", IMGFMT_YUVP}, -{"UYVP", IMGFMT_UYVP}, - -{"RGB48LE",IMGFMT_RGB48LE}, -{"RGB48BE",IMGFMT_RGB48BE}, -{"RGB48", IMGFMT_RGB48NE}, -{"RGB4", IMGFMT_RGB|4}, -{"RGB8", IMGFMT_RGB|8}, -{"RGB15", IMGFMT_RGB|15}, -{"RGB16", IMGFMT_RGB|16}, -{"RGB24", IMGFMT_RGB|24}, -{"RGB32", IMGFMT_RGB|32}, -{"RGBA", IMGFMT_RGBA}, -{"ARGB", IMGFMT_ARGB}, -{"RGB1", IMGFMT_RGB|1}, - -{"BGR48LE",IMGFMT_BGR48LE}, -{"BGR48BE",IMGFMT_BGR48BE}, -{"BGR48", IMGFMT_BGR48NE}, -{"BGR4", IMGFMT_BGR|4}, -{"BGR8", IMGFMT_BGR|8}, -{"BGR15", IMGFMT_BGR|15}, -{"BGR16", IMGFMT_BGR|16}, -{"BGR24", IMGFMT_BGR|24}, -{"BGR32", IMGFMT_BGR|32}, -{"BGRA", IMGFMT_BGRA}, -{"ABGR", IMGFMT_ABGR}, -{"BGR1", IMGFMT_BGR|1}, - -{"MPES", IMGFMT_MPEGPES}, -{"JPEGNI", IMGFMT_ZRMJPEGNI}, -{"JPEGIT", IMGFMT_ZRMJPEGIT}, -{"JPEGIB", IMGFMT_ZRMJPEGIB}, -{"MOCO_MPEG2", IMGFMT_XVMC_MOCO_MPEG2}, -{"IDCT_MPEG2", IMGFMT_XVMC_IDCT_MPEG2}, -{NULL, 0} -}; - - -static int add_to_inout(const char *sfmt,const char *sflags, unsigned int *outfmt, - unsigned char *outflags) -{ - - static const char *flagstr[] = { - "flip", - "noflip", - "yuvhack", - NULL - }; - - int i, j, freeslots; - unsigned char flags; - - for (i = 0; i < CODECS_MAX_OUTFMT && outfmt[i] != 0xffffffff; i++) - /* NOTHING */; - freeslots = CODECS_MAX_OUTFMT - i; - if (!freeslots) - goto err_out_too_many; - - flags = 0; - if(sflags) { - do { - for (j = 0; flagstr[j] != NULL; j++) - if (!strncmp(sflags, flagstr[j], - strlen(flagstr[j]))) - break; - if (flagstr[j] == NULL) - goto err_out_parse_error; - flags|=(1<<j); - sflags+=strlen(flagstr[j]); - } while (*(sflags++) == ','); - - if (*(--sflags) != '\0') { - MSG_ERR("\n{found unparsed flg tile: %s}\n",sflags); - goto err_out_parse_error; - } - } - - do { - for (j = 0; fmt_table[j].name != NULL; j++) - if (!strncmp(sfmt, fmt_table[j].name, strlen(fmt_table[j].name))) - break; - if (fmt_table[j].name == NULL) { - MSG_ERR("\n{%s is not registered format}\n",sfmt); - goto err_out_parse_error; - } - outfmt[i] = fmt_table[j].num; - outflags[i] = flags; - ++i; - sfmt+=strlen(fmt_table[j].name); - } while ((*(sfmt++) == ',') && --freeslots); - - if (!freeslots) - goto err_out_too_many; - - if (*(--sfmt) != '\0') { - MSG_ERR("\n{found unparsed tile %s}\n",sfmt); - goto err_out_parse_error; - } - - return 1; -err_out_too_many: - MSG_ERR("too many out..."); - return 0; -err_out_parse_error: - MSG_ERR("parse error"); - return 0; -} - -static int validate_codec(codecs_t *c, int type) -{ - unsigned i; - char *tmp_name = strdup(c->codec_name); - - for (i = 0; i < strlen(tmp_name) && isalnum(tmp_name[i]); i++) - /* NOTHING */; - - if (i < strlen(tmp_name)) { - MSG_ERR("\ncodec(%s) name is not valid!\n", c->codec_name); - free(tmp_name); - return 0; - } - - if (!c->s_info) - { - strncpy(c->s_info,c->codec_name,sizeof(c->s_info)); - c->s_info[sizeof(c->s_info)-1]=0; - } - free(tmp_name); - return 1; -} - -static short get_cpuflags(char *s) -{ - static const char *flagstr[] = { - "mmx", - "sse", - "3dnow", - NULL - }; - int i; - short flags = 0; - - do { - for (i = 0; flagstr[i]; i++) - if (!strncmp(s, flagstr[i], strlen(flagstr[i]))) - break; - if (!flagstr[i]) - goto err_out_parse_error; - flags |= 1<<i; - s += strlen(flagstr[i]); - } while (*(s++) == ','); - - if (*(--s) != '\0') - goto err_out_parse_error; - - return flags; -err_out_parse_error: - return 0; -} - -static FILE *fp; -static int line_num = 0; -static char *line; -static char *token[MAX_NR_TOKEN]; - -static int get_token(int min, int max) -{ - static int read_nextline = 1; - static int line_pos; - int i; - char c; - - if (max >= MAX_NR_TOKEN) { - MSG_ERR("get_token(): max >= MAX_NR_TOKEN!"); - goto out_eof; - } - - memset(token, 0x00, sizeof(*token) * max); - - if (read_nextline) { - if (!fgets(line, MAX_LINE_LEN, fp)) - goto out_eof; - line_pos = 0; - ++line_num; - read_nextline = 0; - } - for (i = 0; i < max; i++) { - while (isspace(line[line_pos])) - ++line_pos; - if (line[line_pos] == '\0' || line[line_pos] == '#' || - line[line_pos] == ';') { - read_nextline = 1; - if (i >= min) - goto out_ok; - goto out_eol; - } - token[i] = line + line_pos; - c = line[line_pos]; - if (c == '"' || c == '\'') { - token[i]++; - while (line[++line_pos] != c && line[line_pos]) - /* NOTHING */; - } else { - for (/* NOTHING */; !isspace(line[line_pos]) && - line[line_pos]; line_pos++) - /* NOTHING */; - } - if (!line[line_pos]) { - read_nextline = 1; - if (i >= min - 1) - goto out_ok; - goto out_eol; - } - line[line_pos] = '\0'; - line_pos++; - } -out_ok: - return i; -out_eof: - read_nextline = 1; - return RET_EOF; -out_eol: - return RET_EOL; -} - -static codecs_t *video_codecs=NULL; -static codecs_t *audio_codecs=NULL; -static int nr_vcodecs = 0; -static int nr_acodecs = 0; - -int parse_codec_cfg(const char *cfgfile) -{ - codecs_t *codec = NULL; // current codec - codecs_t **codecsp = NULL;// points to audio_codecs or to video_codecs - char *endptr; // strtoul()... - int *nr_codecsp; - const char *err_hint=NULL; - int codec_type; /* TYPE_VIDEO/TYPE_AUDIO */ - int tmp, i; - - // in case we call it secont time - if(video_codecs!=NULL)free(video_codecs); - else video_codecs=NULL; - - if(audio_codecs!=NULL)free(audio_codecs); - else audio_codecs=NULL; - - nr_vcodecs = 0; - nr_acodecs = 0; - - if(cfgfile==NULL)return 0; - - if ((fp = fopen(cfgfile, "r")) == NULL) { - MSG_FATAL("can't open '%s': %s\n", cfgfile, strerror(errno)); - return 0; - } - - if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) { - MSG_FATAL("can't get memory for 'line': %s\n", strerror(errno)); - return 0; - } - - MSG_INFO("Reading %s: ", cfgfile); - /* - * check if the cfgfile starts with 'audiocodec' or - * with 'videocodec' - */ - while ((tmp = get_token(1, 1)) == RET_EOL) - /* NOTHING */; - if (tmp == RET_EOF) - goto out; - if (!strcmp(token[0], "audiocodec") || !strcmp(token[0], "videocodec")) - goto loop_enter; - err_hint=token[0]; - goto err_out_parse_error; - while ((tmp = get_token(1, 1)) != RET_EOF) { - if (tmp == RET_EOL) - continue; - if (!strcmp(token[0], "audiocodec") || - !strcmp(token[0], "videocodec")) { - if (!validate_codec(codec, codec_type)) - goto err_out_not_valid; - loop_enter: - if (*token[0] == 'v') { - codec_type = TYPE_VIDEO; - nr_codecsp = &nr_vcodecs; - codecsp = &video_codecs; - } else if (*token[0] == 'a') { - codec_type = TYPE_AUDIO; - nr_codecsp = &nr_acodecs; - codecsp = &audio_codecs; -#ifdef DEBUG - } else { - MSG_ERR("picsba\n"); - goto err_out; -#endif - } - if (!(*codecsp = (codecs_t *) realloc(*codecsp, - sizeof(codecs_t) * (*nr_codecsp + 2)))) { - MSG_FATAL(" can't realloc '*codecsp': %s\n", strerror(errno)); - goto err_out; - } - codec=*codecsp + *nr_codecsp; - ++*nr_codecsp; - memset(codec,0,sizeof(codecs_t)); - memset(codec->fourcc, 0xff, sizeof(codec->fourcc)); - memset(codec->outfmt, 0xff, sizeof(codec->outfmt)); - memset(codec->infmt, 0xff, sizeof(codec->infmt)); - - if (get_token(1, 1) < 0) - goto err_out_parse_error; - for (i = 0; i < *nr_codecsp - 1; i++) { - if(( (*codecsp)[i].codec_name!=NULL) && - (!strcmp(token[0], (*codecsp)[i].codec_name)) ) { - MSG_ERR(" codec name '%s' isn't unique", token[0]); - goto err_out_print_linenum; - } - } - strncpy(codec->codec_name,token[0],sizeof(codec->codec_name)); - codec->codec_name[sizeof(codec->codec_name)-1]=0; - } else if (!strcmp(token[0], "info")) { - err_hint="info"; - if (codec->s_info[0] || get_token(1, 1) < 0) { - goto err_out_parse_error; - } - strncpy(codec->s_info,token[0],sizeof(codec->s_info)); - codec->s_info[sizeof(codec->s_info)-1]=0; - } else if (!strcmp(token[0], "comment")) { - err_hint="comment"; - if (get_token(1, 1) < 0) { - goto err_out_parse_error; - } - strncat(codec->s_comment,token[0],sizeof(codec->s_comment)); - codec->s_comment[sizeof(codec->s_comment)-1]=0; - } else if (!strcmp(token[0], "fourcc")) { - err_hint="fourcc"; - if (get_token(1, 2) < 0) { - goto err_out_parse_error; - } - if (!add_to_fourcc(token[0], token[1], - codec->fourcc, - codec->fourccmap)) { - MSG_ERR(" can't add fourcc '%s'",token[0]); - goto err_out_print_linenum; - } - } else if (!strcmp(token[0], "format")) { - err_hint="format"; - if (get_token(1, 1) < 0) { - goto err_out_parse_error; - } - if (!add_to_format(token[0], codec->fourcc,codec->fourccmap)) { - MSG_ERR(" can't add format '%s'", token[0]); - goto err_out_print_linenum; - } - } else if (!strcmp(token[0], "driver")) { - err_hint="driver"; - if (get_token(1, 1) < 0) { - goto err_out_parse_error; - } - strncpy(codec->driver_name,token[0],sizeof(codec->driver_name)); - codec->driver_name[sizeof(codec->driver_name)-1]=0; - } else if (!strcmp(token[0], "dll")) { - err_hint="dll"; - if (get_token(1, 1) < 0) { - goto err_out_parse_error; - } - strncpy(codec->dll_name,token[0],sizeof(codec->dll_name)); - codec->dll_name[sizeof(codec->dll_name)-1]=0; - } else if (!strcmp(token[0], "guid")) { - err_hint="guid"; - if (get_token(11, 11) < 0) { - goto err_out_parse_error; - } - codec->guid.f1=strtoul(token[0],&endptr,0); - if ((*endptr != ',' || *(endptr + 1) != '\0') && - *endptr != '\0') - goto err_out_parse_error; - codec->guid.f2=strtoul(token[1],&endptr,0); - if ((*endptr != ',' || *(endptr + 1) != '\0') && - *endptr != '\0') - goto err_out_parse_error; - codec->guid.f3=strtoul(token[2],&endptr,0); - if ((*endptr != ',' || *(endptr + 1) != '\0') && - *endptr != '\0') - goto err_out_parse_error; - for (i = 0; i < 8; i++) { - codec->guid.f4[i]=strtoul(token[i + 3],&endptr,0); - if ((*endptr != ',' || *(endptr + 1) != '\0') && - *endptr != '\0') - goto err_out_parse_error; - } - } else if (!strcmp(token[0], "out")) { - err_hint="out"; - if (get_token(1, 2) < 0) { - goto err_out_parse_error; - } - if (!add_to_inout(token[0], token[1], codec->outfmt, - codec->outflags)) { - MSG_ERR(" can't add outfmt '%s'", token[0]); - goto err_out_print_linenum; - } - } else if (!strcmp(token[0], "in")) { - err_hint="in"; - if (get_token(1, 2) < 0) { - goto err_out_parse_error; - } - if (!add_to_inout(token[0], toke... [truncated message content] |
From: <nic...@us...> - 2012-10-25 08:11:05
|
Revision: 200 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=200&view=rev Author: nickols_k Date: 2012-10-25 08:10:55 +0000 (Thu, 25 Oct 2012) Log Message: ----------- reorder source tree Added Paths: ----------- mplayerxp/libmpconf/Makefile mplayerxp/libplaytree/Makefile Added: mplayerxp/libmpconf/Makefile =================================================================== --- mplayerxp/libmpconf/Makefile (rev 0) +++ mplayerxp/libmpconf/Makefile 2012-10-25 08:10:55 UTC (rev 200) @@ -0,0 +1,49 @@ + +LIBNAME = libmpconf.a + +include ../mp_config.mak + +DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@ || exit; done +DO_ALL = @ for i in $(SUBDIRS); do $(MAKE) -C $$i all || exit; done + +SRCS = cfgparser.c codec-cfg.c m_option.c m_property.c m_struct.c subopt-helper.c + +OBJS = $(SRCS:.c=.o) +INCLUDE = -I. -I../ +CFLAGS = $(OPTFLAGS) $(INCLUDE) -W -Wall + +.SUFFIXES: .c .o + +.PHONY: $(SUBDIRS) + +all: $(LIBNAME) + +$(SUBDIRS): + $(DO_ALL) + +.c.o: + $(CC) -c $(CFLAGS) -o $@ $< + +$(LIBNAME): $(SUBDIRS) $(OBJS) + $(AR) r $(LIBNAME) $(OBJS) + +clean: + $(DO_MAKE) + rm -f *.o *.a *~ + +distclean: + $(DO_MAKE) + rm -f test Makefile.bak *.o *.a *~ .depend + +dep: depend + +depend: + $(DO_MAKE) + $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend + +# +# include dependency files if they exist +# +ifneq ($(wildcard .depend),) +include .depend +endif Property changes on: mplayerxp/libmpconf/Makefile ___________________________________________________________________ Added: svn:eol-style + native Added: mplayerxp/libplaytree/Makefile =================================================================== --- mplayerxp/libplaytree/Makefile (rev 0) +++ mplayerxp/libplaytree/Makefile 2012-10-25 08:10:55 UTC (rev 200) @@ -0,0 +1,49 @@ + +LIBNAME = libplaytree.a + +include ../mp_config.mak + +DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@ || exit; done +DO_ALL = @ for i in $(SUBDIRS); do $(MAKE) -C $$i all || exit; done + +SRCS = asxparser.c playtree.c playtreeparser.c + +OBJS = $(SRCS:.c=.o) +INCLUDE = -I. -I../ +CFLAGS = $(OPTFLAGS) $(INCLUDE) -W -Wall + +.SUFFIXES: .c .o + +.PHONY: $(SUBDIRS) + +all: $(LIBNAME) + +$(SUBDIRS): + $(DO_ALL) + +.c.o: + $(CC) -c $(CFLAGS) -o $@ $< + +$(LIBNAME): $(SUBDIRS) $(OBJS) + $(AR) r $(LIBNAME) $(OBJS) + +clean: + $(DO_MAKE) + rm -f *.o *.a *~ + +distclean: + $(DO_MAKE) + rm -f test Makefile.bak *.o *.a *~ .depend + +dep: depend + +depend: + $(DO_MAKE) + $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend + +# +# include dependency files if they exist +# +ifneq ($(wildcard .depend),) +include .depend +endif Property changes on: mplayerxp/libplaytree/Makefile ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-25 14:45:17
|
Revision: 204 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=204&view=rev Author: nickols_k Date: 2012-10-25 14:45:04 +0000 (Thu, 25 Oct 2012) Log Message: ----------- combine variables into structures Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/cpudetect.h mplayerxp/dec_ahead.c mplayerxp/fifo.c mplayerxp/libmpcodecs/ad_acm.c mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/ad_qtaudio.c mplayerxp/libmpcodecs/ad_twin.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpcodecs/vd_qtvideo.c mplayerxp/libmpcodecs/vd_vfw.c mplayerxp/libmpdemux/asf_mmst_streaming.c mplayerxp/libmpdemux/asf_streaming.c mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/cdda.c mplayerxp/libmpdemux/cddb.c mplayerxp/libmpdemux/demux_asf.c mplayerxp/libmpdemux/demux_audio.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_lavf.c mplayerxp/libmpdemux/demux_mkv.c mplayerxp/libmpdemux/demux_mpxp64.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demux_real.c mplayerxp/libmpdemux/demux_ts.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/demuxer_r.c mplayerxp/libmpdemux/librtsp/rtsp.c mplayerxp/libmpdemux/librtsp/rtsp_rtp.c mplayerxp/libmpdemux/librtsp/rtsp_session.c mplayerxp/libmpdemux/network.c mplayerxp/libmpdemux/realrtsp/asmrp.c mplayerxp/libmpdemux/realrtsp/real.c mplayerxp/libmpdemux/realrtsp/rmff.c mplayerxp/libmpdemux/realrtsp/sdpplin.c mplayerxp/libmpdemux/realrtsp/xbuffer.c mplayerxp/libmpdemux/s_cdd.c mplayerxp/libmpdemux/s_dvdnav.c mplayerxp/libmpdemux/s_dvdread.c mplayerxp/libmpdemux/s_ffmpeg.c mplayerxp/libmpdemux/s_file.c mplayerxp/libmpdemux/s_tv.c mplayerxp/libmpdemux/s_vcdnav.c mplayerxp/libmpdemux/url.c mplayerxp/libmpsub/vobsub.c mplayerxp/libvo/vo_fbdev.c mplayerxp/libvo/vo_vesa.c mplayerxp/libvo/vosub_vidix.c mplayerxp/mp_image.c mplayerxp/mp_msg.c mplayerxp/mp_msg.h mplayerxp/mplayer.c mplayerxp/mplayer.h mplayerxp/osdep/vbelib.c mplayerxp/postproc/vf_scale.c mplayerxp/sig_hand.c Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/cfg-mplayer.h 2012-10-25 14:45:04 UTC (rev 204) @@ -46,8 +46,6 @@ extern int nortc; #endif -extern int enable_xp; -extern int enable_gomp; extern int enable_xp_audio; #if defined( ARCH_X86 ) || defined(ARCH_X86_64) @@ -106,15 +104,15 @@ */ static const config_t xpcore_config[]={ - {"xp", &enable_xp, CONF_TYPE_INT, CONF_RANGE, 0, 4, NULL, "starts MPlayerXP in multi-thread and multi-buffer XP mode"}, - {"dump", &stream_dump, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies dump type and name for the dump of stream"}, - {"gomp", &enable_gomp, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables usage of OpenMP extensions"}, - {"nogomp", &enable_gomp, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables usage of OpenMP extensions"}, + {"xp", &mp_conf.xp, CONF_TYPE_INT, CONF_RANGE, 0, 4, NULL, "starts MPlayerXP in multi-thread and multi-buffer XP mode"}, + {"dump", &mp_conf.stream_dump, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies dump type and name for the dump of stream"}, + {"gomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables usage of OpenMP extensions"}, + {"nogomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables usage of OpenMP extensions"}, {"da_buffs", &vo_conf.da_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, NULL, "specifies number of buffers for decoding-ahead in XP mode"}, - {"cache", &stream_cache_size, CONF_TYPE_INT, CONF_RANGE, 4, 65536, NULL,"specifies amount of memory for precaching a file/URL"}, - {"nocache", &stream_cache_size, CONF_TYPE_FLAG, 0, 1, 0, NULL,"disables precaching a file/URL"}, - {"autoq", &auto_quality, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL, "dynamically changes the level of postprocessing depending on spare CPU time available"}, - {"benchmark", &benchmark, CONF_TYPE_FLAG, 0, 0, 1, NULL, "performs benchmarking to estimate performance of MPlayerXP"}, + {"cache", &mp_conf.s_cache_size, CONF_TYPE_INT, CONF_RANGE, 4, 65536, NULL,"specifies amount of memory for precaching a file/URL"}, + {"nocache", &mp_conf.s_cache_size, CONF_TYPE_FLAG, 0, 1, 0, NULL,"disables precaching a file/URL"}, + {"autoq", &mp_conf.autoq, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL, "dynamically changes the level of postprocessing depending on spare CPU time available"}, + {"benchmark", &mp_conf.benchmark, CONF_TYPE_FLAG, 0, 0, 1, NULL, "performs benchmarking to estimate performance of MPlayerXP"}, {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, }; @@ -226,7 +224,7 @@ {"on", &has_dvdsub, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables subtitle-steam playback"}, {"off", &has_dvdsub, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables subtitle-stream playback"}, {"vob", &vobsub_name, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies the VobSub files that are to be used for subtitle"}, - {"vobid", &vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL, "specifies the VobSub subtitle id"}, + {"vobid", &mp_conf.vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL, "specifies the VobSub subtitle id"}, #ifdef USE_SUB {"file", &sub_name, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies the subtitle file"}, #ifdef USE_ICONV @@ -242,9 +240,9 @@ #endif {"cc", &subcc_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enable DVD Closed Caption (CC) subtitles"}, {"nocc", &subcc_enabled, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable DVD Closed Caption (CC) subtitles"}, - {"id", &dvdsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL, "selects subtitle channel"}, - {"lang", &dvdsub_lang, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies language of DVD-subtitle stream as two-letter country code(s)"}, - {"ifo", &spudec_ifo, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies .ifo file for DVD subtitles"}, + {"id", &mp_conf.dvdsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL, "selects subtitle channel"}, + {"lang", &mp_conf.dvdsub_lang, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies language of DVD-subtitle stream as two-letter country code(s)"}, + {"ifo", &mp_conf.spudec_ifo, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies .ifo file for DVD subtitles"}, {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, }; @@ -266,8 +264,8 @@ {"mixer", &oss_mixer_device, CONF_TYPE_STRING, 0, 0, 0, NULL, "select audio-mixer device"}, {"channels", &audio_output_channels, CONF_TYPE_INT, CONF_RANGE, 2, 8, NULL, "select number of audio output channels to be used"}, {"rate", &force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, NULL, "specifies Hz for audio playback"}, - {"lang", &audio_lang, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies language of DVD-audio stream as two-letter country code(s)"}, - {"id", &audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL, "selects audio channel"}, + {"lang", &mp_conf.audio_lang, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies language of DVD-audio stream as two-letter country code(s)"}, + {"id", &mp_conf.audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL, "selects audio channel"}, #ifdef USE_FAKE_MONO {"stereo", &fakemono, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL, "selects type of MP2/MP3 stereo output"}, #endif @@ -299,7 +297,7 @@ {"bm", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of bus-mastering (if it available for given OS/videocard)"}, {"bm2", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 0, 2, NULL, "enables using of bus-mastering to store all decoded-ahead frames in video-memory"}, {"nobm", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of bus-mastering"}, - {"id", &video_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL, "selects video channel"}, + {"id", &mp_conf.video_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL, "selects video channel"}, {"pp", &npp_options, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies options of post-processing"}, {"sws", &sws_flags, CONF_TYPE_INT, 0, 0, 2, NULL, "specifies the quality of the software scaler"}, #ifdef HAVE_PNG @@ -340,7 +338,7 @@ {"vfm", &video_family, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified video-decoders family"}, {"ac", &audio_codec, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified audio-decoder"}, {"vc", &video_codec, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified video-decoder"}, -/*UD*/ {"verbose", &verbose, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 0, 100, NULL, "verbose output"}, +/*UD*/ {"verbose", &mp_conf.verbose, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 0, 100, NULL, "verbose output"}, {"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, NULL, "verbose output (more -v means more verbosity)"}, {"slave", &slave_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, NULL, "turns MPlayerXP into slave mode as a backend for other programs"}, {"use-stdin", &use_stdin, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL, "forces reading of keyboard codes from STDIN instead of terminal's console"}, Modified: mplayerxp/cpudetect.h =================================================================== --- mplayerxp/cpudetect.h 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/cpudetect.h 2012-10-25 14:45:04 UTC (rev 204) @@ -1,6 +1,8 @@ #ifndef CPUDETECT_H #define CPUDETECT_H +#include "mplayer.h" + #ifdef ARCH_X86_64 # define REGa rax # define REGb rbx Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/dec_ahead.c 2012-10-25 14:45:04 UTC (rev 204) @@ -112,7 +112,6 @@ extern volatile int xp_drop_frame; extern volatile unsigned xp_drop_frame_cnt; extern int output_quality; -extern int auto_quality; int ao_da_buffs; @@ -195,7 +194,7 @@ ada_active_frame - abs frame num. which is being displayed abs_dec_ahead_locked_frame - abs frame num. which is being decoded */ - max_frame_delay = max_video_time_usage+max_vout_time_usage; + max_frame_delay = time_usage.max_video+time_usage.max_vout; /* TODO: @@ -212,7 +211,7 @@ if(max_frame_delay*3 > drop_barrier) { if(drop_barrier < (float)(xp_num_frames-2)/vo_data->fps) drop_barrier += 1/vo_data->fps; else - if(verbose) show_warn_cant_sync(max_frame_delay); + if(mp_conf.verbose) show_warn_cant_sync(max_frame_delay); } if(delta > drop_barrier) rc=0; else if(delta < max_frame_delay*3) rc=1; @@ -286,7 +285,7 @@ pinfo[_xp_id].pid = getpid(); /* Only for testing */ dec_ahead_pth_id = pinfo[_xp_id].pth_id = pthread_self(); - pinfo[_xp_id].thread_name = (xp_core.has_audio && enable_xp < XP_VAFull) ? "video+audio decoding+filtering ahead" : "video decoding+vf ahead"; + pinfo[_xp_id].thread_name = (xp_core.has_audio && mp_conf.xp < XP_VAFull) ? "video+audio decoding+filtering ahead" : "video decoding+vf ahead"; drop_barrier=(float)(xp_num_frames/2)*(1/vo_data->fps); if(av_sync_pts == -1 && !use_pts_fix2) xp_is_bad_pts = d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || @@ -310,7 +309,7 @@ #if 0 /* prevent reent access to non-reent demuxer */ //if(sh_video->num_frames>200) *((char*)0x100) = 1; // Testing crash - if(xp_core.has_audio && enable_xp<XP_VAFull) { + if(xp_core.has_audio && mp_conf.xp<XP_VAFull) { pinfo[_xp_id].current_module = "decode audio"; while(2==xp_thread_decode_audio()) ; pinfo[_xp_id].current_module = "dec_ahead 2"; @@ -381,7 +380,7 @@ our_quality = output_quality*distance/total; if(drop_param) mpcv_set_quality(sh_video,0); else - if(auto_quality) mpcv_set_quality(sh_video,our_quality>0?our_quality:0); + if(mp_conf.autoq) mpcv_set_quality(sh_video,our_quality>0?our_quality:0); } blit_frame=mpcv_decode(sh_video,start,in_size,drop_param,v_pts); if(output_quality) { @@ -418,7 +417,7 @@ ,dae_curr_vplayed(),dae_curr_vdecoded()); if(pthread_end_of_work) goto pt_exit; if(xp_core.in_lseek!=NoSeek) break; - if(xp_core.has_audio && enable_xp<XP_VAFull) { + if(xp_core.has_audio && mp_conf.xp<XP_VAFull) { pinfo[_xp_id].current_module = "decode audio"; xp_thread_decode_audio(); pinfo[_xp_id].current_module = "dec_ahead 5"; @@ -428,7 +427,7 @@ /*------------------------ frame decoded. --------------------*/ } /* while(!xp_eof)*/ -if(xp_core.has_audio && enable_xp<XP_VAFull) { +if(xp_core.has_audio && mp_conf.xp<XP_VAFull) { while(!xp_audio_eof && !xp_core.in_lseek && !pthread_end_of_work) { pinfo[_xp_id].current_module = "decode audio"; if(!xp_thread_decode_audio()) usleep(1); @@ -581,10 +580,10 @@ xp_core.video=malloc(sizeof(dec_ahead_engine_t)); dae_init(xp_core.video,xp_num_frames); } - else {/* if (enable_xp >= XP_VAFull) enable_xp = XP_VAPlay;*/ } + else {/* if (mp_conf.xp >= XP_VAFull) mp_conf.xp = XP_VAPlay;*/ } if(sha) sh_audio = sha; /* currently is unused */ - if(enable_xp>=XP_VideoAudio && sha) { + if(mp_conf.xp>=XP_VideoAudio && sha) { int asize; unsigned o_bps; unsigned min_reserv; @@ -597,7 +596,7 @@ min_reserv = (float)min_reserv * (float)o_bps / (float)sha->o_bps; init_audio_buffer(asize+min_reserv,min_reserv+MIN_BUFFER_RESERV,asize/(sha->audio_out_minsize<10000?sha->audio_out_minsize:4000)+100,sha); xp_core.has_audio=1; - if( enable_xp >= XP_VAPlay ) + if( mp_conf.xp >= XP_VAPlay ) pthread_attr_init(&audio_attr); } @@ -610,15 +609,15 @@ retval = pthread_attr_setdetachstate(&our_attr,PTHREAD_CREATE_DETACHED); if(retval) { - if(verbose) printf("running thread: attr_setdetachstate fault!!!\n"); + if(mp_conf.verbose) printf("running thread: attr_setdetachstate fault!!!\n"); return retval; } pthread_attr_setscope(&our_attr,PTHREAD_SCOPE_SYSTEM); - if( xp_core.has_audio && enable_xp >= XP_VAPlay ) { + if( xp_core.has_audio && mp_conf.xp >= XP_VAPlay ) { retval = pthread_attr_setdetachstate(&audio_attr,PTHREAD_CREATE_DETACHED); if(retval) { - if(verbose) printf("running audio thread: attr_setdetachstate fault!!!\n"); + if(mp_conf.verbose) printf("running audio thread: attr_setdetachstate fault!!!\n"); return retval; } pthread_attr_setscope(&audio_attr,PTHREAD_SCOPE_SYSTEM); @@ -628,7 +627,7 @@ /* requires root privelegies */ pthread_attr_setschedpolicy(&our_attr,SCHED_FIFO); #endif - if( (xp_core.has_audio && enable_xp >= XP_VAFull) || !xp_core.has_video ) + if( (xp_core.has_audio && mp_conf.xp >= XP_VAFull) || !xp_core.has_video ) { retval = pthread_create(&pthread_id,&audio_attr,a_dec_ahead_routine,NULL); if( retval ) return retval; @@ -645,7 +644,7 @@ int run_xp_aplayers(void) { int retval; - if( xp_core.has_audio && enable_xp >= XP_VAPlay ) + if( xp_core.has_audio && mp_conf.xp >= XP_VAPlay ) { retval = pthread_create(&pthread_id,&audio_attr,audio_play_routine,NULL); if( retval ) return retval; @@ -692,7 +691,7 @@ Else we'll get picture destortion on the screen */ initial_audio_pts=HUGE; - if(enable_xp && !pthread_is_living && !a_pthread_is_living) { + if(mp_conf.xp && !pthread_is_living && !a_pthread_is_living) { xp_core.in_lseek = NoSeek; /* Threads not started, do nothing */ return; } Modified: mplayerxp/fifo.c =================================================================== --- mplayerxp/fifo.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/fifo.c 2012-10-25 14:45:04 UTC (rev 204) @@ -1,3 +1,4 @@ +#include "mplayer.h" #include "fifo.h" #ifndef min Modified: mplayerxp/libmpcodecs/ad_acm.c =================================================================== --- mplayerxp/libmpcodecs/ad_acm.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpcodecs/ad_acm.c 2012-10-25 14:45:04 UTC (rev 204) @@ -55,7 +55,7 @@ in_fmt->wFormatTag=sh_audio->format; } - if(verbose) + if(mp_conf.verbose) { MSG_V("Output fmt:\n"); print_wave_header(&priv->o_wf,sizeof(WAVEFORMATEX)); Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpcodecs/ad_mp3.c 2012-10-25 14:45:04 UTC (rev 204) @@ -286,7 +286,7 @@ } if((err=mpg123_open_feed(priv->mh))!=0) goto err_exit; param = MPG123_FORCE_STEREO|MPG123_FORCE_FLOAT; - if(!verbose) param|=MPG123_QUIET; + if(!mp_conf.verbose) param|=MPG123_QUIET; mpg123_param(priv->mh,MPG123_FLAGS,param,0); // Decode first frame (to get header filled) err=MPG123_NEED_MORE; Modified: mplayerxp/libmpcodecs/ad_qtaudio.c =================================================================== --- mplayerxp/libmpcodecs/ad_qtaudio.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpcodecs/ad_qtaudio.c 2012-10-25 14:45:04 UTC (rev 204) @@ -169,7 +169,7 @@ unsigned long OutputBufferSize=0; //size of the output buffer unsigned long WantedBufferSize=0; //the size you want your buffers to be - if(stream_cache_size) + if(mp_conf.s_cache_size) { MSG_FATAL("Disabling sound:\nwin32 quicktime DLLs must be initialized in single-threaded mode! Try -nocache\n"); return 0; @@ -240,17 +240,6 @@ #endif - if(sh->format==0x3343414D){ - // MACE 3:1 - sh->ds->ss_div = 2*3; // 1 samples/packet - sh->ds->ss_mul = sh->channels*2*1; // 1 bytes/packet - } else - if(sh->format==0x3643414D){ - // MACE 6:1 - sh->ds->ss_div = 2*6; // 1 samples/packet - sh->ds->ss_mul = sh->channels*2*1; // 1 bytes/packet - } - return 1; // return values: 1=OK 0=ERROR } Modified: mplayerxp/libmpcodecs/ad_twin.c =================================================================== --- mplayerxp/libmpcodecs/ad_twin.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpcodecs/ad_twin.c 2012-10-25 14:45:04 UTC (rev 204) @@ -274,7 +274,7 @@ sh_audio->samplesize=4; sh_audio->sample_format=AFMT_FLOAT32; - if(verbose) + if(mp_conf.verbose) { MSG_V("Input format:\n"); print_wave_header(in_fmt,sizeof(WAVEFORMATEX)); Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-25 14:45:04 UTC (rev 204) @@ -89,7 +89,6 @@ #define MPDEC_THREAD_COND (VF_FLAGS_THREADS|VF_FLAGS_SLICES) static unsigned smp_num_cpus=1; static unsigned use_vf_threads=0; -extern int enable_gomp; extern char *video_codec; int mpcv_init(sh_video_t *sh_video,const char* codecname,const char * vfm,int status){ @@ -168,7 +167,7 @@ sh_video->inited=1; sh_video->vf_flags=vf_query_flags(sh_video->vfilter); #ifdef _OPENMP - if(enable_gomp) { + if(mp_conf.gomp) { smp_num_cpus=omp_get_num_procs(); use_vf_threads=0; if(((sh_video->vf_flags&MPDEC_THREAD_COND)==MPDEC_THREAD_COND) && (smp_num_cpus>1)) use_vf_threads=1; @@ -261,11 +260,11 @@ t2=GetTimer();t=t2-t; tt = t*0.000001f; - video_time_usage+=tt; - if(benchmark || frame_dropping) { - if(tt > max_video_time_usage) max_video_time_usage=tt; - if(tt < min_video_time_usage) min_video_time_usage=tt; - cur_video_time_usage=tt; + time_usage.video+=tt; + if(mp_conf.benchmark || frame_dropping) { + if(tt > time_usage.max_video) time_usage.max_video=tt; + if(tt < time_usage.min_video) time_usage.min_video=tt; + time_usage.cur_video=tt; } if(drop_frame) return 0; @@ -274,12 +273,12 @@ t2=GetTimer()-t2; tt=t2*0.000001f; - vout_time_usage+=tt; - if(benchmark || frame_dropping) + time_usage.vout+=tt; + if(mp_conf.benchmark || frame_dropping) { - if(tt > max_vout_time_usage) max_vout_time_usage = tt; - if(tt < min_vout_time_usage) min_vout_time_usage = tt; - cur_vout_time_usage=tt; + if(tt > time_usage.max_vout) time_usage.max_vout = tt; + if(tt < time_usage.min_vout) time_usage.min_vout = tt; + time_usage.cur_vout=tt; } return 1; Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpcodecs/vd.c 2012-10-25 14:45:04 UTC (rev 204) @@ -131,7 +131,7 @@ if(out_fmt==0xFFFFFFFF) continue; flags=vf_query_format(vf,out_fmt,w,h); MSG_DBG2("vo_debug[step i=%d]: query(%s %ix%i) returned 0x%X for:\n",i,vo_format_name(out_fmt),w,h,flags); - if(verbose>1) if(verbose) vf_showlist(vf); + if(mp_conf.verbose>1) if(mp_conf.verbose) vf_showlist(vf); if((flags&VFCAP_CSP_SUPPORTED_BY_HW) || ((flags&VFCAP_CSP_SUPPORTED) && j<0)){ // check (query) if codec really support this outfmt... sh->outfmtidx=j; // pass index to the control() function this way Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-10-25 14:45:04 UTC (rev 204) @@ -5,7 +5,8 @@ #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "mp_config.h" -#include "../dec_ahead.h" +#include "mplayer.h" +#include "dec_ahead.h" #ifdef HAVE_GOMP #include <omp.h> #endif @@ -74,7 +75,6 @@ #include "libavcodec/avcodec.h" #include "libvo/video_out.h" -extern int enable_gomp; extern char *npp_options; static int vcodec_inited=0; @@ -361,7 +361,7 @@ #ifdef _OPENMP /* Note: Slices have effect on UNI-processor machines only */ - if(enable_ffslices && omp_get_num_procs()>1 && enable_gomp) enable_ffslices=0; + if(enable_ffslices && omp_get_num_procs()>1 && mp_conf.gomp) enable_ffslices=0; #endif if(vdff_ctx->lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND && enable_ffslices) vdff_ctx->cap_slices=1; /* enable DR1 method */ Modified: mplayerxp/libmpcodecs/vd_qtvideo.c =================================================================== --- mplayerxp/libmpcodecs/vd_qtvideo.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpcodecs/vd_qtvideo.c 2012-10-25 14:45:04 UTC (rev 204) @@ -123,7 +123,7 @@ Component prev=NULL; CodecInfo cinfo; // for ImageCodecGetCodecInfo() ImageSubCodecDecompressCapabilities icap; // for ImageCodecInitialize() - if(stream_cache_size) + if(mp_conf.s_cache_size) { MSG_FATAL("Disabling video:\nwin32 quicktime DLLs must be initialized in single-threaded mode! Try -nocache\n"); return 0; Modified: mplayerxp/libmpcodecs/vd_vfw.c =================================================================== --- mplayerxp/libmpcodecs/vd_vfw.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpcodecs/vd_vfw.c 2012-10-25 14:45:04 UTC (rev 204) @@ -150,7 +150,7 @@ if(sh_video->codec->outflags[sh_video->outfmtidx] & CODECS_FLAG_YUVHACK) priv->o_bih->biCompression = 0; - if(verbose) + if(mp_conf.verbose) { MSG_V("Starting decompression, format:\n"); print_video_header(sh_video->bih,sizeof(BITMAPINFOHEADER)); Modified: mplayerxp/libmpdemux/asf_mmst_streaming.c =================================================================== --- mplayerxp/libmpdemux/asf_mmst_streaming.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/asf_mmst_streaming.c 2012-10-25 14:45:04 UTC (rev 204) @@ -14,7 +14,8 @@ #include <errno.h> #include <inttypes.h> -#include "../mp_config.h" +#include "mp_config.h" +#include "mplayer.h" #include "tcp.h" #include "url.h" @@ -44,9 +45,6 @@ #endif #include "demux_msg.h" -extern int audio_id; -extern int video_id; - #define BUF_SIZE 102400 #define HDR_BUF_SIZE 8192 #define MAX_STREAMS 20 @@ -615,11 +613,11 @@ memset (data, 0, 40); - if (audio_id > 0) { + if (mp_conf.audio_id > 0) { data[2] = 0xFF; data[3] = 0xFF; - data[4] = audio_id; - send_command(s, 0x33, num_stream_ids, 0xFFFF | audio_id << 16, 8, data); + data[4] = mp_conf.audio_id; + send_command(s, 0x33, num_stream_ids, 0xFFFF | mp_conf.audio_id << 16, 8, data); } else { for (i=1; i<num_stream_ids; i++) { data [ (i-1) * 6 + 2 ] = 0xFF; Modified: mplayerxp/libmpdemux/asf_streaming.c =================================================================== --- mplayerxp/libmpdemux/asf_streaming.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/asf_streaming.c 2012-10-25 14:45:04 UTC (rev 204) @@ -408,26 +408,26 @@ return -1; } - if (audio_id > 0) + if (mp_conf.audio_id > 0) // a audio stream was forced - asf_ctrl->audio_id = audio_id; + asf_ctrl->audio_id = mp_conf.audio_id; else if (a_idx >= 0) asf_ctrl->audio_id = asf_ctrl->audio_streams[a_idx]; else if (asf_ctrl->n_audio) { MSG_WARN( "bandwidth too small, " "deselected audio stream\n"); - audio_id = -2; + mp_conf.audio_id = -2; } - if (video_id > 0) + if (mp_conf.video_id > 0) // a video stream was forced - asf_ctrl->video_id = video_id; + asf_ctrl->video_id = mp_conf.video_id; else if (v_idx >= 0) asf_ctrl->video_id = asf_ctrl->video_streams[v_idx]; else if (asf_ctrl->n_video) { MSG_WARN( "bandwidth too small, " "deselected video stream\n"); - video_id = -2; + mp_conf.video_id = -2; } return 1; @@ -801,7 +801,7 @@ } http_response_append( http_hdr, buffer, i ); } while( !http_is_header_entire( http_hdr ) ); - if( verbose>0 ) { + if( mp_conf.verbose>0 ) { http_hdr->buffer[http_hdr->buffer_size]='\0'; MSG_DBG2("Response [%s]\n", http_hdr->buffer ); } Modified: mplayerxp/libmpdemux/cache2.c =================================================================== --- mplayerxp/libmpdemux/cache2.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/cache2.c 2012-10-25 14:45:04 UTC (rev 204) @@ -155,7 +155,7 @@ c->packets[cidx].filepos = c->stream->driver->tell(c->stream); c->stream->driver->read(c->stream,&c->packets[cidx].sp); MSG_DBG2("CACHE2: read_packet at %lli (wanted %u got %u type %i)",c->packets[cidx].filepos,c->sector_size,c->packets[cidx].sp.len,c->packets[cidx].sp.type); - if(verbose>1) + if(mp_conf.verbose>1) if(c->packets[cidx].sp.len>8) { int i; @@ -225,7 +225,7 @@ memcpy(&c->packets[i].cp_mutex,&tmpl,sizeof(tmpl)); pmem += sector; } - if(verbose>1) + if(mp_conf.verbose>1) for(i=0;i<num;i++) { MSG_DBG2("sizeof(c)=%u c=%i c->sp.buf=%p\n",sizeof(cache_packet_t),i,c->packets[i].sp.buf); @@ -267,15 +267,15 @@ pinfo[xp_id].thread_name = "cache2"; while(1) { - if(benchmark) t=GetTimer(); + if(mp_conf.benchmark) t=GetTimer(); cfill=c2_cache_fill(c); - if(benchmark) + if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; tt = t*0.000001f; - c2_time_usage+=tt; - if(tt > max_c2_time_usage) max_c2_time_usage=tt; - if(tt < min_c2_time_usage) min_c2_time_usage=tt; + time_usage.c2+=tt; + if(tt > time_usage.max_c2) time_usage.max_c2=tt; + if(tt < time_usage.min_c2) time_usage.min_c2=tt; } if(!cfill) usleep(FILL_USLEEP_TIME); // idle @@ -310,7 +310,7 @@ retval = pthread_attr_setdetachstate(&c->cache2_attr,PTHREAD_CREATE_DETACHED); if(retval) { - if(verbose) printf("running thread: attr_setdetachstate fault!!!\n"); + if(mp_conf.verbose) printf("running thread: attr_setdetachstate fault!!!\n"); return retval; } pthread_attr_setscope(&c->cache2_attr,PTHREAD_SCOPE_SYSTEM); @@ -543,7 +543,7 @@ c->read_filepos+=x; } CACHE2_PACKET_UNLOCK(cur); - if(verbose>2) + if(mp_conf.verbose>2) { int i; MSG_DBG2( "c2_stream_read got %u bytes ",total); Modified: mplayerxp/libmpdemux/cdda.c =================================================================== --- mplayerxp/libmpdemux/cdda.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/cdda.c 2012-10-25 14:45:04 UTC (rev 204) @@ -1,4 +1,5 @@ -#include "../mp_config.h" +#include "mp_config.h" +#include "mplayer.h" #ifdef HAVE_LIBCDIO @@ -81,7 +82,7 @@ priv = (cdda_priv*)malloc(sizeof(cdda_priv)); memset(priv, 0, sizeof(cdda_priv)); - priv->cd = cdio_cddap_identify(dev,verbose?1:0,NULL); + priv->cd = cdio_cddap_identify(dev,mp_conf.verbose?1:0,NULL); if(!priv->cd) { MSG_ERR("Can't open cdda device: %s\n",dev); @@ -89,7 +90,7 @@ return 0; } - cdio_cddap_verbose_set(priv->cd, verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT, verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT); + cdio_cddap_verbose_set(priv->cd, mp_conf.verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT, mp_conf.verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT); if(cdio_cddap_open(priv->cd) != 0) { MSG_ERR("Can't open disc\n"); Modified: mplayerxp/libmpdemux/cddb.c =================================================================== --- mplayerxp/libmpdemux/cddb.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/cddb.c 2012-10-25 14:45:04 UTC (rev 204) @@ -12,7 +12,8 @@ * */ -#include "../mp_config.h" +#include "mp_config.h" +#include "mplayer.h" #if defined(HAVE_LIBCDIO) && defined(HAVE_STREAMING) Modified: mplayerxp/libmpdemux/demux_asf.c =================================================================== --- mplayerxp/libmpdemux/demux_asf.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/demux_asf.c 2012-10-25 14:45:04 UTC (rev 204) @@ -185,7 +185,7 @@ sh_audio->wf=calloc((apriv->streamh.type_size<sizeof(WAVEFORMATEX))?sizeof(WAVEFORMATEX):apriv->streamh.type_size,1); memcpy(sh_audio->wf,buffer,apriv->streamh.type_size); le2me_WAVEFORMATEX(sh_audio->wf); - if(verbose>=1) print_wave_header(sh_audio->wf,apriv->streamh.type_size); + if(mp_conf.verbose>=1) print_wave_header(sh_audio->wf,apriv->streamh.type_size); if(ASF_LOAD_GUID_PREFIX(apriv->streamh.concealment)==ASF_GUID_PREFIX_audio_conceal_interleave){ stream_read(demuxer->stream,(char*) buffer,apriv->streamh.stream_size); apriv->asf_scrambling_h=buffer[0]; @@ -205,7 +205,7 @@ sh_video->bih=calloc((len<sizeof(BITMAPINFOHEADER))?sizeof(BITMAPINFOHEADER):len,1); memcpy(sh_video->bih,&buffer[4+4+1+2],len); le2me_BITMAPINFOHEADER(sh_video->bih); - if(verbose>=1) print_video_header(sh_video->bih,len); + if(mp_conf.verbose>=1) print_video_header(sh_video->bih,len); break; } } Modified: mplayerxp/libmpdemux/demux_audio.c =================================================================== --- mplayerxp/libmpdemux/demux_audio.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/demux_audio.c 2012-10-25 14:45:04 UTC (rev 204) @@ -1354,7 +1354,7 @@ MSG_V("demux_audio: audio data 0x%llX - 0x%llX \n",demuxer->movi_start,demuxer->movi_end); if(stream_tell(s) != demuxer->movi_start) stream_seek(s,demuxer->movi_start); - if(verbose && sh_audio->wf) print_wave_header(sh_audio->wf,sizeof(WAVEFORMATEX)); + if(mp_conf.verbose && sh_audio->wf) print_wave_header(sh_audio->wf,sizeof(WAVEFORMATEX)); if(demuxer->movi_length==UINT_MAX && sh_audio->i_bps) demuxer->movi_length=(unsigned)(((float)demuxer->movi_end-(float)demuxer->movi_start)/(float)sh_audio->i_bps); return demuxer; Modified: mplayerxp/libmpdemux/demux_avi.c =================================================================== --- mplayerxp/libmpdemux/demux_avi.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/demux_avi.c 2012-10-25 14:45:04 UTC (rev 204) @@ -241,7 +241,7 @@ le2me_MainAVIHeader(&avih); // swap to machine endian chunksize-=MIN(size2,sizeof(avih)); demuxer->movi_length=avih.dwTotalFrames; - if(verbose) print_avih(&avih); else print_avih_flags(&avih); + if(mp_conf.verbose) print_avih(&avih); else print_avih_flags(&avih); break; case ckidSTREAMHEADER: { // read 'strh' AVIStreamHeader h; @@ -264,7 +264,7 @@ // demuxer->audio->sh=sh_audio; } last_fccType=h.fccType; - if(verbose>=1) print_strh(&h); + if(mp_conf.verbose>=1) print_strh(&h); break; } case mmioFOURCC('i', 'n', 'd', 'x'): { uint32_t i; @@ -316,7 +316,7 @@ // fixup MS-RLE header (seems to be broken for <256 color files) if(sh_video->bih->biCompression<=1 && sh_video->bih->biSize==40) sh_video->bih->biSize=chunksize; - if(verbose>=1) print_video_header(sh_video->bih,chunksize); + if(mp_conf.verbose>=1) print_video_header(sh_video->bih,chunksize); if(chunksize>0x28 && strncmp((char *)&sh_video->bih->biCompression,"MPGI",4) == 0) sh_video->aspect=get_avi_aspect(*(((char *)sh_video->bih)+0x28)); chunksize=0; @@ -373,7 +373,7 @@ sh_audio->wf=realloc(sh_audio->wf, sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize); } chunksize=0; - if(verbose>=1) print_wave_header(sh_audio->wf,wf_size); + if(mp_conf.verbose>=1) print_wave_header(sh_audio->wf,wf_size); ++priv->audio_streams; // if(demuxer->audio->id==-1) demuxer->audio->id=stream_id; } @@ -396,7 +396,7 @@ if (sh_video) { sh_video->aspect = GET_AVI_ASPECT(vprp->dwFrameAspectRatio); } - if(verbose>=1) print_vprp(vprp); + if(mp_conf.verbose>=1) print_vprp(vprp); free(vprp); break; } @@ -429,7 +429,7 @@ entry->dwFlags&=0xffff; } chunksize-=priv->idx_size<<4; - if(verbose>=2) print_index(priv->idx,priv->idx_size); + if(mp_conf.verbose>=2) print_index(priv->idx,priv->idx_size); } break; /* added May 2002 */ @@ -600,7 +600,7 @@ } } - if (verbose>=2) print_index(priv->idx, priv->idx_size); + if (mp_conf.verbose>=2) print_index(priv->idx, priv->idx_size); demuxer->movi_end=demuxer->stream->end_pos; @@ -729,7 +729,7 @@ } priv->idx_size=priv->idx_pos; MSG_INFO("Indexed are generated for %ul chunks\n",priv->idx_size); - if(verbose>=2) print_index(priv->idx,priv->idx_size); + if(mp_conf.verbose>=2) print_index(priv->idx,priv->idx_size); #if 0 /* Write generated index to a file */ Modified: mplayerxp/libmpdemux/demux_lavf.c =================================================================== --- mplayerxp/libmpdemux/demux_lavf.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/demux_lavf.c 2012-10-25 14:45:04 UTC (rev 204) @@ -330,7 +330,7 @@ default: break; } - if(verbose>=1) print_wave_header(sh_audio->wf); + if(mp_conf.verbose>=1) print_wave_header(sh_audio->wf); if(demuxer->audio->id != i && demuxer->audio->id != -1) st->discard= AVDISCARD_ALL; else{ @@ -376,7 +376,7 @@ sh_video->ds= demuxer->video; if(codec->extradata_size) memcpy(sh_video->bih + 1, codec->extradata, codec->extradata_size); - if(verbose>=1) print_video_header(sh_video->bih); + if(mp_conf.verbose>=1) print_video_header(sh_video->bih); /* short biPlanes; int biXPelsPerMeter; int biYPelsPerMeter; Modified: mplayerxp/libmpdemux/demux_mkv.c =================================================================== --- mplayerxp/libmpdemux/demux_mkv.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/demux_mkv.c 2012-10-25 14:45:04 UTC (rev 204) @@ -6,7 +6,8 @@ * Licence: GPL */ #define USE_QTX_CODECS 1 -#include "../mp_config.h" +#include "mp_config.h" +#include "mplayer.h" #include <stdlib.h> #include <stdio.h> @@ -574,11 +575,6 @@ #define RAPROPERTIES4_SIZE 56 #define RAPROPERTIES5_SIZE 70 -/* for e.g. "-slang ger" */ -extern char *dvdsub_lang; -extern char *audio_lang; -extern int dvdsub_id; - /** * \brief ensures there is space for at least one additional element * \param array array to grow @@ -2885,8 +2881,8 @@ if (demuxer->audio->id == -1) /* automatically select an audio track */ { /* check if the user specified an audio language */ - if (audio_lang != NULL) - track = demux_mkv_find_track_by_language(mkv_d, audio_lang, + if (mp_conf.audio_lang != NULL) + track = demux_mkv_find_track_by_language(mkv_d, mp_conf.audio_lang, MATROSKA_TRACK_AUDIO); if (track == NULL) /* no audio language specified, or language not found */ @@ -2948,14 +2944,14 @@ if (demuxer->sub->id >= 0) track = demux_mkv_find_track_by_num (mkv_d, demuxer->sub->id, MATROSKA_TRACK_SUBTITLE); - else if (dvdsub_lang != NULL) - track = demux_mkv_find_track_by_language (mkv_d, dvdsub_lang, + else if (mp_conf.dvdsub_lang != NULL) + track = demux_mkv_find_track_by_language (mkv_d, mp_conf.dvdsub_lang, MATROSKA_TRACK_SUBTITLE); if (track) { MSG_V("[mkv] Will display subtitle track %u.\n", track->tnum); - dvdsub_id = demux_mkv_reverse_id(mkv_d, track->tnum, MATROSKA_TRACK_SUBTITLE); + mp_conf.dvdsub_id = demux_mkv_reverse_id(mkv_d, track->tnum, MATROSKA_TRACK_SUBTITLE); #if 0 mkv_d->sh_sub->id = track->tnum; mkv_d->sh_sub->sh = demuxer->s_streams[track->tnum]; Modified: mplayerxp/libmpdemux/demux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-25 14:45:04 UTC (rev 204) @@ -219,7 +219,7 @@ sh->bih=malloc(fsize<sizeof(BITMAPINFOHEADER)?sizeof(BITMAPINFOHEADER):fsize); stream_read(s,(char *)sh->bih,fsize); le2me_BITMAPINFOHEADER(sh->bih); - if(verbose>=1) print_video_header(sh->bih,fsize); + if(mp_conf.verbose>=1) print_video_header(sh->bih,fsize); have_bih=1; if(demuxer->video->id==-1) demuxer->video->id=id; /* TODO: select best */ demuxer->video->sh=sh; @@ -245,7 +245,7 @@ le2me_VideoPropHeader(&vprp); le2me_VIDEO_FIELD_DESC(&vprp.FieldInfo[0]); le2me_VIDEO_FIELD_DESC(&vprp.FieldInfo[1]); - if(verbose) print_vprp(&vprp); + if(mp_conf.verbose) print_vprp(&vprp); if(fsize>sizeof(VideoPropHeader)) stream_skip(s,fsize-sizeof(VideoPropHeader)); sh->aspect=GET_AVI_ASPECT(vprp.dwFrameAspectRatio); } @@ -295,7 +295,7 @@ sh->wf=malloc(fsize<sizeof(WAVEFORMATEX)?sizeof(WAVEFORMATEX):fsize); stream_read(s,(char *)sh->wf,fsize); le2me_WAVEFORMATEX(sh->wf); - if(verbose>=1) print_wave_header(sh->wf,fsize); + if(mp_conf.verbose>=1) print_wave_header(sh->wf,fsize); have_wf=1; if(demuxer->audio->id==-1) demuxer->audio->id=id; /* TODO: select best */ demuxer->audio->sh=sh; @@ -338,7 +338,7 @@ /* Read stream properties */ stream_read(s,(char *)&priv->sprop[id],sizeof(mpxpav64StreamProperties_t)); le2me_mpxpav64StreamProperties(&priv->sprop[id]); - if(verbose) + if(mp_conf.verbose) { char mime[priv->sprop[id].mimetype_len+1]; stream_read(s,mime,priv->sprop[id].mimetype_len); @@ -498,7 +498,7 @@ MSG_ERR("Too many (%i) streams. Max available=%i\n",priv->nstreams,MAX_AV_STREAMS); goto open_failed; } - if(verbose) print_FileProp(&priv->fprop); + if(mp_conf.verbose) print_FileProp(&priv->fprop); stream_skip(s,fsize-sizeof(mpxpav64FileProperties_t)); if((priv->fprop.flags&(~MPXPAV64_FP_FCNT_UTF32))!=0ULL) { @@ -578,7 +578,7 @@ off_t pos=0LL; demux_packet_t* dp; dp=new_demux_packet(len); - if(verbose>1) pos=stream_tell(s); + if(mp_conf.verbose>1) pos=stream_tell(s); len=stream_read(s,dp->buffer,len); resize_demux_packet(dp,len); dp->pts=pts; @@ -848,7 +848,7 @@ { if(mpxpav64_sync(demuxer)) { - if(verbose) MSG_V("MPXPAV64_SEEK: newpos after sync %016llX\n",stream_tell(demuxer->stream)); + if(mp_conf.verbose) MSG_V("MPXPAV64_SEEK: newpos after sync %016llX\n",stream_tell(demuxer->stream)); mpxpav64_reset_prevs(demuxer); mpca_resync_stream(demuxer->audio->sh); } Modified: mplayerxp/libmpdemux/demux_ogg.c =================================================================== --- mplayerxp/libmpdemux/demux_ogg.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/demux_ogg.c 2012-10-25 14:45:04 UTC (rev 204) @@ -474,7 +474,7 @@ ogg_d->text_langs[index] = strdup(val); } // check for -slang if subs are uninitialized yet - if (os->text && d->sub->id == -1 && demux_ogg_check_lang(val, dvdsub_lang)) + if (os->text && d->sub->id == -1 && demux_ogg_check_lang(val, mp_conf.dvdsub_lang)) { d->sub->id = id; #if 0 @@ -858,7 +858,7 @@ inf.width, inf.height, sh_v->fps, inf.aspect_numerator, inf.aspect_denominator); - if(verbose>0) print_video_header(sh_v->bih,sizeof(BITMAPINFOHEADER)); + if(mp_conf.verbose>0) print_video_header(sh_v->bih,sizeof(BITMAPINFOHEADER)); } } #endif @@ -895,7 +895,7 @@ ogg_d->subs[ogg_d->num_sub].id = n_video; n_video++; MSG_V("Ogg stream %d is video (old hdr)\n",ogg_d->num_sub); - if(verbose>0) print_video_header(sh_v->bih,sizeof(BITMAPINFOHEADER)); + if(mp_conf.verbose>0) print_video_header(sh_v->bih,sizeof(BITMAPINFOHEADER)); // Old audio header } else if(get_uint32(pack.packet+96) == 0x05589F81) { unsigned int extra_size; @@ -917,7 +917,7 @@ ogg_d->subs[ogg_d->num_sub].id = n_audio; n_audio++; MSG_V("Ogg stream %d is audio (old hdr)\n",ogg_d->num_sub); - if(verbose>0) print_wave_header(sh_a->wf,sizeof(WAVEFORMATEX)+extra_size); + if(mp_conf.verbose>0) print_wave_header(sh_a->wf,sizeof(WAVEFORMATEX)+extra_size); } else MSG_WARN("Ogg stream %d contains an old header but the header type is unknown\n",ogg_d->num_sub); @@ -946,7 +946,7 @@ ogg_d->subs[ogg_d->num_sub].id = n_video; n_video++; MSG_V("Ogg stream %d is video (new hdr)\n",ogg_d->num_sub); - if(verbose>0) print_video_header(sh_v->bih,sizeof(BITMAPINFOHEADER)); + if(mp_conf.verbose>0) print_video_header(sh_v->bih,sizeof(BITMAPINFOHEADER)); /// New audio header } else if(strncmp(st->streamtype,"audio",5) == 0) { char buffer[5]; @@ -970,7 +970,7 @@ ogg_d->subs[ogg_d->num_sub].id = n_audio; n_audio++; MSG_V("Ogg stream %d is audio (new hdr)\n",ogg_d->num_sub); - if(verbose>0) print_wave_header(sh_a->wf,sizeof(WAVEFORMATEX)+extra_size); + if(mp_conf.verbose>0) print_wave_header(sh_a->wf,sizeof(WAVEFORMATEX)+extra_size); /// Check for text (subtitles) header } else if (strncmp(st->streamtype, "text", 4) == 0) { Modified: mplayerxp/libmpdemux/demux_real.c =================================================================== --- mplayerxp/libmpdemux/demux_real.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/demux_real.c 2012-10-25 14:45:04 UTC (rev 204) @@ -120,7 +120,7 @@ real_index_table_t *index; int i, entries; - if (verbose<=1) + if (mp_conf.verbose<=1) return; if (stream_id > MAX_STREAMS) @@ -358,7 +358,7 @@ if(pict_type<=1){ // I frame, sync timestamps: priv->kf_base=timestamp-kf; - if(verbose>1) MSG_DBG2("\nTS: base=%08X\n",priv->kf_base); + if(mp_conf.verbose>1) MSG_DBG2("\nTS: base=%08X\n",priv->kf_base); kf=timestamp; } else { // P/B frame, merge timestamps: @@ -1152,7 +1152,7 @@ sh->wf->wFormatTag = sh->format; - if (verbose > 0) + if (mp_conf.verbose > 0) print_wave_header(sh->wf,sizeof(WAVEFORMATEX)); /* Select audio stream with highest bitrate if multirate file*/ Modified: mplayerxp/libmpdemux/demux_ts.c =================================================================== --- mplayerxp/libmpdemux/demux_ts.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/demux_ts.c 2012-10-25 14:45:04 UTC (rev 204) @@ -970,17 +970,17 @@ params.prog = ts_prog; params.probe = _ts_probe; - if(dvdsub_lang != NULL) + if(mp_conf.dvdsub_lang != NULL) { - strncpy(params.slang, dvdsub_lang, 3); + strncpy(params.slang, mp_conf.dvdsub_lang, 3); params.slang[3] = 0; } else memset(params.slang, 0, 4); - if(audio_lang != NULL) + if(mp_conf.audio_lang != NULL) { - strncpy(params.alang, audio_lang, 3); + strncpy(params.alang, mp_conf.audio_lang, 3); params.alang[3] = 0; } else @@ -2786,10 +2786,10 @@ int asgn = 0; uint8_t *lang; - if(dvdsub_lang) + if(mp_conf.dvdsub_lang) { if ((lang = pid_lang_from_pmt(priv, pid))) - asgn = (strncmp(lang, dvdsub_lang, 3) == 0); + asgn = (strncmp(lang, mp_conf.dvdsub_lang, 3) == 0); } else //no language specified with -slang asgn = 1; Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/demuxer.c 2012-10-25 14:45:04 UTC (rev 204) @@ -309,7 +309,7 @@ int ds_fill_buffer(demux_stream_t *ds){ demuxer_t *demux=ds->demuxer; if(ds->buffer) free(ds->buffer); - if(verbose>2){ + if(mp_conf.verbose>2){ if(ds==demux->audio) MSG_DBG3("ds_fill_buffer(d_audio) called\n"); else Modified: mplayerxp/libmpdemux/demuxer_r.c =================================================================== --- mplayerxp/libmpdemux/demuxer_r.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/demuxer_r.c 2012-10-25 14:45:04 UTC (rev 204) @@ -62,18 +62,18 @@ unsigned int t2=0; double tt; LOCK_DEMUXER(); - if(benchmark) t=GetTimer(); + if(mp_conf.benchmark) t=GetTimer(); retval = demux_getc(ds); *pts=get_ds_stream_pts(ds,1); if(initial_audio_pts == HUGE) initial_audio_pts=*pts; - if(benchmark) + if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; tt = t*0.000001f; - demux_time_usage+=tt; - audio_decode_time_usage_correction=tt; - if(tt > max_demux_time_usage) max_demux_time_usage=tt; - if(tt < min_demux_time_usage) min_demux_time_usage=tt; + time_usage.demux+=tt; + time_usage.audio_decode_correction=tt; + if(tt > time_usage.max_demux) time_usage.max_demux=tt; + if(tt < time_usage.min_demux) time_usage.min_demux=tt; } UNLOCK_DEMUXER(); return retval; @@ -86,15 +86,15 @@ unsigned int t2=0; double tt; LOCK_DEMUXER(); - if(benchmark) t=GetTimer(); + if(mp_conf.benchmark) t=GetTimer(); retval = video_read_frame(sh_video,frame_time_ptr,v_pts,start,force_fps); - if(benchmark) + if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; tt = t*0.000001f; - demux_time_usage+=tt; - if(tt > max_demux_time_usage) max_demux_time_usage=tt; - if(tt < min_demux_time_usage) min_demux_time_usage=tt; + time_usage.demux+=tt; + if(tt > time_usage.max_demux) time_usage.max_demux=tt; + if(tt < time_usage.min_demux) time_usage.min_demux=tt; } UNLOCK_DEMUXER(); return retval; @@ -107,18 +107,18 @@ unsigned int t2=0; double tt; LOCK_DEMUXER(); - if(benchmark) t=GetTimer(); + if(mp_conf.benchmark) t=GetTimer(); retval = demux_read_data(ds,mem,len); *pts=get_ds_stream_pts(ds,retval); if(initial_audio_pts == HUGE) initial_audio_pts=*pts; - if(benchmark) + if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; tt = t*0.000001f; - demux_time_usage+=tt; - audio_decode_time_usage_correction=tt; - if(tt > max_demux_time_usage) max_demux_time_usage=tt; - if(tt < min_demux_time_usage) min_demux_time_usage=tt; + time_usage.demux+=tt; + time_usage.audio_decode_correction=tt; + if(tt > time_usage.max_demux) time_usage.max_demux=tt; + if(tt < time_usage.min_demux) time_usage.min_demux=tt; } UNLOCK_DEMUXER(); return retval; @@ -131,18 +131,18 @@ unsigned int t2=0; double tt; LOCK_DEMUXER(); - if(benchmark) t=GetTimer(); + if(mp_conf.benchmark) t=GetTimer(); retval = ds_get_packet(ds,start); *pts=get_ds_stream_pts(ds,retval); if(initial_audio_pts == HUGE) initial_audio_pts=*pts; - if(benchmark) + if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; tt = t*0.000001f; - demux_time_usage+=tt; - audio_decode_time_usage_correction=tt; - if(tt > max_demux_time_usage) max_demux_time_usage=tt; - if(tt < min_demux_time_usage) min_demux_time_usage=tt; + time_usage.demux+=tt; + time_usage.audio_decode_correction=tt; + if(tt > time_usage.max_demux) time_usage.max_demux=tt; + if(tt < time_usage.min_demux) time_usage.min_demux=tt; } UNLOCK_DEMUXER(); return retval; @@ -164,15 +164,15 @@ unsigned int t2=0; double tt; LOCK_DEMUXER(); - if(benchmark) t=GetTimer(); + if(mp_conf.benchmark) t=GetTimer(); retval = demux_seek(demuxer,seeka); - if(benchmark) + if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; tt = t*0.000001f; - demux_time_usage+=tt; - if(tt > max_demux_time_usage) max_demux_time_usage=tt; - if(tt < min_demux_time_usage) min_demux_time_usage=tt; + time_usage.demux+=tt; + if(tt > time_usage.max_demux) time_usage.max_demux=tt; + if(tt < time_usage.min_demux) time_usage.min_demux=tt; } UNLOCK_DEMUXER(); return retval; Modified: mplayerxp/libmpdemux/librtsp/rtsp.c =================================================================== --- mplayerxp/libmpdemux/librtsp/rtsp.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/librtsp/rtsp.c 2012-10-25 14:45:04 UTC (rev 204) @@ -33,6 +33,7 @@ #include <stdio.h> #include <assert.h> #include "mp_config.h" +#include "mplayer.h" #ifndef HAVE_WINSOCK2 #define closesocket close #include <sys/socket.h> Modified: mplayerxp/libmpdemux/librtsp/rtsp_rtp.c =================================================================== --- mplayerxp/libmpdemux/librtsp/rtsp_rtp.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/librtsp/rtsp_rtp.c 2012-10-25 14:45:04 UTC (rev 204) @@ -27,6 +27,7 @@ #include <inttypes.h> #include "mp_config.h" +#include "mplayer.h" #ifndef HAVE_WINSOCK2 #include <netdb.h> Modified: mplayerxp/libmpdemux/librtsp/rtsp_session.c =================================================================== --- mplayerxp/libmpdemux/librtsp/rtsp_session.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/librtsp/rtsp_session.c 2012-10-25 14:45:04 UTC (rev 204) @@ -30,6 +30,7 @@ #include <sys/types.h> #include "mp_config.h" +#include "mplayer.h" #ifndef HAVE_WINSOCK2 #include <sys/socket.h> #include <netinet/in.h> Modified: mplayerxp/libmpdemux/network.c =================================================================== --- mplayerxp/libmpdemux/network.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/network.c 2012-10-25 14:45:04 UTC (rev 204) @@ -442,7 +442,7 @@ } *fd_out=fd; - if( verbose ) { + if( mp_conf.verbose ) { http_debug_hdr( http_hdr ); } @@ -696,13 +696,13 @@ void fixup_network_stream_cache(stream_t *stream) { if(stream->streaming_ctrl->buffering) { - if(stream_cache_size<0) { + if(mp_conf.s_cache_size<0) { // cache option not set, will use our computed value. // buffer in KBytes, *5 because the prefill is 20% of the buffer. - stream_cache_size = (stream->streaming_ctrl->prebuffer_size/1024)*5; - if( stream_cache_size<64 ) stream_cache_size = 64; // 16KBytes min buffer + mp_conf.s_cache_size = (stream->streaming_ctrl->prebuffer_size/1024)*5; + if( mp_conf.s_cache_size<64 ) mp_conf.s_cache_size = 64; // 16KBytes min buffer } - MSG_INFO("[network] cache size set to: %i\n", stream_cache_size); + MSG_INFO("[network] cache size set to: %i\n", mp_conf.s_cache_size); } } @@ -976,13 +976,13 @@ streaming_ctrl_free( stream->streaming_ctrl ); stream->streaming_ctrl = NULL; } else if( stream->streaming_ctrl->buffering ) { - if(stream_cache_size<0) { + if(mp_conf.s_cache_size<0) { // cache option not set, will use our computed value. // buffer in KBytes, *5 because the prefill is 20% of the buffer. - stream_cache_size = (stream->streaming_ctrl->prebuffer_size/1024)*5; - if( stream_cache_size<64 ) stream_cache_size = 64; // 16KBytes min buffer + mp_conf.s_cache_size = (stream->streaming_ctrl->prebuffer_size/1024)*5; + if( mp_conf.s_cache_size<64 ) mp_conf.s_cache_size = 64; // 16KBytes min buffer } - MSG_INFO("Cache size set to %d KBytes\n", stream_cache_size); + MSG_INFO("Cache size set to %d KBytes\n", mp_conf.s_cache_size); } return ret; Modified: mplayerxp/libmpdemux/realrtsp/asmrp.c =================================================================== --- mplayerxp/libmpdemux/realrtsp/asmrp.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/realrtsp/asmrp.c 2012-10-25 14:45:04 UTC (rev 204) @@ -42,6 +42,7 @@ #include <string.h> #include "asmrp.h" #include "../demux_msg.h" +#include "mplayer.h" /* #define LOG Modified: mplayerxp/libmpdemux/realrtsp/real.c =================================================================== --- mplayerxp/libmpdemux/realrtsp/real.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/realrtsp/real.c 2012-10-25 14:45:04 UTC (rev 204) @@ -30,8 +30,9 @@ #include <stdio.h> #include <string.h> -#include "../../mp_config.h" -#include "../../bswap.h" +#include "mp_config.h" +#include "mplayer.h" +#include "bswap.h" //#include "libavutil/common.h" #include "real.h" #include "asmrp.h" Modified: mplayerxp/libmpdemux/realrtsp/rmff.c =================================================================== --- mplayerxp/libmpdemux/realrtsp/rmff.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/realrtsp/rmff.c 2012-10-25 14:45:04 UTC (rev 204) @@ -28,7 +28,8 @@ #include "rmff.h" #include "xbuffer.h" -#include "../../bswap.h" +#include "bswap.h" +#include "mplayer.h" #include "md5.h" #include "../demux_msg.h" Modified: mplayerxp/libmpdemux/realrtsp/sdpplin.c =================================================================== --- mplayerxp/libmpdemux/realrtsp/sdpplin.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/realrtsp/sdpplin.c 2012-10-25 14:45:04 UTC (rev 204) @@ -27,6 +27,7 @@ */ #include "mp_config.h" +#include "mplayer.h" #include "../librtsp/rtsp.h" #include "sdpplin.h" #include "xbuffer.h" Modified: mplayerxp/libmpdemux/realrtsp/xbuffer.c =================================================================== --- mplayerxp/libmpdemux/realrtsp/xbuffer.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/realrtsp/xbuffer.c 2012-10-25 14:45:04 UTC (rev 204) @@ -13,6 +13,8 @@ * */ +#include "mplayer.h" + #include <stdlib.h> #include <string.h> #include <inttypes.h> Modified: mplayerxp/libmpdemux/s_cdd.c =================================================================== --- mplayerxp/libmpdemux/s_cdd.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/s_cdd.c 2012-10-25 14:45:04 UTC (rev 204) @@ -1,7 +1,9 @@ /* s_cdd - cdda & cddb streams interface */ -#include "../mp_config.h" +#include "mp_config.h" +#include "mplayer.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> Modified: mplayerxp/libmpdemux/s_dvdnav.c =================================================================== --- mplayerxp/libmpdemux/s_dvdnav.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/s_dvdnav.c 2012-10-25 14:45:04 UTC (rev 204) @@ -100,7 +100,7 @@ } /* turn on/off dvdnav caching */ - dvdnav_set_readahead_flag(dvdnav_priv->dvdnav,stream_cache_size?0:1); + dvdnav_set_readahead_flag(dvdnav_priv->dvdnav,mp_conf.s_cache_size?0:1); /* report the title?! */ if (dvdnav_get_title_string(dvdnav_priv->dvdnav,&title_str)==DVDNAV_STATUS_OK) { @@ -220,7 +220,7 @@ dvd_ok: if(dvd_device) free(dvd_device); ((dvdnav_priv_t *)stream->priv)->started=1; - if(stream_cache_size) + if(mp_conf.s_cache_size) { tevent = malloc(sizeof(dvdnav_event_t)); if(tevent) @@ -511,11 +511,11 @@ stream_change->physical_letterbox, stream_change->physical_pan_scan, stream_change->logical); - if (vo_data->spudec && dvdsub_id!=stream_change->physical_wide) { + if (vo_data->spudec && mp_conf.dvdsub_id!=stream_change->physical_wide) { MSG_DBG2("d_dvdsub->id change: was %d is now %d\n", d_dvdsub->id,stream_change->physical_wide); // FIXME: need a better way to change SPU id - d_dvdsub->id=dvdsub_id=stream_change->physical_wide; + d_dvdsub->id=mp_conf.dvdsub_id=stream_change->physical_wide; if (vo_data->spudec) spudec_reset(vo_data->spudec); } break; @@ -529,11 +529,11 @@ stream_change->logical); aid_temp=stream_change->physical; if (aid_temp>=0) aid_temp+=128; // FIXME: is this sane? - if (d_audio && audio_id!=aid_temp) { + if (d_audio && mp_conf.audio_id!=aid_temp) { MSG_DBG2("d_audio->id change: was %d is now %d\n", d_audio->id,aid_temp); // FIXME: need a bettery way to change audio stream id - d_audio->id=dvdsub_id=aid_temp; + d_audio->id=mp_conf.dvdsub_id=aid_temp; mpxp_resync_audio_stream(); } break; Modified: mplayerxp/libmpdemux/s_dvdread.c =================================================================== --- mplayerxp/libmpdemux/s_dvdread.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/s_dvdread.c 2012-10-25 14:45:04 UTC (rev 204) @@ -2,7 +2,8 @@ s_dvdread - DVDREAD stream interface */ -#include "../mp_config.h" +#include "mp_config.h" +#include "mplayer.h" #ifdef USE_DVDREAD #include <stdlib.h> #include <string.h> Modified: mplayerxp/libmpdemux/s_ffmpeg.c =================================================================== --- mplayerxp/libmpdemux/s_ffmpeg.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/s_ffmpeg.c 2012-10-25 14:45:04 UTC (rev 204) @@ -1,4 +1,5 @@ -#include "../mp_config.h" +#include "mp_config.h" +#include "mplayer.h" #include <dlfcn.h> #include "libavformat/avformat.h" Modified: mplayerxp/libmpdemux/s_file.c =================================================================== --- mplayerxp/libmpdemux/s_file.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/s_file.c 2012-10-25 14:45:04 UTC (rev 204) @@ -36,7 +36,7 @@ /* decreasing number of packet from 256 to 10 speedups cache2 from 3.27% to 1.26% with full speed 1.04% for -nocache */ /* Note: Please locate sector_size changinf after all read/write operations of open() function */ - stream->sector_size=stream_cache_size?stream_cache_size*1024/10:STREAM_BUFFER_SIZE; + stream->sector_size=mp_conf.s_cache_size?mp_conf.s_cache_size*1024/10:STREAM_BUFFER_SIZE; ((file_priv_t*)stream->priv)->spos = 0; return 1; } Modified: mplayerxp/libmpdemux/s_tv.c =================================================================== --- mplayerxp/libmpdemux/s_tv.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/s_tv.c 2012-10-25 14:45:04 UTC (rev 204) @@ -11,7 +11,8 @@ to add support for audio, and bktr *BSD support. */ -#include "../mp_config.h" +#include "mp_config.h" +#include "mplayer.h" #ifdef USE_TV #include <stdlib.h> #include <string.h> Modified: mplayerxp/libmpdemux/s_vcdnav.c =================================================================== --- mplayerxp/libmpdemux/s_vcdnav.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/s_vcdnav.c 2012-10-25 14:45:04 UTC (rev 204) @@ -74,8 +74,8 @@ if(param) vcd_track=atoi(param); priv=stream->priv=calloc(1,sizeof(vcd_priv_t)); // vcdinfo_init(priv->fd); - if(verbose>1) vcd_loglevel_default=VCD_LOG_DEBUG; - else if(verbose) vcd_loglevel_default=VCD_LOG_INFO; + if(mp_conf.verbose>1) vcd_loglevel_default=VCD_LOG_DEBUG; + else if(mp_conf.verbose) vcd_loglevel_default=VCD_LOG_INFO; open_rc=vcdinfo_open(&priv->fd,&device,DRIVER_UNKNOWN,NULL); if(!priv->fd) { Modified: mplayerxp/libmpdemux/url.c =================================================================== --- mplayerxp/libmpdemux/url.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpdemux/url.c 2012-10-25 14:45:04 UTC (rev 204) @@ -14,6 +14,7 @@ #include "url.h" #include "help_mp.h" #include "demux_msg.h" +#include "mplayer.h" #ifndef SIZE_MAX #define SIZE_MAX ((size_t)-1) Modified: mplayerxp/libmpsub/vobsub.c =================================================================== --- mplayerxp/libmpsub/vobsub.c 2012-10-25 09:12:05 UTC (rev 203) +++ mplayerxp/libmpsub/vobsub.c 2012-10-25 14:45:04 UTC (rev 204) @@ -453,7 +453,7 @@ memcpy(vob->spu_streams[index].id, id, idlen); } vob->spu_streams_current = index; - if (verbose) + if (mp_conf.verbose) MSG_ERR( "[vobsub] subtitle (vobsubid): %d language %s\n", index, vob->spu_streams[index].id); return 0; @@ -726,8 +726,8 @@ static int __FASTCALL__ vobsub_set_lang(vobsub_t *vob, const ch... [truncated message content] |
From: <nic...@us...> - 2012-10-26 08:26:13
|
Revision: 213 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=213&view=rev Author: nickols_k Date: 2012-10-26 08:26:02 +0000 (Fri, 26 Oct 2012) Log Message: ----------- remove incompatible with XP-mode sh_video->timer Modified Paths: -------------- mplayerxp/dec_ahead.c mplayerxp/dump.c mplayerxp/libao2/ao_wav.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpdemux/demux_rawvideo.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/stheader.h mplayerxp/libvo/video_out.h mplayerxp/mplayer.c Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-26 07:04:22 UTC (rev 212) +++ mplayerxp/dec_ahead.c 2012-10-26 08:26:02 UTC (rev 213) @@ -168,7 +168,6 @@ int xp_is_bad_pts=0; -extern vo_data_t* vo_data; /* this routine decodes video+audio but intends to be video only */ static void show_warn_cant_sync(float max_frame_delay) { @@ -181,7 +180,7 @@ "*********************************************\n" "Try increase number of buffer for decoding ahead\n" "Exist: %u, need: %u\n" - ,xp_num_frames,(unsigned)(max_frame_delay*3*vo_data->fps)+3); + ,xp_num_frames,(unsigned)(max_frame_delay*3*sh_video->fps)+3); prev_warn_delay=max_frame_delay; } } @@ -209,7 +208,7 @@ */ delta=v_pts-xp_screen_pts; if(max_frame_delay*3 > drop_barrier) { - if(drop_barrier < (float)(xp_num_frames-2)/vo_data->fps) drop_barrier += 1/vo_data->fps; + if(drop_barrier < (float)(xp_num_frames-2)/sh_video->fps) drop_barrier += 1/sh_video->fps; else if(mp_conf.verbose) show_warn_cant_sync(max_frame_delay); } @@ -286,7 +285,7 @@ dec_ahead_pth_id = pinfo[_xp_id].pth_id = pthread_self(); pinfo[_xp_id].thread_name = (xp_core.has_audio && mp_conf.xp < XP_VAFull) ? "video+audio decoding+filtering ahead" : "video decoding+vf ahead"; - drop_barrier=(float)(xp_num_frames/2)*(1/vo_data->fps); + drop_barrier=(float)(xp_num_frames/2)*(1/sh_video->fps); if(av_sync_pts == -1 && !use_pts_fix2) xp_is_bad_pts = d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG4_ES || @@ -316,7 +315,7 @@ } #endif /*-------------------- Decode a frame: -----------------------*/ - in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,vo_data->fps); + in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,sh_video->fps); if(xp_core.in_lseek==Seek) { pinfo[_xp_id].current_module = "Post seek"; if(xp_is_bad_pts) mpeg_timer=HUGE; @@ -353,7 +352,7 @@ int cur_time; cur_time = GetTimerMS(); /* Ugly solution: disable frame dropping right after seeking! */ - if(cur_time - mpxp_seek_time > (xp_num_frames/vo_data->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(v_pts,drop_barrier); + if(cur_time - mpxp_seek_time > (xp_num_frames/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(v_pts,drop_barrier); } /* if( frame_dropping ) */ if(xp_core.in_lseek!=NoSeek) continue; #if 0 @@ -588,7 +587,7 @@ unsigned o_bps; unsigned min_reserv; o_bps=sh_audio->afilter_inited?sh_audio->af_bps:sh_audio->o_bps; - if(xp_core.has_video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_num_frames/vo_data->fps))+MIN_BUFFER_RESERV; + if(xp_core.has_video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_num_frames/sh_video->fps))+MIN_BUFFER_RESERV; else asize = o_bps*ao_da_buffs; /* FIXME: get better indices from asize/real_audio_packet_size */ min_reserv = sha->audio_out_minsize; @@ -746,7 +745,7 @@ if(xp_core.has_video) { /* Match video buffer */ vbuf_size = dae_get_decoder_outrun(xp_core.video); - pref_buf = vbuf_size / vo_data->fps * sh_audio->af_bps; + pref_buf = vbuf_size / sh_video->fps * sh_audio->af_bps; pref_buf -= len; if( pref_buf > 0 ) { len = min( pref_buf, free_buf ); Modified: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-10-26 07:04:22 UTC (rev 212) +++ mplayerxp/dump.c 2012-10-26 08:26:02 UTC (rev 213) @@ -35,7 +35,7 @@ void dump_stream(stream_t *stream) { - unsigned char buf[4096]; + char buf[4096]; int len; FILE *f; const char *ext,*name; @@ -68,21 +68,21 @@ exit_player(MSGTR_Exit_eof); } -static int dump_inited=0; -static int my_use_pts; -static FILE *mux_file; -static muxer_t *muxer; -static muxer_stream_t *m_audio,*m_video,*m_subs; -static sh_audio_t *sh_audio=NULL; -static sh_video_t *sh_video=NULL; -static unsigned decoded_frameno=0; -static unsigned a_frameno=0; #define MUX_HAVE_AUDIO 0x01 #define MUX_HAVE_VIDEO 0x02 #define MUX_HAVE_SUBS 0x04 -static int mux_type; -static uint64_t vsize=0,asize=0,ssize=0; -static float timer_corr=0; /* use common time-base */ +typedef struct priv_s { + int my_use_pts; + FILE *mux_file; + muxer_t *muxer; + muxer_stream_t *m_audio,*m_video,*m_subs; + unsigned decoded_frameno; + unsigned a_frameno; + int mux_type; + uint64_t vsize,asize,ssize; + float timer_corr; /* use common time-base */ + float vtimer; +}priv_t; void __FASTCALL__ dump_stream_event_handler(struct stream_s *s,const stream_packet_t*sp) { @@ -113,20 +113,23 @@ void dump_mux_init(demuxer_t *demuxer) { + sh_audio_t* sha=demuxer->audio->sh; + sh_video_t* shv=demuxer->video->sh; char stream_dump_name[1024]; /* TODO copy it from demuxer */ - if(dump_inited) return; - sh_audio=demuxer->audio->sh; - sh_video=demuxer->video->sh; + if(demuxer->priv) return; + demuxer->priv=malloc(sizeof(priv_t)); + priv_t*priv=demuxer->priv; + memset(priv,0,sizeof(priv_t)); /* describe other useless dumps */ - mux_type=MUX_HAVE_AUDIO|MUX_HAVE_VIDEO|MUX_HAVE_SUBS; + priv->mux_type=MUX_HAVE_AUDIO|MUX_HAVE_VIDEO|MUX_HAVE_SUBS; if(port) { - if(strcmp(port,"audio") ==0 ) { strcpy(stream_dump_name,"a_"); mux_type&=~(MUX_HAVE_VIDEO|MUX_HAVE_SUBS); } + if(strcmp(port,"audio") ==0 ) { strcpy(stream_dump_name,"a_"); priv->mux_type&=~(MUX_HAVE_VIDEO|MUX_HAVE_SUBS); } else - if(strcmp(port,"video") ==0 ) { strcpy(stream_dump_name,"v_"); mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_SUBS); } + if(strcmp(port,"video") ==0 ) { strcpy(stream_dump_name,"v_"); priv->mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_SUBS); } else - if(strcmp(port,"sub") ==0 ) { strcpy(stream_dump_name,"s_"); mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_VIDEO); } + if(strcmp(port,"sub") ==0 ) { strcpy(stream_dump_name,"s_"); priv->mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_VIDEO); } else strcpy(stream_dump_name,port); } else strcpy(stream_dump_name,"avs_"); @@ -140,194 +143,195 @@ MSG_FATAL("Unsupported muxer format %s found\n",media); exit_player(MSGTR_Exit_error); } - mux_file=fopen(stream_dump_name,"wb"); + priv->mux_file=fopen(stream_dump_name,"wb"); MSG_DBG2("Preparing stream dumping: %s\n",stream_dump_name); - if(!mux_file){ + if(!priv->mux_file){ MSG_FATAL(MSGTR_CantOpenDumpfile); exit_player(MSGTR_Exit_error); } - if(!(muxer=muxer_new_muxer(media,port,mux_file))) + if(!(priv->muxer=muxer_new_muxer(media,port,priv->mux_file))) { MSG_FATAL("Can't initialize muxer\n"); exit_player(MSGTR_Exit_error); } - if(sh_audio && (mux_type&MUX_HAVE_AUDIO)) + if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) { - m_audio=muxer_new_stream(muxer,MUXER_TYPE_AUDIO); - m_audio->buffer_size=0x100000; //16384; - m_audio->source=sh_audio; - m_audio->codec=0; - if(!sh_audio->wf) + priv->m_audio=muxer_new_stream(priv->muxer,MUXER_TYPE_AUDIO); + priv->m_audio->buffer_size=0x100000; //16384; + priv->m_audio->source=sha; + priv->m_audio->codec=0; + if(!sha->wf) { - sh_audio->wf=malloc(sizeof(WAVEFORMATEX)); - sh_audio->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize; - sh_audio->wf->wFormatTag = sh_audio->format; - sh_audio->wf->nChannels = sh_audio->channels; - sh_audio->wf->nSamplesPerSec = sh_audio->samplerate; - sh_audio->wf->nAvgBytesPerSec=sh_audio->i_bps; //mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec; - sh_audio->wf->wBitsPerSample = 16; // FIXME - sh_audio->wf->cbSize=0; // FIXME for l3codeca.acm + sha->wf=malloc(sizeof(WAVEFORMATEX)); + sha->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize; + sha->wf->wFormatTag = sha->format; + sha->wf->nChannels = sha->channels; + sha->wf->nSamplesPerSec = sha->samplerate; + sha->wf->nAvgBytesPerSec=sha->i_bps; //mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec; + sha->wf->wBitsPerSample = 16; // FIXME + sha->wf->cbSize=0; // FIXME for l3codeca.acm } - m_audio->wf=malloc(sh_audio->wf->cbSize+sizeof(WAVEFORMATEX)); - memcpy(m_audio->wf,sh_audio->wf,sh_audio->wf->cbSize+sizeof(WAVEFORMATEX)); - if(!sh_audio->wf->cbSize && sh_audio->codecdata_len) + priv->m_audio->wf=malloc(sha->wf->cbSize+sizeof(WAVEFORMATEX)); + memcpy(priv->m_audio->wf,sha->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); + if(!sha->wf->cbSize && sha->codecdata_len) { - m_audio->wf->cbSize=sh_audio->wf->cbSize=sh_audio->codecdata_len; - m_audio->wf=realloc(m_audio->wf,sh_audio->wf->cbSize+sizeof(WAVEFORMATEX)); - memcpy((char *)(m_audio->wf+1),sh_audio->codecdata,sh_audio->codecdata_len); + priv->m_audio->wf->cbSize=sha->wf->cbSize=sha->codecdata_len; + priv->m_audio->wf=realloc(priv->m_audio->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); + memcpy((char *)(priv->m_audio->wf+1),sha->codecdata,sha->codecdata_len); } - if(!sh_audio->i_bps) sh_audio->i_bps=m_audio->wf->nAvgBytesPerSec; - if(sh_audio->audio.dwScale){ - m_audio->h.dwSampleSize=sh_audio->audio.dwSampleSize; - m_audio->h.dwScale=sh_audio->audio.dwScale; - m_audio->h.dwRate=sh_audio->audio.dwRate; + if(!sha->i_bps) sha->i_bps=priv->m_audio->wf->nAvgBytesPerSec; + if(sha->audio.dwScale){ + priv->m_audio->h.dwSampleSize=sha->audio.dwSampleSize; + priv->m_audio->h.dwScale=sha->audio.dwScale; + priv->m_audio->h.dwRate=sha->audio.dwRate; } else { - m_audio->h.dwSampleSize=m_audio->wf->nBlockAlign; - m_audio->h.dwScale=m_audio->h.dwSampleSize; - m_audio->h.dwRate=m_audio->wf->nAvgBytesPerSec; + priv->m_audio->h.dwSampleSize=priv->m_audio->wf->nBlockAlign; + priv->m_audio->h.dwScale=priv->m_audio->h.dwSampleSize; + priv->m_audio->h.dwRate=priv->m_audio->wf->nAvgBytesPerSec; } } - else m_audio=NULL; - if(sh_video && (mux_type&MUX_HAVE_VIDEO)) + else priv->m_audio=NULL; + if(shv && (priv->mux_type&MUX_HAVE_VIDEO)) { - m_video=muxer_new_stream(muxer,MUXER_TYPE_VIDEO); - m_video->buffer_size=0x200000; // 2MB - m_video->source=sh_video; - m_video->h.dwSampleSize=0; // VBR - m_video->h.dwScale=10000; - m_video->h.dwRate=m_video->h.dwScale*sh_video->fps; - m_video->h.dwSuggestedBufferSize=sh_video->video.dwSuggestedBufferSize; - if(!sh_video->bih) + priv->m_video=muxer_new_stream(priv->muxer,MUXER_TYPE_VIDEO); + priv->m_video->buffer_size=0x200000; // 2MB + priv->m_video->source=shv; + priv->m_video->h.dwSampleSize=0; // VBR + priv->m_video->h.dwScale=10000; + priv->m_video->h.dwRate=priv->m_video->h.dwScale*shv->fps; + priv->m_video->h.dwSuggestedBufferSize=shv->video.dwSuggestedBufferSize; + if(!shv->bih) { - sh_video->bih=malloc(sizeof(BITMAPINFOHEADER)); - sh_video->bih->biSize=sizeof(BITMAPINFOHEADER); - sh_video->bih->biWidth=sh_video->disp_w; - sh_video->bih->biHeight=sh_video->disp_h; - sh_video->bih->biCompression=sh_video->format; - sh_video->bih->biPlanes=1; - sh_video->bih->biBitCount=24; // FIXME!!! - sh_video->bih->biSizeImage=sh_video->bih->biWidth*sh_video->bih->biHeight*(sh_video->bih->biBitCount/8); + shv->bih=malloc(sizeof(BITMAPINFOHEADER)); + shv->bih->biSize=sizeof(BITMAPINFOHEADER); + shv->bih->biWidth=shv->disp_w; + shv->bih->biHeight=shv->disp_h; + shv->bih->biCompression=shv->format; + shv->bih->biPlanes=1; + shv->bih->biBitCount=24; // FIXME!!! + shv->bih->biSizeImage=shv->bih->biWidth*shv->bih->biHeight*(shv->bih->biBitCount/8); } - m_video->bih=malloc(sh_video->bih->biSize); - memcpy(m_video->bih,sh_video->bih,sh_video->bih->biSize); - m_video->ImageDesc=sh_video->ImageDesc; - m_video->aspect=sh_video->aspect; - m_video->codec=0; + priv->m_video->bih=malloc(shv->bih->biSize); + memcpy(priv->m_video->bih,shv->bih,shv->bih->biSize); + priv->m_video->ImageDesc=shv->ImageDesc; + priv->m_video->aspect=shv->aspect; + priv->m_video->codec=0; } - else m_video=NULL; - if(demuxer->sub->sh && (mux_type&MUX_HAVE_SUBS)) + else priv->m_video=NULL; + if(demuxer->sub->sh && (priv->mux_type&MUX_HAVE_SUBS)) { - m_subs=muxer_new_stream(muxer,MUXER_TYPE_SUBS); - m_subs->buffer_size=0x100000; //16384; - m_subs->source=NULL; - m_subs->codec=0; + priv->m_subs=muxer_new_stream(priv->muxer,MUXER_TYPE_SUBS); + priv->m_subs->buffer_size=0x100000; //16384; + priv->m_subs->source=NULL; + priv->m_subs->codec=0; } - else m_subs=NULL; + else priv->m_subs=NULL; MSG_DBG2("Opening dump: %X\n",demuxer); MSG_INFO("Dumping stream to %s\n",stream_dump_name); - dump_inited=1; - muxer_fix_parameters(muxer); - muxer_write_header(muxer,demuxer); + muxer_fix_parameters(priv->muxer); + muxer_write_header(priv->muxer,demuxer); } void dump_mux_close(demuxer_t *demuxer) { - demux_stream_t *d_audio; - demux_stream_t *d_video; - if(dump_inited) - { - MSG_DBG2("Closing dump: %X %f secs\n" - "As video %X-%ix%i audio %X-%ix%ix%i\n" - ,demuxer,sh_video?sh_video->timer:sh_audio->timer - ,m_video?m_video->bih->biCompression:-1,m_video?m_video->bih->biWidth:-1,m_video?m_video->bih->biHeight:-1 - ,m_audio?m_audio->wf->wFormatTag:-1,m_audio?m_audio->wf->nSamplesPerSec:-1,m_audio?m_audio->wf->wBitsPerSample:-1,m_audio?m_audio->wf->nChannels:-1); - d_audio=demuxer->audio; - d_video=demuxer->video; - sh_audio=d_audio->sh; - sh_video=d_video->sh; - if(sh_video && (mux_type&MUX_HAVE_VIDEO)) m_video->source=sh_video; - if(sh_audio && (mux_type&MUX_HAVE_AUDIO)) m_audio->source=sh_audio; - muxer_write_index(muxer); - /* fixup avi header */ - if(sh_video) - { - if(sh_video->timer) sh_video->fps=(float)decoded_frameno/(sh_video->timer+timer_corr); - if(m_video) - { - m_video->h.dwRate=m_video->h.dwScale*sh_video->fps; - m_video->h.dwSuggestedBufferSize=vsize/decoded_frameno; - MSG_V("Finishing vstream as: scale %u rate %u fps %f (frames=%u timer=%f)\n" - ,m_video->h.dwScale,m_video->h.dwRate,sh_video->fps,decoded_frameno,sh_video->timer+timer_corr); + priv_t* priv=demuxer->priv; + demux_stream_t *d_audio=demuxer->audio; + demux_stream_t *d_video=demuxer->video; + sh_audio_t* sha=d_audio->sh; + sh_video_t* shv=d_video->sh; + if(priv) { + MSG_DBG2("Closing dump: %X %f secs\n" + "As video %X-%ix%i audio %X-%ix%ix%i\n" + ,demuxer,shv?shv->timer:sha->timer + ,m_video?m_video->bih->biCompression:-1,m_video?m_video->bih->biWidth:-1,m_video?m_video->bih->biHeight:-1 + ,m_audio?m_audio->wf->wFormatTag:-1,m_audio?m_audio->wf->nSamplesPerSec:-1,m_audio?m_audio->wf->wBitsPerSample:-1,m_audio?m_audio->wf->nChannels:-1); + if(shv && (priv->mux_type&MUX_HAVE_VIDEO)) priv->m_video->source=shv; + if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) priv->m_audio->source=sha; + muxer_write_index(priv->muxer); + /* fixup avi header */ + if(shv) { + if(priv->vtimer) shv->fps=(float)priv->decoded_frameno/(priv->vtimer+priv->timer_corr); + if(priv->m_video) { + priv->m_video->h.dwRate=priv->m_video->h.dwScale*shv->fps; + priv->m_video->h.dwSuggestedBufferSize=priv->vsize/priv->decoded_frameno; + MSG_V("Finishing vstream as: scale %u rate %u fps %f (frames=%u timer=%f)\n" + ,priv->m_video->h.dwScale + ,priv->m_video->h.dwRate + ,shv->fps + ,priv->decoded_frameno + ,priv->vtimer+priv->timer_corr); + } } - } - if(sh_audio) - { - if(m_audio) - { - m_audio->h.dwSuggestedBufferSize=asize/a_frameno; - MSG_V("Finishing astream as: scale %u rate %u (frames=%u timer=%f) avg=%i size=%u\n" - ,m_audio->h.dwScale,m_audio->h.dwRate,a_frameno,sh_audio->timer+timer_corr - ,m_audio->wf->nAvgBytesPerSec,asize); + if(sha) { + if(priv->m_audio) { + priv->m_audio->h.dwSuggestedBufferSize=priv->asize/priv->a_frameno; + MSG_V("Finishing astream as: scale %u rate %u (frames=%u timer=%f) avg=%i size=%u\n" + ,priv->m_audio->h.dwScale + ,priv->m_audio->h.dwRate + ,priv->a_frameno + ,sha->timer+priv->timer_corr + ,priv->m_audio->wf->nAvgBytesPerSec + ,priv->asize); + } } - } - if(demuxer->sub->sh) - { - if(m_subs) - { - MSG_V("Finishing sstream as\n"); + if(demuxer->sub->sh) { + if(priv->m_subs) MSG_V("Finishing sstream as\n"); } + fseeko(priv->mux_file,0,SEEK_SET); + muxer_write_header(priv->muxer,demuxer); + fclose(priv->mux_file); + free(demuxer->priv); + demuxer->priv=NULL; } - fseeko(mux_file,0,SEEK_SET); - muxer_write_header(muxer,demuxer); - fclose(mux_file); - dump_inited=0; - } - MSG_INFO(MSGTR_CoreDumped); + MSG_INFO(MSGTR_CoreDumped); } void dump_mux(demuxer_t *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames) { + priv_t* priv=demuxer->priv; demux_stream_t *d_audio=demuxer->audio; demux_stream_t *d_video=demuxer->video; demux_stream_t *d_sub=demuxer->sub; + sh_audio_t* sha=d_audio->sh; + sh_video_t* shv=d_video->sh; float frame_time,a_duration; float mpeg_vtimer=HUGE,mpeg_atimer=HUGE; unsigned char* start=NULL; int in_size,aeof,veof,seof,cmd; - - if(!dump_inited) return; + + if(!priv) return; pinfo[xp_id].current_module="dump"; - sh_audio=d_audio->sh; - sh_video=d_video->sh; - my_use_pts=use_pts; + priv->my_use_pts=use_pts; /* test stream property */ MSG_INFO("%s using PTS method\n",use_pts?"":"not"); - if(m_video) + if(priv->m_video) { - if(!sh_video) { MSG_ERR("Video not found!!!Skip this stream\n"); return; } - if(!sh_video->bih) { MSG_ERR("Video property not found!!!Skip this stream\n"); return; } - if(memcmp(sh_video->bih,m_video->bih,sizeof(BITMAPINFOHEADER))!=0) + if(!shv) { MSG_ERR("Video not found!!!Skip this stream\n"); return; } + if(!shv->bih) { MSG_ERR("Video property not found!!!Skip this stream\n"); return; } + if(memcmp(shv->bih,priv->m_video->bih,sizeof(BITMAPINFOHEADER))!=0) { MSG_ERR("Found different video properties(%X-%ix%i)!=(%X-%ix%i)!!!\nSkip this stream\n", - sh_video->bih->biCompression,sh_video->bih->biWidth,sh_video->bih->biHeight, - m_video->bih->biCompression,m_video->bih->biWidth,m_video->bih->biHeight); + shv->bih->biCompression,shv->bih->biWidth,shv->bih->biHeight, + priv->m_video->bih->biCompression,priv->m_video->bih->biWidth, + priv->m_video->bih->biHeight); return; } - m_video->source=sh_video; + priv->m_video->source=shv; } - if(m_audio) + if(priv->m_audio) { - if(!sh_audio) { MSG_ERR("Audio not found!!!Skip this stream\n"); return; } - if(!sh_audio->wf) { MSG_ERR("Audio property not found!!!Skip this stream\n"); return; } - if(memcmp(sh_audio->wf,m_audio->wf,sizeof(WAVEFORMATEX))!=0) + if(!sha) { MSG_ERR("Audio not found!!!Skip this stream\n"); return; } + if(!sha->wf) { MSG_ERR("Audio property not found!!!Skip this stream\n"); return; } + if(memcmp(sha->wf,priv->m_audio->wf,sizeof(WAVEFORMATEX))!=0) { MSG_ERR("Found different audio properties(%X-%ix%ix%i)!=(%X-%ix%ix%i)X!!!\nSkip this stream\n", - sh_audio->wf->wFormatTag,sh_audio->wf->nSamplesPerSec,sh_audio->wf->wBitsPerSample,sh_audio->wf->nChannels, - m_audio->wf->wFormatTag,m_audio->wf->nSamplesPerSec,m_audio->wf->wBitsPerSample,m_audio->wf->nChannels); + sha->wf->wFormatTag,sha->wf->nSamplesPerSec,sha->wf->wBitsPerSample,sha->wf->nChannels, + priv->m_audio->wf->wFormatTag,priv->m_audio->wf->nSamplesPerSec, + priv->m_audio->wf->wBitsPerSample,priv->m_audio->wf->nChannels); return; } - m_audio->source=sh_audio; + priv->m_audio->source=sha; } if (seek_to_sec) { float d; @@ -346,84 +350,85 @@ seek_p.secs=rel_seek_secs; demux_seek_r(demuxer,&seek_p); } - aeof=sh_audio?0:1; - veof=sh_video?0:1; - if(sh_video) sh_video->timer=0; - if(sh_audio) sh_audio->timer=0; + aeof=sha?0:1; + veof=shv?0:1; + if(shv) priv->vtimer=0; + if(sha) sha->timer=0; while(!(aeof && veof)){ in_size=0; - if(sh_audio && !aeof) + if(sha && !aeof) { float a_pts; - while(sh_audio->timer < (sh_video?sh_video->timer:HUGE) || !sh_video || veof) /* autolimitation of audio reading */ + while(sha->timer < (shv?priv->vtimer:HUGE) || !shv || veof) /* autolimitation of audio reading */ { /* we should try to keep structure of audio packets here and don't generate badly interlaved stream. The ideal case is: type=read_packet(ANY_TYPE); put_packet(type); */ - in_size=ds_get_packet_r(sh_audio->ds,&start,&a_pts); + in_size=ds_get_packet_r(sha->ds,&start,&a_pts); cmd = check_cmd(); if(cmd == -1) goto done; else - a_duration=(float)in_size/(float)(sh_audio->i_bps); + a_duration=(float)in_size/(float)(sha->i_bps); if(mpeg_atimer==HUGE) mpeg_atimer=a_pts; else { if( mpeg_atimer-a_duration<a_pts) mpeg_atimer=a_pts; else mpeg_atimer+=a_duration; } - if(use_pts) sh_audio->timer=a_pts; - else sh_audio->timer=mpeg_atimer; - MSG_V("Got audio frame: %f %u\n",a_pts,(!aeof)?a_frameno:-1); - aeof=sh_audio->ds->eof; - a_frameno++; + if(use_pts) sha->timer=a_pts; + else sha->timer=mpeg_atimer; + MSG_V("Got audio frame: %f %u\n",a_pts,(!aeof)?priv->a_frameno:-1); + aeof=sha->ds->eof; + priv->a_frameno++; if(aeof) break; - if(m_audio) + if(priv->m_audio) { - m_audio->buffer=start; + priv->m_audio->buffer=start; if(in_size>0) { - MSG_V("put audio: %f %f %u\n",a_pts,sh_audio->timer+timer_corr,in_size); - if(m_audio) muxer_write_chunk(m_audio,in_size,m_video?0:AVIIF_KEYFRAME,sh_audio->timer+timer_corr); + MSG_V("put audio: %f %f %u\n",a_pts,sha->timer+priv->timer_corr,in_size); + if(priv->m_audio) + muxer_write_chunk(priv->m_audio,in_size,priv->m_video?0:AVIIF_KEYFRAME,sha->timer+priv->timer_corr); } - if(!m_audio->h.dwSampleSize && m_audio->timer>0) - m_audio->wf->nAvgBytesPerSec=0.5f+(double)m_audio->size/m_audio->timer; + if(!priv->m_audio->h.dwSampleSize && priv->m_audio->timer>0) + priv->m_audio->wf->nAvgBytesPerSec=0.5f+(double)priv->m_audio->size/priv->m_audio->timer; } - asize += in_size; + priv->asize += in_size; } } - if(sh_video && !veof) - { + if(shv && !veof) + { float v_pts; - in_size=video_read_frame(sh_video,&frame_time,&v_pts,&start,0); + in_size=video_read_frame(shv,&frame_time,&v_pts,&start,0); cmd = check_cmd(); if(cmd == -1) goto done; else if(mpeg_vtimer==HUGE) mpeg_vtimer=v_pts; - else + else { if( mpeg_vtimer-frame_time<v_pts ) mpeg_vtimer=v_pts; else mpeg_vtimer+=frame_time; } - if(use_pts) sh_video->timer=v_pts; - else sh_video->timer=mpeg_vtimer; - ++decoded_frameno; - veof=sh_video->ds->eof; - MSG_V("Got video frame %f %i\n",v_pts,(!veof)?decoded_frameno:-1); - if(m_video) m_video->buffer=start; + if(use_pts) priv->vtimer=v_pts; + else priv->vtimer=mpeg_vtimer; + ++priv->decoded_frameno; + veof=shv->ds->eof; + MSG_V("Got video frame %f %i\n",v_pts,(!veof)?priv->decoded_frameno:-1); + if(priv->m_video) priv->m_video->buffer=start; if(in_size>0) { - MSG_V("put video: %f %f %u flg=%u\n",v_pts,sh_video->timer+timer_corr,in_size,sh_video->ds->flags); - if(m_video) muxer_write_chunk(m_video,in_size,(sh_video->ds->flags&1)?AVIIF_KEYFRAME:0,sh_video->timer+timer_corr); - vsize += in_size; + MSG_V("put video: %f %f %u flg=%u\n",v_pts,priv->vtimer+priv->timer_corr,in_size,shv->ds->flags); + if(priv->m_video) muxer_write_chunk(priv->m_video,in_size,(shv->ds->flags&1)?AVIIF_KEYFRAME:0,priv->vtimer+priv->timer_corr); + priv->vsize += in_size; } - if(!(decoded_frameno%100)) - MSG_STATUS("Done %u frames\r",decoded_frameno); + if(!(priv->decoded_frameno%100)) + MSG_STATUS("Done %u frames\r",priv->decoded_frameno); } if(demuxer->sub->sh) { float s_pts=0; - while(s_pts < (sh_video?sh_video->timer:HUGE) || !sh_video || veof) /* autolimitation of sub reading */ + while(s_pts < (shv?priv->vtimer:HUGE) || !shv || veof) /* autolimitation of sub reading */ { in_size=ds_get_packet_r(demuxer->sub,&start,&s_pts); seof=demuxer->sub->eof; @@ -432,31 +437,37 @@ if(cmd == -1) goto done; else MSG_V("Got sub frame: %f\n",s_pts); - if(m_subs) + if(priv->m_subs) { - m_subs->buffer=start; + priv->m_subs->buffer=start; if(in_size>0) { MSG_V("put subs: %f %u\n",s_pts,in_size); - if(m_subs) muxer_write_chunk(m_subs,in_size,m_video?0:AVIIF_KEYFRAME,s_pts); + if(priv->m_subs) + muxer_write_chunk(priv->m_subs,in_size,priv->m_video?0:AVIIF_KEYFRAME,s_pts); } } } } - if(decoded_frameno>play_n_frames) break; + if(priv->decoded_frameno>play_n_frames) break; } done: - if(sh_video) timer_corr+=sh_video->timer+frame_time; + if(shv) priv->timer_corr+=priv->vtimer+frame_time; else { - if(sh_audio) timer_corr+=d_audio->pts; - if(m_audio->wf->nAvgBytesPerSec) - timer_corr+=((float)ds_tell_pts(d_audio))/((float)m_audio->wf->nAvgBytesPerSec); + if(sha) priv->timer_corr+=d_audio->pts; + if(priv->m_audio->wf->nAvgBytesPerSec) + priv->timer_corr+=((float)ds_tell_pts(d_audio))/((float)priv->m_audio->wf->nAvgBytesPerSec); } MSG_STATUS("Done %u frames (video(%X-%ix%i): %llu bytes audio(%X-%ix%ix%i): %llu bytes)\n" - ,decoded_frameno - ,m_video?m_video->bih->biCompression:-1,m_video?m_video->bih->biWidth:-1,m_video?m_video->bih->biHeight:-1 - ,vsize - ,m_audio?m_audio->wf->wFormatTag:-1,m_audio?m_audio->wf->nSamplesPerSec:-1,m_audio?m_audio->wf->wBitsPerSample:-1,m_audio?m_audio->wf->nChannels:-1 - ,asize); + ,priv->decoded_frameno + ,priv->m_video?priv->m_video->bih->biCompression:-1 + ,priv->m_video?priv->m_video->bih->biWidth:-1 + ,priv->m_video?priv->m_video->bih->biHeight:-1 + ,priv->vsize + ,priv->m_audio?priv->m_audio->wf->wFormatTag:-1 + ,priv->m_audio?priv->m_audio->wf->nSamplesPerSec:-1 + ,priv->m_audio?priv->m_audio->wf->wBitsPerSample:-1 + ,priv->m_audio?priv->m_audio->wf->nChannels:-1 + ,priv->asize); } Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2012-10-26 07:04:22 UTC (rev 212) +++ mplayerxp/libao2/ao_wav.c 2012-10-26 08:26:02 UTC (rev 213) @@ -23,6 +23,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include "dec_ahead.h" #include "../bswap.h" #include "postproc/af_format.h" @@ -221,8 +222,9 @@ extern vo_data_t* vo_data; static unsigned get_space(ao_data_t* ao){ priv_t* priv=ao->priv; - if(vo_data->pts) - return ao->pts < vo_data->pts + priv->fast * 30000 ? ao->outburst : 0; + float pts=dae_played_fra(xp_core.video).v_pts; + if(pts) + return ao->pts < pts + priv->fast * 30000 ? ao->outburst : 0; return ao->outburst; } Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-26 07:04:22 UTC (rev 212) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-26 08:26:02 UTC (rev 213) @@ -314,7 +314,7 @@ if(vo_flags & 0x08){ static vo_mpegpes_t packet; static vo_mpegpes_t *pkg=&packet; - packet.timestamp=sh_video->timer*90000.0; + packet.timestamp=v_pts*90000.0; packet.id=0x20; /* Subpic */ while((packet.size=ds_get_packet_sub_r(d_dvdsub,&packet.data))>0){ MSG_V("\rDVD sub: len=%d v_pts=%5.3f s_pts=%5.3f \n",packet.size,v_pts,d_dvdsub->pts); @@ -334,8 +334,8 @@ if (vo_data->vobsub) { if (v_pts >= 0) { while((len=vobsub_get_packet(vo_data->vobsub, v_pts,(any_t**)&packet, ×tamp))>0){ - timestamp -= (v_pts - sh_video->timer)*90000; - MSG_V("\rVOB sub: len=%d v_pts=%5.3f v_timer=%5.3f sub=%5.3f ts=%d \n",len,v_pts,sh_video->timer,timestamp / 90000.0,timestamp); + timestamp -= v_pts*90000; + MSG_V("\rVOB sub: len=%d v_pts=%5.3f sub=%5.3f ts=%d \n",len,v_pts,timestamp / 90000.0,timestamp); spudec_assemble(vo_data->spudec,packet,len,90000*d_dvdsub->pts); } } Modified: mplayerxp/libmpdemux/demux_rawvideo.c =================================================================== --- mplayerxp/libmpdemux/demux_rawvideo.c 2012-10-26 07:04:22 UTC (rev 212) +++ mplayerxp/libmpdemux/demux_rawvideo.c 2012-10-26 08:26:02 UTC (rev 213) @@ -138,7 +138,6 @@ pos+=(seeka->flags&DEMUX_SEEK_PERCENTS?demuxer->movi_end-demuxer->movi_start:(priv.fps*priv.imgsize))*seeka->secs; pos/=priv.imgsize; stream_seek(s,pos*priv.imgsize); - sh_video->timer=pos / sh_video->fps; // printf("demux_rawvideo: streamtell=%d\n",(int)stream_tell(demuxer->stream)); } Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-10-26 07:04:22 UTC (rev 212) +++ mplayerxp/libmpdemux/demuxer.c 2012-10-26 08:26:02 UTC (rev 213) @@ -667,12 +667,7 @@ demuxer->video->prev_pts=0; demuxer->audio->prev_pts=0; -#if 0 - if(sh_audio) sh_audio->timer=sh_video->timer; -#else if(sh_audio) sh_audio->timer=0; - if(sh_video) sh_video->timer=0; // !!!!!! -#endif if(demuxer->driver->seek) demuxer->driver->seek(demuxer,seeka); else MSG_WARN("Demuxer seek error\n"); return 1; Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2012-10-26 07:04:22 UTC (rev 212) +++ mplayerxp/libmpdemux/stheader.h 2012-10-26 08:26:02 UTC (rev 213) @@ -64,7 +64,6 @@ int inited; int is_static; /* default: 0 - means movie; 1 - means picture (.jpg ...)*/ // output format: - float timer; // value of old v_frame float fps; int chapter_change; unsigned disp_w,disp_h;// display size (filled by fileformat parser) Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-10-26 07:04:22 UTC (rev 212) +++ mplayerxp/libvo/video_out.h 2012-10-26 08:26:02 UTC (rev 213) @@ -168,9 +168,6 @@ // requested resolution/bpp: (-x -y -bpp options) vo_rect_t dest; - int pts; - float fps; - any_t* vo_priv;/* private data of vo structure */ any_t* priv; /* private data of video driver */ any_t* priv2; /* private data of X11 commons */ Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-26 07:04:22 UTC (rev 212) +++ mplayerxp/mplayer.c 2012-10-26 08:26:02 UTC (rev 213) @@ -1137,13 +1137,13 @@ #endif //================= Update OSD ==================== -static void __show_status_line(float a_pts,float video_pts,float delay,float AV_delay) { +static void __show_status_line(float a_pts,float v_pts,float delay,float AV_delay) { MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d [frms: [%i]]\n", - a_pts-delay,video_pts,AV_delay,c_total + a_pts-delay,v_pts,AV_delay,c_total ,xp_core.video->num_played_frames,xp_core.video->num_decoded_frames - ,(sh_video->timer>0.5)?(int)(100.0*time_usage.video/(double)sh_video->timer):0 - ,(sh_video->timer>0.5)?(int)(100.0*time_usage.vout/(double)sh_video->timer):0 - ,(sh_video->timer>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)sh_video->timer):0 + ,(v_pts>0.5)?(int)(100.0*time_usage.video/(double)v_pts):0 + ,(v_pts>0.5)?(int)(100.0*time_usage.vout/(double)v_pts):0 + ,(v_pts>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)v_pts):0 ,output_quality ,dae_curr_vplayed() ); @@ -1177,21 +1177,22 @@ float a_pts = sh_audio->timer-ao_get_delay(ao_data); MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d\r" ,a_pts - ,sh_video->timer - ,a_pts-sh_video->timer,0.0 + ,v_pts + ,a_pts-v_pts + ,0.0 ,xp_core.video->num_played_frames,xp_core.video->num_decoded_frames - ,(sh_video->timer>0.5)?(int)(100.0*time_usage.video/(double)sh_video->timer):0 - ,(sh_video->timer>0.5)?(int)(100.0*time_usage.vout/(double)sh_video->timer):0 - ,(sh_video->timer>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)sh_video->timer):0 + ,(v_pts>0.5)?(int)(100.0*time_usage.video/(double)v_pts):0 + ,(v_pts>0.5)?(int)(100.0*time_usage.vout/(double)v_pts):0 + ,(v_pts>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)v_pts):0 ,output_quality ); } else MSG_STATUS("V:%6.1f %3d %2d%% %2d%% %4.1f%% %d\r" ,v_pts ,xp_core.video->num_played_frames - ,(sh_video->timer>0.5)?(int)(100.0*time_usage.video/(double)sh_video->timer):0 - ,(sh_video->timer>0.5)?(int)(100.0*time_usage.vout/(double)sh_video->timer):0 - ,(sh_video->timer>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)sh_video->timer):0 + ,(v_pts>0.5)?(int)(100.0*time_usage.video/(double)v_pts):0 + ,(v_pts>0.5)?(int)(100.0*time_usage.vout/(double)v_pts):0 + ,(v_pts>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)v_pts):0 ,output_quality ); fflush(stdout); @@ -1235,7 +1236,7 @@ } else { sh_video->chapter_change=0; } - } else if(*v_pts < 1.0 && sh_video->timer > 2.0) { + } else if(*v_pts < 1.0 && shva_prev.v_pts > 2.0) { MSG_V("Video chapter change detected\n"); sh_video->chapter_change=1; } @@ -1246,18 +1247,17 @@ } } #if 0 -MSG_INFO("initial_audio_pts=%f a_eof=%i a_pts=%f sh_audio->timer=%f sh_video->timer=%f v_pts=%f stream_pts=%f duration=%f\n" +MSG_INFO("initial_audio_pts=%f a_eof=%i a_pts=%f sh_audio->timer=%f v_pts=%f stream_pts=%f duration=%f\n" ,initial_audio_pts ,audio_eof ,sh_audio && !audio_eof?d_audio->pts+(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps:0 ,sh_audio && !audio_eof?sh_audio->timer-ao_get_delay():0 -,sh_video->timer ,shva[dec_ahead_active_frame].v_pts ,shva[dec_ahead_active_frame].stream_pts ,shva[dec_ahead_active_frame].duration); #endif if(blit_frame) { - xp_screen_pts=sh_video->timer=*v_pts-(av_sync_pts?0:initial_audio_pts); + xp_screen_pts=*v_pts-(av_sync_pts?0:initial_audio_pts); #ifdef USE_OSD /*--------- add OSD to the next frame contents ---------*/ MSG_D("dec_ahead_main: draw_osd to %u\n",player_idx); @@ -1275,7 +1275,7 @@ if(audio_eof && !get_delay_audio_buffer()) goto nosound_model; if((!audio_eof || ao_get_delay(ao_data)) && (!use_pts_fix2 || (!sh_audio->chapter_change && !sh_video->chapter_change))) - time_frame=sh_video->timer-(sh_audio->timer-ao_get_delay(ao_data)); + time_frame=xp_screen_pts-(sh_audio->timer-ao_get_delay(ao_data)); else if(use_pts_fix2 && sh_audio->chapter_change) time_frame=0; else @@ -1343,7 +1343,7 @@ if(mp_conf.benchmark) { /* we need compute draw_slice+change_frame here */ time_usage.cur_vout+=tt; - if((time_usage.cur_video + time_usage.cur_vout + time_usage.cur_audio)*vo_data->fps > 1) + if((time_usage.cur_video+time_usage.cur_vout+time_usage.cur_audio)*sh_video->fps > 1) bench_dropped_frames ++; } } @@ -1789,11 +1789,9 @@ demuxer->file_format,sh_video->format, sh_video->disp_w,sh_video->disp_h, sh_video->fps,1/sh_video->fps ); - vo_data->fps = sh_video->fps; /* need to set fps here for output encoders to pick it up in their init */ if(force_fps){ sh_video->fps=force_fps; - vo_data->fps = force_fps; } if(!sh_video->fps && !force_fps){ @@ -2119,7 +2117,7 @@ i_abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0; if(i_abs) { seek->flags = DEMUX_SEEK_SET|DEMUX_SEEK_PERCENTS; - if(sh_video) osd_function= (v > sh_video->timer) ? OSD_FFW : OSD_REW; + if(sh_video) osd_function= (v > dae_played_fra(xp_core.video).v_pts) ? OSD_FFW : OSD_REW; seek->secs = v/100.; } else { @@ -2620,10 +2618,7 @@ else use_pts_fix2=0; - if(sh_video) { - sh_video->timer=0; - sh_video->chapter_change=0; - } + if(sh_video) sh_video->chapter_change=0; if(sh_audio) { // <- ??? always true sh_audio->chapter_change=0; @@ -2649,7 +2644,7 @@ if(demuxer->file_format!=DEMUXER_TYPE_AVI) pts_from_bps=0; // it must be 0 for mpeg/asf! if(force_fps && sh_video) { - vo_data->fps = sh_video->fps=force_fps; + sh_video->fps=force_fps; MSG_INFO(MSGTR_FPSforced,sh_video->fps,1.0f/sh_video->fps); } @@ -2712,10 +2707,6 @@ int l_eof; /*========================== PLAY VIDEO ============================*/ - - vo_data->pts=sh_video->timer*90000.0; - vo_data->fps=sh_video->fps; - if(input_state.need_repaint) goto repaint; if((sh_video->is_static ||(stream->type&STREAMTYPE_MENU)==STREAMTYPE_MENU) && our_n_frames) { /* don't decode if it's picture */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-26 08:49:49
|
Revision: 214 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=214&view=rev Author: nickols_k Date: 2012-10-26 08:49:43 +0000 (Fri, 26 Oct 2012) Log Message: ----------- cleanups Modified Paths: -------------- mplayerxp/dec_ahead.c mplayerxp/dump.c mplayerxp/libmpdemux/stheader.h mplayerxp/mplayer.c Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-26 08:26:02 UTC (rev 213) +++ mplayerxp/dec_ahead.c 2012-10-26 08:49:43 UTC (rev 214) @@ -189,10 +189,6 @@ unsigned rc=0; static float prev_delta=64; float delta,max_frame_delay;/* delay for decoding of top slow frame */ - /* - ada_active_frame - abs frame num. which is being displayed - abs_dec_ahead_locked_frame - abs frame num. which is being decoded - */ max_frame_delay = time_usage.max_video+time_usage.max_vout; /* @@ -320,7 +316,6 @@ pinfo[_xp_id].current_module = "Post seek"; if(xp_is_bad_pts) mpeg_timer=HUGE; xp_core.in_lseek=NoSeek; - MSG_T("\nDEC_AHEAD: reset counters to (%u %u) due lseek\n",dec_ahead_locked_frame,abs_dec_ahead_locked_frame); pinfo[_xp_id].current_module = "dec_ahead 3"; } if(in_size<0) { @@ -370,8 +365,6 @@ if(xp_n_frame_to_drop) drop_param=frame_dropping; else drop_param=0; /* decode: */ - MSG_T("\nDEC_AHEAD: decode to %u (abs (blitted(%u)>=active+xp-2(%u)))\n" - ,abs_dec_ahead_blitted_frame,abs_dec_ahead_locked_frame,lda_active_frame+xp_num_frames-2); if(output_quality) { unsigned total = xp_num_frames/2; unsigned distance = dae_get_decoder_outrun(xp_core.video); @@ -386,12 +379,6 @@ if(drop_param) mpcv_set_quality(sh_video,output_quality); } if(!blit_frame && drop_param) xp_drop_frame_cnt++; -#ifdef ENABLE_DEC_AHEAD_DEBUG - if(verbose) { - MSG_T("\nDEC_AHEAD: frame %u decoded (blit=%u blit_param=%u size=%i)\n" - ,abs_dec_ahead_locked_frame,blit_frame,drop_param,in_size); - } -#endif if(blit_frame) { unsigned idx=dae_curr_vdecoded(); if(xp_is_bad_pts) Modified: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-10-26 08:26:02 UTC (rev 213) +++ mplayerxp/dump.c 2012-10-26 08:49:43 UTC (rev 214) @@ -242,9 +242,14 @@ if(priv) { MSG_DBG2("Closing dump: %X %f secs\n" "As video %X-%ix%i audio %X-%ix%ix%i\n" - ,demuxer,shv?shv->timer:sha->timer - ,m_video?m_video->bih->biCompression:-1,m_video?m_video->bih->biWidth:-1,m_video?m_video->bih->biHeight:-1 - ,m_audio?m_audio->wf->wFormatTag:-1,m_audio?m_audio->wf->nSamplesPerSec:-1,m_audio?m_audio->wf->wBitsPerSample:-1,m_audio?m_audio->wf->nChannels:-1); + ,demuxer,shv?priv->vtimer:sha->timer + ,priv->m_video?priv->m_video->bih->biCompression:-1 + ,priv->m_video?priv->m_video->bih->biWidth:-1 + ,priv->m_video?priv->m_video->bih->biHeight:-1 + ,priv->m_audio?priv->m_audio->wf->wFormatTag:-1 + ,priv->m_audio?priv->m_audio->wf->nSamplesPerSec:-1 + ,priv->m_audio?priv->m_audio->wf->wBitsPerSample:-1 + ,priv->m_audio?priv->m_audio->wf->nChannels:-1); if(shv && (priv->mux_type&MUX_HAVE_VIDEO)) priv->m_video->source=shv; if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) priv->m_audio->source=sha; muxer_write_index(priv->muxer); Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2012-10-26 08:26:02 UTC (rev 213) +++ mplayerxp/libmpdemux/stheader.h 2012-10-26 08:49:43 UTC (rev 214) @@ -12,16 +12,17 @@ typedef struct sh_audio_s { int aid; demux_stream_t* ds; - unsigned int format; struct codecs_st* codec; int inited; +// input format + unsigned int format; + unsigned i_bps; // == bitrate (compressed bytes/sec) // output format: float timer; // value of old a_frame unsigned samplerate; unsigned samplesize; unsigned channels; unsigned o_bps; // == samplerate*samplesize*channels (uncompr. bytes/sec) - unsigned i_bps; // == bitrate (compressed bytes/sec) // in buffers: char* a_in_buffer; int a_in_buffer_len; @@ -59,9 +60,10 @@ typedef struct sh_video_s { int vid; demux_stream_t* ds; - unsigned int format; struct codecs_st* codec; int inited; +// input format + unsigned int format; int is_static; /* default: 0 - means movie; 1 - means picture (.jpg ...)*/ // output format: float fps; Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-26 08:26:02 UTC (rev 213) +++ mplayerxp/mplayer.c 2012-10-26 08:49:43 UTC (rev 214) @@ -1118,7 +1118,7 @@ osd_show_framedrop--; } else #ifdef ENABLE_DEC_AHEAD_DEBUG - if(mp_conf.verbose) sprintf(osd_text_tmp,"%c %02d:%02d:%02d abs frame: %u",osd_function,pts/3600,(pts/60)%60,pts%60,abs_dec_ahead_active_frame); + if(mp_conf.verbose) sprintf(osd_text_tmp,"%c %02d:%02d:%02d",osd_function,pts/3600,(pts/60)%60,pts%60); else sprintf(osd_text_tmp,"%c %02d:%02d:%02d",osd_function,pts/3600,(pts/60)%60,pts%60); #else sprintf(osd_text_tmp,"%c %02d:%02d:%02d",osd_function,pts/3600,(pts/60)%60,pts%60); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-26 09:26:00
|
Revision: 215 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=215&view=rev Author: nickols_k Date: 2012-10-26 09:25:53 +0000 (Fri, 26 Oct 2012) Log Message: ----------- make development easy Modified Paths: -------------- mplayerxp/Makefile mplayerxp/configure Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-10-26 08:49:43 UTC (rev 214) +++ mplayerxp/Makefile 2012-10-26 09:25:53 UTC (rev 215) @@ -28,11 +28,11 @@ OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) -FF_LIBS = ../ffmpeg/libavcodec/libavcodec.a \ - ../ffmpeg/libswscale/libswscale.a \ - ../ffmpeg/libpostproc/libpostproc.a \ - ../ffmpeg/libavformat/libavformat.a \ - ../ffmpeg/libavutil/libavutil.a +FF_LIBS = ../ffmpeg/libavcodec/libavcodec$(FF_SUFFIX).a \ + ../ffmpeg/libswscale/libswscale$(FF_SUFFIX).a \ + ../ffmpeg/libpostproc/libpostproc$(FF_SUFFIX).a \ + ../ffmpeg/libavformat/libavformat$(FF_SUFFIX).a \ + ../ffmpeg/libavutil/libavutil$(FF_SUFFIX).a MP_LIBS = libmpdemux/libmpdemux.a \ libmpcodecs/libmpcodecs.a \ Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-10-26 08:49:43 UTC (rev 214) +++ mplayerxp/configure 2012-10-26 09:25:53 UTC (rev 215) @@ -325,14 +325,20 @@ _arch=$host_arch x86_32 && _arch="i686" x86_64 && _arch="x86_64" -ffmpeg_args="--arch=$_arch $ffmpeg_args" +x86_32 && ff_libsuffix="32" +x86_64 && ff_libsuffix="64" +ffmpeg_args="--arch=$_arch --build-suffix=$ff_libsuffix $ffmpeg_args" fi test "$debug" != "0" && ffmpeg_args="$ffmpeg_args --enable-debug=$debug" enabled $profile && ffmpeg_args="$ffmpeg_args --enable-profile" +if test -f "../ffmpeg/libavcodec/libavcodec$ff_libsuffix.a"; then +echocheck "ffmpeg was already configured for $ff_libsuffix" +else echocheck "configuring ffmpeg stuff: --cc=\"$cc\" $ffmpeg_args" cd ../ffmpeg $(LC_ALL=C ./configure --cc="$cc" $ffmpeg_args) cd $srcdir +fi echores "done" ################################### @@ -748,6 +754,7 @@ LIBDIR = $libdir DESTDIR = $DESTDIR PROGNAME = $prog_alias +FF_SUFFIX=$ff_libsuffix AR = ar CC = $cc LDCONFIG=$ldconfig This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |