From c8c99b214eff8e62c0dfb83f4c3157f9e42d3e8a Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sun, 6 May 2001 04:32:03 +0000 Subject: [PATCH] * Fixed a few warnings with gcc 3.0. * aout and vout are now allocated in banks, making it possible to have several of them at the same time. * configure now checks for MMX and MMX EXT support in the assembler. * Removed all MMX code from the main program and moved it to the existing idct modules (Closes: Debian bug #96036). Don't forget to make distclean before building vlc again. --- AUTHORS | 1 + ChangeLog | 7 + Makefile.opts.in | 5 - configure | 124 ++++-- configure.in | 25 +- debian/changelog | 6 + include/audio_output.h | 25 +- include/beos_specific.h | 6 +- include/config.h.in | 6 + include/darwin_specific.h | 6 +- include/main.h | 4 +- include/modules.h | 16 +- include/netutils.h | 6 +- include/video_decoder.h | 12 +- {src/video_decoder => include}/video_fifo.h | 4 +- include/video_output.h | 22 +- {src/video_decoder => include}/video_parser.h | 15 +- {src/video_decoder => include}/vpar_headers.h | 2 +- {src/video_decoder => include}/vpar_synchro.h | 2 +- plugins/alsa/aout_alsa.c | 3 +- plugins/fb/vout_fb.c | 29 +- plugins/idct/Makefile | 21 +- plugins/idct/idct.c | 18 +- plugins/idct/idctaltivec.c | 18 +- plugins/idct/idctclassic.c | 18 +- plugins/idct/idctmmx.c | 18 +- plugins/idct/idctmmxext.c | 18 +- plugins/idct/vdec_block.h | 110 ++++++ plugins/idct/vdec_block_c.c | 191 ++++++++++ plugins/idct/vdec_block_mmx.c | 273 ++++++++++++++ plugins/idct/{idct_common.c => vdec_idct.c} | 6 +- plugins/idct/{idct.h => vdec_idct.h} | 4 +- plugins/qt/Makefile | 4 +- plugins/text/intf_rc.c | 12 +- src/ac3_decoder/ac3_bit_allocate.c | 4 +- src/ac3_decoder/ac3_decoder.c | 7 +- src/ac3_decoder/ac3_decoder_thread.c | 3 +- src/ac3_decoder/ac3_downmix.c | 5 +- src/ac3_decoder/ac3_downmix_c.c | 4 +- src/ac3_decoder/ac3_imdct.c | 4 +- src/ac3_decoder/ac3_imdct_c.c | 8 +- src/ac3_decoder/ac3_mantissa.c | 4 +- src/ac3_decoder/ac3_parse.c | 4 +- src/ac3_decoder/ac3_rematrix.c | 4 +- src/ac3_decoder/ac3_srfft.c | 4 +- src/ac3_spdif/ac3_iec958.c | 3 +- src/ac3_spdif/ac3_spdif.c | 9 +- src/audio_output/aout_ext-dec.c | 110 +++--- src/audio_output/aout_s16.c | 2 +- src/audio_output/aout_spdif.c | 3 +- src/audio_output/aout_u8.c | 6 +- src/audio_output/audio_output.c | 34 +- src/input/input_netlist.c | 47 ++- src/interface/interface.c | 68 +++- src/interface/main.c | 127 +++---- src/misc/beos_specific.cpp | 10 +- src/misc/darwin_specific.c | 10 +- src/misc/modules.c | 78 ++-- src/spu_decoder/spu_decoder.c | 34 +- src/video_decoder/vdec_idct.h | 29 -- src/video_decoder/video_decoder.c | 352 +----------------- src/video_output/video_output.c | 30 +- src/video_parser/video_fifo.c | 11 +- src/video_parser/video_parser.c | 27 +- src/video_parser/vpar_blocks.c | 11 +- src/video_parser/vpar_headers.c | 44 ++- src/video_parser/vpar_synchro.c | 9 +- 67 files changed, 1341 insertions(+), 801 deletions(-) rename {src/video_decoder => include}/video_fifo.h (98%) rename {src/video_decoder => include}/video_parser.h (93%) rename {src/video_decoder => include}/vpar_headers.h (99%) rename {src/video_decoder => include}/vpar_synchro.h (98%) create mode 100644 plugins/idct/vdec_block.h create mode 100644 plugins/idct/vdec_block_c.c create mode 100644 plugins/idct/vdec_block_mmx.c rename plugins/idct/{idct_common.c => vdec_idct.c} (97%) rename plugins/idct/{idct.h => vdec_idct.h} (98%) delete mode 100644 src/video_decoder/vdec_idct.h diff --git a/AUTHORS b/AUTHORS index 61232f669b..cf8ad9fb2b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -127,6 +127,7 @@ N: Andres Krapf E: dae@via.ecp.fr C: dae D: FreeBSD port and tests +D: KDE interface N: Markus Kuespert E: ltlBeBoy@beosmail.com diff --git a/ChangeLog b/ChangeLog index 5567bc85b4..19896d59c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,13 @@ #===================# HEAD + * Fixed a few warnings with gcc 3.0. + * aout and vout are now allocated in banks, making it possible to have + several of them at the same time. + * configure now checks for MMX and MMX EXT support in the assembler. + * Removed all MMX code from the main program and moved it to the + existing idct modules (Closes: Debian bug #96036). + * KDE interface. * FreeBSD CSS decryption support. * Fixed a segfault in TS input (psi packets with adaptation field). * Corrected vlc-howto.sgml thanks to Arnaud Gomes-do-Vale diff --git a/Makefile.opts.in b/Makefile.opts.in index eb4d17dadd..9eb59e1e37 100644 --- a/Makefile.opts.in +++ b/Makefile.opts.in @@ -200,11 +200,6 @@ endif #end of optimisations endif -# Optional MMX optimizations for x86 -ifneq (,$(findstring mmx,$(ARCH))) -CFLAGS += -DHAVE_MMX -endif - # # C compiler flags: dependancies # diff --git a/configure b/configure index 14df89cfc7..8624e778ad 100755 --- a/configure +++ b/configure @@ -2837,8 +2837,8 @@ fi rm -f conftest* CFLAGS="${CFLAGS} -rdynamic -Wall -Werror" -echo $ac_n "checking if \$CC groks -rdynamic without complaining too much""... $ac_c" 1>&6 -echo "configure:2842: checking if \$CC groks -rdynamic without complaining too much" >&5 +echo $ac_n "checking if \$CC miserably fails with the -rdynamic flag""... $ac_c" 1>&6 +echo "configure:2842: checking if \$CC miserably fails with the -rdynamic flag" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* LCFLAGS="${LCFLAGS} -rdynamic" - echo "$ac_t""yes" 1>&6 + echo "$ac_t""no" 1>&6 else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - echo "$ac_t""no" 1>&6 + echo "$ac_t""yes" 1>&6 fi rm -f conftest* @@ -3163,33 +3163,75 @@ fi ARCH=${host_cpu} BUILTINS="${BUILTINS} es ps ts yuv idct idctclassic motion" + case x$host_os in - xbeos|xnto-qnx) - ACCEL_PLUGINS="yuvmmx idctmmx motionmmx" - ;; xmingw32msvc) - ACCEL_PLUGINS="idctmmx idctmmxext motionmmx motionmmxext" + MMX_PLUGINS="idctmmx motionmmx" ;; *) - ACCEL_PLUGINS="yuvmmx idctmmx idctmmxext motionmmx motionmmxext" + MMX_PLUGINS="yuvmmx idctmmx motionmmx" ;; esac +echo $ac_n "checking if \$CC groks MMX inline assembly""... $ac_c" 1>&6 +echo "configure:3178: checking if \$CC groks MMX inline assembly" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ACCEL_PLUGINS="${ACCEL_PLUGINS} ${MMX_PLUGINS}" + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +echo $ac_n "checking if \$CC groks MMX EXT (SSE) inline assembly""... $ac_c" 1>&6 +echo "configure:3200: checking if \$CC groks MMX EXT (SSE) inline assembly" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ACCEL_PLUGINS="${ACCEL_PLUGINS} idctmmxext motionmmxext" + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + for ac_hdr in sys/ioctl.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3183: checking for $ac_hdr" >&5 +echo "configure:3225: 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:3193: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3235: \"$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* @@ -3215,17 +3257,17 @@ EOF do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3219: checking for $ac_hdr" >&5 +echo "configure:3261: 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:3229: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3271: \"$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* @@ -3253,7 +3295,7 @@ done BSD_DVD_STRUCT=0 cat > conftest.$ac_ext < EOF @@ -3271,7 +3313,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -3295,7 +3337,7 @@ EOF fi cat > conftest.$ac_ext < EOF @@ -3446,7 +3488,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:3450: checking for $ac_word" >&5 +echo "configure:3492: 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 @@ -3511,17 +3553,17 @@ else do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3515: checking for $ac_hdr" >&5 +echo "configure:3557: 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:3525: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3567: \"$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* @@ -3592,17 +3634,17 @@ if test "${with_sdl+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:3596: checking for $ac_hdr" >&5 +echo "configure:3638: 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:3606: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3648: \"$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* @@ -3640,17 +3682,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3644: checking for $ac_hdr" >&5 +echo "configure:3686: 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:3654: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3696: \"$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* @@ -3750,7 +3792,7 @@ if test x$enable_gtk != xno; then # 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:3754: checking for $ac_word" >&5 +echo "configure:3796: 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 @@ -3810,17 +3852,17 @@ if test x$enable_x11 != xno; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3814: checking for $ac_hdr" >&5 +echo "configure:3856: 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:3824: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3866: \"$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* @@ -3872,17 +3914,17 @@ if test x$enable_xvideo != xno; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3876: checking for $ac_hdr" >&5 +echo "configure:3918: 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:3886: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3928: \"$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* @@ -3920,17 +3962,17 @@ if test "${enable_alsa+set}" = set; then enableval="$enable_alsa" if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6 -echo "configure:3924: checking for sys/asoundlib.h" >&5 +echo "configure:3966: checking for sys/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:3934: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3976: \"$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* @@ -3947,7 +3989,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:3951: checking for main in -lasound" >&5 +echo "configure:3993: 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 @@ -3955,14 +3997,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:4008: \"$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 diff --git a/configure.in b/configure.in index 1c228c0270..2c380c1043 100644 --- a/configure.in +++ b/configure.in @@ -105,10 +105,10 @@ void foo() { int meuh; ntohl(meuh); }],, dnl Check for -rdynamic flag CFLAGS="${CFLAGS} -rdynamic -Wall -Werror" -AC_MSG_CHECKING([if \$CC groks -rdynamic without complaining too much]) +AC_MSG_CHECKING([if \$CC miserably fails with the -rdynamic flag]) AC_TRY_COMPILE([],, LCFLAGS="${LCFLAGS} -rdynamic" - AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) + AC_MSG_RESULT(no), AC_MSG_RESULT(yes)) dnl End of the bizarre compilation tests CFLAGS="${save_CFLAGS}" @@ -136,18 +136,29 @@ dnl dnl default modules dnl BUILTINS="${BUILTINS} es ps ts yuv idct idctclassic motion" + +dnl +dnl Accelerated modules +dnl case x$host_os in - xbeos|xnto-qnx) - ACCEL_PLUGINS="yuvmmx idctmmx motionmmx" - ;; xmingw32msvc) - ACCEL_PLUGINS="idctmmx idctmmxext motionmmx motionmmxext" + MMX_PLUGINS="idctmmx motionmmx" ;; *) - ACCEL_PLUGINS="yuvmmx idctmmx idctmmxext motionmmx motionmmxext" + MMX_PLUGINS="yuvmmx idctmmx motionmmx" ;; esac +AC_MSG_CHECKING([if \$CC groks MMX inline assembly]) +AC_TRY_COMPILE([void quux(){void *p;asm("packuswb %%mm1,%%mm2"::"r"(p));}],, + ACCEL_PLUGINS="${ACCEL_PLUGINS} ${MMX_PLUGINS}" + AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) + +AC_MSG_CHECKING([if \$CC groks MMX EXT (SSE) inline assembly]) +AC_TRY_COMPILE([void quux(){void *p;asm("maskmovq %%mm1,%%mm2"::"r"(p));}],, + ACCEL_PLUGINS="${ACCEL_PLUGINS} idctmmxext motionmmxext" + AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) + dnl dnl DVD module: check for DVD ioctls dnl diff --git a/debian/changelog b/debian/changelog index 461b4c2cd5..e0a7e4e7e5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vlc (0.2.73-2) unstable; urgency=low + + * We now build without MMX in the main application (Closes: #96036). + + -- Samuel Hocevar Fri, 4 May 2001 07:13:04 +0200 + vlc (0.2.73-1) unstable; urgency=low * New upstream release. diff --git a/include/audio_output.h b/include/audio_output.h index b7301c1007..996114e257 100644 --- a/include/audio_output.h +++ b/include/audio_output.h @@ -2,7 +2,7 @@ * audio_output.h : audio output thread interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: audio_output.h,v 1.33 2001/05/01 04:18:17 sam Exp $ + * $Id: audio_output.h,v 1.34 2001/05/06 04:32:02 sam Exp $ * * Authors: Michel Kaempf * @@ -21,6 +21,23 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ +/***************************************************************************** + * aout_bank_t, p_aout_bank (global variable) + ***************************************************************************** + * This global variable is accessed by any function using the audio output. + *****************************************************************************/ +typedef struct +{ + /* Array to all the audio outputs */ + struct aout_thread_s *pp_aout[ AOUT_MAX_THREADS ]; + + int i_count; + vlc_mutex_t lock; /* Global lock */ + +} aout_bank_t; + +extern aout_bank_t *p_aout_bank; + /***************************************************************************** * aout_increment_t ***************************************************************************** @@ -143,7 +160,8 @@ typedef struct aout_thread_s int i_fd; /* The current volume */ - int i_vol; + int i_volume; + int i_savedvolume; /* Format of the audio output samples */ int i_format; /* Number of channels */ @@ -180,6 +198,9 @@ typedef struct aout_thread_s /***************************************************************************** * Prototypes *****************************************************************************/ +void aout_InitBank ( void ); +void aout_EndBank ( void ); + aout_thread_t * aout_CreateThread ( int *pi_status ); void aout_DestroyThread ( aout_thread_t *, int * ); diff --git a/include/beos_specific.h b/include/beos_specific.h index bb2511e485..19c9f36da6 100644 --- a/include/beos_specific.h +++ b/include/beos_specific.h @@ -2,7 +2,7 @@ * beos_specific.h: BeOS specific features ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: beos_specific.h,v 1.5 2001/04/12 01:52:45 sam Exp $ + * $Id: beos_specific.h,v 1.6 2001/05/06 04:32:02 sam Exp $ * * Authors: Jean-Marc Dressler * @@ -29,8 +29,8 @@ extern "C" { #endif -void system_Create ( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ); -void system_Destroy( void ); +void system_Init ( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ); +void system_End ( void ); char * system_GetProgramPath( void ); #ifdef __cplusplus diff --git a/include/config.h.in b/include/config.h.in index f61f7bd648..f8ec6082a8 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -218,6 +218,9 @@ * Audio configuration *****************************************************************************/ +/* Maximum number of audio output threads */ +#define AOUT_MAX_THREADS 10 + /* Environment variable containing the audio output method */ #define AOUT_METHOD_VAR "vlc_aout" @@ -272,6 +275,9 @@ * Video configuration *****************************************************************************/ +/* Maximum number of video output threads */ +#define VOUT_MAX_THREADS 10 + /* * Default settings for video output threads */ diff --git a/include/darwin_specific.h b/include/darwin_specific.h index b63421d187..cab810ec73 100644 --- a/include/darwin_specific.h +++ b/include/darwin_specific.h @@ -2,7 +2,7 @@ * darwin_specific.h: Darwin specific features ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: darwin_specific.h,v 1.1 2001/04/12 01:52:45 sam Exp $ + * $Id: darwin_specific.h,v 1.2 2001/05/06 04:32:02 sam Exp $ * * Authors: Samuel Hocevar * @@ -24,7 +24,7 @@ /***************************************************************************** * Prototypes *****************************************************************************/ -void system_Create ( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ); -void system_Destroy( void ); +void system_Init ( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ); +void system_End ( void ); char * system_GetProgramPath( void ); diff --git a/include/main.h b/include/main.h index bd868c2b98..f2416af2cd 100644 --- a/include/main.h +++ b/include/main.h @@ -3,7 +3,7 @@ * Declaration and extern access to global program object. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: main.h,v 1.17 2001/05/01 04:18:17 sam Exp $ + * $Id: main.h,v 1.18 2001/05/06 04:32:02 sam Exp $ * * Authors: Vincent Seguin * @@ -50,8 +50,6 @@ typedef struct boolean_t b_channels; /* is channel changing supported ? */ /* Unique threads */ - p_vout_thread_t p_vout; /* video output thread */ - p_aout_thread_t p_aout; /* audio output thread */ p_intf_thread_t p_intf; /* main interface thread */ /* Shared data - these structures are accessed directly from p_main by diff --git a/include/modules.h b/include/modules.h index 3752aad30d..212af24828 100644 --- a/include/modules.h +++ b/include/modules.h @@ -2,7 +2,7 @@ * modules.h : Module management functions. ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: modules.h,v 1.22 2001/05/01 04:18:17 sam Exp $ + * $Id: modules.h,v 1.23 2001/05/06 04:32:02 sam Exp $ * * Authors: Samuel Hocevar * @@ -26,7 +26,7 @@ #endif /***************************************************************************** - * bank_t, p_bank (global variable) + * module_bank_t, p_module_bank (global variable) ***************************************************************************** * This global variable is accessed by any function using modules. *****************************************************************************/ @@ -36,9 +36,9 @@ typedef struct vlc_mutex_t lock; /* Global lock -- you can't imagine how awful it is to design thread-safe linked lists. */ -} bank_t; +} module_bank_t; -extern bank_t *p_bank; +extern module_bank_t *p_module_bank; /***************************************************************************** * Module #defines. @@ -168,12 +168,18 @@ typedef struct function_list_s /* IDCT plugin */ struct { - void ( * pf_init ) ( struct vdec_thread_s * ); + void ( * pf_idct_init ) ( struct vdec_thread_s * ); void ( * pf_sparse_idct ) ( struct vdec_thread_s *, dctelem_t *, int ); void ( * pf_idct ) ( struct vdec_thread_s *, dctelem_t *, int ); void ( * pf_norm_scan ) ( u8 ppi_scan[2][64] ); + + void ( * pf_vdec_init ) ( struct vdec_thread_s * ); + void ( * pf_decode_mb_c ) ( struct vdec_thread_s *, + struct macroblock_s * ); + void ( * pf_decode_mb_bw ) ( struct vdec_thread_s *, + struct macroblock_s * ); } idct; /* YUV transformation plugin */ diff --git a/include/netutils.h b/include/netutils.h index 96b93b203d..c8643b7b76 100644 --- a/include/netutils.h +++ b/include/netutils.h @@ -4,7 +4,7 @@ * modules. ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: netutils.h,v 1.11 2001/04/27 18:07:56 henri Exp $ + * $Id: netutils.h,v 1.12 2001/05/06 04:32:02 sam Exp $ * * Authors: Vincent Seguin * Henri Fallon @@ -32,5 +32,5 @@ *****************************************************************************/ int network_BuildLocalAddr ( struct sockaddr_in *, int, char * ); int network_BuildRemoteAddr( struct sockaddr_in *, char * ); -int network_ChannelJoin( int i_channel_id ); -int network_ChannelCreate( void ); +int network_ChannelJoin ( int i_channel_id ); +int network_ChannelCreate ( void ); diff --git a/include/video_decoder.h b/include/video_decoder.h index 6607b64242..6a0c056713 100644 --- a/include/video_decoder.h +++ b/include/video_decoder.h @@ -2,7 +2,7 @@ * video_decoder.h : video decoder thread ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_decoder.h,v 1.22 2001/01/13 12:57:19 sam Exp $ + * $Id: video_decoder.h,v 1.23 2001/05/06 04:32:02 sam Exp $ * * Authors: Christophe Massiot * @@ -54,14 +54,14 @@ typedef struct vdec_thread_s /* idct iformations */ dctelem_t p_pre_idct[64*64]; + /* Macroblock copy functions */ + void ( * pf_vdec_init ) ( struct vdec_thread_s * ); + void ( * pf_decode_mb_c ) ( struct vdec_thread_s *, struct macroblock_s * ); + void ( * pf_decode_mb_bw )( struct vdec_thread_s *, struct macroblock_s * ); + /* Input properties */ struct vpar_thread_s * p_vpar; /* video_parser thread */ -#ifndef HAVE_MMX - /* Lookup tables */ - u8 pi_crop_buf[VDEC_CROPRANGE]; - u8 * pi_crop; -#endif } vdec_thread_t; /***************************************************************************** diff --git a/src/video_decoder/video_fifo.h b/include/video_fifo.h similarity index 98% rename from src/video_decoder/video_fifo.h rename to include/video_fifo.h index 3133bb4e32..de4c8c229e 100644 --- a/src/video_decoder/video_fifo.h +++ b/include/video_fifo.h @@ -2,7 +2,7 @@ * video_fifo.h : FIFO for the pool of video_decoders ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_fifo.h,v 1.4 2001/02/23 14:07:25 massiot Exp $ + * $Id: video_fifo.h,v 1.18 2001/05/06 04:32:02 sam Exp $ * * Authors: Christophe Massiot * @@ -127,7 +127,7 @@ static __inline__ void vpar_DecodeMacroblock( video_fifo_t * p_fifo, vlc_mutex_unlock( &p_fifo->lock ); #else - vdec_DecodeMacroblockC( p_fifo->p_vpar->pp_vdec[0], p_mb ); + p_fifo->p_vpar->pf_decode_mb_c( p_fifo->p_vpar->pp_vdec[0], p_mb ); #endif } diff --git a/include/video_output.h b/include/video_output.h index 3923a275ee..f6fed8705a 100644 --- a/include/video_output.h +++ b/include/video_output.h @@ -5,7 +5,7 @@ * thread, and destroy a previously oppenned video output thread. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_output.h,v 1.58 2001/05/01 04:18:17 sam Exp $ + * $Id: video_output.h,v 1.59 2001/05/06 04:32:02 sam Exp $ * * Authors: Vincent Seguin * @@ -24,6 +24,23 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ +/***************************************************************************** + * vout_bank_t, p_vout_bank (global variable) + ***************************************************************************** + * This global variable is accessed by any function using the video output. + *****************************************************************************/ +typedef struct +{ + /* Array to all the video outputs */ + struct vout_thread_s *pp_vout[ VOUT_MAX_THREADS ]; + + int i_count; + vlc_mutex_t lock; /* Global lock */ + +} vout_bank_t; + +extern vout_bank_t *p_vout_bank; + /***************************************************************************** * vout_yuv_convert_t: YUV conversion function ***************************************************************************** @@ -256,6 +273,9 @@ typedef struct vout_thread_s /***************************************************************************** * Prototypes *****************************************************************************/ +void vout_InitBank ( void ); +void vout_EndBank ( void ); + vout_thread_t * vout_CreateThread ( int *pi_status ); void vout_DestroyThread ( vout_thread_t *p_vout, int *pi_status ); diff --git a/src/video_decoder/video_parser.h b/include/video_parser.h similarity index 93% rename from src/video_decoder/video_parser.h rename to include/video_parser.h index f754f196ec..78ffff7843 100644 --- a/src/video_decoder/video_parser.h +++ b/include/video_parser.h @@ -2,7 +2,7 @@ * video_parser.h : video parser thread ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_parser.h,v 1.8 2001/01/24 19:05:55 massiot Exp $ + * $Id: video_parser.h,v 1.34 2001/05/06 04:32:02 sam Exp $ * * Authors: Christophe Massiot * @@ -136,11 +136,14 @@ typedef struct vpar_thread_s void ( * ppf_motion_skipped[4][4] ) ( struct macroblock_s * ); /* IDCT plugin used and shortcuts to access its capabilities */ - struct module_s * p_idct_module; - idct_init_t pf_init; - f_idct_t pf_sparse_idct; - f_idct_t pf_idct; - norm_scan_t pf_norm_scan; + struct module_s * p_idct_module; + void ( * pf_idct_init ) ( struct vdec_thread_s * ); + void ( * pf_sparse_idct ) ( struct vdec_thread_s *, dctelem_t*, int ); + void ( * pf_idct ) ( struct vdec_thread_s *, dctelem_t*, int ); + void ( * pf_norm_scan ) ( u8 ppi_scan[2][64] ); + void ( * pf_vdec_init ) ( struct vdec_thread_s * ); + void ( * pf_decode_mb_c ) ( struct vdec_thread_s *, struct macroblock_s * ); + void ( * pf_decode_mb_bw )( struct vdec_thread_s *, struct macroblock_s * ); #ifdef STATS /* Statistics */ diff --git a/src/video_decoder/vpar_headers.h b/include/vpar_headers.h similarity index 99% rename from src/video_decoder/vpar_headers.h rename to include/vpar_headers.h index 458fb72bc5..4b321b1d39 100644 --- a/src/video_decoder/vpar_headers.h +++ b/include/vpar_headers.h @@ -2,7 +2,7 @@ * vpar_headers.h : video parser : headers parsing ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vpar_headers.h,v 1.6 2001/02/13 13:01:14 massiot Exp $ + * $Id: vpar_headers.h,v 1.26 2001/05/06 04:32:02 sam Exp $ * * Authors: Christophe Massiot * Stéphane Borel diff --git a/src/video_decoder/vpar_synchro.h b/include/vpar_synchro.h similarity index 98% rename from src/video_decoder/vpar_synchro.h rename to include/vpar_synchro.h index 263b62a93b..96bc9e8222 100644 --- a/src/video_decoder/vpar_synchro.h +++ b/include/vpar_synchro.h @@ -2,7 +2,7 @@ * vpar_synchro.h : video parser blocks management ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vpar_synchro.h,v 1.8 2001/03/06 15:16:42 massiot Exp $ + * $Id: vpar_synchro.h,v 1.33 2001/05/06 04:32:02 sam Exp $ * * Author: Christophe Massiot * diff --git a/plugins/alsa/aout_alsa.c b/plugins/alsa/aout_alsa.c index beecdb0a4d..d49246940e 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 VideoLAN - * $Id: aout_alsa.c,v 1.13 2001/04/06 09:15:47 sam Exp $ + * $Id: aout_alsa.c,v 1.14 2001/05/06 04:32:02 sam Exp $ * * Authors: Henri Fallon * @@ -36,7 +36,6 @@ #include /* calloc(), malloc(), free() */ #include -#include #include "config.h" #include "common.h" /* boolean_t, byte_t */ diff --git a/plugins/fb/vout_fb.c b/plugins/fb/vout_fb.c index ff782c62e9..3c6e1a8306 100644 --- a/plugins/fb/vout_fb.c +++ b/plugins/fb/vout_fb.c @@ -2,7 +2,7 @@ * vout_fb.c: framebuffer video output display method ***************************************************************************** * Copyright (C) 1998, 1999, 2000, 2001 VideoLAN - * $Id: vout_fb.c,v 1.10 2001/03/21 13:42:33 sam Exp $ + * $Id: vout_fb.c,v 1.11 2001/05/06 04:32:02 sam Exp $ * * Authors: Samuel Hocevar * @@ -608,26 +608,33 @@ static void FBCloseDisplay( vout_thread_t *p_vout ) *****************************************************************************/ static void FBSwitchDisplay(int i_signal) { - if( p_main->p_vout != NULL ) + vout_thread_t *p_vout; + + vlc_mutex_lock( &p_vout_bank->lock ); + + /* XXX: only test the first video output */ + if( p_vout_bank->i_count ) { + p_vout = p_vout_bank->pp_vout[0]; + switch( i_signal ) { case SIGUSR1: /* vt has been released */ - p_main->p_vout->b_active = 0; - ioctl( ((vout_sys_t *)p_main->p_vout->p_sys)->i_tty_dev, - VT_RELDISP, 1 ); + p_vout->b_active = 0; + ioctl( p_vout->p_sys->i_tty_dev, VT_RELDISP, 1 ); break; case SIGUSR2: /* vt has been acquired */ - p_main->p_vout->b_active = 1; - ioctl( ((vout_sys_t *)p_main->p_vout->p_sys)->i_tty_dev, - VT_RELDISP, VT_ACTIVATE ); + p_vout->b_active = 1; + ioctl( p_vout->p_sys->i_tty_dev, VT_RELDISP, VT_ACTIVATE ); /* handle blanking */ - vlc_mutex_lock( &p_main->p_vout->change_lock ); - p_main->p_vout->i_changes |= VOUT_SIZE_CHANGE; - vlc_mutex_unlock( &p_main->p_vout->change_lock ); + vlc_mutex_lock( &p_vout->change_lock ); + p_vout->i_changes |= VOUT_SIZE_CHANGE; + vlc_mutex_unlock( &p_vout->change_lock ); break; } } + + vlc_mutex_unlock( &p_vout_bank->lock ); } /***************************************************************************** diff --git a/plugins/idct/Makefile b/plugins/idct/Makefile index 25cd61897e..cf3a25d6b8 100644 --- a/plugins/idct/Makefile +++ b/plugins/idct/Makefile @@ -12,20 +12,27 @@ PLUGIN_IDCTCLASSIC = idctclassic.o PLUGIN_IDCTMMX = idctmmx.o PLUGIN_IDCTMMXEXT = idctmmxext.o PLUGIN_IDCTALTIVEC = idctaltivec.o -PLUGIN_IDCTCOMMON = idct_common.o +PLUGIN_IDCTCOMMON = vdec_idct.o +PLUGIN_VDECBLOCK_C = vdec_block_c.o +PLUGIN_VDECBLOCK_MMX = vdec_block_mmx.o BUILTIN_IDCT = $(PLUGIN_IDCT:%.o=BUILTIN_IDCT_%.o) \ - $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCT_%.o) + $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCT_%.o) \ + $(PLUGIN_VDECBLOCK_C:%.o=BUILTIN_IDCT_%.o) BUILTIN_IDCTCLASSIC = $(PLUGIN_IDCTCLASSIC:%.o=BUILTIN_IDCTCLASSIC_%.o) \ - $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTCLASSIC_%.o) + $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTCLASSIC_%.o) \ + $(PLUGIN_VDECBLOCK_C:%.o=BUILTIN_IDCTCLASSIC_%.o) BUILTIN_IDCTMMX = $(PLUGIN_IDCTMMX:%.o=BUILTIN_IDCTMMX_%.o) \ - $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTMMX_%.o) + $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTMMX_%.o) \ + $(PLUGIN_VDECBLOCK_MMX:%.o=BUILTIN_IDCTMMX_%.o) BUILTIN_IDCTMMXEXT = $(PLUGIN_IDCTMMXEXT:%.o=BUILTIN_IDCTMMXEXT_%.o) \ - $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTMMXEXT_%.o) + $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTMMXEXT_%.o) \ + $(PLUGIN_VDECBLOCK_MMX:%.o=BUILTIN_IDCTMMXEXT_%.o) BUILTIN_IDCTALTIVEC = $(PLUGIN_IDCTALTIVEC:%.o=BUILTIN_IDCTALTIVEC_%.o) \ - $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTALTIVEC_%.o) + $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTALTIVEC_%.o) \ + $(PLUGIN_VDECBLOCK_C:%.o=BUILTIN_IDCTALTIVEC_%.o) -PLUGIN_C = $(PLUGIN_IDCT) $(PLUGIN_IDCTCLASSIC) $(PLUGIN_IDCTMMX) $(PLUGIN_IDCTMMXEXT) $(PLUGIN_IDCTCOMMON) +PLUGIN_C = $(PLUGIN_IDCT) $(PLUGIN_IDCTCLASSIC) $(PLUGIN_IDCTMMX) $(PLUGIN_IDCTMMXEXT) $(PLUGIN_IDCTCOMMON) $(PLUGIN_VDECBLOCK_C) $(PLUGIN_VDECBLOCK_MMX) ALL_OBJ = $(PLUGIN_C) $(PLUGIN_IDCTALTIVEC) $(BUILTIN_IDCT) $(BUILTIN_IDCTCLASSIC) $(BUILTIN_IDCTMMX) $(BUILTIN_IDCTMMXEXT) $(BUILTIN_IDCTALTIVEC) # diff --git a/plugins/idct/idct.c b/plugins/idct/idct.c index dcfd77f1b5..eb51703da6 100644 --- a/plugins/idct/idct.c +++ b/plugins/idct/idct.c @@ -2,7 +2,7 @@ * idct.c : IDCT module ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: idct.c,v 1.8 2001/04/15 04:19:57 sam Exp $ + * $Id: idct.c,v 1.9 2001/05/06 04:32:02 sam Exp $ * * Authors: Gaël Hendryckx * @@ -44,7 +44,8 @@ #include "modules.h" -#include "idct.h" +#include "vdec_block.h" +#include "vdec_idct.h" /***************************************************************************** * Local and extern prototypes. @@ -128,10 +129,15 @@ MODULE_DEACTIVATE static void idct_getfunctions( function_list_t * p_function_list ) { p_function_list->pf_probe = idct_Probe; - p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT ); - p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT ); - p_function_list->functions.idct.pf_idct = _M( vdec_IDCT ); - p_function_list->functions.idct.pf_norm_scan = vdec_NormScan; +#define F p_function_list->functions.idct + F.pf_idct_init = _M( vdec_InitIDCT ); + F.pf_sparse_idct = _M( vdec_SparseIDCT ); + F.pf_idct = _M( vdec_IDCT ); + F.pf_norm_scan = vdec_NormScan; + F.pf_vdec_init = _M( vdec_Init ); + F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC ); + F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW ); +#undef F } /***************************************************************************** diff --git a/plugins/idct/idctaltivec.c b/plugins/idct/idctaltivec.c index b711f3d502..d1b6f4ee2d 100644 --- a/plugins/idct/idctaltivec.c +++ b/plugins/idct/idctaltivec.c @@ -2,7 +2,7 @@ * idctaltivec.c : Altivec IDCT module ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: idctaltivec.c,v 1.4 2001/04/15 04:19:57 sam Exp $ + * $Id: idctaltivec.c,v 1.5 2001/05/06 04:32:02 sam Exp $ * * Authors: Christophe Massiot * @@ -44,7 +44,8 @@ #include "modules.h" #include "modules_inner.h" -#include "idct.h" +#include "vdec_block.h" +#include "vdec_idct.h" #include "idctaltivec.h" @@ -129,10 +130,15 @@ MODULE_DEACTIVATE static void idct_getfunctions( function_list_t * p_function_list ) { p_function_list->pf_probe = idct_Probe; - p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT ); - p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT ); - p_function_list->functions.idct.pf_idct = _M( vdec_IDCT ); - p_function_list->functions.idct.pf_norm_scan = vdec_NormScan; +#define F p_function_list->functions.idct + F.pf_idct_init = _M( vdec_InitIDCT ); + F.pf_sparse_idct = _M( vdec_SparseIDCT ); + F.pf_idct = _M( vdec_IDCT ); + F.pf_norm_scan = vdec_NormScan; + F.pf_vdec_init = _M( vdec_Init ); + F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC ); + F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW ); +#undef F } /***************************************************************************** diff --git a/plugins/idct/idctclassic.c b/plugins/idct/idctclassic.c index 2209d53e77..a12ddbf43a 100644 --- a/plugins/idct/idctclassic.c +++ b/plugins/idct/idctclassic.c @@ -2,7 +2,7 @@ * idctclassic.c : Classic IDCT module ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: idctclassic.c,v 1.8 2001/04/15 04:19:57 sam Exp $ + * $Id: idctclassic.c,v 1.9 2001/05/06 04:32:02 sam Exp $ * * Authors: Gaël Hendryckx * @@ -44,7 +44,8 @@ #include "modules.h" #include "modules_inner.h" -#include "idct.h" +#include "vdec_block.h" +#include "vdec_idct.h" /***************************************************************************** * Local and extern prototypes. @@ -128,10 +129,15 @@ MODULE_DEACTIVATE static void idct_getfunctions( function_list_t * p_function_list ) { p_function_list->pf_probe = idct_Probe; - p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT ); - p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT ); - p_function_list->functions.idct.pf_idct = _M( vdec_IDCT ); - p_function_list->functions.idct.pf_norm_scan = vdec_NormScan; +#define F p_function_list->functions.idct + F.pf_idct_init = _M( vdec_InitIDCT ); + F.pf_sparse_idct = _M( vdec_SparseIDCT ); + F.pf_idct = _M( vdec_IDCT ); + F.pf_norm_scan = vdec_NormScan; + F.pf_vdec_init = _M( vdec_Init ); + F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC ); + F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW ); +#undef F } /***************************************************************************** diff --git a/plugins/idct/idctmmx.c b/plugins/idct/idctmmx.c index eb1a17621d..c0b22526c6 100644 --- a/plugins/idct/idctmmx.c +++ b/plugins/idct/idctmmx.c @@ -2,7 +2,7 @@ * idctmmx.c : MMX IDCT module ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: idctmmx.c,v 1.9 2001/04/15 04:19:57 sam Exp $ + * $Id: idctmmx.c,v 1.10 2001/05/06 04:32:02 sam Exp $ * * Authors: Aaron Holtzman * Michel Lespinasse @@ -48,7 +48,8 @@ #include "modules.h" #include "modules_inner.h" -#include "idct.h" +#include "vdec_block.h" +#include "vdec_idct.h" #include "attributes.h" #include "mmx.h" @@ -134,10 +135,15 @@ MODULE_DEACTIVATE static void idct_getfunctions( function_list_t * p_function_list ) { p_function_list->pf_probe = idct_Probe; - p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT ); - p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT ); - p_function_list->functions.idct.pf_idct = _M( vdec_IDCT ); - p_function_list->functions.idct.pf_norm_scan = vdec_NormScan; +#define F p_function_list->functions.idct + F.pf_idct_init = _M( vdec_InitIDCT ); + F.pf_sparse_idct = _M( vdec_SparseIDCT ); + F.pf_idct = _M( vdec_IDCT ); + F.pf_norm_scan = vdec_NormScan; + F.pf_vdec_init = _M( vdec_Init ); + F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC ); + F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW ); +#undef F } /***************************************************************************** diff --git a/plugins/idct/idctmmxext.c b/plugins/idct/idctmmxext.c index d275f6d569..f8a281d61c 100644 --- a/plugins/idct/idctmmxext.c +++ b/plugins/idct/idctmmxext.c @@ -2,7 +2,7 @@ * idctmmxext.c : MMX EXT IDCT module ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: idctmmxext.c,v 1.6 2001/04/15 04:19:57 sam Exp $ + * $Id: idctmmxext.c,v 1.7 2001/05/06 04:32:02 sam Exp $ * * Authors: Aaron Holtzman * Michel Lespinasse @@ -48,7 +48,8 @@ #include "modules.h" #include "modules_inner.h" -#include "idct.h" +#include "vdec_block.h" +#include "vdec_idct.h" #include "attributes.h" #include "mmx.h" @@ -134,10 +135,15 @@ MODULE_DEACTIVATE static void idct_getfunctions( function_list_t * p_function_list ) { p_function_list->pf_probe = idct_Probe; - p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT ); - p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT ); - p_function_list->functions.idct.pf_idct = _M( vdec_IDCT ); - p_function_list->functions.idct.pf_norm_scan = vdec_NormScan; +#define F p_function_list->functions.idct + F.pf_idct_init = _M( vdec_InitIDCT ); + F.pf_sparse_idct = _M( vdec_SparseIDCT ); + F.pf_idct = _M( vdec_IDCT ); + F.pf_norm_scan = vdec_NormScan; + F.pf_vdec_init = _M( vdec_Init ); + F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC ); + F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW ); +#undef F } /***************************************************************************** diff --git a/plugins/idct/vdec_block.h b/plugins/idct/vdec_block.h new file mode 100644 index 0000000000..9ae0be0826 --- /dev/null +++ b/plugins/idct/vdec_block.h @@ -0,0 +1,110 @@ +/***************************************************************************** + * vdec_block_h: Macroblock copy functions + ***************************************************************************** + * Copyright (C) 1999, 2000, 2001 VideoLAN + * $Id: vdec_block.h,v 1.1 2001/05/06 04:32:02 sam Exp $ + * + * Authors: Christophe Massiot + * + * 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. + *****************************************************************************/ + +/***************************************************************************** + * Prototypes + *****************************************************************************/ +void _M( vdec_Init ) ( struct vdec_thread_s *p_vdec ); +void _M( vdec_DecodeMacroblockC ) ( struct vdec_thread_s *p_vdec, + struct macroblock_s * p_mb ); +void _M( vdec_DecodeMacroblockBW ) ( struct vdec_thread_s *p_vdec, + struct macroblock_s * p_mb ); + +/***************************************************************************** + * vdec_DecodeMacroblock : decode a macroblock of a picture + *****************************************************************************/ +#define DECODEBLOCKSC( OPBLOCK ) \ +{ \ + int i_b, i_mask; \ + \ + i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks); \ + \ + /* luminance */ \ + for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 ) \ + { \ + if( p_mb->i_coded_block_pattern & i_mask ) \ + { \ + /* \ + * Inverse DCT (ISO/IEC 13818-2 section Annex A) \ + */ \ + (p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b], \ + p_mb->pi_sparse_pos[i_b] ); \ + \ + /* \ + * Adding prediction and coefficient data (ISO/IEC 13818-2 \ + * section 7.6.8) \ + */ \ + OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b], \ + p_mb->p_data[i_b], p_mb->i_addb_l_stride ); \ + } \ + } \ + \ + /* chrominance */ \ + for( i_b = 4; i_b < 4 + p_mb->i_chroma_nb_blocks; \ + i_b++, i_mask >>= 1 ) \ + { \ + if( p_mb->i_coded_block_pattern & i_mask ) \ + { \ + /* \ + * Inverse DCT (ISO/IEC 13818-2 section Annex A) \ + */ \ + (p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b], \ + p_mb->pi_sparse_pos[i_b] ); \ + \ + /* \ + * Adding prediction and coefficient data (ISO/IEC 13818-2 \ + * section 7.6.8) \ + */ \ + OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b], \ + p_mb->p_data[i_b], p_mb->i_addb_c_stride ); \ + } \ + } \ +} + +#define DECODEBLOCKSBW( OPBLOCK ) \ +{ \ + int i_b, i_mask; \ + \ + i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks); \ + \ + /* luminance */ \ + for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 ) \ + { \ + if( p_mb->i_coded_block_pattern & i_mask ) \ + { \ + /* \ + * Inverse DCT (ISO/IEC 13818-2 section Annex A) \ + */ \ + (p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b], \ + p_mb->pi_sparse_pos[i_b] ); \ + \ + /* \ + * Adding prediction and coefficient data (ISO/IEC 13818-2 \ + * section 7.6.8) \ + */ \ + OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b], \ + p_mb->p_data[i_b], p_mb->i_addb_l_stride ); \ + } \ + } \ +} + diff --git a/plugins/idct/vdec_block_c.c b/plugins/idct/vdec_block_c.c new file mode 100644 index 0000000000..9bba8cf1e7 --- /dev/null +++ b/plugins/idct/vdec_block_c.c @@ -0,0 +1,191 @@ +/***************************************************************************** + * vdec_block_c.c: Macroblock copy functions in C + ***************************************************************************** + * Copyright (C) 1999, 2000, 2001 VideoLAN + * $Id: vdec_block_c.c,v 1.1 2001/05/06 04:32:02 sam Exp $ + * + * Authors: Christophe Massiot + * + * 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. + *****************************************************************************/ + +/* MODULE_NAME defined in Makefile together with -DBUILTIN */ +#ifdef BUILTIN +# include "modules_inner.h" +#else +# define _M( foo ) foo +#endif + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#include "defs.h" + +#include "config.h" +#include "common.h" +#include "threads.h" +#include "mtime.h" + +#include "intf_msg.h" + +#include "input_ext-dec.h" + +#include "video.h" +#include "video_output.h" + +#include "vdec_motion.h" +#include "video_decoder.h" + +#include "vpar_blocks.h" + +#include "vpar_headers.h" +#include "vpar_synchro.h" +#include "video_parser.h" +#include "video_fifo.h" + +#include "vdec_block.h" + +/***************************************************************************** + * Static variables + ***************************************************************************** + * We can keep them static since they will always contain the same values. + *****************************************************************************/ +static u8 pi_crop_buf[VDEC_CROPRANGE]; +static u8 *pi_crop; + +/***************************************************************************** + * vdec_Init: initialize video decoder thread + *****************************************************************************/ +void _M( vdec_Init ) ( vdec_thread_t *p_vdec ) +{ + int i_dummy; + + /* Init crop table */ + pi_crop = pi_crop_buf + (VDEC_CROPRANGE >> 1); + + for( i_dummy = -(VDEC_CROPRANGE >> 1); i_dummy < 0; i_dummy++ ) + { + pi_crop[i_dummy] = 0; + } + + for( ; i_dummy < 255; i_dummy ++ ) + { + pi_crop[i_dummy] = i_dummy; + } + + for( ; i_dummy < (VDEC_CROPRANGE >> 1) -1; i_dummy++ ) + { + pi_crop[i_dummy] = 255; + } +} + +/***************************************************************************** + * AddBlock : add a block + *****************************************************************************/ +static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, + yuv_data_t * p_data, int i_incr ) +{ + int i_x, i_y; + + for( i_y = 0; i_y < 8; i_y++ ) + { + for( i_x = 0; i_x < 8; i_x++ ) + { + *p_data = pi_crop[*p_data + *p_block++]; + p_data++; + } + p_data += i_incr; + } +} + +/***************************************************************************** + * CopyBlock : copy a block + *****************************************************************************/ +static __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, + yuv_data_t * p_data, int i_incr ) +{ + int i_x, i_y; + + for( i_y = 0; i_y < 8; i_y++ ) + { + for( i_x = 0; i_x < 8; i_x++ ) + { + *p_data++ = pi_crop[*p_block++]; + } + p_data += i_incr; + } +} + +void _M( vdec_DecodeMacroblockC ) ( vdec_thread_t *p_vdec, macroblock_t * p_mb ) +{ + if( !(p_mb->i_mb_type & MB_INTRA) ) + { + /* + * Motion Compensation (ISO/IEC 13818-2 section 7.6) + */ + if( p_mb->pf_motion == 0 ) + { + intf_WarnMsg( 2, "pf_motion set to NULL" ); + } + else + { + p_mb->pf_motion( p_mb ); + } + + DECODEBLOCKSC( AddBlock ) + } + else + { + DECODEBLOCKSC( CopyBlock ) + } + + /* + * Decoding is finished, release the macroblock and free + * unneeded memory. + */ + vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb ); +} + +void _M( vdec_DecodeMacroblockBW ) ( vdec_thread_t *p_vdec, + macroblock_t * p_mb ) +{ + if( !(p_mb->i_mb_type & MB_INTRA) ) + { + /* + * Motion Compensation (ISO/IEC 13818-2 section 7.6) + */ + if( p_mb->pf_motion == 0 ) + { + intf_WarnMsg( 2, "pf_motion set to NULL" ); + } + else + { + p_mb->pf_motion( p_mb ); + } + + DECODEBLOCKSBW( AddBlock ) + } + else + { + DECODEBLOCKSBW( CopyBlock ) + } + + /* + * Decoding is finished, release the macroblock and free + * unneeded memory. + */ + vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb ); +} + diff --git a/plugins/idct/vdec_block_mmx.c b/plugins/idct/vdec_block_mmx.c new file mode 100644 index 0000000000..786ed20e52 --- /dev/null +++ b/plugins/idct/vdec_block_mmx.c @@ -0,0 +1,273 @@ +/***************************************************************************** + * vdec_block_mmx.c: Macroblock copy functions in MMX assembly + ***************************************************************************** + * Copyright (C) 1999, 2000, 2001 VideoLAN + * $Id: vdec_block_mmx.c,v 1.1 2001/05/06 04:32:02 sam Exp $ + * + * Authors: Gaël Hendryckx + * + * 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. + *****************************************************************************/ + +/* MODULE_NAME defined in Makefile together with -DBUILTIN */ +#ifdef BUILTIN +# include "modules_inner.h" +#else +# define _M( foo ) foo +#endif + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#include "defs.h" + +#include "config.h" +#include "common.h" +#include "threads.h" +#include "mtime.h" + +#include "intf_msg.h" + +#include "input_ext-dec.h" + +#include "video.h" +#include "video_output.h" + +#include "vdec_motion.h" +#include "video_decoder.h" + +#include "vpar_blocks.h" + +#include "vpar_headers.h" +#include "vpar_synchro.h" +#include "video_parser.h" +#include "video_fifo.h" + +#include "vdec_block.h" + +/***************************************************************************** + * vdec_Init: initialize video decoder thread + *****************************************************************************/ +void _M( vdec_Init ) ( vdec_thread_t *p_vdec ) +{ + ; +} + +/***************************************************************************** + * AddBlock : add a block + *****************************************************************************/ +static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, + yuv_data_t * p_data, int i_incr ) +{ + asm __volatile__ ( + "pxor %%mm7,%%mm7\n\t" + + "movq (%0),%%mm1\n\t" + "movq %%mm1,%%mm2\n\t" + "punpckhbw %%mm7,%%mm1\n\t" + "punpcklbw %%mm7,%%mm2\n\t" + "paddw (%2),%%mm2\n\t" + "paddw 8(%2),%%mm1\n\t" + "packuswb %%mm1,%%mm2\n\t" + "movq %%mm2,(%0)\n\t" + "addl %3,%0\n\t" + + "movq (%0),%%mm1\n\t" + "movq %%mm1,%%mm2\n\t" + "punpckhbw %%mm7,%%mm1\n\t" + "punpcklbw %%mm7,%%mm2\n\t" + "paddw 16(%2),%%mm2\n\t" + "paddw 24(%2),%%mm1\n\t" + "packuswb %%mm1,%%mm2\n\t" + "movq %%mm2,(%0)\n\t" + "addl %3,%0\n\t" + + "movq (%0),%%mm1\n\t" + "movq %%mm1,%%mm2\n\t" + "punpckhbw %%mm7,%%mm1\n\t" + "punpcklbw %%mm7,%%mm2\n\t" + "paddw 32(%2),%%mm2\n\t" + "paddw 40(%2),%%mm1\n\t" + "packuswb %%mm1,%%mm2\n\t" + "movq %%mm2,(%0)\n\t" + "addl %3,%0\n\t" + + "movq (%0),%%mm1\n\t" + "movq %%mm1,%%mm2\n\t" + "punpckhbw %%mm7,%%mm1\n\t" + "punpcklbw %%mm7,%%mm2\n\t" + "paddw 48(%2),%%mm2\n\t" + "paddw 56(%2),%%mm1\n\t" + "packuswb %%mm1,%%mm2\n\t" + "movq %%mm2,(%0)\n\t" + "addl %3,%0\n\t" + + "movq (%0),%%mm1\n\t" + "movq %%mm1,%%mm2\n\t" + "punpckhbw %%mm7,%%mm1\n\t" + "punpcklbw %%mm7,%%mm2\n\t" + "paddw 64(%2),%%mm2\n\t" + "paddw 72(%2),%%mm1\n\t" + "packuswb %%mm1,%%mm2\n\t" + "movq %%mm2,(%0)\n\t" + "addl %3,%0\n\t" + + "movq (%0),%%mm1\n\t" + "movq %%mm1,%%mm2\n\t" + "punpckhbw %%mm7,%%mm1\n\t" + "punpcklbw %%mm7,%%mm2\n\t" + "paddw 80(%2),%%mm2\n\t" + "paddw 88(%2),%%mm1\n\t" + "packuswb %%mm1,%%mm2\n\t" + "movq %%mm2,(%0)\n\t" + "addl %3,%0\n\t" + + "movq (%0),%%mm1\n\t" + "movq %%mm1,%%mm2\n\t" + "punpckhbw %%mm7,%%mm1\n\t" + "punpcklbw %%mm7,%%mm2\n\t" + "paddw 96(%2),%%mm2\n\t" + "paddw 104(%2),%%mm1\n\t" + "packuswb %%mm1,%%mm2\n\t" + "movq %%mm2,(%0)\n\t" + "addl %3,%0\n\t" + + "movq (%0),%%mm1\n\t" + "movq %%mm1,%%mm2\n\t" + "punpckhbw %%mm7,%%mm1\n\t" + "punpcklbw %%mm7,%%mm2\n\t" + "paddw 112(%2),%%mm2\n\t" + "paddw 120(%2),%%mm1\n\t" + "packuswb %%mm1,%%mm2\n\t" + "movq %%mm2,(%0)\n\t" + + //"emms" + : "=r" (p_data) + : "0" (p_data), "r" (p_block), "r" (i_incr + 8) ); +} + +/***************************************************************************** + * CopyBlock : copy a block + *****************************************************************************/ +static __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, + yuv_data_t * p_data, int i_incr ) +{ + asm __volatile__ ( + "movq (%2),%%mm0\n\t" + "packuswb 8(%2),%%mm0\n\t" + "movq %%mm0,(%0)\n\t" + "addl %3,%0\n\t" + + "movq 16(%2),%%mm0\n\t" + "packuswb 24(%2),%%mm0\n\t" + "movq %%mm0,(%0)\n\t" + "addl %3,%0\n\t" + + "movq 32(%2),%%mm0\n\t" + "packuswb 40(%2),%%mm0\n\t" + "movq %%mm0,(%0)\n\t" + "addl %3,%0\n\t" + + "movq 48(%2),%%mm0\n\t" + "packuswb 56(%2),%%mm0\n\t" + "movq %%mm0,(%0)\n\t" + "addl %3,%0\n\t" + + "movq 64(%2),%%mm0\n\t" + "packuswb 72(%2),%%mm0\n\t" + "movq %%mm0,(%0)\n\t" + "addl %3,%0\n\t" + + "movq 80(%2),%%mm0\n\t" + "packuswb 88(%2),%%mm0\n\t" + "movq %%mm0,(%0)\n\t" + "addl %3,%0\n\t" + + "movq 96(%2),%%mm0\n\t" + "packuswb 104(%2),%%mm0\n\t" + "movq %%mm0,(%0)\n\t" + "addl %3,%0\n\t" + + "movq 112(%2),%%mm0\n\t" + "packuswb 120(%2),%%mm0\n\t" + "movq %%mm0,(%0)\n\t" + + //"emms" + : "=r" (p_data) + : "0" (p_data), "r" (p_block), "r" (i_incr + 8) ); +} + +void _M( vdec_DecodeMacroblockC ) ( vdec_thread_t *p_vdec, + macroblock_t * p_mb ) +{ + if( !(p_mb->i_mb_type & MB_INTRA) ) + { + /* + * Motion Compensation (ISO/IEC 13818-2 section 7.6) + */ + if( p_mb->pf_motion == 0 ) + { + intf_WarnMsg( 2, "pf_motion set to NULL" ); + } + else + { + p_mb->pf_motion( p_mb ); + } + + DECODEBLOCKSC( AddBlock ) + } + else + { + DECODEBLOCKSC( CopyBlock ) + } + + /* + * Decoding is finished, release the macroblock and free + * unneeded memory. + */ + vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb ); +} + +void _M( vdec_DecodeMacroblockBW ) ( vdec_thread_t *p_vdec, + macroblock_t * p_mb ) +{ + if( !(p_mb->i_mb_type & MB_INTRA) ) + { + /* + * Motion Compensation (ISO/IEC 13818-2 section 7.6) + */ + if( p_mb->pf_motion == 0 ) + { + intf_WarnMsg( 2, "pf_motion set to NULL" ); + } + else + { + p_mb->pf_motion( p_mb ); + } + + DECODEBLOCKSBW( AddBlock ) + } + else + { + DECODEBLOCKSBW( CopyBlock ) + } + + /* + * Decoding is finished, release the macroblock and free + * unneeded memory. + */ + vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb ); +} + diff --git a/plugins/idct/idct_common.c b/plugins/idct/vdec_idct.c similarity index 97% rename from plugins/idct/idct_common.c rename to plugins/idct/vdec_idct.c index 7940c04a62..9ee29ed0a4 100644 --- a/plugins/idct/idct_common.c +++ b/plugins/idct/vdec_idct.c @@ -1,8 +1,8 @@ /***************************************************************************** - * idct_common.c : common IDCT functions + * vdec_idct.c : common IDCT functions ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: idct_common.c,v 1.5 2001/04/15 04:19:57 sam Exp $ + * $Id: vdec_idct.c,v 1.1 2001/05/06 04:32:02 sam Exp $ * * Authors: Gaël Hendryckx * @@ -47,7 +47,7 @@ #include "modules.h" -#include "idct.h" +#include "vdec_idct.h" /***************************************************************************** * vdec_InitIDCT : initialize datas for vdec_SparseIDCT diff --git a/plugins/idct/idct.h b/plugins/idct/vdec_idct.h similarity index 98% rename from plugins/idct/idct.h rename to plugins/idct/vdec_idct.h index e9ff7fba51..61b15d7f06 100644 --- a/plugins/idct/idct.h +++ b/plugins/idct/vdec_idct.h @@ -1,8 +1,8 @@ /***************************************************************************** - * idct.h : macros for the inverse discrete cosine transform + * vdec_idct.h : macros for the inverse discrete cosine transform ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: idct.h,v 1.3 2001/04/15 04:19:57 sam Exp $ + * $Id: vdec_idct.h,v 1.1 2001/05/06 04:32:02 sam Exp $ * * Authors: Gaël Hendryckx * Christophe Massiot diff --git a/plugins/qt/Makefile b/plugins/qt/Makefile index 9d927f21b0..37cdd7b471 100644 --- a/plugins/qt/Makefile +++ b/plugins/qt/Makefile @@ -22,13 +22,13 @@ $(PLUGIN_QT): %.o: .dep/%.dpp $(PLUGIN_QT): %.o: %.moc $(CC) $(CFLAGS) $(PCFLAGS) -I/usr/include/qt -I${QTDIR}/include -c -o $@ $(<:%.moc=%.cpp) $(PLUGIN_QT:%.o=%.moc): %.moc: %.cpp - $(MOC) -i $< -o $@ + grep -q Q_OBJECT $< && $(MOC) -i $< -o $@ || true $(BUILTIN_QT): BUILTIN_%.o: .dep/%.dpp $(BUILTIN_QT): %.o: %.moc $(CC) $(CFLAGS) -DBUILTIN -I/usr/include/qt -I${QTDIR}/include -c -o $@ $(<:BUILTIN_%.moc=%.cpp) $(BUILTIN_QT:%.o=%.moc): BUILTIN_%.moc: %.cpp - $(MOC) -i $< -o $@ + grep -q Q_OBJECT $< && $(MOC) -i $< -o $@ || true # # Real targets diff --git a/plugins/text/intf_rc.c b/plugins/text/intf_rc.c index 614622bcb9..14b0816867 100644 --- a/plugins/text/intf_rc.c +++ b/plugins/text/intf_rc.c @@ -55,9 +55,6 @@ #include "video.h" #include "video_output.h" -#include "main.h" - - /***************************************************************************** * intf_sys_t: description and status of rc interface *****************************************************************************/ @@ -212,7 +209,14 @@ static void intf_Run( intf_thread_t *p_intf ) case 'f': case 'F': - p_main->p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE; + vlc_mutex_lock( &p_vout_bank->lock ); + /* XXX: only fullscreen the first video output */ + if( p_vout_bank->i_count ) + { + p_vout_bank->pp_vout[0]->i_changes + |= VOUT_FULLSCREEN_CHANGE; + } + vlc_mutex_unlock( &p_vout_bank->lock ); break; case 'm': diff --git a/src/ac3_decoder/ac3_bit_allocate.c b/src/ac3_decoder/ac3_bit_allocate.c index ebf474b86f..89da86dfab 100644 --- a/src/ac3_decoder/ac3_bit_allocate.c +++ b/src/ac3_decoder/ac3_bit_allocate.c @@ -2,7 +2,7 @@ * ac3_bit_allocate.c: ac3 allocation tables ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: ac3_bit_allocate.c,v 1.19 2001/04/26 11:23:16 sam Exp $ + * $Id: ac3_bit_allocate.c,v 1.20 2001/05/06 04:32:02 sam Exp $ * * Authors: Michel Kaempf * Aaron Holtzman @@ -24,6 +24,8 @@ *****************************************************************************/ #include "defs.h" +#include /* memcpy() */ + #include "config.h" #include "common.h" #include "threads.h" diff --git a/src/ac3_decoder/ac3_decoder.c b/src/ac3_decoder/ac3_decoder.c index c3fd6d48e2..8659165496 100644 --- a/src/ac3_decoder/ac3_decoder.c +++ b/src/ac3_decoder/ac3_decoder.c @@ -2,7 +2,7 @@ * ac3_decoder.c: core ac3 decoder ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_decoder.c,v 1.30 2001/04/30 21:04:20 reno Exp $ + * $Id: ac3_decoder.c,v 1.31 2001/05/06 04:32:02 sam Exp $ * * Authors: Michel Kaempf * Michel Lespinasse @@ -25,6 +25,8 @@ #include "defs.h" +#include /* memcpy() */ + #include "config.h" #include "common.h" #include "threads.h" @@ -34,12 +36,11 @@ #include "stream_control.h" #include "input_ext-dec.h" -#include "audio_output.h" +#include "audio_output.h" #include "ac3_decoder.h" #include "ac3_decoder_thread.h" - #include "ac3_internal.h" #include diff --git a/src/ac3_decoder/ac3_decoder_thread.c b/src/ac3_decoder/ac3_decoder_thread.c index 278942cb0a..6cac3615ac 100644 --- a/src/ac3_decoder/ac3_decoder_thread.c +++ b/src/ac3_decoder/ac3_decoder_thread.c @@ -2,7 +2,7 @@ * ac3_decoder_thread.c: ac3 decoder thread ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_decoder_thread.c,v 1.31 2001/05/01 04:18:18 sam Exp $ + * $Id: ac3_decoder_thread.c,v 1.32 2001/05/06 04:32:02 sam Exp $ * * Authors: Michel Lespinasse * @@ -39,6 +39,7 @@ #include /* "intf_msg.h" */ #include /* malloc(), free() */ +#include /* memset() */ #include "config.h" #include "common.h" diff --git a/src/ac3_decoder/ac3_downmix.c b/src/ac3_decoder/ac3_downmix.c index c78ec60b53..08ecbccd02 100644 --- a/src/ac3_decoder/ac3_downmix.c +++ b/src/ac3_decoder/ac3_downmix.c @@ -2,7 +2,7 @@ * ac3_downmix.c: ac3 downmix functions ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_downmix.c,v 1.21 2001/04/30 21:04:20 reno Exp $ + * $Id: ac3_downmix.c,v 1.22 2001/05/06 04:32:02 sam Exp $ * * Authors: Michel Kaempf * Aaron Holtzman @@ -24,6 +24,8 @@ *****************************************************************************/ #include "defs.h" +#include /* memcpy() */ + #include "config.h" #include "common.h" #include "threads.h" @@ -33,6 +35,7 @@ #include "stream_control.h" #include "input_ext-dec.h" + #include "ac3_decoder.h" #include "ac3_internal.h" #include "ac3_downmix.h" diff --git a/src/ac3_decoder/ac3_downmix_c.c b/src/ac3_decoder/ac3_downmix_c.c index 757c532f6a..992ebe07bd 100644 --- a/src/ac3_decoder/ac3_downmix_c.c +++ b/src/ac3_decoder/ac3_downmix_c.c @@ -2,7 +2,7 @@ * ac3_downmix_c.c: ac3 downmix functions ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: ac3_downmix_c.c,v 1.6 2001/04/30 21:04:20 reno Exp $ + * $Id: ac3_downmix_c.c,v 1.7 2001/05/06 04:32:02 sam Exp $ * * Authors: Renaud Dartus * Aaron Holtzman @@ -24,6 +24,8 @@ #include "defs.h" +#include /* memcpy() */ + #include "config.h" #include "common.h" #include "threads.h" diff --git a/src/ac3_decoder/ac3_imdct.c b/src/ac3_decoder/ac3_imdct.c index 295843a7b7..e632510521 100644 --- a/src/ac3_decoder/ac3_imdct.c +++ b/src/ac3_decoder/ac3_imdct.c @@ -2,7 +2,7 @@ * ac3_imdct.c: ac3 DCT ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_imdct.c,v 1.17 2001/04/30 21:04:20 reno Exp $ + * $Id: ac3_imdct.c,v 1.18 2001/05/06 04:32:02 sam Exp $ * * Authors: Michel Kaempf * Aaron Holtzman @@ -25,6 +25,8 @@ #include "defs.h" +#include /* memcpy() */ + #include #include diff --git a/src/ac3_decoder/ac3_imdct_c.c b/src/ac3_decoder/ac3_imdct_c.c index 11165cbad1..d9f730017f 100644 --- a/src/ac3_decoder/ac3_imdct_c.c +++ b/src/ac3_decoder/ac3_imdct_c.c @@ -2,7 +2,7 @@ * ac3_imdct_c.c: ac3 DCT ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_imdct_c.c,v 1.1 2001/04/30 21:04:20 reno Exp $ + * $Id: ac3_imdct_c.c,v 1.2 2001/05/06 04:32:02 sam Exp $ * * Authors: Renaud Dartus * Aaron Holtzman @@ -24,6 +24,8 @@ #include "defs.h" +#include /* memcpy() */ + #include #include @@ -38,6 +40,10 @@ #include "ac3_decoder.h" #include "ac3_internal.h" +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif + void fft_64p_c (complex_t *x); void fft_128p_c (complex_t *x); void imdct_do_512_c (imdct_t * p_imdct, float data[], float delay[]); diff --git a/src/ac3_decoder/ac3_mantissa.c b/src/ac3_decoder/ac3_mantissa.c index 7282456248..31148dbd64 100644 --- a/src/ac3_decoder/ac3_mantissa.c +++ b/src/ac3_decoder/ac3_mantissa.c @@ -2,7 +2,7 @@ * ac3_mantissa.c: ac3 mantissa computation ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: ac3_mantissa.c,v 1.25 2001/04/30 21:04:20 reno Exp $ + * $Id: ac3_mantissa.c,v 1.26 2001/05/06 04:32:02 sam Exp $ * * Authors: Michel Kaempf * Aaron Holtzman @@ -25,6 +25,8 @@ #include "defs.h" +#include /* memcpy() */ + #include "config.h" #include "common.h" #include "threads.h" diff --git a/src/ac3_decoder/ac3_parse.c b/src/ac3_decoder/ac3_parse.c index 13ca944e87..032d2deb88 100644 --- a/src/ac3_decoder/ac3_parse.c +++ b/src/ac3_decoder/ac3_parse.c @@ -2,7 +2,7 @@ * ac3_parse.c: ac3 parsing procedures ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: ac3_parse.c,v 1.19 2001/04/26 00:12:19 reno Exp $ + * $Id: ac3_parse.c,v 1.20 2001/05/06 04:32:02 sam Exp $ * * Authors: Michel Kaempf * Aaron Holtzman @@ -25,6 +25,8 @@ #include "defs.h" +#include /* memset() */ + #include "config.h" #include "common.h" diff --git a/src/ac3_decoder/ac3_rematrix.c b/src/ac3_decoder/ac3_rematrix.c index 452867c283..9fc4b90d97 100644 --- a/src/ac3_decoder/ac3_rematrix.c +++ b/src/ac3_decoder/ac3_rematrix.c @@ -2,7 +2,7 @@ * ac3_rematrix.c: ac3 audio rematrixing ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_rematrix.c,v 1.15 2001/04/30 21:04:20 reno Exp $ + * $Id: ac3_rematrix.c,v 1.16 2001/05/06 04:32:02 sam Exp $ * * Authors: Michel Kaempf * Aaron Holtzman @@ -23,6 +23,8 @@ *****************************************************************************/ #include "defs.h" +#include /* memcpy() */ + #include "config.h" #include "common.h" #include "threads.h" diff --git a/src/ac3_decoder/ac3_srfft.c b/src/ac3_decoder/ac3_srfft.c index 7eed98a3e5..c23b7a6046 100644 --- a/src/ac3_decoder/ac3_srfft.c +++ b/src/ac3_decoder/ac3_srfft.c @@ -2,7 +2,7 @@ * ac3_srfft.c: ac3 FFT ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_srfft.c,v 1.2 2001/04/30 21:10:25 reno Exp $ + * $Id: ac3_srfft.c,v 1.3 2001/05/06 04:32:02 sam Exp $ * * Authors: Renaud Dartus * Aaron Holtzman @@ -24,6 +24,8 @@ #include "defs.h" +#include /* memcpy() */ + #include #include diff --git a/src/ac3_spdif/ac3_iec958.c b/src/ac3_spdif/ac3_iec958.c index c9994492b7..adb54f27eb 100644 --- a/src/ac3_spdif/ac3_iec958.c +++ b/src/ac3_spdif/ac3_iec958.c @@ -2,7 +2,7 @@ * ac3_iec958.c: ac3 to spdif converter ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: ac3_iec958.c,v 1.2 2001/05/01 04:18:18 sam Exp $ + * $Id: ac3_iec958.c,v 1.3 2001/05/06 04:32:02 sam Exp $ * * Authors: Stéphane Borel * Juha Yrjola @@ -30,6 +30,7 @@ #include #include +#include /* memset() */ #include #include diff --git a/src/ac3_spdif/ac3_spdif.c b/src/ac3_spdif/ac3_spdif.c index 907564f19a..2666090085 100644 --- a/src/ac3_spdif/ac3_spdif.c +++ b/src/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.2 2001/05/01 04:18:18 sam Exp $ + * $Id: ac3_spdif.c,v 1.3 2001/05/06 04:32:02 sam Exp $ * * Authors: Stéphane Borel * Juha Yrjola @@ -21,15 +21,16 @@ * 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 "defs.h" #include #include +#include /* memcpy() */ #include #include diff --git a/src/audio_output/aout_ext-dec.c b/src/audio_output/aout_ext-dec.c index 337c6a5863..0be3fadc25 100644 --- a/src/audio_output/aout_ext-dec.c +++ b/src/audio_output/aout_ext-dec.c @@ -2,7 +2,7 @@ * aout_ext-dec.c : exported fifo management functions ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: aout_ext-dec.c,v 1.1 2001/05/01 04:18:18 sam Exp $ + * $Id: aout_ext-dec.c,v 1.2 2001/05/06 04:32:02 sam Exp $ * * Authors: Michel Kaempf * @@ -48,30 +48,44 @@ aout_fifo_t * aout_CreateFifo( int i_type, int i_channels, long l_rate, long l_units, long l_frame_size, void *p_buffer ) { -#define P_AOUT p_main->p_aout + aout_thread_t *p_aout; int i_fifo; /* Spawn an audio output if there is none */ - if( P_AOUT == NULL ) + vlc_mutex_lock( &p_aout_bank->lock ); + + if( p_aout_bank->i_count == 0 ) { - P_AOUT = aout_CreateThread( NULL ); + intf_Msg( "aout: no aout present, spawning one" ); + + p_aout = aout_CreateThread( NULL ); - if( P_AOUT == NULL ) + /* Everything failed */ + if( p_aout == NULL ) { + vlc_mutex_unlock( &p_aout_bank->lock ); return NULL; } + + p_aout_bank->pp_aout[ p_aout_bank->i_count ] = p_aout; + p_aout_bank->i_count++; + } + else + { + /* Take the first audio output FIXME: take the best one */ + p_aout = p_aout_bank->pp_aout[ 0 ]; } /* Take the fifos lock */ - vlc_mutex_lock( &P_AOUT->fifos_lock ); + vlc_mutex_lock( &p_aout->fifos_lock ); /* Looking for a free fifo structure */ for( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ ) { - if( P_AOUT->fifo[i_fifo].i_type == AOUT_EMPTY_FIFO ) + if( p_aout->fifo[i_fifo].i_type == AOUT_EMPTY_FIFO ) { /* Not very clever, but at least we know which fifo it is */ - P_AOUT->fifo[i_fifo].i_fifo = i_fifo; + p_aout->fifo[i_fifo].i_fifo = i_fifo; break; } } @@ -79,97 +93,101 @@ aout_fifo_t * aout_CreateFifo( int i_type, int i_channels, long l_rate, if( i_fifo == AOUT_MAX_FIFOS ) { intf_ErrMsg( "aout error: no fifo available" ); - vlc_mutex_unlock( &P_AOUT->fifos_lock ); + vlc_mutex_unlock( &p_aout->fifos_lock ); + vlc_mutex_unlock( &p_aout_bank->lock ); return( NULL ); } /* Initialize the new fifo structure */ - switch ( P_AOUT->fifo[i_fifo].i_type = i_type ) + switch ( p_aout->fifo[i_fifo].i_type = i_type ) { case AOUT_INTF_MONO_FIFO: case AOUT_INTF_STEREO_FIFO: - P_AOUT->fifo[i_fifo].b_die = 0; + p_aout->fifo[i_fifo].b_die = 0; - P_AOUT->fifo[i_fifo].i_channels = i_channels; - P_AOUT->fifo[i_fifo].b_stereo = ( i_channels == 2 ); - P_AOUT->fifo[i_fifo].l_rate = l_rate; + p_aout->fifo[i_fifo].i_channels = i_channels; + p_aout->fifo[i_fifo].b_stereo = ( i_channels == 2 ); + p_aout->fifo[i_fifo].l_rate = l_rate; - P_AOUT->fifo[i_fifo].buffer = p_buffer; + p_aout->fifo[i_fifo].buffer = p_buffer; - P_AOUT->fifo[i_fifo].l_unit = 0; - InitializeIncrement( &P_AOUT->fifo[i_fifo].unit_increment, - l_rate, P_AOUT->l_rate ); - P_AOUT->fifo[i_fifo].l_units = l_units; + p_aout->fifo[i_fifo].l_unit = 0; + InitializeIncrement( &p_aout->fifo[i_fifo].unit_increment, + l_rate, p_aout->l_rate ); + p_aout->fifo[i_fifo].l_units = l_units; break; case AOUT_ADEC_MONO_FIFO: case AOUT_ADEC_STEREO_FIFO: - P_AOUT->fifo[i_fifo].b_die = 0; + p_aout->fifo[i_fifo].b_die = 0; - P_AOUT->fifo[i_fifo].i_channels = i_channels; - P_AOUT->fifo[i_fifo].b_stereo = ( i_channels == 2 ); - P_AOUT->fifo[i_fifo].l_rate = l_rate; + p_aout->fifo[i_fifo].i_channels = i_channels; + p_aout->fifo[i_fifo].b_stereo = ( i_channels == 2 ); + p_aout->fifo[i_fifo].l_rate = l_rate; - P_AOUT->fifo[i_fifo].l_frame_size = l_frame_size; + p_aout->fifo[i_fifo].l_frame_size = l_frame_size; /* Allocate the memory needed to store the audio frames. As the * fifo is a rotative fifo, we must be able to find out whether * the fifo is full or empty, that's why we must in fact allocate * memory for (AOUT_FIFO_SIZE+1) audio frames. */ - P_AOUT->fifo[i_fifo].buffer = malloc( sizeof(s16) * + p_aout->fifo[i_fifo].buffer = malloc( sizeof(s16) * ( AOUT_FIFO_SIZE + 1 ) * l_frame_size ); - if ( P_AOUT->fifo[i_fifo].buffer == NULL ) + if ( p_aout->fifo[i_fifo].buffer == NULL ) { intf_ErrMsg( "aout error: cannot create frame buffer" ); - P_AOUT->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; - vlc_mutex_unlock( &P_AOUT->fifos_lock ); + p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; + vlc_mutex_unlock( &p_aout->fifos_lock ); + vlc_mutex_unlock( &p_aout_bank->lock ); return( NULL ); } /* Allocate the memory needed to store the dates of the frames */ - P_AOUT->fifo[i_fifo].date = + p_aout->fifo[i_fifo].date = malloc( sizeof(mtime_t) * ( AOUT_FIFO_SIZE + 1) ); - if ( P_AOUT->fifo[i_fifo].date == NULL ) + if ( p_aout->fifo[i_fifo].date == NULL ) { intf_ErrMsg( "aout error: cannot create date buffer"); - free( P_AOUT->fifo[i_fifo].buffer ); - P_AOUT->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; - vlc_mutex_unlock( &P_AOUT->fifos_lock ); + free( p_aout->fifo[i_fifo].buffer ); + p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; + vlc_mutex_unlock( &p_aout->fifos_lock ); + vlc_mutex_unlock( &p_aout_bank->lock ); return( NULL ); } /* Set the fifo's buffer as empty (the first frame that is to be * played is also the first frame that is not to be played) */ - P_AOUT->fifo[i_fifo].l_start_frame = 0; - /* P_AOUT->fifo[i_fifo].l_next_frame = 0; */ - P_AOUT->fifo[i_fifo].l_end_frame = 0; + p_aout->fifo[i_fifo].l_start_frame = 0; + /* p_aout->fifo[i_fifo].l_next_frame = 0; */ + p_aout->fifo[i_fifo].l_end_frame = 0; /* Waiting for the audio decoder to compute enough frames to work * out the fifo's current rate (as soon as the decoder has decoded * enough frames, the members of the fifo structure that are not * initialized now will be calculated) */ - P_AOUT->fifo[i_fifo].b_start_frame = 0; - P_AOUT->fifo[i_fifo].b_next_frame = 0; + p_aout->fifo[i_fifo].b_start_frame = 0; + p_aout->fifo[i_fifo].b_next_frame = 0; break; default: intf_ErrMsg( "aout error: unknown fifo type 0x%x", - P_AOUT->fifo[i_fifo].i_type ); - P_AOUT->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; - vlc_mutex_unlock( &P_AOUT->fifos_lock ); + p_aout->fifo[i_fifo].i_type ); + p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO; + vlc_mutex_unlock( &p_aout->fifos_lock ); + vlc_mutex_unlock( &p_aout_bank->lock ); return( NULL ); } /* Release the fifos lock */ - vlc_mutex_unlock( &P_AOUT->fifos_lock ); + vlc_mutex_unlock( &p_aout->fifos_lock ); + vlc_mutex_unlock( &p_aout_bank->lock ); intf_WarnMsg( 2, "aout info: fifo #%i allocated, %i channels, rate %li", - P_AOUT->fifo[i_fifo].i_fifo, P_AOUT->fifo[i_fifo].i_channels, - P_AOUT->fifo[i_fifo].l_rate ); + p_aout->fifo[i_fifo].i_fifo, p_aout->fifo[i_fifo].i_channels, + p_aout->fifo[i_fifo].l_rate ); /* Return the pointer to the fifo structure */ - return( &P_AOUT->fifo[i_fifo] ); -#undef P_AOUT + return( &p_aout->fifo[i_fifo] ); } /***************************************************************************** diff --git a/src/audio_output/aout_s16.c b/src/audio_output/aout_s16.c index a0a41a230d..ce093ebdf6 100644 --- a/src/audio_output/aout_s16.c +++ b/src/audio_output/aout_s16.c @@ -82,7 +82,7 @@ void aout_S16StereoThread( aout_thread_t * p_aout ) { ((s16 *)p_aout->buffer)[l_buffer] = (s16)( ( p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS ) - * p_aout->i_vol / 256 ) ; + * p_aout->i_volume / 256 ) ; p_aout->s32_buffer[l_buffer] = 0; } diff --git a/src/audio_output/aout_spdif.c b/src/audio_output/aout_spdif.c index 85348bb2c6..c370444c63 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.1 2001/04/29 02:55:36 stef Exp $ + * $Id: aout_spdif.c,v 1.2 2001/05/06 04:32:02 sam Exp $ * * Authors: Michel Kaempf * Stéphane Borel @@ -29,6 +29,7 @@ #include /* "intf_msg.h" */ #include /* calloc(), malloc(), free() */ +#include /* memset() */ #include "config.h" #include "common.h" diff --git a/src/audio_output/aout_u8.c b/src/audio_output/aout_u8.c index d23de0d2f2..7037471125 100644 --- a/src/audio_output/aout_u8.c +++ b/src/audio_output/aout_u8.c @@ -2,7 +2,7 @@ * aout_u8.c: 8 bit unsigned audio output functions ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: aout_u8.c,v 1.3 2001/05/01 04:18:18 sam Exp $ + * $Id: aout_u8.c,v 1.4 2001/05/06 04:32:02 sam Exp $ * * Authors: Michel Kaempf * @@ -77,7 +77,7 @@ void aout_U8MonoThread( aout_thread_t * p_aout ) for ( l_buffer = 0; l_buffer < l_buffer_limit; l_buffer++ ) { - ((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256 ) + 128 ) * p_aout->i_vol / 256 ); + ((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256 ) + 128 ) * p_aout->i_volume / 256 ); p_aout->s32_buffer[l_buffer] = 0; } @@ -131,7 +131,7 @@ void aout_U8StereoThread( aout_thread_t * p_aout ) for ( l_buffer = 0; l_buffer < l_buffer_limit; l_buffer++ ) { - ((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256) + 128 ) * p_aout->i_vol / 256 ); + ((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256) + 128 ) * p_aout->i_volume / 256 ); p_aout->s32_buffer[l_buffer] = 0; } l_bytes = p_aout->pf_getbufinfo( p_aout, l_buffer_limit ); diff --git a/src/audio_output/audio_output.c b/src/audio_output/audio_output.c index 6ad459b7d0..f7f47a7815 100644 --- a/src/audio_output/audio_output.c +++ b/src/audio_output/audio_output.c @@ -2,7 +2,7 @@ * audio_output.c : audio output thread ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: audio_output.c,v 1.59 2001/05/01 04:18:18 sam Exp $ + * $Id: audio_output.c,v 1.60 2001/05/06 04:32:02 sam Exp $ * * Authors: Michel Kaempf * @@ -64,6 +64,34 @@ *****************************************************************************/ static int aout_SpawnThread( aout_thread_t * p_aout ); +/***************************************************************************** + * aout_InitBank: initialize the audio output bank. + *****************************************************************************/ +void aout_InitBank ( void ) +{ + p_aout_bank->i_count = 0; + + vlc_mutex_init( &p_aout_bank->lock ); +} + +/***************************************************************************** + * aout_EndBank: empty the audio output bank. + ***************************************************************************** + * This function ends all unused audio outputs and empties the bank in + * case of success. + *****************************************************************************/ +void aout_EndBank ( void ) +{ + /* Ask all remaining audio outputs to die */ + while( p_aout_bank->i_count ) + { + aout_DestroyThread( + p_aout_bank->pp_aout[ --p_aout_bank->i_count ], NULL ); + } + + vlc_mutex_destroy( &p_aout_bank->lock ); +} + /***************************************************************************** * aout_CreateThread: initialize audio thread *****************************************************************************/ @@ -138,7 +166,8 @@ aout_thread_t *aout_CreateThread( int *pi_status ) } /* Initialize the volume level */ - p_aout->i_vol = VOLUME_DEFAULT; + p_aout->i_volume = VOLUME_DEFAULT; + p_aout->i_savedvolume = 0; /* FIXME: maybe it would be cleaner to change SpawnThread prototype * see vout to handle status correctly ?? however, it is not critical since @@ -311,7 +340,6 @@ static int aout_SpawnThread( aout_thread_t * p_aout ) *****************************************************************************/ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status ) { - int i_fifo; /* FIXME: pi_status is not handled correctly: check vout how to do!?? */ diff --git a/src/input/input_netlist.c b/src/input/input_netlist.c index b5aafe0519..930e121927 100644 --- a/src/input/input_netlist.c +++ b/src/input/input_netlist.c @@ -2,7 +2,7 @@ * input_netlist.c: netlist management ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: input_netlist.c,v 1.35 2001/04/28 23:19:19 henri Exp $ + * $Id: input_netlist.c,v 1.36 2001/05/06 04:32:02 sam Exp $ * * Authors: Henri Fallon * @@ -29,11 +29,18 @@ #include #include /* memcpy(), memset() */ #include -#ifndef WIN32 -#include /* struct iovec */ -#endif #include +#ifndef WIN32 +# include /* struct iovec */ +#else + struct iovec + { + void *iov_base; /* Pointer to data. */ + size_t iov_len; /* Length of data. */ + }; +#endif + #include "config.h" #include "common.h" #include "threads.h" /* mutex */ @@ -47,17 +54,6 @@ #include "input.h" #include "input_netlist.h" -#ifdef WIN32 -struct iovec - { - void *iov_base; /* Pointer to data. */ - size_t iov_len; /* Length of data. */ - }; -#endif -/***************************************************************************** - * Local prototypes - *****************************************************************************/ - /***************************************************************************** * input_NetlistInit: allocates netlist buffers and init indexes *****************************************************************************/ @@ -253,7 +249,7 @@ void input_NetlistMviovec( void * p_method_data, size_t i_nb_iovec, /* Fills a table of pointers to packets associated with the io_vec's */ -while (i_loop < i_nb_iovec ) + while (i_loop < i_nb_iovec ) { if( i_current >= p_netlist->i_nb_data ) i_current-=p_netlist->i_nb_data; @@ -304,7 +300,7 @@ struct data_packet_s * input_NetlistNewPacket( void * p_method_data, return ( NULL ); } - p_return = (p_netlist->pp_free_data[p_netlist->i_data_start]); + p_return = p_netlist->pp_free_data[p_netlist->i_data_start]; p_netlist->i_data_start++; p_netlist->i_data_start &= ( p_netlist->i_nb_data - 1 ); @@ -387,7 +383,7 @@ void input_NetlistDeletePacket( void * p_method_data, data_packet_t * p_data ) p_data->p_next = NULL; /* unlock */ - vlc_mutex_unlock (&p_netlist->lock); + vlc_mutex_unlock( &p_netlist->lock ); } /***************************************************************************** @@ -432,7 +428,7 @@ void input_NetlistDeletePES( void * p_method_data, pes_packet_t * p_pes ) p_netlist->pp_free_pes[p_netlist->i_pes_end] = p_pes; /* unlock */ - vlc_mutex_unlock (&p_netlist->lock); + vlc_mutex_unlock( &p_netlist->lock ); } @@ -450,12 +446,13 @@ void input_NetlistEnd( input_thread_t * p_input) vlc_mutex_destroy (&p_netlist->lock); /* free the FIFO, the buffer, and the netlist structure */ - free (p_netlist->pp_free_data); - free (p_netlist->pp_free_pes); - free (p_netlist->p_pes); - free (p_netlist->p_data); - free (p_netlist->p_buffers); + free( p_netlist->pp_free_data ); + free( p_netlist->pp_free_pes ); + free( p_netlist->p_pes ); + free( p_netlist->p_data ); + free( p_netlist->p_buffers ); /* free the netlist */ - free (p_netlist); + free( p_netlist ); } + diff --git a/src/interface/interface.c b/src/interface/interface.c index b627e8c2a3..f78e6f50fe 100644 --- a/src/interface/interface.c +++ b/src/interface/interface.c @@ -4,7 +4,7 @@ * interface, such as command line. ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: interface.c,v 1.75 2001/05/01 04:18:18 sam Exp $ + * $Id: interface.c,v 1.76 2001/05/06 04:32:02 sam Exp $ * * Authors: Vincent Seguin * @@ -317,7 +317,7 @@ void intf_AssignNormalKeys( intf_thread_t *p_intf) *****************************************************************************/ int intf_ProcessKey( intf_thread_t *p_intf, int g_key ) { - static int i_volbackup; + int i_index; keyparm k_reply; k_reply = intf_GetKey( p_intf, g_key); @@ -326,6 +326,7 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key ) case INTF_KEY_QUIT: /* quit order */ p_intf->b_die = 1; break; + case INTF_KEY_SET_CHANNEL: /* Change channel - return code is ignored since SelectChannel displays * its own error messages */ @@ -334,23 +335,62 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key ) /* FIXME : keyboard event is for the time being half handled by the interface * half handled directly by the plugins. We should decide what to do. */ break; + case INTF_KEY_INC_VOLUME: /* volume + */ - if( (p_main->p_aout != NULL) && (p_main->p_aout->i_vol < VOLUME_MAX) ) - p_main->p_aout->i_vol += VOLUME_STEP; + vlc_mutex_lock( &p_aout_bank->lock ); + for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ ) + { + if( p_aout_bank->pp_aout[i_index]->i_volume + < VOLUME_MAX - VOLUME_STEP ) + { + p_aout_bank->pp_aout[i_index]->i_volume += VOLUME_STEP; + } + else + { + p_aout_bank->pp_aout[i_index]->i_volume = VOLUME_MAX; + } + } + vlc_mutex_unlock( &p_aout_bank->lock ); break; + case INTF_KEY_DEC_VOLUME: /* volume - */ - if( (p_main->p_aout != NULL) && (p_main->p_aout->i_vol > VOLUME_STEP) ) - p_main->p_aout->i_vol -= VOLUME_STEP; + vlc_mutex_lock( &p_aout_bank->lock ); + for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ ) + { + if( p_aout_bank->pp_aout[i_index]->i_volume > VOLUME_STEP ) + { + p_aout_bank->pp_aout[i_index]->i_volume -= VOLUME_STEP; + } + else + { + p_aout_bank->pp_aout[i_index]->i_volume = 0; + } + } + vlc_mutex_unlock( &p_aout_bank->lock ); break; + case INTF_KEY_TOGGLE_VOLUME: /* toggle mute */ - if( (p_main->p_aout != NULL) && (p_main->p_aout->i_vol)) + vlc_mutex_lock( &p_aout_bank->lock ); + for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ ) { - i_volbackup = p_main->p_aout->i_vol; - p_main->p_aout->i_vol = 0; + if( p_aout_bank->pp_aout[i_index]->i_savedvolume ) + { + p_aout_bank->pp_aout[i_index]->i_volume = + p_aout_bank->pp_aout[i_index]->i_savedvolume; + p_aout_bank->pp_aout[i_index]->i_savedvolume = 0; + } + else + { + p_aout_bank->pp_aout[i_index]->i_savedvolume = + p_aout_bank->pp_aout[i_index]->i_volume; + p_aout_bank->pp_aout[i_index]->i_volume = 0; + } } - else if( (p_main->p_aout != NULL) && (!p_main->p_aout->i_vol)) - p_main->p_aout->i_vol = i_volbackup; + vlc_mutex_unlock( &p_aout_bank->lock ); break; + +/* XXX: fix this later */ +#if 0 case INTF_KEY_DEC_GAMMA: /* gamma - */ if( (p_main->p_vout != NULL) && (p_main->p_vout->f_gamma > -INTF_GAMMA_LIMIT) ) { @@ -367,6 +407,8 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key ) p_main->p_vout->i_changes |= VOUT_GAMMA_CHANGE; } break; +#endif + case INTF_KEY_DUMP_STREAM: if( p_intf->p_input != NULL ) { @@ -375,9 +417,11 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key ) vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock ); } break; - default: /* unknown key */ + + default: /* unknown key */ return( 1 ); } return( 0 ); } + diff --git a/src/interface/main.c b/src/interface/main.c index bfdc998c99..31fb705cc7 100644 --- a/src/interface/main.c +++ b/src/interface/main.c @@ -4,7 +4,7 @@ * and spawn threads. ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: main.c,v 1.91 2001/05/01 04:18:18 sam Exp $ + * $Id: main.c,v 1.92 2001/05/06 04:32:02 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -185,8 +185,10 @@ static const char *psz_shortopts = "hHvgt:T:u:a:s:c:I:A:V:"; * Global variable program_data - these are the only ones, see main.h and * modules.h *****************************************************************************/ -main_t *p_main; -bank_t *p_bank; +main_t *p_main; +module_bank_t *p_module_bank; +aout_bank_t *p_aout_bank; +vout_bank_t *p_vout_bank; /***************************************************************************** * Local prototypes @@ -215,30 +217,21 @@ static int CPUCapabilities ( void ); *****************************************************************************/ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) { - main_t main_data; /* root of all data - see main.h */ - bank_t module_bank; + main_t main_data; /* root of all data - see main.h */ + module_bank_t module_bank; + aout_bank_t aout_bank; + vout_bank_t vout_bank; - p_main = &main_data; /* set up the global variables */ - p_bank = &module_bank; + p_main = &main_data; /* set up the global variables */ + p_module_bank = &module_bank; + p_aout_bank = &aout_bank; + p_vout_bank = &vout_bank; /* - * Initialize the main structure + * Test if our code is likely to run on this CPU */ p_main->i_cpu_capabilities = CPUCapabilities(); - p_main->p_aout = NULL; - p_main->p_vout = NULL; - - /* - * System specific initialization code - */ -#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 ) - system_Create( &i_argc, ppsz_argv, ppsz_env ); -#endif - - /* - * Test if our code is likely to run on this CPU - */ #if defined( __pentium__ ) || defined( __pentiumpro__ ) if( ! TestCPU( CPU_CAPABILITY_586 ) ) { @@ -248,13 +241,11 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) } #endif -#ifdef HAVE_MMX - if( ! TestCPU( CPU_CAPABILITY_MMX ) ) - { - fprintf( stderr, "error: this program needs MMX extensions,\n" - "please try a version without MMX support\n" ); - return( 1 ); - } + /* + * System specific initialization code + */ +#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 ) + system_Init( &i_argc, ppsz_argv, ppsz_env ); #endif /* @@ -297,9 +288,11 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) GetFilenames( i_argc, ppsz_argv ); /* - * Initialize module bank + * Initialize module, aout and vout banks */ module_InitBank(); + aout_InitBank(); + vout_InitBank(); /* * Initialize shared resources and libraries @@ -313,60 +306,44 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) } /* - * Run interface + * Try to run the interface */ p_main->p_intf = intf_Create(); - if( !p_main->p_intf ) + if( p_main->p_intf == NULL ) { intf_ErrMsg( "intf error: interface initialization failed" ); - module_EndBank(); - intf_PlaylistDestroy( p_main->p_playlist ); - intf_MsgDestroy(); - return( errno ); - } - - /* - * Set signal handling policy for all threads - */ - InitSignalHandler(); - - /* - * This is the main loop - */ - p_main->p_intf->pf_run( p_main->p_intf ); - - /* - * Finished, destroy the interface - */ - intf_Destroy( p_main->p_intf ); - - /* - * Close all video devices - */ - if( p_main->p_vout != NULL ) - { - vout_DestroyThread( p_main->p_vout, NULL ); } - - /* - * Close all audio devices - */ - if( p_main->p_aout != NULL ) - { - aout_DestroyThread( p_main->p_aout, NULL ); - } - - /* - * Go back into channel 0 which is the network - */ - if( p_main->b_channels ) + else { - network_ChannelJoin( COMMON_CHANNEL ); + /* + * Set signal handling policy for all threads + */ + InitSignalHandler(); + + /* + * This is the main loop + */ + p_main->p_intf->pf_run( p_main->p_intf ); + + /* + * Finished, destroy the interface + */ + intf_Destroy( p_main->p_intf ); + + /* + * Go back into channel 0 which is the network + */ + if( p_main->b_channels ) + { + network_ChannelJoin( COMMON_CHANNEL ); + } } /* - * Free module bank + * Free module, aout and vout banks */ + vout_EndBank(); + aout_EndBank(); module_EndBank(); /* @@ -378,7 +355,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) * System specific cleaning code */ #if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 ) - system_Destroy(); + system_End(); #endif /* @@ -387,7 +364,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) intf_Msg( "intf: program terminated" ); intf_MsgDestroy(); - return( 0 ); + return 0; } /***************************************************************************** diff --git a/src/misc/beos_specific.cpp b/src/misc/beos_specific.cpp index dfcdb1c3b9..1ccb25cc3e 100644 --- a/src/misc/beos_specific.cpp +++ b/src/misc/beos_specific.cpp @@ -2,7 +2,7 @@ * beos_init.cpp: Initialization for BeOS specific features ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: beos_specific.cpp,v 1.10 2001/04/29 17:03:20 sam Exp $ + * $Id: beos_specific.cpp,v 1.11 2001/05/06 04:32:02 sam Exp $ * * Authors: Jean-Marc Dressler * @@ -69,9 +69,9 @@ extern "C" static void system_AppThread( void * args ); /***************************************************************************** - * system_Create: create a BApplication object and fill in program path. + * system_Init: create a BApplication object and fill in program path. *****************************************************************************/ -void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) +void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) { /* Prepare the lock/wait before launching the BApplication thread */ vlc_mutex_init( &app_lock ); @@ -92,9 +92,9 @@ void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) } /***************************************************************************** - * system_Destroy: destroy the BApplication object. + * system_End: destroy the BApplication object. *****************************************************************************/ -void system_Destroy( void ) +void system_End( void ) { free( psz_program_path ); diff --git a/src/misc/darwin_specific.c b/src/misc/darwin_specific.c index 74b44f22b9..1bd802d34a 100644 --- a/src/misc/darwin_specific.c +++ b/src/misc/darwin_specific.c @@ -2,7 +2,7 @@ * darwin_specific.c: Darwin specific features ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: darwin_specific.c,v 1.3 2001/04/14 07:41:20 sam Exp $ + * $Id: darwin_specific.c,v 1.4 2001/05/06 04:32:02 sam Exp $ * * Authors: Samuel Hocevar * @@ -37,9 +37,9 @@ static char * psz_program_path; /***************************************************************************** - * system_Create: fill in program path. + * system_Init: fill in program path. *****************************************************************************/ -void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) +void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) { char i_dummy; char *p_char, *p_oldchar = &i_dummy; @@ -64,9 +64,9 @@ void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) } /***************************************************************************** - * system_Destroy: free the program path. + * system_End: free the program path. *****************************************************************************/ -void system_Destroy( void ) +void system_End( void ) { free( psz_program_path ); } diff --git a/src/misc/modules.c b/src/misc/modules.c index 7ae18bc477..6ef1ebc1ad 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.28 2001/05/01 04:18:18 sam Exp $ + * $Id: modules.c,v 1.29 2001/05/06 04:32:02 sam Exp $ * * Authors: Samuel Hocevar * Ethan C. Baldridge @@ -85,7 +85,7 @@ static int CallSymbol ( module_t *, char * ); * This function creates a module bank structure and fills it with the * built-in modules, as well as all the plugin modules it can find. *****************************************************************************/ -void module_InitBank( ) +void module_InitBank( void ) { #ifdef HAVE_DYNAMIC_PLUGINS static char * path[] = { ".", "lib", PLUGIN_PATH, NULL, NULL }; @@ -102,13 +102,19 @@ void module_InitBank( ) struct dirent * file; #endif /* HAVE_DYNAMIC_PLUGINS */ - p_bank->first = NULL; - vlc_mutex_init( &p_bank->lock ); + p_module_bank->first = NULL; + vlc_mutex_init( &p_module_bank->lock ); + /* + * Check all the built-in modules + */ intf_WarnMsg( 2, "module: checking built-in modules" ); ALLOCATE_ALL_BUILTINS(); + /* + * Check all the plugin modules we can find + */ #ifdef HAVE_DYNAMIC_PLUGINS intf_WarnMsg( 2, "module: checking plugin modules" ); @@ -187,32 +193,32 @@ void module_InitBank( ) } /***************************************************************************** - * module_EndBank: destroy the module bank. + * module_EndBank: empty the module bank. ***************************************************************************** - * This function unloads all unused plugin modules and removes the module + * This function unloads all unused plugin modules and empties the module * bank in case of success. *****************************************************************************/ -void module_EndBank( ) +void module_EndBank( void ) { module_t * p_next; - while( p_bank->first != NULL ) + while( p_module_bank->first != NULL ) { - if( DeleteModule( p_bank->first ) ) + if( DeleteModule( p_module_bank->first ) ) { /* Module deletion failed */ intf_ErrMsg( "module error: `%s' can't be removed. trying harder.", - p_bank->first->psz_name ); + p_module_bank->first->psz_name ); /* We just free the module by hand. Niahahahahaha. */ - p_next = p_bank->first->next; - free(p_bank->first); - p_bank->first = p_next; + p_next = p_module_bank->first->next; + free(p_module_bank->first); + p_module_bank->first = p_next; } } /* Destroy the lock */ - vlc_mutex_destroy( &p_bank->lock ); + vlc_mutex_destroy( &p_module_bank->lock ); return; } @@ -223,7 +229,7 @@ void module_EndBank( ) * This function resets the module bank by unloading all unused plugin * modules. *****************************************************************************/ -void module_ResetBank( ) +void module_ResetBank( void ) { intf_ErrMsg( "FIXME: module_ResetBank unimplemented" ); return; @@ -235,16 +241,16 @@ void module_ResetBank( ) * This function parses the module bank and hides modules that have been * unused for a while. *****************************************************************************/ -void module_ManageBank( ) +void module_ManageBank( void ) { #ifdef HAVE_DYNAMIC_PLUGINS module_t * p_module; /* We take the global lock */ - vlc_mutex_lock( &p_bank->lock ); + vlc_mutex_lock( &p_module_bank->lock ); /* Parse the module list to see if any modules need to be unloaded */ - for( p_module = p_bank->first ; + for( p_module = p_module_bank->first ; p_module != NULL ; p_module = p_module->next ) { @@ -268,7 +274,7 @@ void module_ManageBank( ) } /* We release the global lock */ - vlc_mutex_unlock( &p_bank->lock ); + vlc_mutex_unlock( &p_module_bank->lock ); #endif /* HAVE_DYNAMIC_PLUGINS */ return; @@ -287,10 +293,10 @@ module_t * module_Need( int i_capabilities, void *p_data ) int i_index; /* We take the global lock */ - vlc_mutex_lock( &p_bank->lock ); + vlc_mutex_lock( &p_module_bank->lock ); /* Parse the module list for capabilities and probe each of them */ - for( p_module = p_bank->first ; + for( p_module = p_module_bank->first ; p_module != NULL ; p_module = p_module->next ) { @@ -342,7 +348,7 @@ module_t * module_Need( int i_capabilities, void *p_data ) } /* We can release the global lock, module refcount was incremented */ - vlc_mutex_unlock( &p_bank->lock ); + vlc_mutex_unlock( &p_module_bank->lock ); if( p_bestmodule != NULL ) { @@ -363,7 +369,7 @@ module_t * module_Need( int i_capabilities, void *p_data ) void module_Unneed( module_t * p_module ) { /* We take the global lock */ - vlc_mutex_lock( &p_bank->lock ); + vlc_mutex_lock( &p_module_bank->lock ); /* Just unlock the module - we can't do anything if it fails, * so there is no need to check the return value. */ @@ -372,7 +378,7 @@ void module_Unneed( module_t * p_module ) intf_WarnMsg( 3, "module: unlocking module `%s'", p_module->psz_name ); /* We release the global lock */ - vlc_mutex_unlock( &p_bank->lock ); + vlc_mutex_unlock( &p_module_bank->lock ); return; } @@ -435,7 +441,7 @@ static int AllocatePluginModule( char * psz_filename ) } /* Check that we don't already have a module with this name */ - for( p_othermodule = p_bank->first ; + for( p_othermodule = p_module_bank->first ; p_othermodule != NULL ; p_othermodule = p_othermodule->next ) { @@ -485,13 +491,13 @@ static int AllocatePluginModule( char * psz_filename ) p_module->b_builtin = 0; /* Link module into the linked list */ - if( p_bank->first != NULL ) + if( p_module_bank->first != NULL ) { - p_bank->first->prev = p_module; + p_module_bank->first->prev = p_module; } - p_module->next = p_bank->first; + p_module->next = p_module_bank->first; p_module->prev = NULL; - p_bank->first = p_module; + p_module_bank->first = p_module; /* Immediate message so that a slow module doesn't make the user wait */ intf_WarnMsgImm( 2, "module: plugin module `%s', %s", @@ -541,7 +547,7 @@ static int AllocateBuiltinModule( int ( *pf_init ) ( module_t * ), } /* Check that we don't already have a module with this name */ - for( p_othermodule = p_bank->first ; + for( p_othermodule = p_module_bank->first ; p_othermodule != NULL ; p_othermodule = p_othermodule->next ) { @@ -587,13 +593,13 @@ static int AllocateBuiltinModule( int ( *pf_init ) ( module_t * ), p_module->is.builtin.pf_deactivate = pf_deactivate; /* Link module into the linked list */ - if( p_bank->first != NULL ) + if( p_module_bank->first != NULL ) { - p_bank->first->prev = p_module; + p_module_bank->first->prev = p_module; } - p_module->next = p_bank->first; + p_module->next = p_module_bank->first; p_module->prev = NULL; - p_bank->first = p_module; + p_module_bank->first = p_module; /* Immediate message so that a slow module doesn't make the user wait */ intf_WarnMsgImm( 2, "module: builtin module `%s', %s", @@ -650,9 +656,9 @@ static int DeleteModule( module_t * p_module ) #endif /* Unlink the module from the linked list. */ - if( p_module == p_bank->first ) + if( p_module == p_module_bank->first ) { - p_bank->first = p_module->next; + p_module_bank->first = p_module->next; } if( p_module->prev != NULL ) diff --git a/src/spu_decoder/spu_decoder.c b/src/spu_decoder/spu_decoder.c index 0079117009..95dbb00b40 100644 --- a/src/spu_decoder/spu_decoder.c +++ b/src/spu_decoder/spu_decoder.c @@ -2,7 +2,7 @@ * spu_decoder.c : spu decoder thread ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: spu_decoder.c,v 1.39 2001/05/01 12:22:18 sam Exp $ + * $Id: spu_decoder.c,v 1.40 2001/05/06 04:32:02 sam Exp $ * * Authors: Samuel Hocevar * @@ -89,24 +89,44 @@ vlc_thread_t spudec_CreateThread( vdec_config_t * p_config ) p_spudec->p_fifo = p_config->decoder_config.p_decoder_fifo; /* XXX: The vout request and fifo opening will eventually be here */ - if( p_spudec->p_vout == NULL ) + + /* Spawn an audio output if there is none */ + vlc_mutex_lock( &p_vout_bank->lock ); + + if( p_vout_bank->i_count == 0 ) { - if( p_main->p_vout == NULL ) + intf_Msg( "spudec: no vout present, spawning one" ); + + p_spudec->p_vout = vout_CreateThread( NULL ); + + /* Everything failed */ + if( p_spudec->p_vout == NULL ) { - intf_Msg( "vpar: no vout present, spawning one" ); - p_main->p_vout = vout_CreateThread( NULL ); + intf_Msg( "spudec: can't open vout, aborting" ); + vlc_mutex_unlock( &p_vout_bank->lock ); + free( p_spudec ); + + return 0; } - p_spudec->p_vout = p_main->p_vout; + p_vout_bank->pp_vout[ p_vout_bank->i_count ] = p_spudec->p_vout; + p_vout_bank->i_count++; + } + else + { + /* Take the first video output FIXME: take the best one */ + p_spudec->p_vout = p_vout_bank->pp_vout[ 0 ]; } + vlc_mutex_unlock( &p_vout_bank->lock ); + /* Spawn the spu decoder thread */ if ( vlc_thread_create(&p_spudec->thread_id, "spu decoder", (vlc_thread_func_t)RunThread, (void *)p_spudec) ) { intf_ErrMsg( "spudec error: can't spawn spu decoder thread" ); free( p_spudec ); - return( 0 ); + return 0; } return( p_spudec->thread_id ); diff --git a/src/video_decoder/vdec_idct.h b/src/video_decoder/vdec_idct.h deleted file mode 100644 index 7127b6dd7e..0000000000 --- a/src/video_decoder/vdec_idct.h +++ /dev/null @@ -1,29 +0,0 @@ -/***************************************************************************** - * vdec_idct.h : types for the inverse discrete cosine transform - ***************************************************************************** - * Copyright (C) 1999, 2000 VideoLAN - * $Id: vdec_idct.h,v 1.4 2001/01/17 18:17:30 massiot Exp $ - * - * Authors: Gaël Hendryckx - * Christophe Massiot - * - * 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. - *****************************************************************************/ - -struct vdec_thread_s; - -typedef void ( *idct_init_t ) ( struct vdec_thread_s * ); -typedef void ( *f_idct_t ) ( struct vdec_thread_s *, dctelem_t*, int ); -typedef void ( *norm_scan_t ) ( u8 ppi_scan[2][64] ); diff --git a/src/video_decoder/video_decoder.c b/src/video_decoder/video_decoder.c index 34df5a820e..22e418cf4b 100644 --- a/src/video_decoder/video_decoder.c +++ b/src/video_decoder/video_decoder.c @@ -2,7 +2,7 @@ * video_decoder.c : video decoder thread ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_decoder.c,v 1.48 2001/04/06 09:15:48 sam Exp $ + * $Id: video_decoder.c,v 1.49 2001/05/06 04:32:02 sam Exp $ * * Authors: Christophe Massiot * Gaël Hendryckx @@ -47,7 +47,6 @@ #include "video_output.h" #include "vdec_motion.h" -#include "vdec_idct.h" #include "video_decoder.h" #include "vpar_blocks.h" @@ -152,28 +151,13 @@ static int vdec_InitThread( vdec_thread_t *p_vdec ) int vdec_InitThread( vdec_thread_t *p_vdec ) #endif { -#ifndef HAVE_MMX - int i_dummy; -#endif - intf_DbgMsg("vdec debug: initializing video decoder thread %p", p_vdec); -#ifndef HAVE_MMX - /* Init crop table */ - p_vdec->pi_crop = p_vdec->pi_crop_buf + (VDEC_CROPRANGE >> 1); - for( i_dummy = -(VDEC_CROPRANGE >> 1); i_dummy < 0; i_dummy++ ) - { - p_vdec->pi_crop[i_dummy] = 0; - } - for( ; i_dummy < 255; i_dummy ++ ) - { - p_vdec->pi_crop[i_dummy] = i_dummy; - } - for( ; i_dummy < (VDEC_CROPRANGE >> 1) -1; i_dummy++ ) - { - p_vdec->pi_crop[i_dummy] = 255; - } -#endif + p_vdec->pf_vdec_init = p_vdec->p_vpar->pf_vdec_init; + p_vdec->pf_decode_mb_c = p_vdec->p_vpar->pf_decode_mb_c; + p_vdec->pf_decode_mb_bw = p_vdec->p_vpar->pf_decode_mb_bw; + + p_vdec->pf_vdec_init( p_vdec ); #ifdef VDEC_SMP /* Re-nice ourself */ @@ -219,327 +203,6 @@ static void EndThread( vdec_thread_t *p_vdec ) intf_DbgMsg("vdec debug: EndThread(%p)", p_vdec); } -/***************************************************************************** - * AddBlock : add a block - *****************************************************************************/ -#ifndef HAVE_MMX -static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, - yuv_data_t * p_data, int i_incr ) -{ - int i_x, i_y; - - for( i_y = 0; i_y < 8; i_y++ ) - { - for( i_x = 0; i_x < 8; i_x++ ) - { - *p_data = p_vdec->pi_crop[*p_data + *p_block++]; - p_data++; - } - p_data += i_incr; - } -} -#else -static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, - yuv_data_t * p_data, int i_incr ) -{ - asm __volatile__ ( - "pxor %%mm7,%%mm7\n\t" - - "movq (%0),%%mm1\n\t" - "movq %%mm1,%%mm2\n\t" - "punpckhbw %%mm7,%%mm1\n\t" - "punpcklbw %%mm7,%%mm2\n\t" - "paddw (%2),%%mm2\n\t" - "paddw 8(%2),%%mm1\n\t" - "packuswb %%mm1,%%mm2\n\t" - "movq %%mm2,(%0)\n\t" - "addl %3,%0\n\t" - - "movq (%0),%%mm1\n\t" - "movq %%mm1,%%mm2\n\t" - "punpckhbw %%mm7,%%mm1\n\t" - "punpcklbw %%mm7,%%mm2\n\t" - "paddw 16(%2),%%mm2\n\t" - "paddw 24(%2),%%mm1\n\t" - "packuswb %%mm1,%%mm2\n\t" - "movq %%mm2,(%0)\n\t" - "addl %3,%0\n\t" - - "movq (%0),%%mm1\n\t" - "movq %%mm1,%%mm2\n\t" - "punpckhbw %%mm7,%%mm1\n\t" - "punpcklbw %%mm7,%%mm2\n\t" - "paddw 32(%2),%%mm2\n\t" - "paddw 40(%2),%%mm1\n\t" - "packuswb %%mm1,%%mm2\n\t" - "movq %%mm2,(%0)\n\t" - "addl %3,%0\n\t" - - "movq (%0),%%mm1\n\t" - "movq %%mm1,%%mm2\n\t" - "punpckhbw %%mm7,%%mm1\n\t" - "punpcklbw %%mm7,%%mm2\n\t" - "paddw 48(%2),%%mm2\n\t" - "paddw 56(%2),%%mm1\n\t" - "packuswb %%mm1,%%mm2\n\t" - "movq %%mm2,(%0)\n\t" - "addl %3,%0\n\t" - - "movq (%0),%%mm1\n\t" - "movq %%mm1,%%mm2\n\t" - "punpckhbw %%mm7,%%mm1\n\t" - "punpcklbw %%mm7,%%mm2\n\t" - "paddw 64(%2),%%mm2\n\t" - "paddw 72(%2),%%mm1\n\t" - "packuswb %%mm1,%%mm2\n\t" - "movq %%mm2,(%0)\n\t" - "addl %3,%0\n\t" - - "movq (%0),%%mm1\n\t" - "movq %%mm1,%%mm2\n\t" - "punpckhbw %%mm7,%%mm1\n\t" - "punpcklbw %%mm7,%%mm2\n\t" - "paddw 80(%2),%%mm2\n\t" - "paddw 88(%2),%%mm1\n\t" - "packuswb %%mm1,%%mm2\n\t" - "movq %%mm2,(%0)\n\t" - "addl %3,%0\n\t" - - "movq (%0),%%mm1\n\t" - "movq %%mm1,%%mm2\n\t" - "punpckhbw %%mm7,%%mm1\n\t" - "punpcklbw %%mm7,%%mm2\n\t" - "paddw 96(%2),%%mm2\n\t" - "paddw 104(%2),%%mm1\n\t" - "packuswb %%mm1,%%mm2\n\t" - "movq %%mm2,(%0)\n\t" - "addl %3,%0\n\t" - - "movq (%0),%%mm1\n\t" - "movq %%mm1,%%mm2\n\t" - "punpckhbw %%mm7,%%mm1\n\t" - "punpcklbw %%mm7,%%mm2\n\t" - "paddw 112(%2),%%mm2\n\t" - "paddw 120(%2),%%mm1\n\t" - "packuswb %%mm1,%%mm2\n\t" - "movq %%mm2,(%0)\n\t" - - //"emms" - : "=r" (p_data) - : "0" (p_data), "r" (p_block), "r" (i_incr + 8) ); -} -#endif - - -/***************************************************************************** - * CopyBlock : copy a block - *****************************************************************************/ -#ifndef HAVE_MMX -static __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, - yuv_data_t * p_data, int i_incr ) -{ - int i_x, i_y; - - for( i_y = 0; i_y < 8; i_y++ ) - { - for( i_x = 0; i_x < 8; i_x++ ) - { - *p_data++ = p_vdec->pi_crop[*p_block++]; - } - p_data += i_incr; - } -} -#else -static __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, - yuv_data_t * p_data, int i_incr ) -{ - asm __volatile__ ( - "movq (%2),%%mm0\n\t" - "packuswb 8(%2),%%mm0\n\t" - "movq %%mm0,(%0)\n\t" - "addl %3,%0\n\t" - - "movq 16(%2),%%mm0\n\t" - "packuswb 24(%2),%%mm0\n\t" - "movq %%mm0,(%0)\n\t" - "addl %3,%0\n\t" - - "movq 32(%2),%%mm0\n\t" - "packuswb 40(%2),%%mm0\n\t" - "movq %%mm0,(%0)\n\t" - "addl %3,%0\n\t" - - "movq 48(%2),%%mm0\n\t" - "packuswb 56(%2),%%mm0\n\t" - "movq %%mm0,(%0)\n\t" - "addl %3,%0\n\t" - - "movq 64(%2),%%mm0\n\t" - "packuswb 72(%2),%%mm0\n\t" - "movq %%mm0,(%0)\n\t" - "addl %3,%0\n\t" - - "movq 80(%2),%%mm0\n\t" - "packuswb 88(%2),%%mm0\n\t" - "movq %%mm0,(%0)\n\t" - "addl %3,%0\n\t" - - "movq 96(%2),%%mm0\n\t" - "packuswb 104(%2),%%mm0\n\t" - "movq %%mm0,(%0)\n\t" - "addl %3,%0\n\t" - - "movq 112(%2),%%mm0\n\t" - "packuswb 120(%2),%%mm0\n\t" - "movq %%mm0,(%0)\n\t" - - //"emms" - : "=r" (p_data) - : "0" (p_data), "r" (p_block), "r" (i_incr + 8) ); -} -#endif - - -/***************************************************************************** - * vdec_DecodeMacroblock : decode a macroblock of a picture - *****************************************************************************/ -#define DECODEBLOCKSC( OPBLOCK ) \ -{ \ - int i_b, i_mask; \ - \ - i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks); \ - \ - /* luminance */ \ - for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 ) \ - { \ - if( p_mb->i_coded_block_pattern & i_mask ) \ - { \ - /* \ - * Inverse DCT (ISO/IEC 13818-2 section Annex A) \ - */ \ - (p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b], \ - p_mb->pi_sparse_pos[i_b] ); \ - \ - /* \ - * Adding prediction and coefficient data (ISO/IEC 13818-2 \ - * section 7.6.8) \ - */ \ - OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b], \ - p_mb->p_data[i_b], p_mb->i_addb_l_stride ); \ - } \ - } \ - \ - /* chrominance */ \ - for( i_b = 4; i_b < 4 + p_mb->i_chroma_nb_blocks; \ - i_b++, i_mask >>= 1 ) \ - { \ - if( p_mb->i_coded_block_pattern & i_mask ) \ - { \ - /* \ - * Inverse DCT (ISO/IEC 13818-2 section Annex A) \ - */ \ - (p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b], \ - p_mb->pi_sparse_pos[i_b] ); \ - \ - /* \ - * Adding prediction and coefficient data (ISO/IEC 13818-2 \ - * section 7.6.8) \ - */ \ - OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b], \ - p_mb->p_data[i_b], p_mb->i_addb_c_stride ); \ - } \ - } \ -} - -#define DECODEBLOCKSBW( OPBLOCK ) \ -{ \ - int i_b, i_mask; \ - \ - i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks); \ - \ - /* luminance */ \ - for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 ) \ - { \ - if( p_mb->i_coded_block_pattern & i_mask ) \ - { \ - /* \ - * Inverse DCT (ISO/IEC 13818-2 section Annex A) \ - */ \ - (p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b], \ - p_mb->pi_sparse_pos[i_b] ); \ - \ - /* \ - * Adding prediction and coefficient data (ISO/IEC 13818-2 \ - * section 7.6.8) \ - */ \ - OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b], \ - p_mb->p_data[i_b], p_mb->i_addb_l_stride ); \ - } \ - } \ -} - -void vdec_DecodeMacroblockC ( vdec_thread_t *p_vdec, macroblock_t * p_mb ) -{ - if( !(p_mb->i_mb_type & MB_INTRA) ) - { - /* - * Motion Compensation (ISO/IEC 13818-2 section 7.6) - */ - if( p_mb->pf_motion == 0 ) - { - intf_WarnMsg( 2, "pf_motion set to NULL" ); - } - else - { - p_mb->pf_motion( p_mb ); - } - - DECODEBLOCKSC( AddBlock ) - } - else - { - DECODEBLOCKSC( CopyBlock ) - } - - /* - * Decoding is finished, release the macroblock and free - * unneeded memory. - */ - vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb ); -} - -void vdec_DecodeMacroblockBW ( vdec_thread_t *p_vdec, macroblock_t * p_mb ) -{ - if( !(p_mb->i_mb_type & MB_INTRA) ) - { - /* - * Motion Compensation (ISO/IEC 13818-2 section 7.6) - */ - if( p_mb->pf_motion == 0 ) - { - intf_WarnMsg( 2, "pf_motion set to NULL" ); - } - else - { - p_mb->pf_motion( p_mb ); - } - - DECODEBLOCKSBW( AddBlock ) - } - else - { - DECODEBLOCKSBW( CopyBlock ) - } - - /* - * Decoding is finished, release the macroblock and free - * unneeded memory. - */ - vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb ); -} - - - /***************************************************************************** * RunThread: video decoder thread ***************************************************************************** @@ -571,7 +234,7 @@ static void RunThread( vdec_thread_t *p_vdec ) if( (p_mb = vpar_GetMacroblock( &p_vdec->p_vpar->vfifo )) != NULL ) { - vdec_DecodeMacroblockC ( p_vdec, p_mb ); + p_vdec->pf_decode_mb_c( p_vdec, p_mb ); } } @@ -587,3 +250,4 @@ static void RunThread( vdec_thread_t *p_vdec ) EndThread( p_vdec ); p_vdec->b_run = 0; } + diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index fcae25b414..9e2f42d7e0 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 VideoLAN - * $Id: video_output.c,v 1.122 2001/05/01 04:18:18 sam Exp $ + * $Id: video_output.c,v 1.123 2001/05/06 04:32:02 sam Exp $ * * Authors: Vincent Seguin * @@ -85,6 +85,34 @@ static int Align ( vout_thread_t *p_vout, int *pi_x, static void SetPalette ( p_vout_thread_t p_vout, u16 *red, u16 *green, u16 *blue, u16 *transp ); +/***************************************************************************** + * vout_InitBank: initialize the video output bank. + *****************************************************************************/ +void vout_InitBank ( void ) +{ + p_vout_bank->i_count = 0; + + vlc_mutex_init( &p_vout_bank->lock ); +} + +/***************************************************************************** + * vout_EndBank: empty the video output bank. + ***************************************************************************** + * This function ends all unused video outputs and empties the bank in + * case of success. + *****************************************************************************/ +void vout_EndBank ( void ) +{ + /* Ask all remaining video outputs to die */ + while( p_vout_bank->i_count ) + { + vout_DestroyThread( + p_vout_bank->pp_vout[ --p_vout_bank->i_count ], NULL ); + } + + vlc_mutex_destroy( &p_vout_bank->lock ); +} + /***************************************************************************** * vout_CreateThread: creates a new video output thread ***************************************************************************** diff --git a/src/video_parser/video_fifo.c b/src/video_parser/video_fifo.c index aa7d818529..d93c64adf7 100644 --- a/src/video_parser/video_fifo.c +++ b/src/video_parser/video_fifo.c @@ -2,7 +2,7 @@ * video_fifo.c : video FIFO management ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_fifo.c,v 1.30 2001/04/06 09:15:48 sam Exp $ + * $Id: video_fifo.c,v 1.31 2001/05/06 04:32:02 sam Exp $ * * Authors: Christophe Massiot * @@ -43,13 +43,12 @@ #include "video_decoder.h" #include "vdec_motion.h" -#include "../video_decoder/vdec_idct.h" #include "vpar_blocks.h" -#include "../video_decoder/vpar_headers.h" -#include "../video_decoder/vpar_synchro.h" -#include "../video_decoder/video_parser.h" -#include "../video_decoder/video_fifo.h" +#include "vpar_headers.h" +#include "vpar_synchro.h" +#include "video_parser.h" +#include "video_fifo.h" /***************************************************************************** * vpar_InitFIFO : initialize the video FIFO diff --git a/src/video_parser/video_parser.c b/src/video_parser/video_parser.c index d478efaf2c..ef358154a2 100644 --- a/src/video_parser/video_parser.c +++ b/src/video_parser/video_parser.c @@ -2,7 +2,7 @@ * video_parser.c : video parser thread ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_parser.c,v 1.84 2001/05/01 15:12:22 sam Exp $ + * $Id: video_parser.c,v 1.85 2001/05/06 04:32:03 sam Exp $ * * Authors: Christophe Massiot * Samuel Hocevar @@ -52,13 +52,12 @@ #include "video_decoder.h" #include "vdec_motion.h" -#include "../video_decoder/vdec_idct.h" #include "vpar_blocks.h" -#include "../video_decoder/vpar_headers.h" -#include "../video_decoder/vpar_synchro.h" -#include "../video_decoder/video_parser.h" -#include "../video_decoder/video_fifo.h" +#include "vpar_headers.h" +#include "vpar_synchro.h" +#include "video_parser.h" +#include "video_fifo.h" /* * Local prototypes @@ -175,10 +174,13 @@ vlc_thread_t vpar_CreateThread( vdec_config_t * p_config ) } #define f p_vpar->p_idct_module->p_functions->idct.functions.idct - p_vpar->pf_init = f.pf_init; + p_vpar->pf_idct_init = f.pf_idct_init; p_vpar->pf_sparse_idct = f.pf_sparse_idct; p_vpar->pf_idct = f.pf_idct; p_vpar->pf_norm_scan = f.pf_norm_scan; + p_vpar->pf_vdec_init = f.pf_vdec_init; + p_vpar->pf_decode_mb_c = f.pf_decode_mb_c; + p_vpar->pf_decode_mb_bw = f.pf_decode_mb_bw; #undef f /* Spawn the video parser thread */ @@ -264,15 +266,22 @@ static int InitThread( vpar_thread_t *p_vpar ) } #else /* Fake a video_decoder thread */ - if( (p_vpar->pp_vdec[0] = (vdec_thread_t *)malloc(sizeof( vdec_thread_t ))) - == NULL || vdec_InitThread( p_vpar->pp_vdec[0] ) ) + p_vpar->pp_vdec[0] = (vdec_thread_t *)malloc(sizeof( vdec_thread_t )); + + if( p_vpar->pp_vdec[0] == NULL ) { return( 1 ); } + p_vpar->pp_vdec[0]->b_die = 0; p_vpar->pp_vdec[0]->b_error = 0; p_vpar->pp_vdec[0]->p_vpar = p_vpar; + if( vdec_InitThread( p_vpar->pp_vdec[0] ) ) + { + return( 1 ); + } + # if !defined(SYS_BEOS) && !defined(WIN32) # if VDEC_NICE /* Re-nice ourself */ diff --git a/src/video_parser/vpar_blocks.c b/src/video_parser/vpar_blocks.c index a6cb2b4ed4..b4b85a2f8e 100644 --- a/src/video_parser/vpar_blocks.c +++ b/src/video_parser/vpar_blocks.c @@ -2,7 +2,7 @@ * vpar_blocks.c : blocks parsing ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vpar_blocks.c,v 1.80 2001/04/28 03:36:25 sam Exp $ + * $Id: vpar_blocks.c,v 1.81 2001/05/06 04:32:03 sam Exp $ * * Authors: Christophe Massiot * Jean-Marc Dressler @@ -45,13 +45,12 @@ #include "video_decoder.h" #include "vdec_motion.h" -#include "../video_decoder/vdec_idct.h" #include "vpar_blocks.h" -#include "../video_decoder/vpar_headers.h" -#include "../video_decoder/vpar_synchro.h" -#include "../video_decoder/video_parser.h" -#include "../video_decoder/video_fifo.h" +#include "vpar_headers.h" +#include "vpar_synchro.h" +#include "video_parser.h" +#include "video_fifo.h" /* * Welcome to vpar_blocks.c ! Here's where the heavy processor-critical parsing diff --git a/src/video_parser/vpar_headers.c b/src/video_parser/vpar_headers.c index df7167876e..67d9ff776d 100644 --- a/src/video_parser/vpar_headers.c +++ b/src/video_parser/vpar_headers.c @@ -2,7 +2,7 @@ * vpar_headers.c : headers parsing ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vpar_headers.c,v 1.85 2001/05/01 15:12:22 sam Exp $ + * $Id: vpar_headers.c,v 1.86 2001/05/06 04:32:03 sam Exp $ * * Authors: Christophe Massiot * Stéphane Borel @@ -45,13 +45,12 @@ #include "video_decoder.h" #include "vdec_motion.h" -#include "../video_decoder/vdec_idct.h" #include "vpar_blocks.h" -#include "../video_decoder/vpar_headers.h" -#include "../video_decoder/vpar_synchro.h" -#include "../video_decoder/video_parser.h" -#include "../video_decoder/video_fifo.h" +#include "vpar_headers.h" +#include "vpar_synchro.h" +#include "video_parser.h" +#include "video_fifo.h" #include "main.h" /* XXX REMOVE THIS */ @@ -452,19 +451,36 @@ static void SequenceHeader( vpar_thread_t * p_vpar ) ExtensionAndUserData( p_vpar ); /* XXX: The vout request and fifo opening will eventually be here */ - if( p_vpar->p_vout == NULL ) + + /* Spawn an audio output if there is none */ + vlc_mutex_lock( &p_vout_bank->lock ); + + if( p_vout_bank->i_count == 0 ) { - if( p_main->p_vout == NULL ) + intf_Msg( "vpar: no vout present, spawning one" ); + + p_vpar->p_vout = vout_CreateThread( NULL ); + + /* Everything failed */ + if( p_vpar->p_vout == NULL ) { - intf_Msg( "vpar: no vout present, spawning one" ); - p_main->p_vout = vout_CreateThread( NULL ); + intf_Msg( "vpar: can't open vout, aborting" ); + vlc_mutex_unlock( &p_vout_bank->lock ); - /* Spawning another one for fun */ - //vout_CreateThread( NULL ); + /* XXX ! XXX ! XXX ! what to do here ? */ + return; } - - p_vpar->p_vout = p_main->p_vout; + + p_vout_bank->pp_vout[ p_vout_bank->i_count ] = p_vpar->p_vout; + p_vout_bank->i_count++; } + else + { + /* Take the first video output FIXME: take the best one */ + p_vpar->p_vout = p_vout_bank->pp_vout[ 0 ]; + } + + vlc_mutex_unlock( &p_vout_bank->lock ); } /***************************************************************************** diff --git a/src/video_parser/vpar_synchro.c b/src/video_parser/vpar_synchro.c index caac6b16b6..e03dfc86af 100644 --- a/src/video_parser/vpar_synchro.c +++ b/src/video_parser/vpar_synchro.c @@ -2,7 +2,7 @@ * vpar_synchro.c : frame dropping routines ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vpar_synchro.c,v 1.88 2001/04/27 19:29:11 massiot Exp $ + * $Id: vpar_synchro.c,v 1.89 2001/05/06 04:32:03 sam Exp $ * * Authors: Christophe Massiot * Samuel Hocevar @@ -113,12 +113,11 @@ #include "video_decoder.h" #include "vdec_motion.h" -#include "../video_decoder/vdec_idct.h" #include "vpar_blocks.h" -#include "../video_decoder/vpar_headers.h" -#include "../video_decoder/vpar_synchro.h" -#include "../video_decoder/video_parser.h" +#include "vpar_headers.h" +#include "vpar_synchro.h" +#include "video_parser.h" #include "main.h" -- 2.39.2