From: Sam Hocevar Date: Tue, 19 Feb 2002 00:50:20 +0000 (+0000) Subject: * Got rid of TRACE and intf_DbgMsg which were seldom used anyway. X-Git-Tag: 0.3.0~191 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=730cc399c5a7320cce2999bf035294c075d14370;p=vlc * Got rid of TRACE and intf_DbgMsg which were seldom used anyway. * All intf_*Msg functions now write to stderr. * Implemented a message queue interface plugins can subscribe to. * Wrote the logger interface plugin. Usage: vlc -I logger:filename.log * Lots of fixes in the SPU renderer. --- diff --git a/Makefile b/Makefile index bd0f6d8949..5591ba9aa0 100644 --- a/Makefile +++ b/Makefile @@ -119,6 +119,7 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \ qt/qt \ sdl/sdl \ spudec/spudec \ + text/logger \ text/ncurses \ text/rc \ vcd/vcd \ diff --git a/Makefile.opts.in b/Makefile.opts.in index 8606424850..40ce42c636 100644 --- a/Makefile.opts.in +++ b/Makefile.opts.in @@ -35,7 +35,6 @@ ARCH = @ARCH@ # Compilation options # DEBUG = @DEBUG@ -TRACE = @TRACE@ CPROF = @CPROF@ GPROF = @GPROF@ OPTIMS = @OPTIMS@ @@ -147,10 +146,6 @@ ifeq ($(DEBUG),1) PROGRAM_OPTIONS += DEBUG DEFINE += -DDEBUG endif -ifeq ($(TRACE),1) -PROGRAM_OPTIONS += TRACE -DEFINE += -DTRACE -endif ifeq ($(CPROF),1) PROGRAM_OPTIONS += CPROF DEFINE += -DCPROF diff --git a/configure b/configure index d635156eb5..5e949b3b50 100755 --- a/configure +++ b/configure @@ -28,8 +28,6 @@ ac_help="$ac_help --disable-altivec Disable altivec optimizations (default enabled on PPC)" ac_help="$ac_help --enable-debug Enable debug mode (default disabled)" -ac_help="$ac_help - --enable-trace Enable trace mode (default disabled)" ac_help="$ac_help --enable-gprof Enable gprof profiling (default disabled)" ac_help="$ac_help @@ -50,6 +48,8 @@ ac_help="$ac_help --enable-vcd VCD support for Linux (default enabled)" ac_help="$ac_help --disable-dummy dummy module (default enabled)" +ac_help="$ac_help + --disable-logger file logger module (default enabled)" ac_help="$ac_help --disable-null Null module (default enabled)" ac_help="$ac_help @@ -6234,14 +6234,6 @@ if test "${enable_debug+set}" = set; then fi -TRACE=0 -# Check whether --enable-trace or --disable-trace was given. -if test "${enable_trace+set}" = set; then - enableval="$enable_trace" - if test x$enableval = xyes; then TRACE=1; fi -fi - - GPROF=0 # Check whether --enable-gprof or --disable-gprof was given. if test "${enable_gprof+set}" = set; then @@ -6277,7 +6269,7 @@ if test "${enable_pth+set}" = set; then enableval="$enable_pth" if test x$enableval = xyes; then echo $ac_n "checking for pth_init in -lpth""... $ac_c" 1>&6 -echo "configure:6281: checking for pth_init in -lpth" >&5 +echo "configure:6273: checking for pth_init in -lpth" >&5 ac_lib_var=`echo pth'_'pth_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6285,7 +6277,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpth $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6324,7 +6316,7 @@ else fi cat > conftest.$ac_ext < EOF @@ -6482,7 +6474,7 @@ fi if test x$enable_vcd != xno then cat > conftest.$ac_ext < EOF @@ -6511,7 +6503,19 @@ fi if test x$enable_dummy != xno then - BUILTINS="${BUILTINS} dummy" + PLUGINS="${PLUGINS} dummy" +fi + +# Check whether --enable-logger or --disable-logger was given. +if test "${enable_logger+set}" = set; then + enableval="$enable_logger" + : +fi + + +if test x$enable_logger != xno +then + PLUGINS="${PLUGINS} logger" fi # Check whether --enable-null or --disable-null was given. @@ -6523,7 +6527,7 @@ fi if test x$enable_null != xno then - BUILTINS="${BUILTINS} null" + PLUGINS="${PLUGINS} null" fi # Check whether --enable-rc or --disable-rc was given. @@ -6535,7 +6539,7 @@ fi if test x$enable_rc != xno then - BUILTINS="${BUILTINS} rc" + PLUGINS="${PLUGINS} rc" fi # Check whether --with-mad or --without-mad was given. @@ -6556,17 +6560,17 @@ if test "${with_mad+set}" = set; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6560: checking for $ac_hdr" >&5 +echo "configure:6564: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6570: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6596,7 +6600,7 @@ fi done echo $ac_n "checking for mad_bit_init in -lmad""... $ac_c" 1>&6 -echo "configure:6600: checking for mad_bit_init in -lmad" >&5 +echo "configure:6604: checking for mad_bit_init in -lmad" >&5 ac_lib_var=`echo mad'_'mad_bit_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6604,7 +6608,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmad $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6672,17 +6676,17 @@ then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6676: checking for $ac_hdr" >&5 +echo "configure:6680: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6686: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6690: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6720,7 +6724,7 @@ if test "${enable_esd+set}" = set; then # Extract the first word of "esd-config", so it can be a program name with args. set dummy esd-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6724: checking for $ac_word" >&5 +echo "configure:6728: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ESD_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6771,7 +6775,7 @@ if test "${enable_arts+set}" = set; then # Extract the first word of "artsc-config", so it can be a program name with args. set dummy artsc-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6775: checking for $ac_word" >&5 +echo "configure:6779: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ARTS_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6829,17 +6833,17 @@ else do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6833: checking for $ac_hdr" >&5 +echo "configure:6837: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6843: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6847: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6884,17 +6888,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6888: checking for $ac_hdr" >&5 +echo "configure:6892: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6898: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6902: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6937,17 +6941,17 @@ if ((test "x$enableval" != "xno") && (test x$SYS != xmingw32)) do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6941: checking for $ac_hdr" >&5 +echo "configure:6945: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6951: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6955: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7035,7 +7039,7 @@ fi # Extract the first word of "sdl12-config", so it can be a program name with args. set dummy sdl12-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7039: checking for $ac_word" >&5 +echo "configure:7043: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SDL12_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7075,7 +7079,7 @@ fi # Extract the first word of "sdl11-config", so it can be a program name with args. set dummy sdl11-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7079: checking for $ac_word" >&5 +echo "configure:7083: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SDL11_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7116,7 +7120,7 @@ fi # Extract the first word of "sdl-config", so it can be a program name with args. set dummy sdl-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7120: checking for $ac_word" >&5 +echo "configure:7124: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SDL_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7162,17 +7166,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7166: checking for $ac_hdr" >&5 +echo "configure:7170: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7176: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7180: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7242,17 +7246,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7246: checking for $ac_hdr" >&5 +echo "configure:7250: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7256: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7260: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7281,7 +7285,7 @@ done else echo $ac_n "checking for directX headers in ${withval}""... $ac_c" 1>&6 -echo "configure:7285: checking for directX headers in ${withval}" >&5 +echo "configure:7289: checking for directX headers in ${withval}" >&5 if test -f ${withval}/include/ddraw.h then PLUGINS="${PLUGINS} directx" @@ -7390,7 +7394,7 @@ if test "${enable_gnome+set}" = set; then # Extract the first word of "gnome-config", so it can be a program name with args. set dummy gnome-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7394: checking for $ac_word" >&5 +echo "configure:7398: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GNOME_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7435,17 +7439,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7439: checking for $ac_hdr" >&5 +echo "configure:7443: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7449: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7453: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7505,7 +7509,7 @@ fi # Extract the first word of "gtk-config", so it can be a program name with args. set dummy gtk-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7509: checking for $ac_word" >&5 +echo "configure:7513: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7555,17 +7559,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7559: checking for $ac_hdr" >&5 +echo "configure:7563: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7569: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7573: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7622,17 +7626,17 @@ if test x$enable_x11 != xno && do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7626: checking for $ac_hdr" >&5 +echo "configure:7630: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7636: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7640: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7685,17 +7689,17 @@ if test x$enable_xvideo != xno && do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7689: checking for $ac_hdr" >&5 +echo "configure:7693: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7699: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7703: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7719,7 +7723,7 @@ EOF saved_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -L$x_libraries -lX11 -lXext" echo $ac_n "checking for XvSetPortAttribute in -lXv_pic""... $ac_c" 1>&6 -echo "configure:7723: checking for XvSetPortAttribute in -lXv_pic" >&5 +echo "configure:7727: checking for XvSetPortAttribute in -lXv_pic" >&5 ac_lib_var=`echo Xv_pic'_'XvSetPortAttribute | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7727,7 +7731,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXv_pic $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7785,17 +7789,17 @@ if test x$enable_lirc = xyes then ac_safe=`echo "lirc/lirc_client.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for lirc/lirc_client.h""... $ac_c" 1>&6 -echo "configure:7789: checking for lirc/lirc_client.h" >&5 +echo "configure:7793: checking for lirc/lirc_client.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7799: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7803: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7812,7 +7816,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for lirc_init in -llirc_client""... $ac_c" 1>&6 -echo "configure:7816: checking for lirc_init in -llirc_client" >&5 +echo "configure:7820: checking for lirc_init in -llirc_client" >&5 ac_lib_var=`echo lirc_client'_'lirc_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7820,7 +7824,7 @@ else ac_save_LIBS="$LIBS" LIBS="-llirc_client $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7871,17 +7875,17 @@ if test "${enable_alsa+set}" = set; then then ac_safe=`echo "alsa/asoundlib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for alsa/asoundlib.h""... $ac_c" 1>&6 -echo "configure:7875: checking for alsa/asoundlib.h" >&5 +echo "configure:7879: checking for alsa/asoundlib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7885: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7889: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7898,7 +7902,7 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6 -echo "configure:7902: checking for main in -lasound" >&5 +echo "configure:7906: checking for main in -lasound" >&5 ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7906,14 +7910,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lasound $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8084,7 +8088,6 @@ PLUGIN_PATH="${ac_tool_prefix}/share/videolan" - trap '' 1 2 15 @@ -8283,7 +8286,6 @@ s%@ALIASES@%$ALIASES%g s%@INCLUDE@%$INCLUDE%g s%@DEBUG@%$DEBUG%g s%@ASM@%$ASM%g -s%@TRACE@%$TRACE%g s%@CPROF@%$CPROF%g s%@GPROF@%$GPROF%g s%@OPTIMS@%$OPTIMS%g @@ -8624,7 +8626,6 @@ vlc configuration ----------------- vlc version : ${VLC_VERSION} debug mode : ${DEBUG} -trace mode : ${TRACE} cprof/gprof support : ${CPROF}/${GPROF} need builtin getopt : ${NEED_GETOPT} built-in modules :${BUILTINS} diff --git a/configure.in b/configure.in index 9e7b8bf777..0a7c58b58c 100644 --- a/configure.in +++ b/configure.in @@ -715,14 +715,6 @@ AC_ARG_ENABLE(debug, [ --enable-debug Enable debug mode (default disabled)], [ if test x$enableval = xyes; then DEBUG=1; fi ]) -dnl -dnl Trace mode -dnl -TRACE=0 -AC_ARG_ENABLE(trace, -[ --enable-trace Enable trace mode (default disabled)], -[ if test x$enableval = xyes; then TRACE=1; fi ]) - dnl dnl Profiling dnl @@ -919,7 +911,18 @@ AC_ARG_ENABLE(dummy, if test x$enable_dummy != xno then - BUILTINS="${BUILTINS} dummy" + PLUGINS="${PLUGINS} dummy" +fi + +dnl +dnl log plugin +dnl +AC_ARG_ENABLE(logger, + [ --disable-logger file logger module (default enabled)]) + +if test x$enable_logger != xno +then + PLUGINS="${PLUGINS} logger" fi dnl @@ -930,7 +933,7 @@ AC_ARG_ENABLE(null, if test x$enable_null != xno then - BUILTINS="${BUILTINS} null" + PLUGINS="${PLUGINS} null" fi dnl @@ -941,7 +944,7 @@ AC_ARG_ENABLE(rc, if test x$enable_rc != xno then - BUILTINS="${BUILTINS} rc" + PLUGINS="${PLUGINS} rc" fi dnl @@ -1489,7 +1492,6 @@ AC_SUBST(ALIASES) AC_SUBST(INCLUDE) AC_SUBST(DEBUG) AC_SUBST(ASM) -AC_SUBST(TRACE) AC_SUBST(CPROF) AC_SUBST(GPROF) AC_SUBST(OPTIMS) @@ -1590,7 +1592,6 @@ vlc configuration ----------------- vlc version : ${VLC_VERSION} debug mode : ${DEBUG} -trace mode : ${TRACE} cprof/gprof support : ${CPROF}/${GPROF} need builtin getopt : ${NEED_GETOPT} built-in modules :${BUILTINS} diff --git a/include/common.h b/include/common.h index 55a91e1109..ea3a14a461 100644 --- a/include/common.h +++ b/include/common.h @@ -3,7 +3,7 @@ * Collection of useful common types and macros definitions ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: common.h,v 1.73 2002/02/15 13:32:52 sam Exp $ + * $Id: common.h,v 1.74 2002/02/19 00:50:18 sam Exp $ * * Authors: Samuel Hocevar * Vincent Seguin @@ -167,6 +167,7 @@ struct pgrm_descriptor_s; struct pes_packet_s; struct input_area_s; struct bit_stream_s; +struct intf_subscription_s; /***************************************************************************** * Macros and inline functions @@ -444,18 +445,13 @@ typedef struct module_symbols_s void ( * main_PutIntVariable ) ( char *, int ); void ( * main_PutPszVariable ) ( char *, char * ); - int ( * intf_ProcessKey ) ( struct intf_thread_s *, int ); - void ( * intf_AssignKey ) ( struct intf_thread_s *, int, int, int ); + struct intf_subscription_s * ( * intf_MsgSub ) ( void ); + void ( * intf_MsgUnsub ) ( struct intf_subscription_s * ); void ( * intf_Msg ) ( char *, ... ); void ( * intf_ErrMsg ) ( char *, ... ); void ( * intf_StatMsg ) ( char *, ... ); void ( * intf_WarnMsg ) ( int, char *, ... ); - void ( * intf_WarnMsgImm ) ( int, char *, ... ); -#ifdef TRACE - void ( * intf_DbgMsg ) ( char *, char *, int, char *, ... ); - void ( * intf_DbgMsgImm ) ( char *, char *, int, char *, ... ); -#endif int ( * intf_PlaylistAdd ) ( struct playlist_s *, int, const char* ); int ( * intf_PlaylistDelete ) ( struct playlist_s *, int ); diff --git a/include/config.h b/include/config.h index b77ee0fee5..56d107fedc 100644 --- a/include/config.h +++ b/include/config.h @@ -36,29 +36,6 @@ * */ -/***************************************************************************** - * Debugging options - define or undefine symbols - *****************************************************************************/ -#ifdef TRACE -/* General trace support, which depends of the TRACE define, is determined - * in the Makefile */ - -/* Modules specific debugging - this will produce a lot of output, but can be - * useful to track a bug */ -//#define TRACE_INTF -//#define TRACE_INPUT -//#define TRACE_AUDIO -#define TRACE_VOUT -#define TRACE_VPAR - -/* Trace log file - if defined, a file can be used to store all messages. If - * TRACE_LOG_ONLY is defined, debug messages will only be printed to the log and - * will not appear on the screen */ -#define TRACE_LOG "vlc-trace.log" -#define TRACE_LOG_ONLY - -#endif - /***************************************************************************** * General configuration *****************************************************************************/ @@ -116,10 +93,6 @@ #define INTF_PATH_VAR "vlc_search_path" #define INTF_PATH_DEFAULT "" -/* Environment variable containing the standard output method */ -#define INTF_STDOUT_VAR "vlc_stdout" -#define INTF_STDOUT_DEFAULT "" - /***************************************************************************** * Input thread configuration *****************************************************************************/ @@ -457,40 +430,16 @@ /* Maximal size of a message to be stored in the mesage queue, * it is needed when vasprintf is not avalaible */ -#define INTF_MAX_MSG_SIZE 512 +#define INTF_MAX_MSG_SIZE 512 /* Maximal size of the message queue - in case of overflow, all messages in the - * queue are printed by the calling thread */ -#define INTF_MSG_QSIZE 64 + * queue are printed, but not sent to the threads */ +#define INTF_MSG_QSIZE 256 /* Interface warnig message level */ #define INTF_WARNING_VAR "vlc_warning_level" #define INTF_WARNING_DEFAULT 0 -/* Define to enable messages queues - disabling messages queue can be useful - * when debugging, since it allows messages which would not be printed - * due to a crash to be printed anyway */ -#ifndef DEBUG -#define INTF_MSG_QUEUE -#endif - -/* Format of the header for debug messages. The arguments following this header - * are the file (char *), the function (char *) and the line (int) in which the - * message function was called */ -#define INTF_MSG_DBG_FORMAT "## %s:%s(),%i: " - -/* Max number of arguments on a command line, including the function name */ -#define INTF_MAX_ARGS 20 - -/* Maximal size of a command line in a script */ -#define INTF_MAX_CMD_SIZE 240 - -/* Number of memorized lines in console window text zone */ -#define INTF_CONSOLE_MAX_TEXT 100 - -/* Maximal number of commands which can be saved in history list */ -#define INTF_CONSOLE_MAX_HISTORY 20 - /**************************************************************************** * Playlist defaults ****************************************************************************/ diff --git a/include/defs.h.in b/include/defs.h.in index 6529224e51..87c82cfe3a 100644 --- a/include/defs.h.in +++ b/include/defs.h.in @@ -190,8 +190,8 @@ /* Define if you have the header file. */ #undef HAVE_CTHREADS_H -/* Define if you have the header file. */ -#undef HAVE_DIRECTX_H +/* Define if you have the header file. */ +#undef HAVE_DDRAW_H /* Define if you have the header file. */ #undef HAVE_DLFCN_H diff --git a/include/interface.h b/include/interface.h index a5947c210c..95e56afae9 100644 --- a/include/interface.h +++ b/include/interface.h @@ -4,7 +4,7 @@ * interface, such as message output. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: interface.h,v 1.26 2002/01/07 02:12:29 sam Exp $ + * $Id: interface.h,v 1.27 2002/02/19 00:50:18 sam Exp $ * * Authors: Vincent Seguin * @@ -53,9 +53,58 @@ typedef struct intf_thread_s } intf_thread_t; +/***************************************************************************** + * msg_item_t + ***************************************************************************** + * Store a single message. Messages have a maximal size of INTF_MSG_MSGSIZE. + *****************************************************************************/ +typedef struct +{ + int i_type; /* message type, see below */ + char * psz_msg; /* the message itself */ + +#if 0 + mtime_t date; /* date of the message */ + char * psz_file; /* file in which the function was called */ + char * psz_function; /* function from which the function was called */ + int i_line; /* line at which the function was called */ +#endif +} msg_item_t; + +/* Message types */ +#define INTF_MSG_STD 0 /* standard message */ +#define INTF_MSG_ERR 1 /* error message */ +#define INTF_MSG_WARN 2 /* warning message */ +#define INTF_MSG_STAT 3 /* statistic message */ + +/***************************************************************************** + * intf_subscription_t + ***************************************************************************** + * Used by interface plugins which subscribe to the message queue. + *****************************************************************************/ +typedef struct intf_subscription_s +{ + int i_start; + int* pi_stop; + + msg_item_t* p_msg; + vlc_mutex_t* p_lock; +} intf_subscription_t; + /***************************************************************************** * Prototypes *****************************************************************************/ -intf_thread_t * intf_Create ( void ); -void intf_Destroy ( intf_thread_t * p_intf ); +intf_thread_t * intf_Create ( void ); +void intf_Destroy ( intf_thread_t * p_intf ); + +void intf_MsgCreate ( void ); +void intf_MsgDestroy ( void ); + +#ifndef PLUGIN +intf_subscription_t* intf_MsgSub ( void ); +void intf_MsgUnsub ( intf_subscription_t * ); +#else +# define intf_MsgSub p_symbols->intf_MsgSub +# define intf_MsgUnsub p_symbols->intf_MsgUnsub +#endif diff --git a/include/intf_msg.h b/include/intf_msg.h index f5bdbfa429..c55fb9eaf7 100644 --- a/include/intf_msg.h +++ b/include/intf_msg.h @@ -4,7 +4,7 @@ * interface, such as message output. See config.h for output configuration. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: intf_msg.h,v 1.17 2001/12/30 07:09:54 sam Exp $ + * $Id: intf_msg.h,v 1.18 2002/02/19 00:50:19 sam Exp $ * * Authors: Vincent Seguin * @@ -23,92 +23,23 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -/***************************************************************************** - * intf_DbgMsg macros and functions - ***************************************************************************** - * The intf_DbgMsg* functions are defined as macro to be able to use the - * compiler extensions and print the file, the function and the line number - * from which they have been called. They call _intf_DbgMsg*() functions after - * having added debugging informations. - * Outside trace mode, intf_DbgMsg* functions do nothing. - *****************************************************************************/ -#ifdef TRACE - -/* TRACE mode */ -void _intf_DbgMsg ( char *psz_file, char *psz_function, int i_line, - char *psz_format, ... ); -void _intf_DbgMsgImm ( char *psz_file, char *psz_function, int i_line, - char *psz_format, ... ); - -#define intf_DbgMsg( format, args... ) \ - _intf_DbgMsg( __FILE__, __FUNCTION__, __LINE__, format, ## args ) -#define intf_DbgMsgImm( format, args... ) \ - _intf_DbgMsg( __FILE__, __FUNCTION__, __LINE__, format, ## args ) - -#else - -/* Non-TRACE mode */ -#if defined( _MSC_VER ) -# define intf_DbgMsg -# define intf_DbgMsgImm -#else -# define intf_DbgMsg( format, args... ) -# define intf_DbgMsgImm( format, args...) -#endif - -#endif - -/***************************************************************************** - * intf_FlushMsg macro and function - ***************************************************************************** - * intf_FlushMsg is a function which flushs message queue and print all messages - * remaining. It is only useful if INTF_MSG_QUEUE is defined. In this case, it - * is really a function. In the other case, it is a macro doing nothing. - *****************************************************************************/ -#ifdef INTF_MSG_QUEUE - -/* Message queue mode */ -void intf_FlushMsg ( void ); - -#else - -/* Direct mode */ -#define intf_FlushMsg() ; - -#endif - /***************************************************************************** * Prototypes *****************************************************************************/ #ifndef PLUGIN -p_intf_msg_t intf_MsgCreate ( void ); -void intf_MsgDestroy ( void ); +void intf_Msg ( char *psz_format, ... ); +void intf_ErrMsg ( char *psz_format, ... ); +void intf_WarnMsg ( int i_level, char *psz_format, ... ); +void intf_StatMsg ( char *psz_format, ... ); -void intf_Msg ( char *psz_format, ... ); -void intf_ErrMsg ( char *psz_format, ... ); -void intf_WarnMsg ( int i_level, char *psz_format, ... ); -void intf_StatMsg ( char *psz_format, ... ); - -void intf_MsgImm ( char *psz_format, ... ); -void intf_ErrMsgImm ( char *psz_format, ... ); -void intf_WarnMsgImm ( int i_level, char *psz_format, ... ); -void intf_WarnHexDump ( int i_level, void *p_data, int i_size ); +void intf_WarnHexDump ( int i_level, void *p_data, int i_size ); #else +# define intf_MsgSub p_symbols->intf_MsgSub +# define intf_MsgUnsub p_symbols->intf_MsgUnsub + # define intf_Msg p_symbols->intf_Msg # define intf_ErrMsg p_symbols->intf_ErrMsg # define intf_StatMsg p_symbols->intf_StatMsg # define intf_WarnMsg p_symbols->intf_WarnMsg -# define intf_WarnMsgImm p_symbols->intf_WarnMsgImm -# ifdef TRACE -# undef intf_DbgMsg -# undef intf_DbgMsgImm -# define intf_DbgMsg( format, args... ) \ - p_symbols->intf_DbgMsg( __FILE__, __FUNCTION__, \ - __LINE__, format, ## args ) -# define intf_DbgMsgImm( format, args... ) \ - p_symbols->intf_DbgMsgImm( __FILE__, __FUNCTION__, \ - __LINE__, format, ## args ) -# endif - #endif diff --git a/include/video.h b/include/video.h index 52797e5d30..3c01da1b43 100644 --- a/include/video.h +++ b/include/video.h @@ -4,7 +4,7 @@ * includes all common video types and constants. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video.h,v 1.42 2002/02/08 15:57:29 sam Exp $ + * $Id: video.h,v 1.43 2002/02/19 00:50:19 sam Exp $ * * Authors: Vincent Seguin * @@ -318,8 +318,6 @@ typedef struct subpicture_s int i_y; /* offset from alignment position */ int i_width; /* picture width */ int i_height; /* picture height */ - int i_horizontal_align; /* horizontal alignment */ - int i_vertical_align; /* vertical alignment */ /* Additionnal properties depending of the subpicture type */ union @@ -357,19 +355,3 @@ typedef struct subpicture_s #define READY_SUBPICTURE 2 /* ready for display */ #define DESTROYED_SUBPICTURE 3 /* allocated but not used anymore */ -/* Alignment types */ -#define RIGHT_ALIGN 10 /* x is absolute for right */ -#define LEFT_ALIGN 11 /* x is absolute for left */ -#define RIGHT_RALIGN 12 /* x is relative for right from right */ -#define LEFT_RALIGN 13 /* x is relative for left from left */ - -#define CENTER_ALIGN 20 /* x, y are absolute for center */ -#define CENTER_RALIGN 21 /* x,y are relative for center from center */ - -#define BOTTOM_ALIGN 30 /* y is absolute for bottom */ -#define TOP_ALIGN 31 /* y is absolute for top */ -#define BOTTOM_RALIGN 32 /* y is relative for bottom from bottom */ -#define TOP_RALIGN 33 /* y is relative for top from top */ -#define SUBTITLE_RALIGN 34 /* y is relative for center from subtitle */ - - diff --git a/ipkg/patch b/ipkg/patch index 262f599808..3948951928 100644 --- a/ipkg/patch +++ b/ipkg/patch @@ -12,7 +12,7 @@ break; } +#else -+ intf_ProcessKey( p_main->p_intf, SDLK_q ); ++ //intf_ProcessKey( p_main->p_intf, SDLK_q ); +#endif break; diff --git a/plugins/ac3_adec/ac3_adec.c b/plugins/ac3_adec/ac3_adec.c index 8ac89fc55f..caf44b2474 100644 --- a/plugins/ac3_adec/ac3_adec.c +++ b/plugins/ac3_adec/ac3_adec.c @@ -2,7 +2,7 @@ * ac3_adec.c: ac3 decoder module main file ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: ac3_adec.c,v 1.19 2002/02/15 13:32:52 sam Exp $ + * $Id: ac3_adec.c,v 1.20 2002/02/19 00:50:19 sam Exp $ * * Authors: Michel Lespinasse * @@ -194,9 +194,6 @@ static int InitThread( ac3dec_thread_t * p_ac3thread ) */ p_ac3thread->p_aout_fifo = NULL; - intf_DbgMsg ( "ac3_adec debug: ac3_adec thread (%p) initialized", - p_ac3thread ); - /* * Bit stream */ @@ -204,8 +201,6 @@ static int InitThread( ac3dec_thread_t * p_ac3thread ) p_ac3thread->p_config->p_decoder_fifo, BitstreamCallback, (void *) p_ac3thread ); - intf_DbgMsg("ac3dec debug: ac3 decoder thread %p initialized", p_ac3thread); - return( 0 ); } @@ -217,8 +212,6 @@ static int decoder_Run ( decoder_config_t * p_config ) ac3dec_thread_t * p_ac3thread; boolean_t b_sync = 0; - intf_DbgMsg( "ac3_adec debug: ac3_adec thread launched, initializing" ); - /* Allocate the memory needed to store the thread's structure */ p_ac3thread = (ac3dec_thread_t *)memalign(16, sizeof(ac3dec_thread_t)); @@ -379,8 +372,6 @@ static int decoder_Run ( decoder_config_t * p_config ) *****************************************************************************/ static void EndThread (ac3dec_thread_t * p_ac3thread) { - intf_DbgMsg ("ac3dec debug: destroying ac3 decoder thread %p", p_ac3thread); - /* If the audio output fifo was created, we destroy it */ if (p_ac3thread->p_aout_fifo != NULL) { @@ -424,8 +415,6 @@ static void EndThread (ac3dec_thread_t * p_ac3thread) /* Free what's left of the decoder */ free( p_ac3thread->ac3_decoder->imdct ); free( p_ac3thread->ac3_decoder ); - - intf_DbgMsg( "ac3dec debug: ac3 decoder thread %p destroyed", p_ac3thread ); } /***************************************************************************** diff --git a/plugins/ac3_adec/ac3_parse.c b/plugins/ac3_adec/ac3_parse.c index 9f35319df6..9555fe98a9 100644 --- a/plugins/ac3_adec/ac3_parse.c +++ b/plugins/ac3_adec/ac3_parse.c @@ -2,7 +2,7 @@ * ac3_parse.c: ac3 parsing procedures ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: ac3_parse.c,v 1.6 2001/12/30 07:09:54 sam Exp $ + * $Id: ac3_parse.c,v 1.7 2002/02/19 00:50:19 sam Exp $ * * Authors: Michel Kaempf * Aaron Holtzman @@ -95,10 +95,8 @@ static const struct frmsize_s frmsizecod_tbl[] = static const int fscod_tbl[] = {48000, 44100, 32000}; /* Some internal functions */ -#ifdef TRACE static void parse_bsi_stats (ac3dec_t * p_ac3dec); static void parse_audblk_stats (ac3dec_t * p_ac3dec); -#endif /* Parse a syncinfo structure */ int ac3_sync_frame (ac3dec_t * p_ac3dec, ac3_sync_info_t * p_sync_info) @@ -300,9 +298,10 @@ int parse_bsi (ac3dec_t * p_ac3dec) } p_ac3dec->total_bits_read += 25; -#ifdef TRACE - parse_bsi_stats (p_ac3dec); -#endif + if( p_main->b_stats ) + { + parse_bsi_stats (p_ac3dec); + } return 0; } @@ -777,9 +776,10 @@ int parse_audblk (ac3dec_t * p_ac3dec, int blknum) p_ac3dec->total_bits_read += 8 * p_ac3dec->audblk.skipl + 9; } -#ifdef TRACE - parse_audblk_stats(p_ac3dec); -#endif + if( p_main->b_stats ) + { + parse_audblk_stats(p_ac3dec); + } return 0; } @@ -806,7 +806,6 @@ void parse_auxdata (ac3dec_t * p_ac3dec) RemoveBits (&p_ac3dec->bit_stream,16); } -#ifdef TRACE static void parse_bsi_stats (ac3dec_t * p_ac3dec) /* Some stats */ { struct mixlev_s @@ -870,5 +869,4 @@ static void parse_audblk_stats (ac3dec_t * p_ac3dec) intf_ErrMsg ("%1d",p_ac3dec->audblk.blksw[i]); intf_ErrMsg ("]"); } -#endif diff --git a/plugins/ac3_spdif/ac3_spdif.c b/plugins/ac3_spdif/ac3_spdif.c index 34e2d8f329..32d459c47f 100644 --- a/plugins/ac3_spdif/ac3_spdif.c +++ b/plugins/ac3_spdif/ac3_spdif.c @@ -2,7 +2,7 @@ * ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: ac3_spdif.c,v 1.13 2002/02/15 13:32:52 sam Exp $ + * $Id: ac3_spdif.c,v 1.14 2002/02/19 00:50:19 sam Exp $ * * Authors: Stéphane Borel * Juha Yrjola @@ -109,8 +109,6 @@ static int decoder_Run( decoder_config_t * p_config ) /* PTS of the current frame */ mtime_t i_current_pts = 0; - intf_DbgMsg( "spdif debug: ac3_spdif thread created, initializing." ); - /* Allocate the memory needed to store the thread's structure */ p_spdif = malloc( sizeof(ac3_spdif_thread_t) ); @@ -136,8 +134,6 @@ static int decoder_Run( decoder_config_t * p_config ) i_frame_time = 1000000 * AC3_FRAME_SIZE / p_spdif->ac3_info.i_sample_rate; - intf_DbgMsg( "spdif debug: ac3_spdif thread (%p) initialized", p_spdif ); - while( !p_spdif->p_fifo->b_die && !p_spdif->p_fifo->b_error ) { /* Handle the dates */ @@ -292,8 +288,6 @@ static int InitThread( ac3_spdif_thread_t * p_spdif ) *****************************************************************************/ static void EndThread( ac3_spdif_thread_t * p_spdif ) { - intf_DbgMsg( "spdif debug: destroying thread %p", p_spdif ); - /* If the audio output fifo was created, we destroy it */ if( p_spdif->p_aout_fifo != NULL ) { @@ -309,8 +303,6 @@ static void EndThread( ac3_spdif_thread_t * p_spdif ) /* Destroy descriptor */ free( p_spdif->p_ac3 ); free( p_spdif ); - - intf_DbgMsg ("spdif debug: thread %p destroyed", p_spdif ); } /***************************************************************************** diff --git a/plugins/alsa/aout_alsa.c b/plugins/alsa/aout_alsa.c index 48ea8ed307..3ec44e0f33 100644 --- a/plugins/alsa/aout_alsa.c +++ b/plugins/alsa/aout_alsa.c @@ -2,7 +2,7 @@ * aout_alsa.c : Alsa functions library ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: aout_alsa.c,v 1.26 2002/02/15 13:32:52 sam Exp $ + * $Id: aout_alsa.c,v 1.27 2002/02/19 00:50:19 sam Exp $ * * Authors: Henri Fallon - Original Author * Jeffrey Baker - Port to ALSA 1.0 API @@ -90,7 +90,6 @@ static int aout_Open( aout_thread_t *p_aout ) return( -1 ); } - intf_DbgMsg( "aout info: ALSA device successfully opened" ); return( 0 ); } @@ -339,8 +338,6 @@ static void aout_Close( aout_thread_t *p_aout ) } free( p_aout->p_sys ); - - intf_DbgMsg( "aout: ALSA device closed" ); } /***************************************************************************** diff --git a/plugins/directx/vout_events.c b/plugins/directx/vout_events.c index fcdfece54a..025eeb532d 100644 --- a/plugins/directx/vout_events.c +++ b/plugins/directx/vout_events.c @@ -2,7 +2,7 @@ * vout_events.c: Windows DirectX video output events handler ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: vout_events.c,v 1.10 2002/01/27 22:14:52 gbazin Exp $ + * $Id: vout_events.c,v 1.11 2002/02/19 00:50:19 sam Exp $ * * Authors: Gildas Bazin * @@ -190,8 +190,6 @@ void DirectXEventThread( vout_thread_t *p_vout ) case '9': network_ChannelJoin( 9 ); break; default: - intf_DbgMsg( "unhandled key '%c' (%i)", - (char)msg.wParam, msg.wParam ); break; } diff --git a/plugins/dvd/input_dvd.c b/plugins/dvd/input_dvd.c index 101495f041..8d2cc98f19 100644 --- a/plugins/dvd/input_dvd.c +++ b/plugins/dvd/input_dvd.c @@ -9,7 +9,7 @@ * -dvd_udf to find files ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: input_dvd.c,v 1.119 2002/02/15 13:32:53 sam Exp $ + * $Id: input_dvd.c,v 1.120 2002/02/19 00:50:19 sam Exp $ * * Author: Stéphane Borel * @@ -445,9 +445,8 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) p_dvd->i_title_id = vts.title_inf.p_title_start[i_vts_title-1].i_title_id; - intf_WarnMsgImm( 3, "dvd: title %d vts_title %d pgc %d", - p_dvd->i_title, i_vts_title, p_dvd->i_title_id ); - + intf_WarnMsg( 3, "dvd: title %d vts_title %d pgc %d", + p_dvd->i_title, i_vts_title, p_dvd->i_title_id ); /* * Angle management diff --git a/plugins/ggi/ggi.c b/plugins/ggi/ggi.c index 3467054338..15eecf4128 100644 --- a/plugins/ggi/ggi.c +++ b/plugins/ggi/ggi.c @@ -2,7 +2,7 @@ * ggi.c : GGI plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: ggi.c,v 1.13 2002/02/15 13:32:53 sam Exp $ + * $Id: ggi.c,v 1.14 2002/02/19 00:50:19 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -469,11 +469,6 @@ static int OpenDisplay( vout_thread_t *p_vout ) } } - if( p_vout->p_sys->b_must_acquire ) - { - intf_DbgMsg("buffers must be acquired"); - } - /* Set graphic context colors */ col_fg.r = col_fg.g = col_fg.b = -1; col_bg.r = col_bg.g = col_bg.b = 0; diff --git a/plugins/gtk/gnome.c b/plugins/gtk/gnome.c index afa145166f..4ecaeffe97 100644 --- a/plugins/gtk/gnome.c +++ b/plugins/gtk/gnome.c @@ -2,7 +2,7 @@ * gnome.c : Gnome plugin for vlc ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: gnome.c,v 1.9 2002/02/15 13:32:53 sam Exp $ + * $Id: gnome.c,v 1.10 2002/02/19 00:50:19 sam Exp $ * * Authors: Samuel Hocevar * @@ -76,7 +76,7 @@ MODULE_INIT_START { ADD_CAPABILITY( INTF, 100 ) } - ADD_SHORTCUT( "gtk" ) + ADD_SHORTCUT( "gnome" ) ADD_PROGRAM( "gnome-vlc" ) MODULE_INIT_STOP diff --git a/plugins/lirc/lirc.c b/plugins/lirc/lirc.c index b881754f83..89b11b428c 100644 --- a/plugins/lirc/lirc.c +++ b/plugins/lirc/lirc.c @@ -2,7 +2,7 @@ * lirc.c : lirc plugin for vlc ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: lirc.c,v 1.2 2002/02/15 13:32:53 sam Exp $ + * $Id: lirc.c,v 1.3 2002/02/19 00:50:19 sam Exp $ * * Authors: Sigmund Augdal * @@ -95,9 +95,6 @@ static void intf_getfunctions( function_list_t * p_function_list ) *****************************************************************************/ static int intf_Open( intf_thread_t *p_intf ) { - /* Non-buffered stdout */ - setvbuf( stdout, (char *)NULL, _IOLBF, 0 ); - /* Allocate instance and initialize some members */ p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); if( p_intf->p_sys == NULL ) diff --git a/plugins/lpcm_adec/lpcm_adec.c b/plugins/lpcm_adec/lpcm_adec.c index 650b5a3a6f..7b6f6f1f3e 100644 --- a/plugins/lpcm_adec/lpcm_adec.c +++ b/plugins/lpcm_adec/lpcm_adec.c @@ -2,7 +2,7 @@ * lpcm_decoder_thread.c: lpcm decoder thread ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: lpcm_adec.c,v 1.11 2002/02/15 13:32:53 sam Exp $ + * $Id: lpcm_adec.c,v 1.12 2002/02/19 00:50:19 sam Exp $ * * Authors: Samuel Hocevar * Henri Fallon @@ -94,8 +94,6 @@ static int decoder_Run( decoder_config_t * p_config ) { lpcmdec_thread_t * p_lpcmdec; - intf_DbgMsg("lpcm_adec debug: thread launched, initializing."); - /* Allocate the memory needed to store the thread's structure */ if( (p_lpcmdec = (lpcmdec_thread_t *)malloc (sizeof(lpcmdec_thread_t)) ) == NULL) @@ -118,9 +116,6 @@ static int decoder_Run( decoder_config_t * p_config ) return( -1 ); } - intf_DbgMsg( "LPCM Debug: lpcm decoder thread %p initialized\n", - p_lpcmdec ); - /* lpcm decoder thread's main loop */ while ((!p_lpcmdec->p_fifo->b_die) && (!p_lpcmdec->p_fifo->b_error)) { @@ -208,9 +203,6 @@ void DecodeFrame( lpcmdec_thread_t * p_lpcmdec ) (p_lpcmdec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE; vlc_cond_signal (&p_lpcmdec->p_aout_fifo->data_wait); vlc_mutex_unlock (&p_lpcmdec->p_aout_fifo->data_lock); - - intf_DbgMsg( "LPCM Debug: %x", *buffer ); - } /***************************************************************************** @@ -218,8 +210,6 @@ void DecodeFrame( lpcmdec_thread_t * p_lpcmdec ) *****************************************************************************/ static void EndThread( lpcmdec_thread_t * p_lpcmdec ) { - intf_DbgMsg( "LPCM Debug: destroying lpcm decoder thread %p", p_lpcmdec ); - /* If the audio output fifo was created, we destroy it */ if( p_lpcmdec->p_aout_fifo != NULL ) { @@ -233,6 +223,4 @@ static void EndThread( lpcmdec_thread_t * p_lpcmdec ) /* Destroy descriptor */ free( p_lpcmdec ); - - intf_DbgMsg( "LPCM Debug: lpcm decoder thread %p destroyed", p_lpcmdec ); } diff --git a/plugins/macosx/aout_macosx.c b/plugins/macosx/aout_macosx.c index 75a5bca5ed..4cc9917690 100644 --- a/plugins/macosx/aout_macosx.c +++ b/plugins/macosx/aout_macosx.c @@ -2,7 +2,7 @@ * aout_darwin.c : Darwin audio output plugin ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: aout_macosx.c,v 1.12 2002/02/15 13:32:53 sam Exp $ + * $Id: aout_macosx.c,v 1.13 2002/02/19 00:50:19 sam Exp $ * * Authors: Colin Delacroix * @@ -228,8 +228,6 @@ static int aout_SetFormat( aout_thread_t *p_aout ) if( err == noErr ) { - intf_DbgMsg( "audio output format is %i", p_aout->i_format ); - /* * setting format.mFormatFlags to anything but the default value * doesn't seem to work. Can anybody explain that ?? @@ -243,14 +241,12 @@ static int aout_SetFormat( aout_thread_t *p_aout ) return( -1 ); case AOUT_FMT_S16_LE: /* Little endian signed 16 */ - intf_DbgMsg( "This means Little endian signed 16" ); // format.mFormatFlags &= ~kLinearPCMFormatFlagIsBigEndian; intf_ErrMsg( "Audio format (LE Unsigned 16) not supported now," "please report stream" ); return( -1 ); case AOUT_FMT_S16_BE: /* Big endian signed 16 */ - intf_DbgMsg( "This means big endian signed 16" ); // format.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; break; @@ -261,7 +257,6 @@ static int aout_SetFormat( aout_thread_t *p_aout ) case AOUT_FMT_U16_LE: /* Little endian U16 */ // format.mFormatFlags &= ~kLinearPCMFormatFlagIsSignedInteger; - intf_DbgMsg( "This means Little endian U16" ); intf_ErrMsg( "Audio format (LE Unsigned 8) not supported now," "please report stream" ); return( -1 ); @@ -274,7 +269,6 @@ static int aout_SetFormat( aout_thread_t *p_aout ) break; default: - intf_DbgMsg( "This means Unknown aout format" ); return( -1 ); } @@ -363,7 +357,6 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) { #if WRITE_AUDIO_OUTPUT_TO_FILE write( p_aout->p_sys->fd, buffer, i_size ); - intf_DbgMsg( "write() -> %d", write( p_aout->p_sys->fd, buffer, i_size ) ); #else Convert16BitIntegerTo32Float( buffer, p_aout->p_sys->p_Data, i_size ); diff --git a/plugins/mad/mad_libmad.c b/plugins/mad/mad_libmad.c index 15a0af6b56..f0d7dafd31 100644 --- a/plugins/mad/mad_libmad.c +++ b/plugins/mad/mad_libmad.c @@ -154,7 +154,6 @@ enum mad_flow libmad_input(void *data, struct mad_stream *p_libmad_stream) * mad_adec_thread_t *p_mad_adec = (mad_adec_thread_t *) data; * * intf_ErrMsg( "mad_adec: libmad_header samplerate %d", p_libmad_header->samplerate); - * intf_DbgMsg( "mad_adec: libmad_header bitrate %d", p_libmad_header->bitrate); * * p_mad_adec->p_aout_fifo->l_rate = p_libmad_header->samplerate; * mad_timer_add(&p_mad_adec->libmad_timer,p_libmad_header->duration); diff --git a/plugins/mga/xmga.c b/plugins/mga/xmga.c index ba151102d0..462c0b74ad 100644 --- a/plugins/mga/xmga.c +++ b/plugins/mga/xmga.c @@ -2,7 +2,7 @@ * xmga.c : X11 MGA plugin for vlc ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: xmga.c,v 1.4 2002/02/15 13:32:53 sam Exp $ + * $Id: xmga.c,v 1.5 2002/02/19 00:50:19 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -558,8 +558,6 @@ static int vout_Manage( vout_thread_t *p_vout ) case '9': network_ChannelJoin( 9 ); break; default: - intf_DbgMsg( "vout: unhandled key '%c' (%i)", - (char)i_key, i_key ); break; } } @@ -626,10 +624,6 @@ static int vout_Manage( vout_thread_t *p_vout ) { p_main->p_intf->b_die = 1; } - else - { - intf_DbgMsg( "vout: unhandled ClientMessage received" ); - } } /* @@ -1175,7 +1169,6 @@ static void EnableXScreenSaver( vout_thread_t *p_vout ) { int dummy; - intf_DbgMsg( "vout: enabling screen saver" ); XSetScreenSaver( p_vout->p_sys->p_display, p_vout->p_sys->i_ss_timeout, p_vout->p_sys->i_ss_interval, p_vout->p_sys->i_ss_blanking, @@ -1207,7 +1200,6 @@ static void DisableXScreenSaver( vout_thread_t *p_vout ) &p_vout->p_sys->i_ss_exposure ); /* Disable screen saver */ - intf_DbgMsg( "vout: disabling screen saver" ); XSetScreenSaver( p_vout->p_sys->p_display, 0, p_vout->p_sys->i_ss_interval, p_vout->p_sys->i_ss_blanking, @@ -1220,7 +1212,6 @@ static void DisableXScreenSaver( vout_thread_t *p_vout ) /* Save DPMS current state */ DPMSInfo( p_vout->p_sys->p_display, &dummy, &p_vout->p_sys->b_ss_dpms ); - intf_DbgMsg( "vout: disabling DPMS" ); DPMSDisable( p_vout->p_sys->p_display ); } } diff --git a/plugins/mpeg_adec/mpeg_adec.c b/plugins/mpeg_adec/mpeg_adec.c index e42a42beb4..08a34ba880 100644 --- a/plugins/mpeg_adec/mpeg_adec.c +++ b/plugins/mpeg_adec/mpeg_adec.c @@ -2,7 +2,7 @@ * mpeg_adec.c: MPEG audio decoder thread ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: mpeg_adec.c,v 1.18 2002/02/15 13:32:53 sam Exp $ + * $Id: mpeg_adec.c,v 1.19 2002/02/19 00:50:19 sam Exp $ * * Authors: Michel Kaempf * Michel Lespinasse @@ -95,8 +95,6 @@ static int decoder_Run ( decoder_config_t * p_config ) { adec_thread_t * p_adec; - intf_DbgMsg("mpeg_adec debug: thread launched, initializing."); - /* Allocate the memory needed to store the thread's structure */ if ( (p_adec = (adec_thread_t *)malloc (sizeof(adec_thread_t))) == NULL ) { @@ -130,8 +128,6 @@ static int decoder_Run ( decoder_config_t * p_config ) it will be created when the first frame is received */ p_adec->p_aout_fifo = NULL; - intf_DbgMsg("mpeg_adec debug: thread initialized, decoding begins."); - p_adec->i_sync = 0; /* Audio decoder thread's main loop */ @@ -240,8 +236,6 @@ static void DecodeThread( adec_thread_t * p_adec ) *****************************************************************************/ static void EndThread ( adec_thread_t *p_adec ) { - intf_DbgMsg ( "adec debug: destroying audio decoder thread %p", p_adec ); - /* If the audio output fifo was created, we destroy it */ if ( p_adec->p_aout_fifo != NULL ) { @@ -254,7 +248,5 @@ static void EndThread ( adec_thread_t *p_adec ) } /* Destroy descriptor */ free( p_adec ); - - intf_DbgMsg ("adec debug: audio decoder thread %p destroyed", p_adec); } diff --git a/plugins/mpeg_vdec/video_decoder.c b/plugins/mpeg_vdec/video_decoder.c index c2309bbff6..ebaf22cc91 100644 --- a/plugins/mpeg_vdec/video_decoder.c +++ b/plugins/mpeg_vdec/video_decoder.c @@ -2,7 +2,7 @@ * video_decoder.c : video decoder thread ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: video_decoder.c,v 1.5 2001/12/30 07:09:56 sam Exp $ + * $Id: video_decoder.c,v 1.6 2002/02/19 00:50:19 sam Exp $ * * Authors: Christophe Massiot * Michel Lespinasse @@ -61,8 +61,6 @@ vdec_thread_t * vdec_CreateThread( vdec_pool_t * p_pool ) { vdec_thread_t * p_vdec; - intf_DbgMsg("vdec debug: creating video decoder thread"); - /* Allocate the memory needed to store the thread's structure */ if ( (p_vdec = (vdec_thread_t *)malloc( sizeof(vdec_thread_t) )) == NULL ) { @@ -89,7 +87,6 @@ vdec_thread_t * vdec_CreateThread( vdec_pool_t * p_pool ) return( NULL ); } - intf_DbgMsg("vdec debug: video decoder thread (%p) created", p_vdec); return( p_vdec ); } @@ -98,8 +95,6 @@ vdec_thread_t * vdec_CreateThread( vdec_pool_t * p_pool ) *****************************************************************************/ void vdec_DestroyThread( vdec_thread_t *p_vdec ) { - intf_DbgMsg("vdec debug: requesting termination of video decoder thread %p", p_vdec); - /* Ask thread to kill itself */ p_vdec->b_die = 1; @@ -122,8 +117,6 @@ void vdec_DestroyThread( vdec_thread_t *p_vdec ) *****************************************************************************/ void vdec_InitThread( vdec_thread_t * p_vdec ) { - intf_DbgMsg("vdec debug: initializing video decoder thread %p", p_vdec); - #if !defined(SYS_BEOS) # if VDEC_NICE /* Re-nice ourself - otherwise we would steal CPU time from the video @@ -146,7 +139,6 @@ void vdec_InitThread( vdec_thread_t * p_vdec ) p_vdec->p_pool->pf_idct_init( &p_vdec->p_idct_data ); /* Mark thread as running and return */ - intf_DbgMsg("vdec debug: InitThread(%p) succeeded", p_vdec); } /***************************************************************************** @@ -157,8 +149,6 @@ void vdec_InitThread( vdec_thread_t * p_vdec ) *****************************************************************************/ void vdec_EndThread( vdec_thread_t * p_vdec ) { - intf_DbgMsg("vdec debug: EndThread(%p)", p_vdec); - if( p_vdec->p_idct_data != NULL ) { free( p_vdec->p_idct_data ); @@ -388,9 +378,6 @@ DECLARE_DECODEMB( vdec_DecodeMacroblock444, CHROMA_444 ); *****************************************************************************/ static void RunThread( vdec_thread_t *p_vdec ) { - intf_DbgMsg("vdec debug: running video decoder thread (%p) (pid == %i)", - p_vdec, getpid()); - vdec_InitThread( p_vdec ); /* diff --git a/plugins/mpeg_vdec/video_parser.c b/plugins/mpeg_vdec/video_parser.c index 70093a9d95..da4e36afde 100644 --- a/plugins/mpeg_vdec/video_parser.c +++ b/plugins/mpeg_vdec/video_parser.c @@ -2,7 +2,7 @@ * video_parser.c : video parser thread ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: video_parser.c,v 1.13 2002/02/15 13:32:53 sam Exp $ + * $Id: video_parser.c,v 1.14 2002/02/19 00:50:19 sam Exp $ * * Authors: Christophe Massiot * Samuel Hocevar @@ -107,8 +107,6 @@ static int decoder_Run ( decoder_config_t * p_config ) vpar_thread_t * p_vpar; boolean_t b_error; - intf_DbgMsg( "vpar debug: video parser thread created. Initializing..." ); - /* Allocate the memory needed to store the thread's structure */ if ( (p_vpar = (vpar_thread_t *)malloc( sizeof(vpar_thread_t) )) == NULL ) { @@ -265,7 +263,6 @@ static int InitThread( vpar_thread_t *p_vpar ) vpar_InitPool( p_vpar ); /* Mark thread as running and return */ - intf_DbgMsg("vpar debug: InitThread(%p) succeeded", p_vpar); return( 0 ); } @@ -277,8 +274,6 @@ static int InitThread( vpar_thread_t *p_vpar ) *****************************************************************************/ static void EndThread( vpar_thread_t *p_vpar ) { - intf_DbgMsg("vpar debug: destroying video parser thread %p", p_vpar); - /* Release used video buffers. */ if( p_vpar->sequence.p_forward != NULL ) { @@ -367,8 +362,6 @@ static void EndThread( vpar_thread_t *p_vpar ) module_Unneed( p_vpar->p_motion_module ); free( p_vpar ); - - intf_DbgMsg("vpar debug: EndThread(%p)", p_vpar); } /***************************************************************************** @@ -388,9 +381,6 @@ static void BitstreamCallback ( bit_stream_t * p_bit_stream, if( p_bit_stream->p_decoder_fifo->p_first->b_discontinuity ) { -#ifdef TRACE_VPAR - intf_DbgMsg( "Discontinuity in BitstreamCallback" ); -#endif /* Escape the current picture and reset the picture predictors. */ p_vpar->sequence.b_expect_discontinuity = 1; p_vpar->picture.b_error = 1; @@ -399,9 +389,6 @@ static void BitstreamCallback ( bit_stream_t * p_bit_stream, if( p_bit_stream->p_data->b_discard_payload ) { -#ifdef TRACE_VPAR - intf_DbgMsg( "Discard payload in BitstreamCallback" ); -#endif /* 1 packet messed up, trash the slice. */ p_vpar->picture.b_error = 1; } diff --git a/plugins/mpeg_vdec/vpar_headers.c b/plugins/mpeg_vdec/vpar_headers.c index ef1769b4e1..e2649ebcf5 100644 --- a/plugins/mpeg_vdec/vpar_headers.c +++ b/plugins/mpeg_vdec/vpar_headers.c @@ -2,7 +2,7 @@ * vpar_headers.c : headers parsing ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: vpar_headers.c,v 1.13 2002/02/13 22:10:40 sam Exp $ + * $Id: vpar_headers.c,v 1.14 2002/02/19 00:50:19 sam Exp $ * * Authors: Christophe Massiot * Stéphane Borel @@ -804,7 +804,6 @@ static void PictureHeader( vpar_thread_t * p_vpar ) p_vpar->picture.b_repeat_first_field ) ) == NULL ) { - intf_DbgMsg("vpar debug: vout_CreatePicture failed, delaying"); if( p_vpar->p_fifo->b_die || p_vpar->p_fifo->b_error ) { return; diff --git a/plugins/mpeg_vdec/vpar_synchro.c b/plugins/mpeg_vdec/vpar_synchro.c index bad3772992..38e1cda392 100644 --- a/plugins/mpeg_vdec/vpar_synchro.c +++ b/plugins/mpeg_vdec/vpar_synchro.c @@ -2,7 +2,7 @@ * vpar_synchro.c : frame dropping routines ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: vpar_synchro.c,v 1.5 2001/12/30 07:09:56 sam Exp $ + * $Id: vpar_synchro.c,v 1.6 2002/02/19 00:50:19 sam Exp $ * * Authors: Christophe Massiot * Samuel Hocevar @@ -206,9 +206,6 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type, mtime_t now, period, tau_yuv; mtime_t pts = 0; boolean_t b_decode = 0; -#ifdef TRACE_VPAR - char p_date[MSTRTIME_MAX_SIZE]; -#endif now = mdate(); period = 1000000 * 1001 / p_vpar->sequence.i_frame_rate @@ -297,13 +294,6 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type, } } -#ifdef TRACE_VPAR - intf_DbgMsg("vpar synchro debug: %s picture scheduled for %s, %s (%lld)", - i_coding_type == B_CODING_TYPE ? "B" : - (i_coding_type == P_CODING_TYPE ? "P" : "I"), - mstrtime(p_date, pts), b_decode ? "decoding" : "trashed", - S.p_tau[i_coding_type]); -#endif if( !b_decode ) { S.i_not_chosen_pic++; @@ -359,18 +349,6 @@ void vpar_SynchroEnd( vpar_thread_t * p_vpar, int i_coding_type, p_vpar->synchro.pi_meaningful[i_coding_type]++; } } - -#ifdef TRACE_VPAR - intf_DbgMsg("vpar synchro debug: finished decoding %s (%lld)", - i_coding_type == B_CODING_TYPE ? "B" : - (i_coding_type == P_CODING_TYPE ? "P" : "I"), tau); -#endif - } - else - { - intf_DbgMsg("vpar synchro debug: aborting %s", - i_coding_type == B_CODING_TYPE ? "B" : - (i_coding_type == P_CODING_TYPE ? "P" : "I")); } } diff --git a/plugins/qnx/vout_qnx.c b/plugins/qnx/vout_qnx.c index 5d524fa9c4..e32d8b9dbc 100644 --- a/plugins/qnx/vout_qnx.c +++ b/plugins/qnx/vout_qnx.c @@ -476,12 +476,6 @@ static int vout_Manage( vout_thread_t *p_vout ) { network_ChannelJoin( i_key ); } - else if( intf_ProcessKey( p_main->p_intf, - (char) i_key ) ) - { - intf_DbgMsg( "vout: unhandled key '%c' (%i)", - (char) i_key, i_key ); - } break; } } @@ -498,8 +492,6 @@ static int vout_Manage( vout_thread_t *p_vout ) { PhDim_t dim; - intf_DbgMsg( "vout: changing full-screen status" ); - p_vout->b_fullscreen = !p_vout->b_fullscreen; p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE; @@ -540,7 +532,6 @@ static int vout_Manage( vout_thread_t *p_vout ) */ if( p_vout->i_changes & VOUT_SIZE_CHANGE ) { - intf_DbgMsg( "vout: resizing window" ); p_vout->i_changes &= ~VOUT_SIZE_CHANGE; if( p_vout->p_sys->i_mode != MODE_VIDEO_OVERLAY ) @@ -566,8 +557,6 @@ static int vout_Manage( vout_thread_t *p_vout ) */ if( b_repos && p_vout->p_sys->i_mode == MODE_VIDEO_OVERLAY ) { - intf_DbgMsg( "vout: moving video channel" ); - vout_End( p_vout ); if( vout_Init( p_vout ) ) { @@ -670,7 +659,6 @@ static int QNXInitDisplay( p_vout_thread_t p_vout ) hwcaps.currently_available_video_ram >= ( ( minfo.width * minfo.height * minfo.bits_per_pixel ) / 8 ) ) { - intf_DbgMsg( "vout: using video ram" ); p_vout->p_sys->i_mode = MODE_VIDEO_MEM; } diff --git a/plugins/sdl/vout_sdl.c b/plugins/sdl/vout_sdl.c index 50f206b817..a6fa54f576 100644 --- a/plugins/sdl/vout_sdl.c +++ b/plugins/sdl/vout_sdl.c @@ -2,7 +2,7 @@ * vout_sdl.c: SDL video output display method ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: vout_sdl.c,v 1.81 2002/02/15 13:32:53 sam Exp $ + * $Id: vout_sdl.c,v 1.82 2002/02/19 00:50:19 sam Exp $ * * Authors: Samuel Hocevar * Pierre Baillet @@ -473,7 +473,6 @@ static int vout_Manage( vout_thread_t *p_vout ) case SDLK_F9: network_ChannelJoin( 9 ); break; default: - intf_DbgMsg( "unhandled key %i", event.key.keysym.sym ); break; } break; diff --git a/plugins/spudec/spu_decoder.c b/plugins/spudec/spu_decoder.c index f2847da14d..411d0f5a2c 100644 --- a/plugins/spudec/spu_decoder.c +++ b/plugins/spudec/spu_decoder.c @@ -2,7 +2,7 @@ * spu_decoder.c : spu decoder thread ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: spu_decoder.c,v 1.9 2002/02/15 13:32:53 sam Exp $ + * $Id: spu_decoder.c,v 1.10 2002/02/19 00:50:19 sam Exp $ * * Authors: Samuel Hocevar * @@ -171,20 +171,15 @@ static int decoder_Run( decoder_config_t * p_config ) *****************************************************************************/ static int InitThread( spudec_thread_t *p_spudec ) { - int i_retry = 0; - - /* Spawn a video output if there is none */ + /* Find an available video output */ vlc_mutex_lock( &p_vout_bank->lock ); while( p_vout_bank->i_count == 0 ) { vlc_mutex_unlock( &p_vout_bank->lock ); - if( i_retry++ > 10 ) + if( p_spudec->p_fifo->b_die || p_spudec->p_fifo->b_error ) { - intf_WarnMsg( 1, "spudec: waited too long for vout, aborting" ); - free( p_spudec ); - return( -1 ); } diff --git a/plugins/text/Makefile b/plugins/text/Makefile index e4af72a3c1..a90b85c303 100644 --- a/plugins/text/Makefile +++ b/plugins/text/Makefile @@ -1,2 +1,3 @@ ncurses_SOURCES = ncurses.c rc_SOURCES = rc.c +logger_SOURCES = logger.c diff --git a/plugins/text/logger.c b/plugins/text/logger.c new file mode 100644 index 0000000000..adcf0d0581 --- /dev/null +++ b/plugins/text/logger.c @@ -0,0 +1,202 @@ +/***************************************************************************** + * logger.c : file logging plugin for vlc + ***************************************************************************** + * Copyright (C) 2002 VideoLAN + * $Id: logger.c,v 1.1 2002/02/19 00:50:19 sam Exp $ + * + * Authors: Samuel Hocevar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#include /* malloc(), free() */ +#include + +#include /* ENOMEM */ +#include + +#include + +#include "interface.h" + +#define LOG_FILE "vlc.log" +#define LOG_STRING( msg, file ) fwrite( msg, strlen( msg ), 1, file ); + +/***************************************************************************** + * intf_sys_t: description and status of log interface + *****************************************************************************/ +typedef struct intf_sys_s +{ + FILE * p_file; /* The log file */ + intf_subscription_t *p_sub; + +} intf_sys_t; + +/***************************************************************************** + * Local prototypes. + *****************************************************************************/ +static void intf_getfunctions ( function_list_t * p_function_list ); +static int intf_Open ( intf_thread_t *p_intf ); +static void intf_Close ( intf_thread_t *p_intf ); +static void intf_Run ( intf_thread_t *p_intf ); + +static void FlushQueue ( intf_subscription_t *, FILE * ); + +/***************************************************************************** + * Build configuration tree. + *****************************************************************************/ +MODULE_CONFIG_START +MODULE_CONFIG_STOP + +MODULE_INIT_START + SET_DESCRIPTION( "file logging interface module" ) + ADD_CAPABILITY( INTF, 1 ) + ADD_SHORTCUT( "logger" ) +MODULE_INIT_STOP + +MODULE_ACTIVATE_START + intf_getfunctions( &p_module->p_functions->intf ); +MODULE_ACTIVATE_STOP + +MODULE_DEACTIVATE_START +MODULE_DEACTIVATE_STOP + +/***************************************************************************** + * Functions exported as capabilities. They are declared as static so that + * we don't pollute the namespace too much. + *****************************************************************************/ +static void intf_getfunctions( function_list_t * p_function_list ) +{ + p_function_list->functions.intf.pf_open = intf_Open; + p_function_list->functions.intf.pf_close = intf_Close; + p_function_list->functions.intf.pf_run = intf_Run; +} + +/***************************************************************************** + * intf_Open: initialize and create stuff + *****************************************************************************/ +static int intf_Open( intf_thread_t *p_intf ) +{ + char *psz_filename; + + /* Allocate instance and initialize some members */ + p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) ); + if( p_intf->p_sys == NULL ) + { + intf_ErrMsg( "intf error: %s", strerror(ENOMEM) ); + return -1; + } + + psz_filename = main_GetPszVariable( INTF_METHOD_VAR, NULL ); + + while( *psz_filename && *psz_filename != ':' ) + { + psz_filename++; + } + + if( *psz_filename == ':' ) + { + psz_filename++; + } + else + { + intf_ErrMsg( "intf error: no log filename provided, using `%s'", + LOG_FILE ); + psz_filename = LOG_FILE; + } + + /* Open the log file */ + intf_WarnMsg( 1, "intf: opening logfile `%s'", psz_filename ); + p_intf->p_sys->p_file = fopen( psz_filename, "w" ); + + p_intf->p_sys->p_sub = intf_MsgSub(); + + if( p_intf->p_sys->p_file == NULL ) + { + intf_ErrMsg( "intf error: error opening logfile `%s'", psz_filename ); + free( p_intf->p_sys ); + intf_MsgUnsub( p_intf->p_sys->p_sub ); + return -1; + } + + LOG_STRING( "-- log plugin started --\n", p_intf->p_sys->p_file ); + + return 0; +} + +/***************************************************************************** + * intf_Close: destroy interface stuff + *****************************************************************************/ +static void intf_Close( intf_thread_t *p_intf ) +{ + /* Flush the queue and unsubscribe from the message queue */ + FlushQueue( p_intf->p_sys->p_sub, p_intf->p_sys->p_file ); + intf_MsgUnsub( p_intf->p_sys->p_sub ); + + LOG_STRING( "-- log plugin stopped --\n", p_intf->p_sys->p_file ); + + /* Close the log file */ + fclose( p_intf->p_sys->p_file ); + + /* Destroy structure */ + free( p_intf->p_sys ); +} + +/***************************************************************************** + * intf_Run: rc thread + ***************************************************************************** + * This part of the interface is in a separate thread so that we can call + * exec() from within it without annoying the rest of the program. + *****************************************************************************/ +static void intf_Run( intf_thread_t *p_intf ) +{ + while( !p_intf->b_die ) + { + p_intf->pf_manage( p_intf ); + + FlushQueue( p_intf->p_sys->p_sub, p_intf->p_sys->p_file ); + + msleep( INTF_IDLE_SLEEP ); + } +} + +/***************************************************************************** + * FlushQueue: flush the message queue into the log file + *****************************************************************************/ +static void FlushQueue( intf_subscription_t *p_sub, FILE *p_file ) +{ + int i_start, i_stop; + char *psz_msg; + + vlc_mutex_lock( p_sub->p_lock ); + i_stop = *p_sub->pi_stop; + vlc_mutex_unlock( p_sub->p_lock ); + + /* Append all messages to log file */ + for( i_start = p_sub->i_start; i_start < i_stop; i_start++ ) + { + psz_msg = p_sub->p_msg[i_start].psz_msg; + LOG_STRING( psz_msg, p_file ); + LOG_STRING( "\n", p_file ); + } + + vlc_mutex_lock( p_sub->p_lock ); + p_sub->i_start = i_start; + vlc_mutex_unlock( p_sub->p_lock ); +} + diff --git a/plugins/vcd/input_vcd.c b/plugins/vcd/input_vcd.c index 2d7b8b3bf6..755bbff207 100644 --- a/plugins/vcd/input_vcd.c +++ b/plugins/vcd/input_vcd.c @@ -464,8 +464,6 @@ static int VCDRead( input_thread_t * p_input, data_packet_t ** pp_data ) break; /* go to the next sector */ } - intf_DbgMsg( "packet start code : %X", i_header ); - switch( i_header ) { /* 0x1b9 == SYSTEM_END_CODE, it is only 4 bytes long. */ @@ -500,9 +498,6 @@ static int VCDRead( input_thread_t * p_input, data_packet_t ** pp_data ) break; } - intf_DbgMsg( "i_index : %d", i_index ); - intf_DbgMsg( "i_packet_size : %d", i_packet_size ); - if ( i_index + i_packet_size > BUFFER_SIZE ) { intf_ErrMsg( "vcd error: packet too long (%i)", diff --git a/plugins/vcd/linux_cdrom_tools.c b/plugins/vcd/linux_cdrom_tools.c index abafc3a10d..89657820e2 100644 --- a/plugins/vcd/linux_cdrom_tools.c +++ b/plugins/vcd/linux_cdrom_tools.c @@ -116,9 +116,6 @@ int ioctl_ReadSector( int i_fd, int i_sector, byte_t * p_buffer ) p_msf->minute = i_dummy / (CD_FRAMES * CD_SECS); p_msf->second = ( i_dummy % (CD_FRAMES * CD_SECS) ) / CD_FRAMES; p_msf->frame = ( i_dummy % (CD_FRAMES * CD_SECS) ) % CD_FRAMES; - - intf_DbgMsg( "vcd debug: playing frame %d:%d-%d", - p_msf->minute, p_msf->second, p_msf->frame); #undef p_msf if( ioctl(i_fd, CDROMREADRAW, p_block) == -1 ) diff --git a/plugins/x11/x11.c b/plugins/x11/x11.c index 2b8906b26a..114e745fdf 100644 --- a/plugins/x11/x11.c +++ b/plugins/x11/x11.c @@ -2,7 +2,7 @@ * x11.c : X11 plugin for vlc ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: x11.c,v 1.10 2001/12/30 07:09:56 sam Exp $ + * $Id: x11.c,v 1.11 2002/02/19 00:50:19 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -68,8 +68,6 @@ static void vout_SetPalette( p_vout_thread_t p_vout, int i, j; XColor p_colors[255]; - intf_DbgMsg( "vout: Palette change called" ); - /* allocate palette */ for( i = 0, j = 255; i < 255; i++, j-- ) { diff --git a/plugins/x11/xcommon.c b/plugins/x11/xcommon.c index cd2d01dc22..c52853a03c 100644 --- a/plugins/x11/xcommon.c +++ b/plugins/x11/xcommon.c @@ -2,7 +2,7 @@ * xcommon.c: Functions common to the X11 and XVideo plugins ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: xcommon.c,v 1.16 2002/02/15 13:32:54 sam Exp $ + * $Id: xcommon.c,v 1.17 2002/02/19 00:50:19 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -669,8 +669,6 @@ static int vout_Manage( vout_thread_t *p_vout ) case '9': network_ChannelJoin( 9 ); break; default: - intf_DbgMsg( "vout: unhandled key '%c' (%i)", - (char)i_key, i_key ); break; } } @@ -767,10 +765,6 @@ static int vout_Manage( vout_thread_t *p_vout ) { p_main->p_intf->b_die = 1; } - else - { - intf_DbgMsg( "vout: unhandled ClientMessage received" ); - } } /* @@ -792,7 +786,6 @@ static int vout_Manage( vout_thread_t *p_vout ) if( b_resized ) { /* If interface window has been resized, change vout size */ - intf_DbgMsg( "vout: resizing output window" ); p_vout->i_width = p_vout->p_sys->i_width; p_vout->i_height = p_vout->p_sys->i_height; p_vout->i_changes |= VOUT_SIZE_CHANGE; @@ -801,7 +794,6 @@ static int vout_Manage( vout_thread_t *p_vout ) (p_vout->i_height != p_vout->p_sys->i_height) ) { /* If video output size has changed, change interface window size */ - intf_DbgMsg( "vout: resizing output window" ); p_vout->p_sys->i_width = p_vout->i_width; p_vout->p_sys->i_height = p_vout->i_height; XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window, @@ -821,7 +813,6 @@ static int vout_Manage( vout_thread_t *p_vout ) */ if( p_vout->i_changes & VOUT_SIZE_CHANGE ) { - intf_DbgMsg( "vout info: resizing window" ); p_vout->i_changes &= ~VOUT_SIZE_CHANGE; /* Resize window */ @@ -1660,7 +1651,6 @@ static void EnableXScreenSaver( vout_thread_t *p_vout ) int dummy; #endif - intf_DbgMsg( "vout: enabling screen saver" ); XSetScreenSaver( p_vout->p_sys->p_display, p_vout->p_sys->i_ss_timeout, p_vout->p_sys->i_ss_interval, p_vout->p_sys->i_ss_blanking, @@ -1696,7 +1686,6 @@ static void DisableXScreenSaver( vout_thread_t *p_vout ) &p_vout->p_sys->i_ss_exposure ); /* Disable screen saver */ - intf_DbgMsg( "vout: disabling screen saver" ); XSetScreenSaver( p_vout->p_sys->p_display, 0, p_vout->p_sys->i_ss_interval, p_vout->p_sys->i_ss_blanking, @@ -1710,7 +1699,6 @@ static void DisableXScreenSaver( vout_thread_t *p_vout ) /* Save DPMS current state */ DPMSInfo( p_vout->p_sys->p_display, &unused, &p_vout->p_sys->b_ss_dpms ); - intf_DbgMsg( "vout: disabling DPMS" ); DPMSDisable( p_vout->p_sys->p_display ); } #endif diff --git a/src/audio_output/aout_common.c b/src/audio_output/aout_common.c index 8383b9eed8..a8860cebc9 100644 --- a/src/audio_output/aout_common.c +++ b/src/audio_output/aout_common.c @@ -2,7 +2,7 @@ * aout_common.c: generic audio output functions ***************************************************************************** * Copyright (C) 1999-2002 VideoLAN - * $Id: aout_common.c,v 1.2 2002/01/14 19:54:36 asmax Exp $ + * $Id: aout_common.c,v 1.3 2002/02/19 00:50:19 sam Exp $ * * Authors: Michel Kaempf * Cyril Deguet @@ -123,7 +123,7 @@ void aout_FillBuffer( aout_thread_t * p_aout, aout_fifo_t * p_fifo ) default: - intf_DbgMsg("aout debug: unknown fifo type (%i)", p_fifo->i_type); + intf_ErrMsg("aout error: unknown fifo type (%i)", p_fifo->i_type); break; } } @@ -204,9 +204,6 @@ static int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, l_rate = p_fifo->l_rate; } - intf_DbgMsg( "aout debug: %lli (%li);", aout_date - - p_fifo->date[p_fifo->l_start_frame], l_rate ); - InitializeIncrement( &p_fifo->unit_increment, l_rate, p_aout->l_rate ); p_fifo->l_units = (((l_units - (p_fifo->l_unit - diff --git a/src/audio_output/aout_spdif.c b/src/audio_output/aout_spdif.c index 958003277c..7063fc6745 100644 --- a/src/audio_output/aout_spdif.c +++ b/src/audio_output/aout_spdif.c @@ -2,7 +2,7 @@ * aout_spdif: ac3 passthrough output ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: aout_spdif.c,v 1.21 2001/12/30 07:09:56 sam Exp $ + * $Id: aout_spdif.c,v 1.22 2002/02/19 00:50:19 sam Exp $ * * Authors: Michel Kaempf * Stéphane Borel @@ -52,8 +52,6 @@ void aout_SpdifThread( aout_thread_t * p_aout ) mtime_t m_old = 0; - intf_DbgMsg( "aout debug: starting spdif output loop" ); - while( !p_aout->b_die ) { for( i_fifo = 0 ; i_fifo < AOUT_MAX_FIFOS ; i_fifo++ ) @@ -103,8 +101,6 @@ void aout_SpdifThread( aout_thread_t * p_aout ) /* check continuity */ if( (m_play - m_old) != m_frame_time ) { - intf_DbgMsg( "aout debug: malformed frame ? (%lld)", - m_play - m_old ); mwait( m_play - m_frame_time ); } else @@ -117,10 +113,6 @@ void aout_SpdifThread( aout_thread_t * p_aout ) (byte_t *)p_aout->buffer, SPDIF_FRAME_SIZE ); } - else - { - intf_DbgMsg( "aout debug: late spdif frame" ); - } } else { @@ -132,7 +124,6 @@ void aout_SpdifThread( aout_thread_t * p_aout ) } } - intf_DbgMsg( "aout debug: exiting spdif loop" ); vlc_mutex_lock( &p_aout->fifos_lock ); for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ ) diff --git a/src/input/input.c b/src/input/input.c index d0e3a6ee2a..8b9c8d71e2 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -4,7 +4,7 @@ * decoders. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: input.c,v 1.174 2002/02/15 13:32:54 sam Exp $ + * $Id: input.c,v 1.175 2002/02/19 00:50:19 sam Exp $ * * Authors: Christophe Massiot * @@ -441,8 +441,6 @@ static void RunThread( input_thread_t *p_input ) EndThread( p_input ); DestroyThread( p_input ); - - intf_DbgMsg("input: Thread end"); } /***************************************************************************** diff --git a/src/input/input_dec.c b/src/input/input_dec.c index 5c80238ace..48e5dabae0 100644 --- a/src/input/input_dec.c +++ b/src/input/input_dec.c @@ -2,7 +2,7 @@ * input_dec.c: Functions for the management of decoders ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: input_dec.c,v 1.26 2002/02/15 13:32:54 sam Exp $ + * $Id: input_dec.c,v 1.27 2002/02/19 00:50:19 sam Exp $ * * Authors: Christophe Massiot * @@ -90,9 +90,6 @@ vlc_thread_t input_RunDecoder( input_thread_t * p_input, return( 0 ); } - intf_DbgMsg( "input debug: decoder \"%s\"thread created", - p_es->p_module->psz_name ); - return thread_id; } diff --git a/src/input/input_programs.c b/src/input/input_programs.c index e2f30c0ea5..9d4c23593e 100644 --- a/src/input/input_programs.c +++ b/src/input/input_programs.c @@ -2,7 +2,7 @@ * input_programs.c: es_descriptor_t, pgrm_descriptor_t management ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: input_programs.c,v 1.70 2001/12/30 07:09:56 sam Exp $ + * $Id: input_programs.c,v 1.71 2002/02/19 00:50:19 sam Exp $ * * Authors: Christophe Massiot * @@ -142,8 +142,6 @@ pgrm_descriptor_t * input_AddProgram( input_thread_t * p_input, /* Where to add the pgrm */ int i_pgrm_index = p_input->stream.i_pgrm_number; - intf_DbgMsg("Adding description for pgrm %d", i_pgrm_id); - /* Add an entry to the list of program associated with the stream */ p_input->stream.i_pgrm_number++; p_input->stream.pp_programs = realloc( p_input->stream.pp_programs, @@ -208,8 +206,6 @@ void input_DelProgram( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm ) ASSERT( p_pgrm ); - intf_DbgMsg("Deleting description for pgrm %d", p_pgrm->i_number); - /* Free the structures that describe the es that belongs to that program */ while( p_pgrm->i_es_number ) { @@ -259,8 +255,6 @@ input_area_t * input_AddArea( input_thread_t * p_input ) /* Where to add the pgrm */ int i_area_index = p_input->stream.i_area_nb; - intf_DbgMsg("Adding description for area %d", i_area_index ); - /* Add an entry to the list of program associated with the stream */ p_input->stream.i_area_nb++; p_input->stream.pp_areas = realloc( p_input->stream.pp_areas, @@ -329,8 +323,6 @@ void input_DelArea( input_thread_t * p_input, input_area_t * p_area ) ASSERT( p_area ); - intf_DbgMsg("Deleting description for area %d", p_area->i_id ); - /* Find the area in the areas table */ for( i_area_index = 0; i_area_index < p_input->stream.i_area_nb; i_area_index++ ) @@ -390,8 +382,6 @@ es_descriptor_t * input_AddES( input_thread_t * p_input, { es_descriptor_t * p_es; - intf_DbgMsg("Adding description for ES 0x%x", i_es_id); - p_es = (es_descriptor_t *)malloc( sizeof(es_descriptor_t) ); if( p_es == NULL ) { @@ -533,13 +523,11 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es ) { if( p_es == NULL ) { - intf_ErrMsg( "Nothing to do in input_SelectES" ); + intf_ErrMsg( "input error: nothing to do in input_SelectES" ); return -1; } -#ifdef TRACE_INPUT - intf_DbgMsg( "Selecting ES 0x%x", p_es->i_id ); -#endif + intf_WarnMsg( 4, "input: selecting ES 0x%x", p_es->i_id ); if( p_es->p_decoder_fifo != NULL ) { @@ -607,9 +595,7 @@ int input_UnselectES( input_thread_t * p_input, es_descriptor_t * p_es ) return -1; } -#ifdef TRACE_INPUT - intf_DbgMsg( "Unselecting ES 0x%x", p_es->i_id ); -#endif + intf_WarnMsg( 4, "input: unselecting ES 0x%x", p_es->i_id ); if( p_es->p_decoder_fifo == NULL ) { @@ -640,9 +626,7 @@ int input_UnselectES( input_thread_t * p_input, es_descriptor_t * p_es ) if( p_input->stream.pp_selected_es == NULL ) { -#ifdef TRACE_INPUT - intf_DbgMsg( "No more selected ES in input_UnselectES" ); -#endif + intf_WarnMsg( 4, "input: no more selected ES in input_UnselectES" ); return( 1 ); } } diff --git a/src/input/mpeg_system.c b/src/input/mpeg_system.c index 0b18a898b7..5fea7a6f0a 100644 --- a/src/input/mpeg_system.c +++ b/src/input/mpeg_system.c @@ -2,7 +2,7 @@ * mpeg_system.c: TS, PS and PES management ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: mpeg_system.c,v 1.78 2002/01/04 14:01:34 sam Exp $ + * $Id: mpeg_system.c,v 1.79 2002/02/19 00:50:19 sam Exp $ * * Authors: Christophe Massiot * Michel Lespinasse @@ -119,8 +119,6 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es ) #define p_pes (p_es->p_pes) - //intf_DbgMsg("End of PES packet %p", p_pes); - /* Parse the header. The header has a variable length, but in order * to improve the algorithm, we will read the 14 bytes we may be * interested in */ @@ -413,8 +411,6 @@ void input_GatherPES( input_thread_t * p_input, data_packet_t * p_data, { #define p_pes (p_es->p_pes) - //intf_DbgMsg("PES-demultiplexing %p (%p)", p_ts_packet, p_pes); - /* If we lost data, insert a NULL data packet (philosophy : 0 is quite * often an escape sequence in decoders, so that should make them wait * for the next start code). */ @@ -541,7 +537,6 @@ static void DecodePSM( input_thread_t * p_input, data_packet_t * p_data ) return; } - intf_DbgMsg( "input: building PSM" ); p_demux->b_has_PSM = 1; p_demux->i_PSM_version = p_data->p_demux_start[6] & 0x1F; diff --git a/src/interface/interface.c b/src/interface/interface.c index f3ce089f65..28323add9b 100644 --- a/src/interface/interface.c +++ b/src/interface/interface.c @@ -4,7 +4,7 @@ * interface, such as command line. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: interface.c,v 1.88 2002/02/15 13:32:54 sam Exp $ + * $Id: interface.c,v 1.89 2002/02/19 00:50:19 sam Exp $ * * Authors: Vincent Seguin * @@ -112,9 +112,6 @@ intf_thread_t* intf_Create( void ) *****************************************************************************/ static void intf_Manage( intf_thread_t *p_intf ) { - /* Flush waiting messages */ - intf_FlushMsg(); - /* Manage module bank */ module_ManageBank( ); diff --git a/src/interface/intf_msg.c b/src/interface/intf_msg.c index f36f9915a4..9a1514cffd 100644 --- a/src/interface/intf_msg.c +++ b/src/interface/intf_msg.c @@ -4,7 +4,7 @@ * interface, such as message output. See config.h for output configuration. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: intf_msg.c,v 1.42 2002/01/04 14:01:35 sam Exp $ + * $Id: intf_msg.c,v 1.43 2002/02/19 00:50:19 sam Exp $ * * Authors: Vincent Seguin * @@ -41,35 +41,6 @@ #include "interface.h" -/***************************************************************************** - * intf_msg_item_t - ***************************************************************************** - * Store a single message. Messages have a maximal size of INTF_MSG_MSGSIZE. - * If TRACE is defined, messages have a date field and debug messages are - * printed with a date to allow more precise profiling. - *****************************************************************************/ -typedef struct -{ - int i_type; /* message type, see below */ - char * psz_msg; /* the message itself */ - -#ifdef TRACE - /* Debugging informations - in TRACE mode, debug messages have calling - * location information printed */ - mtime_t date; /* date of the message */ - char * psz_file; /* file in which the function was called */ - char * psz_function; /* function from which the function was called */ - int i_line; /* line at which the function was called */ -#endif -} intf_msg_item_t; - -/* Message types */ -#define INTF_MSG_STD 0 /* standard message */ -#define INTF_MSG_ERR 1 /* error message */ -#define INTF_MSG_DBG 3 /* debug message */ -#define INTF_MSG_WARN 4 /* warning message */ -#define INTF_MSG_STAT 5 /* statistic message */ - /***************************************************************************** * intf_msg_t @@ -77,43 +48,29 @@ typedef struct * Store all data requiered by messages interfaces. It has a single reference * int p_main. *****************************************************************************/ -typedef struct intf_msg_s +typedef struct msg_bank_s { -#ifdef INTF_MSG_QUEUE + /* Message queue lock */ + vlc_mutex_t lock; + /* Message queue */ - vlc_mutex_t lock; /* message queue lock */ - int i_count; /* number of messages stored */ - intf_msg_item_t msg[INTF_MSG_QSIZE]; /* message queue */ -#endif + msg_item_t msg[INTF_MSG_QSIZE]; /* message queue */ + int i_start; + int i_stop; -#ifdef TRACE_LOG - /* Log file */ - FILE * p_log_file; /* log file */ -#endif + /* Subscribers */ + int i_sub; + intf_subscription_t **pp_sub; -#if !defined(INTF_MSG_QUEUE) && !defined(TRACE_LOG) - /* If neither messages queue, neither log file is used, then the structure - * is empty. However, empty structures are not allowed in C. Therefore, a - * dummy integer is used to fill it. */ - int i_dummy; /* unused filler */ -#endif -} intf_msg_t; +} msg_bank_t; + +msg_bank_t msg_bank; /***************************************************************************** * Local prototypes *****************************************************************************/ - -static void QueueMsg ( intf_msg_t *p_msg, int i_type, - char *psz_format, va_list ap ); -static void PrintMsg ( intf_msg_item_t *p_msg ); -#ifdef TRACE -static void QueueDbgMsg ( intf_msg_t *p_msg, char *psz_file, - char *psz_function, int i_line, - char *psz_format, va_list ap ); -#endif -#ifdef INTF_MSG_QUEUE -static void FlushLockedMsg ( intf_msg_t *p_msg ); -#endif +static void QueueMsg ( int, char *, va_list ); +static void FlushLockedMsg ( void ); #if defined( WIN32 ) static char *ConvertPrintfFormatString ( char *psz_format ); @@ -125,33 +82,15 @@ static char *ConvertPrintfFormatString ( char *psz_format ); * This functions has to be called before any call to other intf_*Msg functions. * It set up the locks and the message queue if it is used. *****************************************************************************/ -p_intf_msg_t intf_MsgCreate( void ) +void intf_MsgCreate( void ) { - p_intf_msg_t p_msg; - - /* Allocate structure */ - p_msg = malloc( sizeof( intf_msg_t ) ); - if( p_msg == NULL ) - { - errno = ENOMEM; - } - else - { -#ifdef INTF_MSG_QUEUE /* Message queue initialization */ - vlc_mutex_init( &p_msg->lock ); /* intialize lock */ - p_msg->i_count = 0; /* queue is empty */ -#endif + vlc_mutex_init( &msg_bank.lock ); + msg_bank.i_start = 0; + msg_bank.i_stop = 0; - -#ifdef TRACE_LOG - /* Log file initialization - on failure, file pointer will be null, - * and no log will be issued, but this is not considered as an - * error */ - p_msg->p_log_file = fopen( TRACE_LOG, "w" ); -#endif - } - return( p_msg ); + msg_bank.i_sub = 0; + msg_bank.pp_sub = NULL; } /***************************************************************************** @@ -163,23 +102,81 @@ p_intf_msg_t intf_MsgCreate( void ) *****************************************************************************/ void intf_MsgDestroy( void ) { - intf_FlushMsg(); /* print all remaining messages */ + /* Destroy lock */ + vlc_mutex_destroy( &msg_bank.lock ); -#ifdef TRACE_LOG - /* Close log file if any */ - if( p_main->p_msg->p_log_file != NULL ) + if( msg_bank.i_sub ) { - fclose( p_main->p_msg->p_log_file ); + fprintf( stderr, "intf error: stale interface subscribers\n" ); } -#endif -#ifdef INTF_MSG_QUEUE - /* destroy lock */ - vlc_mutex_destroy( &p_main->p_msg->lock ); -#endif - - /* Free structure */ - free( p_main->p_msg ); + /* Free remaining messages */ + FlushLockedMsg( ); +} + +/***************************************************************************** + * intf_MsgSub: subscribe to the message queue. + *****************************************************************************/ +intf_subscription_t *intf_MsgSub( void ) +{ + intf_subscription_t *p_sub = malloc( sizeof( intf_subscription_t ) ); + + vlc_mutex_lock( &msg_bank.lock ); + + /* Add subscription to the list */ + msg_bank.i_sub++; + msg_bank.pp_sub = realloc( msg_bank.pp_sub, + msg_bank.i_sub * sizeof( intf_subscription_t* ) ); + + msg_bank.pp_sub[ msg_bank.i_sub - 1 ] = p_sub; + + p_sub->i_start = msg_bank.i_start; + p_sub->pi_stop = &msg_bank.i_stop; + + p_sub->p_msg = msg_bank.msg; + p_sub->p_lock = &msg_bank.lock; + + vlc_mutex_unlock( &msg_bank.lock ); + + return p_sub; +} + +/***************************************************************************** + * intf_MsgSub: unsubscribe from the message queue. + *****************************************************************************/ +void intf_MsgUnsub( intf_subscription_t *p_sub ) +{ + int i_index; + + vlc_mutex_lock( &msg_bank.lock ); + + /* Look for the appropriate subscription */ + for( i_index = 0; i_index < msg_bank.i_sub; i_index++ ) + { + if( msg_bank.pp_sub[ i_index ] == p_sub ) + { + break; + } + } + + if( msg_bank.pp_sub[ i_index ] != p_sub ) + { + intf_ErrMsg( "intf error: subscriber not found" ); + vlc_mutex_unlock( &msg_bank.lock ); + return; + } + + /* Remove this subscription */ + for( ; i_index < msg_bank.i_sub; i_index++ ) + { + msg_bank.pp_sub[ i_index ] = msg_bank.pp_sub[ i_index+1 ]; + } + + msg_bank.i_sub--; + msg_bank.pp_sub = realloc( msg_bank.pp_sub, + msg_bank.i_sub * sizeof( intf_subscription_t* ) ); + + vlc_mutex_unlock( &msg_bank.lock ); } /***************************************************************************** @@ -193,7 +190,7 @@ void intf_Msg( char *psz_format, ... ) va_list ap; va_start( ap, psz_format ); - QueueMsg( p_main->p_msg, INTF_MSG_STD, psz_format, ap ); + QueueMsg( INTF_MSG_STD, psz_format, ap ); va_end( ap ); } @@ -208,7 +205,7 @@ void intf_ErrMsg( char *psz_format, ... ) va_list ap; va_start( ap, psz_format ); - QueueMsg( p_main->p_msg, INTF_MSG_ERR, psz_format, ap ); + QueueMsg( INTF_MSG_ERR, psz_format, ap ); va_end( ap ); } @@ -225,7 +222,7 @@ void intf_WarnMsg( int i_level, char *psz_format, ... ) if( i_level <= p_main->i_warning_level ) { va_start( ap, psz_format ); - QueueMsg( p_main->p_msg, INTF_MSG_WARN, psz_format, ap ); + QueueMsg( INTF_MSG_WARN, psz_format, ap ); va_end( ap ); } } @@ -243,105 +240,10 @@ void intf_StatMsg( char *psz_format, ... ) if( p_main->b_stats ) { va_start( ap, psz_format ); - QueueMsg( p_main->p_msg, INTF_MSG_STAT, psz_format, ap ); - va_end( ap ); - } -} - -/***************************************************************************** - * _intf_DbgMsg: print a debugging message (ok ?) - ***************************************************************************** - * This function prints a debugging message. Compared to other intf_*Msg - * functions, it is only defined if TRACE is defined and require a file name, - * a function name and a line number as additionnal debugging informations. It - * also prints a debugging header for each received line. - *****************************************************************************/ -#ifdef TRACE -void _intf_DbgMsg( char *psz_file, char *psz_function, int i_line, - char *psz_format, ...) -{ - va_list ap; - - va_start( ap, psz_format ); - QueueDbgMsg( p_main->p_msg, psz_file, psz_function, i_line, - psz_format, ap ); - va_end( ap ); -} -#endif - -/***************************************************************************** - * intf_MsgImm: print a message (ok ?) - ***************************************************************************** - * This function prints a message immediately. If the queue is used, all - * waiting messages are also printed. - *****************************************************************************/ -void intf_MsgImm( char *psz_format, ... ) -{ - va_list ap; - - va_start( ap, psz_format ); - QueueMsg( p_main->p_msg, INTF_MSG_STD, psz_format, ap ); - va_end( ap ); - intf_FlushMsg(); -} - -/***************************************************************************** - * intf_ErrMsgImm: print an error message immediately (ok ?) - ***************************************************************************** - * This function is the same as intf_MsgImm, except that it prints its message - * on stderr. - *****************************************************************************/ -void intf_ErrMsgImm(char *psz_format, ...) -{ - va_list ap; - - va_start( ap, psz_format ); - QueueMsg( p_main->p_msg, INTF_MSG_ERR, psz_format, ap ); - va_end( ap ); - intf_FlushMsg(); -} - -/***************************************************************************** - * intf_WarnMsgImm : print a warning message - ***************************************************************************** - * This function is the same as intf_MsgImm, except that it concerns warning - * messages for testing purpose. - *****************************************************************************/ -void intf_WarnMsgImm( int i_level, char *psz_format, ... ) -{ - va_list ap; - - if( i_level <= p_main->i_warning_level ) - { - va_start( ap, psz_format ); - QueueMsg( p_main->p_msg, INTF_MSG_WARN, psz_format, ap ); + QueueMsg( INTF_MSG_STAT, psz_format, ap ); va_end( ap ); } - intf_FlushMsg(); -} - - - -/***************************************************************************** - * _intf_DbgMsgImm: print a debugging message immediately (ok ?) - ***************************************************************************** - * This function is the same as intf_DbgMsgImm, except that it prints its - * message immediately. It should only be called through the macro - * intf_DbgMsgImm(). - *****************************************************************************/ -#ifdef TRACE -void _intf_DbgMsgImm( char *psz_file, char *psz_function, int i_line, - char *psz_format, ...) -{ - va_list ap; - - va_start( ap, psz_format ); - QueueDbgMsg( p_main->p_msg, psz_file, psz_function, i_line, - psz_format, ap ); - va_end( ap ); - intf_FlushMsg(); } -#endif /***************************************************************************** * intf_WarnHexDump : print a hexadecimal dump of a memory area @@ -380,23 +282,6 @@ void intf_WarnHexDump( int i_level, void *p_data, int i_size ) intf_WarnMsg( i_level, "hexdump: %i bytes dumped", i_size ); } -/***************************************************************************** - * intf_FlushMsg (ok ?) - ***************************************************************************** - * Print all messages remaining in queue: get lock and call FlushLockedMsg. - * This function does nothing if the message queue isn't used. - * This function is only implemented if message queue is used. If not, it is - * an empty macro. - *****************************************************************************/ -#ifdef INTF_MSG_QUEUE -void intf_FlushMsg( void ) -{ - vlc_mutex_lock( &p_main->p_msg->lock ); /* get lock */ - FlushLockedMsg( p_main->p_msg ); /* flush messages */ - vlc_mutex_unlock( &p_main->p_msg->lock ); /* give lock back */ -} -#endif - /* following functions are local */ /***************************************************************************** @@ -407,282 +292,123 @@ void intf_FlushMsg( void ) * is full. If the message can't be converted to string in memory, it exit the * program. If the queue is not used, it prints the message immediately. *****************************************************************************/ -static void QueueMsg( intf_msg_t *p_msg, int i_type, char *psz_format, va_list ap ) +static void QueueMsg( int i_type, char *psz_format, va_list ap ) { char * psz_str; /* formatted message string */ - intf_msg_item_t * p_msg_item; /* pointer to message */ + msg_item_t * p_item; /* pointer to message */ #ifdef WIN32 char * psz_temp; #endif -#ifndef INTF_MSG_QUEUE /*................................... instant mode ...*/ - intf_msg_item_t msg_item; /* message */ - p_msg_item = &msg_item; -#endif /*....................................................................*/ - /* * Convert message to string */ - #ifdef HAVE_VASPRINTF vasprintf( &psz_str, psz_format, ap ); #else psz_str = (char*) malloc( strlen(psz_format) + INTF_MAX_MSG_SIZE ); #endif + if( psz_str == NULL ) { - fprintf(stderr, "warning: can't store following message (%s): ", + fprintf(stderr, "intf warning: can't store following message (%s): ", strerror(errno) ); vfprintf(stderr, psz_format, ap ); fprintf(stderr, "\n" ); exit( errno ); } + #ifndef HAVE_VASPRINTF -#ifdef WIN32 +# ifdef WIN32 psz_temp = ConvertPrintfFormatString(psz_format); vsprintf( psz_str, psz_temp, ap ); free( psz_temp ); -#else +# else vsprintf( psz_str, psz_format, ap ); -#endif /* WIN32 */ -#endif /* HAVE_VASPRINTF */ - -#ifdef INTF_MSG_QUEUE /*...................................... queue mode ...*/ - vlc_mutex_lock( &p_msg->lock ); /* get lock */ - if( p_msg->i_count == INTF_MSG_QSIZE ) /* flush queue if needed */ - { -#ifdef DEBUG /* in debug mode, queue overflow causes a warning */ - fprintf(stderr, "warning: message queue overflow\n" ); -#endif - FlushLockedMsg( p_msg ); - } - p_msg_item = p_msg->msg + p_msg->i_count++; /* select message */ -#endif /*.............................................. end of queue mode ...*/ - - /* - * Fill message information fields - */ - p_msg_item->i_type = i_type; - p_msg_item->psz_msg = psz_str; -#ifdef TRACE - p_msg_item->date = mdate(); +# endif #endif -#ifdef INTF_MSG_QUEUE /*......................................... queue mode */ - vlc_mutex_unlock( &p_msg->lock ); /* give lock back */ -#else /*....................................................... instant mode */ - PrintMsg( p_msg_item ); /* print message */ - free( psz_str ); /* free message data */ -#endif /*....................................................................*/ -} - -/***************************************************************************** - * QueueDbgMsg: add a message to a queue with debugging informations - ***************************************************************************** - * This function is the same as QueueMsg, except that it is only defined when - * TRACE is define, and require additionnal debugging informations. - *****************************************************************************/ -#ifdef TRACE -static void QueueDbgMsg(intf_msg_t *p_msg, char *psz_file, char *psz_function, - int i_line, char *psz_format, va_list ap) -{ - char * psz_str; /* formatted message string */ - intf_msg_item_t * p_msg_item; /* pointer to message */ -#ifdef WIN32 - char * psz_temp; -#endif + /* Put message in queue */ + vlc_mutex_lock( &msg_bank.lock ); -#ifndef INTF_MSG_QUEUE /*................................... instant mode ...*/ - intf_msg_item_t msg_item; /* message */ - p_msg_item = &msg_item; -#endif /*....................................................................*/ + /* Send the message to stderr */ + fprintf( stderr, "%s\n", psz_str ); - /* - * Convert message to string - */ -#ifdef HAVE_VASPRINTF - vasprintf( &psz_str, psz_format, ap ); -#else - psz_str = (char*) malloc( INTF_MAX_MSG_SIZE ); -#endif - if( psz_str == NULL ) + if( ((msg_bank.i_stop - msg_bank.i_start + 1) % INTF_MSG_QSIZE) == 0 ) { - fprintf(stderr, "warning: can't store following message (%s): ", - strerror(errno) ); - fprintf(stderr, INTF_MSG_DBG_FORMAT, psz_file, psz_function, i_line ); - vfprintf(stderr, psz_format, ap ); - fprintf(stderr, "\n" ); - exit( errno ); - } -#ifndef HAVE_VASPRINTF -#ifdef WIN32 - psz_temp = ConvertPrintfFormatString(psz_format); - vsprintf( psz_str, psz_temp, ap ); - free( psz_temp ); -#else - vsprintf( psz_str, psz_format, ap ); -#endif /* WIN32 */ -#endif /* HAVE_VASPRINTF */ + FlushLockedMsg( ); -#ifdef INTF_MSG_QUEUE /*...................................... queue mode ...*/ - vlc_mutex_lock( &p_msg->lock ); /* get lock */ - if( p_msg->i_count == INTF_MSG_QSIZE ) /* flush queue if needed */ - { - fprintf(stderr, "warning: message queue overflow\n" ); - FlushLockedMsg( p_msg ); + if( ((msg_bank.i_stop - msg_bank.i_start + 1) % INTF_MSG_QSIZE) == 0 ) + { + fprintf( stderr, "intf warning: message queue overflow\n" ); + vlc_mutex_unlock( &msg_bank.lock ); + return; + } } - p_msg_item = p_msg->msg + p_msg->i_count++; /* select message */ -#endif /*.............................................. end of queue mode ...*/ - /* - * Fill message information fields - */ - p_msg_item->i_type = INTF_MSG_DBG; - p_msg_item->psz_msg = psz_str; - p_msg_item->psz_file = psz_file; - p_msg_item->psz_function = psz_function; - p_msg_item->i_line = i_line; - p_msg_item->date = mdate(); - -#ifdef INTF_MSG_QUEUE /*......................................... queue mode */ - vlc_mutex_unlock( &p_msg->lock ); /* give lock back */ -#else /*....................................................... instant mode */ - PrintMsg( p_msg_item ); /* print message */ - free( psz_str ); /* free message data */ -#endif /*....................................................................*/ -} -#endif + p_item = msg_bank.msg + msg_bank.i_stop; + msg_bank.i_stop = (msg_bank.i_stop + 1) % INTF_MSG_QSIZE; -/***************************************************************************** - * FlushLockedMsg (ok ?) - ***************************************************************************** - * Print all messages remaining in queue. MESSAGE QUEUE MUST BE LOCKED, since - * this function does not check the lock. This function is only defined if - * INTF_MSG_QUEUE is defined. - *****************************************************************************/ -#ifdef INTF_MSG_QUEUE -static void FlushLockedMsg ( intf_msg_t *p_msg ) -{ - int i_index; + /* Fill message information fields */ + p_item->i_type = i_type; + p_item->psz_msg = psz_str; - for( i_index = 0; i_index < p_msg->i_count; i_index++ ) - { - /* Print message and free message data */ - PrintMsg( &p_msg->msg[i_index] ); - free( p_msg->msg[i_index].psz_msg ); - } - - p_msg->i_count = 0; + vlc_mutex_unlock( &msg_bank.lock ); } -#endif /***************************************************************************** - * PrintMsg: print a message (ok ?) + * FlushLockedMsg (ok ?) ***************************************************************************** - * Print a single message. The message data is not freed. This function exists - * in two version. The TRACE version prints a date with each message, and is - * able to log messages (if TRACE_LOG is defined). - * The normal one just prints messages to the screen. + * Print all messages remaining in queue. MESSAGE QUEUE MUST BE LOCKED, since + * this function does not check the lock. *****************************************************************************/ -#ifdef TRACE - -static void PrintMsg( intf_msg_item_t *p_msg ) +static void FlushLockedMsg ( void ) { - char psz_date[MSTRTIME_MAX_SIZE]; /* formatted time buffer */ - int i_msg_len = MSTRTIME_MAX_SIZE + strlen(p_msg->psz_msg) + 200; - char *psz_msg; /* message buffer */ + int i_index, i_start, i_stop; - psz_msg = malloc( sizeof( char ) * i_msg_len ); + /* Get the maximum message index that can be freed */ + i_stop = msg_bank.i_stop; - /* Check if allocation succeeded */ - if( psz_msg == NULL ) + /* Check until which value we can free messages */ + for( i_index = 0; i_index < msg_bank.i_sub; i_index++ ) { - fprintf( stderr, "error: not enough memory for message %s\n", - p_msg->psz_msg ); - return; + i_start = msg_bank.pp_sub[ i_index ]->i_start; + + /* If this subscriber is late, we don't free messages before + * his i_start value, otherwise he'll miss messages */ + if( ( i_start < i_stop + && (msg_bank.i_stop <= i_start || i_stop <= msg_bank.i_stop) ) + || ( i_stop < i_start + && (i_stop <= msg_bank.i_stop && msg_bank.i_stop <= i_start) ) ) + { + i_stop = i_start; + } } - /* Format message - the message is formatted here because in case the log - * file is used, it avoids another format string parsing */ - switch( p_msg->i_type ) + /* Free message data */ + if( msg_bank.i_start <= i_stop ) { - case INTF_MSG_STD: /* regular messages */ - case INTF_MSG_STAT: - case INTF_MSG_ERR: - snprintf( psz_msg, i_msg_len, "%s", p_msg->psz_msg ); - break; - - case INTF_MSG_WARN: /* Warning message */ - mstrtime( psz_date, p_msg->date ); - snprintf( psz_msg, i_msg_len, "(%s) %s", - psz_date, p_msg->psz_msg ); - - break; - - case INTF_MSG_DBG: /* debug messages */ - mstrtime( psz_date, p_msg->date ); - snprintf( psz_msg, i_msg_len, "(%s) " INTF_MSG_DBG_FORMAT "%s", - psz_date, p_msg->psz_file, p_msg->psz_function, p_msg->i_line, - p_msg->psz_msg ); - break; + i_index = msg_bank.i_start; } - - /* - * Print messages - */ - switch( p_msg->i_type ) + else { - case INTF_MSG_STD: /* standard messages */ - case INTF_MSG_STAT: - fprintf( stdout, "%s\n", psz_msg ); - break; - case INTF_MSG_ERR: /* error messages */ - case INTF_MSG_WARN: -#ifndef TRACE_LOG_ONLY - case INTF_MSG_DBG: /* debugging messages */ -#endif - fprintf( stderr, "%s\n", psz_msg ); - break; - } + for( i_index = msg_bank.i_start; i_index < INTF_MSG_QSIZE; i_index++ ) + { + free( msg_bank.msg[i_index].psz_msg ); + } -#ifdef TRACE_LOG - /* Append all messages to log file */ - if( p_main->p_msg->p_log_file != NULL ) - { - fwrite( psz_msg, strlen( psz_msg ), 1, p_main->p_msg->p_log_file ); - fwrite( "\n", 1, 1, p_main->p_msg->p_log_file ); + i_index = 0; } -#endif - /* Free the message */ - free( psz_msg ); -} - -#else - -static void PrintMsg( intf_msg_item_t *p_msg ) -{ - /* - * Print messages on screen - */ - switch( p_msg->i_type ) + for( ; i_index < i_stop; i_index++ ) { - case INTF_MSG_STD: /* standard messages */ - case INTF_MSG_STAT: - case INTF_MSG_DBG: /* debug messages */ - fprintf( stdout, "%s\n", p_msg->psz_msg ); - break; - case INTF_MSG_ERR: /* error messages */ - case INTF_MSG_WARN: - fprintf( stderr, "%s\n", p_msg->psz_msg ); /* warning message */ - break; + free( msg_bank.msg[i_index].psz_msg ); } -} - -#endif + /* Update the new start value */ + msg_bank.i_start = i_index; +} -#if defined( WIN32 ) /***************************************************************************** * ConvertPrintfFormatString: replace all occurrences of %ll with %I64 in the * printf format string. @@ -694,6 +420,7 @@ static void PrintMsg( intf_msg_item_t *p_msg ) * a "long long" type!!! * By the way, if we don't do this we can sometimes end up with segfaults. *****************************************************************************/ +#if defined( WIN32 ) static char *ConvertPrintfFormatString( char *psz_format ) { int i, i_counter=0, i_pos=0; @@ -715,7 +442,7 @@ static char *ConvertPrintfFormatString( char *psz_format ) psz_dest = malloc( strlen(psz_format) + i_counter + 1 ); if( psz_dest == NULL ) { - fprintf(stderr, "warning: malloc failed in ConvertPrintfFormatString\n"); + fprintf( stderr, "intf warning: ConvertPrintfFormatString failed\n"); exit (errno); } diff --git a/src/interface/main.c b/src/interface/main.c index 4953e511aa..8a87ece5d5 100644 --- a/src/interface/main.c +++ b/src/interface/main.c @@ -4,7 +4,7 @@ * and spawn threads. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: main.c,v 1.151 2002/02/15 13:32:54 sam Exp $ + * $Id: main.c,v 1.152 2002/02/19 00:50:19 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -128,8 +128,7 @@ #define OPT_SYNCHRO 190 #define OPT_WARNING 191 #define OPT_VERSION 192 -#define OPT_STDOUT 193 -#define OPT_STATS 194 +#define OPT_STATS 193 #define OPT_MPEG_ADEC 200 #define OPT_AC3_ADEC 201 @@ -158,7 +157,6 @@ static const struct option longopts[] = /* Interface options */ { "intf", 1, 0, 'I' }, { "warning", 1, 0, OPT_WARNING }, - { "stdout", 1, 0, OPT_STDOUT }, { "stats", 0, 0, OPT_STATS }, /* Audio options */ @@ -250,7 +248,6 @@ static void FatalSignalHandler ( int i_signal ); static void IllegalSignalHandler ( int i_signal ); static u32 CPUCapabilities ( void ); -static int RedirectSTDOUT ( void ); static void ShowConsole ( void ); static jmp_buf env; @@ -327,15 +324,9 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) /* * Initialize messages interface */ - p_main->p_msg = intf_MsgCreate(); - if( !p_main->p_msg ) /* start messages interface */ - { - fprintf( stderr, "error: can't initialize messages interface (%s)\n", - strerror(errno) ); - return( errno ); - } + intf_MsgCreate(); - intf_MsgImm( COPYRIGHT_MESSAGE "\n" ); + intf_Msg( COPYRIGHT_MESSAGE "\n" ); /* * Read configuration @@ -350,8 +341,6 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) * Redirect the standard output if required by the user, and on Win32 we * also open a console to display the debug messages. */ - RedirectSTDOUT(); - if( p_main->b_stats ) { char p_capabilities[200]; @@ -670,46 +659,28 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) /* General/common options */ case 'h': /* -h, --help */ ShowConsole(); - RedirectSTDOUT(); Usage( SHORT_HELP ); #ifdef WIN32 /* Pause the console because it's destroyed when we exit */ - if( strcmp( "", main_GetPszVariable( INTF_STDOUT_VAR, - INTF_STDOUT_DEFAULT ) ) == 0 ) - { - /* No stdout redirection has been asked for */ - intf_MsgImm( "\nPress the RETURN key to continue..." ); - getchar(); - } + intf_Msg( "\nPress the RETURN key to continue..." ); + getchar(); #endif return( -1 ); break; case 'H': /* -H, --longhelp */ ShowConsole(); - RedirectSTDOUT(); Usage( LONG_HELP ); #ifdef WIN32 /* Pause the console because it's destroyed when we exit */ - if( strcmp( "", main_GetPszVariable( INTF_STDOUT_VAR, - INTF_STDOUT_DEFAULT ) ) == 0 ) - { - /* No stdout redirection has been asked for */ - intf_MsgImm( "\nPress the RETURN key to continue..." ); - getchar(); - } + intf_Msg( "\nPress the RETURN key to continue..." ); + getchar(); #endif return( -1 ); break; case OPT_VERSION: /* --version */ ShowConsole(); - RedirectSTDOUT(); Version(); #ifdef WIN32 /* Pause the console because it's destroyed when we exit */ - if( strcmp( "", main_GetPszVariable( INTF_STDOUT_VAR, - INTF_STDOUT_DEFAULT ) ) == 0 ) - { - /* No stdout redirection has been asked for */ - intf_MsgImm( "\nPress the RETURN key to continue..." ); - getchar(); - } + intf_Msg( "\nPress the RETURN key to continue..." ); + getchar(); #endif return( -1 ); break; @@ -726,10 +697,6 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) p_main->i_warning_level = atoi(optarg); break; - case OPT_STDOUT: /* --stdout */ - main_PutPszVariable( INTF_STDOUT_VAR, optarg ); - break; - case OPT_STATS: p_main->b_stats = 1; break; @@ -899,18 +866,12 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) case '?': default: ShowConsole(); - RedirectSTDOUT(); intf_ErrMsg( "intf error: unknown option `%s'", ppsz_argv[optind] ); Usage( USAGE ); #ifdef WIN32 /* Pause the console because it's destroyed when we exit */ - if( strcmp( "", main_GetPszVariable( INTF_STDOUT_VAR, - INTF_STDOUT_DEFAULT ) ) == 0 ) - { - /* No stdout redirection has been asked for */ - intf_MsgImm( "\nPress the RETURN key to continue..." ); - getchar(); - } + intf_Msg( "\nPress the RETURN key to continue..." ); + getchar(); #endif return( EINVAL ); break; @@ -952,21 +913,20 @@ static int GetFilenames( int i_argc, char *ppsz_argv[] ) static void Usage( int i_fashion ) { /* Usage */ - intf_MsgImm( "Usage: %s [options] [parameters] [file]...", + intf_Msg( "Usage: %s [options] [parameters] [file]...", p_main->psz_arg0 ); if( i_fashion == USAGE ) { - intf_MsgImm( "Try `%s --help' for more information.", + intf_Msg( "Try `%s --help' for more information.", p_main->psz_arg0 ); return; } /* Options */ - intf_MsgImm( "\nOptions:" + intf_Msg( "\nOptions:" "\n -I, --intf \tinterface method" "\n -v, --verbose \tverbose mode (cumulative)" - "\n --stdout \tredirect console stdout" "\n --memcpy \tmemcpy method" "\n" "\n --noaudio \tdisable audio" @@ -1034,15 +994,14 @@ static void Usage( int i_fashion ) return; /* Interface parameters */ - intf_MsgImm( "\nInterface parameters:" + intf_Msg( "\nInterface parameters:" "\n " INTF_METHOD_VAR "= \tinterface method" "\n " INTF_INIT_SCRIPT_VAR "= \tinitialization script" "\n " INTF_CHANNELS_VAR "= \tchannels list" - "\n " INTF_STDOUT_VAR "= \tredirect console stdout" "\n " MEMCPY_METHOD_VAR "= \tmemcpy method" ); /* Audio parameters */ - intf_MsgImm( "\nAudio parameters:" + intf_Msg( "\nAudio parameters:" "\n " AOUT_METHOD_VAR "= \taudio method" "\n " AOUT_DSP_VAR "= \tdsp device path" "\n " AOUT_STEREO_VAR "={1|0} \tstereo or mono output" @@ -1053,7 +1012,7 @@ static void Usage( int i_fashion ) "\n " AOUT_RATE_VAR "= \toutput rate" ); /* Video parameters */ - intf_MsgImm( "\nVideo parameters:" + intf_Msg( "\nVideo parameters:" "\n " VOUT_METHOD_VAR "= \tdisplay method" "\n " VOUT_DISPLAY_VAR "= \tdisplay used" "\n " VOUT_WIDTH_VAR "= \tdisplay width" @@ -1072,7 +1031,7 @@ static void Usage( int i_fashion ) "\n " VOUT_SPUMARGIN_VAR "= \tforce SPU margin" ); /* DVD parameters */ - intf_MsgImm( "\nDVD parameters:" + intf_Msg( "\nDVD parameters:" "\n " INPUT_DVD_DEVICE_VAR "= \tDVD device" "\n " INPUT_TITLE_VAR "= \ttitle number" "\n " INPUT_CHAPTER_VAR "=<chapter> \tchapter number" @@ -1082,13 +1041,13 @@ static void Usage( int i_fashion ) "\n " INPUT_SUBTITLE_VAR "=[0-31] \tsubtitle channel" ); /* Input parameters */ - intf_MsgImm( "\nInput parameters:" + intf_Msg( "\nInput parameters:" "\n " INPUT_IFACE_VAR "=<interface> \tnetwork interface" "\n " INPUT_CHANNEL_SERVER_VAR "=<hostname> \tchannel server" "\n " INPUT_CHANNEL_PORT_VAR "=<port> \tchannel server port" ); /* Decoder parameters */ - intf_MsgImm( "\nDecoder parameters:" + intf_Msg( "\nDecoder parameters:" "\n " ADEC_MPEG_VAR "=<builtin|mad> \tMPEG audio decoder" "\n " ADEC_AC3_VAR "=<builtin|a52> \tAC3 audio decoder" ); } @@ -1100,7 +1059,7 @@ static void Usage( int i_fashion ) *****************************************************************************/ static void Version( void ) { - intf_MsgImm( VERSION_MESSAGE + intf_Msg( VERSION_MESSAGE "This program comes with NO WARRANTY, to the extent permitted by law.\n" "You may redistribute it under the terms of the GNU General Public License;\n" "see the file named COPYING for details.\n" @@ -1157,7 +1116,7 @@ static void FatalSignalHandler( int i_signal ) #endif /* Acknowledge the signal received */ - intf_ErrMsgImm( "intf error: signal %d received, exiting", i_signal ); + intf_ErrMsg( "intf error: signal %d received, exiting", i_signal ); /* Try to terminate everything - this is done by requesting the end of the * interface thread */ @@ -1409,49 +1368,6 @@ static u32 CPUCapabilities( void ) #endif } -/***************************************************************************** - * RedirectSTDOUT: redirect stdout and stderr to a file - ***************************************************************************** - * This function will redirect stdout and stderr to a file if the user has - * specified so. - *****************************************************************************/ -static int RedirectSTDOUT( void ) -{ - int i_fd; - char *psz_filename; - - psz_filename = main_GetPszVariable( INTF_STDOUT_VAR, INTF_STDOUT_DEFAULT ); - - if( *psz_filename ) - { - ShowConsole(); - i_fd = open( psz_filename, O_CREAT | O_TRUNC | O_RDWR, - S_IREAD | S_IWRITE ); - if( dup2( i_fd, fileno(stdout) ) == -1 ) - { - intf_ErrMsg( "warning: unable to redirect stdout" ); - } - - if( dup2( i_fd, fileno(stderr) ) == -1 ) - { - intf_ErrMsg( "warning: unable to redirect stderr" ); - } - - close( i_fd ); - } - else - { - /* No stdout redirection has been asked so open a console */ - if( p_main->i_warning_level ) - { - ShowConsole(); - } - - } - - return 0; -} - /***************************************************************************** * ShowConsole: On Win32, create an output console for debug messages ***************************************************************************** diff --git a/src/misc/modules.c b/src/misc/modules.c index 12fb201c59..ef32e0cff6 100644 --- a/src/misc/modules.c +++ b/src/misc/modules.c @@ -2,7 +2,7 @@ * modules.c : Built-in and plugin modules management functions ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: modules.c,v 1.52 2002/02/15 13:32:54 sam Exp $ + * $Id: modules.c,v 1.53 2002/02/19 00:50:20 sam Exp $ * * Authors: Samuel Hocevar <sam@zoy.org> * Ethan C. Baldridge <BaldridgeE@cadmus.com> @@ -403,7 +403,8 @@ module_t * module_Need( int i_capability, char *psz_name, void *p_data ) break; default: - intf_ErrMsg( "module error: if you can read this, sam fucked up something very bad... fuck him with a chainsaw on vlc-devel" ); + intf_ErrMsg( "module error: unknown module type %i", + i_capability ); i_ret = -1; break; } @@ -449,7 +450,7 @@ module_t * module_Need( int i_capability, char *psz_name, void *p_data ) } else if( psz_name != NULL && *psz_name ) { - intf_ErrMsg( "module error: requested %s module `%s' not found", + intf_ErrMsg( "module error: requested %s module `%s' unavailable", GetCapabilityName( i_capability ), psz_name ); } @@ -535,7 +536,7 @@ static void AllocateAllPlugins( void ) psz_fullpath = *ppsz_path; } - intf_WarnMsgImm( 1, "module: browsing `%s'", psz_fullpath ); + intf_WarnMsg( 1, "module: browsing `%s'", psz_fullpath ); if( (dir = opendir( psz_fullpath )) ) { @@ -594,7 +595,7 @@ static int AllocatePluginModule( char * psz_filename ) if( module_load( psz_filename, &handle ) ) { /* The plugin module couldn't be opened */ - intf_WarnMsgImm( 1, "module warning: cannot open %s (%s)", + intf_WarnMsg( 1, "module warning: cannot open %s (%s)", psz_filename, module_error() ); return( -1 ); } @@ -698,7 +699,7 @@ static int AllocatePluginModule( char * psz_filename ) p_module_bank->i_count++; /* Immediate message so that a slow module doesn't make the user wait */ - intf_WarnMsgImm( 2, "module: new plugin module `%s', %s", + intf_WarnMsg( 2, "module: new plugin module `%s', %s", p_module->psz_name, p_module->psz_longname ); return( 0 ); @@ -788,7 +789,7 @@ static int AllocateBuiltinModule( int ( *pf_init ) ( module_t * ), p_module_bank->i_count++; /* Immediate message so that a slow module doesn't make the user wait */ - intf_WarnMsgImm( 2, "module: new builtin module `%s', %s", + intf_WarnMsg( 2, "module: new builtin module `%s', %s", p_module->psz_name, p_module->psz_longname ); return( 0 ); diff --git a/src/misc/modules_plugin.h b/src/misc/modules_plugin.h index 97b3bd08c3..e8dc08a2d9 100644 --- a/src/misc/modules_plugin.h +++ b/src/misc/modules_plugin.h @@ -2,7 +2,7 @@ * modules_plugin.h : Plugin management functions used by the core application. ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: modules_plugin.h,v 1.8 2002/01/29 20:11:18 gbazin Exp $ + * $Id: modules_plugin.h,v 1.9 2002/02/19 00:50:20 sam Exp $ * * Authors: Samuel Hocevar <sam@zoy.org> * @@ -144,16 +144,7 @@ module_error( void ) /***************************************************************************** * STORE_SYMBOLS: store known symbols into p_symbols for plugin access. *****************************************************************************/ -#ifdef TRACE -# define STORE_TRACE_SYMBOLS( p_symbols ) \ - (p_symbols)->intf_DbgMsg = _intf_DbgMsg; \ - (p_symbols)->intf_DbgMsgImm = _intf_DbgMsgImm; -#else -# define STORE_TRACE_SYMBOLS( p_symbols ) -#endif - #define STORE_SYMBOLS( p_symbols ) \ - STORE_TRACE_SYMBOLS( p_symbols ) \ (p_symbols)->p_main = p_main; \ (p_symbols)->p_input_bank = p_input_bank; \ (p_symbols)->p_aout_bank = p_aout_bank; \ @@ -162,11 +153,12 @@ module_error( void ) (p_symbols)->main_GetPszVariable = main_GetPszVariable; \ (p_symbols)->main_PutIntVariable = main_PutIntVariable; \ (p_symbols)->main_PutPszVariable = main_PutPszVariable; \ + (p_symbols)->intf_MsgSub = intf_MsgSub; \ + (p_symbols)->intf_MsgUnsub = intf_MsgUnsub; \ (p_symbols)->intf_Msg = intf_Msg; \ (p_symbols)->intf_ErrMsg = intf_ErrMsg; \ (p_symbols)->intf_StatMsg = intf_StatMsg;\ (p_symbols)->intf_WarnMsg = intf_WarnMsg; \ - (p_symbols)->intf_WarnMsgImm = intf_WarnMsgImm; \ (p_symbols)->intf_PlaylistAdd = intf_PlaylistAdd; \ (p_symbols)->intf_PlaylistDelete = intf_PlaylistDelete; \ (p_symbols)->intf_PlaylistNext = intf_PlaylistNext; \ diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index ef2107a882..2897e2c6d0 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -5,7 +5,7 @@ * thread, and destroy a previously oppened video output thread. ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: video_output.c,v 1.159 2002/02/18 19:02:41 stef Exp $ + * $Id: video_output.c,v 1.160 2002/02/19 00:50:20 sam Exp $ * * Authors: Vincent Seguin <seguin@via.ecp.fr> * @@ -377,7 +377,6 @@ static int InitThread( vout_thread_t *p_vout ) p_vout->b_active = 1; *p_vout->pi_status = THREAD_READY; - intf_DbgMsg("thread ready"); return( 0 ); } @@ -536,10 +535,6 @@ static void RunThread( vout_thread_t *p_vout) * to display. */ vlc_mutex_lock( &p_vout->change_lock ); -#ifdef TRACE_VOUT - intf_DbgMsg( "picture %p, subpicture %p", p_picture, p_subpic ); -#endif - /* * Display the previously rendered picture */ @@ -590,7 +585,6 @@ static void RunThread( vout_thread_t *p_vout) /* Destroy thread structures allocated by CreateThread */ DestroyThread( p_vout, THREAD_OVER ); - intf_DbgMsg( "thread end" ); } /***************************************************************************** diff --git a/src/video_output/video_text.c b/src/video_output/video_text.c index c0dbd82a2f..ee34bd7615 100644 --- a/src/video_output/video_text.c +++ b/src/video_output/video_text.c @@ -2,7 +2,7 @@ * video_text.c : text manipulation functions ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: video_text.c,v 1.33 2001/12/30 07:09:56 sam Exp $ + * $Id: video_text.c,v 1.34 2002/02/19 00:50:20 sam Exp $ * * Authors: Vincent Seguin <seguin@via.ecp.fr> * Samuel Hocevar <sam@zoy.org> @@ -262,7 +262,7 @@ vout_font_t *vout_LoadFont( const char *psz_name ) if( i_file == -1 ) { - intf_DbgMsg( "vout error: can't open file '%s' (%s)", + intf_ErrMsg( "vout error: can't open file '%s' (%s)", psz_name, strerror(errno) ); return( NULL ); } @@ -360,9 +360,9 @@ vout_font_t *vout_LoadFont( const char *psz_name ) break; } - - intf_DbgMsg( "loaded %s: type %d, %d-%dx%d", psz_name, p_font->i_type, + intf_ErrMsg( "loaded %s: type %d, %d-%dx%d", psz_name, p_font->i_type, p_font->i_width, p_font->i_interspacing, p_font->i_height ); + return( p_font ); } @@ -379,7 +379,6 @@ void vout_UnloadFont( vout_font_t *p_font ) return; } - intf_DbgMsg( "vout: unloading font %p", p_font ); free( p_font->p_data ); free( p_font ); } diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c index 1aa97fa8f8..fde53fd6c7 100644 --- a/src/video_output/vout_pictures.c +++ b/src/video_output/vout_pictures.c @@ -2,7 +2,7 @@ * vout_pictures.c : picture management functions ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: vout_pictures.c,v 1.15 2002/02/15 13:32:54 sam Exp $ + * $Id: vout_pictures.c,v 1.16 2002/02/19 00:50:20 sam Exp $ * * Authors: Vincent Seguin <seguin@via.ecp.fr> * Samuel Hocevar <sam@zoy.org> @@ -53,17 +53,12 @@ void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic ) case RESERVED_DATED_PICTURE: p_pic->i_status = READY_PICTURE; break; -#ifdef DEBUG default: intf_ErrMsg( "error: picture %p has invalid status %d", p_pic, p_pic->i_status ); break; -#endif } -#ifdef TRACE_VOUT - intf_DbgMsg("picture %p", p_pic); -#endif vlc_mutex_unlock( &p_vout->picture_lock ); } @@ -77,10 +72,6 @@ void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic ) void vout_DatePicture( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date ) { -#ifdef TRACE_VOUT - char psz_date[ MSTRTIME_MAX_SIZE ]; /* date */ -#endif - vlc_mutex_lock( &p_vout->picture_lock ); p_pic->date = date; switch( p_pic->i_status ) @@ -91,18 +82,12 @@ void vout_DatePicture( vout_thread_t *p_vout, case RESERVED_DISP_PICTURE: p_pic->i_status = READY_PICTURE; break; -#ifdef DEBUG default: intf_ErrMsg( "error: picture %p has invalid status %d", p_pic, p_pic->i_status ); break; -#endif } -#ifdef TRACE_VOUT - intf_DbgMsg( "picture %p, display date: %s", - p_pic, mstrtime( psz_date, p_pic->date) ); -#endif vlc_mutex_unlock( &p_vout->picture_lock ); } @@ -261,11 +246,6 @@ void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic ) { vlc_mutex_lock( &p_vout->picture_lock ); p_pic->i_refcount++; - -#ifdef TRACE_VOUT - intf_DbgMsg( "picture %p refcount=%d", p_pic, p_pic->i_refcount ); -#endif - vlc_mutex_unlock( &p_vout->picture_lock ); } @@ -279,13 +259,11 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic ) vlc_mutex_lock( &p_vout->picture_lock ); p_pic->i_refcount--; -#ifdef TRACE_VOUT if( p_pic->i_refcount < 0 ) { - intf_DbgMsg( "error: refcount < 0" ); + intf_ErrMsg( "vout error: picture refcount is %i", p_pic->i_refcount ); p_pic->i_refcount = 0; } -#endif if( ( p_pic->i_refcount == 0 ) && ( p_pic->i_status == DISPLAYED_PICTURE ) ) @@ -294,10 +272,6 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic ) p_vout->i_heap_size--; } -#ifdef TRACE_VOUT - intf_DbgMsg( "picture %p refcount=%d", p_pic, p_pic->i_refcount ); -#endif - vlc_mutex_unlock( &p_vout->picture_lock ); } diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c index 739795a4af..d72df7791f 100644 --- a/src/video_output/vout_subpictures.c +++ b/src/video_output/vout_subpictures.c @@ -2,7 +2,7 @@ * vout_subpictures.c : subpicture management functions ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: vout_subpictures.c,v 1.7 2002/02/13 22:10:40 sam Exp $ + * $Id: vout_subpictures.c,v 1.8 2002/02/19 00:50:20 sam Exp $ * * Authors: Vincent Seguin <seguin@via.ecp.fr> * Samuel Hocevar <sam@zoy.org> @@ -41,32 +41,22 @@ static void vout_RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic, const subpicture_t *p_spu ); -/* FIXME: fake palette - the real one has to be sought in the .IFO */ -static int p_palette[4] = { 0x0000, 0x0000, 0xffff, 0x8888 }; - /***************************************************************************** * vout_DisplaySubPicture: display a subpicture unit ***************************************************************************** - * Remove the reservation flag of a subpicture, which will cause it to be ready - * for display. The picture does not need to be locked, since it is ignored by - * the output thread if is reserved. + * Remove the reservation flag of a subpicture, which will cause it to be + * ready for display. *****************************************************************************/ void vout_DisplaySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic ) { -#ifdef TRACE_VOUT - char psz_start[ MSTRTIME_MAX_SIZE ]; /* buffer for date string */ - char psz_stop[ MSTRTIME_MAX_SIZE ]; /* buffer for date string */ -#endif int i_margin; -#ifdef DEBUG /* Check if status is valid */ if( p_subpic->i_status != RESERVED_SUBPICTURE ) { - intf_ErrMsg( "error: subpicture %p has invalid status #%d", + intf_ErrMsg( "vout error: subpicture %p has invalid status #%d", p_subpic, p_subpic->i_status ); } -#endif /* If the user requested an SPU margin, we force the position after * having checked that it was a valid value. */ @@ -84,14 +74,6 @@ void vout_DisplaySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic ) /* Remove reservation flag */ p_subpic->i_status = READY_SUBPICTURE; - -#ifdef TRACE_VOUT - /* Send subpicture information */ - intf_DbgMsg("subpicture %p: type=%d, begin date=%s, end date=%s", - p_subpic, p_subpic->i_type, - mstrtime( psz_start, p_subpic->i_start ), - mstrtime( psz_stop, p_subpic->i_stop ) ); -#endif } /***************************************************************************** @@ -128,10 +110,6 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type, * the best possible case, since no memory allocation needs * to be done */ p_vout->p_subpicture[i_subpic].i_status = RESERVED_SUBPICTURE; -#ifdef TRACE_VOUT - intf_DbgMsg("subpicture %p (in destroyed subpicture slot)", - &p_vout->p_subpicture[i_subpic] ); -#endif vlc_mutex_unlock( &p_vout->subpicture_lock ); return( &p_vout->p_subpicture[i_subpic] ); } @@ -159,62 +137,53 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type, p_free_subpic = p_destroyed_subpic; } - /* - * Prepare subpicture - */ - if( p_free_subpic != NULL ) + /* If no free or destroyed subpicture could be found */ + if( p_free_subpic == NULL ) { - /* Allocate memory */ - switch( i_type ) - { - case TEXT_SUBPICTURE: /* text subpicture */ - p_free_subpic->p_data = memalign( 16, i_size + 1 ); - break; - case DVD_SUBPICTURE: /* DVD subpicture unit */ - p_free_subpic->p_data = memalign( 16, i_size ); - break; -#ifdef DEBUG - default: - intf_ErrMsg("error: unknown subpicture type %d", i_type ); - p_free_subpic->p_data = NULL; - break; -#endif - } + intf_ErrMsg( "vout error: subpicture heap is full" ); + vlc_mutex_unlock( &p_vout->subpicture_lock ); + return( NULL ); + } - if( p_free_subpic->p_data != NULL ) - { - /* Copy subpicture information, set some default values */ - p_free_subpic->i_type = i_type; - p_free_subpic->i_status = RESERVED_SUBPICTURE; - p_free_subpic->i_size = i_size; - p_free_subpic->i_x = 0; - p_free_subpic->i_y = 0; - p_free_subpic->i_width = 0; - p_free_subpic->i_height = 0; - p_free_subpic->i_horizontal_align = CENTER_RALIGN; - p_free_subpic->i_vertical_align = CENTER_RALIGN; - } - else - { - /* Memory allocation failed : set subpicture as empty */ - p_free_subpic->i_type = EMPTY_SUBPICTURE; - p_free_subpic->i_status = FREE_SUBPICTURE; - p_free_subpic = NULL; - intf_ErrMsg( "vout error: spu allocation returned %s", - strerror( ENOMEM ) ); - } + /* Prepare subpicture */ + switch( i_type ) + { + case TEXT_SUBPICTURE: /* text subpicture */ + p_free_subpic->p_data = memalign( 16, i_size + 1 ); + break; + case DVD_SUBPICTURE: /* DVD subpicture unit */ + p_free_subpic->p_data = memalign( 16, i_size ); + break; + default: + intf_ErrMsg( "vout error: unknown subpicture type %d", i_type ); + p_free_subpic->p_data = NULL; + break; + } -#ifdef TRACE_VOUT - intf_DbgMsg("subpicture %p (in free subpicture slot)", p_free_subpic ); -#endif - vlc_mutex_unlock( &p_vout->subpicture_lock ); - return( p_free_subpic ); + if( p_free_subpic->p_data != NULL ) + { + /* Copy subpicture information, set some default values */ + p_free_subpic->i_type = i_type; + p_free_subpic->i_status = RESERVED_SUBPICTURE; + p_free_subpic->i_size = i_size; + p_free_subpic->i_x = 0; + p_free_subpic->i_y = 0; + p_free_subpic->i_width = 0; + p_free_subpic->i_height = 0; + } + else + { + /* Memory allocation failed : set subpicture as empty */ + p_free_subpic->i_type = EMPTY_SUBPICTURE; + p_free_subpic->i_status = FREE_SUBPICTURE; + p_free_subpic = NULL; + intf_ErrMsg( "vout error: spu allocation returned %s", + strerror( ENOMEM ) ); } - /* No free or destroyed subpicture could be found */ - intf_DbgMsg( "warning: subpicture heap is full" ); vlc_mutex_unlock( &p_vout->subpicture_lock ); - return( NULL ); + + return( p_free_subpic ); } /***************************************************************************** @@ -227,21 +196,15 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type, *****************************************************************************/ void vout_DestroySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic ) { -#ifdef DEBUG /* Check if status is valid */ if( ( p_subpic->i_status != RESERVED_SUBPICTURE ) && ( p_subpic->i_status != READY_SUBPICTURE ) ) { - intf_ErrMsg("error: subpicture %p has invalid status %d", + intf_ErrMsg( "vout error: subpicture %p has invalid status %d", p_subpic, p_subpic->i_status ); } -#endif p_subpic->i_status = DESTROYED_SUBPICTURE; - -#ifdef TRACE_VOUT - intf_DbgMsg("subpicture %p", p_subpic); -#endif } /***************************************************************************** @@ -297,10 +260,8 @@ void vout_RenderSubPictures( vout_thread_t *p_vout, picture_t *p_pic, #endif default: -#ifdef DEBUG - intf_ErrMsg( "error: unknown subpicture %p type %d", + intf_ErrMsg( "vout error: unknown subpicture %p type %d", p_subpic, p_subpic->i_type ); -#endif break; } @@ -418,40 +379,101 @@ subpicture_t *vout_SortSubPictures( vout_thread_t *p_vout, return p_subpic; } -#if 0 /* code removed because we should use the FOURCC value instead */ /***************************************************************************** - * vout_RenderRGBSPU: draw an SPU on a picture + * vout_RenderSPU: draw an SPU on a picture ***************************************************************************** * This is a fast implementation of the subpicture drawing code. The data * has been preprocessed once in spu_decoder.c, so we don't need to parse the * RLE buffer again and again. Most sanity checks are done in spu_decoder.c * so that this routine can be as fast as possible. *****************************************************************************/ -static void vout_RenderRGBSPU( const vout_thread_t *p_vout, picture_t *p_pic, - const subpicture_t *p_spu ) +static void vout_RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic, + const subpicture_t *p_spu ) { - int i_len, i_color; + /* Common variables */ + u8 p_clut8[4], p_trsp[4]; + u16 p_clut16[4]; + u8 *p_dest; u16 *p_source = (u16 *)p_spu->p_data; - int i_xscale = ( p_buffer->i_pic_width << 6 ) / p_pic->i_width; - int i_yscale = ( p_buffer->i_pic_height << 6 ) / p_pic->i_height; + int i_x, i_y; + int i_len, i_color; + + /* RGB-specific */ + int i_xscale, i_yscale, i_width, i_height, i_ytmp, i_yreal, i_ynext; + + /* FIXME: get this from the DVD */ + p_trsp[0] = 0x00; p_trsp[1] = 0xff; p_trsp[2] = 0xff; p_trsp[3] = 0xff; - int i_width = p_spu->i_width * i_xscale; - int i_height = p_spu->i_height * i_yscale; + switch( p_vout->output.i_chroma ) + { + /* I420 target, no scaling */ + case FOURCC_I420: + case FOURCC_IYUV: + case FOURCC_YV12: - int i_x, i_y, i_ytmp, i_yreal, i_ynext; + /* FIXME: get this from the DVD */ + p_clut8[0] = 0xaa; p_clut8[1] = 0x44; + p_clut8[2] = 0xff; p_clut8[3] = 0x88; - u8 *p_dest = p_buffer->p_data + ( i_width >> 6 ) * i_bytes_per_pixel - /* Add the picture coordinates and the SPU coordinates */ - + ( p_buffer->i_pic_x + ((p_spu->i_x * i_xscale) >> 6)) - * i_bytes_per_pixel - + ( p_buffer->i_pic_y + ((p_spu->i_y * i_yscale) >> 6)) - * i_bytes_per_line; + p_dest = p_pic->p->p_pixels + p_spu->i_x + p_spu->i_width + + p_vout->output.i_width * ( p_spu->i_y + p_spu->i_height ); /* Draw until we reach the bottom of the subtitle */ - i_y = 0; + for( i_y = p_spu->i_height * p_vout->output.i_width ; + i_y ; + i_y -= p_vout->output.i_width ) + { + /* Draw until we reach the end of the line */ + for( i_x = p_spu->i_width ; i_x ; ) + { + /* Get the RLE part, then draw the line */ + i_color = *p_source & 0x3; + + switch( p_trsp[ i_color ] ) + { + case 0x00: + i_x -= *p_source++ >> 2; + break; - while( i_y < i_height ) + case 0xff: + i_len = *p_source++ >> 2; + memset( p_dest - i_x - i_y, p_clut8[ i_color ], i_len ); + i_x -= i_len; + break; + + default: + /* FIXME: we should do transparency */ + i_len = *p_source++ >> 2; + memset( p_dest - i_x - i_y, p_clut8[ i_color ], i_len ); + i_x -= i_len; + break; + } + } + } + + break; + + /* RV16 target, scaling */ + case FOURCC_RV16: + + /* FIXME: get this from the DVD */ + p_clut16[0] = 0xaaaa; p_clut16[1] = 0x4444; + p_clut16[2] = 0xffff; p_clut16[3] = 0x8888; + + i_xscale = ( p_vout->output.i_width << 6 ) / p_vout->render.i_width; + i_yscale = ( p_vout->output.i_height << 6 ) / p_vout->render.i_height; + + i_width = p_spu->i_width * i_xscale; + i_height = p_spu->i_height * i_yscale; + + p_dest = p_pic->p->p_pixels + ( i_width >> 6 ) * 2 + /* Add the picture coordinates and the SPU coordinates */ + + ( (p_spu->i_x * i_xscale) >> 6 ) * 2 + + ( (p_spu->i_y * i_yscale) >> 6 ) * p_vout->output.i_width * 2; + + /* Draw until we reach the bottom of the subtitle */ + for( i_y = 0 ; i_y < i_height ; ) { i_ytmp = i_y >> 6; i_y += i_yscale; @@ -460,116 +482,91 @@ static void vout_RenderRGBSPU( const vout_thread_t *p_vout, picture_t *p_pic, if( i_ytmp + 1 >= ( i_y >> 6 ) ) { /* Just one line : we precalculate i_y >> 6 */ - i_yreal = i_bytes_per_line * i_ytmp; + i_yreal = p_vout->output.i_width * 2 * i_ytmp; /* Draw until we reach the end of the line */ - i_x = i_width; - - while( i_x ) + for( i_x = i_width ; i_x ; ) { - /* Get the RLE part */ + /* Get the RLE part, then draw the line */ i_color = *p_source & 0x3; - /* Draw the line */ - if( i_color ) + switch( p_trsp[ i_color ] ) { - i_len = i_xscale * ( *p_source++ >> 2 ); + case 0x00: + i_x -= i_xscale * ( *p_source++ >> 2 ); + break; - memset( p_dest - i_bytes_per_pixel * ( i_x >> 6 ) - + i_yreal, - p_palette[ i_color ], - i_bytes_per_pixel * ( ( i_len >> 6 ) + 1 ) ); + case 0xff: + i_len = i_xscale * ( *p_source++ >> 2 ); + memset( p_dest - 2 * ( i_x >> 6 ) + i_yreal, + p_clut16[ i_color ], + 2 * ( ( i_len >> 6 ) + 1 ) ); + i_x -= i_len; + break; + default: + /* FIXME: we should do transparency */ + i_len = i_xscale * ( *p_source++ >> 2 ); + memset( p_dest - 2 * ( i_x >> 6 ) + i_yreal, + p_clut16[ i_color ], + 2 * ( ( i_len >> 6 ) + 1 ) ); i_x -= i_len; - continue; + break; } - i_x -= i_xscale * ( *p_source++ >> 2 ); } } else { - i_yreal = i_bytes_per_line * i_ytmp; - i_ynext = i_bytes_per_line * i_y >> 6; + i_yreal = p_vout->output.i_width * 2 * i_ytmp; + i_ynext = p_vout->output.i_width * 2 * i_y >> 6; /* Draw until we reach the end of the line */ - i_x = i_width; - - while( i_x ) + for( i_x = i_width ; i_x ; ) { - /* Get the RLE part */ + /* Get the RLE part, then draw as many lines as needed */ i_color = *p_source & 0x3; - /* Draw as many lines as needed */ - if( i_color ) + switch( p_trsp[ i_color ] ) { - i_len = i_xscale * ( *p_source++ >> 2 ); + case 0x00: + i_x -= i_xscale * ( *p_source++ >> 2 ); + break; - for( i_ytmp = i_yreal ; - i_ytmp < i_ynext ; - i_ytmp += i_bytes_per_line ) + case 0xff: + i_len = i_xscale * ( *p_source++ >> 2 ); + for( i_ytmp = i_yreal ; i_ytmp < i_ynext ; + i_ytmp += p_vout->output.i_width * 2 ) { - memset( p_dest - i_bytes_per_pixel * ( i_x >> 6 ) - + i_ytmp, - p_palette[ i_color ], - i_bytes_per_pixel * ( ( i_len >> 6 ) + 1 ) ); + memset( p_dest - 2 * ( i_x >> 6 ) + i_ytmp, + p_clut16[ i_color ], + 2 * ( ( i_len >> 6 ) + 1 ) ); } + i_x -= i_len; + break; + default: + /* FIXME: we should do transparency */ + i_len = i_xscale * ( *p_source++ >> 2 ); + for( i_ytmp = i_yreal ; i_ytmp < i_ynext ; + i_ytmp += p_vout->output.i_width * 2 ) + { + memset( p_dest - 2 * ( i_x >> 6 ) + i_ytmp, + p_clut16[ i_color ], + 2 * ( ( i_len >> 6 ) + 1 ) ); + } i_x -= i_len; - continue; + break; } - - i_x -= i_xscale * ( *p_source++ >> 2 ); } } } -} -#endif - -/***************************************************************************** - * vout_RenderSPU: draw an SPU on an YUV overlay - ***************************************************************************** - * This is a fast implementation of the subpicture drawing code. The data - * has been preprocessed once in spu_decoder.c, so we don't need to parse the - * RLE buffer again and again. Most sanity checks are done in spu_decoder.c - * so that this routine can be as fast as possible. - *****************************************************************************/ -static void vout_RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic, - const subpicture_t *p_spu ) -{ - int i_len, i_color; - u16 *p_source = (u16 *)p_spu->p_data; - - int i_x, i_y; - u8 *p_dest = p_pic->p->p_pixels + p_spu->i_x + p_spu->i_width - + p_vout->output.i_width * ( p_spu->i_y + p_spu->i_height ); - - /* Draw until we reach the bottom of the subtitle */ - i_y = p_spu->i_height * p_vout->output.i_width; - - while( i_y ) - { - /* Draw until we reach the end of the line */ - i_x = p_spu->i_width; - - while( i_x ) - { - /* Draw the line if needed */ - i_color = *p_source & 0x3; - - if( i_color ) - { - i_len = *p_source++ >> 2; - memset( p_dest - i_x - i_y, p_palette[ i_color ], i_len ); - i_x -= i_len; - continue; - } - - i_x -= *p_source++ >> 2; - } + break; - i_y -= p_vout->output.i_width; + default: + intf_ErrMsg( "vout error: unknown chroma, can't render SPU" ); + break; } }