]> git.sesse.net Git - vlc/commitdiff
* COMPLETE CVS BREAKAGE !! The MAIN branch is going to be a playground
authorSam Hocevar <sam@videolan.org>
Sun, 9 Dec 2001 17:01:37 +0000 (17:01 +0000)
committerSam Hocevar <sam@videolan.org>
Sun, 9 Dec 2001 17:01:37 +0000 (17:01 +0000)
    for my nevrotic and destructive pulsions during the next few hours!

  * If you want to test vlc, please use the v0_2_92_branch branch.

  * Stuff currently working:
     - direct to YUV buffer decoding
     - non-ugly subtitle blending
     - XVideo and SDL video output

  * Stuff currently utterly broken:
     - aspect ratio
     - software rendering (ie, all other video output plugins)

  * Additional misc changes:
     - Renamed spu_dec to spudec and mad_adec to mad to stay coherent with
       other plugins. Also, renamed mpeg to mpeg_system.
     - Added jobi to the AUTHORS file.
     - Factored code common to vout_x11.c and vout_xvideo.c.

173 files changed:
AUTHORS
Makefile
Makefile.opts.in
configure
configure.in
debian/control
debian/rules
extras/libdvdcss/css.c
extras/libdvdcss/ioctl.c
extras/libdvdcss/libdvdcss.c
include/common.h
include/config.h.in
include/defs.h.in
include/interface.h
include/modules.h
include/modules_export.h
include/vdec_ext-plugins.h
include/video.h
include/video_output.h
ipkg/rules
plugins/ac3_adec/ac3_adec.c
plugins/ac3_adec/ac3_bit_allocate.c
plugins/ac3_adec/ac3_decoder.c
plugins/ac3_adec/ac3_exponent.c
plugins/ac3_adec/ac3_imdct.c
plugins/ac3_adec/ac3_mantissa.c
plugins/ac3_adec/ac3_parse.c
plugins/ac3_adec/ac3_rematrix.c
plugins/ac3_spdif/ac3_iec958.c
plugins/ac3_spdif/ac3_spdif.c
plugins/alsa/alsa.c
plugins/arts/arts.c
plugins/beos/beos.cpp
plugins/chroma/.cvsignore [moved from plugins/mad_adec/.cvsignore with 100% similarity]
plugins/chroma/Makefile [new file with mode: 0644]
plugins/directx/directx.c
plugins/downmix/ac3_downmix_3dn.c
plugins/downmix/ac3_downmix_c.c
plugins/downmix/ac3_downmix_sse.c
plugins/downmix/downmix.c
plugins/downmix/downmix3dn.c
plugins/downmix/downmixsse.c
plugins/dsp/dsp.c
plugins/dummy/dummy.c
plugins/dummy/null.c
plugins/dummy/vout_dummy.c
plugins/dvd/dummy_dvdcss.c
plugins/dvd/dvd.c
plugins/dvd/dvd_ifo.c
plugins/dvd/dvd_udf.c
plugins/dvdread/dvdread.c
plugins/esd/esd.c
plugins/fb/fb.c
plugins/ggi/ggi.c
plugins/glide/glide.c
plugins/gtk/gnome.c
plugins/gtk/gtk.c
plugins/idct/idct.c
plugins/idct/idctaltivec.c
plugins/idct/idctclassic.c
plugins/idct/idctmmx.c
plugins/idct/idctmmxext.c
plugins/idct/vdec_block_c.c [new file with mode: 0644]
plugins/idct/vdec_block_mmx.c [new file with mode: 0644]
plugins/imdct/ac3_imdct_3dn.c
plugins/imdct/ac3_imdct_c.c
plugins/imdct/ac3_imdct_common.c
plugins/imdct/ac3_imdct_sse.c
plugins/imdct/ac3_srfft_3dn.c
plugins/imdct/ac3_srfft_c.c
plugins/imdct/ac3_srfft_sse.c
plugins/imdct/imdct.c
plugins/imdct/imdct3dn.c
plugins/imdct/imdctsse.c
plugins/lpcm_adec/lpcm_adec.c
plugins/macosx/intf_main.c
plugins/macosx/macosx.c
plugins/mad/.cvsignore [moved from plugins/mpeg/.cvsignore with 100% similarity]
plugins/mad/API [moved from plugins/mad_adec/API with 100% similarity]
plugins/mad/BUGS [moved from plugins/mad_adec/BUGS with 94% similarity]
plugins/mad/DESIGN [moved from plugins/mad_adec/DESIGN with 90% similarity]
plugins/mad/Makefile [moved from plugins/mad_adec/Makefile with 71% similarity]
plugins/mad/TODO [moved from plugins/mad_adec/TODO with 100% similarity]
plugins/mad/docs/joe_drew.txt [moved from plugins/mad_adec/docs/joe_drew.txt with 100% similarity]
plugins/mad/docs/rob_leslie.txt [moved from plugins/mad_adec/docs/rob_leslie.txt with 100% similarity]
plugins/mad/mad_adec.c [moved from plugins/mad_adec/mad_adec.c with 99% similarity]
plugins/mad/mad_adec.h [moved from plugins/mad_adec/mad_adec.h with 100% similarity]
plugins/mad/mad_libmad.c [moved from plugins/mad_adec/mad_libmad.c with 99% similarity]
plugins/mad/mad_libmad.h [moved from plugins/mad_adec/mad_libmad.h with 100% similarity]
plugins/mga/mga.c
plugins/mga/vout_mga.c
plugins/motion/motion.c
plugins/motion/motion3dnow.c
plugins/motion/motionaltivec.c
plugins/motion/motionmmx.c
plugins/motion/motionmmxext.c
plugins/motion/vdec_motion_common.c [new file with mode: 0644]
plugins/motion/vdec_motion_inner.c [new file with mode: 0644]
plugins/motion/vdec_motion_inner_mmx.c [new file with mode: 0644]
plugins/motion/vdec_motion_inner_mmxext.c [new file with mode: 0644]
plugins/mpeg_adec/adec_layer1.c
plugins/mpeg_adec/adec_layer2.c
plugins/mpeg_adec/mpeg_adec.c
plugins/mpeg_adec/mpeg_adec_generic.c
plugins/mpeg_system/.cvsignore [moved from plugins/spu_dec/.cvsignore with 100% similarity]
plugins/mpeg_system/Makefile [moved from plugins/mpeg/Makefile with 74% similarity]
plugins/mpeg_system/input_es.c [moved from plugins/mpeg/input_es.c with 99% similarity]
plugins/mpeg_system/input_es.h [moved from plugins/mpeg/input_es.h with 95% similarity]
plugins/mpeg_system/input_ps.c [moved from plugins/mpeg/input_ps.c with 99% similarity]
plugins/mpeg_system/input_ps.h [moved from plugins/mpeg/input_ps.h with 97% similarity]
plugins/mpeg_system/input_ts.c [moved from plugins/mpeg/input_ts.c with 99% similarity]
plugins/mpeg_system/input_ts.h [moved from plugins/mpeg/input_ts.h with 96% similarity]
plugins/mpeg_system/mpeg_es.c [moved from plugins/mpeg/es.c with 94% similarity]
plugins/mpeg_system/mpeg_ps.c [moved from plugins/mpeg/ps.c with 94% similarity]
plugins/mpeg_system/mpeg_ts.c [moved from plugins/mpeg/ts.c with 94% similarity]
plugins/mpeg_vdec/video_decoder.c
plugins/mpeg_vdec/vpar_blocks.c
plugins/mpeg_vdec/vpar_headers.c
plugins/mpeg_vdec/vpar_pool.c
plugins/qnx/qnx.c
plugins/qt/qt.cpp
plugins/sdl/sdl.c
plugins/sdl/vout_sdl.c
plugins/spudec/.cvsignore [moved from plugins/yuv/.cvsignore with 100% similarity]
plugins/spudec/Makefile [moved from plugins/spu_dec/Makefile with 90% similarity]
plugins/spudec/spu_decoder.c [moved from plugins/spu_dec/spu_decoder.c with 94% similarity]
plugins/spudec/spu_decoder.h [moved from plugins/spu_dec/spu_decoder.h with 98% similarity]
plugins/text/intf_rc.c
plugins/text/ncurses.c
plugins/text/rc.c
plugins/vcd/input_vcd.c
plugins/vcd/vcd.c
plugins/x11/Makefile
plugins/x11/vout_common.c [new file with mode: 0644]
plugins/x11/vout_common.h [new file with mode: 0644]
plugins/x11/vout_x11.c
plugins/x11/vout_xvideo.c
plugins/x11/x11.c
plugins/x11/xvideo.c
plugins/yuv/Makefile [deleted file]
plugins/yuv/transforms_common.h [deleted file]
plugins/yuv/transforms_yuv.c [deleted file]
plugins/yuv/transforms_yuv.h [deleted file]
plugins/yuv/transforms_yuvmmx.c [deleted file]
plugins/yuv/transforms_yuvmmx.h [deleted file]
plugins/yuv/video_common.h [deleted file]
plugins/yuv/video_yuv.c [deleted file]
plugins/yuv/video_yuvmmx.c [deleted file]
plugins/yuv/yuv.c [deleted file]
plugins/yuv/yuvmmx.c [deleted file]
src/audio_output/aout_s8.c
src/audio_output/aout_spdif.c
src/audio_output/aout_u16.c
src/input/input_dec.c
src/input/input_ext-dec.c
src/input/input_ext-intf.c
src/input/input_netlist.c
src/input/mpeg_system.c
src/interface/interface.c
src/interface/main.c
src/misc/beos_specific.cpp
src/misc/darwin_specific.c
src/misc/iso_lang.c
src/misc/mtime.c
src/misc/win32_specific.c
src/video_output/video_output.c
src/video_output/video_spu.c [deleted file]
src/video_output/video_spu.h [deleted file]
src/video_output/video_text.c
src/video_output/video_yuv.c [deleted file]
src/video_output/video_yuv.h [deleted file]
src/video_output/vout_pictures.c [new file with mode: 0644]
src/video_output/vout_subpictures.c [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
index 39d9574b14f807af58cfeeb754944e8a08641964..14961428ddd5520f59a0aa66a42c173bf27c6a00 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -29,6 +29,11 @@ N: Billy Biggs
 E: vektor@dumbterm.net
 D: libdvdcss enhancements
 
+N: Johan Bilien
+E: jobi@via.ecp.fr
+C: jobi
+D: VCD input
+
 N: Emmanuel Blindauer
 E: manu@agat.net
 D: aRts audio output
index e7be454dbb4abf24eb284b88503af43eb877b284..96b3ee279e9f4cd2da60405784a2b79c9e6346d4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -16,8 +16,9 @@ endif
 PLUGINS_DIR := ac3_adec \
                ac3_spdif \
                alsa \
-               arts \
+               arts \
                beos \
+               chroma \
                directx \
                dsp \
                dummy \
@@ -34,26 +35,26 @@ PLUGINS_DIR :=      ac3_adec \
                kde \
                lpcm_adec \
                macosx \
-               mad_adec \
+               mad \
                memcpy \
                mga \
                motion \
-               mpeg \
+               mpeg_system \
                mpeg_adec \
                mpeg_vdec \
                qt \
                sdl \
-               spu_dec \
+               spudec \
                text \
                vcd \
-               x11 \
-               yuv
+               x11
 
 PLUGINS_TARGETS := ac3_adec/ac3_adec \
                ac3_spdif/ac3_spdif \
                alsa/alsa \
-               arts/arts \
+               arts/arts \
                beos/beos \
+               chroma/yuv2rgb8 \
                directx/directx \
                dsp/dsp \
                dummy/dummy \
@@ -80,7 +81,7 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
                kde/kde \
                lpcm_adec/lpcm_adec \
                macosx/macosx \
-               mad_adec/mad_adec \
+               mad/mad \
                memcpy/memcpy \
                memcpy/memcpymmx \
                memcpy/memcpymmxext \
@@ -91,14 +92,14 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
                motion/motionmmxext \
                motion/motion3dnow \
                motion/motionaltivec \
+               mpeg_system/mpeg_es \
+               mpeg_system/mpeg_ps \
+               mpeg_system/mpeg_ts \
                mpeg_adec/mpeg_adec \
                mpeg_vdec/mpeg_vdec \
-               mpeg/es \
-               mpeg/ps \
-               mpeg/ts \
                qt/qt \
                sdl/sdl \
-               spu_dec/spu_dec \
+               spudec/spudec \
                text/ncurses \
                text/rc \
                vcd/vcd \
@@ -106,12 +107,13 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
                x11/xvideo \
                yuv/yuv \
                yuv/yuvmmx
+
 #
 # C Objects
 # 
 INTERFACE := main interface intf_msg intf_playlist intf_channels
 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_netlist input_clock mpeg_system
-VIDEO_OUTPUT := video_output video_text video_spu video_yuv
+VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
 MISC := mtime tests modules netutils iso_lang
 
index 843a223e3dfedd4f007b6f911c667dede174752a..6174d340605b6ae032d4398ddf974e15d81f59c6 100644 (file)
@@ -83,13 +83,13 @@ LIB_GTK = @LIB_GTK@
 LIB_KDE = @LIB_KDE@
 LIB_LIBDVDCSS = @LIB_LIBDVDCSS@
 LIB_MACOSX = @LIB_MACOSX@
-LIB_MAD_ADEC = @LIB_MAD_ADEC@
+LIB_MAD = @LIB_MAD@
+LIB_MPEG_TS = @LIB_MPEG_TS@
 LIB_NCURSES = @LIB_NCURSES@
 LIB_QNX = @LIB_QNX@
 LIB_QT = @LIB_QT@
 LIB_RC = @LIB_RC@
 LIB_SDL = @LIB_SDL@
-LIB_TS = @LIB_TS@
 LIB_X11 = @LIB_X11@
 LIB_XVIDEO = @LIB_XVIDEO@
 LIB_YUV = @LIB_YUV@
@@ -105,7 +105,7 @@ CFLAGS_ESD = @CFLAGS_ESD@
 CFLAGS_LIBDVDCSS = @CFLAGS_LIBDVDCSS@
 CFLAGS_ESD = @CFLAGS_ESD@
 CFLAGS_GTK = @CFLAGS_GTK@
-CFLAGS_MAD_ADEC = @CFLAGS_MAD_ADEC@
+CFLAGS_MAD = @CFLAGS_MAD@
 CFLAGS_SDL = @CFLAGS_SDL@
 CFLAGS_X11 = @CFLAGS_X11@
 
index 3863f5ff9fe6ea988a11420e523d9cca0d371ef5..a4781ab7cde1b5df8deba013074a6c46bff59cb1 100755 (executable)
--- a/configure
+++ b/configure
@@ -48,9 +48,9 @@ ac_help="$ac_help
 ac_help="$ac_help
   --disable-null          Null module (default enabled)"
 ac_help="$ac_help
-  --disable-rc            rc module (default enabled)"
+  --disable-rc            Remote Control module (default enabled)"
 ac_help="$ac_help
-  --with-libmad[=PATH]    libmad module (default disabled)"
+  --with-mad[=PATH]       libmad module (default disabled)"
 ac_help="$ac_help
   --disable-dsp           Linux /dev/dsp support (default enabled)"
 ac_help="$ac_help
@@ -2378,15 +2378,12 @@ else
 #include <sys/types.h>
 #include <fcntl.h>
 #include <sys/mman.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 
 /* This mess was copied from the GNU getpagesize.h.  */
 #ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+# endif
 
 /* Assume that all systems that can run configure have sys/param.h.  */
 # ifndef HAVE_SYS_PARAM_H
@@ -2441,7 +2438,7 @@ main()
        /*
         * First, make a file with some known garbage in it.
         */
-       data = (char*)malloc(pagesize);
+       data = malloc(pagesize);
        if (!data)
                exit(1);
        for (i = 0; i < pagesize; ++i)
@@ -2462,7 +2459,7 @@ main()
        fd = open("conftestmmap", O_RDWR);
        if (fd < 0)
                exit(1);
-       data2 = (char*)malloc(2 * pagesize);
+       data2 = malloc(2 * pagesize);
        if (!data2)
                exit(1);
        data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
@@ -2480,7 +2477,7 @@ main()
         */
        for (i = 0; i < pagesize; ++i)
                *(data2 + i) = *(data2 + i) + 1;
-       data3 = (char*)malloc(pagesize);
+       data3 = malloc(pagesize);
        if (!data3)
                exit(1);
        if (read(fd, data3, pagesize) != pagesize)
@@ -2494,7 +2491,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:2498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_mmap_fixed_mapped=yes
 else
@@ -2517,12 +2514,12 @@ EOF
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2521: checking return type of signal handlers" >&5
+echo "configure:2518: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2526 "configure"
+#line 2523 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -2539,7 +2536,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:2543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -2558,7 +2555,7 @@ EOF
 
 
 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:2562: checking for dlopen in -ldl" >&5
+echo "configure:2559: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2566,7 +2563,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2570 "configure"
+#line 2567 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2577,7 +2574,7 @@ int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:2581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2578: \"$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
@@ -2597,8 +2594,48 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
+echo $ac_n "checking for cos in -lm""... $ac_c" 1>&6
+echo "configure:2599: checking for cos in -lm" >&5
+ac_lib_var=`echo m'_'cos | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lm  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2607 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char cos();
+
+int main() {
+cos()
+; return 0; }
+EOF
+if { (eval echo configure:2618: \"$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
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIB_IMDCT="${LIB_IMDCT} -lm"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
 echo $ac_n "checking for pow in -lm""... $ac_c" 1>&6
-echo "configure:2602: checking for pow in -lm" >&5
+echo "configure:2639: checking for pow in -lm" >&5
 ac_lib_var=`echo m'_'pow | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2606,7 +2643,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2610 "configure"
+#line 2647 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2617,7 +2654,7 @@ int main() {
 pow()
 ; return 0; }
 EOF
-if { (eval echo configure:2621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2658: \"$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
@@ -2641,7 +2678,7 @@ fi
 THREAD_LIB=error
 if test "x${THREAD_LIB}" = xerror; then
   echo $ac_n "checking for pthread_attr_init in -lpthread""... $ac_c" 1>&6
-echo "configure:2645: checking for pthread_attr_init in -lpthread" >&5
+echo "configure:2682: checking for pthread_attr_init in -lpthread" >&5
 ac_lib_var=`echo pthread'_'pthread_attr_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2649,7 +2686,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2653 "configure"
+#line 2690 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2660,7 +2697,7 @@ int main() {
 pthread_attr_init()
 ; return 0; }
 EOF
-if { (eval echo configure:2664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2701: \"$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
@@ -2683,7 +2720,7 @@ fi
 fi
 if test "x${THREAD_LIB}" = xerror; then
   echo $ac_n "checking for pthread_attr_init in -lpthreads""... $ac_c" 1>&6
-echo "configure:2687: checking for pthread_attr_init in -lpthreads" >&5
+echo "configure:2724: checking for pthread_attr_init in -lpthreads" >&5
 ac_lib_var=`echo pthreads'_'pthread_attr_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2691,7 +2728,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpthreads  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2695 "configure"
+#line 2732 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2702,7 +2739,7 @@ int main() {
 pthread_attr_init()
 ; return 0; }
 EOF
-if { (eval echo configure:2706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2743: \"$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
@@ -2725,7 +2762,7 @@ fi
 fi
 if test "x${THREAD_LIB}" = xerror; then
   echo $ac_n "checking for pthread_attr_init in -lc_r""... $ac_c" 1>&6
-echo "configure:2729: checking for pthread_attr_init in -lc_r" >&5
+echo "configure:2766: checking for pthread_attr_init in -lc_r" >&5
 ac_lib_var=`echo c_r'_'pthread_attr_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2733,7 +2770,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lc_r  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2737 "configure"
+#line 2774 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2744,7 +2781,7 @@ int main() {
 pthread_attr_init()
 ; return 0; }
 EOF
-if { (eval echo configure:2748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2785: \"$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
@@ -2767,12 +2804,12 @@ fi
 fi
 if test "x${THREAD_LIB}" = xerror; then
   echo $ac_n "checking for pthread_attr_init""... $ac_c" 1>&6
-echo "configure:2771: checking for pthread_attr_init" >&5
+echo "configure:2808: checking for pthread_attr_init" >&5
 if eval "test \"`echo '$''{'ac_cv_func_pthread_attr_init'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2776 "configure"
+#line 2813 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char pthread_attr_init(); below.  */
@@ -2795,7 +2832,7 @@ pthread_attr_init();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_pthread_attr_init=yes"
 else
@@ -2818,7 +2855,7 @@ fi
 fi
 
 echo $ac_n "checking for cthread_fork in -lthreads""... $ac_c" 1>&6
-echo "configure:2822: checking for cthread_fork in -lthreads" >&5
+echo "configure:2859: checking for cthread_fork in -lthreads" >&5
 ac_lib_var=`echo threads'_'cthread_fork | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2826,7 +2863,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lthreads  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2830 "configure"
+#line 2867 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2837,7 +2874,7 @@ int main() {
 cthread_fork()
 ; return 0; }
 EOF
-if { (eval echo configure:2841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2878: \"$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
@@ -2859,7 +2896,7 @@ fi
 
 
 cat > conftest.$ac_ext <<EOF
-#line 2863 "configure"
+#line 2900 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 EOF
@@ -2875,7 +2912,7 @@ fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 2879 "configure"
+#line 2916 "configure"
 #include "confdefs.h"
 #include <strings.h>
 EOF
@@ -2895,17 +2932,17 @@ for ac_hdr in stddef.h getopt.h strings.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2899: checking for $ac_hdr" >&5
+echo "configure:2936: 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
-#line 2904 "configure"
+#line 2941 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2909: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2946: \"$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*
@@ -2935,17 +2972,17 @@ for ac_hdr in sys/sockio.h fcntl.h sys/time.h sys/times.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2939: checking for $ac_hdr" >&5
+echo "configure:2976: 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
-#line 2944 "configure"
+#line 2981 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2949: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2986: \"$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*
@@ -2975,17 +3012,17 @@ for ac_hdr in sys/soundcard.h machine/soundcard.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2979: checking for $ac_hdr" >&5
+echo "configure:3016: 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
-#line 2984 "configure"
+#line 3021 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3026: \"$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*
@@ -3015,17 +3052,17 @@ for ac_hdr in dlfcn.h image.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3019: checking for $ac_hdr" >&5
+echo "configure:3056: 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
-#line 3024 "configure"
+#line 3061 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3029: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3066: \"$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*
@@ -3055,17 +3092,17 @@ for ac_hdr in arpa/inet.h net/if.h netinet/in.h sys/socket.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3059: checking for $ac_hdr" >&5
+echo "configure:3096: 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
-#line 3064 "configure"
+#line 3101 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3069: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3106: \"$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*
@@ -3095,17 +3132,17 @@ for ac_hdr in machine/param.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3099: checking for $ac_hdr" >&5
+echo "configure:3136: 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
-#line 3104 "configure"
+#line 3141 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3109: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3146: \"$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*
@@ -3136,17 +3173,17 @@ for ac_hdr in cthreads.h pthread.h kernel/scheduler.h kernel/OS.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3140: checking for $ac_hdr" >&5
+echo "configure:3177: 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
-#line 3145 "configure"
+#line 3182 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3150: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3187: \"$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*
@@ -3174,20 +3211,20 @@ done
 
 
 echo $ac_n "checking for ntohl in sys/param.h""... $ac_c" 1>&6
-echo "configure:3178: checking for ntohl in sys/param.h" >&5
+echo "configure:3215: checking for ntohl in sys/param.h" >&5
 if eval "test \"`echo '$''{'ac_cv_c_ntohl_sys_param_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   CFLAGS="${save_CFLAGS} -Wall -Werror"
      cat > conftest.$ac_ext <<EOF
-#line 3184 "configure"
+#line 3221 "configure"
 #include "confdefs.h"
 #include <sys/param.h>
 int main() {
 void foo() { int meuh; ntohl(meuh); }
 ; return 0; }
 EOF
-if { (eval echo configure:3191: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3228: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_ntohl_sys_param_h=yes
 else
@@ -3208,20 +3245,20 @@ EOF
 fi
 
 echo $ac_n "checking if \$CC accepts -finline-limit""... $ac_c" 1>&6
-echo "configure:3212: checking if \$CC accepts -finline-limit" >&5
+echo "configure:3249: checking if \$CC accepts -finline-limit" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline_limit'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   CFLAGS="${save_CFLAGS} -finline-limit-30000"
      cat > conftest.$ac_ext <<EOF
-#line 3218 "configure"
+#line 3255 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3225: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3262: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline_limit=yes
 else
@@ -3239,20 +3276,20 @@ if test x"$ac_cv_c_inline_limit" != x"no"; then
 fi
 
 echo $ac_n "checking if \$CC accepts -bundle -undefined error""... $ac_c" 1>&6
-echo "configure:3243: checking if \$CC accepts -bundle -undefined error" >&5
+echo "configure:3280: checking if \$CC accepts -bundle -undefined error" >&5
 if eval "test \"`echo '$''{'ac_cv_ld_darwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   CFLAGS="${save_CFLAGS} -bundle -undefined error"
      cat > conftest.$ac_ext <<EOF
-#line 3249 "configure"
+#line 3286 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3256: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3293: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_ld_darwin=yes
 else
@@ -3270,20 +3307,20 @@ if test x"$ac_cv_ld_darwin" != x"no"; then
 fi
 
 echo $ac_n "checking if \$CC accepts -shared""... $ac_c" 1>&6
-echo "configure:3274: checking if \$CC accepts -shared" >&5
+echo "configure:3311: checking if \$CC accepts -shared" >&5
 if eval "test \"`echo '$''{'ac_cv_ld_plugins'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   CFLAGS="${save_CFLAGS} -shared"
      cat > conftest.$ac_ext <<EOF
-#line 3280 "configure"
+#line 3317 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3287: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_ld_plugins=yes
 else
@@ -3302,7 +3339,7 @@ fi
         
 if test x"${SOFLAGS}" = x; then
     echo $ac_n "checking for soname setting""... $ac_c" 1>&6
-echo "configure:3306: checking for soname setting" >&5
+echo "configure:3343: checking for soname setting" >&5
 if eval "test \"`echo '$''{'ac_cv_ld_soname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3311,14 +3348,14 @@ else
         try_SOFLAGS="-Wl,-soname -Wl,"
         LDFLAGS="${save_LDFLAGS} ${try_SOFLAGS}foo.so.0"
         cat > conftest.$ac_ext <<EOF
-#line 3315 "configure"
+#line 3352 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_ld_soname="${try_SOFLAGS}"
 else
@@ -3330,14 +3367,14 @@ else
             try_SOFLAGS="-Wl,-h -Wl,"
             LDFLAGS="${save_LDFLAGS} ${try_SOFLAGS}foo.so.0"
             cat > conftest.$ac_ext <<EOF
-#line 3334 "configure"
+#line 3371 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3378: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_ld_soname="${try_SOFLAGS}"
 else
@@ -3366,7 +3403,7 @@ have problems using libdvdcss.
 fi
 
 echo $ac_n "checking __attribute__ ((aligned ())) support""... $ac_c" 1>&6
-echo "configure:3370: checking __attribute__ ((aligned ())) support" >&5
+echo "configure:3407: checking __attribute__ ((aligned ())) support" >&5
 if eval "test \"`echo '$''{'ac_cv_c_attribute_aligned'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3374,14 +3411,14 @@ else
        CFLAGS="${save_CFLAGS} -Werror"
     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
         cat > conftest.$ac_ext <<EOF
-#line 3378 "configure"
+#line 3415 "configure"
 #include "confdefs.h"
 
 int main() {
 static char c __attribute__ ((aligned($ac_cv_c_attr_align_try))) = 0; return c;
 ; return 0; }
 EOF
-if { (eval echo configure:3385: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3422: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_attribute_aligned=$ac_cv_c_attr_align_try
 else
@@ -3404,19 +3441,19 @@ CFLAGS="${save_CFLAGS}"
 LDFLAGS="${save_LDFLAGS}"
 
 echo $ac_n "checking for boolean_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:3408: checking for boolean_t in sys/types.h" >&5
+echo "configure:3445: checking for boolean_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_c_boolean_t_sys_types_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3413 "configure"
+#line 3450 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int main() {
 boolean_t foo;
 ; return 0; }
 EOF
-if { (eval echo configure:3420: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_boolean_t_sys_types_h=yes
 else
@@ -3437,19 +3474,19 @@ EOF
 fi
 
 echo $ac_n "checking for boolean_t in pthread.h""... $ac_c" 1>&6
-echo "configure:3441: checking for boolean_t in pthread.h" >&5
+echo "configure:3478: checking for boolean_t in pthread.h" >&5
 if eval "test \"`echo '$''{'ac_cv_c_boolean_t_pthread_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3446 "configure"
+#line 3483 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 int main() {
 boolean_t foo;
 ; return 0; }
 EOF
-if { (eval echo configure:3453: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3490: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_boolean_t_pthread_h=yes
 else
@@ -3470,19 +3507,19 @@ EOF
 fi
 
 echo $ac_n "checking for boolean_t in cthreads.h""... $ac_c" 1>&6
-echo "configure:3474: checking for boolean_t in cthreads.h" >&5
+echo "configure:3511: checking for boolean_t in cthreads.h" >&5
 if eval "test \"`echo '$''{'ac_cv_c_boolean_t_cthreads_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3479 "configure"
+#line 3516 "configure"
 #include "confdefs.h"
 #include <cthreads.h>
 int main() {
 boolean_t foo;
 ; return 0; }
 EOF
-if { (eval echo configure:3486: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3523: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_boolean_t_cthreads_h=yes
 else
@@ -3503,18 +3540,18 @@ EOF
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:3507: checking for working const" >&5
+echo "configure:3544: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3512 "configure"
+#line 3549 "configure"
 #include "confdefs.h"
 
 int main() {
 
 /* Ultrix mips cc rejects this.  */
-typedef int charset[2]; const charset x = {0,0};
+typedef int charset[2]; const charset x;
 /* SunOS 4.1.1 cc rejects this.  */
 char const *const *ccp;
 char **p;
@@ -3557,7 +3594,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:3561: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3598: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -3578,12 +3615,12 @@ EOF
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:3582: checking for ANSI C header files" >&5
+echo "configure:3619: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3587 "configure"
+#line 3624 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -3591,7 +3628,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3595: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3632: \"$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*
@@ -3608,7 +3645,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3612 "configure"
+#line 3649 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -3626,7 +3663,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3630 "configure"
+#line 3667 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -3647,7 +3684,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 3651 "configure"
+#line 3688 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -3658,7 +3695,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:3662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -3682,12 +3719,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3686: checking for size_t" >&5
+echo "configure:3723: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3691 "configure"
+#line 3728 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3715,12 +3752,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:3719: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:3756: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3724 "configure"
+#line 3761 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -3729,7 +3766,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:3733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3770: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -3753,29 +3790,30 @@ fi
 
 ARCH=${target_cpu}
 
-BUILTINS="${BUILTINS} es ps ts memcpy yuv idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
-PLUGINS="${PLUGINS} ac3_spdif spu_dec"
+#BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy yuv2rgb8 idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
+BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
+PLUGINS="${PLUGINS} ac3_spdif spudec"
 
-MMX_MODULES="memcpymmx yuvmmx idctmmx motionmmx"
+MMX_MODULES="memcpymmx idctmmx motionmmx"
 MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
 THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn"
 SSE_MODULES="imdctsse downmixsse"
 ALTIVEC_MODULES="idctaltivec motionaltivec"
 
 echo $ac_n "checking if \$CC groks MMX inline assembly""... $ac_c" 1>&6
-echo "configure:3767: checking if \$CC groks MMX inline assembly" >&5
+echo "configure:3805: checking if \$CC groks MMX inline assembly" >&5
 if eval "test \"`echo '$''{'ac_cv_mmx_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3772 "configure"
+#line 3810 "configure"
 #include "confdefs.h"
 
 int main() {
 void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));
 ; return 0; }
 EOF
-if { (eval echo configure:3779: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3817: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mmx_inline=yes
 else
@@ -3793,19 +3831,19 @@ if test x"$ac_cv_mmx_inline" != x"no"; then
 fi
 
 echo $ac_n "checking if \$CC groks MMX EXT inline assembly""... $ac_c" 1>&6
-echo "configure:3797: checking if \$CC groks MMX EXT inline assembly" >&5
+echo "configure:3835: checking if \$CC groks MMX EXT inline assembly" >&5
 if eval "test \"`echo '$''{'ac_cv_mmxext_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3802 "configure"
+#line 3840 "configure"
 #include "confdefs.h"
 
 int main() {
 void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));
 ; return 0; }
 EOF
-if { (eval echo configure:3809: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3847: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mmxext_inline=yes
 else
@@ -3823,19 +3861,19 @@ if test x"$ac_cv_mmxext_inline" != x"no"; then
 fi
 
 echo $ac_n "checking if \$CC groks 3D Now! inline assembly""... $ac_c" 1>&6
-echo "configure:3827: checking if \$CC groks 3D Now! inline assembly" >&5
+echo "configure:3865: checking if \$CC groks 3D Now! inline assembly" >&5
 if eval "test \"`echo '$''{'ac_cv_3dnow_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3832 "configure"
+#line 3870 "configure"
 #include "confdefs.h"
 
 int main() {
 void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));
 ; return 0; }
 EOF
-if { (eval echo configure:3839: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3877: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_3dnow_inline=yes
 else
@@ -3857,19 +3895,19 @@ EOF
 fi
 
 echo $ac_n "checking if \$CC groks SSE inline assembly""... $ac_c" 1>&6
-echo "configure:3861: checking if \$CC groks SSE inline assembly" >&5
+echo "configure:3899: checking if \$CC groks SSE inline assembly" >&5
 if eval "test \"`echo '$''{'ac_cv_sse_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3866 "configure"
+#line 3904 "configure"
 #include "confdefs.h"
 
 int main() {
 void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));
 ; return 0; }
 EOF
-if { (eval echo configure:3873: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3911: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_sse_inline=yes
 else
@@ -3891,19 +3929,19 @@ EOF
 fi
 
 echo $ac_n "checking if \$CC groks Altivec inline assembly""... $ac_c" 1>&6
-echo "configure:3895: checking if \$CC groks Altivec inline assembly" >&5
+echo "configure:3933: checking if \$CC groks Altivec inline assembly" >&5
 if eval "test \"`echo '$''{'ac_cv_altivec_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3900 "configure"
+#line 3938 "configure"
 #include "confdefs.h"
 
 int main() {
 asm volatile("vperm 0,1,2,3");
 ; return 0; }
 EOF
-if { (eval echo configure:3907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3945: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_altivec_inline=yes
 else
@@ -3913,14 +3951,14 @@ else
   save_CFLAGS=$CFLAGS
           CFLAGS="$CFLAGS -Wa,-m7400"
           cat > conftest.$ac_ext <<EOF
-#line 3917 "configure"
+#line 3955 "configure"
 #include "confdefs.h"
 
 int main() {
 asm volatile("vperm 0,1,2,3");
 ; return 0; }
 EOF
-if { (eval echo configure:3924: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_altivec_inline="-Wa,-m7400"
 else
@@ -3949,7 +3987,7 @@ EOF
 fi
 
 echo $ac_n "checking if \$CC groks Altivec C extensions""... $ac_c" 1>&6
-echo "configure:3953: checking if \$CC groks Altivec C extensions" >&5
+echo "configure:3991: checking if \$CC groks Altivec C extensions" >&5
 if eval "test \"`echo '$''{'ac_cv_c_altivec'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3957,14 +3995,14 @@ else
      CFLAGS="$CFLAGS -faltivec"
      # Darwin test
      cat > conftest.$ac_ext <<EOF
-#line 3961 "configure"
+#line 3999 "configure"
 #include "confdefs.h"
 
 int main() {
 vec_mtvscr((vector unsigned int)(0));
 ; return 0; }
 EOF
-if { (eval echo configure:3968: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_altivec=-faltivec
 else
@@ -3975,14 +4013,14 @@ else
         # Linux/PPC test
         CFLAGS="$save_CFLAGS $CFLAGS_ALTIVEC -fvec"
         cat > conftest.$ac_ext <<EOF
-#line 3979 "configure"
+#line 4017 "configure"
 #include "confdefs.h"
 
 int main() {
 vec_mtvscr((vector unsigned int)(0));
 ; return 0; }
 EOF
-if { (eval echo configure:3986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4024: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_altivec="-fvec"
 else
@@ -4010,21 +4048,21 @@ EOF
 fi
 
 echo $ac_n "checking if linker needs -framework vecLib""... $ac_c" 1>&6
-echo "configure:4014: checking if linker needs -framework vecLib" >&5
+echo "configure:4052: checking if linker needs -framework vecLib" >&5
 if eval "test \"`echo '$''{'ac_cv_ld_altivec'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   save_LDFLAGS=$LDFLAGS
      LDFLAGS="$LDFLAGS -framework vecLib"
      cat > conftest.$ac_ext <<EOF
-#line 4021 "configure"
+#line 4059 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:4028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_ld_altivec=yes
 else
@@ -4056,6 +4094,11 @@ case ${target_os} in
   *mingw32*)
     SYS=mingw32
     ;;
+  *nto*)
+    SYS=nto
+    LIB_X11="${LIB_X11} -lsocket"
+    LIB_XVIDEO="${LIB_XVIDEO} -lsocket"
+    ;;
   *)
     SYS=${target_os}
     ;;
@@ -4065,7 +4108,7 @@ if test $SYS = mingw32; then
 # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
 set dummy ${ac_tool_prefix}windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4069: checking for $ac_word" >&5
+echo "configure:4112: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4097,7 +4140,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "windres", so it can be a program name with args.
 set dummy windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4101: checking for $ac_word" >&5
+echo "configure:4144: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4129,7 +4172,7 @@ else
 fi
 fi
 
-LIB_TS="-lws2_32"
+LIB_MPEG_TS="-lws2_32"
 LIB_RC="-lws2_32"
 fi
 
@@ -4140,17 +4183,17 @@ for ac_hdr in winioctl.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4144: checking for $ac_hdr" >&5
+echo "configure:4187: 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
-#line 4149 "configure"
+#line 4192 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4154: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4197: \"$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*
@@ -4183,17 +4226,17 @@ 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:4187: checking for $ac_hdr" >&5
+echo "configure:4230: 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
-#line 4192 "configure"
+#line 4235 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4197: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4240: \"$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*
@@ -4219,17 +4262,17 @@ EOF
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4223: checking for $ac_hdr" >&5
+echo "configure:4266: 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
-#line 4228 "configure"
+#line 4271 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4233: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4276: \"$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*
@@ -4259,7 +4302,7 @@ done
   LINUX_DVD_STRUCT=0
   OPENBSD_DVD_STRUCT=0
         cat > conftest.$ac_ext <<EOF
-#line 4263 "configure"
+#line 4306 "configure"
 #include "confdefs.h"
 #include <sys/cdio.h>
 EOF
@@ -4272,7 +4315,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
 EOF
 
     cat > conftest.$ac_ext <<EOF
-#line 4276 "configure"
+#line 4319 "configure"
 #include "confdefs.h"
 #include <sys/cdio.h>
 EOF
@@ -4292,7 +4335,7 @@ fi
 rm -f conftest*
 
         cat > conftest.$ac_ext <<EOF
-#line 4296 "configure"
+#line 4339 "configure"
 #include "confdefs.h"
 #include <sys/dvdio.h>
 EOF
@@ -4305,7 +4348,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
 EOF
 
     cat > conftest.$ac_ext <<EOF
-#line 4309 "configure"
+#line 4352 "configure"
 #include "confdefs.h"
 #include <sys/dvdio.h>
 EOF
@@ -4325,7 +4368,7 @@ fi
 rm -f conftest*
 
         cat > conftest.$ac_ext <<EOF
-#line 4329 "configure"
+#line 4372 "configure"
 #include "confdefs.h"
 #include <linux/cdrom.h>
 EOF
@@ -4344,7 +4387,7 @@ rm -f conftest*
 
         NEED_BSDI_LIBDVD=0
   cat > conftest.$ac_ext <<EOF
-#line 4348 "configure"
+#line 4391 "configure"
 #include "confdefs.h"
 #include <dvd.h>
 EOF
@@ -4366,17 +4409,17 @@ else
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4370: checking for $ac_hdr" >&5
+echo "configure:4413: 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
-#line 4375 "configure"
+#line 4418 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4380: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4423: \"$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*
@@ -4416,17 +4459,17 @@ rm -f conftest*
 
         ac_safe=`echo "sys/scsi/scsi_types.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/scsi/scsi_types.h""... $ac_c" 1>&6
-echo "configure:4420: checking for sys/scsi/scsi_types.h" >&5
+echo "configure:4463: checking for sys/scsi/scsi_types.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
-#line 4425 "configure"
+#line 4468 "configure"
 #include "confdefs.h"
 #include <sys/scsi/scsi_types.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4430: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4473: \"$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*
@@ -4445,17 +4488,17 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   
     ac_safe=`echo "sys/scsi/impl/uscsi.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/scsi/impl/uscsi.h""... $ac_c" 1>&6
-echo "configure:4449: checking for sys/scsi/impl/uscsi.h" >&5
+echo "configure:4492: checking for sys/scsi/impl/uscsi.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
-#line 4454 "configure"
+#line 4497 "configure"
 #include "confdefs.h"
 #include <sys/scsi/impl/uscsi.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4459: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4502: \"$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*
@@ -4512,6 +4555,19 @@ fi
 done
 
 
+
+case ${target_os} in
+  bsdi*)
+    SYS=bsdi
+    ;;
+  darwin*)
+    SYS=darwin
+    ;;
+  *)
+    SYS=${target_os}
+    ;;
+esac
+
 # Check whether --with-tuning or --without-tuning was given.
 if test "${with_tuning+set}" = set; then
   withval="$with_tuning"
@@ -4610,7 +4666,7 @@ if test "${enable_pth+set}" = set; then
   enableval="$enable_pth"
    if test x$enableval = xyes; then
     echo $ac_n "checking for pth_init in -lpth""... $ac_c" 1>&6
-echo "configure:4614: checking for pth_init in -lpth" >&5
+echo "configure:4670: checking for pth_init in -lpth" >&5
 ac_lib_var=`echo pth'_'pth_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4618,7 +4674,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpth  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4622 "configure"
+#line 4678 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4629,7 +4685,7 @@ int main() {
 pth_init()
 ; return 0; }
 EOF
-if { (eval echo configure:4633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4689: \"$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
@@ -4657,7 +4713,7 @@ else
 fi
 
     cat > conftest.$ac_ext <<EOF
-#line 4661 "configure"
+#line 4717 "configure"
 #include "confdefs.h"
 #include <pth.h>
 EOF
@@ -4778,7 +4834,7 @@ fi
 if test x$enable_vcd != xno
 then
   cat > conftest.$ac_ext <<EOF
-#line 4782 "configure"
+#line 4838 "configure"
 #include "confdefs.h"
 #include <linux/cdrom.h>
 EOF
@@ -4828,40 +4884,41 @@ if test "${enable_rc+set}" = set; then
   :
 fi
 
+
 if test x$enable_rc != xno
 then
   BUILTINS="${BUILTINS} rc"
 fi
 
-# Check whether --with-libmad or --without-libmad was given.
-if test "${with_libmad+set}" = set; then
-  withval="$with_libmad"
+# Check whether --with-mad or --without-mad was given.
+if test "${with_mad+set}" = set; then
+  withval="$with_mad"
    if test "x$with_val" != "xno"; then
       if test -n $with_val; then
-           CFLAGS_MAD_ADEC="-I$with_val/include"
-        LIB_MAD_ADEC="-L$with_val/lib -lmad"
+           CFLAGS_MAD="-I$with_val/include"
+        LIB_MAD="-L$with_val/lib -lmad"
       else
-        LIB_MAD_ADEC="-lmad"
+        LIB_MAD="-lmad"
       fi
       save_CFLAGS=$CFLAGS
       save_LDFLAGS=$LDFLAGS
-      CFLAGS="$CFLAGS $CFLAGS_MAD_ADEC"
-      LDFLAGS="$LDFLAGS $LIB_MAD_ADEC"
+      CFLAGS="$CFLAGS $CFLAGS_MAD"
+      LDFLAGS="$LDFLAGS $LIB_MAD"
       for ac_hdr in mad.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4855: checking for $ac_hdr" >&5
+echo "configure:4912: 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
-#line 4860 "configure"
+#line 4917 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4865: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4922: \"$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*
@@ -4891,7 +4948,7 @@ fi
 done
 
       echo $ac_n "checking for mad_bit_init in -lmad""... $ac_c" 1>&6
-echo "configure:4895: checking for mad_bit_init in -lmad" >&5
+echo "configure:4952: checking for mad_bit_init in -lmad" >&5
 ac_lib_var=`echo mad'_'mad_bit_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4899,7 +4956,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lmad  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4903 "configure"
+#line 4960 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4910,7 +4967,7 @@ int main() {
 mad_bit_init()
 ; return 0; }
 EOF
-if { (eval echo configure:4914: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4971: \"$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
@@ -4942,7 +4999,7 @@ fi
 
       CFLAGS=$save_CFLAGS
       LDFLAGS=$save_LDFLAGS
-      BUILTINS="${BUILTINS} mad_adec"
+      PLUGINS="${PLUGINS} mad"
     fi 
 fi
 
@@ -4979,7 +5036,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:4983: checking for $ac_word" >&5
+echo "configure:5040: 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
@@ -5030,7 +5087,7 @@ if test "${enable_arts+set}" = set; then
      # Extract the first word of "artsc-config", so it can be a program name with args.
 set dummy artsc-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5034: checking for $ac_word" >&5
+echo "configure:5091: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_ARTS_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5087,17 +5144,17 @@ else
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5091: checking for $ac_hdr" >&5
+echo "configure:5148: 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
-#line 5096 "configure"
+#line 5153 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5101: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5158: \"$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*
@@ -5141,17 +5198,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5145: checking for $ac_hdr" >&5
+echo "configure:5202: 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
-#line 5150 "configure"
+#line 5207 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5212: \"$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*
@@ -5229,7 +5286,7 @@ fi
   # Extract the first word of "sdl12-config", so it can be a program name with args.
 set dummy sdl12-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5233: checking for $ac_word" >&5
+echo "configure:5290: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_SDL12_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5269,7 +5326,7 @@ fi
     # Extract the first word of "sdl11-config", so it can be a program name with args.
 set dummy sdl11-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5273: checking for $ac_word" >&5
+echo "configure:5330: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_SDL11_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5310,7 +5367,7 @@ fi
     # Extract the first word of "sdl-config", so it can be a program name with args.
 set dummy sdl-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5314: checking for $ac_word" >&5
+echo "configure:5371: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_SDL_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5356,17 +5413,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5360: checking for $ac_hdr" >&5
+echo "configure:5417: 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
-#line 5365 "configure"
+#line 5422 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5370: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5427: \"$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*
@@ -5436,17 +5493,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5440: checking for $ac_hdr" >&5
+echo "configure:5497: 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
-#line 5445 "configure"
+#line 5502 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5450: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5507: \"$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*
@@ -5475,7 +5532,7 @@ done
 
     else
       echo $ac_n "checking for directX headers in ${withval}""... $ac_c" 1>&6
-echo "configure:5479: checking for directX headers in ${withval}" >&5
+echo "configure:5536: checking for directX headers in ${withval}" >&5
       if test -f ${withval}/include/directx.h
       then
         PLUGINS="${PLUGINS} directx"
@@ -5558,7 +5615,7 @@ if test "${enable_gnome+set}" = set; then
     # Extract the first word of "gnome-config", so it can be a program name with args.
 set dummy gnome-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5562: checking for $ac_word" >&5
+echo "configure:5619: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GNOME_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5603,17 +5660,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5607: checking for $ac_hdr" >&5
+echo "configure:5664: 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
-#line 5612 "configure"
+#line 5669 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5674: \"$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*
@@ -5673,7 +5730,7 @@ fi
   # Extract the first word of "gtk-config", so it can be a program name with args.
 set dummy gtk-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5677: checking for $ac_word" >&5
+echo "configure:5734: 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
@@ -5719,17 +5776,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5723: checking for $ac_hdr" >&5
+echo "configure:5780: 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
-#line 5728 "configure"
+#line 5785 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5733: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5790: \"$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*
@@ -5785,17 +5842,17 @@ if test x$enable_x11 != xno &&
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5789: checking for $ac_hdr" >&5
+echo "configure:5846: 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
-#line 5794 "configure"
+#line 5851 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5799: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5856: \"$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*
@@ -5816,7 +5873,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
 #define $ac_tr_hdr 1
 EOF
  
-    PLUGINS="${PLUGINS} x11"
+    #PLUGINS="${PLUGINS} x11"
     LIB_X11="-L$x_libraries -lX11 -lXext"
     CFLAGS_X11="-I$x_includes"
   
@@ -5848,17 +5905,17 @@ if test x$enable_xvideo != xno &&
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5852: checking for $ac_hdr" >&5
+echo "configure:5909: 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
-#line 5857 "configure"
+#line 5914 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5862: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5919: \"$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*
@@ -5898,17 +5955,17 @@ if test "${enable_alsa+set}" = set; then
    then
      ac_safe=`echo "alsa/asoundlib.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for alsa/asoundlib.h""... $ac_c" 1>&6
-echo "configure:5902: checking for alsa/asoundlib.h" >&5
+echo "configure:5959: checking for alsa/asoundlib.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5907 "configure"
+#line 5964 "configure"
 #include "confdefs.h"
 #include <alsa/asoundlib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5912: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5969: \"$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*
@@ -5925,7 +5982,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:5929: checking for main in -lasound" >&5
+echo "configure:5986: 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
@@ -5933,14 +5990,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lasound  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5937 "configure"
+#line 5994 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:5944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6001: \"$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
@@ -6264,13 +6321,13 @@ s%@LIB_GTK@%$LIB_GTK%g
 s%@LIB_KDE@%$LIB_KDE%g
 s%@LIB_LIBDVDCSS@%$LIB_LIBDVDCSS%g
 s%@LIB_MACOSX@%$LIB_MACOSX%g
-s%@LIB_MAD_ADEC@%$LIB_MAD_ADEC%g
+s%@LIB_MAD@%$LIB_MAD%g
+s%@LIB_MPEG_TS@%$LIB_MPEG_TS%g
 s%@LIB_NCURSES@%$LIB_NCURSES%g
 s%@LIB_QNX@%$LIB_QNX%g
 s%@LIB_QT@%$LIB_QT%g
 s%@LIB_RC@%$LIB_RC%g
 s%@LIB_SDL@%$LIB_SDL%g
-s%@LIB_TS@%$LIB_TS%g
 s%@LIB_X11@%$LIB_X11%g
 s%@LIB_XVIDEO@%$LIB_XVIDEO%g
 s%@LIB_YUV@%$LIB_YUV%g
@@ -6282,7 +6339,7 @@ s%@CFLAGS_LIBDVDCSS@%$CFLAGS_LIBDVDCSS%g
 s%@CFLAGS_ARTS@%$CFLAGS_ARTS%g
 s%@CFLAGS_ESD@%$CFLAGS_ESD%g
 s%@CFLAGS_GTK@%$CFLAGS_GTK%g
-s%@CFLAGS_MAD_ADEC@%$CFLAGS_MAD_ADEC%g
+s%@CFLAGS_MAD@%$CFLAGS_MAD%g
 s%@CFLAGS_SDL@%$CFLAGS_SDL%g
 s%@CFLAGS_X11@%$CFLAGS_X11%g
 s%@OBJ_DVD@%$OBJ_DVD%g
index 229c8ff9821fb10af07f314a0a627e8138cf1392..99d696dd8e4da56bf1353e520aca89f361d8144a 100644 (file)
@@ -135,6 +135,7 @@ AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
 AC_FUNC_MMAP
 AC_TYPE_SIGNAL
 AC_CHECK_LIB(dl,dlopen,LIB="${LIB} -ldl")
+AC_CHECK_LIB(m,cos,LIB_IMDCT="${LIB_IMDCT} -lm")
 AC_CHECK_LIB(m,pow,LIB_YUV="${LIB_YUV} -lm")
 
 dnl Check for pthreads - borrowed from XMMS
@@ -295,13 +296,14 @@ ARCH=${target_cpu}
 dnl
 dnl  default modules
 dnl
-BUILTINS="${BUILTINS} es ps ts memcpy yuv idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
-PLUGINS="${PLUGINS} ac3_spdif spu_dec"
+#BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy yuv2rgb8 idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
+BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
+PLUGINS="${PLUGINS} ac3_spdif spudec"
 
 dnl
 dnl  Accelerated modules
 dnl
-MMX_MODULES="memcpymmx yuvmmx idctmmx motionmmx"
+MMX_MODULES="memcpymmx idctmmx motionmmx"
 MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
 THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn"
 SSE_MODULES="imdctsse downmixsse"
@@ -407,6 +409,11 @@ case ${target_os} in
   *mingw32*)
     SYS=mingw32
     ;;
+  *nto*)
+    SYS=nto
+    LIB_X11="${LIB_X11} -lsocket"
+    LIB_XVIDEO="${LIB_XVIDEO} -lsocket"
+    ;;
   *)
     SYS=${target_os}
     ;;
@@ -417,7 +424,7 @@ dnl Windoze specific section
 dnl
 if test $SYS = mingw32; then
 AC_CHECK_TOOL(WINDRES, windres, :)
-LIB_TS="-lws2_32"
+LIB_MPEG_TS="-lws2_32"
 LIB_RC="-lws2_32"
 fi
 
@@ -513,6 +520,22 @@ AC_CHECK_HEADERS(sys/ioctl.h,[
   fi
 ])
 
+
+dnl
+dnl  Check the operating system
+dnl
+case ${target_os} in
+  bsdi*)
+    SYS=bsdi
+    ;;
+  darwin*)
+    SYS=darwin
+    ;;
+  *)
+    SYS=${target_os}
+    ;;
+esac
+
 dnl
 dnl  Special arch tuning
 dnl
@@ -749,28 +772,29 @@ dnl
 dnl  rc plugin
 dnl
 AC_ARG_ENABLE(rc,
-  [  --disable-rc            rc module (default enabled)])
+  [  --disable-rc            Remote Control module (default enabled)])
+
 if test x$enable_rc != xno
 then
   BUILTINS="${BUILTINS} rc"
 fi
 
 dnl
-dnl  libmad plugin
+dnl  mad plugin
 dnl
-AC_ARG_WITH(libmad,
-  [  --with-libmad[=PATH]    libmad module (default disabled)],
+AC_ARG_WITH(mad,
+  [  --with-mad[=PATH]       libmad module (default disabled)],
   [ if test "x$with_val" != "xno"; then
       if test -n $with_val; then
-           CFLAGS_MAD_ADEC="-I$with_val/include"
-        LIB_MAD_ADEC="-L$with_val/lib -lmad"
+           CFLAGS_MAD="-I$with_val/include"
+        LIB_MAD="-L$with_val/lib -lmad"
       else
-        LIB_MAD_ADEC="-lmad"
+        LIB_MAD="-lmad"
       fi
       save_CFLAGS=$CFLAGS
       save_LDFLAGS=$LDFLAGS
-      CFLAGS="$CFLAGS $CFLAGS_MAD_ADEC"
-      LDFLAGS="$LDFLAGS $LIB_MAD_ADEC"
+      CFLAGS="$CFLAGS $CFLAGS_MAD"
+      LDFLAGS="$LDFLAGS $LIB_MAD"
       AC_CHECK_HEADERS(mad.h, ,
       [ echo "Cannot find development headers for libmad..."
         exit 1
@@ -781,7 +805,7 @@ AC_ARG_WITH(libmad,
       ])
       CFLAGS=$save_CFLAGS
       LDFLAGS=$save_LDFLAGS
-      BUILTINS="${BUILTINS} mad_adec"
+      PLUGINS="${PLUGINS} mad"
     fi ])
 
 dnl special case for BeOS
@@ -1127,7 +1151,7 @@ if test x$enable_x11 != xno &&
   saved_CPPFLAGS=$CPPFLAGS
   CPPFLAGS="$CPPFLAGS -I$x_includes"
   AC_CHECK_HEADERS(X11/Xlib.h, [
-    PLUGINS="${PLUGINS} x11"
+    #PLUGINS="${PLUGINS} x11"
     LIB_X11="-L$x_libraries -lX11 -lXext"
     CFLAGS_X11="-I$x_includes"
   ]
@@ -1234,13 +1258,13 @@ AC_SUBST(LIB_GTK)
 AC_SUBST(LIB_KDE)
 AC_SUBST(LIB_LIBDVDCSS)
 AC_SUBST(LIB_MACOSX)
-AC_SUBST(LIB_MAD_ADEC)
+AC_SUBST(LIB_MAD)
+AC_SUBST(LIB_MPEG_TS)
 AC_SUBST(LIB_NCURSES)
 AC_SUBST(LIB_QNX)
 AC_SUBST(LIB_QT)
 AC_SUBST(LIB_RC)
 AC_SUBST(LIB_SDL)
-AC_SUBST(LIB_TS)
 AC_SUBST(LIB_X11)
 AC_SUBST(LIB_XVIDEO)
 AC_SUBST(LIB_YUV)
@@ -1253,7 +1277,7 @@ AC_SUBST(CFLAGS_LIBDVDCSS)
 AC_SUBST(CFLAGS_ARTS)
 AC_SUBST(CFLAGS_ESD)
 AC_SUBST(CFLAGS_GTK)
-AC_SUBST(CFLAGS_MAD_ADEC)
+AC_SUBST(CFLAGS_MAD)
 AC_SUBST(CFLAGS_SDL)
 AC_SUBST(CFLAGS_X11)
 
index e31cf438c7cee3938a9531c30e30e918d13802d2..1891373adb380c4487c443dc003351eab56e7989 100644 (file)
@@ -2,7 +2,7 @@ Source: vlc
 Section: graphics
 Priority: optional
 Maintainer: Samuel Hocevar <sam@zoy.org>
-Build-Depends: debhelper (>=2.2.0), xlibs-dev, libgnome-dev, libggi2-dev, libglide2-dev [i386], libesd0-dev, libsdl1.2-dev, libqt-dev, libasound2-dev [alpha i386 ia64 m68k powerpc] (>=0.9.0beta7)
+Build-Depends: debhelper (>=2.2.0), xlibs-dev, libgnome-dev, libggi2-dev, libglide2-dev [i386], libesd0-dev, libsdl1.2-dev, libqt-dev, libasound2-dev [alpha i386 ia64 m68k powerpc] (>=0.9.0beta7), libmad0-dev
 Standards-Version: 3.0.1
 
 Package: vlc
@@ -107,3 +107,12 @@ Description: Qt plugin for vlc
  VideoLAN is a free MPEG, MPEG2 and DVD software solution.
  .
  This plugin adds a Qt interface to vlc, the VideoLAN Client.
+
+Package: vlc-mad
+Architecture: any
+Depends: vlc (= ${Source-Version}), ${shlibs:Depends}
+Description: MAD plugin for vlc
+ VideoLAN is a free MPEG, MPEG2 and DVD software solution.
+ .
+ This plugin adds support for libmad, the MPEG audio decoder library, to
+ the VideoLAN Client. MAD is 100% fixed-point based.
index 6eced2e1f381dceec72645e7ce076762f50425e4..ccb865da50dc7d6ce1c26ee721e86a3accbef4e1 100755 (executable)
@@ -9,14 +9,14 @@
 export DH_COMPAT=3
 
 # Compilation options
-export CONFIG_FLAGS="--enable-release --prefix=/usr --enable-gnome --enable-gtk --enable-fb --with-ggi --enable-sdl --enable-esd --enable-qt"
+export CONFIG_FLAGS="--enable-release --prefix=/usr --enable-gnome --enable-gtk --enable-fb --with-ggi --enable-sdl --enable-esd --enable-qt --with-mad"
 export LIBDVDCSS_FLAGS="--with-dvdcss=local-shared"
 export VIDDIR="usr/share/videolan"
 export PIXDIR="usr/share/pixmaps"
 export GNOMEDIR="usr/share/gnome/apps/Multimedia"
 
 # Library options
-version=$(shell grep '^ *LIBDVDCSS_VERSION=[0-9]' configure.in | head -1 | cut -f2 -d=)
+version=$(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
 major=$(shell echo "$(version)" | cut -f1 -d.)
 
 build: build-stamp
index 1207663aade196943a31acf3ddef9d94cae91400..46201066588b1117826742486dff3cef1525df9b 100644 (file)
@@ -2,7 +2,7 @@
  * css.c: Functions for DVD authentification and unscrambling
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: css.c,v 1.16 2001/11/13 02:03:46 sam Exp $
+ * $Id: css.c,v 1.17 2001/12/09 17:01:35 sam Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *         HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
@@ -40,7 +40,6 @@
 
 #include <string.h>
 
-#include "config.h"
 #include "common.h"
 
 #include "videolan/dvdcss.h"
index 54d74bf932de7034d57bb83ee6fce83a7694260a..fe26db05f9bc12b29814ffae864e5e12fe810dc9 100644 (file)
@@ -2,7 +2,7 @@
  * ioctl.c: DVD ioctl replacement function
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ioctl.c,v 1.14 2001/10/18 23:13:46 ej Exp $
+ * $Id: ioctl.c,v 1.15 2001/12/09 17:01:35 sam Exp $
  *
  * Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
  *          Samuel Hocevar <sam@zoy.org>
@@ -69,7 +69,6 @@
 #   include <sys/scsi/impl/uscsi.h>
 #endif
 
-#include "config.h"
 #include "common.h"
 
 #ifdef SYS_DARWIN
index 947c1e945559a2b036053cd051ea2b379c24f5dc..646ba251837f6a72360081972b33f44a1005b95f 100644 (file)
@@ -2,7 +2,7 @@
  * libdvdcss.c: DVD reading library.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: libdvdcss.c,v 1.24 2001/11/27 10:18:33 massiot Exp $
+ * $Id: libdvdcss.c,v 1.25 2001/12/09 17:01:35 sam Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -45,7 +45,6 @@
 #   include <sys/uio.h>                                      /* struct iovec */
 #endif
 
-#include "config.h"
 #include "common.h"
 
 #if defined( WIN32 )
index 5a730aa8c701d517a7999c8991bd1f3d1e0e4c62..7c3aff21f504ff08cd33acda93d312098752bfeb 100644 (file)
@@ -3,7 +3,7 @@
  * Collection of useful common types and macros definitions
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: common.h,v 1.53 2001/12/07 18:33:07 sam Exp $
+ * $Id: common.h,v 1.54 2001/12/09 17:01:35 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@via.ecp.fr>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -119,10 +119,12 @@ typedef struct intf_channel_s *         p_intf_channel_t;
 struct input_thread_s;
 struct input_channel_s;
 struct input_cfg_s;
+struct input_area_s;
 
 typedef struct input_thread_s *         p_input_thread_t;
 typedef struct input_channel_s *        p_input_channel_t;
 typedef struct input_cfg_s *            p_input_cfg_t;
+typedef struct input_area_s *           p_input_area_t;
 
 /* Audio */
 struct aout_thread_s;
@@ -142,6 +144,7 @@ struct video_parser_s;
 typedef struct vout_thread_s *          p_vout_thread_t;
 typedef struct vout_font_s *            p_vout_font_t;
 typedef struct vout_sys_s *             p_vout_sys_t;
+typedef struct chroma_sys_s *           p_chroma_sys_t;
 typedef struct vdec_thread_s *          p_vdec_thread_t;
 typedef struct vpar_thread_s *          p_vpar_thread_t;
 typedef struct video_parser_s *         p_video_parser_t;
@@ -149,6 +152,11 @@ typedef struct video_parser_s *         p_video_parser_t;
 /* Misc */
 struct macroblock_s;
 struct data_packet_s;
+struct imdct_s;
+struct complex_s;
+struct dm_par_s;
+struct picture_s;
+struct picture_sys_s;
 struct es_descriptor_s;
 struct pgrm_descriptor_s;
 struct pes_packet_s;
@@ -362,11 +370,11 @@ typedef struct module_symbols_s
                                        ( int, int, long, long, long, void * );
     void ( * aout_DestroyFifo )     ( struct aout_fifo_s * );
 
-    struct vout_thread_s * (* vout_CreateThread) ( int *, int, int );
+    struct vout_thread_s * (* vout_CreateThread) ( int *, int, int, int, int );
     struct subpicture_s * (* vout_CreateSubPicture) ( struct vout_thread_s *, 
                                                       int, int );
     struct picture_s * ( * vout_CreatePicture ) ( struct vout_thread_s *, 
-                                                  int, int, int );
+                                                  int, int, int, int );
 
     void  ( * vout_DestroySubPicture )  ( struct vout_thread_s *, 
                                           struct subpicture_s * );
index c50c2d90a4343fb45064af6e848c1cf803e9edd9..3e78b4aff63d52ecb2b420176d476b7938a62b15 100644 (file)
  * since higher stream values will result in no display at all. */
 #define VOUT_MAX_WIDTH                  4096
 
+/* Number of planes in a picture */
+#define VOUT_MAX_PLANES                 5
+
 /* Video heap size - remember that a decompressed picture is big
  * (~1 Mbyte) before using huge values */
 #define VOUT_MAX_PICTURES               8
index f4ba3580590d897f2363bdaa43d2edb4e3aef9aa..c63b4079994ed540723ead96966a5560b062fa96 100644 (file)
@@ -73,9 +73,6 @@
 /* Define if you have the <Ph.h> header file.  */
 #undef HAVE_PH_H
 
-/* Define if you have the <X11/Xlib.h> header file.  */
-#undef HAVE_X11_XLIB_H
-
 /* Define if you have the <X11/extensions/Xv.h> header file.  */
 #undef HAVE_X11_EXTENSIONS_XV_H
 
index ba86301b3928b34cb737a2a5317a4f12e82f0399..8fdb60f538102686e8d68c580cf1a9580504398b 100644 (file)
@@ -4,7 +4,7 @@
  * interface, such as message output.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: interface.h,v 1.22 2001/03/21 13:42:33 sam Exp $
+ * $Id: interface.h,v 1.23 2001/12/09 17:01:35 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
  * This structe describes all interface-specific data of the main (interface)
  * thread.
  *****************************************************************************/
-typedef struct _keyparam
-{
-    int key;
-    int param;
-} keyparm;
-
-typedef struct _key
-{
-    int received_key;
-    keyparm forwarded;
-    struct _key *  next;
-} intf_key;
-
-typedef intf_key * p_intf_key;
-
 typedef struct intf_thread_s
 {
     boolean_t           b_die;                                 /* `die' flag */
@@ -66,7 +51,6 @@ typedef struct intf_thread_s
     /* Specific interfaces */
     p_intf_console_t    p_console;                                /* console */
     p_intf_sys_t        p_sys;                           /* system interface */
-    p_intf_key          p_keys;
     
     /* Plugin used and shortcuts to access its capabilities */
     struct module_s *   p_module;
@@ -83,12 +67,9 @@ typedef struct intf_thread_s
     /* Channels array - NULL if not used */
     p_intf_channel_t    p_channel;                /* description of channels */
 
-    /* Main threads - NULL if not active */
+    /* Input thread - NULL if not active */
     p_input_thread_t    p_input;
 
-    /* Specific functions */
-    keyparm (*p_intf_get_key)(struct intf_thread_s *p_intf, int r_key) ;
-
     /* XXX: new message passing stuff will go here */
     vlc_mutex_t         change_lock;
     boolean_t           b_menu_change;
@@ -102,9 +83,3 @@ typedef struct intf_thread_s
 intf_thread_t * intf_Create             ( void );
 void            intf_Destroy            ( intf_thread_t * p_intf );
 
-int             intf_ProcessKey         ( intf_thread_t * p_intf, int i_key );
-
-void intf_AssignKey( intf_thread_t *p_intf, int r_key, int f_key, int param);
-keyparm intf_GetKey( intf_thread_t *p_intf, int r_key);
-void intf_AssignNormalKeys( intf_thread_t *p_intf);
-
index 8065843b0421a5c29211d91e940e9d5c67053dcf..a7aad936767cfffeb2457c4baf6be76f57dc0736 100644 (file)
@@ -2,7 +2,7 @@
  * modules.h : Module management functions.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules.h,v 1.35 2001/12/07 18:33:07 sam Exp $
+ * $Id: modules.h,v 1.36 2001/12/09 17:01:35 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -64,7 +64,7 @@ typedef void *  module_handle_t;
 #define MODULE_CAPABILITY_IDCT     1 <<  6  /* IDCT transformation */
 #define MODULE_CAPABILITY_AOUT     1 <<  7  /* Audio output */
 #define MODULE_CAPABILITY_VOUT     1 <<  8  /* Video output */
-#define MODULE_CAPABILITY_YUV      1 <<  9  /* YUV colorspace conversion */
+#define MODULE_CAPABILITY_CHROMA   1 <<  9  /* colorspace conversion */
 #define MODULE_CAPABILITY_IMDCT    1 << 10  /* IMDCT transformation */
 #define MODULE_CAPABILITY_DOWNMIX  1 << 11  /* AC3 downmix */
 #define MODULE_CAPABILITY_MEMCPY   1 << 12  /* memcpy */
@@ -87,6 +87,13 @@ typedef struct probedata_s
     {
         char * psz_data;
     } aout;
+
+    struct
+    {
+        struct { int i_chroma; int i_width; int i_height; } source;
+        struct { int i_chroma; int i_width; int i_height; } dest;
+    } chroma;
+
 } probedata_t;
 
 /* FIXME: find a nicer way to do this. */
@@ -155,9 +162,10 @@ typedef struct function_list_s
             void ( * pf_end )        ( struct vout_thread_s * );
             void ( * pf_destroy )    ( struct vout_thread_s * );
             int  ( * pf_manage )     ( struct vout_thread_s * );
-            void ( * pf_display )    ( struct vout_thread_s * );
-            void ( * pf_setpalette ) ( struct vout_thread_s *, u16 *red,
-                                       u16 *green, u16 *blue, u16 *transp );
+            void ( * pf_display )    ( struct vout_thread_s *,
+                                       struct picture_s * );
+            void ( * pf_setpalette ) ( struct vout_thread_s *,
+                                       u16 *, u16 *, u16 * );
         } vout;
 
         /* Motion compensation plugin */
@@ -182,13 +190,13 @@ typedef struct function_list_s
             void ( * pf_norm_scan )    ( u8 ppi_scan[2][64] );
         } idct;
 
-        /* YUV transformation plugin */
+        /* Chroma transformation plugin */
         struct
         {
             int  ( * pf_init )         ( struct vout_thread_s * );
             int  ( * pf_reset )        ( struct vout_thread_s * );
             void ( * pf_end )          ( struct vout_thread_s * );
-        } yuv;
+        } chroma;
 
         /* IMDCT plugin */
         struct
@@ -247,7 +255,7 @@ typedef struct module_functions_s
     function_list_t idct;
     function_list_t aout;
     function_list_t vout;
-    function_list_t yuv;
+    function_list_t chroma;
     function_list_t imdct;
     function_list_t downmix;
     function_list_t memcpy;
index 4317a3215f1dc1d211f64d7498f1ce1002f4a175..a515c3d01cc1210dd7f1617aee657c16e1848a01 100644 (file)
@@ -31,8 +31,6 @@
     (p_symbols)->TestProgram = TestProgram; \
     (p_symbols)->TestMethod = TestMethod; \
     (p_symbols)->TestCPU = TestCPU; \
-    (p_symbols)->intf_AssignKey = intf_AssignKey; \
-    (p_symbols)->intf_ProcessKey = intf_ProcessKey; \
     (p_symbols)->intf_Msg = intf_Msg; \
     (p_symbols)->intf_ErrMsg = intf_ErrMsg; \
     (p_symbols)->intf_StatMsg = intf_StatMsg;\
 #   define TestMethod(a,b) p_symbols->TestMethod(a,b)
 #   define TestCPU(a) p_symbols->TestCPU(a)
 
-#   define intf_AssignKey(a,b,c,d) p_symbols->intf_AssignKey(a,b,c,d)
-#   define intf_ProcessKey(a,b) p_symbols->intf_ProcessKey(a,b)
-
 #   define intf_Msg p_symbols->intf_Msg
 #   define intf_ErrMsg p_symbols->intf_ErrMsg
 #   define intf_StatMsg p_symbols->intf_StatMsg
index c6d4183d761037d86ce28f7bcbfb99e5993fd66d..5c50241e4dbe9bc9b9b06c5feeed08a9530175a0 100644 (file)
@@ -2,7 +2,7 @@
  * vdec_ext-plugins.h : structures from the video decoder exported to plug-ins
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: vdec_ext-plugins.h,v 1.7 2001/10/11 16:12:43 massiot Exp $
+ * $Id: vdec_ext-plugins.h,v 1.8 2001/12/09 17:01:35 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -63,7 +63,8 @@ typedef struct macroblock_s
     /* Motion compensation information */
     motion_inner_t          p_motions[8];
     int                     i_nb_motions;
-    yuv_data_t *            pp_dest[3];
+    pixel_data_t *          pp_dest[3];
+
 } macroblock_t;
 
 /* Macroblock Modes */
index 2e5e50a15954e5c1c4eec9f212339069c4a12b85..1d5fb3d0127fa9b4e42650d135102398ea85b50a 100644 (file)
@@ -4,7 +4,7 @@
  * includes all common video types and constants.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video.h,v 1.32 2001/08/22 17:21:45 massiot Exp $
+ * $Id: video.h,v 1.33 2001/12/09 17:01:35 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
  *  "mtime.h"
  *****************************************************************************/
 
+/*****************************************************************************
+ * plane_t: description of a planar graphic field
+ *****************************************************************************/
+typedef u8 pixel_data_t;
+
+typedef struct plane_s
+{
+    pixel_data_t *p_data;
+    int           i_bytes;
+} plane_t;
+
 /*****************************************************************************
  * picture_t: video picture
  *****************************************************************************
  *****************************************************************************/
 typedef struct picture_s
 {
+    /* Picture data - data can always be freely modified, but no pointer
+     * may EVER be modified. A direct buffer can be handled as the plugin
+     * wishes, but for internal video output pictures the allocated pointer
+     * MUST be planes[0].p_data */
+    plane_t         planes[ VOUT_MAX_PLANES ];  /* description of the planes */
+    int             i_planes;                  /* number of allocated planes */
+
     /* Type and flags - should NOT be modified except by the vout thread */
-    int             i_type;                                  /* picture type */
     int             i_status;                               /* picture flags */
     int             i_matrix_coefficients;     /* in YUV type, encoding type */
 
     /* Picture management properties - these properties can be modified using
-     * the video output thread API, but should ne be written directly */
+     * the video output thread API, but should never be written directly */
     int             i_refcount;                    /* link reference counter */
     mtime_t         date;                                    /* display date */
 
     /* Picture static properties - those properties are fixed at initialization
      * and should NOT be modified */
     int             i_width;                                /* picture width */
-    int             i_chroma_width;                          /* chroma width */
     int             i_height;                              /* picture height */
-    int             i_size;                                /* number of pels */
-    int             i_chroma_size;                  /* number of chroma pels */
+    int             i_chroma;                              /* picture chroma */
+    int             i_aspect_ratio;                          /* aspect ratio */
+    boolean_t       b_directbuffer;               /* is it a direct buffer ? */
+
+    /* These values can be calculated from i_chroma, i_width and i_height
+     * but we leave them to prevent unnecessary calculation */
+    int             i_size;
+    int             i_chroma_width;
+    int             i_chroma_size;
+
+    /* Picture margins - needed because of possible padding issues */
+    int             i_left_margin;
+    int             i_right_margin;
+    int             i_top_margin;
+    int             i_bottom_margin;
 
     /* Picture dynamic properties - those properties can be changed by the
      * decoder */
-    int             i_display_horizontal_offset;   /* ISO/IEC 13818-2 6.3.12 */
-    int             i_display_vertical_offset;     /* ISO/IEC 13818-2 6.3.12 */
-    int             i_display_width;                 /* useful picture width */
-    int             i_display_height;               /* useful picture height */
-    int             i_aspect_ratio;                          /* aspect ratio */
+    boolean_t       b_progressive_frame;      /* is it a progressive frame ? */
+    boolean_t       b_repeat_first_field;                         /* RFF bit */
+    boolean_t       b_top_field_first;               /* which field is first */
+
+    /* Macroblock counter - the decoder use it to verify if it has
+     * decoded all the macroblocks of the picture */
+    int             i_deccount;
+    vlc_mutex_t     lock_deccount;
+
+    /* Private data - the video output plugin might want to put stuff here to
+     * keep track of the picture */
+    struct picture_sys_s *p_sys;
 
-    /* Picture data - data can always be freely modified. p_data itself
-     * (the pointer) should NEVER be modified. In YUV format, the p_y, p_u and
-     * p_v data pointers refers to different areas of p_data, and should not
-     * be freed */
-    void *          p_data;                                  /* picture data */
-    yuv_data_t *    p_y;        /* pointer to beginning of Y image in p_data */
-    yuv_data_t *    p_u;        /* pointer to beginning of U image in p_data */
-    yuv_data_t *    p_v;        /* pointer to beginning of V image in p_data */
 } picture_t;
 
-/* Pictures types */
+/* Pictures chromas */
 #define EMPTY_PICTURE           0     /* picture slot is empty and available */
 #define YUV_420_PICTURE         100                     /* 4:2:0 YUV picture */
 #define YUV_422_PICTURE         101                     /* 4:2:2 YUV picture */
 #define YUV_444_PICTURE         102                     /* 4:4:4 YUV picture */
+#define RGB_8BPP_PICTURE        200                      /* RGB 8bpp picture */
+#define RGB_16BPP_PICTURE       201                     /* RGB 16bpp picture */
+#define RGB_32BPP_PICTURE       202                     /* RGB 32bpp picture */
 
 /* Pictures status */
 #define FREE_PICTURE            0                  /* free and not allocated */
@@ -97,6 +128,23 @@ typedef struct picture_s
 #define AR_16_9_PICTURE         3              /* 16:9 picture (wide screen) */
 #define AR_221_1_PICTURE        4                  /* 2.21:1 picture (movie) */
 
+/* Plane indices */
+#define YUV_PLANE               0
+#define RGB_PLANE               0
+#define Y_PLANE                 0
+#define U_PLANE                 1
+#define V_PLANE                 2
+#define Cb_PLANE                1
+#define Cr_PLANE                2
+#define R_PLANE                 0
+#define G_PLANE                 1
+#define B_PLANE                 2
+
+/* Shortcuts */
+#define P_Y planes[ Y_PLANE ].p_data
+#define P_U planes[ U_PLANE ].p_data
+#define P_V planes[ V_PLANE ].p_data
+
 /*****************************************************************************
  * subpicture_t: video subtitle
  *****************************************************************************
index dd4885a797f9290ed339ddbc98a66030cceb5713..e3e2be0a336c13f7dfced84233c3694e2c9c1201 100644 (file)
@@ -5,7 +5,7 @@
  * thread, and destroy a previously oppenned video output thread.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_output.h,v 1.63 2001/10/01 16:18:48 massiot Exp $
+ * $Id: video_output.h,v 1.64 2001/12/09 17:01:35 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -42,64 +42,31 @@ typedef struct vout_bank_s
 extern vout_bank_t *p_vout_bank;
 
 /*****************************************************************************
- * vout_yuv_convert_t: YUV conversion function
+ * vout_chroma_t: Chroma conversion function
  *****************************************************************************
- * This is the prototype common to all conversion functions. The type of p_pic
- * will change depending on the processed screen depth.
+ * This is the prototype common to all conversion functions.
  * Parameters:
- *      p_vout                          video output thread
- *      p_pic                           picture address
- *      p_y, p_u, p_v                   Y,U,V samples addresses
- *      i_width, i_height               Y samples extension
- *      i_pic_width, i_pic_height       picture extension
- *      i_pic_line_width                picture total line width
- *      i_matrix_coefficients           matrix coefficients
+ *      p_source                        source picture
+ *      p_dest                          destination picture
  * Picture width and source dimensions must be multiples of 16.
  *****************************************************************************/
-typedef void (vout_yuv_convert_t)( p_vout_thread_t p_vout, void *p_pic,
-                                   yuv_data_t *p_y, yuv_data_t *p_u, yuv_data_t *p_v,
-                                   int i_width, int i_height,
-                                   int i_pic_width, int i_pic_height, int i_pic_line_width,
-                                   int i_matrix_coefficients );
+typedef void (vout_chroma_convert_t)( picture_t *p_source, picture_t *p_dest );
 
-/*****************************************************************************
- * vout_yuv_t: pre-calculated YUV conversion tables
- *****************************************************************************
- * These tables are used by conversion and scaling functions.
- *****************************************************************************/
-typedef int  (yuv_init_t)           ( p_vout_thread_t p_vout );
-typedef int  (yuv_reset_t)          ( p_vout_thread_t p_vout );
-typedef void (yuv_end_t)            ( p_vout_thread_t p_vout );
-
-typedef struct vout_yuv_s
+typedef struct vout_chroma_s
 {
     /* conversion functions */
-    vout_yuv_convert_t *pf_yuv420;                    /* YUV 4:2:0 converter */
-    vout_yuv_convert_t *pf_yuv422;                    /* YUV 4:2:2 converter */
-    vout_yuv_convert_t *pf_yuv444;                    /* YUV 4:4:4 converter */
-
-    /* Pre-calculated conversion tables */
-    void *              p_base;            /* base for all conversion tables */
-    union
-    {
-        u8 *            p_gray8;                        /* gray 8 bits table */
-        u16 *           p_gray16;                      /* gray 16 bits table */
-        u32 *           p_gray32;                      /* gray 32 bits table */
-        u8 *            p_rgb8;                          /* RGB 8 bits table */
-        u16 *           p_rgb16;                        /* RGB 16 bits table */
-        u32 *           p_rgb32;                        /* RGB 32 bits table */
-    } yuv;
-
-    /* Temporary conversion buffer and offset array */
-    void *              p_buffer;                       /* conversion buffer */
-    int *               p_offset;                            /* offset array */
+    vout_chroma_convert_t *pf_convert;
+
+    /* Private module-dependant data */
+    p_chroma_sys_t      p_sys;                               /* private data */
 
     /* Plugin used and shortcuts to access its capabilities */
     struct module_s *   p_module;
-    yuv_init_t *        pf_init;                    /* initialize YUV tables */
-    yuv_reset_t *       pf_reset;                        /* reset YUV tables */
-    yuv_end_t *         pf_end;                           /* free YUV tables */
-} vout_yuv_t;
+    int  ( * pf_init )  ( struct vout_thread_s * );
+    int  ( * pf_reset ) ( struct vout_thread_s * );
+    void ( * pf_end )   ( struct vout_thread_s * );
+
+} vout_chroma_t;
 
 /*****************************************************************************
  * vout_buffer_t: rendering buffer
@@ -132,9 +99,6 @@ typedef struct vout_fifo_s
     boolean_t           b_die;
     int                 i_fifo;      /* Just to keep track of the fifo index */
 
-    int                 i_width;
-    int                 i_height;
-
     vlc_mutex_t         data_lock;
     vlc_cond_t          data_wait;
 
@@ -164,16 +128,15 @@ typedef struct vout_thread_s
     int *               pi_status;                  /* temporary status flag */
     p_vout_sys_t        p_sys;                       /* system output method */
                                                                    
+    /* Current input properties */
+    int                 i_width;                      /* current input width */
+    int                 i_height;                    /* current input height */
+    int                 i_chroma;                    /* current input chroma */
+    int                 i_aspect_ratio;        /* current input aspect ratio */
+
     /* Current display properties */
     u16                 i_changes;             /* changes made to the thread */
-    int                 i_width;              /* current output method width */
-    int                 i_height;            /* current output method height */
-    int                 i_bytes_per_line;  /* bytes per line (incl. virtual) */
-    int                 i_screen_depth;  /* significant bpp: 8, 15, 16 or 24 */
-    int                 i_bytes_per_pixel;/* real screen depth: 1, 2, 3 or 4 */
     float               f_gamma;                                    /* gamma */
-    boolean_t           b_need_render;  /* does the output method need a YUV 
-                                         * conversion ?                      */
 
     /* Color masks and shifts in RGB mode - masks are set by system
      * initialization, shifts are calculated. A pixel color value can be
@@ -194,46 +157,36 @@ typedef struct vout_thread_s
 
     /* Plugin used and shortcuts to access its capabilities */
     struct module_s *   p_module;
-    int  ( *pf_create )     ( struct vout_thread_s * );
-    int  ( *pf_init )       ( struct vout_thread_s * );
-    void ( *pf_end )        ( struct vout_thread_s * );
-    void ( *pf_destroy )    ( struct vout_thread_s * );
-    int  ( *pf_manage )     ( struct vout_thread_s * );
-    void ( *pf_display )    ( struct vout_thread_s * );
-    void ( *pf_setpalette ) ( struct vout_thread_s *, u16 *red,
-                              u16 *green, u16 *blue, u16 *transp );
-    void ( *pf_setbuffers ) ( struct vout_thread_s *, void *, void * );
+    int              ( *pf_create )     ( struct vout_thread_s * );
+    int              ( *pf_init )       ( struct vout_thread_s * );
+    void             ( *pf_end )        ( struct vout_thread_s * );
+    void             ( *pf_destroy )    ( struct vout_thread_s * );
+    int              ( *pf_manage )     ( struct vout_thread_s * );
+    void             ( *pf_display )    ( struct vout_thread_s *,
+                                          struct picture_s * );
+    void             ( *pf_setpalette ) ( struct vout_thread_s *,
+                                          u16 *, u16 *, u16 * );
 
     /* Pictures and rendering properties */
     boolean_t           b_grayscale;           /* color or grayscale display */
-    boolean_t           b_YCbr;            /* use YUV to YCbr instead of RGB */
     boolean_t           b_info;              /* print additional information */
     boolean_t           b_interface;                     /* render interface */
     boolean_t           b_scale;                    /* allow picture scaling */
-    boolean_t           b_fullscreen;           /* toogle fullscreen dusplay */
+    boolean_t           b_fullscreen;           /* toogle fullscreen display */
     mtime_t             render_time;             /* last picture render time */
 
-
-    /* Idle screens management */
-    mtime_t             last_display_date;     /* last non idle display date */
-    mtime_t             last_idle_date;            /* last idle display date */
-    mtime_t             init_display_date;
-
     /* Statistics - these numbers are not supposed to be accurate, but are a
      * good indication of the thread status */
     count_t             c_fps_samples;                     /* picture counts */
     mtime_t             p_fps_sample[VOUT_FPS_SAMPLES]; /* FPS samples dates */
 
-    /* Rendering buffers */
-    int                 i_buffer_index;                      /* buffer index */
-    vout_buffer_t       p_buffer[2];                   /* buffers properties */
-
     /* Video heap and translation tables */
     picture_t           p_picture[VOUT_MAX_PICTURES];            /* pictures */
     subpicture_t        p_subpicture[VOUT_MAX_PICTURES];      /* subpictures */
+    int                 i_directbuffers;       /* number of pictures in VRAM */
     int                 i_pictures;                     /* current heap size */
-    vout_yuv_t          yuv;                           /* translation tables */
-    picture_t *         p_rendered_pic;  /* picture currently being rendered */
+
+    vout_chroma_t       chroma;                        /* translation tables */
 
     /* Bitmap fonts */
     p_vout_font_t       p_default_font;                      /* default font */
@@ -258,7 +211,7 @@ typedef struct vout_thread_s
 #define VOUT_FULLSCREEN_CHANGE  0x0040               /* b_fullscreen changed */
 #define VOUT_SIZE_CHANGE        0x0200                       /* size changed */
 #define VOUT_DEPTH_CHANGE       0x0400                      /* depth changed */
-#define VOUT_YUV_CHANGE         0x0800                  /* change yuv tables */
+#define VOUT_CHROMA_CHANGE      0x0800               /* change chroma tables */
 
 /* Disabled for thread deadlocks issues --Meuuh */
 //#define VOUT_NODISPLAY_CHANGE   0xff00    /* changes which forbidden display */
@@ -279,25 +232,28 @@ typedef struct vout_thread_s
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
-void            vout_InitBank           ( void );
-void            vout_EndBank            ( void );
-
-vout_thread_t * vout_CreateThread   ( int *pi_status, int i_width, int i_height );
-void            vout_DestroyThread  ( vout_thread_t *p_vout, int *pi_status );
-
-vout_fifo_t *   vout_CreateFifo         ( void );
-void            vout_DestroyFifo        ( vout_fifo_t *p_fifo );
-void            vout_FreeFifo           ( vout_fifo_t *p_fifo );
-
-picture_t *     vout_CreatePicture  ( vout_thread_t *p_vout, int i_type,
-                                      int i_width, int i_height );
-void            vout_DestroyPicture ( vout_thread_t *p_vout, picture_t *p_pic );
-void            vout_DisplayPicture ( vout_thread_t *p_vout, picture_t *p_pic );
-void            vout_DatePicture    ( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date );
-void            vout_LinkPicture    ( vout_thread_t *p_vout, picture_t *p_pic );
-void            vout_UnlinkPicture  ( vout_thread_t *p_vout, picture_t *p_pic );
-
-subpicture_t *  vout_CreateSubPicture   ( vout_thread_t *p_vout, int i_type, int i_size );
-void            vout_DestroySubPicture  ( vout_thread_t *p_vout, subpicture_t *p_subpic );
-void            vout_DisplaySubPicture  ( vout_thread_t *p_vout, subpicture_t *p_subpic );
+void            vout_InitBank       ( void );
+void            vout_EndBank        ( void );
+
+vout_thread_t * vout_CreateThread   ( int *pi_status, int, int, int, int );
+void            vout_DestroyThread  ( vout_thread_t *, int *pi_status );
+
+vout_fifo_t *   vout_CreateFifo     ( void );
+void            vout_DestroyFifo    ( vout_fifo_t * );
+void            vout_FreeFifo       ( vout_fifo_t * );
+
+picture_t *     vout_CreatePicture  ( vout_thread_t *, int, int, int, int );
+void            vout_DestroyPicture ( vout_thread_t *, picture_t * );
+void            vout_DisplayPicture ( vout_thread_t *, picture_t * );
+void            vout_DatePicture    ( vout_thread_t *, picture_t *, mtime_t );
+void            vout_LinkPicture    ( vout_thread_t *, picture_t * );
+void            vout_UnlinkPicture  ( vout_thread_t *, picture_t * );
+picture_t *     vout_RenderPicture  ( vout_thread_t *, picture_t *,
+                                                       subpicture_t * );
+
+subpicture_t *  vout_CreateSubPicture   ( vout_thread_t *, int, int );
+void            vout_DestroySubPicture  ( vout_thread_t *, subpicture_t * );
+void            vout_DisplaySubPicture  ( vout_thread_t *, subpicture_t * );
+subpicture_t *  vout_SortSubPictures    ( vout_thread_t *, mtime_t );
+void            vout_RenderSubPictures  ( picture_t *, subpicture_t * );
 
index d6b3044b46edc5841aa8ea34d9641897fc8d972c..b693687a2d09e16529c8ac1a78b10d8dbdda05f1 100755 (executable)
@@ -7,7 +7,7 @@
 export CC=arm-linux-gcc
 export LD=arm-linux-ld
 export STRIP=arm-linux-strip
-export CONFIG_FLAGS="--enable-release --prefix=/usr --disable-gtk --enable-fb --enable-sdl --disable-xvideo --disable-plugins --with-tuning=strongarm1100 --x-includes=/skiff/local/arm-linux/include --x-libraries=/skiff/local/arm-linux/lib/X11 --with-sdl-config-path=/skiff/local/bin --with-libmad=/skiff/local/arm-linux"
+export CONFIG_FLAGS="--enable-release --prefix=/usr --disable-gtk --enable-fb --enable-sdl --disable-xvideo --disable-plugins --with-tuning=strongarm1100 --x-includes=/skiff/local/arm-linux/include --x-libraries=/skiff/local/arm-linux/lib/X11 --with-sdl-config-path=/skiff/local/bin --with-mad=/skiff/local/arm-linux"
 export LIBDVDCSS_FLAGS="--with-dvdcss=local-static"
 export VIDDIR="usr/share/videolan"
 export PIXDIR="usr/share/pixmaps"
index 0633e762328e8d9ea13bdb5e45476d4cf8417122..50211fde6a6a08f9a1e60e8a62e610f2f6dc9948 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_adec.c: ac3 decoder module main file
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_adec.c,v 1.5 2001/12/03 16:18:37 sam Exp $
+ * $Id: ac3_adec.c,v 1.6 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Michel Lespinasse <walken@zoy.org>
  *
@@ -36,7 +36,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                              /* memset() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 #include "threads.h"
index 55d1aa09a46a4ca01df48516a4211ca416585c16..419a32c8d55e105e30564fda619daff84efd76fa 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_bit_allocate.c: ac3 allocation tables
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: ac3_bit_allocate.c,v 1.3 2001/11/28 15:08:04 massiot Exp $
+ * $Id: ac3_bit_allocate.c,v 1.4 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -30,7 +30,6 @@
 
 #include <string.h>                                              /* memcpy() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index c49d25e8aa36d33ebb250352335570235ecfab42..ad0cbc5eb2242c72cb77e066595028cc4029c440 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_decoder.c: core ac3 decoder
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_decoder.c,v 1.3 2001/11/28 15:08:04 massiot Exp $
+ * $Id: ac3_decoder.c,v 1.4 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Michel Lespinasse <walken@zoy.org>
@@ -30,7 +30,6 @@
 
 #include <string.h>                                              /* memcpy() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 #include "threads.h"
index bab0a4539e8c92f18692dbeeee2f2560190b6245..c9f6b452eb7918d04808bba38df946df7e673032 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_exponent.c: ac3 exponent calculations
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_exponent.c,v 1.3 2001/11/28 15:08:04 massiot Exp $
+ * $Id: ac3_exponent.c,v 1.4 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Michel Lespinasse <walken@zoy.org>
@@ -30,7 +30,6 @@
 
 #include <string.h>                                    /* memcpy(), memset() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 #include "threads.h"
index 27901f9cb77cb0b9acd3f0851b1778e76cdc2813..980f7bd193dcd53ab859ee9f36833087321b430a 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_imdct.c: ac3 DCT
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_imdct.c,v 1.4 2001/11/28 15:08:04 massiot Exp $
+ * $Id: ac3_imdct.c,v 1.5 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -33,7 +33,6 @@
 #include <math.h>
 #include <stdio.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index 037bc016f816686d51d94a27427b1522b157d7d7..c4f95d78c55b3f878531ed539af58ff0a156a92c 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_mantissa.c: ac3 mantissa computation
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_mantissa.c,v 1.3 2001/11/28 15:08:04 massiot Exp $
+ * $Id: ac3_mantissa.c,v 1.4 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -30,7 +30,6 @@
 
 #include <string.h>                                              /* memcpy() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index a14c17ba128524e41876cbcf21b57ac08d422594..3d1aba7e92e9e8449fb77f8c7c448c53e83cef7d 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_parse.c: ac3 parsing procedures
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_parse.c,v 1.3 2001/11/28 15:08:04 massiot Exp $
+ * $Id: ac3_parse.c,v 1.4 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -30,7 +30,6 @@
 
 #include <string.h>                                              /* memset() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index 16f659ec068be601bddaefaed4213d03fda745f4..b7a7a30f03c2a1e9556f444f537bc70ca7983a99 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_rematrix.c: ac3 audio rematrixing
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_rematrix.c,v 1.3 2001/11/28 15:08:04 massiot Exp $
+ * $Id: ac3_rematrix.c,v 1.4 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -29,7 +29,6 @@
 
 #include <string.h>                                              /* memcpy() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index 3152c1209dc27025dd4835330ae1834960f94bfd..bd4722ba783ca832bd6cc287118e115db295d209 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_iec958.c: ac3 to spdif converter
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: ac3_iec958.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
+ * $Id: ac3_iec958.c,v 1.3 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          Juha Yrjola <jyrjola@cc.hut.fi>
@@ -37,7 +37,6 @@
 #include <unistd.h>
 #endif
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 #include "threads.h"
index b6e98bead4907ac516a75b26449e08dbb2621220..95c26b31ea9ef8a1da85bbb8c648f2e5736ca19c 100644 (file)
@@ -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.5 2001/12/03 16:18:37 sam Exp $
+ * $Id: ac3_spdif.c,v 1.6 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          Juha Yrjola <jyrjola@cc.hut.fi>
@@ -40,7 +40,6 @@
 #include <unistd.h>
 #endif
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 #include "threads.h"
index 77e606a3bb04ea207700b3ec576a8a6dfd3d9d69..ffede17d1e5d1bc4d896dab0af1cbe39419cb32c 100644 (file)
@@ -2,7 +2,7 @@
  * alsa.c : alsa plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: alsa.c,v 1.11 2001/11/28 15:08:05 massiot Exp $
+ * $Id: alsa.c,v 1.12 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Henri Fallon <henri@videolan.org>
  *
@@ -33,7 +33,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 5b8023292aadbe08e899845ced076d1201603a2a..3a9f96bf31d0cf240b5f429de91c18495ced26f7 100644 (file)
@@ -31,7 +31,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                              /* strdup() */
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index fb7d5035d2328de08b33b8f767790670f11a6e8c..12552396e8ea238ff8fb8ea32ab768a76cdbc051 100644 (file)
@@ -2,7 +2,7 @@
  * beos.cpp : BeOS plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: beos.cpp,v 1.13 2001/11/30 09:49:48 tcastley Exp $
+ * $Id: beos.cpp,v 1.14 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -35,7 +35,6 @@
 
 extern "C"
 {
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
diff --git a/plugins/chroma/Makefile b/plugins/chroma/Makefile
new file mode 100644 (file)
index 0000000..315a145
--- /dev/null
@@ -0,0 +1,34 @@
+###############################################################################
+# vlc (VideoLAN Client) chroma conversion modules makefile
+# (c)2001 VideoLAN
+###############################################################################
+
+#
+# Objects
+#
+
+PLUGIN_YUV2RGB8 = yuv2rgb8.o #common.o
+
+BUILTIN_YUV2RGB8 = $(PLUGIN_YUV2RGB8:%.o=BUILTIN_%.o)
+
+PLUGIN_C = $(PLUGIN_YUV2RGB8)
+BUILTIN_C = $(BUILTIN_YUV2RGB8)
+ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
+
+#
+# Virtual targets
+#
+
+include ../../Makefile.modules
+
+#
+# Real targets
+#
+
+../yuv2rgb8.so: $(PLUGIN_YUV2RGB8)
+       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) 
+
+../yuv2rgb8.a: $(BUILTIN_YUV2RGB8)
+       ar r $@ $^
+       $(RANLIB) $@
+
index c1b7b0bf586171bd2a63ed76216269d5c6673009..97c9c27c76f8cbe8fbdc3be057d920d0c22fc733 100644 (file)
@@ -2,7 +2,7 @@
  * directx.c : Windows DirectX plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: directx.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
+ * $Id: directx.c,v 1.3 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *      
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 83c335aa3c538c81e63dbf88f64bd0505b18f8fe..dc0ba6eb4e43d0998720a4df0c43ec8c325d08b5 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_downmix_3dn.c: accelerated 3D Now! ac3 downmix functions
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: ac3_downmix_3dn.c,v 1.6 2001/11/28 15:08:05 massiot Exp $
+ * $Id: ac3_downmix_3dn.c,v 1.7 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Renaud Dartus <reno@videolan.org>
  *
@@ -29,7 +29,6 @@
  *****************************************************************************/
 #include "defs.h"
 
-#include "config.h"
 #include "common.h"
 
 #include "ac3_downmix.h"
index f47ebd064a3301d48bc60c0ab3a9ec390cebfb46..722b8f430c24dd95d7b2f3228fae4c47f6e1e713 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_downmix_c.c: ac3 downmix functions in C
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: ac3_downmix_c.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
+ * $Id: ac3_downmix_c.c,v 1.3 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Renaud Dartus <reno@videolan.org>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -32,7 +32,6 @@
 
 #include <string.h>                                              /* memcpy() */
 
-#include "config.h"
 #include "common.h"
 
 #include "ac3_downmix.h"
index 2e2898b5d1b06aa97d7bfb70668196e649fa1dc4..4d2e971454065a136057eb3ac7b614e1f92cf2d3 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_downmix_sse.c: accelerated SSE ac3 downmix functions
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: ac3_downmix_sse.c,v 1.6 2001/11/28 15:08:05 massiot Exp $
+ * $Id: ac3_downmix_sse.c,v 1.7 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Renaud Dartus <reno@videolan.org>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -30,7 +30,6 @@
  *****************************************************************************/
 #include "defs.h"
 
-#include "config.h"
 #include "common.h"
 
 #include "ac3_downmix.h"
index 1aa1e7c584999a946df2b126a2b27b5d7ad1fdb9..b7b2dcdd9c36eca67f0906b4c1ed562c70ab7619 100644 (file)
@@ -2,7 +2,7 @@
  * downmix.c : AC3 downmix module
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: downmix.c,v 1.4 2001/11/28 15:08:05 massiot Exp $
+ * $Id: downmix.c,v 1.5 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Renaud Dartus <reno@via.ecp.fr>
  *
@@ -32,7 +32,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index 4b6ca32bd38a1f08302f9aabf208287cfddbf7da..86cfc34dfa30cbe2ba2ca0d08473b0f684307fd8 100644 (file)
@@ -2,7 +2,7 @@
  * downmix3dn.c : accelerated 3D Now! AC3 downmix module
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: downmix3dn.c,v 1.5 2001/11/28 15:08:05 massiot Exp $
+ * $Id: downmix3dn.c,v 1.6 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Renaud Dartus <reno@via.ecp.fr>
  *
@@ -32,7 +32,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index f361a498340e761bb71166a992a82c3cad450024..0a7c6ebf6c8401e325add2ffd538c12e6b86bd88 100644 (file)
@@ -2,7 +2,7 @@
  * downmixsse.c : accelerated SSE AC3 downmix module
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: downmixsse.c,v 1.5 2001/11/28 15:08:05 massiot Exp $
+ * $Id: downmixsse.c,v 1.6 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Renaud Dartus <reno@via.ecp.fr>
  *
@@ -32,7 +32,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index 2f3f65cd4f9145f4a050db0953a218cde802fba9..6a5c3dc7667f52808a5d160a54591d3a10571488 100644 (file)
@@ -2,7 +2,7 @@
  * dsp.c : OSS /dev/dsp module for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: dsp.c,v 1.10 2001/11/28 15:08:05 massiot Exp $
+ * $Id: dsp.c,v 1.11 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -33,7 +33,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                              /* strdup() */
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 0fd71b5bb8dfebf99dae08f076b2c9f6e20ca1ac..344c71b6973060a4fc5b38a55fb081d868770df4 100644 (file)
@@ -2,7 +2,7 @@
  * dummy.c : dummy plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: dummy.c,v 1.11 2001/11/28 15:08:05 massiot Exp $
+ * $Id: dummy.c,v 1.12 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 3073f8b63770d1c2a4cff52120b49898a9f8b9ec..46b134c472077ea57304c5f4e671a567b4aad9f0 100644 (file)
@@ -2,7 +2,7 @@
  * null.c : NULL module for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: null.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
+ * $Id: null.c,v 1.3 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -31,7 +31,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                              /* strdup() */
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 0ac14da533152fe61a25baf6d0660c78ae8481c8..558a9ac5cfe458e8396777b143fafd6b75572e1d 100644 (file)
@@ -2,7 +2,7 @@
  * vout_dummy.c: Dummy video output display method for testing purposes
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: vout_dummy.c,v 1.9 2001/11/28 15:08:05 massiot Exp $
+ * $Id: vout_dummy.c,v 1.10 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -33,7 +33,6 @@
 #include <stdlib.h>                                                /* free() */
 #include <string.h>                                            /* strerror() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
@@ -48,8 +47,7 @@
 
 #define DUMMY_WIDTH 16
 #define DUMMY_HEIGHT 16
-#define DUMMY_BITS_PER_PLANE 16
-#define DUMMY_BYTES_PER_PIXEL 2
+#define DUMMY_MAX_DIRECTBUFFERS 5
 
 /*****************************************************************************
  * vout_sys_t: dummy video output method descriptor
@@ -59,9 +57,7 @@
  *****************************************************************************/
 typedef struct vout_sys_s
 {
-    /* Dummy video memory */
-    byte_t *                    p_video;                      /* base adress */
-    size_t                      i_page_size;                    /* page size */
+    /* Nothing needed here. Maybe stats ? */
 
 } vout_sys_t;
 
@@ -74,7 +70,7 @@ static int  vout_Init      ( struct vout_thread_s * );
 static void vout_End       ( struct vout_thread_s * );
 static void vout_Destroy   ( struct vout_thread_s * );
 static int  vout_Manage    ( struct vout_thread_s * );
-static void vout_Display   ( struct vout_thread_s * );
+static void vout_Display   ( struct vout_thread_s *, struct picture_s * );
 
 /*****************************************************************************
  * Functions exported as capabilities. They are declared as static so that
@@ -120,29 +116,6 @@ static int vout_Create( vout_thread_t *p_vout )
         return( 1 );
     }
 
-    p_vout->i_width            = DUMMY_WIDTH;
-    p_vout->i_height           = DUMMY_HEIGHT;
-    p_vout->i_screen_depth     = DUMMY_BITS_PER_PLANE;
-    p_vout->i_bytes_per_pixel  = DUMMY_BYTES_PER_PIXEL;
-    p_vout->i_bytes_per_line   = DUMMY_WIDTH * DUMMY_BYTES_PER_PIXEL;
-
-    p_vout->p_sys->i_page_size = DUMMY_WIDTH * DUMMY_HEIGHT
-                                  * DUMMY_BYTES_PER_PIXEL;
-
-    /* Map two framebuffers a the very beginning of the fb */
-    p_vout->p_sys->p_video = malloc( 2 * p_vout->p_sys->i_page_size );
-    if( p_vout->p_sys->p_video == NULL )
-    {
-        intf_ErrMsg( "vout error: can't map video memory (%s)",
-                     strerror(errno) );
-        free( p_vout->p_sys );
-        return( 1 );
-    }
-
-    /* Set and initialize buffers */
-    p_vout->pf_setbuffers( p_vout, p_vout->p_sys->p_video,
-                     p_vout->p_sys->p_video + p_vout->p_sys->i_page_size );
-
     return( 0 );
 }
 
@@ -151,6 +124,92 @@ static int vout_Create( vout_thread_t *p_vout )
  *****************************************************************************/
 static int vout_Init( vout_thread_t *p_vout )
 {
+    picture_t *p_pic;
+    int        i_index = 0;
+    int        i_luma_bytes, i_chroma_bytes;
+
+    /* Try to initialize DUMMY_MAX_DIRECTBUFFERS direct buffers */
+    while( i_index < DUMMY_MAX_DIRECTBUFFERS )
+    {
+        p_pic = &p_vout->p_picture[ i_index ];
+
+        switch( p_vout->i_chroma )
+        {
+        /* We know this chroma, allocate a buffer which will be used
+         * directly by the decoder */
+        case YUV_420_PICTURE:
+
+            p_pic->i_chroma = YUV_420_PICTURE;
+            p_pic->i_width  = p_vout->i_width;
+            p_pic->i_height = p_vout->i_height;
+
+            /* Precalculate some values */
+            p_pic->i_size         = p_vout->i_width * p_vout->i_height;
+            p_pic->i_chroma_width = p_vout->i_width / 2;
+            p_pic->i_chroma_size  = p_vout->i_width * p_vout->i_height / 2;
+
+            /* Allocate the memory buffer */
+            i_luma_bytes = p_pic->i_size * sizeof(pixel_data_t);
+            i_chroma_bytes = p_pic->i_chroma_size * sizeof(pixel_data_t);
+
+            /* Y buffer */
+            p_pic->planes[ Y_PLANE ].p_data = malloc( i_luma_bytes + 2 * i_chroma_bytes );
+            p_pic->planes[ Y_PLANE ].i_bytes = i_luma_bytes;
+
+            /* U buffer */
+            p_pic->planes[ U_PLANE ].p_data = p_pic->planes[ Y_PLANE ].p_data + p_pic->i_height * p_pic->i_width;
+            p_pic->planes[ U_PLANE ].i_bytes = i_chroma_bytes;
+
+            /* V buffer */
+            p_pic->planes[ V_PLANE ].p_data = p_pic->planes[ U_PLANE ].p_data + p_pic->i_height * p_pic->i_chroma_width;
+            p_pic->planes[ V_PLANE ].i_bytes = i_chroma_bytes;
+
+            /* We allocated 3 planes */
+            p_pic->i_planes = 3;
+
+            break;
+
+        /* Unknown chroma, allocate an RGB buffer, the video output's job
+         * will be to do the chroma->RGB conversion */
+        default:
+
+            p_pic->i_chroma = RGB_16BPP_PICTURE;
+            p_pic->i_width  = DUMMY_WIDTH;
+            p_pic->i_height = DUMMY_HEIGHT;
+
+            /* Precalculate some values */
+            i_luma_bytes    = sizeof(u16) * DUMMY_WIDTH * DUMMY_HEIGHT;
+
+            /* Allocate the memory buffer */
+            p_pic->planes[ RGB_PLANE ].p_data = malloc( i_luma_bytes );
+            p_pic->planes[ RGB_PLANE ].i_bytes = i_luma_bytes;
+
+            /* We allocated 1 plane */
+            p_pic->i_planes = 1;
+
+            break;
+        }
+
+        if( p_pic->i_planes == 0 )
+        {
+            break;
+        }
+
+        p_pic->i_status        = DESTROYED_PICTURE;
+
+        p_pic->b_directbuffer  = 1;
+
+        p_pic->i_left_margin   =
+        p_pic->i_right_margin  =
+        p_pic->i_top_margin    =
+        p_pic->i_bottom_margin = 0;
+
+        i_index++;
+    }
+
+    /* How many directbuffers did we create ? */
+    p_vout->i_directbuffers = i_index;
+
     return( 0 );
 }
 
@@ -159,7 +218,14 @@ static int vout_Init( vout_thread_t *p_vout )
  *****************************************************************************/
 static void vout_End( vout_thread_t *p_vout )
 {
-    ;
+    int i_index;
+
+    /* Free the fake direct buffers we allocated */
+    for( i_index = p_vout->i_directbuffers ; i_index ; )
+    {
+        i_index--;
+        free( p_vout->p_picture[ i_index ].planes[ 0 ].p_data );
+    }
 }
 
 /*****************************************************************************
@@ -169,7 +235,6 @@ static void vout_End( vout_thread_t *p_vout )
  *****************************************************************************/
 static void vout_Destroy( vout_thread_t *p_vout )
 {
-    free( p_vout->p_sys->p_video );
     free( p_vout->p_sys );
 }
 
@@ -190,8 +255,8 @@ static int vout_Manage( vout_thread_t *p_vout )
  * This function send the currently rendered image to dummy image, waits until
  * it is displayed and switch the two rendering buffers, preparing next frame.
  *****************************************************************************/
-static void vout_Display( vout_thread_t *p_vout )
+static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
 {
-    ;
+    /* No need to do anything, the fake direct buffers stay as they are */
 }
 
index 1cc92cb154874ae05c033ab6f99938d8508c0cdb..c0ef5df3acc535c1a0110e8b52242ce4f0f306ee 100644 (file)
@@ -2,7 +2,7 @@
  * dummy_dvdcss.c: Dummy libdvdcss with minimal DVD access.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: dummy_dvdcss.c,v 1.3 2001/11/12 20:16:33 sam Exp $
+ * $Id: dummy_dvdcss.c,v 1.4 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -43,7 +43,6 @@
 #   error "building dummy libdvdcss on this system does not make sense !"
 #endif
 
-#include "config.h"
 #include "common.h"
 
 #include "dummy_dvdcss.h"
index 1445f2e63a2a3675100d4ed5af82fad1955cb0f6..2013a49b22147c9ccef469764dc04d77ac1cccec 100644 (file)
@@ -2,7 +2,7 @@
  * dvd.c : DVD input module for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: dvd.c,v 1.15 2001/11/28 15:08:05 massiot Exp $
+ * $Id: dvd.c,v 1.16 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -37,7 +37,6 @@
 #   include "dummy_dvdcss.h"
 #endif
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index b1d3a7ed1914ecb6ab3d84006bd2378b6752487f..eff7fe6d252900ec273263d5ef7c661c86527420 100644 (file)
@@ -2,7 +2,7 @@
  * dvd_ifo.c: Functions for ifo parsing
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: dvd_ifo.c,v 1.41 2001/11/28 15:08:05 massiot Exp $
+ * $Id: dvd_ifo.c,v 1.42 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          German Tischler <tanis@gaspode.franken.de>
@@ -31,7 +31,6 @@
  * Preamble
  *****************************************************************************/
 #include "defs.h"
-#include "config.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -51,7 +50,6 @@
 #   include <videolan/dvdcss.h>
 #endif
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index 83c6a40acb2e475234e0b9bd69fb40f1c8f76ce9..e6e22d37ced481a988e670fb83c5972fc5ffcd92 100644 (file)
@@ -5,7 +5,7 @@
  * contains the basic udf handling functions
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: dvd_udf.c,v 1.16 2001/11/28 15:08:05 massiot Exp $
+ * $Id: dvd_udf.c,v 1.17 2001/12/09 17:01:36 sam Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -56,7 +56,6 @@
 #   include <videolan/dvdcss.h>
 #endif
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index 8456963261d41c6fc27427870b54d23546fb3c95..8f89d271fa28e1cb2697d09abdbd9d745a7d844a 100644 (file)
@@ -2,7 +2,7 @@
  * dvdread.c : DvdRead input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: dvdread.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
+ * $Id: dvdread.c,v 1.3 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -37,7 +37,6 @@
 #   include "dummy_dvdcss.h"
 #endif
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 456e10223661656077854efac9954a4ac0bc1a6a..9adfc68e7bc807a3e0e0fd177561e69373a53ebd 100644 (file)
@@ -2,7 +2,7 @@
  * esd.c : EsounD module
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: esd.c,v 1.9 2001/11/28 15:08:05 massiot Exp $
+ * $Id: esd.c,v 1.10 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                              /* strdup() */
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 0066d5445ef0fc632278d693bde23d1daa0c247a..a73047d94445c25b7731eef225fe86b87db60885 100644 (file)
@@ -2,7 +2,7 @@
  * fb.c : framebuffer plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: fb.c,v 1.8 2001/11/28 15:08:05 massiot Exp $
+ * $Id: fb.c,v 1.9 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *      
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 3c314c7f27b928502a1a9bb06818ba5edcc3107d..791c10115e3792dc2d05f7b7154c8188281027e8 100644 (file)
@@ -2,7 +2,7 @@
  * ggi.c : GGI plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: ggi.c,v 1.8 2001/11/28 15:08:05 massiot Exp $
+ * $Id: ggi.c,v 1.9 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *      
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 55c5ee9a82bf9382e48f7334eea497ee4874e5c5..a426e36fe187e9faffe8bdc5fcc578546139dbc2 100644 (file)
@@ -2,7 +2,7 @@
  * glide.c : 3dfx Glide plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: glide.c,v 1.7 2001/11/28 15:08:05 massiot Exp $
+ * $Id: glide.c,v 1.8 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index d4fd605af7df92bca70bb01b448e971a2741c315..af752b98a7ffc4ec395d79cfcc41af25a88b06da 100644 (file)
@@ -2,7 +2,7 @@
  * gnome.c : Gnome plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: gnome.c,v 1.2 2001/05/30 17:03:12 sam Exp $
+ * $Id: gnome.c,v 1.3 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *      
  *****************************************************************************/
 #include "defs.h"
 
+#include <string.h>
 #include <stdlib.h>                                      /* malloc(), free() */
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
+#include "intf_msg.h"
 #include "threads.h"
 #include "mtime.h"
 
index 6c917518eed6dc16874cd5bc9585470a4d953ed4..e2aa479a99263fbb62c146722f87040f9916d526 100644 (file)
@@ -2,7 +2,7 @@
  * gtk.c : Gtk+ plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: gtk.c,v 1.5 2001/11/28 15:08:05 massiot Exp $
+ * $Id: gtk.c,v 1.6 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *      
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 9461dd5edff80d5165731b305d25794d7dcca118..3530aa842a44b70e130f384c5d6fbecf6b4cccca 100644 (file)
@@ -2,7 +2,7 @@
  * idct.c : C IDCT module
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: idct.c,v 1.17 2001/11/28 15:08:05 massiot Exp $
+ * $Id: idct.c,v 1.18 2001/12/09 17:01:36 sam Exp $
  *
  * Author: Gaël Hendryckx <jimmy@via.ecp.fr>
  *
@@ -32,7 +32,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index f082dc47a55760b829c85a47103e5bb2e1cdb17f..831fface7e860f36491380504873718c329236b5 100644 (file)
@@ -2,7 +2,7 @@
  * idctaltivec.c : Altivec IDCT module
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: idctaltivec.c,v 1.20 2001/12/06 13:46:23 massiot Exp $
+ * $Id: idctaltivec.c,v 1.21 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -35,7 +35,6 @@
 #include <string.h>
 #include <inttypes.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index fa8b6c207c64fe2d03ecfd7e9448bbbb27e88100..9a0bb0bee3b27fe9cb9481cac581087778514dc7 100644 (file)
@@ -2,7 +2,7 @@
  * idctclassic.c : Classic IDCT module
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: idctclassic.c,v 1.17 2001/11/28 15:08:05 massiot Exp $
+ * $Id: idctclassic.c,v 1.18 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
  *
@@ -32,7 +32,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index d79b6891d1dbeb459c68d038304c442dd2fd5819..29e10a571818153545b92be0b486d735f0e31d23 100644 (file)
@@ -2,7 +2,7 @@
  * idctmmx.c : MMX IDCT module
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: idctmmx.c,v 1.20 2001/11/28 15:08:05 massiot Exp $
+ * $Id: idctmmx.c,v 1.21 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
  *          Michel Lespinasse <walken@zoy.org>
@@ -36,7 +36,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index 3baed081bb5a1467fe8ac45ce91e3a507290eef7..1cf6a22e58d3d5357c933f629aaf9f0c2e766ef8 100644 (file)
@@ -2,7 +2,7 @@
  * idctmmxext.c : MMX EXT IDCT module
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: idctmmxext.c,v 1.17 2001/11/28 15:08:05 massiot Exp $
+ * $Id: idctmmxext.c,v 1.18 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
  *          Michel Lespinasse <walken@zoy.org>
@@ -36,7 +36,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
diff --git a/plugins/idct/vdec_block_c.c b/plugins/idct/vdec_block_c.c
new file mode 100644 (file)
index 0000000..0ec9f2f
--- /dev/null
@@ -0,0 +1,127 @@
+/*****************************************************************************
+ * vdec_block_c.c: Macroblock copy functions in C
+ *****************************************************************************
+ * Copyright (C) 1999, 2000, 2001 VideoLAN
+ * $Id: vdec_block_c.c,v 1.8 2001/12/09 17:01:36 sam Exp $
+ *
+ * Authors: Christophe Massiot <massiot@via.ecp.fr>
+ *
+ * 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 <string.h>                                    /* memcpy(), memset() */
+
+#include "common.h"
+#include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
+#include "threads.h"
+#include "mtime.h"
+
+#include "vdec_idct.h"
+
+#include "modules.h"
+#include "modules_export.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_InitDecode: initialize video decoder thread
+ *****************************************************************************/
+void _M( vdec_InitDecode ) ( )
+{
+    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;
+    }
+}
+
+/*****************************************************************************
+ * vdec_AddBlock : add a block
+ *****************************************************************************/
+void _M( vdec_AddBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
+                           int i_incr )
+{
+    int i = 8;
+
+    do {
+        p_data[0] = pi_crop[ p_data[0] + p_block[0] ];
+        p_data[1] = pi_crop[ p_data[1] + p_block[1] ];
+        p_data[2] = pi_crop[ p_data[2] + p_block[2] ];
+        p_data[3] = pi_crop[ p_data[3] + p_block[3] ];
+        p_data[4] = pi_crop[ p_data[4] + p_block[4] ];
+        p_data[5] = pi_crop[ p_data[5] + p_block[5] ];
+        p_data[6] = pi_crop[ p_data[6] + p_block[6] ];
+        p_data[7] = pi_crop[ p_data[7] + p_block[7] ];
+
+        p_data += i_incr;
+        p_block += 8;
+    } while( --i );
+}
+
+/*****************************************************************************
+ * vdec_CopyBlock : copy a block
+ *****************************************************************************/
+void _M( vdec_CopyBlock )( dctelem_t * p_block, yuv_data_t * p_data,
+                           int i_incr )
+{
+    int i = 8;
+
+    do {
+        p_data[0] = pi_crop[ p_block[0] ];
+        p_data[1] = pi_crop[ p_block[1] ];
+        p_data[2] = pi_crop[ p_block[2] ];
+        p_data[3] = pi_crop[ p_block[3] ];
+        p_data[4] = pi_crop[ p_block[4] ];
+        p_data[5] = pi_crop[ p_block[5] ];
+        p_data[6] = pi_crop[ p_block[6] ];
+        p_data[7] = pi_crop[ p_block[7] ];
+
+        p_data += i_incr;
+        p_block += 8;
+    } while( --i );
+}
+
diff --git a/plugins/idct/vdec_block_mmx.c b/plugins/idct/vdec_block_mmx.c
new file mode 100644 (file)
index 0000000..a0595b7
--- /dev/null
@@ -0,0 +1,134 @@
+/*****************************************************************************
+ * vdec_block_mmx.c: Macroblock copy functions in MMX assembly
+ *****************************************************************************
+ * Copyright (C) 1999, 2000, 2001 VideoLAN
+ * $Id: vdec_block_mmx.c,v 1.8 2001/12/09 17:01:36 sam Exp $
+ *
+ * Authors: Michel Lespinasse <walken@zoy.org>
+ *          Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * 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 <string.h>                                    /* memcpy(), memset() */
+
+#include "common.h"
+#include "intf_msg.h"
+#include "threads.h"
+#include "mtime.h"
+
+#include "input_ext-dec.h"
+
+#include "video.h"
+#include "video_output.h"
+
+#include "vdec_idct.h"
+
+#include "modules.h"
+#include "modules_export.h"
+
+#include "mmx.h"
+
+/*****************************************************************************
+ * vdec_InitDecode: initialize video decoder thread
+ *****************************************************************************/
+void _M( vdec_InitDecode ) ( )
+{
+    ;
+}
+
+/*****************************************************************************
+ * vdec_AddBlock : add a block
+ *****************************************************************************/
+#define ADD_MMX(offset,r1,r2,r3,r4)                                         \
+    movq_m2r (*(p_data+2*i_incr), r1);                                      \
+    packuswb_r2r (r4, r3);                                                  \
+    movq_r2r (r1, r2);                                                      \
+    p_data += i_incr;                                                       \
+    movq_r2m (r3, *p_data);                                                 \
+    punpcklbw_r2r (mm0, r1);                                                \
+    paddsw_m2r (*(p_block+offset), r1);                                     \
+    punpckhbw_r2r (mm0, r2);                                                \
+    paddsw_m2r (*(p_block+offset+4), r2);
+
+void _M( vdec_AddBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
+                           int i_incr )
+{
+    movq_m2r (*p_data, mm1);
+    pxor_r2r (mm0, mm0);
+    movq_m2r (*(p_data + i_incr), mm3);
+    movq_r2r (mm1, mm2);
+    punpcklbw_r2r (mm0, mm1);
+    movq_r2r (mm3, mm4);
+    paddsw_m2r (*(p_block+0*8), mm1);
+    punpckhbw_r2r (mm0, mm2);
+    paddsw_m2r (*(p_block+0*8+4), mm2);
+    punpcklbw_r2r (mm0, mm3);
+    paddsw_m2r (*(p_block+1*8), mm3);
+    packuswb_r2r (mm2, mm1);
+    punpckhbw_r2r (mm0, mm4);
+    movq_r2m (mm1, *p_data);
+    paddsw_m2r (*(p_block+1*8+4), mm4);
+    ADD_MMX (2*8, mm1, mm2, mm3, mm4);
+    ADD_MMX (3*8, mm3, mm4, mm1, mm2);
+    ADD_MMX (4*8, mm1, mm2, mm3, mm4);
+    ADD_MMX (5*8, mm3, mm4, mm1, mm2);
+    ADD_MMX (6*8, mm1, mm2, mm3, mm4);
+    ADD_MMX (7*8, mm3, mm4, mm1, mm2);
+    packuswb_r2r (mm4, mm3);
+    movq_r2m (mm3, *(p_data + i_incr));
+}
+
+/*****************************************************************************
+ * vdec_CopyBlock : copy a block
+ *****************************************************************************/
+#define COPY_MMX(offset,r0,r1,r2)                                           \
+    movq_m2r (*(p_block+offset), r0);                                       \
+    p_data += i_incr;                                                       \
+    movq_m2r (*(p_block+offset+4), r1);                                     \
+    movq_r2m (r2, *p_data);                                                 \
+    packuswb_r2r (r1, r0);
+
+void _M( vdec_CopyBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
+                            int i_incr )
+{
+    movq_m2r (*(p_block+0*8), mm0);
+    movq_m2r (*(p_block+0*8+4), mm1);
+    movq_m2r (*(p_block+1*8), mm2);
+    packuswb_r2r (mm1, mm0);
+    movq_m2r (*(p_block+1*8+4), mm3);
+    movq_r2m (mm0, *p_data);
+    packuswb_r2r (mm3, mm2);
+    COPY_MMX (2*8, mm0, mm1, mm2);
+    COPY_MMX (3*8, mm2, mm3, mm0);
+    COPY_MMX (4*8, mm0, mm1, mm2);
+    COPY_MMX (5*8, mm2, mm3, mm0);
+    COPY_MMX (6*8, mm0, mm1, mm2);
+    COPY_MMX (7*8, mm2, mm3, mm0);
+    movq_r2m (mm2, *(p_data + i_incr));
+}
+
index a02345aa9161bb52d363a1c9e14a471e1299d73e..76267c10720671314508c446025af664209db1e7 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_imdct_3dn.c: accelerated 3D Now! ac3 DCT
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_imdct_3dn.c,v 1.7 2001/11/28 15:08:05 massiot Exp $
+ * $Id: ac3_imdct_3dn.c,v 1.8 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Renaud Dartus <reno@videolan.org>
  *
@@ -32,7 +32,6 @@
 #include <math.h>
 #include <stdio.h>
 
-#include "config.h"
 #include "common.h"
 
 #include "ac3_imdct.h"
index 3c4375965653126e03b3715df41b5d23092ca18a..973091cc51a8b67ec67e2b614fe6dfa97f0df11a 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_imdct_c.c: ac3 DCT in C
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_imdct_c.c,v 1.3 2001/11/28 15:08:05 massiot Exp $
+ * $Id: ac3_imdct_c.c,v 1.4 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Renaud Dartus <reno@videolan.org>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -35,7 +35,6 @@
 #include <math.h>
 #include <stdio.h>
 
-#include "config.h"
 #include "common.h"
 
 #include "ac3_imdct.h"
index c4d0e011a4ae56ed746174b8ef99db9c2ad74785..634e238688b09ec8b5be7a72497fb0038e19f657 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_imdct_common.c: common ac3 DCT functions
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_imdct_common.c,v 1.4 2001/11/28 15:08:05 massiot Exp $
+ * $Id: ac3_imdct_common.c,v 1.5 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Renaud Dartus <reno@videolan.org>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -39,7 +39,6 @@
 #include <math.h>
 #include <stdio.h>
 
-#include "config.h"
 #include "common.h"
 
 #include "ac3_imdct.h"
index 002df6ff83a62a81f9a7dc04aea465ef7eb3aeed..6c15eb7764cc87e442b5f201a7987a2d5f28ed50 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_imdct_sse.c: accelerated SSE ac3 DCT
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_imdct_sse.c,v 1.8 2001/11/28 15:08:05 massiot Exp $
+ * $Id: ac3_imdct_sse.c,v 1.9 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Renaud Dartus <reno@videolan.org>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -33,7 +33,6 @@
 #include <math.h>
 #include <stdio.h>
 
-#include "config.h"
 #include "common.h"
 
 #include "ac3_imdct.h"
index b385a31714a1be79c0a67269cfcfd9c07d0181e9..432362d66e76ae66f1b6fc99d23624871ab490eb 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_srfft_3dn.c: accelerated 3D Now! ac3 fft functions
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_srfft_3dn.c,v 1.3 2001/11/28 15:08:05 massiot Exp $
+ * $Id: ac3_srfft_3dn.c,v 1.4 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Renaud Dartus <reno@videolan.org>
  *
@@ -34,7 +34,6 @@
 #include <math.h>
 #include <stdio.h>
 
-#include "config.h"
 #include "common.h"
 
 #include "ac3_imdct.h"
index 9be24113c33ae47bfd596554749698507441ac34..51e89473d270d1a61246a66978ac67c08647fb94 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_srfft.c: ac3 FFT in C
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_srfft_c.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
+ * $Id: ac3_srfft_c.c,v 1.3 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Renaud Dartus <reno@videolan.org>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -35,7 +35,6 @@
 #include <math.h>
 #include <stdio.h>
 
-#include "config.h"
 #include "common.h"
 
 #include "ac3_imdct.h"
index 2855fa181264012ace5741fb64e8f6ca0f96350a..cfc94f28d24c4ae2ae95b5074a24dccb3d86a565 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_srfft_sse.c: accelerated SSE ac3 fft functions
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_srfft_sse.c,v 1.9 2001/11/28 15:08:05 massiot Exp $
+ * $Id: ac3_srfft_sse.c,v 1.10 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Renaud Dartus <reno@videolan.org>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -35,7 +35,6 @@
 #include <math.h>
 #include <stdio.h>
 
-#include "config.h"
 #include "common.h"
 
 #include "ac3_imdct.h"
index d844f6ac9a1a0f4507abb924951be6035f528725..a0897bc92adc93f4c3d020440ee37bd4f51d314b 100644 (file)
@@ -2,7 +2,7 @@
  * imdct.c : IMDCT module
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: imdct.c,v 1.5 2001/11/28 15:08:05 massiot Exp $
+ * $Id: imdct.c,v 1.6 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
  *
@@ -32,7 +32,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index aafac8f9cc79e6209a5c026e33a5f3a8c0f6224f..4f7b19f0eaade147128a54b0328fdffadf78cdc8 100644 (file)
@@ -2,7 +2,7 @@
  * imdct3dn.c : accelerated 3D Now! IMDCT module
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: imdct3dn.c,v 1.7 2001/11/28 15:08:05 massiot Exp $
+ * $Id: imdct3dn.c,v 1.8 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Renaud Dartus <reno@via.ecp.fr>
  *
@@ -32,7 +32,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index be952002076e832e987dd5f2fc0de1e4d6aac578..d812e41b88791a8f86f5944a697e8322c0a06e65 100644 (file)
@@ -2,7 +2,7 @@
  * imdctsse.c : accelerated SSE IMDCT module
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: imdctsse.c,v 1.8 2001/11/28 15:08:05 massiot Exp $
+ * $Id: imdctsse.c,v 1.9 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
  *
@@ -32,7 +32,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index 4fb641b091496e3e2d01af7a086549badd32e114..164ab20ce7fd820fc51df03b1c84aef26afb7f21 100644 (file)
@@ -2,7 +2,7 @@
  * lpcm_decoder_thread.c: lpcm decoder thread
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: lpcm_adec.c,v 1.3 2001/12/03 16:18:37 sam Exp $
+ * $Id: lpcm_adec.c,v 1.4 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Henri Fallon <henri@videolan.org>
@@ -38,7 +38,6 @@
 #include <string.h>                                    /* memcpy(), memset() */
 #include <stdlib.h>                                      /* malloc(), free() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 #include "threads.h"
index 5cd526b3c31bb2f5517f387f6810222ddfff2ec2..3c68f480c5834b590d9ef18c8deb3339f5218b99 100644 (file)
@@ -33,7 +33,6 @@
 #include <sys/param.h>                                    /* for MAXPATHLEN */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index e00c6405768a29f80016523a5ce7fd8eda301c41..52bb8dc9c5a26251ee39d0137610d499f527d1b2 100644 (file)
@@ -2,7 +2,7 @@
  * macosx.c : MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: macosx.c,v 1.8 2001/11/29 15:56:37 massiot Exp $
+ * $Id: macosx.c,v 1.9 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Eugenio Jarosiewicz <ej0@cise.ufl.edu>
@@ -34,7 +34,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
similarity index 100%
rename from plugins/mad_adec/API
rename to plugins/mad/API
similarity index 94%
rename from plugins/mad_adec/BUGS
rename to plugins/mad/BUGS
index d16e71de28d6b8101ac694973035354005f94fa6..0a9f74c33db14e4d4f58bd54ff5b90d318cc4efb 100644 (file)
@@ -1,6 +1,6 @@
 bug #09/11/2001-1: (FIXED 20/11/2001, by JP Saman)
        Makefile.opts.in and Makefile.opts static libmad.a library is not filled in automatically by configure.
-       It should say in Makefile.opts LIB_MAD_ADEC=lib/libmad.a
+       It should say in Makefile.opts LIB_MAD=lib/libmad.a
 
 bug #09/11/2001-2:
        libmad/mad.h is not created automatically. Fix compile step and dependencies for mad_adec to automatically
@@ -17,4 +17,4 @@ bug #20/11/2001-1 (FIXED 25/11/2001, by JP Saman)
        it points to a later video frame, then when the audio data was read. How can I set the correct timestamp on the
         audio fifo at the time it was read from the bitstream, so that it matches the video frame it belongs to?
         Solution: Do it in two steps, in the input function save i_pts of fifo and in output function pass saved i_pts to
-        aout_fifo.
\ No newline at end of file
+        aout_fifo.
similarity index 90%
rename from plugins/mad_adec/DESIGN
rename to plugins/mad/DESIGN
index d9327c4b93192777da0f08a97d87ed35e2dd8a7e..c3790cadd984299b94feac49c0043a12aa46c03a 100644 (file)
@@ -5,8 +5,7 @@ Directories:
 ============
 vlc/                   : adapted config.in and Makefile
                        : added libtool, ltmain.sh and ltconfig
-vlc/extras/libmad      : libmad from the original mad distribution
-vlc/plugins/mad_adec   : mad audio decoder plugin for vlc
+vlc/plugins/mad                : mad audio decoder plugin for vlc
 
 Interface functions to implement in mad plugin are:
 =========
@@ -34,7 +33,7 @@ initializing, starting and stopping them.
             |
       ---------------          
       |   <plugin>  |
-      |   mad_adec  |
+      |     mad     |
       _______________
             ^
             |
@@ -46,7 +45,7 @@ initializing, starting and stopping them.
 
 Interface view:
 ===============
-                                 [mad_adec decoder plugin]
+                                   [mad decoder plugin]
                                   ----------------------
        vlc decoder interface -> | mad_adec     mad_libmad | -> libmad
                                   -----------------------
similarity index 71%
rename from plugins/mad_adec/Makefile
rename to plugins/mad/Makefile
index e1ca10a0fecb290e5ba0348bad84b1f5bcb123f0..b63ed76a19de268eb6f73b407ef899ef9f0f55db 100644 (file)
@@ -18,20 +18,20 @@ include ../../Makefile.modules
 
 $(PLUGIN_MAD): %.o: .dep/%.d
 $(PLUGIN_MAD): %.o: %.c
-       $(CC) $(CFLAGS) $(PCFLAGS) $(CFLAGS_MAD_ADEC) -DPLUGIN -c -o $@ $<
+       $(CC) $(CFLAGS) $(PCFLAGS) $(CFLAGS_MAD) -DPLUGIN -c -o $@ $<
 
 $(BUILTIN_MAD): BUILTIN_%.o: .dep/%.d
 $(BUILTIN_MAD): BUILTIN_%.o: %.c
-       $(CC) $(CFLAGS) $(CFLAGS_MAD_ADEC) -DBUILTIN -c -o $@ $<
+       $(CC) $(CFLAGS) $(CFLAGS_MAD) -DBUILTIN -c -o $@ $<
 
 #
 # Real targets
 #
 
-../mad_adec.so: $(PLUGIN_MAD)
-       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_MAD_ADEC)
+../mad.so: $(PLUGIN_MAD)
+       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_MAD)
 
-../mad_adec.a: $(BUILTIN_MAD)
+../mad.a: $(BUILTIN_MAD)
        ar r $@ $^
        $(RANLIB) $@
 
similarity index 100%
rename from plugins/mad_adec/TODO
rename to plugins/mad/TODO
similarity index 99%
rename from plugins/mad_adec/mad_adec.c
rename to plugins/mad/mad_adec.c
index ab8a9ca7946be97df895ca286828c8257fc47500..8b3f55a8cc4397f54efe6e732704f458c9f37fde 100644 (file)
@@ -20,7 +20,7 @@
  *                                                                         *
  ***************************************************************************/
 
-#define MODULE_NAME mad_adec
+#define MODULE_NAME mad
 #include "modules_inner.h"
 
 /*****************************************************************************
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                              /* strdup() */
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
 #include "mtime.h"
+#include "tests.h"
 
 #include "audio_output.h"
 
similarity index 99%
rename from plugins/mad_adec/mad_libmad.c
rename to plugins/mad/mad_libmad.c
index 30eb99d82571f6ba2a7e3deef4d4106162590cc7..a63fa92499ffc63469692f2701f8dd5fe719d8d4 100644 (file)
@@ -27,7 +27,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                              /* strdup() */
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index a4cc81f7f3be86f02cceae7a6c7dc9bba032b413..2d3c6a935f33b5ea124d7ff864069b7df76f6cf8 100644 (file)
@@ -2,7 +2,7 @@
  * mga.c : Matrox Graphic Array plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: mga.c,v 1.7 2001/11/28 15:08:05 massiot Exp $
+ * $Id: mga.c,v 1.8 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index af74077b6c18d79064ef4dc3b01f2ce7137c572e..13bfebb5b0cab48b2dd70ca06c6fc2b0754a57fe 100644 (file)
@@ -2,7 +2,7 @@
  * vout_mga.c: MGA video output display method
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: vout_mga.c,v 1.9 2001/11/28 15:08:05 massiot Exp $
+ * $Id: vout_mga.c,v 1.10 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
  *          Samuel Hocevar <sam@zoy.org>
@@ -42,7 +42,6 @@
 #include <sys/types.h>                                     /* typedef ushort */
 #endif
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index fc5496794fff2a24e6c92816c38fbdf7d9cff4a5..762f9cabf6dcd9bda4719f02ab98f20e2c7273fc 100644 (file)
@@ -2,7 +2,7 @@
  * motion.c : C motion compensation module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: motion.c,v 1.11 2001/11/28 15:08:05 massiot Exp $
+ * $Id: motion.c,v 1.12 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
  *          Michel Lespinasse <walken@zoy.org>
@@ -33,7 +33,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 052ebb78412d1d59bd62a570efaeaa9a3382b4e0..cff28d99e262a672a8948678759d31515e9c6ed8 100644 (file)
@@ -2,7 +2,7 @@
  * motion3dnow.c : 3DNow! motion compensation module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: motion3dnow.c,v 1.4 2001/11/28 15:08:05 massiot Exp $
+ * $Id: motion3dnow.c,v 1.5 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
  *          Michel Lespinasse <walken@zoy.org>
@@ -33,7 +33,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index ee77fba6c7e57b1bea19b7d24da92fa5dbb50086..6d4f9ce95bbe804e856aad9b23e310597eb6b359 100644 (file)
@@ -2,7 +2,7 @@
  * motionaltivec.c : Altivec motion compensation module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: motionaltivec.c,v 1.7 2001/12/06 13:46:23 massiot Exp $
+ * $Id: motionaltivec.c,v 1.8 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Michel Lespinasse <walken@zoy.org>
  *          Paul Mackerras <paulus@linuxcare.com.au>
@@ -36,7 +36,6 @@
 #include <string.h>
 #include <inttypes.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 39efe2af6143e7b15cac825dd6fa58da5496c021..e8eeb0e44086459028315f2d1cf13da0c6ffbe8f 100644 (file)
@@ -2,7 +2,7 @@
  * motionmmx.c : MMX motion compensation module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: motionmmx.c,v 1.12 2001/11/28 15:08:05 massiot Exp $
+ * $Id: motionmmx.c,v 1.13 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
  *          Michel Lespinasse <walken@zoy.org>
@@ -33,7 +33,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 0f29fbc625ca98d49211634f1b7be9d004b422aa..9653867cf844ff5190e091b249c872cf4b737814 100644 (file)
@@ -2,7 +2,7 @@
  * motionmmxext.c : MMX EXT motion compensation module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: motionmmxext.c,v 1.13 2001/11/28 15:08:05 massiot Exp $
+ * $Id: motionmmxext.c,v 1.14 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
  *          Michel Lespinasse <walken@zoy.org>
@@ -33,7 +33,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
diff --git a/plugins/motion/vdec_motion_common.c b/plugins/motion/vdec_motion_common.c
new file mode 100644 (file)
index 0000000..86aa61a
--- /dev/null
@@ -0,0 +1,751 @@
+/*****************************************************************************
+ * vdec_motion_common.c : common motion compensation routines common
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: vdec_motion_common.c,v 1.11 2001/12/09 17:01:36 sam Exp $
+ *
+ * Authors: Christophe Massiot <massiot@via.ecp.fr>
+ *          Jean-Marc Dressler <polux@via.ecp.fr>
+ *          Michel Lespinasse <walken@via.ecp.fr>
+ *
+ * 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 "common.h"
+#include "threads.h"
+#include "mtime.h"
+
+#include "intf_msg.h"
+
+#include "video.h"
+
+#include "vdec_ext-plugins.h"
+
+#include "modules.h"
+#include "modules_export.h"
+
+extern int _M( motion_Probe )( probedata_t *p_data );
+
+static void vdec_MotionFieldField420  ( macroblock_t * p_mb );
+static void vdec_MotionFieldField422  ( macroblock_t * p_mb );
+static void vdec_MotionFieldField444  ( macroblock_t * p_mb );
+static void vdec_MotionField16x8420   ( macroblock_t * p_mb );
+static void vdec_MotionField16x8422   ( macroblock_t * p_mb );
+static void vdec_MotionField16x8444   ( macroblock_t * p_mb );
+static void vdec_MotionFieldDMV420    ( macroblock_t * p_mb );
+static void vdec_MotionFieldDMV422    ( macroblock_t * p_mb );
+static void vdec_MotionFieldDMV444    ( macroblock_t * p_mb );
+static void vdec_MotionFrameFrame420  ( macroblock_t * p_mb );
+static void vdec_MotionFrameFrame422  ( macroblock_t * p_mb );
+static void vdec_MotionFrameFrame444  ( macroblock_t * p_mb );
+static void vdec_MotionFrameField420  ( macroblock_t * p_mb );
+static void vdec_MotionFrameField422  ( macroblock_t * p_mb );
+static void vdec_MotionFrameField444  ( macroblock_t * p_mb );
+static void vdec_MotionFrameDMV420    ( macroblock_t * p_mb );
+static void vdec_MotionFrameDMV422    ( macroblock_t * p_mb );
+static void vdec_MotionFrameDMV444    ( macroblock_t * p_mb );
+
+/*****************************************************************************
+ * Functions exported as capabilities. They are declared as static so that
+ * we don't pollute the namespace too much.
+ *****************************************************************************/
+void _M( motion_getfunctions )( function_list_t * p_function_list )
+{
+    p_function_list->pf_probe = _M( motion_Probe );
+
+#define list p_function_list->functions.motion
+#define motion_functions( yuv ) \
+    list.pf_field_field_##yuv = vdec_MotionFieldField##yuv; \
+    list.pf_field_16x8_##yuv  = vdec_MotionField16x8##yuv;  \
+    list.pf_field_dmv_##yuv   = vdec_MotionFieldDMV##yuv;   \
+    list.pf_frame_field_##yuv = vdec_MotionFrameField##yuv; \
+    list.pf_frame_frame_##yuv = vdec_MotionFrameFrame##yuv; \
+    list.pf_frame_dmv_##yuv   = vdec_MotionFrameDMV##yuv;
+    motion_functions( 420 )
+    motion_functions( 422 )
+    motion_functions( 444 )
+#undef motion_functions
+#undef list
+
+    return;
+}
+
+#define __MotionComponents(width,height)                \
+void _M( MotionComponent_x_y_copy_##width##_##height )();    \
+void _M( MotionComponent_X_y_copy_##width##_##height )();    \
+void _M( MotionComponent_x_Y_copy_##width##_##height )();    \
+void _M( MotionComponent_X_Y_copy_##width##_##height )();    \
+void _M( MotionComponent_x_y_avg_##width##_##height )();     \
+void _M( MotionComponent_X_y_avg_##width##_##height )();     \
+void _M( MotionComponent_x_Y_avg_##width##_##height )();     \
+void _M( MotionComponent_X_Y_avg_##width##_##height )();
+
+__MotionComponents (16,16)       /* 444, 422, 420 */
+__MotionComponents (16,8)        /* 444, 422, 420 */
+__MotionComponents (8,8)         /* 422, 420 */
+__MotionComponents (8,4)         /* 420 */
+#if 0
+__MotionComponents (8,16)        /* 422 */
+#endif
+
+#define ___callTheRightOne(width,height)                                     \
+    if ((i_width == width) && (i_height == height))                          \
+    {                                                                        \
+        if (!b_average)                                                      \
+        {                                                                    \
+            switch (i_select)                                                \
+            {                                                                \
+            case 0:                                                          \
+                _M( MotionComponent_x_y_copy_##width##_##height )(p_src,     \
+                                                          p_dest, i_stride); \
+                break;                                                       \
+            case 1:                                                          \
+                _M( MotionComponent_X_y_copy_##width##_##height )(p_src,     \
+                                                          p_dest, i_stride); \
+                break;                                                       \
+            case 2:                                                          \
+                _M( MotionComponent_x_Y_copy_##width##_##height )(p_src,     \
+                                                          p_dest, i_stride); \
+                break;                                                       \
+            case 3:                                                          \
+                _M( MotionComponent_X_Y_copy_##width##_##height )(p_src,     \
+                                                          p_dest, i_stride); \
+                break;                                                       \
+            }                                                                \
+        }                                                                    \
+        else                                                                 \
+        {                                                                    \
+            switch (i_select)                                                \
+            {                                                                \
+            case 0:                                                          \
+                _M( MotionComponent_x_y_avg_##width##_##height )(p_src,      \
+                                                          p_dest, i_stride); \
+                break;                                                       \
+            case 1:                                                          \
+                _M( MotionComponent_X_y_avg_##width##_##height )(p_src,      \
+                                                          p_dest, i_stride); \
+                break;                                                       \
+            case 2:                                                          \
+                _M( MotionComponent_x_Y_avg_##width##_##height )(p_src,      \
+                                                          p_dest, i_stride); \
+                break;                                                       \
+            case 3:                                                          \
+                _M( MotionComponent_X_Y_avg_##width##_##height )(p_src,      \
+                                                          p_dest, i_stride); \
+                break;                                                       \
+            }                                                                \
+        }                                                                    \
+    }
+
+/*****************************************************************************
+ * vdec_MotionComponent : last stage of motion compensation
+ *****************************************************************************/
+static __inline__ void MotionComponent(
+                    pixel_data_t * p_src,   /* source block */
+                    pixel_data_t * p_dest,  /* dest block */
+                    int i_width,            /* (explicit) width of block */
+                    int i_height,           /* (explicit) height of block */
+                    int i_stride,           /* number of coeffs to jump
+                                             * between each predicted line */
+                    int i_select,           /* half-pel vectors */
+                    boolean_t b_average     /* (explicit) averaging of several
+                                             * predictions */ )
+{
+    ___callTheRightOne (16,16)
+    ___callTheRightOne (16,8)
+    ___callTheRightOne (8,8)
+    ___callTheRightOne (8,4)
+#if 0
+    ___callTheRightOne (8,16)
+#endif
+}
+
+/*****************************************************************************
+ * Motion420 : motion compensation for a 4:2:0 macroblock
+ *****************************************************************************/
+static __inline__ void Motion420(
+                    macroblock_t * p_mb,        /* destination macroblock */
+                    picture_t * p_source,       /* source picture */
+                    boolean_t b_source_field,   /* source field */
+                    boolean_t b_dest_field,     /* destination field */
+                    int i_mv_x, int i_mv_y,     /* motion vector coordinates,
+                                                 * in half pels */
+                    int i_l_stride,             /* number of coeffs to jump to
+                                                 * go to the next predicted
+                                                 * line */
+                    int i_c_stride,
+                    int i_height,               /* height of the block to
+                                                 * predict, in luminance
+                                                 * (explicit) */
+                    int i_offset,               /* position of the first
+                                                 * predicted line (explicit) */
+                    boolean_t b_average         /* (explicit) averaging of
+                                                 * several predictions */ )
+{
+    /* Temporary variables to avoid recalculating things twice */
+    int     i_source_offset, i_dest_offset, i_c_height, i_c_select;
+
+    i_source_offset = (p_mb->i_l_x + (i_mv_x >> 1))
+                       + (p_mb->i_motion_l_y + i_offset
+                         + b_source_field)
+                       * p_mb->p_picture->i_width
+                       + (i_mv_y >> 1) * i_l_stride;
+
+    if( i_source_offset >= p_source->i_size )
+    {
+        intf_WarnMsg( 2, "Bad motion vector (lum)" );
+        return;
+    }
+
+    /* Luminance */
+    MotionComponent( /* source */
+                     p_source->planes[ Y_PLANE ].p_data
+                       + i_source_offset,
+                     /* destination */
+                     p_mb->p_picture->planes[ Y_PLANE ].p_data
+                       + (p_mb->i_l_x)
+                       + (p_mb->i_motion_l_y + b_dest_field + i_offset)
+                         * p_mb->p_picture->i_width,
+                     /* prediction width and height */
+                     16, i_height,
+                     /* stride */
+                     i_l_stride,
+                     /* select */
+                     ((i_mv_y & 1) << 1) | (i_mv_x & 1),
+                     b_average );
+
+    i_source_offset = (p_mb->i_c_x + ((i_mv_x/2) >> 1))
+                        + (p_mb->i_motion_c_y + (i_offset >> 1)
+                           + b_source_field)
+                          * p_mb->p_picture->i_chroma_width
+                        + ((i_mv_y/2) >> 1) * i_c_stride;
+
+    if( i_source_offset >= p_source->i_chroma_size )
+    {
+        intf_WarnMsg( 2, "Bad motion vector (chroma)" );
+        return;
+    }
+
+    i_dest_offset = (p_mb->i_c_x)
+                      + (p_mb->i_motion_c_y + b_dest_field
+                          + (i_offset >> 1))
+                        * p_mb->p_picture->i_chroma_width;
+    i_c_height = i_height >> 1;
+    i_c_select = (((i_mv_y/2) & 1) << 1) | ((i_mv_x/2) & 1);
+
+    /* Chrominance Cr */
+    MotionComponent( p_source->planes[ U_PLANE ].p_data
+                       + i_source_offset,
+                     p_mb->p_picture->planes[ U_PLANE ].p_data
+                       + i_dest_offset,
+                     8, i_c_height, i_c_stride,
+                     i_c_select, b_average );
+
+    /* Chrominance Cb */
+    MotionComponent( p_source->planes[ V_PLANE ].p_data
+                       + i_source_offset,
+                     p_mb->p_picture->planes[ V_PLANE ].p_data
+                       + i_dest_offset,
+                     8, i_c_height, i_c_stride,
+                     i_c_select, b_average );
+}
+
+/*****************************************************************************
+ * Motion422 : motion compensation for a 4:2:2 macroblock
+ *****************************************************************************/
+static __inline__ void Motion422(
+                    macroblock_t * p_mb,        /* destination macroblock */
+                    picture_t * p_source,       /* source picture */
+                    boolean_t b_source_field,   /* source field */
+                    boolean_t b_dest_field,     /* destination field */
+                    int i_mv_x, int i_mv_y,     /* motion vector coordinates,
+                                                 * in half pels */
+                    int i_l_stride,             /* number of coeffs to jump to
+                                                 * go to the next predicted
+                                                 * line */
+                    int i_c_stride,
+                    int i_height,               /* height of the block to
+                                                 * predict, in luminance
+                                                 * (explicit) */
+                    int i_offset,               /* position of the first
+                                                 * predicted line (explicit) */
+                    boolean_t b_average         /* (explicit) averaging of
+                                                 * several predictions */ )
+{
+#if 0
+    int     i_source_offset, i_dest_offset, i_c_select;
+
+    /* Luminance */
+    MotionComponent( /* source */
+                     p_source->planes[ Y_PLANE ].p_data
+                       + (p_mb->i_l_x + (i_mv_x >> 1))
+                       + (p_mb->i_motion_l_y + i_offset
+                          + b_source_field)
+                       * p_mb->p_picture->i_width
+                       + (i_mv_y >> 1) * p_mb->i_l_stride,
+                     /* destination */
+                     p_mb->p_picture->planes[ Y_PLANE ].p_data
+                       + (p_mb->i_l_x)
+                       + (p_mb->i_motion_l_y + b_dest_field)
+                         * p_mb->p_picture->i_width,
+                     /* prediction width and height */
+                     16, i_height,
+                     /* stride */
+                     i_l_stride,
+                     /* select */
+                     ((i_mv_y & 1) << 1) | (i_mv_x & 1),
+                     b_average );
+
+    i_source_offset = (p_mb->i_c_x + ((i_mv_x/2) >> 1))
+                        + (p_mb->i_motion_c_y + i_offset
+                           + b_source_field)
+                        * p_mb->p_picture->i_chroma_width
+                        + (i_mv_y) >> 1) * p_mb->i_c_stride;
+    i_dest_offset = (p_mb->i_c_x)
+                      + (p_mb->i_motion_c_y + b_dest_field)
+                        * p_mb->p_picture->i_chroma_width;
+    i_c_select = ((i_mv_y & 1) << 1) | ((i_mv_x/2) & 1);
+
+    /* Chrominance Cr */
+    MotionComponent( p_source->planes[ U_PLANE ].p_data
+                       + i_source_offset,
+                     p_mb->p_picture->planes[ U_PLANE ].p_data
+                       + i_dest_offset,
+                     8, i_height, i_c_stride,
+                     i_c_select, b_average );
+
+    /* Chrominance Cb */
+    MotionComponent( p_source->planes[ V_PLANE ].p_data
+                       + i_source_offset,
+                     p_mb->p_picture->planes[ U_PLANE ].p_data
+                       + i_dest_offset,
+                     8, i_height, i_c_stride,
+                     i_c_select, b_average );
+#endif
+}
+
+/*****************************************************************************
+ * Motion444 : motion compensation for a 4:4:4 macroblock
+ *****************************************************************************/
+static __inline__ void Motion444(
+                    macroblock_t * p_mb,        /* destination macroblock */
+                    picture_t * p_source,       /* source picture */
+                    boolean_t b_source_field,   /* source field */
+                    boolean_t b_dest_field,     /* destination field */
+                    int i_mv_x, int i_mv_y,     /* motion vector coordinates,
+                                                 * in half pels */
+                    int i_l_stride,             /* number of coeffs to jump to
+                                                 * go to the next predicted
+                                                 * line */
+                    int i_c_stride,
+                    int i_height,               /* height of the block to
+                                                 * predict, in luminance
+                                                 * (explicit) */
+                    int i_offset,               /* position of the first
+                                                 * predicted line (explicit) */
+                    boolean_t b_average         /* (explicit) averaging of
+                                                 * several predictions */ )
+{
+#if 0
+    int     i_source_offset, i_dest_offset, i_select;
+
+    i_source_offset = (p_mb->i_l_x + (i_mv_x >> 1))
+                        + (p_mb->i_motion_l_y + i_offset
+                           + b_source_field)
+                        * p_mb->p_picture->i_width
+                        + (i_mv_y >> 1) * p_mb->i_l_stride;
+    i_dest_offset = (p_mb->i_l_x)
+                      + (p_mb->i_motion_l_y + b_dest_field)
+                        * p_mb->p_picture->i_width;
+    i_select = ((i_mv_y & 1) << 1) | (i_mv_x & 1);
+
+
+    /* Luminance */
+    MotionComponent( p_source->planes[ Y_PLANE ].p_data
+                       + i_source_offset,
+                     p_mb->p_picture->planes[ Y_PLANE ].p_data
+                       + i_dest_offset,
+                     16, i_height, i_l_stride,
+                     i_select, b_average );
+
+    /* Chrominance Cr */
+    MotionComponent( p_source->planes[ U_PLANE ].p_data
+                       + i_source_offset,
+                     p_mb->p_picture->planes[ U_PLANE ].p_data
+                       + i_dest_offset,
+                     16, i_height, i_l_stride,
+                     i_select, b_average );
+
+    /* Chrominance Cb */
+    MotionComponent( p_source->planes[ V_PLANE ].p_data
+                       + i_source_offset,
+                     p_mb->p_picture->planes[ V_PLANE ].p_data
+                       + i_dest_offset,
+                     16, i_height, i_l_stride,
+                     i_select, b_average );
+#endif
+}
+
+/*****************************************************************************
+ * vdec_MotionFieldField : motion compensation for field motion type (field)
+ *****************************************************************************/
+#define FIELDFIELD( MOTION )                                            \
+{                                                                       \
+    picture_t *     p_pred;                                             \
+                                                                        \
+    if( p_mb->i_mb_type & MB_MOTION_FORWARD )                           \
+    {                                                                   \
+        if( p_mb->b_P_second                                            \
+             && (p_mb->b_motion_field != p_mb->ppi_field_select[0][0]) )\
+            p_pred = p_mb->p_picture;                                   \
+        else                                                            \
+            p_pred = p_mb->p_forward;                                   \
+                                                                        \
+        MOTION( p_mb, p_pred, p_mb->ppi_field_select[0][0],             \
+                p_mb->b_motion_field,                                   \
+                p_mb->pppi_motion_vectors[0][0][0],                     \
+                p_mb->pppi_motion_vectors[0][0][1],                     \
+                p_mb->i_l_stride, p_mb->i_c_stride, 16, 0, 0 );         \
+                                                                        \
+        if( p_mb->i_mb_type & MB_MOTION_BACKWARD )                      \
+        {                                                               \
+            MOTION( p_mb, p_mb->p_backward,                             \
+                    p_mb->ppi_field_select[0][1],                       \
+                    p_mb->b_motion_field,                               \
+                    p_mb->pppi_motion_vectors[0][1][0],                 \
+                    p_mb->pppi_motion_vectors[0][1][1],                 \
+                    p_mb->i_l_stride, p_mb->i_c_stride, 16, 0, 1 );     \
+        }                                                               \
+    }                                                                   \
+                                                                        \
+    else /* MB_MOTION_BACKWARD */                                       \
+    {                                                                   \
+        MOTION( p_mb, p_mb->p_backward, p_mb->ppi_field_select[0][1],   \
+                p_mb->b_motion_field,                                   \
+                p_mb->pppi_motion_vectors[0][1][0],                     \
+                p_mb->pppi_motion_vectors[0][1][1],                     \
+                p_mb->i_l_stride, p_mb->i_c_stride, 16, 0, 0 );         \
+    }                                                                   \
+}
+
+static void vdec_MotionFieldField420( macroblock_t * p_mb )
+{
+    FIELDFIELD( Motion420 )
+}
+
+static void vdec_MotionFieldField422( macroblock_t * p_mb )
+{
+    //FIELDFIELD( Motion422 )
+}
+
+static void vdec_MotionFieldField444( macroblock_t * p_mb )
+{
+    //FIELDFIELD( Motion444 )
+}
+
+/*****************************************************************************
+ * vdec_MotionField16x8XXX: motion compensation for 16x8 motion type (field)
+ *****************************************************************************/
+#define FIELD16X8( MOTION )                                             \
+{                                                                       \
+    picture_t *     p_pred;                                             \
+                                                                        \
+    if( p_mb->i_mb_type & MB_MOTION_FORWARD )                           \
+    {                                                                   \
+        if( p_mb->b_P_second                                            \
+             && (p_mb->b_motion_field != p_mb->ppi_field_select[0][0]) )\
+            p_pred = p_mb->p_picture;                                   \
+        else                                                            \
+            p_pred = p_mb->p_forward;                                   \
+                                                                        \
+        MOTION( p_mb, p_pred, p_mb->ppi_field_select[0][0],             \
+                p_mb->b_motion_field,                                   \
+                p_mb->pppi_motion_vectors[0][0][0],                     \
+                p_mb->pppi_motion_vectors[0][0][1],                     \
+                p_mb->i_l_stride, p_mb->i_c_stride, 8, 0, 0 );          \
+                                                                        \
+        if( p_mb->b_P_second                                            \
+             && (p_mb->b_motion_field != p_mb->ppi_field_select[1][0]) )\
+            p_pred = p_mb->p_picture;                                   \
+        else                                                            \
+            p_pred = p_mb->p_forward;                                   \
+                                                                        \
+        MOTION( p_mb, p_pred, p_mb->ppi_field_select[1][0],             \
+                p_mb->b_motion_field,                                   \
+                p_mb->pppi_motion_vectors[1][0][0],                     \
+                p_mb->pppi_motion_vectors[1][0][1],                     \
+                p_mb->i_l_stride, p_mb->i_c_stride, 8, 8, 0 );          \
+                                                                        \
+        if( p_mb->i_mb_type & MB_MOTION_BACKWARD )                      \
+        {                                                               \
+            MOTION( p_mb, p_mb->p_backward,                             \
+                    p_mb->ppi_field_select[0][1],                       \
+                    p_mb->b_motion_field,                               \
+                    p_mb->pppi_motion_vectors[0][1][0],                 \
+                    p_mb->pppi_motion_vectors[0][1][1],                 \
+                    p_mb->i_l_stride, p_mb->i_c_stride, 8, 0, 1 );      \
+                                                                        \
+            MOTION( p_mb, p_mb->p_backward,                             \
+                    p_mb->ppi_field_select[1][1],                       \
+                    p_mb->b_motion_field,                               \
+                    p_mb->pppi_motion_vectors[1][1][0],                 \
+                    p_mb->pppi_motion_vectors[1][1][1],                 \
+                    p_mb->i_l_stride, p_mb->i_c_stride, 8, 8, 1 );      \
+        }                                                               \
+    }                                                                   \
+                                                                        \
+    else /* MB_MOTION_BACKWARD */                                       \
+    {                                                                   \
+        MOTION( p_mb, p_mb->p_backward, p_mb->ppi_field_select[0][1],   \
+                p_mb->b_motion_field,                                   \
+                p_mb->pppi_motion_vectors[0][1][0],                     \
+                p_mb->pppi_motion_vectors[0][1][1],                     \
+                p_mb->i_l_stride, p_mb->i_c_stride, 8, 0, 0 );          \
+                                                                        \
+        MOTION( p_mb, p_mb->p_backward, p_mb->ppi_field_select[1][1],   \
+                p_mb->b_motion_field,                                   \
+                p_mb->pppi_motion_vectors[1][1][0],                     \
+                p_mb->pppi_motion_vectors[1][1][1],                     \
+                p_mb->i_l_stride, p_mb->i_c_stride, 8, 8, 0 );          \
+    }                                                                   \
+}
+
+static void vdec_MotionField16x8420( macroblock_t * p_mb )
+{
+    FIELD16X8( Motion420 )
+}
+
+static void vdec_MotionField16x8422( macroblock_t * p_mb )
+{
+    //FIELD16X8( Motion422 )
+}
+
+static void vdec_MotionField16x8444( macroblock_t * p_mb )
+{
+    //FIELD16X8( Motion444 )
+}
+
+/*****************************************************************************
+ * vdec_MotionFieldDMVXXX : motion compensation for dmv motion type (field)
+ *****************************************************************************/
+#define FIELDDMV( MOTION )                                              \
+{                                                                       \
+    /* This is necessarily a MOTION_FORWARD only macroblock, in a P     \
+     * picture. */                                                      \
+    picture_t *     p_pred;                                             \
+                                                                        \
+    /* predict from field of same parity */                             \
+    MOTION( p_mb, p_mb->p_forward,                                      \
+            p_mb->b_motion_field, p_mb->b_motion_field,                 \
+            p_mb->pppi_motion_vectors[0][0][0],                         \
+            p_mb->pppi_motion_vectors[0][0][1],                         \
+            p_mb->i_l_stride, p_mb->i_c_stride, 16, 0, 0 );             \
+                                                                        \
+    if( p_mb->b_P_second )                                              \
+        p_pred = p_mb->p_picture;                                       \
+    else                                                                \
+        p_pred = p_mb->p_forward;                                       \
+                                                                        \
+    /* predict from field of opposite parity */                         \
+    MOTION( p_mb, p_pred, !p_mb->b_motion_field, p_mb->b_motion_field,  \
+            p_mb->ppi_dmv[0][0], p_mb->ppi_dmv[0][1],                   \
+            p_mb->i_l_stride, p_mb->i_c_stride, 16, 0, 1 );             \
+} /* FIELDDMV */
+
+static void vdec_MotionFieldDMV420( macroblock_t * p_mb )
+{
+    FIELDDMV( Motion420 )
+}
+
+static void vdec_MotionFieldDMV422( macroblock_t * p_mb )
+{
+    //FIELDDMV( Motion422 )
+}
+
+static void vdec_MotionFieldDMV444( macroblock_t * p_mb )
+{
+    //FIELDDMV( Motion444 )
+}
+
+/*****************************************************************************
+ * vdec_MotionFrameFrameXXX?? : motion compensation for frame motion type (frame)
+ *****************************************************************************/
+#define FRAMEFRAME( MOTION )                                            \
+{                                                                       \
+    if( p_mb->i_mb_type & MB_MOTION_FORWARD )                           \
+    {                                                                   \
+        MOTION( p_mb, p_mb->p_forward, 0, 0,                            \
+                p_mb->pppi_motion_vectors[0][0][0],                     \
+                p_mb->pppi_motion_vectors[0][0][1],                     \
+                p_mb->i_l_stride, p_mb->i_c_stride, 16, 0, 0 );         \
+                                                                        \
+        if( p_mb->i_mb_type & MB_MOTION_BACKWARD )                      \
+        {                                                               \
+            MOTION( p_mb, p_mb->p_backward, 0, 0,                       \
+                    p_mb->pppi_motion_vectors[0][1][0],                 \
+                    p_mb->pppi_motion_vectors[0][1][1],                 \
+                    p_mb->i_l_stride, p_mb->i_c_stride, 16, 0, 1 );     \
+        }                                                               \
+    }                                                                   \
+                                                                        \
+    else /* MB_MOTION_BACKWARD */                                       \
+    {                                                                   \
+        MOTION( p_mb, p_mb->p_backward, 0, 0,                           \
+                p_mb->pppi_motion_vectors[0][1][0],                     \
+                p_mb->pppi_motion_vectors[0][1][1],                     \
+                p_mb->i_l_stride, p_mb->i_c_stride, 16, 0, 0 );         \
+    }                                                                   \
+} /* FRAMEFRAME */
+
+static void vdec_MotionFrameFrame420( macroblock_t * p_mb )
+{
+    FRAMEFRAME( Motion420 )
+}
+
+static void vdec_MotionFrameFrame422( macroblock_t * p_mb )
+{
+    //FRAMEFRAME( Motion422 )
+}
+
+static void vdec_MotionFrameFrame444( macroblock_t * p_mb )
+{
+    //FRAMEFRAME( Motion444 )
+}
+
+/*****************************************************************************
+ * vdec_MotionFrameFieldXXX?? : motion compensation for field motion type (frame)
+ *****************************************************************************/
+#define FRAMEFIELD( MOTION )                                            \
+{                                                                       \
+    int i_l_stride = p_mb->i_l_stride << 1;                             \
+    int i_c_stride = p_mb->i_c_stride << 1;                             \
+                                                                        \
+    if( p_mb->i_mb_type & MB_MOTION_FORWARD )                           \
+    {                                                                   \
+        MOTION( p_mb, p_mb->p_forward, p_mb->ppi_field_select[0][0], 0, \
+                p_mb->pppi_motion_vectors[0][0][0],                     \
+                p_mb->pppi_motion_vectors[0][0][1] >> 1,                \
+                i_l_stride, i_c_stride, 8, 0, 0 );                      \
+                                                                        \
+        MOTION( p_mb, p_mb->p_forward, p_mb->ppi_field_select[1][0], 1, \
+                p_mb->pppi_motion_vectors[1][0][0],                     \
+                p_mb->pppi_motion_vectors[1][0][1] >> 1,                \
+                i_l_stride, i_c_stride, 8, 0, 0 );                      \
+                                                                        \
+        if( p_mb->i_mb_type & MB_MOTION_BACKWARD )                      \
+        {                                                               \
+            MOTION( p_mb, p_mb->p_backward,                             \
+                    p_mb->ppi_field_select[0][1], 0,                    \
+                    p_mb->pppi_motion_vectors[0][1][0],                 \
+                    p_mb->pppi_motion_vectors[0][1][1] >> 1,            \
+                    i_l_stride, i_c_stride, 8, 0, 1 );                  \
+                                                                        \
+            MOTION( p_mb, p_mb->p_backward,                             \
+                    p_mb->ppi_field_select[1][1], 1,                    \
+                    p_mb->pppi_motion_vectors[1][1][0],                 \
+                    p_mb->pppi_motion_vectors[1][1][1] >> 1,            \
+                    i_l_stride, i_c_stride, 8, 0, 1 );                  \
+        }                                                               \
+    }                                                                   \
+                                                                        \
+    else /* MB_MOTION_BACKWARD only */                                  \
+    {                                                                   \
+        MOTION( p_mb, p_mb->p_backward, p_mb->ppi_field_select[0][1], 0,\
+                p_mb->pppi_motion_vectors[0][1][0],                     \
+                p_mb->pppi_motion_vectors[0][1][1] >> 1,                \
+                i_l_stride, i_c_stride, 8, 0, 0 );                      \
+                                                                        \
+        MOTION( p_mb, p_mb->p_backward, p_mb->ppi_field_select[1][1], 1,\
+                p_mb->pppi_motion_vectors[1][1][0],                     \
+                p_mb->pppi_motion_vectors[1][1][1] >> 1,                \
+                i_l_stride, i_c_stride, 8, 0, 0 );                      \
+    }                                                                   \
+} /* FRAMEFIELD */
+
+static void vdec_MotionFrameField420( macroblock_t * p_mb )
+{
+    FRAMEFIELD( Motion420 )
+}
+
+static void vdec_MotionFrameField422( macroblock_t * p_mb )
+{
+    //FRAMEFIELD( Motion422 )
+}
+
+static void vdec_MotionFrameField444( macroblock_t * p_mb )
+{
+    //FRAMEFIELD( Motion444 )
+}
+
+/*****************************************************************************
+ * vdec_MotionFrameDMVXXX?? : motion compensation for dmv motion type (frame)
+ *****************************************************************************/
+#define FRAMEDMV( MOTION )                                              \
+{                                                                       \
+    /* This is necessarily a MOTION_FORWARD only macroblock, in a P     \
+     * picture. */                                                      \
+                                                                        \
+    /* predict top field from top field */                              \
+    MOTION( p_mb, p_mb->p_forward, 0, 0,                                \
+            p_mb->pppi_motion_vectors[0][0][0],                         \
+            p_mb->pppi_motion_vectors[0][0][1],                         \
+            /* XXX?? XXX?? >> 1 ? */                                    \
+            p_mb->i_l_stride << 1, p_mb->i_c_stride << 1, 8, 0, 0 );    \
+                                                                        \
+    /* predict and add to top field from bottom field */                \
+    MOTION( p_mb, p_mb->p_forward, 1, 0,                                \
+            p_mb->ppi_dmv[0][0], p_mb->ppi_dmv[0][1],                   \
+            p_mb->i_l_stride << 1, p_mb->i_c_stride << 1, 8, 0, 1 );    \
+                                                                        \
+    /* predict bottom field from bottom field */                        \
+    MOTION( p_mb, p_mb->p_forward, 1, 1,                                \
+            p_mb->pppi_motion_vectors[0][0][0],                         \
+            p_mb->pppi_motion_vectors[0][0][1],                         \
+            /* XXX?? XXX?? >> 1 ? */                                    \
+            p_mb->i_l_stride << 1, p_mb->i_c_stride << 1, 8, 0, 0 );    \
+                                                                        \
+    /* predict and add to bottom field from top field */                \
+    MOTION( p_mb, p_mb->p_forward, 1, 0,                                \
+            p_mb->ppi_dmv[1][0], p_mb->ppi_dmv[1][1],                   \
+            p_mb->i_l_stride << 1, p_mb->i_c_stride << 1, 8, 0, 1 );    \
+} /* FRAMEDMV */
+
+static void vdec_MotionFrameDMV420( macroblock_t * p_mb )
+{
+    FRAMEDMV( Motion420 )
+}
+
+static void vdec_MotionFrameDMV422( macroblock_t * p_mb )
+{
+    //FRAMEDMV( Motion422 )
+}
+
+static void vdec_MotionFrameDMV444( macroblock_t * p_mb )
+{
+    //FRAMEDMV( Motion444 )
+}
+
diff --git a/plugins/motion/vdec_motion_inner.c b/plugins/motion/vdec_motion_inner.c
new file mode 100644 (file)
index 0000000..939252f
--- /dev/null
@@ -0,0 +1,219 @@
+/*****************************************************************************
+ * vdec_motion_inner.c : motion compensation inner routines
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: vdec_motion_inner.c,v 1.5 2001/12/09 17:01:36 sam Exp $
+ *
+ * Authors: Christophe Massiot <massiot@via.ecp.fr>
+ *          Jean-Marc Dressler <polux@via.ecp.fr>
+ *          Michel Lespinasse <walken@via.ecp.fr>
+ *
+ * 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.
+ *****************************************************************************/
+
+#define MODULE_NAME motion
+#include "modules_inner.h"
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include "common.h"
+#include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
+#include "threads.h"
+#include "mtime.h"
+
+#include "video.h"
+
+#define __MotionComponent_x_y_copy(width,height)                        \
+void _M(MotionComponent_x_y_copy_##width##_##height)                    \
+        ( pixel_data_t *p_src, pixel_data_t *p_dest, int i_stride )     \
+{                                                                       \
+    int i_x, i_y;                                                       \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            p_dest[i_x] = p_src[i_x];                                   \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
+}
+
+#define __MotionComponent_X_y_copy(width,height)                        \
+void _M(MotionComponent_X_y_copy_##width##_##height)                    \
+        ( pixel_data_t *p_src, pixel_data_t *p_dest, int i_stride )     \
+{                                                                       \
+    int i_x, i_y;                                                       \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            p_dest[i_x] = (unsigned int)(p_src[i_x]                     \
+                                         + p_src[i_x + 1]               \
+                                         + 1) >> 1;                     \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
+}
+
+#define __MotionComponent_x_Y_copy(width,height)                        \
+void _M(MotionComponent_x_Y_copy_##width##_##height)                    \
+        ( pixel_data_t *p_src, pixel_data_t *p_dest, int i_stride )     \
+{                                                                       \
+    int i_x, i_y;                                                       \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            p_dest[i_x] = (unsigned int)(p_src[i_x]                     \
+                                         + p_src[i_x + i_stride]        \
+                                         + 1) >> 1;                     \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
+}
+
+#define __MotionComponent_X_Y_copy(width,height)                        \
+void _M(MotionComponent_X_Y_copy_##width##_##height)                    \
+        ( pixel_data_t *p_src, pixel_data_t *p_dest, int i_stride )     \
+{                                                                       \
+    int i_x, i_y;                                                       \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            p_dest[i_x] = (unsigned int)(p_src[i_x]                     \
+                                         + p_src[i_x + 1]               \
+                                         + p_src[i_x + i_stride]        \
+                                         + p_src[i_x + i_stride + 1]    \
+                                         + 2) >> 2;                     \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
+}
+
+#define __MotionComponent_x_y_avg(width,height)                         \
+void _M(MotionComponent_x_y_avg_##width##_##height)                     \
+        ( pixel_data_t * p_src, pixel_data_t * p_dest, int i_stride )   \
+{                                                                       \
+    int i_x, i_y;                                                       \
+    unsigned int i_dummy;                                               \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            i_dummy = p_dest[i_x] + p_src[i_x];                         \
+            p_dest[i_x] = (i_dummy + 1) >> 1;                           \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
+}
+
+#define __MotionComponent_X_y_avg(width,height)                         \
+void _M(MotionComponent_X_y_avg_##width##_##height)                     \
+        ( pixel_data_t * p_src, pixel_data_t * p_dest, int i_stride )   \
+{                                                                       \
+    int i_x, i_y;                                                       \
+    unsigned int i_dummy;                                               \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            i_dummy = p_dest[i_x] + ((unsigned int)(p_src[i_x]          \
+                                                    + p_src[i_x + 1]    \
+                                                    + 1) >> 1);         \
+            p_dest[i_x] = (i_dummy + 1) >> 1;                           \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
+}
+
+#define __MotionComponent_x_Y_avg(width,height)                         \
+void _M(MotionComponent_x_Y_avg_##width##_##height)                     \
+        ( pixel_data_t * p_src, pixel_data_t * p_dest, int i_stride )   \
+{                                                                       \
+    int i_x, i_y;                                                       \
+    unsigned int i_dummy;                                               \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            i_dummy =                                                   \
+                p_dest[i_x] + ((unsigned int)(p_src[i_x]                \
+                                              + p_src[i_x + i_stride]   \
+                                              + 1) >> 1);               \
+            p_dest[i_x] = (i_dummy + 1) >> 1;                           \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
+}
+
+#define __MotionComponent_X_Y_avg(width,height)                         \
+void _M(MotionComponent_X_Y_avg_##width##_##height)                     \
+        ( pixel_data_t * p_src, pixel_data_t * p_dest, int i_stride )   \
+{                                                                       \
+    int i_x, i_y;                                                       \
+    unsigned int i_dummy;                                               \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            i_dummy =                                                   \
+                p_dest[i_x] + ((unsigned int)(p_src[i_x]                \
+                                            + p_src[i_x + 1]            \
+                                            + p_src[i_x + i_stride]     \
+                                            + p_src[i_x + i_stride + 1] \
+                                            + 2) >> 2);                 \
+            p_dest[i_x] = (i_dummy + 1) >> 1;                           \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
+}
+
+#define __MotionComponents(width,height)        \
+__MotionComponent_x_y_copy(width,height)        \
+__MotionComponent_X_y_copy(width,height)        \
+__MotionComponent_x_Y_copy(width,height)        \
+__MotionComponent_X_Y_copy(width,height)        \
+__MotionComponent_x_y_avg(width,height)         \
+__MotionComponent_X_y_avg(width,height)         \
+__MotionComponent_x_Y_avg(width,height)         \
+__MotionComponent_X_Y_avg(width,height)
+
+__MotionComponents (16,16)      /* 444, 422, 420 */
+__MotionComponents (16,8)       /* 444, 422, 420 */
+__MotionComponents (8,8)        /* 422, 420 */
+__MotionComponents (8,4)        /* 420 */
+#if 0
+__MotionComponents (8,16)       /* 422 */
+#endif
diff --git a/plugins/motion/vdec_motion_inner_mmx.c b/plugins/motion/vdec_motion_inner_mmx.c
new file mode 100644 (file)
index 0000000..193802a
--- /dev/null
@@ -0,0 +1,474 @@
+/*****************************************************************************
+ * vdec_motion_inner_mmx.c : motion compensation inner routines optimized in
+ *                           MMX
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: vdec_motion_inner_mmx.c,v 1.5 2001/12/09 17:01:36 sam Exp $
+ *
+ * Authors: Christophe Massiot <massiot@via.ecp.fr>, largerly inspired by the
+ *          work done by the livid project <http://www.linuxvideo.org/>
+ *
+ * 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.
+ *****************************************************************************/
+
+#define MODULE_NAME motionmmx
+#include "modules_inner.h"
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include "common.h"
+#include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
+#include "threads.h"
+#include "mtime.h"
+
+#include "video.h"
+
+#include "attributes.h"
+#include "mmx.h"
+
+/* OK, I know, this code has been taken from livid's mpeg2dec --Meuuh */
+
+/* Some rounding constants */
+mmx_t round1 = {0x0001000100010001LL};
+mmx_t round4 = {0x0002000200020002LL};
+
+/*
+ * Useful functions
+ */
+
+static __inline__ void MMXZeroReg()
+{
+   /* load 0 into mm0 */
+   pxor_r2r(mm0,mm0);
+}
+
+static __inline__ void MMXAverage2( u8 *dst, u8 *src1, u8 *src2 )
+{
+   //
+   // *dst = clip_to_u8((*src1 + *src2 + 1)/2);
+   //
+
+   movq_m2r(*src1,mm1);        // load 8 src1 bytes
+   movq_r2r(mm1,mm2);          // copy 8 src1 bytes
+
+   movq_m2r(*src2,mm3);        // load 8 src2 bytes
+   movq_r2r(mm3,mm4);          // copy 8 src2 bytes
+
+   punpcklbw_r2r(mm0,mm1);     // unpack low src1 bytes
+   punpckhbw_r2r(mm0,mm2);     // unpack high src1 bytes
+
+   punpcklbw_r2r(mm0,mm3);     // unpack low src2 bytes
+   punpckhbw_r2r(mm0,mm4);     // unpack high src2 bytes
+
+   paddw_r2r(mm3,mm1);         // add lows to mm1
+   paddw_m2r(round1,mm1);
+   psraw_i2r(1,mm1);           // /2
+
+   paddw_r2r(mm4,mm2);         // add highs to mm2
+   paddw_m2r(round1,mm2);
+   psraw_i2r(1,mm2);           // /2
+
+   packuswb_r2r(mm2,mm1);      // pack (w/ saturation)
+   movq_r2m(mm1,*dst);         // store result in dst
+}
+
+static __inline__ void MMXInterpAverage2( u8 *dst, u8 *src1, u8 *src2 )
+{
+   //
+   // *dst = clip_to_u8((*dst + (*src1 + *src2 + 1)/2 + 1)/2);
+   //
+
+   movq_m2r(*dst,mm1);            // load 8 dst bytes
+   movq_r2r(mm1,mm2);             // copy 8 dst bytes
+
+   movq_m2r(*src1,mm3);           // load 8 src1 bytes
+   movq_r2r(mm3,mm4);             // copy 8 src1 bytes
+
+   movq_m2r(*src2,mm5);           // load 8 src2 bytes
+   movq_r2r(mm5,mm6);             // copy 8 src2 bytes
+
+   punpcklbw_r2r(mm0,mm1);        // unpack low dst bytes
+   punpckhbw_r2r(mm0,mm2);        // unpack high dst bytes
+
+   punpcklbw_r2r(mm0,mm3);        // unpack low src1 bytes
+   punpckhbw_r2r(mm0,mm4);        // unpack high src1 bytes
+
+   punpcklbw_r2r(mm0,mm5);        // unpack low src2 bytes
+   punpckhbw_r2r(mm0,mm6);        // unpack high src2 bytes
+
+   paddw_r2r(mm5,mm3);            // add lows
+   paddw_m2r(round1,mm3);
+   psraw_i2r(1,mm3);              // /2
+
+   paddw_r2r(mm6,mm4);            // add highs
+   paddw_m2r(round1,mm4);
+   psraw_i2r(1,mm4);              // /2
+
+   paddw_r2r(mm3,mm1);            // add lows
+   paddw_m2r(round1,mm1);
+   psraw_i2r(1,mm1);              // /2
+
+   paddw_r2r(mm4,mm2);            // add highs
+   paddw_m2r(round1,mm2);
+   psraw_i2r(1,mm2);              // /2
+
+   packuswb_r2r(mm2,mm1);         // pack (w/ saturation)
+   movq_r2m(mm1,*dst);            // store result in dst
+}
+
+static __inline__ void MMXAverage4( u8 *dst, u8 *src1, u8 *src2, u8 *src3,
+                                    u8 *src4 )
+{
+   //
+   // *dst = (*src1 + *src2 + *src3 + *src4 + 2) / 4;
+   //
+
+   movq_m2r(*src1,mm1);                // load 8 src1 bytes
+   movq_r2r(mm1,mm2);                  // copy 8 src1 bytes
+
+   punpcklbw_r2r(mm0,mm1);             // unpack low src1 bytes
+   punpckhbw_r2r(mm0,mm2);             // unpack high src1 bytes
+
+   movq_m2r(*src2,mm3);                // load 8 src2 bytes
+   movq_r2r(mm3,mm4);                  // copy 8 src2 bytes
+
+   punpcklbw_r2r(mm0,mm3);             // unpack low src2 bytes
+   punpckhbw_r2r(mm0,mm4);             // unpack high src2 bytes
+
+   paddw_r2r(mm3,mm1);                 // add lows
+   paddw_r2r(mm4,mm2);                 // add highs
+
+   // now have partials in mm1 and mm2
+
+   movq_m2r(*src3,mm3);                // load 8 src3 bytes
+   movq_r2r(mm3,mm4);                  // copy 8 src3 bytes
+
+   punpcklbw_r2r(mm0,mm3);             // unpack low src3 bytes
+   punpckhbw_r2r(mm0,mm4);             // unpack high src3 bytes
+
+   paddw_r2r(mm3,mm1);                 // add lows
+   paddw_r2r(mm4,mm2);                 // add highs
+
+   movq_m2r(*src4,mm5);                // load 8 src4 bytes
+   movq_r2r(mm5,mm6);                  // copy 8 src4 bytes
+
+   punpcklbw_r2r(mm0,mm5);             // unpack low src4 bytes
+   punpckhbw_r2r(mm0,mm6);             // unpack high src4 bytes
+
+   paddw_r2r(mm5,mm1);                 // add lows
+   paddw_r2r(mm6,mm2);                 // add highs
+
+   // now have subtotal in mm1 and mm2
+
+   paddw_m2r(round4,mm1);
+   psraw_i2r(2,mm1);                   // /4
+   paddw_m2r(round4,mm2);
+   psraw_i2r(2,mm2);                   // /4
+
+   packuswb_r2r(mm2,mm1);              // pack (w/ saturation)
+   movq_r2m(mm1,*dst);                 // store result in dst
+}
+
+static __inline__ void MMXInterpAverage4( u8 *dst, u8 *src1, u8 *src2,
+                                          u8 *src3, u8 *src4 )
+{
+   //
+   // *dst = clip_to_u8((*dst + (*src1 + *src2 + *src3 + *src4 + 2)/4 + 1)/2);
+   //
+
+   movq_m2r(*src1,mm1);                // load 8 src1 bytes
+   movq_r2r(mm1,mm2);                  // copy 8 src1 bytes
+
+   punpcklbw_r2r(mm0,mm1);             // unpack low src1 bytes
+   punpckhbw_r2r(mm0,mm2);             // unpack high src1 bytes
+
+   movq_m2r(*src2,mm3);                // load 8 src2 bytes
+   movq_r2r(mm3,mm4);                  // copy 8 src2 bytes
+
+   punpcklbw_r2r(mm0,mm3);             // unpack low src2 bytes
+   punpckhbw_r2r(mm0,mm4);             // unpack high src2 bytes
+
+   paddw_r2r(mm3,mm1);                 // add lows
+   paddw_r2r(mm4,mm2);                 // add highs
+
+   // now have partials in mm1 and mm2
+
+   movq_m2r(*src3,mm3);                // load 8 src3 bytes
+   movq_r2r(mm3,mm4);                  // copy 8 src3 bytes
+
+   punpcklbw_r2r(mm0,mm3);             // unpack low src3 bytes
+   punpckhbw_r2r(mm0,mm4);             // unpack high src3 bytes
+
+   paddw_r2r(mm3,mm1);                 // add lows
+   paddw_r2r(mm4,mm2);                 // add highs
+
+   movq_m2r(*src4,mm5);                // load 8 src4 bytes
+   movq_r2r(mm5,mm6);                  // copy 8 src4 bytes
+
+   punpcklbw_r2r(mm0,mm5);             // unpack low src4 bytes
+   punpckhbw_r2r(mm0,mm6);             // unpack high src4 bytes
+
+   paddw_r2r(mm5,mm1);                 // add lows
+   paddw_r2r(mm6,mm2);                 // add highs
+
+   paddw_m2r(round4,mm1);
+   psraw_i2r(2,mm1);                   // /4
+   paddw_m2r(round4,mm2);
+   psraw_i2r(2,mm2);                   // /4
+
+   // now have subtotal/4 in mm1 and mm2
+
+   movq_m2r(*dst,mm3);                 // load 8 dst bytes
+   movq_r2r(mm3,mm4);                  // copy 8 dst bytes
+
+   punpcklbw_r2r(mm0,mm3);             // unpack low dst bytes
+   punpckhbw_r2r(mm0,mm4);             // unpack high dst bytes
+
+   paddw_r2r(mm3,mm1);                 // add lows
+   paddw_r2r(mm4,mm2);                 // add highs
+
+   paddw_m2r(round1,mm1);
+   psraw_i2r(1,mm1);                   // /2
+   paddw_m2r(round1,mm2);
+   psraw_i2r(1,mm2);                   // /2
+
+   // now have end value in mm1 and mm2
+
+   packuswb_r2r(mm2,mm1);              // pack (w/ saturation)
+   movq_r2m(mm1,*dst);                 // store result in dst
+}
+
+
+/*
+ * Actual Motion compensation
+ */
+
+#define pavg_r2r(src,dest)      pavgusb_r2r (src, dest);
+#define pavg_m2r(src,dest)      pavgusb_m2r (src, dest);
+
+#define __MotionComponent_x_y_copy(width,height)                            \
+void _M(MotionComponent_x_y_copy_##width##_##height)(pixel_data_t * p_src,  \
+                                                 pixel_data_t * p_dest,     \
+                                                 int i_stride)              \
+{                                                                           \
+    int i_y;                                                                \
+                                                                            \
+    MMXZeroReg();                                                           \
+                                                                            \
+    for( i_y = 0; i_y < height; i_y ++ )                                    \
+    {                                                                       \
+        movq_m2r( *p_src, mm0 );     /* load 8 ref bytes */                 \
+        if( width == 16 )                                                   \
+            movq_m2r( *(p_src + 8), mm1 );                                  \
+        p_src += i_stride;                                                  \
+                                                                            \
+        movq_r2m( mm0, *p_dest );    /* store 8 bytes at curr */            \
+        if( width == 16 )                                                   \
+            movq_r2m( mm1, *(p_dest + 8) );                                 \
+        p_dest += i_stride;                                                 \
+    }                                                                       \
+}
+
+#define __MotionComponent_X_y_copy(width,height)                            \
+void _M(MotionComponent_X_y_copy_##width##_##height)(pixel_data_t * p_src,  \
+                                                 pixel_data_t * p_dest,     \
+                                                 int i_stride)              \
+{                                                                           \
+    int i_y;                                                                \
+                                                                            \
+    MMXZeroReg();                                                           \
+                                                                            \
+    for( i_y = 0; i_y < height; i_y ++ )                                    \
+    {                                                                       \
+        MMXAverage2( p_dest, p_src, p_src + 1 );                            \
+                                                                            \
+        if( width == 16 )                                                   \
+        {                                                                   \
+            MMXAverage2( p_dest + 8, p_src + 8, p_src + 9 );                \
+        }                                                                   \
+                                                                            \
+        p_dest += i_stride;                                                 \
+        p_src += i_stride;                                                  \
+    }                                                                       \
+}
+
+#define __MotionComponent_x_Y_copy(width,height)                            \
+void _M(MotionComponent_x_Y_copy_##width##_##height)(pixel_data_t * p_src,  \
+                                                 pixel_data_t * p_dest,     \
+                                                 int i_stride)              \
+{                                                                           \
+    int i_y;                                                                \
+    pixel_data_t * p_next_src = p_src + i_stride;                           \
+                                                                            \
+    MMXZeroReg();                                                           \
+                                                                            \
+    for( i_y = 0; i_y < height; i_y ++ )                                    \
+    {                                                                       \
+        MMXAverage2( p_dest, p_src, p_next_src );                           \
+                                                                            \
+        if( width == 16 )                                                   \
+        {                                                                   \
+            MMXAverage2( p_dest + 8, p_src + 8, p_next_src + 8 );           \
+        }                                                                   \
+                                                                            \
+        p_dest += i_stride;                                                 \
+        p_src += i_stride;                                                  \
+        p_next_src += i_stride;                                             \
+    }                                                                       \
+}
+
+#define __MotionComponent_X_Y_copy(width,height)                            \
+void _M(MotionComponent_X_Y_copy_##width##_##height)(pixel_data_t * p_src,  \
+                                                 pixel_data_t * p_dest,     \
+                                                 int i_stride)              \
+{                                                                           \
+    int i_y;                                                                \
+    pixel_data_t * p_next_src = p_src + i_stride;                           \
+                                                                            \
+    MMXZeroReg();                                                           \
+                                                                            \
+    for( i_y = 0; i_y < height; i_y ++ )                                    \
+    {                                                                       \
+        MMXAverage4( p_dest, p_src, p_src + 1, p_next_src, p_next_src + 1 );\
+                                                                            \
+        if( width == 16 )                                                   \
+        {                                                                   \
+            MMXAverage4( p_dest + 8, p_src + 8, p_src + 9,                  \
+                         p_next_src + 8, p_next_src + 9 );                  \
+        }                                                                   \
+                                                                            \
+        p_dest += i_stride;                                                 \
+        p_src += i_stride;                                                  \
+        p_next_src += i_stride;                                             \
+    }                                                                       \
+}
+
+#define __MotionComponent_x_y_avg(width,height)                             \
+void _M(MotionComponent_x_y_avg_##width##_##height)(pixel_data_t * p_src,   \
+                                                pixel_data_t * p_dest,      \
+                                                int i_stride)               \
+{                                                                           \
+    int i_y;                                                                \
+                                                                            \
+    MMXZeroReg();                                                           \
+                                                                            \
+    for( i_y = 0; i_y < height; i_y ++ )                                    \
+    {                                                                       \
+        MMXAverage2( p_dest, p_dest, p_src );                               \
+                                                                            \
+        if( width == 16 )                                                   \
+        {                                                                   \
+            MMXAverage2( p_dest + 8, p_dest + 8, p_src + 8 );               \
+        }                                                                   \
+                                                                            \
+        p_dest += i_stride;                                                 \
+        p_src += i_stride;                                                  \
+    }                                                                       \
+}
+
+#define __MotionComponent_X_y_avg(width,height)                             \
+void _M(MotionComponent_X_y_avg_##width##_##height)(pixel_data_t * p_src,   \
+                                                pixel_data_t * p_dest,      \
+                                                int i_stride)               \
+{                                                                           \
+    int i_y;                                                                \
+                                                                            \
+    MMXZeroReg();                                                           \
+                                                                            \
+    for( i_y = 0; i_y < height; i_y ++ )                                    \
+    {                                                                       \
+        MMXInterpAverage2( p_dest, p_src, p_src + 1 );                      \
+                                                                            \
+        if( width == 16 )                                                   \
+        {                                                                   \
+            MMXInterpAverage2( p_dest + 8, p_src + 8, p_src + 9 );          \
+        }                                                                   \
+                                                                            \
+        p_dest += i_stride;                                                 \
+        p_src += i_stride;                                                  \
+    }                                                                       \
+}
+
+#define __MotionComponent_x_Y_avg(width,height)                             \
+void _M(MotionComponent_x_Y_avg_##width##_##height)(pixel_data_t * p_src,   \
+                                                pixel_data_t * p_dest,      \
+                                                int i_stride)               \
+{                                                                           \
+    int i_y;                                                                \
+    pixel_data_t * p_next_src = p_src + i_stride;                           \
+                                                                            \
+    MMXZeroReg();                                                           \
+                                                                            \
+    for( i_y = 0; i_y < height; i_y ++ )                                    \
+    {                                                                       \
+        MMXInterpAverage2( p_dest, p_src, p_next_src );                     \
+                                                                            \
+        if( width == 16 )                                                   \
+        {                                                                   \
+            MMXInterpAverage2( p_dest + 8, p_src + 8, p_next_src + 8 );     \
+        }                                                                   \
+        p_dest += i_stride;                                                 \
+        p_src += i_stride;                                                  \
+        p_next_src += i_stride;                                             \
+    }                                                                       \
+}
+
+#define __MotionComponent_X_Y_avg(width,height)                             \
+void _M(MotionComponent_X_Y_avg_##width##_##height)(pixel_data_t * p_src,   \
+                                                pixel_data_t * p_dest,      \
+                                                int i_stride)               \
+{                                                                           \
+    int i_y;                                                                \
+    pixel_data_t * p_next_src = p_src + i_stride;                           \
+                                                                            \
+    MMXZeroReg();                                                           \
+                                                                            \
+    for( i_y = 0; i_y < height; i_y ++ )                                    \
+    {                                                                       \
+        MMXInterpAverage4( p_dest, p_src, p_src + 1, p_next_src,            \
+                           p_next_src + 1 );                                \
+                                                                            \
+        if( width == 16 )                                                   \
+        {                                                                   \
+            MMXInterpAverage4( p_dest + 8, p_src + 8, p_src + 9,            \
+                               p_next_src + 8, p_next_src + 9 );            \
+        }                                                                   \
+                                                                            \
+        p_dest += i_stride;                                                 \
+        p_src += i_stride;                                                  \
+        p_next_src += i_stride;                                             \
+    }                                                                       \
+}
+
+#define __MotionComponents(width,height)                                    \
+__MotionComponent_x_y_copy(width,height)                                    \
+__MotionComponent_X_y_copy(width,height)                                    \
+__MotionComponent_x_Y_copy(width,height)                                    \
+__MotionComponent_X_Y_copy(width,height)                                    \
+__MotionComponent_x_y_avg(width,height)                                     \
+__MotionComponent_X_y_avg(width,height)                                     \
+__MotionComponent_x_Y_avg(width,height)                                     \
+__MotionComponent_X_Y_avg(width,height)
+
+__MotionComponents (16,16)      /* 444, 422, 420 */
+__MotionComponents (16,8)       /* 444, 422, 420 */
+__MotionComponents (8,8)        /* 422, 420 */
+__MotionComponents (8,4)        /* 420 */
+#if 0
+__MotionComponents (8,16)       /* 422 */
+#endif
diff --git a/plugins/motion/vdec_motion_inner_mmxext.c b/plugins/motion/vdec_motion_inner_mmxext.c
new file mode 100644 (file)
index 0000000..5c0b60a
--- /dev/null
@@ -0,0 +1,396 @@
+/*****************************************************************************
+ * vdec_motion_inner_mmxext.c : motion compensation inner routines optimized
+ *                              in MMX EXT
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: vdec_motion_inner_mmxext.c,v 1.5 2001/12/09 17:01:36 sam Exp $
+ *
+ * Authors: Christophe Massiot <massiot@via.ecp.fr>, largerly inspired by the
+ *          work done by the livid project <http://www.linuxvideo.org/>
+ *
+ * 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.
+ *****************************************************************************/
+
+#define MODULE_NAME motionmmxext
+#include "modules_inner.h"
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include "common.h"
+#include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
+#include "threads.h"
+#include "mtime.h"
+
+#include "video.h"
+
+#include "attributes.h"
+#include "mmx.h"
+
+/* OK, I know, this code has been taken from livid's mpeg2dec --Meuuh */
+
+static mmx_t mask_one = {0x0101010101010101LL};
+
+/*
+ * Useful functions
+ */
+
+#define pavg_r2r(src,dest)      pavgb_r2r (src, dest);
+#define pavg_m2r(src,dest)      pavgb_m2r (src, dest);
+
+#define __MotionComponent_x_y_copy(width,height)                            \
+void _M(MotionComponent_x_y_copy_##width##_##height)(pixel_data_t * p_src,  \
+                                                 pixel_data_t * p_dest,     \
+                                                 int i_stride)              \
+{                                                                           \
+    int i_y;                                                                \
+                                                                            \
+        pxor_r2r (mm0, mm0);                                                \
+        pxor_r2r (mm1, mm1);                                                \
+        pxor_r2r (mm2, mm2);                                                \
+        pxor_r2r (mm3, mm3);                                                \
+        pxor_r2r (mm4, mm4);                                                \
+        pxor_r2r (mm5, mm5);                                                \
+        pxor_r2r (mm6, mm6);                                                \
+        pxor_r2r (mm7, mm7);                                                \
+                                                                            \
+    for( i_y = 0; i_y < height; i_y ++ )                                    \
+    {                                                                       \
+        movq_m2r( *p_src, mm0 );     /* load 8 ref bytes */                 \
+        if( width == 16 )                                                   \
+            movq_m2r( *(p_src + 8), mm1 );                                  \
+        p_src += i_stride;                                                  \
+                                                                            \
+        movq_r2m( mm0, *p_dest );    /* store 8 bytes at curr */            \
+        if( width == 16 )                                                   \
+            movq_r2m( mm1, *(p_dest + 8) );                                 \
+        p_dest += i_stride;                                                 \
+    }                                                                       \
+}
+
+#define __MotionComponent_X_y_copy(width,height)                            \
+void _M(MotionComponent_X_y_copy_##width##_##height)(pixel_data_t * p_src,  \
+                                                 pixel_data_t * p_dest,     \
+                                                 int i_stride)              \
+{                                                                           \
+    int i_y;                                                                \
+                                                                            \
+    for( i_y = 0; i_y < height; i_y ++ )                                    \
+    {                                                                       \
+        movq_m2r (*p_src, mm0);                                             \
+        if( width == 16 )                                                   \
+            movq_m2r (*(p_src + 8), mm1);                                   \
+        pavg_m2r (*(p_src + 1), mm0);                                       \
+        if( width == 16 )                                                   \
+            pavg_m2r (*(p_src + 9), mm1);                                   \
+        movq_r2m (mm0, *p_dest);                                            \
+        p_src += i_stride;                                                  \
+        if( width == 16 )                                                   \
+            movq_r2m (mm1, *(p_dest + 8));                                  \
+        p_dest += i_stride;                                                 \
+    }                                                                       \
+}
+
+#define __MotionComponent_x_Y_copy(width,height)                            \
+void _M(MotionComponent_x_Y_copy_##width##_##height)(pixel_data_t * p_src,  \
+                                                 pixel_data_t * p_dest,     \
+                                                 int i_stride)              \
+{                                                                           \
+    int i_y;                                                                \
+    pixel_data_t * p_next_src = p_src + i_stride;                           \
+                                                                            \
+    for( i_y = 0; i_y < height; i_y ++ )                                    \
+    {                                                                       \
+        movq_m2r (*p_src, mm0);                                             \
+        if( width == 16 )                                                   \
+            movq_m2r (*(p_src + 8), mm1);                                   \
+        pavg_m2r (*(p_next_src), mm0);                                      \
+        if( width == 16 )                                                   \
+            pavg_m2r (*(p_next_src + 8), mm1);                              \
+        movq_r2m (mm0, *p_dest);                                            \
+        p_src += i_stride;                                                  \
+        p_next_src += i_stride;                                             \
+        if( width == 16 )                                                   \
+            movq_r2m (mm1, *(p_dest + 8));                                  \
+        p_dest += i_stride;                                                 \
+    }                                                                       \
+}
+
+#define __MotionComponent_X_Y_copy(width,height)                            \
+void _M(MotionComponent_X_Y_copy_##width##_##height)(pixel_data_t * p_src,  \
+                                                 pixel_data_t * p_dest,     \
+                                                 int i_stride)              \
+{                                                                           \
+    int i_y;                                                                \
+                                                                            \
+    if( width == 16 )                                                       \
+    {                                                                       \
+        for( i_y = 0; i_y < height; i_y ++ )                                \
+        {                                                                   \
+            movq_m2r (*p_src, mm0);                                         \
+            movq_m2r (*(p_src+i_stride+1), mm1);                            \
+            movq_r2r (mm0, mm7);                                            \
+            movq_m2r (*(p_src+1), mm2);                                     \
+            pxor_r2r (mm1, mm7);                                            \
+            movq_m2r (*(p_src + i_stride), mm3);                            \
+            movq_r2r (mm2, mm6);                                            \
+            pxor_r2r (mm3, mm6);                                            \
+            pavg_r2r (mm1, mm0);                                            \
+            pavg_r2r (mm3, mm2);                                            \
+            por_r2r (mm6, mm7);                                             \
+            movq_r2r (mm0, mm6);                                            \
+            pxor_r2r (mm2, mm6);                                            \
+            pand_r2r (mm6, mm7);                                            \
+            pand_m2r (mask_one, mm7);                                       \
+            pavg_r2r (mm2, mm0);                                            \
+            psubusb_r2r (mm7, mm0);                                         \
+            movq_r2m (mm0, *p_dest);                                        \
+                                                                            \
+            movq_m2r (*(p_src+8), mm0);                                     \
+            movq_m2r (*(p_src+i_stride+9), mm1);                            \
+            movq_r2r (mm0, mm7);                                            \
+            movq_m2r (*(p_src+9), mm2);                                     \
+            pxor_r2r (mm1, mm7);                                            \
+            movq_m2r (*(p_src+i_stride+8), mm3);                            \
+            movq_r2r (mm2, mm6);                                            \
+            pxor_r2r (mm3, mm6);                                            \
+            pavg_r2r (mm1, mm0);                                            \
+            pavg_r2r (mm3, mm2);                                            \
+            por_r2r (mm6, mm7);                                             \
+            movq_r2r (mm0, mm6);                                            \
+            pxor_r2r (mm2, mm6);                                            \
+            pand_r2r (mm6, mm7);                                            \
+            pand_m2r (mask_one, mm7);                                       \
+            pavg_r2r (mm2, mm0);                                            \
+            psubusb_r2r (mm7, mm0);                                         \
+            p_src += i_stride;                                              \
+            movq_r2m (mm0, *(p_dest+8));                                    \
+            p_dest += i_stride;                                             \
+        }                                                                   \
+    }                                                                       \
+    else                                                                    \
+    {                                                                       \
+        movq_m2r (*p_src, mm0);                                             \
+        movq_m2r (*(p_src+1), mm1);                                         \
+        movq_r2r (mm0, mm7);                                                \
+        pxor_r2r (mm1, mm7);                                                \
+        pavg_r2r (mm1, mm0);                                                \
+        p_src += i_stride;                                                  \
+                                                                            \
+        for( i_y = 0; i_y < height; i_y ++ )                                \
+        {                                                                   \
+            movq_m2r (*p_src, mm2);                                         \
+            movq_r2r (mm0, mm5);                                            \
+            movq_m2r (*(p_src+1), mm3);                                     \
+            movq_r2r (mm2, mm6);                                            \
+            pxor_r2r (mm3, mm6);                                            \
+            pavg_r2r (mm3, mm2);                                            \
+            por_r2r (mm6, mm7);                                             \
+            pxor_r2r (mm2, mm5);                                            \
+            pand_r2r (mm5, mm7);                                            \
+            pavg_r2r (mm2, mm0);                                            \
+            pand_m2r (mask_one, mm7);                                       \
+            psubusb_r2r (mm7, mm0);                                         \
+            p_src += i_stride;                                              \
+            movq_r2m (mm0, *p_dest);                                        \
+            p_dest += i_stride;                                             \
+            movq_r2r (mm6, mm7);                                            \
+            movq_r2r (mm2, mm0);                                            \
+        }                                                                   \
+    }                                                                       \
+}
+
+#define __MotionComponent_x_y_avg(width,height)                             \
+void _M(MotionComponent_x_y_avg_##width##_##height)(pixel_data_t * p_src,   \
+                                                pixel_data_t * p_dest,      \
+                                                int i_stride)               \
+{                                                                           \
+    int i_y;                                                                \
+                                                                            \
+    for( i_y = 0; i_y < height; i_y ++ )                                    \
+    {                                                                       \
+        movq_m2r( *p_src, mm0 );                                            \
+        if( width == 16 )                                                   \
+            movq_m2r( *(p_src + 8), mm1 );                                  \
+        pavg_m2r( *p_dest, mm0 );                                           \
+        if( width == 16 )                                                   \
+            pavg_m2r( *(p_dest + 8), mm1 );                                 \
+        movq_r2m( mm0, *p_dest );                                           \
+        p_src += i_stride;                                                  \
+        if( width == 16 )                                                   \
+            movq_r2m( mm1, *(p_dest + 8) );                                 \
+        p_dest += i_stride;                                                 \
+    }                                                                       \
+}
+
+#define __MotionComponent_X_y_avg(width,height)                             \
+void _M(MotionComponent_X_y_avg_##width##_##height)(pixel_data_t * p_src,   \
+                                                pixel_data_t * p_dest,      \
+                                                int i_stride)               \
+{                                                                           \
+    int i_y;                                                                \
+                                                                            \
+    for( i_y = 0; i_y < height; i_y ++ )                                    \
+    {                                                                       \
+        movq_m2r (*p_src, mm0);                                             \
+        if( width == 16 )                                                   \
+            movq_m2r (*(p_src + 8), mm1);                                   \
+        pavg_m2r (*(p_src + 1), mm0);                                       \
+        if( width == 16 )                                                   \
+            pavg_m2r (*(p_src + 9), mm1);                                   \
+        pavg_m2r (*p_dest, mm0);                                            \
+        if( width == 16 )                                                   \
+            pavg_m2r (*(p_dest + 8), mm1);                                  \
+        p_src += i_stride;                                                  \
+        movq_r2m (mm0, *p_dest);                                            \
+        if( width == 16 )                                                   \
+            movq_r2m (mm1, *(p_dest + 8));                                  \
+        p_dest += i_stride;                                                 \
+    }                                                                       \
+}
+
+#define __MotionComponent_x_Y_avg(width,height)                             \
+void _M(MotionComponent_x_Y_avg_##width##_##height)(pixel_data_t * p_src,   \
+                                                pixel_data_t * p_dest,      \
+                                                int i_stride)               \
+{                                                                           \
+    int i_y;                                                                \
+    pixel_data_t * p_next_src = p_src + i_stride;                           \
+                                                                            \
+    for( i_y = 0; i_y < height; i_y ++ )                                    \
+    {                                                                       \
+        movq_m2r (*p_src, mm0);                                             \
+        if( width == 16 )                                                   \
+            movq_m2r (*(p_src + 8), mm1);                                   \
+        pavg_m2r (*(p_next_src), mm0);                                      \
+        if( width == 16 )                                                   \
+            pavg_m2r (*(p_next_src + 8), mm1);                              \
+        pavg_m2r (*p_dest, mm0);                                            \
+        if( width == 16 )                                                   \
+            pavg_m2r (*(p_dest + 8), mm1);                                  \
+        p_src += i_stride;                                                  \
+        p_next_src += i_stride;                                             \
+        movq_r2m (mm0, *p_dest);                                            \
+        if( width == 16 )                                                   \
+            movq_r2m (mm1, *(p_dest + 8));                                  \
+        p_dest += i_stride;                                                 \
+    }                                                                       \
+}
+
+#define __MotionComponent_X_Y_avg(width,height)                             \
+void _M(MotionComponent_X_Y_avg_##width##_##height)(pixel_data_t * p_src,   \
+                                                pixel_data_t * p_dest,      \
+                                                int i_stride)               \
+{                                                                           \
+    int i_y;                                                                \
+                                                                            \
+    if( width == 16 )                                                       \
+    {                                                                       \
+        for( i_y = 0; i_y < height; i_y ++ )                                \
+        {                                                                   \
+            movq_m2r (*p_src, mm0);                                         \
+            movq_m2r (*(p_src+i_stride+1), mm1);                            \
+            movq_r2r (mm0, mm7);                                            \
+            movq_m2r (*(p_src+1), mm2);                                     \
+            pxor_r2r (mm1, mm7);                                            \
+            movq_m2r (*(p_src+i_stride), mm3);                              \
+            movq_r2r (mm2, mm6);                                            \
+            pxor_r2r (mm3, mm6);                                            \
+            pavg_r2r (mm1, mm0);                                            \
+            pavg_r2r (mm3, mm2);                                            \
+            por_r2r (mm6, mm7);                                             \
+            movq_r2r (mm0, mm6);                                            \
+            pxor_r2r (mm2, mm6);                                            \
+            pand_r2r (mm6, mm7);                                            \
+            pand_m2r (mask_one, mm7);                                       \
+            pavg_r2r (mm2, mm0);                                            \
+            psubusb_r2r (mm7, mm0);                                         \
+            movq_m2r (*p_dest, mm1);                                        \
+            pavg_r2r (mm1, mm0);                                            \
+            movq_r2m (mm0, *p_dest);                                        \
+                                                                            \
+            movq_m2r (*(p_src+8), mm0);                                     \
+            movq_m2r (*(p_src+i_stride+9), mm1);                            \
+            movq_r2r (mm0, mm7);                                            \
+            movq_m2r (*(p_src+9), mm2);                                     \
+            pxor_r2r (mm1, mm7);                                            \
+            movq_m2r (*(p_src+i_stride+8), mm3);                            \
+            movq_r2r (mm2, mm6);                                            \
+            pxor_r2r (mm3, mm6);                                            \
+            pavg_r2r (mm1, mm0);                                            \
+            pavg_r2r (mm3, mm2);                                            \
+            por_r2r (mm6, mm7);                                             \
+            movq_r2r (mm0, mm6);                                            \
+            pxor_r2r (mm2, mm6);                                            \
+            pand_r2r (mm6, mm7);                                            \
+            pand_m2r (mask_one, mm7);                                       \
+            pavg_r2r (mm2, mm0);                                            \
+            psubusb_r2r (mm7, mm0);                                         \
+            movq_m2r (*(p_dest+8), mm1);                                    \
+            pavg_r2r (mm1, mm0);                                            \
+            p_src += i_stride;                                              \
+            movq_r2m (mm0, *(p_dest+8));                                    \
+            p_dest += i_stride;                                             \
+        }                                                                   \
+    }                                                                       \
+    else                                                                    \
+    {                                                                       \
+        for( i_y = 0; i_y < height; i_y ++ )                                \
+        {                                                                   \
+            movq_m2r (*p_src, mm0);                                         \
+            movq_m2r (*(p_src+i_stride+1), mm1);                            \
+            movq_r2r (mm0, mm7);                                            \
+            movq_m2r (*(p_src+1), mm2);                                     \
+            pxor_r2r (mm1, mm7);                                            \
+            movq_m2r (*(p_src+i_stride), mm3);                              \
+            movq_r2r (mm2, mm6);                                            \
+            pxor_r2r (mm3, mm6);                                            \
+            pavg_r2r (mm1, mm0);                                            \
+            pavg_r2r (mm3, mm2);                                            \
+            por_r2r (mm6, mm7);                                             \
+            movq_r2r (mm0, mm6);                                            \
+            pxor_r2r (mm2, mm6);                                            \
+            pand_r2r (mm6, mm7);                                            \
+            pand_m2r (mask_one, mm7);                                       \
+            pavg_r2r (mm2, mm0);                                            \
+            psubusb_r2r (mm7, mm0);                                         \
+            movq_m2r (*p_dest, mm1);                                        \
+            pavg_r2r (mm1, mm0);                                            \
+            p_src += i_stride;                                              \
+            movq_r2m (mm0, *p_dest);                                        \
+            p_dest += i_stride;                                             \
+        }                                                                   \
+    }                                                                       \
+}
+
+#define __MotionComponents(width,height)                                    \
+__MotionComponent_x_y_copy(width,height)                                    \
+__MotionComponent_X_y_copy(width,height)                                    \
+__MotionComponent_x_Y_copy(width,height)                                    \
+__MotionComponent_X_Y_copy(width,height)                                    \
+__MotionComponent_x_y_avg(width,height)                                     \
+__MotionComponent_X_y_avg(width,height)                                     \
+__MotionComponent_x_Y_avg(width,height)                                     \
+__MotionComponent_X_Y_avg(width,height)
+
+__MotionComponents (16,16)      /* 444, 422, 420 */
+__MotionComponents (16,8)       /* 444, 422, 420 */
+__MotionComponents (8,8)        /* 422, 420 */
+__MotionComponents (8,4)        /* 420 */
+#if 0
+__MotionComponents (8,16)       /* 422 */
+#endif
index 607ca0f32cf8bdf3bff0ddce393d815bc1a0388e..7e25670fe726f24a2f5d7ebd8f641a94fef8ef10 100644 (file)
@@ -2,7 +2,7 @@
  * adec_layer1.c: MPEG Layer I audio decoder
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: adec_layer1.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
+ * $Id: adec_layer1.c,v 1.3 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Michel Lespinasse <walken@via.ecp.fr>
@@ -27,7 +27,6 @@
 #include <stdlib.h>                                                  /* NULL */
 #include <string.h>                                    /* memcpy(), memset() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index b341eb1c6cf495c2aa116dcb3a4ade3d95e5d61d..e05774e97a68e193bbb959763de05166cb857d99 100644 (file)
@@ -2,7 +2,7 @@
  * adec_layer2.c: MPEG Layer II audio decoder
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: adec_layer2.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
+ * $Id: adec_layer2.c,v 1.3 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Michel Lespinasse <walken@via.ecp.fr>
@@ -27,7 +27,6 @@
 #include <stdlib.h>                                                  /* NULL */
 #include <string.h>                                    /* memcpy(), memset() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index e20835d282e28e367eedd167a38b092247195b16..aabe23056b46f469ae565abf8b7fb84d4686b456 100644 (file)
@@ -2,7 +2,7 @@
  * mpeg_adec.c: MPEG audio decoder thread
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: mpeg_adec.c,v 1.5 2001/12/04 13:47:46 massiot Exp $
+ * $Id: mpeg_adec.c,v 1.6 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Michel Lespinasse <walken@via.ecp.fr>
@@ -34,7 +34,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index b7f52ad896338ce77222e73b4763e933e75c62d3..4d1d7887d9e9cba82500411075a9687d511815c5 100644 (file)
@@ -2,7 +2,7 @@
  * adec_generic.c: MPEG audio decoder
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: mpeg_adec_generic.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
+ * $Id: mpeg_adec_generic.c,v 1.3 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Michel Lespinasse <walken@via.ecp.fr>
@@ -26,7 +26,6 @@
 
 #include <string.h>                                    /* memcpy(), memset() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
similarity index 74%
rename from plugins/mpeg/Makefile
rename to plugins/mpeg_system/Makefile
index b43634338a77afa4d767dae79c197478f37449dc..c6305d446fadfe0fe087cc5b0ce16e5080e31358 100644 (file)
@@ -7,9 +7,9 @@
 # Objects
 #
 
-PLUGIN_ES = es.o input_es.o
-PLUGIN_PS = ps.o input_ps.o
-PLUGIN_TS = ts.o input_ts.o
+PLUGIN_ES = mpeg_es.o input_es.o
+PLUGIN_PS = mpeg_ps.o input_ps.o
+PLUGIN_TS = mpeg_ts.o input_ts.o
 BUILTIN_ES = $(PLUGIN_ES:%.o=BUILTIN_%.o)
 BUILTIN_PS = $(PLUGIN_PS:%.o=BUILTIN_%.o)
 BUILTIN_TS = $(PLUGIN_TS:%.o=BUILTIN_%.o)
@@ -28,24 +28,24 @@ include ../../Makefile.modules
 # Real targets
 #
 
-../es.so: $(PLUGIN_ES)
+../mpeg_es.so: $(PLUGIN_ES)
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) 
 
-../es.a: $(BUILTIN_ES)
+../mpeg_es.a: $(BUILTIN_ES)
        ar r $@ $^
        $(RANLIB) $@
 
-../ps.so: $(PLUGIN_PS)
+../mpeg_ps.so: $(PLUGIN_PS)
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) 
 
-../ps.a: $(BUILTIN_PS)
+../mpeg_ps.a: $(BUILTIN_PS)
        ar r $@ $^
        $(RANLIB) $@
 
-../ts.so: $(PLUGIN_TS)
+../mpeg_ts.so: $(PLUGIN_TS)
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_TS)
 
-../ts.a: $(BUILTIN_TS)
+../mpeg_ts.a: $(BUILTIN_TS)
        ar r $@ $^
        $(RANLIB) $@
 
similarity index 99%
rename from plugins/mpeg/input_es.c
rename to plugins/mpeg_system/input_es.c
index 1d16e3e819c3287ccfe49835ecc9c22586d34b8f..222862db6586afbbd484d1dfea253ff330e586fd 100644 (file)
@@ -2,7 +2,7 @@
  * input_es.c: Elementary Stream demux and packet management
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: input_es.c,v 1.16 2001/12/07 18:33:07 sam Exp $
+ * $Id: input_es.c,v 1.1 2001/12/09 17:01:36 sam Exp $
  *
  * Author: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -21,7 +21,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
-#define MODULE_NAME es
+#define MODULE_NAME mpeg_es
 #include "modules_inner.h"
 
 /*****************************************************************************
similarity index 95%
rename from plugins/mpeg/input_es.h
rename to plugins/mpeg_system/input_es.h
index 484e7bdca600f5639112d8a53953583b7e96393a..ac2f1fcfdfb44ad057594913b455aa0af21438ce 100644 (file)
@@ -2,7 +2,7 @@
  * input_es.h: thread structure of the ES plugin
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: input_es.h,v 1.2 2001/06/27 09:53:56 massiot Exp $
+ * $Id: input_es.h,v 1.1 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: 
  *
similarity index 99%
rename from plugins/mpeg/input_ps.c
rename to plugins/mpeg_system/input_ps.c
index 7124580032363db7904bad40569fea1926fe289b..c5cd287a0a7a4550cc07e132d8ccdf6b5f94b363 100644 (file)
@@ -2,7 +2,7 @@
  * input_ps.c: PS demux and packet management
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input_ps.c,v 1.44 2001/12/07 18:33:07 sam Exp $
+ * $Id: input_ps.c,v 1.1 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Cyril Deguet <asmax@via.ecp.fr>
@@ -22,7 +22,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
-#define MODULE_NAME ps
+#define MODULE_NAME mpeg_ps
 #include "modules_inner.h"
 
 /*****************************************************************************
similarity index 97%
rename from plugins/mpeg/input_ps.h
rename to plugins/mpeg_system/input_ps.h
index 4d72ade2a88843fe12bd4e2d0e3f1e4dae4f4190..0420cc354798f58df87e7aaeff24777bd4f67bc5 100644 (file)
@@ -2,7 +2,7 @@
  * input_ps.h: thread structure of the PS plugin
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ps.h,v 1.9 2001/10/02 16:46:59 massiot Exp $
+ * $Id: input_ps.h,v 1.1 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Cyril Deguet <asmax@via.ecp.fr>
similarity index 99%
rename from plugins/mpeg/input_ts.c
rename to plugins/mpeg_system/input_ts.c
index 1143818c425ba5f8704cc9e9af5dfabf3398dd06..4cd52e52772e41ab4e68a54bfe75945b76d2dfb4 100644 (file)
@@ -2,7 +2,7 @@
  * input_ts.c: TS demux and netlist management
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input_ts.c,v 1.42 2001/12/07 18:33:07 sam Exp $
+ * $Id: input_ts.c,v 1.1 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Henri Fallon <henri@videolan.org>
  *
@@ -21,7 +21,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
-#define MODULE_NAME ts
+#define MODULE_NAME mpeg_ts
 #include "modules_inner.h"
 
 /*****************************************************************************
similarity index 96%
rename from plugins/mpeg/input_ts.h
rename to plugins/mpeg_system/input_ts.h
index 9e1339f2db66a2739df6ead71372a63137109fe1..b2bea672ff0d43a8653675bf30744f6c1b1be056 100644 (file)
@@ -2,7 +2,7 @@
  * input_ts.h: structures of the input not exported to other modules
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ts.h,v 1.12 2001/12/07 18:33:07 sam Exp $
+ * $Id: input_ts.h,v 1.1 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Henri Fallon <henri@via.ecp.fr>
  *          Boris Dorès <babal@via.ecp.fr>
@@ -71,7 +71,7 @@ static __inline__ int read_network( int i_fd, char * p_base,
          i_bytes = p_sys->i_length - p_sys->i_offset;
     }
 
-    fast_memcpy( p_base, p_sys->p_buffer + p_sys->i_offset, i_bytes );
+    pf_fast_memcpy( p_base, p_sys->p_buffer + p_sys->i_offset, i_bytes );
     p_sys->i_offset += i_bytes;
 
     return i_bytes;
similarity index 94%
rename from plugins/mpeg/es.c
rename to plugins/mpeg_system/mpeg_es.c
index 15d3a7e1cb7dae2262e852c37c8524fb353478c4..0e90535a0a762e3355ab2de955337accff87efc0 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
- * es.c : Elementary Stream input module for vlc
+ * mpeg_es.c : Elementary Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: es.c,v 1.4 2001/11/28 15:08:05 massiot Exp $
+ * $Id: mpeg_es.c,v 1.1 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -21,7 +21,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
-#define MODULE_NAME es
+#define MODULE_NAME mpeg_es
 #include "modules_inner.h"
 
 /*****************************************************************************
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                              /* strdup() */
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
similarity index 94%
rename from plugins/mpeg/ps.c
rename to plugins/mpeg_system/mpeg_ps.c
index 31f509f96c8190e626d61d6b68b1d655f354bbe5..dab4a249b1a5b892a42b0ecd43ab7ad97a79cc63 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
- * ps.c : Program Stream input module for vlc
+ * mpeg_ps.c : Program Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: ps.c,v 1.5 2001/11/28 15:08:05 massiot Exp $
+ * $Id: mpeg_ps.c,v 1.1 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -21,7 +21,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
-#define MODULE_NAME ps
+#define MODULE_NAME mpeg_ps
 #include "modules_inner.h"
 
 /*****************************************************************************
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                              /* strdup() */
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
similarity index 94%
rename from plugins/mpeg/ts.c
rename to plugins/mpeg_system/mpeg_ts.c
index 7ab0d9af65f17ecffe7fcb5aa97d34c9221f97c6..9259905685cc4eb33e23dad23e43fd914719e609 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
- * ts.c : Transport Stream input module for vlc
+ * mpeg_ts.c : Transport Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: ts.c,v 1.6 2001/11/28 15:08:05 massiot Exp $
+ * $Id: mpeg_ts.c,v 1.1 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Henri Fallon <henri@via.ecp.fr>
  *
@@ -21,7 +21,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
-#define MODULE_NAME ts
+#define MODULE_NAME mpeg_ts
 #include "modules_inner.h"
 
 /*****************************************************************************
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                              /* strdup() */
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 355ea210e7c21a8450b94c196bbfbe0d12a9d7a4..74c9bafb3f7096a3abed5c9e06eaf544f5c457a3 100644 (file)
@@ -2,7 +2,7 @@
  * video_decoder.c : video decoder thread
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: video_decoder.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
+ * $Id: video_decoder.c,v 1.3 2001/12/09 17:01:36 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Michel Lespinasse <walken@zoy.org>
@@ -35,7 +35,6 @@
 #include <string.h>                                    /* memcpy(), memset() */
 #include <errno.h>                                                  /* errno */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index 01408dfa2b7d046586173834ddd2c969a0735304..871f892593015160d50ca5b74c90e8d9e39622ec 100644 (file)
@@ -2,7 +2,7 @@
  * vpar_blocks.c : blocks parsing
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: vpar_blocks.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
+ * $Id: vpar_blocks.c,v 1.3 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Michel Lespinasse <walken@zoy.org>
  *          Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
@@ -30,7 +30,6 @@
 
 #include <string.h>                                                /* memset */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
@@ -1822,20 +1821,20 @@ static __inline__ void ParseSlice( vpar_thread_t * p_vpar,
         if( i_coding_type != I_CODING_TYPE || p_vpar->picture.b_concealment_mv )
         {
             p_f_motion->pppi_ref[1][0] =
-                pp_forward_ref[1]->p_y + i_offset * 4 + i_width;
+                pp_forward_ref[1]->P_Y + i_offset * 4 + i_width;
             p_f_motion->pppi_ref[1][1] =
-                pp_forward_ref[1]->p_u + i_chroma_tmp;
+                pp_forward_ref[1]->P_U + i_chroma_tmp;
             p_f_motion->pppi_ref[1][2] =
-                pp_forward_ref[1]->p_v + i_chroma_tmp;
+                pp_forward_ref[1]->P_V + i_chroma_tmp;
         }
         if( i_coding_type == B_CODING_TYPE )
         {
             p_b_motion->pppi_ref[1][0] =
-                p_vpar->sequence.p_backward->p_y + i_offset * 4 + i_width;
+                p_vpar->sequence.p_backward->P_Y + i_offset * 4 + i_width;
             p_b_motion->pppi_ref[1][1] =
-                p_vpar->sequence.p_backward->p_u + i_chroma_tmp;
+                p_vpar->sequence.p_backward->P_U + i_chroma_tmp;
             p_b_motion->pppi_ref[1][2] =
-                p_vpar->sequence.p_backward->p_v + i_chroma_tmp;
+                p_vpar->sequence.p_backward->P_V + i_chroma_tmp;
         }
     }
 
@@ -1844,9 +1843,9 @@ static __inline__ void ParseSlice( vpar_thread_t * p_vpar,
                         * (2 - p_vpar->sequence.b_chroma_h_subsampled);
     if( i_coding_type != I_CODING_TYPE || p_vpar->picture.b_concealment_mv )
     {
-        p_f_motion->pppi_ref[0][0] = pp_forward_ref[0]->p_y + i_offset * 4;
-        p_f_motion->pppi_ref[0][1] = pp_forward_ref[0]->p_u + i_chroma_tmp;
-        p_f_motion->pppi_ref[0][2] = pp_forward_ref[0]->p_v + i_chroma_tmp;
+        p_f_motion->pppi_ref[0][0] = pp_forward_ref[0]->P_Y + i_offset * 4;
+        p_f_motion->pppi_ref[0][1] = pp_forward_ref[0]->P_U + i_chroma_tmp;
+        p_f_motion->pppi_ref[0][2] = pp_forward_ref[0]->P_V + i_chroma_tmp;
         p_f_motion->pi_f_code[0] = p_vpar->picture.ppi_f_code[0][0];
         p_f_motion->pi_f_code[1] = p_vpar->picture.ppi_f_code[0][1];
         p_f_motion->ppi_pmv[0][0] = p_f_motion->ppi_pmv[0][1] = 0;
@@ -1855,11 +1854,11 @@ static __inline__ void ParseSlice( vpar_thread_t * p_vpar,
 
     if( i_coding_type == B_CODING_TYPE )
     {
-        p_b_motion->pppi_ref[0][0] = p_vpar->sequence.p_backward->p_y
+        p_b_motion->pppi_ref[0][0] = p_vpar->sequence.p_backward->P_Y
                                         + i_offset * 4;
-        p_b_motion->pppi_ref[0][1] = p_vpar->sequence.p_backward->p_u
+        p_b_motion->pppi_ref[0][1] = p_vpar->sequence.p_backward->P_U
             + i_chroma_tmp;
-        p_b_motion->pppi_ref[0][2] = p_vpar->sequence.p_backward->p_v
+        p_b_motion->pppi_ref[0][2] = p_vpar->sequence.p_backward->P_V
             + i_chroma_tmp;
         p_b_motion->pi_f_code[0] = p_vpar->picture.ppi_f_code[1][0];
         p_b_motion->pi_f_code[1] = p_vpar->picture.ppi_f_code[1][1];
@@ -1868,9 +1867,9 @@ static __inline__ void ParseSlice( vpar_thread_t * p_vpar,
     }
 
     /* Initialize destination pointers. */
-    p_dest[0] = p_vpar->picture.p_picture->p_y + i_offset * 4;
-    p_dest[1] = p_vpar->picture.p_picture->p_u + i_chroma_tmp;
-    p_dest[2] = p_vpar->picture.p_picture->p_v + i_chroma_tmp;
+    p_dest[0] = p_vpar->picture.p_picture->P_Y + i_offset * 4;
+    p_dest[1] = p_vpar->picture.p_picture->P_U + i_chroma_tmp;
+    p_dest[2] = p_vpar->picture.p_picture->P_V + i_chroma_tmp;
 
     if( i_structure == BOTTOM_FIELD )
     {
index 9d197d19be405d4d7b5e8b66fb688c057af913f4..b9f22eda8380829538897f64d053cf888bc447e7 100644 (file)
@@ -2,7 +2,7 @@
  * vpar_headers.c : headers parsing
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: vpar_headers.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
+ * $Id: vpar_headers.c,v 1.3 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -30,7 +30,6 @@
 #include <stdlib.h>                                                /* free() */
 #include <string.h>                                    /* memcpy(), memset() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
@@ -438,8 +437,11 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
     {
         intf_WarnMsg( 1, "vpar: no vout present, spawning one" );
 
-        p_vpar->p_vout = vout_CreateThread( NULL, p_vpar->sequence.i_width,
-                                            p_vpar->sequence.i_height );
+        p_vpar->p_vout =
+            vout_CreateThread( NULL, p_vpar->sequence.i_width,
+                                     p_vpar->sequence.i_height,
+                                     99 + p_vpar->sequence.i_chroma_format,
+                                     p_vpar->sequence.i_aspect_ratio );
 
         /* Everything failed */
         if( p_vpar->p_vout == NULL )
@@ -447,6 +449,7 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
             intf_ErrMsg( "vpar error: can't open vout, aborting" );
             vlc_mutex_unlock( &p_vout_bank->lock );
 
+            p_vpar->p_fifo->b_error = 1;
             /* XXX ! XXX ! XXX ! what to do here ? */
             return;
         }
@@ -641,7 +644,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
                      * but will prevent us from segfaulting in the slice
                      * parsing. */
                     static picture_t    fake_picture;
-                    fake_picture.p_data = NULL; /* We will use it later */
+                    fake_picture.i_planes = 0; /* We will use it later */
                     p_vpar->sequence.p_forward = &fake_picture;
                 }
             }
@@ -735,12 +738,13 @@ static void PictureHeader( vpar_thread_t * p_vpar )
     {
         /* This is a new frame. Get a structure from the video_output. */
         while( ( P_picture = vout_CreatePicture( p_vpar->p_vout,
-                              /* XXX */ 99+p_vpar->sequence.i_chroma_format,
                                         p_vpar->sequence.i_width,
-                                        p_vpar->sequence.i_height ) )
+                                        p_vpar->sequence.i_height,
+                         /* XXX */ 99 + p_vpar->sequence.i_chroma_format,
+                                        p_vpar->sequence.i_aspect_ratio ) )
              == NULL )
         {
-            intf_DbgMsg("vpar debug: allocation error in vout_CreatePicture, delaying");
+            intf_DbgMsg("vpar debug: vout_CreatePicture failed, delaying");
             if( p_vpar->p_fifo->b_die || p_vpar->p_fifo->b_error )
             {
                 return;
@@ -755,9 +759,6 @@ static void PictureHeader( vpar_thread_t * p_vpar )
         p_vpar->picture.i_field_width = ( p_vpar->sequence.i_width
                     << ( 1 - p_vpar->picture.b_frame_structure ) );
 
-/* FIXME ! remove asap ?? */
-//memset( P_picture->p_data, 0, (p_vpar->sequence.i_mb_size*384));
-
         /* Update the reference pointers. */
         ReferenceUpdate( p_vpar, p_vpar->picture.i_coding_type, P_picture );
     }
@@ -859,7 +860,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
     }
 
     if( p_vpar->sequence.p_forward != NULL &&
-        p_vpar->sequence.p_forward->p_data == NULL )
+        p_vpar->sequence.p_forward->i_planes == 0 )
     {
         /* This can only happen with the fake picture created for section
          * 7.6.3.5. Clean up our mess. */
index 36709a889962f6ae80f7ca4ec7bedc389920198c..2b30102ff9ccd57cea764ac37d12ca405bb94e64 100644 (file)
@@ -2,7 +2,7 @@
  * vpar_pool.c : management of the pool of decoder threads
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: vpar_pool.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
+ * $Id: vpar_pool.c,v 1.3 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -29,7 +29,6 @@
 #include <string.h>                                    /* memcpy(), memset() */
 #include <stdlib.h>                                             /* realloc() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index addcc868cc493efb4f15dbc9ca09637cbc19bd4d..07cc1b6802ad22d8de8e94f69e03cea54d58edd7 100644 (file)
@@ -31,7 +31,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index cdd9b6c8c8d1e3171fcb03b5fac5301e4dd6b6d2..0359766eb929b53408483036be007870aab0ae3b 100644 (file)
@@ -2,7 +2,7 @@
  * qt.cpp : Qt plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: qt.cpp,v 1.4 2001/11/28 15:08:05 massiot Exp $
+ * $Id: qt.cpp,v 1.5 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -34,7 +34,6 @@
 
 extern "C"
 {
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index bdc9619602ef143eee0cdc478e78390e78b3a365..7ff3300de74fe35a056c8a17bd4a108139e5ce3d 100644 (file)
@@ -2,7 +2,7 @@
  * sdl.c : SDL plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: sdl.c,v 1.17 2001/11/28 15:08:05 massiot Exp $
+ * $Id: sdl.c,v 1.18 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Pierre Baillet <oct@zoy.org>
@@ -34,7 +34,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 1ac557fa6d5a74f5b39f3d859267a9c5f0491be1..f20f0af3ae485dca71ba1da9db1694eee4ad37bb 100644 (file)
@@ -2,7 +2,7 @@
  * vout_sdl.c: SDL video output display method
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: vout_sdl.c,v 1.67 2001/12/07 18:33:08 sam Exp $
+ * $Id: vout_sdl.c,v 1.68 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Pierre Baillet <oct@zoy.org>
 #include "video_output.h"
 
 #include "interface.h"
-/* FIXME: get rid of this */
-#include "keystrokes.h"
-#include "netutils.h"
 
 #include "modules.h"
 #include "modules_export.h"
 
-/*****************************************************************************
- * FIXME: this file is ...                                                   *
- *                                                                           *
- *              XXX   XXX     FIXME     XXX     XXX   XXX   XXX              *
- *              XXX   XXX   XXX   XXX   XXX     XXX   XXX   XXX              *
- *              XXX   XXX   XXX         XXX       FIXME     XXX              *
- *              XXX   XXX   XXX  TODO   XXX        XXX      XXX              *
- *              XXX   XXX   XXX   XXX   XXX        XXX                       *
- *                FIXME       FIXME       FIXME    XXX      XXX              *
- *                                                                           *
- *****************************************************************************/
+#define SDL_MAX_DIRECTBUFFERS 5
+#define SDL_DEFAULT_BPP 16
 
 /*****************************************************************************
  * vout_sys_t: video output SDL method descriptor
  *****************************************************************************/
 typedef struct vout_sys_s
 {
+    SDL_Surface *   p_display;                             /* display device */
+
     int i_width;
     int i_height;
 
-    SDL_Surface *   p_display;                             /* display device */
-    SDL_Overlay *   p_overlay;                             /* overlay device */
-
-    boolean_t   b_overlay;
     boolean_t   b_cursor;
-    boolean_t   b_reopen_display;
-
     boolean_t   b_cursor_autohidden;
     mtime_t     i_lastmoved;
 
-    Uint8   *   p_sdl_buf[2];                          /* Buffer information */
-
 } vout_sys_t;
 
+/*****************************************************************************
+ * picture_sys_t: direct buffer method descriptor
+ *****************************************************************************
+ * This structure is part of the picture descriptor, it describes the
+ * SDL specific properties of a direct buffer.
+ *****************************************************************************/
+typedef struct picture_sys_s
+{
+    SDL_Overlay *p_overlay;
+
+} picture_sys_t;
+
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
-static int  vout_Probe     ( probedata_t *p_data );
-static int  vout_Create    ( struct vout_thread_s * );
-static int  vout_Init      ( struct vout_thread_s * );
-static void vout_End       ( struct vout_thread_s * );
-static void vout_Destroy   ( struct vout_thread_s * );
-static int  vout_Manage    ( struct vout_thread_s * );
-static void vout_Display   ( struct vout_thread_s * );
-static void vout_SetPalette( p_vout_thread_t p_vout, u16 *red, u16 *green,
-                             u16 *blue, u16 *transp );
-
-static int  SDLOpenDisplay     ( vout_thread_t *p_vout );
-static void SDLCloseDisplay    ( vout_thread_t *p_vout );
-static void OutputCoords       ( const picture_t *p_pic, const boolean_t scale,
-                                 const int win_w, const int win_h,
-                                 int *dx, int *dy, int *w, int *h );
+static int  vout_Probe      ( probedata_t *p_data );
+static int  vout_Create     ( struct vout_thread_s * );
+static int  vout_Init       ( struct vout_thread_s * );
+static void vout_End        ( struct vout_thread_s * );
+static void vout_Destroy    ( struct vout_thread_s * );
+static int  vout_Manage     ( struct vout_thread_s * );
+static void vout_Display    ( struct vout_thread_s *, struct picture_s * );
+
+static int  SDLOpenDisplay      ( vout_thread_t *p_vout );
+static void SDLCloseDisplay     ( vout_thread_t *p_vout );
+static int  SDLNewPicture       ( vout_thread_t *p_vout, picture_t *p_pic );
 
 /*****************************************************************************
  * Functions exported as capabilities. They are declared as static so that
@@ -128,7 +118,7 @@ void _M( vout_getfunctions )( function_list_t * p_function_list )
     p_function_list->functions.vout.pf_destroy    = vout_Destroy;
     p_function_list->functions.vout.pf_manage     = vout_Manage;
     p_function_list->functions.vout.pf_display    = vout_Display;
-    p_function_list->functions.vout.pf_setpalette = vout_SetPalette;
+    p_function_list->functions.vout.pf_setpalette = NULL;
 }
 
 /*****************************************************************************
@@ -183,54 +173,19 @@ static int vout_Create( vout_thread_t *p_vout )
     }
 
     p_vout->p_sys->b_cursor = 1; /* TODO should be done with a main_GetInt.. */
-
     p_vout->p_sys->b_cursor_autohidden = 0;
     p_vout->p_sys->i_lastmoved = mdate();
 
-    p_vout->b_fullscreen = main_GetIntVariable( VOUT_FULLSCREEN_VAR,
-                                VOUT_FULLSCREEN_DEFAULT );
-    p_vout->p_sys->b_overlay = main_GetIntVariable( VOUT_OVERLAY_VAR,
-                                VOUT_OVERLAY_DEFAULT );
     p_vout->p_sys->i_width = p_vout->i_width;
     p_vout->p_sys->i_height = p_vout->i_height;
 
-    p_vout->p_sys->p_display = NULL;
-    p_vout->p_sys->p_overlay = NULL;
-
-    if( SDLOpenDisplay(p_vout) )
+    if( SDLOpenDisplay( p_vout ) )
     {
         intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() );
         free( p_vout->p_sys );
         return( 1 );
     }
 
-    /* FIXME: get rid of this ASAP, it's FUCKING UGLY */
-    { intf_thread_t * p_intf = p_main->p_intf;
-    intf_AssignKey(p_intf, SDLK_q,      INTF_KEY_QUIT, 0);
-    intf_AssignKey(p_intf, SDLK_ESCAPE, INTF_KEY_QUIT, 0);
-    /* intf_AssignKey(p_intf,3,'Q'); */
-    intf_AssignKey(p_intf, SDLK_0,      INTF_KEY_SET_CHANNEL,0);
-    intf_AssignKey(p_intf, SDLK_1,      INTF_KEY_SET_CHANNEL,1);
-    intf_AssignKey(p_intf, SDLK_2,      INTF_KEY_SET_CHANNEL,2);
-    intf_AssignKey(p_intf, SDLK_3,      INTF_KEY_SET_CHANNEL,3);
-    intf_AssignKey(p_intf, SDLK_4,      INTF_KEY_SET_CHANNEL,4);
-    intf_AssignKey(p_intf, SDLK_5,      INTF_KEY_SET_CHANNEL,5);
-    intf_AssignKey(p_intf, SDLK_6,      INTF_KEY_SET_CHANNEL,6);
-    intf_AssignKey(p_intf, SDLK_7,      INTF_KEY_SET_CHANNEL,7);
-    intf_AssignKey(p_intf, SDLK_8,      INTF_KEY_SET_CHANNEL,8);
-    intf_AssignKey(p_intf, SDLK_9,      INTF_KEY_SET_CHANNEL,9);
-    intf_AssignKey(p_intf, SDLK_PLUS,   INTF_KEY_INC_VOLUME, 0);
-    intf_AssignKey(p_intf, SDLK_MINUS,  INTF_KEY_DEC_VOLUME, 0);
-    intf_AssignKey(p_intf, SDLK_m,      INTF_KEY_TOGGLE_VOLUME, 0);
-    /* intf_AssignKey(p_intf,'M','M'); */
-    intf_AssignKey(p_intf, SDLK_g,      INTF_KEY_DEC_GAMMA, 0);
-    /* intf_AssignKey(p_intf,'G','G'); */
-    intf_AssignKey(p_intf, SDLK_c,      INTF_KEY_TOGGLE_GRAYSCALE, 0);
-    intf_AssignKey(p_intf, SDLK_SPACE,  INTF_KEY_TOGGLE_INTERFACE, 0);
-    intf_AssignKey(p_intf, SDLK_i,      INTF_KEY_TOGGLE_INFO, 0);
-    intf_AssignKey(p_intf, SDLK_s,      INTF_KEY_TOGGLE_SCALING, 0);
-    intf_AssignKey(p_intf, SDLK_d,      INTF_KEY_DUMP_STREAM, 0); }
-
     return( 0 );
 }
 
@@ -241,28 +196,33 @@ static int vout_Create( vout_thread_t *p_vout )
  *****************************************************************************/
 static int vout_Init( vout_thread_t *p_vout )
 {
-    /* This hack is hugly, but hey, you are, too. */
-
-    SDL_Overlay *   p_overlay;
-    
-    p_overlay = SDL_CreateYUVOverlay( 
-           main_GetIntVariable( VOUT_WIDTH_VAR,VOUT_WIDTH_DEFAULT ),
-           main_GetIntVariable( VOUT_HEIGHT_VAR,VOUT_HEIGHT_DEFAULT ),
-                                      SDL_YV12_OVERLAY, 
-                                      p_vout->p_sys->p_display );
+    picture_t *p_pic;
+    int        i_index = 0;
 
-    if( p_overlay == NULL )
+    /* Try to initialize SDL_MAX_DIRECTBUFFERS direct buffers */
+    while( i_index < SDL_MAX_DIRECTBUFFERS )
     {
-        intf_ErrMsg( "vout error: could not create SDL overlay" );
-        p_vout->b_need_render = 1;
-        return( 0 );
-    }
+        p_pic = &p_vout->p_picture[ i_index ];
 
-    intf_WarnMsg( 2, "vout: YUV acceleration %s",
-              p_overlay->hw_overlay ? "activated" : "unavailable !" ); 
-    p_vout->b_need_render = !p_overlay->hw_overlay;
+        if( SDLNewPicture( p_vout, p_pic ) )
+        {
+            break;
+        }
+
+        p_pic->i_status        = DESTROYED_PICTURE;
+
+        p_pic->b_directbuffer  = 1;
 
-    SDL_FreeYUVOverlay( p_overlay );
+        p_pic->i_left_margin   =
+        p_pic->i_right_margin  =
+        p_pic->i_top_margin    =
+        p_pic->i_bottom_margin = 0;
+
+        i_index++;
+    }
+
+    /* How many directbuffers did we create ? */
+    p_vout->i_directbuffers = i_index;
 
     return( 0 );
 }
@@ -274,8 +234,16 @@ static int vout_Init( vout_thread_t *p_vout )
  *****************************************************************************/
 static void vout_End( vout_thread_t *p_vout )
 {
-    SDLCloseDisplay( p_vout );
-    SDL_QuitSubSystem( SDL_INIT_VIDEO );
+    int i_index;
+
+    /* Free the direct buffers we allocated */
+    for( i_index = p_vout->i_directbuffers ; i_index ; )
+    {
+        i_index--;
+        SDL_UnlockYUVOverlay( p_vout->p_picture[ i_index ].p_sys->p_overlay );
+        SDL_FreeYUVOverlay( p_vout->p_picture[ i_index ].p_sys->p_overlay );
+        free( p_vout->p_picture[ i_index ].p_sys );
+    }
 }
 
 /*****************************************************************************
@@ -285,6 +253,10 @@ static void vout_End( vout_thread_t *p_vout )
  *****************************************************************************/
 static void vout_Destroy( vout_thread_t *p_vout )
 {
+    SDLCloseDisplay( p_vout );
+
+    SDL_QuitSubSystem( SDL_INIT_VIDEO );
+
     free( p_vout->p_sys );
 }
 
@@ -297,7 +269,6 @@ static void vout_Destroy( vout_thread_t *p_vout )
 static int vout_Manage( vout_thread_t *p_vout )
 {
     SDL_Event event;                                            /* SDL event */
-    char *    p_key;
 
     /* Process events */
     while( SDL_PollEvent(&event) )
@@ -305,9 +276,10 @@ static int vout_Manage( vout_thread_t *p_vout )
         switch( event.type )
         {
         case SDL_VIDEORESIZE:                          /* Resizing of window */
-            p_vout->i_width = event.resize.w;
-            p_vout->i_height = event.resize.h;
-            p_vout->i_changes |= VOUT_SIZE_CHANGE;
+            p_vout->p_sys->i_width = event.resize.w;
+            p_vout->p_sys->i_height = event.resize.h;
+            SDLCloseDisplay( p_vout );
+            SDLOpenDisplay( p_vout );
             break;
 
         case SDL_MOUSEMOTION:
@@ -338,26 +310,27 @@ static int vout_Manage( vout_thread_t *p_vout )
         case SDL_MOUSEBUTTONDOWN:
             switch( event.button.button )
             {
-            case SDL_BUTTON_MIDDLE:
-                p_vout->i_changes |= VOUT_CURSOR_CHANGE;
+            case SDL_BUTTON_LEFT:
+                /* Handle clicks */
                 break;
             }
             break;
 
         case SDL_QUIT:
-            intf_ProcessKey( p_main->p_intf, SDLK_q );
+            p_main->p_intf->b_die = 1;
             break;
 
         case SDL_KEYDOWN:                             /* if a key is pressed */
 
             switch( event.key.keysym.sym )
             {
-            case SDLK_f:                             /* switch to fullscreen */
-                p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
+            case SDLK_q:                                             /* quit */
+           case SDLK_ESCAPE:
+                p_main->p_intf->b_die = 1;
                 break;
 
-            case SDLK_y:                               /* switch to hard YUV */
-                p_vout->i_changes |= VOUT_YUV_CHANGE;
+            case SDLK_f:                             /* switch to fullscreen */
+                p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
                 break;
 
             case SDLK_c:                                 /* toggle grayscale */
@@ -380,50 +353,23 @@ static int vout_Manage( vout_thread_t *p_vout )
                 p_vout->i_changes |= VOUT_INTF_CHANGE;
                 break;
             
-            case SDLK_F10:
-                network_ChannelJoin( 0 );
-                break;
-            case SDLK_F1:
-                network_ChannelJoin( 1 );
-                break;
-            case SDLK_F2:
-                network_ChannelJoin( 2 );
-                break;
-            case SDLK_F3:
-                network_ChannelJoin( 3 );
-                break;
-            case SDLK_F4:
-                network_ChannelJoin( 4 );
-                break;
-            case SDLK_F5:
-                network_ChannelJoin( 5 );
-                break;
-            case SDLK_F6:
-                network_ChannelJoin( 6 );
-                break;
-            case SDLK_F7:
-                network_ChannelJoin( 7 );
-                break;
-            case SDLK_F8:
-                network_ChannelJoin( 8 );
-                break;
-            case SDLK_F9:
-                network_ChannelJoin( 9 );
-                break;
-
             case SDLK_MENU:
                 p_main->p_intf->b_menu_change = 1;
                 break;
                 
+            case SDLK_F10: network_ChannelJoin( 0 ); break;
+            case SDLK_F1:  network_ChannelJoin( 1 ); break;
+            case SDLK_F2:  network_ChannelJoin( 2 ); break;
+            case SDLK_F3:  network_ChannelJoin( 3 ); break;
+            case SDLK_F4:  network_ChannelJoin( 4 ); break;
+            case SDLK_F5:  network_ChannelJoin( 5 ); break;
+            case SDLK_F6:  network_ChannelJoin( 6 ); break;
+            case SDLK_F7:  network_ChannelJoin( 7 ); break;
+            case SDLK_F8:  network_ChannelJoin( 8 ); break;
+            case SDLK_F9:  network_ChannelJoin( 9 ); break;
+
             default:
-                p_key = SDL_GetKeyName( event.key.keysym.sym ) ;
-                if( intf_ProcessKey( p_main->p_intf, 
-                                     (char )event.key.keysym.sym ) )
-                {
-                   intf_DbgMsg( "unhandled key '%c' (%i)", 
-                                (char)event.key.keysym.sym, 
-                                event.key.keysym.sym );                
-                }
+                intf_DbgMsg( "unhandled key %i", event.key.keysym.sym );
                 break;
             }
             break;
@@ -433,44 +379,7 @@ static int vout_Manage( vout_thread_t *p_vout )
         }
     }
 
-    /*
-     * Size Change 
-     */
-    if( p_vout->i_changes & VOUT_SIZE_CHANGE )
-    {
-        p_vout->p_sys->i_width = p_vout->i_width;
-        p_vout->p_sys->i_height = p_vout->i_height;
-
-        /* Need to reopen display */
-        SDLCloseDisplay( p_vout );
-        if( SDLOpenDisplay( p_vout ) )
-        {
-          intf_ErrMsg( "vout error: can't reopen display after resize" );
-          return( 1 );
-        }
-        p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
-    }
-    
-    /*
-     * YUV Change 
-     */
-    if( p_vout->i_changes & VOUT_YUV_CHANGE )
-    {
-        p_vout->b_need_render = ! p_vout->b_need_render;
-        
-        /* Need to reopen display */
-        SDLCloseDisplay( p_vout );
-        if( SDLOpenDisplay( p_vout ) )
-        {
-          intf_ErrMsg( "error: can't reopen display after YUV change" );
-          return( 1 );
-        }
-        p_vout->i_changes &= ~VOUT_YUV_CHANGE;
-    }
-
-    /*
-     * Fullscreen change
-     */
+    /* Fullscreen change */
     if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
     {
         p_vout->b_fullscreen = ! p_vout->b_fullscreen;
@@ -484,9 +393,7 @@ static int vout_Manage( vout_thread_t *p_vout )
         p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
     }
 
-    /*
-     * Pointer change
-     */
+    /* Pointer change */
     if( ! p_vout->p_sys->b_cursor_autohidden &&
         ( mdate() - p_vout->p_sys->i_lastmoved > 2000000 ) )
     {
@@ -495,137 +402,33 @@ static int vout_Manage( vout_thread_t *p_vout )
         SDL_ShowCursor( 0 );
     }
 
-    if( p_vout->i_changes & VOUT_CURSOR_CHANGE )
-    {
-        p_vout->p_sys->b_cursor = ! p_vout->p_sys->b_cursor;
-
-        SDL_ShowCursor( p_vout->p_sys->b_cursor &&
-                        ! p_vout->p_sys->b_cursor_autohidden );
-
-        p_vout->i_changes &= ~VOUT_CURSOR_CHANGE;
-    }
-    
     return( 0 );
 }
 
 /*****************************************************************************
- * vout_SetPalette: sets an 8 bpp palette
+ * vout_Display: displays previously rendered output
  *****************************************************************************
- * This function sets the palette given as an argument. It does not return
- * anything, but could later send information on which colors it was unable
- * to set.
+ * This function sends the currently rendered image to the display.
  *****************************************************************************/
-static void vout_SetPalette( p_vout_thread_t p_vout, u16 *red, u16 *green,
-                         u16 *blue, u16 *transp)
+static void vout_Display( vout_thread_t *p_vout, picture_t *p_picture )
 {
-     /* Create a display surface with a grayscale palette */
-    SDL_Color colors[256];
-    int i;
-  
-    /* Fill colors with color information */
-    for( i = 0; i < 256; i++ )
-    {
-        colors[ i ].r = red[ i ] >> 8;
-        colors[ i ].g = green[ i ] >> 8;
-        colors[ i ].b = blue[ i ] >> 8;
-    }
+    SDL_Rect disp;
+
+    /* We'll need to deal with aspect ratio later */
+    disp.w = p_vout->p_sys->i_width;
+    disp.h = p_vout->p_sys->i_height;
+    disp.x = 0;
+    disp.y = 0;
 
-    /* Set palette */
-    if( SDL_SetColors( p_vout->p_sys->p_display, colors, 0, 256 ) == 0 )
+    if( p_picture->b_directbuffer )
     {
-        intf_ErrMsg( "vout error: failed setting palette" );
+        SDL_UnlockYUVOverlay( p_picture->p_sys->p_overlay);
+        SDL_DisplayYUVOverlay( p_picture->p_sys->p_overlay , &disp );
+        SDL_LockYUVOverlay( p_picture->p_sys->p_overlay);
     }
-
-}
-
-/*****************************************************************************
- * vout_Display: displays previously rendered output
- *****************************************************************************
- * This function send the currently rendered image to the display, wait until
- * it is displayed and switch the two rendering buffer, preparing next frame.
- *****************************************************************************/
-static void vout_Display( vout_thread_t *p_vout )
-{
-    SDL_Rect    disp;
-
-    if((p_vout->p_sys->p_display != NULL) && !p_vout->p_sys->b_reopen_display)
+    else
     {
-        if( !p_vout->b_need_render )
-        {
-            /*
-             * p_vout->p_rendered_pic->p_y/u/v contains the YUV buffers to
-             * render 
-             */
-            /* TODO: support for streams other than 4:2:0 */
-            if( p_vout->p_rendered_pic->i_type != YUV_420_PICTURE )
-            {
-                intf_ErrMsg("sdl vout error: no support for that kind of pictures");
-                return;
-            }
-            /* create the overlay if necessary */
-            if( p_vout->p_sys->p_overlay == NULL )
-            {
-                p_vout->p_sys->p_overlay = SDL_CreateYUVOverlay( 
-                                             p_vout->p_rendered_pic->i_width, 
-                                             p_vout->p_rendered_pic->i_height,
-                                             SDL_YV12_OVERLAY, 
-                                             p_vout->p_sys->p_display );
-
-                if( p_vout->p_sys->p_overlay != NULL )
-                {
-                    intf_WarnMsg( 2, "vout: YUV acceleration %s",
-                                  p_vout->p_sys->p_overlay->hw_overlay
-                                   ? "activated" : "unavailable !" ); 
-                }
-            }
-
-            if( p_vout->p_sys->p_overlay == NULL )
-            {
-                /* Overlay allocation failed, switch back to software mode */
-                intf_ErrMsg( "vout error: could not create SDL overlay" );
-                p_vout->b_need_render = 1;
-            }
-            else
-            {
-                int i_x, i_y, i_w, i_h;
-
-                SDL_LockYUVOverlay( p_vout->p_sys->p_overlay );
-                /* copy the data into video buffers */
-                /* Y first */
-                p_main->fast_memcpy( p_vout->p_sys->p_overlay->pixels[0],
-                                     p_vout->p_rendered_pic->p_y,
-                                     p_vout->p_sys->p_overlay->h *
-                                     p_vout->p_sys->p_overlay->pitches[0] );
-                /* then V */
-                p_main->fast_memcpy( p_vout->p_sys->p_overlay->pixels[1],
-                                     p_vout->p_rendered_pic->p_v,
-                                     p_vout->p_sys->p_overlay->h *
-                                     p_vout->p_sys->p_overlay->pitches[1] / 2 );
-                /* and U */
-                p_main->fast_memcpy( p_vout->p_sys->p_overlay->pixels[2],
-                                     p_vout->p_rendered_pic->p_u,
-                                     p_vout->p_sys->p_overlay->h *
-                                     p_vout->p_sys->p_overlay->pitches[2] / 2 );
-
-                OutputCoords( p_vout->p_rendered_pic, 1,
-                              p_vout->p_sys->i_width,
-                              p_vout->p_sys->i_height,
-                              &i_x, &i_y,
-                              &i_w, &i_h);
-                disp.x = i_x;
-                disp.y = i_y;
-                disp.w = i_w;
-                disp.h = i_h;
-
-                SDL_DisplayYUVOverlay( p_vout->p_sys->p_overlay , &disp );
-                SDL_UnlockYUVOverlay(p_vout->p_sys->p_overlay);
-
-                return;
-            }
-        }
-    
-        /* Software YUV: change display frame */
-        SDL_Flip( p_vout->p_sys->p_display );
+        intf_ErrMsg( "vout error: main thread passed a virtual buffer" );
     }
 }
 
@@ -639,47 +442,24 @@ static void vout_Display( vout_thread_t *p_vout )
  *****************************************************************************/
 static int SDLOpenDisplay( vout_thread_t *p_vout )
 {
-    SDL_Rect    clipping_rect;
-    Uint32      flags;
-    int bpp;
-    /* Open display 
-     * TODO: Check that we can request for a DOUBLEBUF HWSURFACE display
-     */
+    Uint32 i_flags;
+    int    i_bpp;
 
-    /* init flags and cursor */
-    flags = SDL_ANYFORMAT | SDL_HWPALETTE;
-
-    if( p_vout->b_fullscreen )
-    {
-        flags |= SDL_FULLSCREEN;
-    }
-    else
-    {
-        flags |= SDL_RESIZABLE;
-    }
+    /* Initialize flags and cursor */
+    i_flags = SDL_ANYFORMAT | SDL_HWPALETTE | SDL_HWSURFACE;
+    i_flags |= p_vout->b_fullscreen ? SDL_FULLSCREEN : SDL_RESIZABLE;
 
-    if( p_vout->b_need_render )
-    {
-        flags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
-    }
-    else
-    {
-        flags |= SDL_SWSURFACE; /* save video memory */
-    }
-
-    bpp = SDL_VideoModeOK( p_vout->p_sys->i_width,
-                           p_vout->p_sys->i_height,
-                           p_vout->i_screen_depth, flags );
-
-    if( bpp == 0 )
+    i_bpp = SDL_VideoModeOK( p_vout->p_sys->i_width, p_vout->p_sys->i_height,
+                             SDL_DEFAULT_BPP, i_flags );
+    if( i_bpp == 0 )
     {
         intf_ErrMsg( "vout error: no video mode available" );
         return( 1 );
     }
 
-    p_vout->p_sys->p_display = SDL_SetVideoMode(p_vout->p_sys->i_width,
-                                                p_vout->p_sys->i_height,
-                                                bpp, flags);
+    p_vout->p_sys->p_display = SDL_SetVideoMode( p_vout->p_sys->i_width,
+                                                 p_vout->p_sys->i_height,
+                                                 i_bpp, i_flags );
 
     if( p_vout->p_sys->p_display == NULL )
     {
@@ -691,56 +471,7 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
 
     SDL_WM_SetCaption( VOUT_TITLE " (SDL output)",
                        VOUT_TITLE " (SDL output)" );
-    SDL_EventState(SDL_KEYUP , SDL_IGNORE);                /* ignore keys up */
-
-    if( p_vout->b_need_render )
-    {
-        p_vout->p_sys->p_sdl_buf[ 0 ] = p_vout->p_sys->p_display->pixels;
-        SDL_Flip(p_vout->p_sys->p_display);
-        p_vout->p_sys->p_sdl_buf[ 1 ] = p_vout->p_sys->p_display->pixels;
-        SDL_Flip(p_vout->p_sys->p_display);
-
-        /* Set clipping for text */
-        clipping_rect.x = 0;
-        clipping_rect.y = 0;
-        clipping_rect.w = p_vout->p_sys->p_display->w;
-        clipping_rect.h = p_vout->p_sys->p_display->h;
-        SDL_SetClipRect(p_vout->p_sys->p_display, &clipping_rect);
-
-        /* Set thread information */
-        p_vout->i_width =           p_vout->p_sys->p_display->w;
-        p_vout->i_height =          p_vout->p_sys->p_display->h;
-        p_vout->i_bytes_per_line =  p_vout->p_sys->p_display->pitch;
-
-        p_vout->i_screen_depth =
-            p_vout->p_sys->p_display->format->BitsPerPixel;
-        p_vout->i_bytes_per_pixel =
-            p_vout->p_sys->p_display->format->BytesPerPixel;
-
-        p_vout->i_red_mask =        p_vout->p_sys->p_display->format->Rmask;
-        p_vout->i_green_mask =      p_vout->p_sys->p_display->format->Gmask;
-        p_vout->i_blue_mask =       p_vout->p_sys->p_display->format->Bmask;
-
-        /* FIXME: palette in 8bpp ?? */
-        /* Set and initialize buffers */
-        p_vout->pf_setbuffers( p_vout, p_vout->p_sys->p_sdl_buf[ 0 ],
-                                       p_vout->p_sys->p_sdl_buf[ 1 ] );
-    }
-    else
-    {
-        p_vout->p_sys->p_sdl_buf[ 0 ] = p_vout->p_sys->p_display->pixels;
-        p_vout->p_sys->p_sdl_buf[ 1 ] = p_vout->p_sys->p_display->pixels;
-
-        /* Set thread information */
-        p_vout->i_width =           p_vout->p_sys->p_display->w;
-        p_vout->i_height =          p_vout->p_sys->p_display->h;
-        p_vout->i_bytes_per_line =  p_vout->p_sys->p_display->pitch;
-
-        p_vout->pf_setbuffers( p_vout, p_vout->p_sys->p_sdl_buf[ 0 ],
-                                       p_vout->p_sys->p_sdl_buf[ 1 ] );
-    }
-
-    p_vout->p_sys->b_reopen_display = 0;
+    SDL_EventState( SDL_KEYUP, SDL_IGNORE );               /* ignore keys up */
 
     return( 0 );
 }
@@ -753,84 +484,68 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
  *****************************************************************************/
 static void SDLCloseDisplay( vout_thread_t *p_vout )
 {
-    if( p_vout->p_sys->p_display != NULL )
-    {
-        if( p_vout->p_sys->p_overlay != NULL )
-        {            
-            SDL_FreeYUVOverlay( p_vout->p_sys->p_overlay );
-            p_vout->p_sys->p_overlay = NULL;
-        }
-
-        SDL_UnlockSurface ( p_vout->p_sys->p_display );
-        SDL_FreeSurface( p_vout->p_sys->p_display );
-        p_vout->p_sys->p_display = NULL;
-    }
+    SDL_UnlockSurface ( p_vout->p_sys->p_display );
+    SDL_FreeSurface( p_vout->p_sys->p_display );
 }
 
 /*****************************************************************************
- * OutputCoords: compute the dimensions of the destination image
+ * SDLNewPicture: allocate a picture
  *****************************************************************************
- * This based on some code in SetBufferPicture... , it is also in use in the
- * the xvideo plugin. Maybe we should think about putting standard video
- * processing functions in a common library ?
+ * Returns 0 on success, -1 otherwise
  *****************************************************************************/
-static void OutputCoords( const picture_t *p_pic, const boolean_t scale,
-                          const int win_w, const int win_h,
-                          int *dx, int *dy, int *w, int *h )
+static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
 {
-    if( !scale )
+    switch( p_vout->i_chroma )
     {
-        *w = p_pic->i_width; *h = p_pic->i_height;
-    }
-    else
-    {
-        *w = win_w;
-        switch( p_pic->i_aspect_ratio )
-        {
-            case AR_3_4_PICTURE:
-                *h = win_w * 3 / 4;
-                break;
+        case YUV_420_PICTURE:
+            /* We know this chroma, allocate a buffer which will be used
+             * directly by the decoder */
+            p_pic->p_sys = malloc( sizeof( picture_sys_t ) );
 
-            case AR_16_9_PICTURE:
-                *h = win_w * 9 / 16;
-                break;
-
-            case AR_221_1_PICTURE:
-                *h = win_w * 100 / 221;
-                break;
+            if( p_pic->p_sys == NULL )
+            {
+                return -1;
+            }
 
-            case AR_SQUARE_PICTURE:
-            default:
-                *h = win_w * p_pic->i_height / p_pic->i_width;
-                break;
-        }
+            p_pic->p_sys->p_overlay =
+                SDL_CreateYUVOverlay( p_vout->i_width, p_vout->i_height,
+                                      SDL_YV12_OVERLAY,
+                                      p_vout->p_sys->p_display );
 
-        if( *h > win_h )
-        {
-            *h = win_h;
-            switch( p_pic->i_aspect_ratio )
+            if( p_pic->p_sys->p_overlay == NULL )
             {
-                case AR_3_4_PICTURE:
-                    *w = win_h * 4 / 3;
-                    break;
-
-                case AR_16_9_PICTURE:
-                    *w = win_h * 16 / 9;
-                    break;
-
-                case AR_221_1_PICTURE:
-                    *w = win_h * 221 / 100;
-                    break;
-
-                case AR_SQUARE_PICTURE:
-                default:
-                    *w = win_h * p_pic->i_width / p_pic->i_height;
-                    break;
+                free( p_pic->p_sys );
+                return -1;
             }
-        }
-    }
 
-    /* Set picture position */
-    *dx = (win_w - *w) / 2;
-    *dy = (win_h - *h) / 2;
+            SDL_LockYUVOverlay( p_pic->p_sys->p_overlay );
+
+            p_pic->i_chroma = p_vout->i_chroma; /* YUV_420_PICTURE */
+            p_pic->i_width  = p_vout->i_width;
+            p_pic->i_height = p_vout->i_height;
+
+            /* Precalculate some values */
+            p_pic->i_size         = p_vout->i_width * p_vout->i_height;
+            p_pic->i_chroma_width = p_vout->i_width / 2;
+            p_pic->i_chroma_size  = p_vout->i_height * p_pic->i_chroma_width;
+
+            /* FIXME: try to get the right i_bytes value from p_overlay */
+            p_pic->planes[ Y_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[0];
+            p_pic->planes[ Y_PLANE ].i_bytes = p_pic->i_size * sizeof( u8 );
+            p_pic->planes[ U_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[2];
+            p_pic->planes[ U_PLANE ].i_bytes = p_pic->i_size * sizeof( u8 ) / 4;
+            p_pic->planes[ V_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[1];
+            p_pic->planes[ V_PLANE ].i_bytes = p_pic->i_size * sizeof( u8 ) / 4;
+
+            p_pic->i_planes = 3;
+
+            return 0;
+
+        default:
+            /* Unknown chroma, tell the guy to get lost */
+            p_pic->i_planes = 0;
+
+            return 0;
+    }
 }
+
similarity index 90%
rename from plugins/spu_dec/Makefile
rename to plugins/spudec/Makefile
index 0688a3537c7b8e506b676c6712933ebb39f43809..01a91af64fe5406d5a42d9ea23d4175b586c4cf5 100644 (file)
@@ -20,10 +20,10 @@ include ../../Makefile.modules
 # Real targets
 #
 
-../spu_dec.so: $(PLUGIN_C)
+../spudec.so: $(PLUGIN_C)
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) 
 
-../spu_dec.a: $(BUILTIN_C)
+../spudec.a: $(BUILTIN_C)
        ar r $@ $^
        $(RANLIB) $@
 
similarity index 94%
rename from plugins/spu_dec/spu_decoder.c
rename to plugins/spudec/spu_decoder.c
index 8fbafb6282d33abdd8665207ef812b6e20cf5584..321c1a9d20d824b41272eb87ad35ad15d7bb21de 100644 (file)
@@ -2,7 +2,7 @@
  * spu_decoder.c : spu decoder thread
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: spu_decoder.c,v 1.5 2001/12/03 16:18:37 sam Exp $
+ * $Id: spu_decoder.c,v 1.1 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -21,7 +21,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
-#define MODULE_NAME spu_dec
+#define MODULE_NAME spudec
 #include "modules_inner.h"
 
 /*****************************************************************************
@@ -40,7 +40,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                    /* memcpy(), memset() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int spu_dec_Probe         ( probedata_t * );
-static int  spu_dec_Run          ( decoder_config_t * );
-static int  spu_dec_Init         ( spudec_thread_t * );
-static void spu_dec_ErrorThread  ( spudec_thread_t * );
-static void spu_dec_EndThread    ( spudec_thread_t * );
+static int  spudec_Probe         ( probedata_t * );
+static int  spudec_Run           ( decoder_config_t * );
+static int  spudec_Init          ( spudec_thread_t * );
+static void spudec_ErrorThread   ( spudec_thread_t * );
+static void spudec_EndThread     ( spudec_thread_t * );
 
 static int  SyncPacket           ( spudec_thread_t * );
 static void ParsePacket          ( spudec_thread_t * );
@@ -73,10 +72,10 @@ static int  ParseRLE             ( spudec_thread_t *, subpicture_t *, u8 * );
 /*****************************************************************************
  * Capabilities
  *****************************************************************************/
-void _M( spu_dec_getfunctions )( function_list_t * p_function_list )
+void _M( spudec_getfunctions )( function_list_t * p_function_list )
 {
-    p_function_list->pf_probe = spu_dec_Probe;
-    p_function_list->functions.dec.pf_run = spu_dec_Run;
+    p_function_list->pf_probe = spudec_Probe;
+    p_function_list->functions.dec.pf_run = spudec_Run;
 }
 
 /*****************************************************************************
@@ -93,19 +92,19 @@ MODULE_INIT_START
 MODULE_INIT_STOP
 
 MODULE_ACTIVATE_START
-    _M( spu_dec_getfunctions )( &p_module->p_functions->dec );
+    _M( spudec_getfunctions )( &p_module->p_functions->dec );
 MODULE_ACTIVATE_STOP
 
 MODULE_DEACTIVATE_START
 MODULE_DEACTIVATE_STOP
 
 /*****************************************************************************
- * spu_dec_Probe: probe the decoder and return score
+ * spudec_Probe: probe the decoder and return score
  *****************************************************************************
  * Tries to launch a decoder and return score so that the interface is able 
  * to chose.
  *****************************************************************************/
-static int spu_dec_Probe( probedata_t *p_data )
+static int spudec_Probe( probedata_t *p_data )
 {
     if( p_data->i_type == DVD_SPU_ES )
         return( 50 );
@@ -114,9 +113,9 @@ static int spu_dec_Probe( probedata_t *p_data )
 }
 
 /*****************************************************************************
- * spu_dec_Run: this function is called just after the thread is created
+ * spudec_Run: this function is called just after the thread is created
  *****************************************************************************/
-static int spu_dec_Run( decoder_config_t * p_config )
+static int spudec_Run( decoder_config_t * p_config )
 {
     spudec_thread_t *     p_spudec;
    
@@ -142,7 +141,7 @@ static int spu_dec_Run( decoder_config_t * p_config )
     /*
      * Initialize thread and free configuration
      */
-    p_spudec->p_fifo->b_error = spu_dec_Init( p_spudec );
+    p_spudec->p_fifo->b_error = spudec_Init( p_spudec );
 
     /*
      * Main loop - it is not executed if an error occured during
@@ -161,11 +160,11 @@ static int spu_dec_Run( decoder_config_t * p_config )
      */
     if( p_spudec->p_fifo->b_error )
     {
-        spu_dec_ErrorThread( p_spudec );
+        spudec_ErrorThread( p_spudec );
     }
 
     /* End of thread */
-    spu_dec_EndThread( p_spudec );
+    spudec_EndThread( p_spudec );
 
     if( p_spudec->p_fifo->b_error )
     {
@@ -179,13 +178,13 @@ static int spu_dec_Run( decoder_config_t * p_config )
 /* following functions are local */
 
 /*****************************************************************************
- * spu_dec_Init: initialize spu decoder thread
+ * spudec_Init: initialize spu decoder thread
  *****************************************************************************
  * This function is called from RunThread and performs the second step of the
  * initialization. It returns 0 on success. Note that the thread's flag are not
  * modified inside this function.
  *****************************************************************************/
-static int spu_dec_Init( spudec_thread_t *p_spudec )
+static int spudec_Init( spudec_thread_t *p_spudec )
 {
     /* Spawn a video output if there is none */
     vlc_mutex_lock( &p_vout_bank->lock );
@@ -194,7 +193,7 @@ static int spu_dec_Init( spudec_thread_t *p_spudec )
     {
         intf_WarnMsg( 1, "spudec: no vout present, spawning one" );
 
-        p_spudec->p_vout = vout_CreateThread( NULL, 0, 0 );
+        p_spudec->p_vout = vout_CreateThread( NULL, 0, 0, 0, 0 );
 
         /* Everything failed */
         if( p_spudec->p_vout == NULL )
@@ -225,13 +224,13 @@ static int spu_dec_Init( spudec_thread_t *p_spudec )
 }
 
 /*****************************************************************************
- * spu_dec_ErrorThread: spu_dec_Run() error loop
+ * spudec_ErrorThread: spudec_Run() error loop
  *****************************************************************************
  * This function is called when an error occured during thread main's loop. The
  * thread can still receive feed, but must be ready to terminate as soon as
  * possible.
  *****************************************************************************/
-static void spu_dec_ErrorThread( spudec_thread_t *p_spudec )
+static void spudec_ErrorThread( spudec_thread_t *p_spudec )
 {
     /* We take the lock, because we are going to read/write the start/end
      * indexes of the decoder fifo */
@@ -258,12 +257,12 @@ static void spu_dec_ErrorThread( spudec_thread_t *p_spudec )
 }
 
 /*****************************************************************************
- * spu_dec_EndThread: thread destruction
+ * spudec_EndThread: thread destruction
  *****************************************************************************
  * This function is called when the thread ends after a sucessful
  * initialization.
  *****************************************************************************/
-static void spu_dec_EndThread( spudec_thread_t *p_spudec )
+static void spudec_EndThread( spudec_thread_t *p_spudec )
 {
     free( p_spudec );
 }
similarity index 98%
rename from plugins/spu_dec/spu_decoder.h
rename to plugins/spudec/spu_decoder.h
index d0ea3784a12f416d84633f83c42639a7904e8187..2f9fa94a1262ab0f5670371205ee079ba745e7c8 100644 (file)
@@ -2,7 +2,7 @@
  * spu_decoder.h : sub picture unit decoder thread interface
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: spu_decoder.h,v 1.1 2001/11/13 12:09:18 henri Exp $
+ * $Id: spu_decoder.h,v 1.1 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
index 130cd0a987cb04b1220e97118843d12d7b376d74..ead0d39ad2647cd8ac91a588a1d9a805d6d94bd2 100644 (file)
@@ -42,7 +42,6 @@
 #include <winsock2.h>                                            /* select() */
 #endif
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index fde7ddbec66c12119ce75b7b4c3262c1205619fc..13c2599629aa83463b1dfedaacb9ca2c7a550317 100644 (file)
@@ -2,7 +2,7 @@
  * ncurses.c : NCurses plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: ncurses.c,v 1.7 2001/11/28 15:08:06 massiot Exp $
+ * $Id: ncurses.c,v 1.8 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *      
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 33d5600f8133778189cfdf50c49a2d4e05da616d..3108f01ae3352ead34646b19ce8e0c7f0a027ee6 100644 (file)
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 4cb3920988b9bbba7b506e8122fa7e50e0fa0af4..179f8ed82ed76b4c5bc9f9d92fb95311ab3cc429 100644 (file)
@@ -70,7 +70,7 @@
 #include "modules.h"
 #include "modules_export.h"
 
-#include "../mpeg/input_ps.h"
+#include "../mpeg_system/input_ps.h"
 #include "input_vcd.h"
 #include "linux_cdrom_tools.h"
 
index e1c2d09dd0d23a69871e6a0dd608971ed25a56fc..9cfaa652ab68ab696ec15e4aa3f1f71bbcc19b80 100644 (file)
@@ -2,7 +2,7 @@
  * vcd.c : VCD input module for vlc
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: vcd.c,v 1.2 2001/11/28 15:08:06 massiot Exp $
+ * $Id: vcd.c,v 1.3 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                              /* strdup() */
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index b60a6a23506d176ac160bebc4e5cdcc10e5b2301..4ef99b50d320ae84c3f3ea9239b3b9c8dedc5b55 100644 (file)
@@ -9,19 +9,15 @@
 
 PLUGIN_X11 = x11.o vout_x11.o
 PLUGIN_XVIDEO = xvideo.o vout_xvideo.o
-BUILTIN_X11 = $(PLUGIN_X11:%.o=BUILTIN_%.o)
-BUILTIN_XVIDEO = $(PLUGIN_XVIDEO:%.o=BUILTIN_%.o)
+PLUGIN_XCOMMON = vout_common.o
 
-PLUGIN_C = $(PLUGIN_X11) $(PLUGIN_XVIDEO)
-BUILTIN_C = $(BUILTIN_X11) $(BUILTIN_XVIDEO)
+BUILTIN_X11 = $(PLUGIN_X11:%.o=BUILTIN_X11_%.o) \
+              $(PLUGIN_XCOMMON:%.o=BUILTIN_X11_%.o)
+BUILTIN_XVIDEO = $(PLUGIN_XVIDEO:%.o=BUILTIN_XVIDEO_%.o) \
+                 $(PLUGIN_XCOMMON:%.o=BUILTIN_XVIDEO_%.o)
 
-ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
-
-#
-# Special plugin modifications
-#
-
-CFLAGS += $(CFLAGS_X11)
+PLUGIN_C = $(PLUGIN_X11) $(PLUGIN_XVIDEO) $(PLUGIN_XCOMMON)
+ALL_OBJ = $(PLUGIN_C) $(BUILTIN_X11) $(BUILTIN_XVIDEO)
 
 #
 # Virtual targets
@@ -29,27 +25,27 @@ CFLAGS += $(CFLAGS_X11)
 
 include ../../Makefile.modules
 
+$(BUILTIN_X11): BUILTIN_X11_%.o: .dep/%.d
+$(BUILTIN_X11): BUILTIN_X11_%.o: %.c
+       $(CC) $(CFLAGS) $(CFLAGS_X11) -DBUILTIN -DMODULE_NAME=x11 -c -o $@ $<
+
+$(BUILTIN_XVIDEO): BUILTIN_XVIDEO_%.o: .dep/%.d
+$(BUILTIN_XVIDEO): BUILTIN_XVIDEO_%.o: %.c
+       $(CC) $(CFLAGS) $(CFLAGS_XVIDEO) -DBUILTIN -DMODULE_NAME=xvideo -c -o $@ $<
+
 #
 # Real targets
 #
 
 ../x11.so: $(PLUGIN_X11)
-ifeq ($(SYS),nto-qnx)
-       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_X11) -lsocket
-else
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_X11)
-endif
 
 ../x11.a: $(BUILTIN_X11)
        ar r $@ $^
        $(RANLIB) $@
 
 ../xvideo.so: $(PLUGIN_XVIDEO)
-ifeq ($(SYS),nto-qnx)
-       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_XVIDEO) -lsocket
-else
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_XVIDEO)
-endif
 
 ../xvideo.a: $(BUILTIN_XVIDEO)
        ar r $@ $^
diff --git a/plugins/x11/vout_common.c b/plugins/x11/vout_common.c
new file mode 100644 (file)
index 0000000..0c34286
--- /dev/null
@@ -0,0 +1,670 @@
+/*****************************************************************************
+ * vout_common.c: Functions common to the X11 and XVideo plugins
+ *****************************************************************************
+ * Copyright (C) 1998-2001 VideoLAN
+ * $Id: vout_common.c,v 1.1 2001/12/09 17:01:37 sam Exp $
+ *
+ * Authors: Vincent Seguin <seguin@via.ecp.fr>
+ *          Samuel Hocevar <sam@zoy.org>
+ *          David Kennedy <dkennedy@tinytoad.com>
+ *
+ * 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.
+ *****************************************************************************/
+
+#include "modules_inner.h"
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#ifdef HAVE_MACHINE_PARAM_H
+/* BSD */
+#include <machine/param.h>
+#include <sys/types.h>                                     /* typedef ushort */
+#include <sys/ipc.h>
+#endif
+
+#ifndef WIN32
+#include <netinet/in.h>                               /* BSD: struct in_addr */
+#endif
+
+#include <sys/shm.h>                                   /* shmget(), shmctl() */
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/keysym.h>
+#include <X11/extensions/XShm.h>
+
+#define x11 12
+#define xvideo 42
+#if ( MODULE_NAME == x11 )
+#   define MODULE_NAME_IS_x11 1
+#elif ( MODULE_NAME == xvideo )
+#   define MODULE_NAME_IS_xvideo 1
+#   include <X11/extensions/Xv.h>
+#   include <X11/extensions/Xvlib.h>
+#   include <X11/extensions/dpms.h>
+#endif
+#undef x11
+#undef xvideo
+
+#include "common.h"
+#include "intf_msg.h"
+#include "threads.h"
+#include "mtime.h"
+#include "tests.h"
+
+#include "video.h"
+#include "video_output.h"
+#include "vout_common.h"
+
+#include "interface.h"
+#include "netutils.h"                                 /* network_ChannelJoin */
+
+#include "stream_control.h"                 /* needed by input_ext-intf.h... */
+#include "input_ext-intf.h"
+
+#include "modules.h"
+#include "modules_export.h"
+
+/*****************************************************************************
+ * vout_Manage: handle X11 events
+ *****************************************************************************
+ * This function should be called regularly by video output thread. It manages
+ * X11 events and allows window resizing. It returns a non null value on
+ * error.
+ *****************************************************************************/
+int _M( vout_Manage ) ( vout_thread_t *p_vout )
+{
+    XEvent      xevent;                                         /* X11 event */
+    boolean_t   b_resized;                        /* window has been resized */
+    char        i_key;                                    /* ISO Latin-1 key */
+    KeySym      x_key_symbol;
+
+    /* Handle X11 events: ConfigureNotify events are parsed to know if the
+     * output window's size changed, MapNotify and UnmapNotify to know if the
+     * window is mapped (and if the display is useful), and ClientMessages
+     * to intercept window destruction requests */
+
+    b_resized = 0;
+    while( XCheckWindowEvent( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                              StructureNotifyMask | KeyPressMask |
+                              ButtonPressMask | ButtonReleaseMask | 
+                              PointerMotionMask | Button1MotionMask , &xevent )
+           == True )
+    {
+        /* ConfigureNotify event: prepare  */
+        if( (xevent.type == ConfigureNotify)
+          && ((xevent.xconfigure.width != p_vout->p_sys->i_window_width)
+             || (xevent.xconfigure.height != p_vout->p_sys->i_window_height)) )
+        {
+            /* Update dimensions */
+            b_resized = 1;
+            p_vout->p_sys->i_window_width = xevent.xconfigure.width;
+            p_vout->p_sys->i_window_height = xevent.xconfigure.height;
+        }
+        /* MapNotify event: change window status and disable screen saver */
+        else if( xevent.type == MapNotify)
+        {
+            if( (p_vout != NULL) && !p_vout->b_active )
+            {
+                _M( XCommonDisableScreenSaver ) ( p_vout );
+                p_vout->b_active = 1;
+            }
+        }
+        /* UnmapNotify event: change window status and enable screen saver */
+        else if( xevent.type == UnmapNotify )
+        {
+            if( (p_vout != NULL) && p_vout->b_active )
+            {
+                _M( XCommonEnableScreenSaver ) ( p_vout );
+                p_vout->b_active = 0;
+            }
+        }
+        /* Keyboard event */
+        else if( xevent.type == KeyPress )
+        {
+            /* We may have keys like F1 trough F12, ESC ... */
+            x_key_symbol = XKeycodeToKeysym( p_vout->p_sys->p_display,
+                                             xevent.xkey.keycode, 0 );
+            switch( x_key_symbol )
+            {
+                 case XK_Escape:
+                     p_main->p_intf->b_die = 1;
+                     break;
+                 case XK_Menu:
+                     p_main->p_intf->b_menu_change = 1;
+                     break;
+                 default:
+                     /* "Normal Keys"
+                      * The reason why I use this instead of XK_0 is that 
+                      * with XLookupString, we don't have to care about
+                      * keymaps. */
+
+                    if( XLookupString( &xevent.xkey, &i_key, 1, NULL, NULL ) )
+                    {
+                        /* FIXME: handle stuff here */
+                        switch( i_key )
+                        {
+                        case 'q':
+                        case 'Q':
+                            p_main->p_intf->b_die = 1;
+                            break;
+                        case 'f':
+                        case 'F':
+                            p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
+                            break;
+
+                        case '0': network_ChannelJoin( 0 ); break;
+                        case '1': network_ChannelJoin( 1 ); break;
+                        case '2': network_ChannelJoin( 2 ); break;
+                        case '3': network_ChannelJoin( 3 ); break;
+                        case '4': network_ChannelJoin( 4 ); break;
+                        case '5': network_ChannelJoin( 5 ); break;
+                        case '6': network_ChannelJoin( 6 ); break;
+                        case '7': network_ChannelJoin( 7 ); break;
+                        case '8': network_ChannelJoin( 8 ); break;
+                        case '9': network_ChannelJoin( 9 ); break;
+
+                        default:
+                            intf_DbgMsg( "vout: unhandled key '%c' (%i)", 
+                                         (char)i_key, i_key );
+                            break;
+                        }
+                    }
+                break;
+            }
+        }
+        /* Mouse click */
+        else if( xevent.type == ButtonPress )
+        {
+            switch( ((XButtonEvent *)&xevent)->button )
+            {
+                case Button1:
+                    /* In this part we will eventually manage
+                     * clicks for DVD navigation for instance. For the
+                     * moment just pause the stream. */
+                    input_SetStatus( p_main->p_intf->p_input,
+                                     INPUT_STATUS_PAUSE );
+                    break;
+            }
+        }
+        /* Mouse release */
+        else if( xevent.type == ButtonRelease )
+        {
+            switch( ((XButtonEvent *)&xevent)->button )
+            {
+                case Button3:
+                    /* FIXME: need locking ! */
+                    p_main->p_intf->b_menu_change = 1;
+                    break;
+            }
+        }
+        /* Mouse move */
+        else if( xevent.type == MotionNotify )
+        {
+            p_vout->p_sys->i_time_mouse_last_moved = mdate();
+            if( ! p_vout->p_sys->b_mouse_pointer_visible )
+            {
+                _M( XCommonToggleMousePointer ) ( p_vout ); 
+            }
+        }
+        /* Other event */
+        else
+        {
+            intf_WarnMsg( 3, "vout: unhandled event %d received", xevent.type );
+        }
+    }
+
+    /* Handle events for YUV video output sub-window */
+    while( XCheckWindowEvent( p_vout->p_sys->p_display,
+                              p_vout->p_sys->yuv_window,
+                              ExposureMask, &xevent ) == True )
+    {
+        /* Window exposed (only handled if stream playback is paused) */
+        if( xevent.type == Expose )
+        {
+            if( ((XExposeEvent *)&xevent)->count == 0 )
+            {
+                /* (if this is the last a collection of expose events...) */
+                if( p_main->p_intf->p_input != NULL )
+                {
+                    if( PAUSE_S ==
+                            p_main->p_intf->p_input->stream.control.i_status )
+                    {
+/*                        XVideoDisplay( p_vout )*/;
+                    }
+                }
+            }
+        }
+    }
+
+    /* ClientMessage event - only WM_PROTOCOLS with WM_DELETE_WINDOW data
+     * are handled - according to the man pages, the format is always 32
+     * in this case */
+    while( XCheckTypedEvent( p_vout->p_sys->p_display,
+                             ClientMessage, &xevent ) )
+    {
+        if( (xevent.xclient.message_type == p_vout->p_sys->wm_protocols)
+            && (xevent.xclient.data.l[0] == p_vout->p_sys->wm_delete_window ) )
+        {
+            p_main->p_intf->b_die = 1;
+        }
+        else
+        {
+            intf_DbgMsg( "vout: unhandled ClientMessage received" );
+        }
+    }
+
+    if ( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
+    {
+        p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
+
+        p_vout->b_fullscreen = !p_vout->b_fullscreen;
+
+        /* Get rid of the old window */
+        _M( XCommonDestroyWindow ) ( p_vout );
+
+        /* And create a new one */
+        if( _M( XCommonCreateWindow ) ( p_vout ) )
+        {
+            intf_ErrMsg( "vout error: cannot create X11 window" );
+            XCloseDisplay( p_vout->p_sys->p_display );
+
+            free( p_vout->p_sys );
+            return( 1 );
+        }
+
+    }
+
+#ifdef MODULE_NAME_IS_x11
+    /*
+     * Handle vout window resizing
+     */
+    if( b_resized )
+    {
+        /* If interface window has been resized, change vout size */
+        intf_DbgMsg( "vout: resizing output window" );
+        p_vout->i_width =  p_vout->p_sys->i_width;
+        p_vout->i_height = p_vout->p_sys->i_height;
+        p_vout->i_changes |= VOUT_SIZE_CHANGE;
+    }
+    else if( (p_vout->i_width  != p_vout->p_sys->i_width) ||
+             (p_vout->i_height != p_vout->p_sys->i_height) )
+    {
+        /* If video output size has changed, change interface window size */
+        intf_DbgMsg( "vout: resizing output window" );
+        p_vout->p_sys->i_width =    p_vout->i_width;
+        p_vout->p_sys->i_height =   p_vout->i_height;
+        XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                       p_vout->p_sys->i_width, p_vout->p_sys->i_height );
+    }
+    /*
+     * Color/Grayscale or gamma change: in 8bpp, just change the colormap
+     */
+    if( (p_vout->i_changes & VOUT_GRAYSCALE_CHANGE)
+        && (p_vout->i_screen_depth == 8) )
+    {
+        /* FIXME: clear flags ?? */
+    }
+
+    /*
+     * Size change
+     */
+    if( p_vout->i_changes & VOUT_SIZE_CHANGE )
+    {
+        intf_DbgMsg( "vout info: resizing window" );
+        p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
+
+        /* Resize window */
+        XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                       p_vout->i_width, p_vout->i_height );
+
+        /* Destroy XImages to change their size */
+        vout_End( p_vout );
+
+        /* Recreate XImages. If SysInit failed, the thread can't go on. */
+        if( vout_Init( p_vout ) )
+        {
+            intf_ErrMsg( "vout error: cannot resize display" );
+            return( 1 );
+       }
+
+        /* Tell the video output thread that it will need to rebuild YUV
+         * tables. This is needed since conversion buffer size may have
+         * changed */
+        p_vout->i_changes |= VOUT_YUV_CHANGE;
+        intf_Msg( "vout: video display resized (%dx%d)",
+                  p_vout->i_width, p_vout->i_height);
+    }
+#else
+    /*
+     * Size change
+     */
+    if( p_vout->i_changes & VOUT_SIZE_CHANGE )
+    {
+        p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
+
+        p_vout->i_width = p_vout->p_sys->i_window_width;
+        p_vout->i_height = p_vout->p_sys->i_window_height;
+
+        intf_WarnMsg( 3, "vout: video display resized (%dx%d)",
+                      p_vout->i_width, p_vout->i_height );
+    }
+#endif
+
+    /* Autohide Cursour */
+    if( mdate() - p_vout->p_sys->i_time_mouse_last_moved > 2000000 )
+    {
+        /* Hide the mouse automatically */
+        if( p_vout->p_sys->b_mouse_pointer_visible )
+        {
+            _M( XCommonToggleMousePointer ) ( p_vout ); 
+        }
+    }
+
+    return 0;
+}
+
+/*****************************************************************************
+ * XCommonCreateWindow: open and set-up X11 main window
+ *****************************************************************************/
+int _M( XCommonCreateWindow ) ( vout_thread_t *p_vout )
+{
+    XSizeHints              xsize_hints;
+    XSetWindowAttributes    xwindow_attributes;
+    XGCValues               xgcvalues;
+    XEvent                  xevent;
+    Atom                    prop;
+    mwmhints_t              mwmhints;
+
+    boolean_t               b_expose;
+    boolean_t               b_configure_notify;
+    boolean_t               b_map_notify;
+
+    /* If we're full screen, we're full screen! */
+    if( p_vout->b_fullscreen ) 
+    {
+        p_vout->p_sys->i_window_width =
+           DisplayWidth( p_vout->p_sys->p_display, p_vout->p_sys->i_screen );
+        p_vout->p_sys->i_window_height =
+           DisplayHeight( p_vout->p_sys->p_display, p_vout->p_sys->i_screen ); 
+    }
+    else
+    {
+        /* Set main window's size */
+        p_vout->p_sys->i_window_width = p_vout->i_width;
+        p_vout->p_sys->i_window_height = p_vout->i_height;
+    }
+
+    /* Prepare window manager hints and properties */
+    xsize_hints.base_width          = p_vout->p_sys->i_window_width;
+    xsize_hints.base_height         = p_vout->p_sys->i_window_height;
+    xsize_hints.flags               = PSize;
+    p_vout->p_sys->wm_protocols     = XInternAtom( p_vout->p_sys->p_display,
+                                                   "WM_PROTOCOLS", True );
+    p_vout->p_sys->wm_delete_window = XInternAtom( p_vout->p_sys->p_display,
+                                                   "WM_DELETE_WINDOW", True );
+
+    /* Prepare window attributes */
+    xwindow_attributes.backing_store = Always;       /* save the hidden part */
+    xwindow_attributes.background_pixel = BlackPixel( p_vout->p_sys->p_display,
+                                                      p_vout->p_sys->i_screen );
+    xwindow_attributes.event_mask = ExposureMask | StructureNotifyMask;
+    
+
+    /* Create the window and set hints - the window must receive ConfigureNotify
+     * events, and, until it is displayed, Expose and MapNotify events. */
+
+    p_vout->p_sys->window =
+        XCreateWindow( p_vout->p_sys->p_display,
+                       DefaultRootWindow( p_vout->p_sys->p_display ),
+                       0, 0,
+                       p_vout->p_sys->i_window_width,
+                       p_vout->p_sys->i_window_height,
+#ifdef MODULE_NAME_IS_x11
+                       /* XXX - what's this ? */
+                       0,
+#else
+                       1,
+#endif
+                       0, InputOutput, 0,
+                       CWBackingStore | CWBackPixel | CWEventMask,
+                       &xwindow_attributes );
+
+    if ( p_vout->b_fullscreen )
+    {
+        prop = XInternAtom(p_vout->p_sys->p_display, "_MOTIF_WM_HINTS", False);
+        mwmhints.flags = MWM_HINTS_DECORATIONS;
+        mwmhints.decorations = 0;
+        XChangeProperty( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                         prop, prop, 32, PropModeReplace,
+                         (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS );
+
+        XSetTransientForHint( p_vout->p_sys->p_display,
+                              p_vout->p_sys->window, None );
+        XRaiseWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
+    }
+
+    /* Set window manager hints and properties: size hints, command,
+     * window's name, and accepted protocols */
+    XSetWMNormalHints( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                       &xsize_hints );
+    XSetCommand( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                 p_main->ppsz_argv, p_main->i_argc );
+    XStoreName( p_vout->p_sys->p_display, p_vout->p_sys->window,
+#ifdef MODULE_NAME_IS_x11
+                VOUT_TITLE " (X11 output)"
+#else
+                VOUT_TITLE " (XVideo output)"
+#endif
+              );
+
+    if( (p_vout->p_sys->wm_protocols == None)        /* use WM_DELETE_WINDOW */
+        || (p_vout->p_sys->wm_delete_window == None)
+        || !XSetWMProtocols( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                             &p_vout->p_sys->wm_delete_window, 1 ) )
+    {
+        /* WM_DELETE_WINDOW is not supported by window manager */
+        intf_Msg( "vout error: missing or bad window manager" );
+    }
+
+    /* Creation of a graphic context that doesn't generate a GraphicsExpose
+     * event when using functions like XCopyArea */
+    xgcvalues.graphics_exposures = False;
+    p_vout->p_sys->gc = XCreateGC( p_vout->p_sys->p_display,
+                                   p_vout->p_sys->window,
+                                   GCGraphicsExposures, &xgcvalues);
+
+    /* Send orders to server, and wait until window is displayed - three
+     * events must be received: a MapNotify event, an Expose event allowing
+     * drawing in the window, and a ConfigureNotify to get the window
+     * dimensions. Once those events have been received, only ConfigureNotify
+     * events need to be received. */
+    b_expose = 0;
+    b_configure_notify = 0;
+    b_map_notify = 0;
+    XMapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window);
+    do
+    {
+        XNextEvent( p_vout->p_sys->p_display, &xevent);
+        if( (xevent.type == Expose)
+            && (xevent.xexpose.window == p_vout->p_sys->window) )
+        {
+            b_expose = 1;
+        }
+        else if( (xevent.type == MapNotify)
+                 && (xevent.xmap.window == p_vout->p_sys->window) )
+        {
+            b_map_notify = 1;
+        }
+        else if( (xevent.type == ConfigureNotify)
+                 && (xevent.xconfigure.window == p_vout->p_sys->window) )
+        {
+            b_configure_notify = 1;
+            p_vout->p_sys->i_window_width = xevent.xconfigure.width;
+            p_vout->p_sys->i_window_height = xevent.xconfigure.height;
+        }
+    } while( !( b_expose && b_configure_notify && b_map_notify ) );
+
+    XSelectInput( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                  StructureNotifyMask | KeyPressMask |
+                  ButtonPressMask | ButtonReleaseMask | 
+                  PointerMotionMask );
+
+    if( p_vout->b_fullscreen )
+    {
+        XSetInputFocus( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                        RevertToNone, CurrentTime );
+        XMoveWindow( p_vout->p_sys->p_display, p_vout->p_sys->window, 0, 0 );
+    }
+
+#ifdef MODULE_NAME_IS_x11
+    if( XDefaultDepth(p_vout->p_sys->p_display, p_vout->p_sys->i_screen) == 8 )
+    {
+        /* Allocate a new palette */
+        p_vout->p_sys->colormap =
+            XCreateColormap( p_vout->p_sys->p_display,
+                             DefaultRootWindow( p_vout->p_sys->p_display ),
+                             DefaultVisual( p_vout->p_sys->p_display,
+                                            p_vout->p_sys->i_screen ),
+                             AllocAll );
+
+        xwindow_attributes.colormap = p_vout->p_sys->colormap;
+        XChangeWindowAttributes( p_vout->p_sys->p_display,
+                                 p_vout->p_sys->window,
+                                 CWColormap, &xwindow_attributes );
+    }
+
+#else
+    /* Create YUV output sub-window. */
+    p_vout->p_sys->yuv_window=XCreateSimpleWindow( p_vout->p_sys->p_display,
+                         p_vout->p_sys->window, 0, 0, 1, 1, 0,
+                         BlackPixel( p_vout->p_sys->p_display,
+                                         p_vout->p_sys->i_screen ),
+                         WhitePixel( p_vout->p_sys->p_display,
+                                         p_vout->p_sys->i_screen ) );
+
+    p_vout->p_sys->yuv_gc = XCreateGC( p_vout->p_sys->p_display,
+                                       p_vout->p_sys->yuv_window,
+                                       GCGraphicsExposures, &xgcvalues );
+    
+    XSetWindowBackground( p_vout->p_sys->p_display, p_vout->p_sys->yuv_window,
+             BlackPixel(p_vout->p_sys->p_display, p_vout->p_sys->i_screen ) );
+    
+    XMapWindow( p_vout->p_sys->p_display, p_vout->p_sys->yuv_window );
+    XSelectInput( p_vout->p_sys->p_display, p_vout->p_sys->yuv_window,
+                  ExposureMask );
+#endif
+
+    /* If the cursor was formerly blank than blank it again */
+    if( !p_vout->p_sys->b_mouse_pointer_visible )
+    {
+        _M( XCommonToggleMousePointer ) ( p_vout );
+        _M( XCommonToggleMousePointer ) ( p_vout );
+    }
+
+    XSync( p_vout->p_sys->p_display, False );
+
+    /* At this stage, the window is open, displayed, and ready to
+     * receive data */
+
+    return( 0 );
+}
+
+void _M( XCommonDestroyWindow ) ( vout_thread_t *p_vout )
+{
+    XSync( p_vout->p_sys->p_display, False );
+
+#ifdef MODULE_NAME_IS_xvideo
+    XFreeGC( p_vout->p_sys->p_display, p_vout->p_sys->yuv_gc );
+    XDestroyWindow( p_vout->p_sys->p_display, p_vout->p_sys->yuv_window );
+#endif
+
+    XUnmapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
+    XFreeGC( p_vout->p_sys->p_display, p_vout->p_sys->gc );
+    XDestroyWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
+}
+
+/*****************************************************************************
+ * XCommonEnableScreenSaver: enable screen saver
+ *****************************************************************************
+ * This function enable the screen saver on a display after it had been
+ * disabled by XDisableScreenSaver. Both functions use a counter mechanism to
+ * know wether the screen saver can be activated or not: if n successive calls
+ * are made to XDisableScreenSaver, n successive calls to XEnableScreenSaver
+ * will be required before the screen saver could effectively be activated.
+ *****************************************************************************/
+void _M( XCommonEnableScreenSaver ) ( vout_thread_t *p_vout )
+{
+    intf_DbgMsg( "vout: enabling screen saver" );
+    XSetScreenSaver( p_vout->p_sys->p_display, p_vout->p_sys->i_ss_timeout,
+                     p_vout->p_sys->i_ss_interval,
+                     p_vout->p_sys->i_ss_blanking,
+                     p_vout->p_sys->i_ss_exposure );
+}
+
+/*****************************************************************************
+ * XCommonDisableScreenSaver: disable screen saver
+ *****************************************************************************
+ * See XEnableScreenSaver
+ *****************************************************************************/
+void _M( XCommonDisableScreenSaver ) ( vout_thread_t *p_vout )
+{
+    /* Save screen saver informations */
+    XGetScreenSaver( p_vout->p_sys->p_display, &p_vout->p_sys->i_ss_timeout,
+                     &p_vout->p_sys->i_ss_interval,
+                     &p_vout->p_sys->i_ss_blanking,
+                     &p_vout->p_sys->i_ss_exposure );
+
+    /* Disable screen saver */
+    intf_DbgMsg( "vout: disabling screen saver" );
+    XSetScreenSaver( p_vout->p_sys->p_display, 0,
+                     p_vout->p_sys->i_ss_interval,
+                     p_vout->p_sys->i_ss_blanking,
+                     p_vout->p_sys->i_ss_exposure );
+
+#ifdef MODULE_NAME_IS_xvideo
+    DPMSDisable( p_vout->p_sys->p_display );
+#endif
+}
+
+/*****************************************************************************
+ * XCommonToggleMousePointer: hide or show the mouse pointer
+ *****************************************************************************
+ * This function hides the X pointer if it is visible by putting it at
+ * coordinates (32,32) and setting the pointer sprite to a blank one. To
+ * show it again, we disable the sprite and restore the original coordinates.
+ *****************************************************************************/
+void _M( XCommonToggleMousePointer ) ( vout_thread_t *p_vout )
+{
+    if( p_vout->p_sys->b_mouse_pointer_visible )
+    {
+        XDefineCursor( p_vout->p_sys->p_display,
+                       p_vout->p_sys->window,
+                       p_vout->p_sys->blank_cursor );
+        p_vout->p_sys->b_mouse_pointer_visible = 0;
+    }
+    else
+    {
+        XUndefineCursor( p_vout->p_sys->p_display, p_vout->p_sys->window );
+        p_vout->p_sys->b_mouse_pointer_visible = 1;
+    }
+}
+
diff --git a/plugins/x11/vout_common.h b/plugins/x11/vout_common.h
new file mode 100644 (file)
index 0000000..b15cf12
--- /dev/null
@@ -0,0 +1,124 @@
+/*****************************************************************************
+ * vout_xvideo.c: Xvideo video output display method
+ *****************************************************************************
+ * Copyright (C) 1998-2001 VideoLAN
+ * $Id: vout_common.h,v 1.1 2001/12/09 17:01:37 sam Exp $
+ *
+ * Authors: Shane Harper <shanegh@optusnet.com.au>
+ *          Vincent Seguin <seguin@via.ecp.fr>
+ *          Samuel Hocevar <sam@zoy.org>
+ *          David Kennedy <dkennedy@tinytoad.com>
+ *
+ * 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.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * vout_sys_t: video output method descriptor
+ *****************************************************************************
+ * This structure is part of the video output thread descriptor.
+ * It describes the X11 and XVideo specific properties of an output thread.
+ *****************************************************************************/
+typedef struct vout_sys_s
+{
+    /* User settings */
+#if 0
+    /* this plugin (currently) requires the SHM Ext... */
+    boolean_t           b_shm;               /* shared memory extension flag */
+#endif
+
+    /* Internal settings and properties */
+    Display *           p_display;                        /* display pointer */
+#if MODULE_NAME == xvideo
+    Visual *            p_visual;                          /* visual pointer */
+#endif
+    int                 i_screen;                           /* screen number */
+    Window              window;                               /* root window */
+    GC                  gc;              /* graphic context instance handler */
+#if MODULE_NAME == xvideo
+    Window              yuv_window;   /* sub-window for displaying yuv video
+                                                                        data */
+    GC                  yuv_gc;
+    int                 i_xvport;
+#else
+    Colormap            colormap;               /* colormap used (8bpp only) */
+
+    /* Display buffers and shared memory information */
+    XImage *            p_ximage[2];                       /* XImage pointer */
+    XShmSegmentInfo     shm_info[2];       /* shared memory zone information */
+#endif
+
+    /* X11 generic properties */
+    Atom                wm_protocols;
+    Atom                wm_delete_window;
+
+    int                 i_window_width;              /* width of main window */
+    int                 i_window_height;            /* height of main window */
+
+    /* Screen saver properties */
+    int                 i_ss_timeout;                             /* timeout */
+    int                 i_ss_interval;           /* interval between changes */
+    int                 i_ss_blanking;                      /* blanking mode */
+    int                 i_ss_exposure;                      /* exposure mode */
+
+    /* Mouse pointer properties */
+    boolean_t           b_mouse_pointer_visible;
+    mtime_t             i_time_mouse_last_moved; /* used to auto-hide pointer*/
+    Cursor              blank_cursor;                   /* the hidden cursor */
+    Pixmap              cursor_pixmap;
+
+} vout_sys_t;
+
+/*****************************************************************************
+ * picture_sys_t: direct buffer method descriptor
+ *****************************************************************************
+ * This structure is part of the picture descriptor, it describes the
+ * XVideo specific properties of a direct buffer.
+ *****************************************************************************/
+typedef struct picture_sys_s
+{
+    XvImage *           p_xvimage;
+    XShmSegmentInfo     shminfo;       /* shared memory zone information */
+
+} picture_sys_t;
+
+/*****************************************************************************
+ * mwmhints_t: window manager hints
+ *****************************************************************************
+ * Fullscreen needs to be able to hide the wm decorations so we provide
+ * this structure to make it easier.
+ *****************************************************************************/
+#define MWM_HINTS_DECORATIONS   (1L << 1)
+#define PROP_MWM_HINTS_ELEMENTS 5
+typedef struct mwmhints_s
+{
+    u32 flags;
+    u32 functions;
+    u32 decorations;
+    s32 input_mode;
+    u32 status;
+} mwmhints_t;
+
+/*****************************************************************************
+ * Common prototypes
+ *****************************************************************************/
+int  _M( vout_Manage )   ( struct vout_thread_s * );
+
+int  _M( XCommonCreateWindow )    ( vout_thread_t *p_vout );
+void _M( XCommonDestroyWindow )   ( vout_thread_t *p_vout );
+
+void _M( XCommonEnableScreenSaver )       ( vout_thread_t *p_vout );
+void _M( XCommonDisableScreenSaver )      ( vout_thread_t *p_vout );
+void _M( XCommonToggleMousePointer )      ( vout_thread_t *p_vout );
+
index af43f99b293a537f2ec0fe6adbf5b941283bbb81..59f156f1f60c0402bbba4691d02bcd31b3db2d85 100644 (file)
@@ -2,7 +2,7 @@
  * vout_x11.c: X11 video output display method
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: vout_x11.c,v 1.33 2001/12/07 18:33:08 sam Exp $
+ * $Id: vout_x11.c,v 1.34 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
 
 #include "video.h"
 #include "video_output.h"
+#include "vout_common.h"
 
 #include "interface.h"
-
 #include "netutils.h"                                 /* network_ChannelJoin */
 
 #include "modules.h"
 #include "modules_export.h"
 
-/*****************************************************************************
- * vout_sys_t: video output X11 method descriptor
- *****************************************************************************
- * This structure is part of the video output thread descriptor.
- * It describes the X11 specific properties of an output thread. X11 video
- * output is performed through regular resizable windows. Windows can be
- * dynamically resized to adapt to the size of the streams.
- *****************************************************************************/
-typedef struct vout_sys_s
-{
-    /* User settings */
-    boolean_t           b_shm;               /* shared memory extension flag */
-
-    /* Internal settings and properties */
-    Display *           p_display;                        /* display pointer */
-    Visual *            p_visual;                          /* visual pointer */
-    int                 i_screen;                           /* screen number */
-    Window              window;                               /* root window */
-    GC                  gc;              /* graphic context instance handler */
-    Colormap            colormap;               /* colormap used (8bpp only) */
-
-    /* Display buffers and shared memory information */
-    XImage *            p_ximage[2];                       /* XImage pointer */
-    XShmSegmentInfo     shm_info[2];       /* shared memory zone information */
-
-    /* X11 generic properties */
-    Atom                wm_protocols;
-    Atom                wm_delete_window;
-
-    int                 i_width;                     /* width of main window */
-    int                 i_height;                   /* height of main window */
-
-    /* Screen saver properties */
-    int                 i_ss_timeout;                             /* timeout */
-    int                 i_ss_interval;           /* interval between changes */
-    int                 i_ss_blanking;                      /* blanking mode */
-    int                 i_ss_exposure;                      /* exposure mode */
-
-    /* Mouse pointer properties */
-    mtime_t             i_lastmoved;                     /* Auto-hide cursor */
-    boolean_t           b_mouse_pointer_visible;
-    Cursor              blank_cursor;                   /* the hidden cursor */
-    Pixmap              cursor_pixmap;
-
-} vout_sys_t;
-
-/* Fullscreen needs to be able to hide the wm decorations */
-#define MWM_HINTS_DECORATIONS   (1L << 1)
-#define PROP_MWM_HINTS_ELEMENTS 5
-typedef struct mwmhints_s
-{
-    u32 flags;
-    u32 functions;
-    u32 decorations;
-    s32 input_mode;
-    u32 status;
-} mwmhints_t;
-
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
@@ -134,11 +76,9 @@ static int  vout_Create    ( struct vout_thread_s * );
 static int  vout_Init      ( struct vout_thread_s * );
 static void vout_End       ( struct vout_thread_s * );
 static void vout_Destroy   ( struct vout_thread_s * );
-static int  vout_Manage    ( struct vout_thread_s * );
 static void vout_Display   ( struct vout_thread_s * );
 static void vout_SetPalette( struct vout_thread_s *, u16*, u16*, u16*, u16* );
 
-static int  X11CreateWindow     ( vout_thread_t *p_vout );
 static int  X11InitDisplay      ( vout_thread_t *p_vout, char *psz_display );
 
 static int  X11CreateImage      ( vout_thread_t *p_vout, XImage **pp_ximage );
@@ -148,10 +88,6 @@ static int  X11CreateShmImage   ( vout_thread_t *p_vout, XImage **pp_ximage,
 static void X11DestroyShmImage  ( vout_thread_t *p_vout, XImage *p_ximage,
                                   XShmSegmentInfo *p_shm_info );
 
-static void X11ToggleMousePointer       ( vout_thread_t *p_vout );
-static void X11EnableScreenSaver        ( vout_thread_t *p_vout );
-static void X11DisableScreenSaver       ( vout_thread_t *p_vout );
-
 /*****************************************************************************
  * Functions exported as capabilities. They are declared as static so that
  * we don't pollute the namespace too much.
@@ -163,7 +99,7 @@ void _M( vout_getfunctions )( function_list_t * p_function_list )
     p_function_list->functions.vout.pf_init       = vout_Init;
     p_function_list->functions.vout.pf_end        = vout_End;
     p_function_list->functions.vout.pf_destroy    = vout_Destroy;
-    p_function_list->functions.vout.pf_manage     = vout_Manage;
+    p_function_list->functions.vout.pf_manage     = _M( vout_Manage );
     p_function_list->functions.vout.pf_display    = vout_Display;
     p_function_list->functions.vout.pf_setpalette = vout_SetPalette;
 }
@@ -216,13 +152,10 @@ static int vout_Create( vout_thread_t *p_vout )
     }
     p_vout->p_sys->i_screen = DefaultScreen( p_vout->p_sys->p_display );
 
-    p_vout->b_fullscreen
-        = main_GetIntVariable( VOUT_FULLSCREEN_VAR, VOUT_FULLSCREEN_DEFAULT );
-
     /* Spawn base window - this window will include the video output window,
      * but also command buttons, subtitles and other indicators */
 
-    if( X11CreateWindow( p_vout ) )
+    if( _M( XCommonCreateWindow ) ( p_vout ) )
     {
         intf_ErrMsg( "vout error: cannot create X11 window" );
         XCloseDisplay( p_vout->p_sys->p_display );
@@ -267,7 +200,7 @@ static int vout_Create( vout_thread_t *p_vout )
                                       &cursor_color, 1, 1 );    
 
     /* Disable screen saver and return */
-    X11DisableScreenSaver( p_vout );
+    _M( XCommonDisableScreenSaver ) ( p_vout );
 
     return( 0 );
 }
@@ -373,11 +306,13 @@ static void vout_End( vout_thread_t *p_vout )
 static void vout_Destroy( vout_thread_t *p_vout )
 {
     /* Enable screen saver */
-    X11EnableScreenSaver( p_vout );
+    _M( XCommonEnableScreenSaver ) ( p_vout );
 
     /* Restore cursor if it was blanked */
     if( !p_vout->p_sys->b_mouse_pointer_visible )
-        X11ToggleMousePointer( p_vout );
+    {
+        _M( XCommonToggleMousePointer ) ( p_vout );
+    }
 
     /* Destroy blank cursor pixmap */
     XFreePixmap( p_vout->p_sys->p_display, p_vout->p_sys->cursor_pixmap );
@@ -399,302 +334,6 @@ static void vout_Destroy( vout_thread_t *p_vout )
     free( p_vout->p_sys );
 }
 
-/*****************************************************************************
- * vout_Manage: handle X11 events
- *****************************************************************************
- * This function should be called regularly by video output thread. It manages
- * X11 events and allows window resizing. It returns a non null value on
- * error.
- *****************************************************************************/
-static int vout_Manage( vout_thread_t *p_vout )
-{
-    XEvent      xevent;                                         /* X11 event */
-    boolean_t   b_resized;                        /* window has been resized */
-    char        i_key;                                    /* ISO Latin-1 key */
-    KeySym      x_key_symbol;
-
-    /* Handle X11 events: ConfigureNotify events are parsed to know if the
-     * output window's size changed, MapNotify and UnmapNotify to know if the
-     * window is mapped (and if the display is useful), and ClientMessages
-     * to intercept window destruction requests */
-
-    b_resized = 0;
-    while( XCheckWindowEvent( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                              StructureNotifyMask | KeyPressMask |
-                              ButtonPressMask | ButtonReleaseMask | 
-                              PointerMotionMask | Button1MotionMask , &xevent )
-           == True )
-    {
-        /* ConfigureNotify event: prepare  */
-        if( (xevent.type == ConfigureNotify)
-            && ((xevent.xconfigure.width != p_vout->p_sys->i_width)
-                || (xevent.xconfigure.height != p_vout->p_sys->i_height)) )
-        {
-            /* Update dimensions */
-            b_resized = 1;
-            p_vout->p_sys->i_width = xevent.xconfigure.width;
-            p_vout->p_sys->i_height = xevent.xconfigure.height;
-        }
-        /* MapNotify event: change window status and disable screen saver */
-        else if( xevent.type == MapNotify)
-        {
-            if( (p_vout != NULL) && !p_vout->b_active )
-            {
-                X11DisableScreenSaver( p_vout );
-                p_vout->b_active = 1;
-            }
-        }
-        /* UnmapNotify event: change window status and enable screen saver */
-        else if( xevent.type == UnmapNotify )
-        {
-            if( (p_vout != NULL) && p_vout->b_active )
-            {
-                X11EnableScreenSaver( p_vout );
-                p_vout->b_active = 0;
-            }
-        }
-        /* Keyboard event */
-        else if( xevent.type == KeyPress )
-        {
-            /* We may have keys like F1 trough F12, ESC ... */
-            x_key_symbol = XKeycodeToKeysym( p_vout->p_sys->p_display,
-                                             xevent.xkey.keycode, 0 );
-            switch( x_key_symbol )
-            {
-                 case XK_Escape:
-                     p_main->p_intf->b_die = 1;
-                     break;
-                 case XK_Menu:
-                     p_main->p_intf->b_menu_change = 1;
-                     break;
-                 default:
-                     /* "Normal Keys"
-                      * The reason why I use this instead of XK_0 is that 
-                      * with XLookupString, we don't have to care about
-                      * keymaps. */
-
-                    if( XLookupString( &xevent.xkey, &i_key, 1, NULL, NULL ) )
-                    {
-                        /* FIXME: handle stuff here */
-                        switch( i_key )
-                        {
-                        case 'q':
-                        case 'Q':
-                            p_main->p_intf->b_die = 1;
-                            break;
-                        case 'f':
-                        case 'F':
-                            p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
-                            break;
-                        case '0':
-                            network_ChannelJoin( 0 );
-                            break;
-                        case '1':
-                            network_ChannelJoin( 1 );
-                            break;
-                        case '2':
-                            network_ChannelJoin( 2 );
-                            break;
-                        case '3':
-                            network_ChannelJoin( 3 );
-                            break;
-                        case '4':
-                            network_ChannelJoin( 4 );
-                            break;
-                        case '5':
-                            network_ChannelJoin( 5 );
-                            break;
-                        case '6':
-                            network_ChannelJoin( 6 );
-                            break;
-                        case '7':
-                            network_ChannelJoin( 7 );
-                            break;
-                        case '8':
-                            network_ChannelJoin( 8 );
-                            break;
-                        case '9':
-                            network_ChannelJoin( 9 );
-                            break;
-                        default:
-                            if( intf_ProcessKey( p_main->p_intf, 
-                                                 (char )i_key ) )
-                            {
-                               intf_DbgMsg( "vout: unhandled key '%c' (%i)", 
-                                            (char)i_key, i_key );
-                            }
-                            break;
-                        }
-                    }
-                break;
-            }
-        }
-        /* Mouse click */
-        else if( xevent.type == ButtonPress )
-        {
-            switch( ((XButtonEvent *)&xevent)->button )
-            {
-                case Button1:
-                    /* in this part we will eventually manage
-                     * clicks for DVD navigation for instance */
-                    break;
-            }
-        }
-        /* Mouse release */
-        else if( xevent.type == ButtonRelease )
-        {
-            switch( ((XButtonEvent *)&xevent)->button )
-            {
-                case Button3:
-                    /* FIXME: need locking ! */
-                    p_main->p_intf->b_menu_change = 1;
-                    break;
-            }
-        }
-        /* Mouse move */
-        else if( xevent.type == MotionNotify )
-        {
-            p_vout->p_sys->i_lastmoved = mdate();
-            if( ! p_vout->p_sys->b_mouse_pointer_visible )
-            {
-                X11ToggleMousePointer( p_vout ); 
-            }
-        }
-        /* Other event */
-        else
-        {
-            intf_WarnMsg( 3, "vout: unhandled event %d received", xevent.type );
-        }
-    }
-
-    /* ClientMessage event - only WM_PROTOCOLS with WM_DELETE_WINDOW data
-     * are handled - according to the man pages, the format is always 32
-     * in this case */
-    while( XCheckTypedEvent( p_vout->p_sys->p_display,
-                             ClientMessage, &xevent ) )
-    {
-        if( (xevent.xclient.message_type == p_vout->p_sys->wm_protocols)
-            && (xevent.xclient.data.l[0] == p_vout->p_sys->wm_delete_window ) )
-        {
-            p_main->p_intf->b_die = 1;
-        }
-        else
-        {
-            intf_DbgMsg( "vout: unhandled ClientMessage received" );
-        }
-    }
-
-    if ( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
-    {
-        char *psz_display;
-        /* Open display, unsing 'vlc_display' or the DISPLAY
-         * environment variable */
-        psz_display = XDisplayName( main_GetPszVariable( VOUT_DISPLAY_VAR, NULL ) );
-
-        intf_DbgMsg( "vout: changing full-screen status" );
-
-        p_vout->b_fullscreen = !p_vout->b_fullscreen;
-        p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
-
-        /* Get rid of the old window */
-        XUnmapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
-        XFreeGC( p_vout->p_sys->p_display, p_vout->p_sys->gc );
-
-        /* And create a new one */
-        if( X11CreateWindow( p_vout ) )
-        {
-            intf_ErrMsg( "vout error: cannot create X11 window" );
-            XCloseDisplay( p_vout->p_sys->p_display );
-
-            free( p_vout->p_sys );
-            return( 1 );
-        }
-
-        if( X11InitDisplay( p_vout, psz_display ) )
-        {
-            intf_ErrMsg( "vout error: cannot initialize X11 display" );
-            XCloseDisplay( p_vout->p_sys->p_display );
-            free( p_vout->p_sys );
-            return( 1 );
-        }
-        /* We've changed the size, update it */
-        p_vout->i_changes |= VOUT_SIZE_CHANGE;
-    }
-
-    /*
-     * Handle vout window resizing
-     */
-    if( b_resized )
-    {
-        /* If interface window has been resized, change vout size */
-        intf_DbgMsg( "vout: resizing output window" );
-        p_vout->i_width =  p_vout->p_sys->i_width;
-        p_vout->i_height = p_vout->p_sys->i_height;
-        p_vout->i_changes |= VOUT_SIZE_CHANGE;
-    }
-    else if( (p_vout->i_width  != p_vout->p_sys->i_width) ||
-             (p_vout->i_height != p_vout->p_sys->i_height) )
-    {
-        /* If video output size has changed, change interface window size */
-        intf_DbgMsg( "vout: resizing output window" );
-        p_vout->p_sys->i_width =    p_vout->i_width;
-        p_vout->p_sys->i_height =   p_vout->i_height;
-        XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                       p_vout->p_sys->i_width, p_vout->p_sys->i_height );
-    }
-    /*
-     * Color/Grayscale or gamma change: in 8bpp, just change the colormap
-     */
-    if( (p_vout->i_changes & VOUT_GRAYSCALE_CHANGE)
-        && (p_vout->i_screen_depth == 8) )
-    {
-        /* FIXME: clear flags ?? */
-    }
-
-    /*
-     * Size change
-     */
-    if( p_vout->i_changes & VOUT_SIZE_CHANGE )
-    {
-        intf_DbgMsg( "vout info: resizing window" );
-        p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
-
-        /* Resize window */
-        XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                       p_vout->i_width, p_vout->i_height );
-
-        /* Destroy XImages to change their size */
-        vout_End( p_vout );
-
-        /* Recreate XImages. If SysInit failed, the thread can't go on. */
-        if( vout_Init( p_vout ) )
-        {
-            intf_ErrMsg( "vout error: cannot resize display" );
-            return( 1 );
-       }
-
-        /* Tell the video output thread that it will need to rebuild YUV
-         * tables. This is needed since conversion buffer size may have
-         * changed */
-        p_vout->i_changes |= VOUT_YUV_CHANGE;
-        intf_Msg( "vout: video display resized (%dx%d)",
-                  p_vout->i_width, p_vout->i_height);
-    }
-
-    /* Autohide Cursour */
-    if( mdate() - p_vout->p_sys->i_lastmoved > 2000000 )
-    {
-        /* Hide the mouse automatically */
-        if( p_vout->p_sys->b_mouse_pointer_visible )
-        {
-            X11ToggleMousePointer( p_vout ); 
-        }
-    }
-
-    
-    return 0;
-}
-
 /*****************************************************************************
  * vout_Display: displays previously rendered output
  *****************************************************************************
@@ -762,171 +401,6 @@ static void vout_SetPalette( p_vout_thread_t p_vout,
 
 /* following functions are local */
 
-/*****************************************************************************
- * X11CreateWindow: open and set-up X11 main window
- *****************************************************************************/
-static int X11CreateWindow( vout_thread_t *p_vout )
-{
-    XSizeHints              xsize_hints;
-    XSetWindowAttributes    xwindow_attributes;
-    XGCValues               xgcvalues;
-    XEvent                  xevent;
-    Atom                    prop;
-    mwmhints_t              mwmhints;
-
-    boolean_t               b_expose;
-    boolean_t               b_configure_notify;
-    boolean_t               b_map_notify;
-
-    /* If we're full screen, we're full screen! */
-    if( p_vout->b_fullscreen ) 
-    {
-        p_vout->p_sys->i_width = DisplayWidth( p_vout->p_sys->p_display, 
-                                               p_vout->p_sys->i_screen );
-        p_vout->p_sys->i_height =  DisplayHeight( p_vout->p_sys->p_display, 
-                                                  p_vout->p_sys->i_screen ); 
-        p_vout->i_width =  p_vout->p_sys->i_width;
-        p_vout->i_height = p_vout->p_sys->i_height;
-    }
-    else
-    {
-        /* Set main window's size */
-        p_vout->p_sys->i_width = p_vout->i_width;
-        p_vout->p_sys->i_height = p_vout->i_height;
-    }
-
-    /* Prepare window manager hints and properties */
-    xsize_hints.base_width          = p_vout->p_sys->i_width;
-    xsize_hints.base_height         = p_vout->p_sys->i_height;
-    xsize_hints.flags               = PSize;
-    p_vout->p_sys->wm_protocols     = XInternAtom( p_vout->p_sys->p_display,
-                                                   "WM_PROTOCOLS", True );
-    p_vout->p_sys->wm_delete_window = XInternAtom( p_vout->p_sys->p_display,
-                                                   "WM_DELETE_WINDOW", True );
-
-    /* Prepare window attributes */
-    xwindow_attributes.backing_store = Always;       /* save the hidden part */
-    xwindow_attributes.background_pixel = BlackPixel( p_vout->p_sys->p_display,
-                                                      p_vout->p_sys->i_screen );
-    xwindow_attributes.event_mask = ExposureMask | StructureNotifyMask;
-    
-
-    /* Create the window and set hints - the window must receive ConfigureNotify
-     * events, and, until it is displayed, Expose and MapNotify events. */
-
-    p_vout->p_sys->window =
-        XCreateWindow( p_vout->p_sys->p_display,
-                       DefaultRootWindow( p_vout->p_sys->p_display ),
-                       0, 0,
-                       p_vout->p_sys->i_width, p_vout->p_sys->i_height, 0,
-                       0, InputOutput, 0,
-                       CWBackingStore | CWBackPixel | CWEventMask,
-                       &xwindow_attributes );
-
-    if ( p_vout->b_fullscreen )
-    {
-        prop = XInternAtom(p_vout->p_sys->p_display, "_MOTIF_WM_HINTS", False);
-        mwmhints.flags = MWM_HINTS_DECORATIONS;
-        mwmhints.decorations = 0;
-        XChangeProperty( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                         prop, prop, 32, PropModeReplace,
-                         (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS );
-
-        XSetTransientForHint( p_vout->p_sys->p_display,
-                              p_vout->p_sys->window, None );
-        XRaiseWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
-    }
-
-    /* Set window manager hints and properties: size hints, command,
-     * window's name, and accepted protocols */
-    XSetWMNormalHints( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                       &xsize_hints );
-    XSetCommand( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                 p_main->ppsz_argv, p_main->i_argc );
-    XStoreName( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                VOUT_TITLE " (X11 output)" );
-
-    if( (p_vout->p_sys->wm_protocols == None)        /* use WM_DELETE_WINDOW */
-        || (p_vout->p_sys->wm_delete_window == None)
-        || !XSetWMProtocols( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                             &p_vout->p_sys->wm_delete_window, 1 ) )
-    {
-        /* WM_DELETE_WINDOW is not supported by window manager */
-        intf_Msg( "vout error: missing or bad window manager" );
-    }
-
-    /* Creation of a graphic context that doesn't generate a GraphicsExpose
-     * event when using functions like XCopyArea */
-    xgcvalues.graphics_exposures = False;
-    p_vout->p_sys->gc = XCreateGC( p_vout->p_sys->p_display,
-                                   p_vout->p_sys->window,
-                                   GCGraphicsExposures, &xgcvalues);
-
-    /* Send orders to server, and wait until window is displayed - three
-     * events must be received: a MapNotify event, an Expose event allowing
-     * drawing in the window, and a ConfigureNotify to get the window
-     * dimensions. Once those events have been received, only ConfigureNotify
-     * events need to be received. */
-    b_expose = 0;
-    b_configure_notify = 0;
-    b_map_notify = 0;
-    XMapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window);
-    do
-    {
-        XNextEvent( p_vout->p_sys->p_display, &xevent);
-        if( (xevent.type == Expose)
-            && (xevent.xexpose.window == p_vout->p_sys->window) )
-        {
-            b_expose = 1;
-        }
-        else if( (xevent.type == MapNotify)
-                 && (xevent.xmap.window == p_vout->p_sys->window) )
-        {
-            b_map_notify = 1;
-        }
-        else if( (xevent.type == ConfigureNotify)
-                 && (xevent.xconfigure.window == p_vout->p_sys->window) )
-        {
-            b_configure_notify = 1;
-            p_vout->p_sys->i_width = xevent.xconfigure.width;
-            p_vout->p_sys->i_height = xevent.xconfigure.height;
-        }
-    } while( !( b_expose && b_configure_notify && b_map_notify ) );
-
-    XSelectInput( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                  StructureNotifyMask | KeyPressMask |
-                  ButtonPressMask | ButtonReleaseMask | 
-                  PointerMotionMask );
-
-    if( XDefaultDepth(p_vout->p_sys->p_display, p_vout->p_sys->i_screen) == 8 )
-    {
-        /* Allocate a new palette */
-        p_vout->p_sys->colormap =
-            XCreateColormap( p_vout->p_sys->p_display,
-                             DefaultRootWindow( p_vout->p_sys->p_display ),
-                             DefaultVisual( p_vout->p_sys->p_display,
-                                            p_vout->p_sys->i_screen ),
-                             AllocAll );
-
-        xwindow_attributes.colormap = p_vout->p_sys->colormap;
-        XChangeWindowAttributes( p_vout->p_sys->p_display,
-                                 p_vout->p_sys->window,
-                                 CWColormap, &xwindow_attributes );
-    }
-
-    if( p_vout->b_fullscreen )
-    {
-        XSetInputFocus( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                        RevertToNone, CurrentTime );
-        XMoveWindow( p_vout->p_sys->p_display, p_vout->p_sys->window, 0, 0 );
-    }
-
-    /* At this stage, the window is open, displayed, and ready to
-     * receive data */
-
-    return( 0 );
-}
-
 /*****************************************************************************
  * X11InitDisplay: open and initialize X11 device
  *****************************************************************************
@@ -1185,69 +659,3 @@ static void X11DestroyShmImage( vout_thread_t *p_vout, XImage *p_ximage,
     }
 }
 
-
-/* WAZAAAAAAAAAAA */
-
-/*****************************************************************************
- * X11EnableScreenSaver: enable screen saver
- *****************************************************************************
- * This function enable the screen saver on a display after it had been
- * disabled by XDisableScreenSaver. Both functions use a counter mechanism to
- * know wether the screen saver can be activated or not: if n successive calls
- * are made to XDisableScreenSaver, n successive calls to XEnableScreenSaver
- * will be required before the screen saver could effectively be activated.
- *****************************************************************************/
-void X11EnableScreenSaver( vout_thread_t *p_vout )
-{
-    intf_DbgMsg( "vout: enabling screen saver" );
-    XSetScreenSaver( p_vout->p_sys->p_display, p_vout->p_sys->i_ss_timeout,
-                     p_vout->p_sys->i_ss_interval,
-                     p_vout->p_sys->i_ss_blanking,
-                     p_vout->p_sys->i_ss_exposure );
-}
-
-/*****************************************************************************
- * X11DisableScreenSaver: disable screen saver
- *****************************************************************************
- * See XEnableScreenSaver
- *****************************************************************************/
-void X11DisableScreenSaver( vout_thread_t *p_vout )
-{
-    /* Save screen saver informations */
-    XGetScreenSaver( p_vout->p_sys->p_display, &p_vout->p_sys->i_ss_timeout,
-                     &p_vout->p_sys->i_ss_interval,
-                     &p_vout->p_sys->i_ss_blanking,
-                     &p_vout->p_sys->i_ss_exposure );
-
-    /* Disable screen saver */
-    intf_DbgMsg( "vout: disabling screen saver" );
-    XSetScreenSaver( p_vout->p_sys->p_display, 0,
-                     p_vout->p_sys->i_ss_interval,
-                     p_vout->p_sys->i_ss_blanking,
-                     p_vout->p_sys->i_ss_exposure );
-}
-
-/*****************************************************************************
- * X11ToggleMousePointer: hide or show the mouse pointer
- *****************************************************************************
- * This function hides the X pointer if it is visible by putting it at
- * coordinates (32,32) and setting the pointer sprite to a blank one. To
- * show it again, we disable the sprite and restore the original coordinates.
- *****************************************************************************/
-void X11ToggleMousePointer( vout_thread_t *p_vout )
-{
-    if( p_vout->p_sys->b_mouse_pointer_visible )
-    {
-        p_vout->p_sys->b_mouse_pointer_visible = 0;
-
-        XDefineCursor( p_vout->p_sys->p_display,
-                       p_vout->p_sys->window, p_vout->p_sys->blank_cursor );
-    }
-    else
-    {
-        p_vout->p_sys->b_mouse_pointer_visible = 1;
-
-        XUndefineCursor( p_vout->p_sys->p_display, p_vout->p_sys->window );
-    }
-}
-
index a50612f20387d296b494a58274b2e4b2190346b0..08a9d4dab7090b92fc97694a6f13b4874a0d55c3 100644 (file)
@@ -2,7 +2,7 @@
  * vout_xvideo.c: Xvideo video output display method
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: vout_xvideo.c,v 1.36 2001/12/07 18:33:08 sam Exp $
+ * $Id: vout_xvideo.c,v 1.37 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Shane Harper <shanegh@optusnet.com.au>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -64,9 +64,9 @@
 
 #include "video.h"
 #include "video_output.h"
+#include "vout_common.h"
 
 #include "interface.h"
-
 #include "netutils.h"                                 /* network_ChannelJoin */
 
 #include "stream_control.h"                 /* needed by input_ext-intf.h... */
 #include "modules.h"
 #include "modules_export.h"
 
+#define XVIDEO_MAX_DIRECTBUFFERS 5
 #define GUID_YUV12_PLANAR 0x32315659
 
-
-/*****************************************************************************
- * vout_sys_t: video output X11 method descriptor
- *****************************************************************************
- * This structure is part of the video output thread descriptor.
- * It describes the XVideo specific properties of an output thread.
- *****************************************************************************/
-typedef struct vout_sys_s
-{
-    /* User settings */
-#if 0
-    /* this plugin (currently) requires the SHM Ext... */
-    boolean_t           b_shm;               /* shared memory extension flag */
-#endif
-
-    /* Internal settings and properties */
-    Display *           p_display;                        /* display pointer */
-    int                 i_screen;                           /* screen number */
-    Window              window;                               /* root window */
-    GC                  gc;              /* graphic context instance handler */
-    Window              yuv_window;   /* sub-window for displaying yuv video
-                                                                        data */
-    GC                  yuv_gc;
-    int                 xv_port;
-
-    /* Display buffers and shared memory information */
-    /* Note: only 1 buffer... Xv ext does double buffering. */
-    XvImage *           p_xvimage;
-    int                 i_image_width;
-    int                 i_image_height;
-                                /* i_image_width & i_image_height reflect the
-                                 * size of the XvImage. They are used by
-                                 * vout_Display() to check if the image to be
-                                 * displayed can use the current XvImage. */
-    XShmSegmentInfo     shm_info;       /* shared memory zone information */
-
-    /* X11 generic properties */
-    Atom                wm_protocols;
-    Atom                wm_delete_window;
-
-    int                 i_window_width;              /* width of main window */
-    int                 i_window_height;            /* height of main window */
-
-
-    /* Screen saver properties */
-    int                 i_ss_timeout;                             /* timeout */
-    int                 i_ss_interval;           /* interval between changes */
-    int                 i_ss_blanking;                      /* blanking mode */
-    int                 i_ss_exposure;                      /* exposure mode */
-    
-    /* Mouse pointer properties */
-    boolean_t           b_mouse_pointer_visible;
-    mtime_t             i_time_mouse_last_moved; /* used to auto-hide pointer*/
-    Cursor              blank_cursor;                   /* the hidden cursor */
-    Pixmap              cursor_pixmap;
-
-} vout_sys_t;
-
-/* Fullscreen needs to be able to hide the wm decorations */
-#define MWM_HINTS_DECORATIONS   (1L << 1)
-#define PROP_MWM_HINTS_ELEMENTS 5
-typedef struct mwmhints_s
-{
-    u32 flags;
-    u32 functions;
-    u32 decorations;
-    s32 input_mode;
-    u32 status;
-} mwmhints_t;
-
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
@@ -155,30 +86,20 @@ static int  vout_Create    ( vout_thread_t * );
 static int  vout_Init      ( vout_thread_t * );
 static void vout_End       ( vout_thread_t * );
 static void vout_Destroy   ( vout_thread_t * );
-static int  vout_Manage    ( vout_thread_t * );
-static void vout_Display   ( vout_thread_t * );
-static void vout_SetPalette( vout_thread_t *, u16 *, u16 *, u16 *, u16 * );
-
-static int  XVideoCreateWindow       ( vout_thread_t * );
-static void XVideoDestroyWindow      ( vout_thread_t *p_vout );
-static int  XVideoUpdateImgSizeIfRequired( vout_thread_t *p_vout );
-static int  XVideoCreateShmImage     ( Display* dpy, int xv_port,
-                                       XvImage **pp_xvimage,
-                                       XShmSegmentInfo *p_shm_info,
-                                       int i_width, int i_height );
-static void XVideoDestroyShmImage    ( vout_thread_t *, XvImage *,
-                                       XShmSegmentInfo * );
-static void X11ToggleMousePointer    ( vout_thread_t * );
-static void XVideoEnableScreenSaver  ( vout_thread_t * );
-static void XVideoDisableScreenSaver ( vout_thread_t * );
-/*static void XVideoSetAttribute       ( vout_thread_t *, char *, float );*/
+static void vout_Display   ( vout_thread_t *, picture_t * );
+
+static int  XVideoNewPicture   ( vout_thread_t *, picture_t * );
+
+static XvImage *CreateShmImage ( Display *, int, XShmSegmentInfo *, int, int );
+static void     DestroyShmImage( Display *, XvImage *, XShmSegmentInfo * );
 
-static int  XVideoCheckForXv         ( Display * );
-static int  XVideoGetPort            ( Display * );
-static void XVideoOutputCoords       ( const picture_t *, const boolean_t,
-                                       const int, const int,
-                                       int *, int *, int *, int * );
-static void XVideoDisplay            ( vout_thread_t * );
+static int  CheckForXVideo     ( Display * );
+static int  GetXVideoPort      ( Display * );
+static void XVideoOutputCoords ( const picture_t *, const boolean_t,
+                                 const int, const int,
+                                 int *, int *, int *, int * );
+
+/*static void XVideoSetAttribute       ( vout_thread_t *, char *, float );*/
 
 /*****************************************************************************
  * Functions exported as capabilities. They are declared as static so that
@@ -191,9 +112,9 @@ void _M( vout_getfunctions )( function_list_t * p_function_list )
     p_function_list->functions.vout.pf_init       = vout_Init;
     p_function_list->functions.vout.pf_end        = vout_End;
     p_function_list->functions.vout.pf_destroy    = vout_Destroy;
-    p_function_list->functions.vout.pf_manage     = vout_Manage;
+    p_function_list->functions.vout.pf_manage     = _M( vout_Manage );
     p_function_list->functions.vout.pf_display    = vout_Display;
-    p_function_list->functions.vout.pf_setpalette = vout_SetPalette;
+    p_function_list->functions.vout.pf_setpalette = NULL;
 }
 
 /*****************************************************************************
@@ -217,14 +138,14 @@ static int vout_Probe( probedata_t *p_data )
         return( 0 );
     }
     
-    if( !XVideoCheckForXv( p_display ) )
+    if( !CheckForXVideo( p_display ) )
     {
         intf_WarnMsg( 3, "vout: Xvideo not supported" );
         XCloseDisplay( p_display );
         return( 0 );
     }
 
-    if( XVideoGetPort( p_display ) < 0 )
+    if( GetXVideoPort( p_display ) < 0 )
     {
         intf_WarnMsg( 3, "vout: Xvideo not supported" );
         XCloseDisplay( p_display );
@@ -245,7 +166,7 @@ static int vout_Probe( probedata_t *p_data )
 /*****************************************************************************
  * vout_Create: allocate XVideo video thread output method
  *****************************************************************************
- * This function allocate and initialize a XVideo vout method. It uses some of
+ * This function allocates and initialize a XVideo vout method. It uses some of
  * the vout properties to choose the window size, and change them according to
  * the actual properties of the display.
  *****************************************************************************/
@@ -274,10 +195,7 @@ static int vout_Create( vout_thread_t *p_vout )
     }
     p_vout->p_sys->i_screen = DefaultScreen( p_vout->p_sys->p_display );
 
-    p_vout->b_fullscreen
-        = main_GetIntVariable( VOUT_FULLSCREEN_VAR, VOUT_FULLSCREEN_DEFAULT );
-    
-    if( !XVideoCheckForXv( p_vout->p_sys->p_display ) )
+    if( !CheckForXVideo( p_vout->p_sys->p_display ) )
     {
         intf_ErrMsg( "vout error: no XVideo extension" );
         XCloseDisplay( p_vout->p_sys->p_display );
@@ -286,7 +204,7 @@ static int vout_Create( vout_thread_t *p_vout )
     }
 
     /* Check we have access to a video port */
-    if( (p_vout->p_sys->xv_port = XVideoGetPort(p_vout->p_sys->p_display)) <0 )
+    if( (p_vout->p_sys->i_xvport = GetXVideoPort(p_vout->p_sys->p_display)) <0 )
     {
         intf_ErrMsg( "vout error: cannot get XVideo port" );
         XCloseDisplay( p_vout->p_sys->p_display );
@@ -321,16 +239,15 @@ static int vout_Create( vout_thread_t *p_vout )
 
     /* Spawn base window - this window will include the video output window,
      * but also command buttons, subtitles and other indicators */
-    if( XVideoCreateWindow( p_vout ) )
+    if( _M( XCommonCreateWindow ) ( p_vout ) )
     {
-        intf_ErrMsg( "vout error: cannot create XVideo window" );
+        intf_ErrMsg( "vout error: no suitable Xvideo image input port" );
+        _M( XCommonDestroyWindow ) ( p_vout );
         XCloseDisplay( p_vout->p_sys->p_display );
         free( p_vout->p_sys );
         return( 1 );
     }
 
-    /* p_vout->pf_setbuffers( p_vout, NULL, NULL ); */
-
 #if 0
     /* XXX The brightness and contrast values should be read from environment
      * XXX variables... */
@@ -339,7 +256,7 @@ static int vout_Create( vout_thread_t *p_vout )
 #endif
 
     /* Disable screen saver and return */
-    XVideoDisableScreenSaver( p_vout );
+    _M( XCommonDisableScreenSaver ) ( p_vout );
 
     return( 0 );
 }
@@ -349,12 +266,33 @@ static int vout_Create( vout_thread_t *p_vout )
  *****************************************************************************/
 static int vout_Init( vout_thread_t *p_vout )
 {
-#ifdef SYS_DARWIN
-    /* FIXME : As of 2001-03-16, XFree4 for MacOS X does not support Xshm. */
-    p_vout->p_sys->b_shm = 0;
-#endif
-    p_vout->b_need_render = 0;
-    p_vout->p_sys->i_image_width = p_vout->p_sys->i_image_height = 0;
+    picture_t *p_pic;
+    int        i_index = 0;
+
+    /* Try to initialize up to XVIDEO_MAX_DIRECTBUFFERS direct buffers */
+    while( i_index < XVIDEO_MAX_DIRECTBUFFERS )
+    {
+        p_pic = &p_vout->p_picture[ i_index ];
+
+        if( XVideoNewPicture( p_vout, p_pic ) )
+        {
+            break;
+        }
+
+        p_pic->i_status        = DESTROYED_PICTURE;
+
+        p_pic->b_directbuffer  = 1;
+
+        p_pic->i_left_margin   =
+        p_pic->i_right_margin  =
+        p_pic->i_top_margin    =
+        p_pic->i_bottom_margin = 0;
+
+        i_index++;
+    }
+
+    /* How many directbuffers did we create ? */
+    p_vout->i_directbuffers = i_index;
 
     return( 0 );
 }
@@ -367,8 +305,17 @@ static int vout_Init( vout_thread_t *p_vout )
  *****************************************************************************/
 static void vout_End( vout_thread_t *p_vout )
 {
-    XVideoDestroyShmImage( p_vout, p_vout->p_sys->p_xvimage,
-                           &p_vout->p_sys->shm_info );
+    int i_index;
+
+    /* Free the direct buffers we allocated */
+    for( i_index = p_vout->i_directbuffers ; i_index ; )
+    {
+        i_index--;
+        DestroyShmImage( p_vout->p_sys->p_display,
+                         p_vout->p_picture[ i_index ].p_sys->p_xvimage,
+                         &p_vout->p_picture[ i_index ].p_sys->shminfo );
+        free( p_vout->p_picture[ i_index ].p_sys );
+    }
 }
 
 /*****************************************************************************
@@ -380,384 +327,65 @@ static void vout_Destroy( vout_thread_t *p_vout )
 {
     /* Restore cursor if it was blanked */
     if( !p_vout->p_sys->b_mouse_pointer_visible )
-        X11ToggleMousePointer( p_vout );
+    {
+        _M( XCommonToggleMousePointer ) ( p_vout );
+    }
 
     /* Destroy blank cursor pixmap */
     XFreePixmap( p_vout->p_sys->p_display, p_vout->p_sys->cursor_pixmap );
 
-    XVideoEnableScreenSaver( p_vout );
-    XVideoDestroyWindow( p_vout );
+    _M( XCommonEnableScreenSaver ) ( p_vout );
+    _M( XCommonDestroyWindow ) ( p_vout );
     XCloseDisplay( p_vout->p_sys->p_display );
 
     /* Destroy structure */
     free( p_vout->p_sys );
 }
 
-/*****************************************************************************
- * vout_Manage: handle X11 events
- *****************************************************************************
- * This function should be called regularly by video output thread. It manages
- * X11 events and allows window resizing. It returns a non null value on
- * error.
- *
- * XXX  Should "factor-out" common code in this and the "same" fn in the x11
- * XXX  plugin!
- *****************************************************************************/
-static int vout_Manage( vout_thread_t *p_vout )
-{
-    XEvent      xevent;                                         /* X11 event */
-    char        i_key;                                    /* ISO Latin-1 key */
-    KeySym      x_key_symbol;
-
-    /* Handle X11 events: ConfigureNotify events are parsed to know if the
-     * output window's size changed, MapNotify and UnmapNotify to know if the
-     * window is mapped (and if the display is useful), and ClientMessages
-     * to intercept window destruction requests */
-    while( XCheckWindowEvent( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                              StructureNotifyMask | KeyPressMask |
-                              ButtonPressMask | ButtonReleaseMask | 
-                              PointerMotionMask, &xevent )
-           == True )
-    {
-        /* ConfigureNotify event: prepare  */
-        if( (xevent.type == ConfigureNotify)
-            /*&& ((xevent.xconfigure.width != p_vout->p_sys->i_window_width)
-                || (xevent.xconfigure.height != p_vout->p_sys->i_window_height))*/ )
-        {
-            /* Update dimensions */
-            p_vout->p_sys->i_window_width = xevent.xconfigure.width;
-            p_vout->p_sys->i_window_height = xevent.xconfigure.height;
-//            p_vout->i_changes |= VOUT_SIZE_CHANGE;
-        }
-        /* MapNotify event: change window status and disable screen saver */
-        else if( xevent.type == MapNotify)
-        {
-            if( (p_vout != NULL) && !p_vout->b_active )
-            {
-                XVideoDisableScreenSaver( p_vout );
-                p_vout->b_active = 1;
-            }
-        }
-        /* UnmapNotify event: change window status and enable screen saver */
-        else if( xevent.type == UnmapNotify )
-        {
-            if( (p_vout != NULL) && p_vout->b_active )
-            {
-                XVideoEnableScreenSaver( p_vout );
-                p_vout->b_active = 0;
-            }
-        }
-        /* Keyboard event */
-        else if( xevent.type == KeyPress )
-        {
-            /* We may have keys like F1 trough F12, ESC ... */
-            x_key_symbol = XKeycodeToKeysym( p_vout->p_sys->p_display,
-                                             xevent.xkey.keycode, 0 );
-            switch( x_key_symbol )
-            {
-                 case XK_Escape:
-                     p_main->p_intf->b_die = 1;
-                     break;
-                 case XK_Menu:
-                     p_main->p_intf->b_menu_change = 1;
-                     break;
-                 default:
-                     /* "Normal Keys"
-                      * The reason why I use this instead of XK_0 is that 
-                      * with XLookupString, we don't have to care about
-                      * keymaps. */
-
-                    if( XLookupString( &xevent.xkey, &i_key, 1, NULL, NULL ) )
-                    {
-                        switch( i_key )
-                        {
-                        case 'q':
-                        case 'Q':
-                            p_main->p_intf->b_die = 1;
-                            break;
-                        case 'f':
-                        case 'F':
-                            p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
-                            break;
-                        case '0':
-                            network_ChannelJoin( 0 );
-                            break;
-                        case '1':
-                            network_ChannelJoin( 1 );
-                            break;
-                        case '2':
-                            network_ChannelJoin( 2 );
-                            break;
-                        case '3':
-                            network_ChannelJoin( 3 );
-                            break;
-                        case '4':
-                            network_ChannelJoin( 4 );
-                            break;
-                        case '5':
-                            network_ChannelJoin( 5 );
-                            break;
-                        case '6':
-                            network_ChannelJoin( 6 );
-                            break;
-                        case '7':
-                            network_ChannelJoin( 7 );
-                            break;
-                        case '8':
-                            network_ChannelJoin( 8 );
-                            break;
-                        case '9':
-                            network_ChannelJoin( 9 );
-                            break;
-                        default:
-                            if( intf_ProcessKey( p_main->p_intf, 
-                                                 (char )i_key ) )
-                            {
-                               intf_DbgMsg( "unhandled key '%c' (%i)", 
-                                            (char)i_key, i_key );
-                            }
-                            break;
-                        }
-                    }
-                break;
-            }
-        }
-        /* Mouse click */
-        else if( xevent.type == ButtonPress )
-        {
-            switch( ((XButtonEvent *)&xevent)->button )
-            {
-                case Button1:
-                    /* In this part we will eventually manage
-                     * clicks for DVD navigation for instance. For the
-                     * moment just pause the stream. */
-                    input_SetStatus( p_main->p_intf->p_input,
-                                     INPUT_STATUS_PAUSE );
-                    break;
-            }
-        }
-        /* Mouse release */
-        else if( xevent.type == ButtonRelease )
-        {
-            switch( ((XButtonEvent *)&xevent)->button )
-            {
-                case Button3:
-                    /* FIXME: need locking ! */
-                    p_main->p_intf->b_menu_change = 1;
-                    break;
-            }
-        }
-        /* Mouse move */
-        else if( xevent.type == MotionNotify )
-        {
-            p_vout->p_sys->i_time_mouse_last_moved = mdate();
-            if( !p_vout->p_sys->b_mouse_pointer_visible )
-                X11ToggleMousePointer( p_vout ); 
-        }
-        /* Other event */
-        else
-        {
-            intf_WarnMsg( 3, "%p -> unhandled event type %d received",
-                         p_vout, xevent.type );
-        }
-    }
-
-    /* Handle events for YUV video output sub-window */
-    while( XCheckWindowEvent( p_vout->p_sys->p_display,
-                              p_vout->p_sys->yuv_window,
-                              ExposureMask, &xevent ) == True )
-    {
-        /* Window exposed (only handled if stream playback is paused) */
-        if( xevent.type == Expose )
-        {
-            if( ((XExposeEvent *)&xevent)->count == 0 )
-                /* (if this is the last a collection of expose events...) */
-                if( p_main->p_intf->p_input )
-                    if( PAUSE_S ==
-                            p_main->p_intf->p_input->stream.control.i_status )
-                        XVideoDisplay( p_vout );
-        }
-    }
-        
-    /* ClientMessage event - only WM_PROTOCOLS with WM_DELETE_WINDOW data
-     * are handled - according to the man pages, the format is always 32
-     * in this case */
-    while( XCheckTypedEvent( p_vout->p_sys->p_display,
-                             ClientMessage, &xevent ) )
-    {
-        if( (xevent.xclient.message_type == p_vout->p_sys->wm_protocols)
-            && (xevent.xclient.data.l[0] == p_vout->p_sys->wm_delete_window ) )
-        {
-            p_main->p_intf->b_die = 1;
-        }
-        else
-        {
-            intf_DbgMsg( "%p -> unhandled ClientMessage received", p_vout );
-        }
-    }
-
-    if ( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
-    {
-        intf_DbgMsg( "vout: changing full-screen status" );
-
-        p_vout->b_fullscreen = !p_vout->b_fullscreen;
-
-        /* Get rid of the old window */
-        XVideoDestroyWindow( p_vout );
-
-        /* And create a new one */
-        if( XVideoCreateWindow( p_vout ) )
-        {
-            intf_ErrMsg( "vout error: cannot create X11 window" );
-            XCloseDisplay( p_vout->p_sys->p_display );
-
-            free( p_vout->p_sys );
-            return( 1 );
-        }
-    }
-
-    
-    if( (p_vout->i_changes & VOUT_GRAYSCALE_CHANGE))
-    {
-        /* FIXME: clear flags ?? */
-    }
-
-    /*
-     * Size change
-     */
-    if( p_vout->i_changes & VOUT_SIZE_CHANGE )
-    {
-        intf_DbgMsg( "vout: resizing window" );
-        p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
-
-        p_vout->i_width = p_vout->p_sys->i_window_width;
-        p_vout->i_height = p_vout->p_sys->i_window_height;
-
-        intf_WarnMsg( 3, "vout: video display resized (%dx%d)",
-                      p_vout->i_width, p_vout->i_height );
-    }
-
-    /* Autohide Cursor */
-    if( p_vout->p_sys->b_mouse_pointer_visible &&
-        mdate() - p_vout->p_sys->i_time_mouse_last_moved > 2000000 )
-    {
-        X11ToggleMousePointer( p_vout );
-    }
-    
-    return 0;
-}
-
 /*****************************************************************************
  * vout_Display: displays previously rendered output
  *****************************************************************************
  * This function sends the currently rendered image to X11 server.
  * (The Xv extension takes care of "double-buffering".)
  *****************************************************************************/
-static void vout_Display( vout_thread_t *p_vout )
+static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
 {
-    boolean_t b_draw = 1;
-    int i_size = p_vout->p_rendered_pic->i_width *
-                   p_vout->p_rendered_pic->i_height;
-
-    if( XVideoUpdateImgSizeIfRequired( p_vout ) )
-    {
-        return;
-    }
-
-    switch( p_vout->p_rendered_pic->i_type )
-    {
-    case YUV_422_PICTURE:
-        intf_ErrMsg( "vout error: YUV_422_PICTURE not (yet) supported" );
-        b_draw = 0;
-        break;
-
-    case YUV_444_PICTURE:
-        intf_ErrMsg( "vout error: YUV_444_PICTURE not (yet) supported" );
-        b_draw = 0;
-        break;
-
-    case YUV_420_PICTURE:
-        p_main->fast_memcpy( p_vout->p_sys->p_xvimage->data,
-                             p_vout->p_rendered_pic->p_y, i_size );
-        p_main->fast_memcpy( p_vout->p_sys->p_xvimage->data + ( i_size ),
-                             p_vout->p_rendered_pic->p_v, i_size / 4 );
-        p_main->fast_memcpy( p_vout->p_sys->p_xvimage->data
-                                 + ( i_size ) + ( i_size / 4 ),
-                             p_vout->p_rendered_pic->p_u, i_size / 4 );
-        break;
-    }
-
-    if( b_draw )
-    {
-        XVideoDisplay( p_vout );
-    }
-}
+    int i_dest_width, i_dest_height, i_dest_x, i_dest_y;
+
+    //printf("pic: %i %i, disp: %i %i\n", p_pic->i_width, p_pic->i_height, p_vout->p_sys->i_window_width, p_vout->p_sys->i_window_height);
+    //printf("pic aspect ratio: %i\n", p_pic->i_aspect_ratio);
+    XVideoOutputCoords( p_pic, p_vout->b_scale,
+                        p_vout->p_sys->i_window_width,
+                        p_vout->p_sys->i_window_height,
+                        &i_dest_x, &i_dest_y,
+                        &i_dest_width, &i_dest_height);
+    //printf("resized to %i %i, moved at %i %i\n", i_dest_width, i_dest_height, i_dest_x, i_dest_y);
+
+    XvShmPutImage( p_vout->p_sys->p_display, p_vout->p_sys->i_xvport,
+                   p_vout->p_sys->yuv_window, p_vout->p_sys->gc,
+                   p_pic->p_sys->p_xvimage,
+                   0 /*src_x*/, 0 /*src_y*/, p_pic->i_width, p_pic->i_height,
+                   0 /*dest_x*/, 0 /*dest_y*/, i_dest_width, i_dest_height,
+                   True );
 
-static void vout_SetPalette( p_vout_thread_t p_vout,
-                             u16 *red, u16 *green, u16 *blue, u16 *transp )
-{
-    return;
+    XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->yuv_window,
+                   i_dest_width, i_dest_height );
+#if 0
+    XMoveWindow( p_vout->p_sys->p_display, p_vout->p_sys->yuv_window,
+                 i_dest_x, i_dest_y );
+#endif
 }
 
 /* following functions are local */
 
 /*****************************************************************************
- * XVideoUpdateImgSizeIfRequired 
- *****************************************************************************
- * This function checks to see if the image to be displayed is of a different
- * size to the last image displayed. If so, the old shm block must be
- * destroyed and a new one created.
- * Note: the "image size" is the size of the image to be passed to the Xv
- * extension (which is probably different to the size of the output window).
- *****************************************************************************/
-static int XVideoUpdateImgSizeIfRequired( vout_thread_t *p_vout )
-{
-    int i_img_width         = p_vout->p_rendered_pic->i_width;
-    int i_img_height        = p_vout->p_rendered_pic->i_height;
-
-    if( p_vout->p_sys->i_image_width != i_img_width
-            || p_vout->p_sys->i_image_height != i_img_height )
-    {
-        if( p_vout->p_sys->i_image_width != 0
-             && p_vout->p_sys->i_image_height != 0 )
-        {
-            /* Destroy XvImage to change its size */
-            vout_End( p_vout );
-        }
-
-        p_vout->p_sys->i_image_width  = i_img_width;
-        p_vout->p_sys->i_image_height = i_img_height;
-
-        /* Create XvImage using XShm extension */
-        if( XVideoCreateShmImage( p_vout->p_sys->p_display,
-                                  p_vout->p_sys->xv_port,
-                                  &p_vout->p_sys->p_xvimage,
-                                  &p_vout->p_sys->shm_info,
-                                  i_img_width, i_img_height ) )
-        {
-            intf_ErrMsg( "vout: failed to create xvimage." );
-            p_vout->p_sys->i_image_width = 0;
-            return( 1 );
-        }
-
-        /* Set bytes per line and initialize buffers */
-        p_vout->i_bytes_per_line =
-            (p_vout->p_sys->p_xvimage->data_size) /
-            (p_vout->p_sys->p_xvimage->height);
-
-    }
-
-    return( 0 );
-}
-
-/*****************************************************************************
- * XVideoCheckForXv: check for the XVideo extension
+ * CheckForXVideo: check for the XVideo extension
  *****************************************************************************/
-static int XVideoCheckForXv( Display *dpy )
+static int CheckForXVideo( Display *p_display )
 {
     unsigned int i;
 
-    switch( XvQueryExtension( dpy, &i, &i, &i, &i, &i ) )
+    switch( XvQueryExtension( p_display, &i, &i, &i, &i, &i ) )
     {
         case Success:
             return( 1 );
@@ -777,355 +405,196 @@ static int XVideoCheckForXv( Display *dpy )
 }
 
 /*****************************************************************************
- * XVideoCreateWindow: open and set-up XVideo main window
+ * XVideoNewPicture: allocate a picture
+ *****************************************************************************
+ * Returns 0 on success, -1 otherwise
  *****************************************************************************/
-static int XVideoCreateWindow( vout_thread_t *p_vout )
+static int XVideoNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
 {
-    XSizeHints              xsize_hints;
-    XSetWindowAttributes    xwindow_attributes;
-    XGCValues               xgcvalues;
-    XEvent                  xevent;
-    Atom                    prop;
-    mwmhints_t              mwmhints;
-    
-    boolean_t               b_expose;
-    boolean_t               b_configure_notify;
-    boolean_t               b_map_notify;
-
-
-    /* Set main window's size */
-    /* If we're full screen, we're full screen! */
-    if( p_vout->b_fullscreen )
+    switch( p_vout->i_chroma )
     {
-        p_vout->p_sys->i_window_width = DisplayWidth( p_vout->p_sys->p_display,
-                                                      p_vout->p_sys->i_screen );
-        p_vout->p_sys->i_window_height =  DisplayHeight( p_vout->p_sys->p_display,
-                                                         p_vout->p_sys->i_screen );
-    }
-    else
-    {
-        p_vout->p_sys->i_window_width =  p_vout->i_width;
-        p_vout->p_sys->i_window_height = p_vout->i_height;
-    }
-
-    /* Prepare window manager hints and properties */
-    xsize_hints.base_width          = p_vout->p_sys->i_window_width;
-    xsize_hints.base_height         = p_vout->p_sys->i_window_height;
-    xsize_hints.flags               = PSize;
-    p_vout->p_sys->wm_protocols     = XInternAtom( p_vout->p_sys->p_display,
-                                                   "WM_PROTOCOLS", True );
-    p_vout->p_sys->wm_delete_window = XInternAtom( p_vout->p_sys->p_display,
-                                                   "WM_DELETE_WINDOW", True );
-
-    /* Prepare window attributes */
-    xwindow_attributes.background_pixel = BlackPixel( p_vout->p_sys->p_display,
-                                                      p_vout->p_sys->i_screen );
-
-    xwindow_attributes.event_mask = ExposureMask | StructureNotifyMask;
-
-    /* Create the window and set hints - the window must receive ConfigureNotify
-     * events, and, until it is displayed, Expose and MapNotify events. */
-    p_vout->p_sys->window =
-            XCreateWindow( p_vout->p_sys->p_display,
-                           DefaultRootWindow( p_vout->p_sys->p_display ),
-                           0, 0,
-                           p_vout->p_sys->i_window_width,
-                           p_vout->p_sys->i_window_height, 1,
-                           0, InputOutput, 0,
-                           CWBackPixel | CWEventMask,
-                           &xwindow_attributes );
-
-    if ( p_vout->b_fullscreen )
-    {
-        prop = XInternAtom(p_vout->p_sys->p_display, "_MOTIF_WM_HINTS", False);
-        mwmhints.flags = MWM_HINTS_DECORATIONS;
-        mwmhints.decorations = 0;
-        XChangeProperty( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                         prop, prop, 32, PropModeReplace,
-                         (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS );
-
-        XSetTransientForHint( p_vout->p_sys->p_display,
-                              p_vout->p_sys->window, None );
-        XRaiseWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
-    }
-
-    
-    /* Set window manager hints and properties: size hints, command,
-     * window's name, and accepted protocols */
-    XSetWMNormalHints( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                       &xsize_hints );
-    XSetCommand( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                 p_main->ppsz_argv, p_main->i_argc );
-    XStoreName( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                VOUT_TITLE " (XVideo output)" );
-
-    if( (p_vout->p_sys->wm_protocols == None)        /* use WM_DELETE_WINDOW */
-        || (p_vout->p_sys->wm_delete_window == None)
-        || !XSetWMProtocols( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                             &p_vout->p_sys->wm_delete_window, 1 ) )
-    {
-        /* WM_DELETE_WINDOW is not supported by window manager */
-        intf_Msg( "vout error: missing or bad window manager" );
-    }
-
-    /* Creation of a graphic context that doesn't generate a GraphicsExpose
-     * event when using functions like XCopyArea */
-    xgcvalues.graphics_exposures = False;
-    p_vout->p_sys->gc = XCreateGC( p_vout->p_sys->p_display,
-                                   p_vout->p_sys->window,
-                                   GCGraphicsExposures, &xgcvalues);
-
-    /* Send orders to server, and wait until window is displayed - three
-     * events must be received: a MapNotify event, an Expose event allowing
-     * drawing in the window, and a ConfigureNotify to get the window
-     * dimensions. Once those events have been received, only ConfigureNotify
-     * events need to be received. */
-    b_expose = 0;
-    b_configure_notify = 0;
-    b_map_notify = 0;
-    XMapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window);
-    do
-    {
-        XNextEvent( p_vout->p_sys->p_display, &xevent);
-        if( (xevent.type == Expose)
-            && (xevent.xexpose.window == p_vout->p_sys->window) )
-        {
-            b_expose = 1;
-        }
-        else if( (xevent.type == MapNotify)
-                 && (xevent.xmap.window == p_vout->p_sys->window) )
-        {
-            b_map_notify = 1;
-        }
-        else if( (xevent.type == ConfigureNotify)
-                 && (xevent.xconfigure.window == p_vout->p_sys->window) )
-        {
-            b_configure_notify = 1;
-            p_vout->p_sys->i_window_width = xevent.xconfigure.width;
-            p_vout->p_sys->i_window_height = xevent.xconfigure.height;
-        }
-    } while( !( b_expose && b_configure_notify && b_map_notify ) );
+        case YUV_420_PICTURE:
+            /* We know this chroma, allocate a buffer which will be used
+             * directly by the decoder */
+            p_pic->p_sys = malloc( sizeof( picture_sys_t ) );
 
-    XSelectInput( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                  StructureNotifyMask | KeyPressMask |
-                  ButtonPressMask | ButtonReleaseMask | 
-                  PointerMotionMask );
+            if( p_pic->p_sys == NULL )
+            {
+                return -1;
+            }
 
-    if( p_vout->b_fullscreen )
-    {
-        XSetInputFocus( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                        RevertToNone, CurrentTime );
-        XMoveWindow( p_vout->p_sys->p_display, p_vout->p_sys->window, 0, 0 );
-    }
+            /* Create XvImage using XShm extension */
+            p_pic->p_sys->p_xvimage =
+                CreateShmImage( p_vout->p_sys->p_display,
+                                p_vout->p_sys->i_xvport,
+                                &p_pic->p_sys->shminfo,
+                                p_vout->i_width, p_vout->i_height );
+            if( p_pic->p_sys->p_xvimage == NULL )
+            {
+                free( p_pic->p_sys );
+                return -1;
+            }
 
-    /* Create YUV output sub-window. */
-    p_vout->p_sys->yuv_window=XCreateSimpleWindow( p_vout->p_sys->p_display,
-                         p_vout->p_sys->window, 0, 0, 1, 1, 0,
-                         BlackPixel( p_vout->p_sys->p_display,
-                                         p_vout->p_sys->i_screen ),
-                         WhitePixel( p_vout->p_sys->p_display,
-                                         p_vout->p_sys->i_screen ) );
-    p_vout->p_sys->yuv_gc = XCreateGC( p_vout->p_sys->p_display,
-                                        p_vout->p_sys->yuv_window,
-                                        GCGraphicsExposures, &xgcvalues );
-
-    XSetWindowBackground( p_vout->p_sys->p_display, p_vout->p_sys->yuv_window,
-             BlackPixel(p_vout->p_sys->p_display, p_vout->p_sys->i_screen ) );
-
-    XMapWindow( p_vout->p_sys->p_display, p_vout->p_sys->yuv_window );
-    XSelectInput( p_vout->p_sys->p_display, p_vout->p_sys->yuv_window,
-                  ExposureMask );
-
-    /* If the cursor was formerly blank than blank it again */
-    if( !p_vout->p_sys->b_mouse_pointer_visible )
-    {
-        X11ToggleMousePointer( p_vout );
-        X11ToggleMousePointer( p_vout );
-    }
+            p_pic->i_chroma = p_vout->i_chroma; /* YUV_420_PICTURE */
+            p_pic->i_width  = p_vout->i_width;
+            p_pic->i_height = p_vout->i_height;
 
-    XSync( p_vout->p_sys->p_display, False );
+            /* Precalculate some values */
+            p_pic->i_size         = p_vout->i_width * p_vout->i_height;
+            p_pic->i_chroma_width = p_vout->i_width / 2;
+            p_pic->i_chroma_size  = p_vout->i_height * p_pic->i_chroma_width;
 
-    return( 0 );
-}
+            /* FIXME: try to get the right i_bytes value from p_overlay */
+            p_pic->planes[ Y_PLANE ].p_data  = p_pic->p_sys->p_xvimage->data;
+            p_pic->planes[ Y_PLANE ].i_bytes = p_pic->i_size * sizeof(u8);
+            p_pic->planes[ U_PLANE ].p_data  = (u8*)p_pic->p_sys->p_xvimage->data
+                                                + p_pic->i_size * 5 / 4;
+            p_pic->planes[ U_PLANE ].i_bytes = p_pic->i_size * sizeof(u8) / 4;
+            p_pic->planes[ V_PLANE ].p_data  = (u8*)p_pic->p_sys->p_xvimage->data
+                                                + p_pic->i_size;
+            p_pic->planes[ V_PLANE ].i_bytes = p_pic->i_size * sizeof(u8) / 4;
+            p_pic->i_planes = 3;
 
-static void XVideoDestroyWindow( vout_thread_t *p_vout )
-{
-    XSync( p_vout->p_sys->p_display, False );
+            return 0;
 
-    XFreeGC( p_vout->p_sys->p_display, p_vout->p_sys->yuv_gc );
-    XDestroyWindow( p_vout->p_sys->p_display, p_vout->p_sys->yuv_window );
+        default:
+            /* Unknown chroma, tell the guy to get lost */
+            p_pic->i_planes = 0;
 
-    XUnmapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
-    XFreeGC( p_vout->p_sys->p_display, p_vout->p_sys->gc );
-    XDestroyWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
+            return 0;
+    }
 }
 
 /*****************************************************************************
- * XVideoCreateShmImage: create an XvImage using shared memory extension
+ * CreateShmImage: create an XvImage using shared memory extension
  *****************************************************************************
  * Prepare an XvImage for display function.
  * The order of the operations respects the recommandations of the mit-shm
  * document by J.Corbet and K.Packard. Most of the parameters were copied from
  * there.
  *****************************************************************************/
-static int XVideoCreateShmImage( Display* dpy, int xv_port,
-                                    XvImage **pp_xvimage,
-                                    XShmSegmentInfo *p_shm_info,
-                                    int i_width, int i_height )
+static XvImage *CreateShmImage( Display* p_display, int i_xvport,
+                                XShmSegmentInfo *p_shminfo,
+                                int i_width, int i_height )
 {
-    *pp_xvimage = XvShmCreateImage( dpy, xv_port,
-                                    GUID_YUV12_PLANAR, 0,
-                                    i_width, i_height,
-                                    p_shm_info );
-    if( !(*pp_xvimage) )
+    XvImage *p_xvimage;
+
+    p_xvimage = XvShmCreateImage( p_display, i_xvport,
+                                  GUID_YUV12_PLANAR, 0,
+                                  i_width, i_height,
+                                  p_shminfo );
+    if( p_xvimage == NULL )
     {
         intf_ErrMsg( "vout error: XvShmCreateImage failed." );
-        return( -1 );
+        return( NULL );
     }
 
-    p_shm_info->shmid    = shmget( IPC_PRIVATE, (*pp_xvimage)->data_size,
-                                   IPC_CREAT | 0777 );
-    if( p_shm_info->shmid < 0)                                      /* error */
+    p_shminfo->shmid = shmget( IPC_PRIVATE, p_xvimage->data_size,
+                               IPC_CREAT | 0776 );
+    if( p_shminfo->shmid < 0 ) /* error */
     {
         intf_ErrMsg( "vout error: cannot allocate shared image data (%s)",
-                    strerror(errno));
-        return( 1 );
+                     strerror( errno ) );
+        return( NULL );
     }
 
-    p_shm_info->shmaddr  = (*pp_xvimage)->data = shmat( p_shm_info->shmid,
-                                                        0, 0 );
-    p_shm_info->readOnly = False;
+    p_shminfo->shmaddr = p_xvimage->data = shmat( p_shminfo->shmid, 0, 0 );
+    p_shminfo->readOnly = False;
 
-    if( !XShmAttach( dpy, p_shm_info ) )
+    if( !XShmAttach( p_display, p_shminfo ) )
     {
         intf_ErrMsg( "vout error: XShmAttach failed" );
-        shmctl( p_shm_info->shmid, IPC_RMID, 0 );
-        shmdt( p_shm_info->shmaddr );
-        return( -1 );
+        shmctl( p_shminfo->shmid, IPC_RMID, 0 );
+        shmdt( p_shminfo->shmaddr );
+        return( NULL );
     }
 
     /* Send image to X server. This instruction is required, since having
      * built a Shm XImage and not using it causes an error on XCloseDisplay */
-    XSync( dpy, False );
+    XSync( p_display, False );
 
-    /* Mark the shm segment to be removed when there will be no more
+#if 1
+    /* Mark the shm segment to be removed when there are no more
      * attachements, so it is automatic on process exit or after shmdt */
-    shmctl( p_shm_info->shmid, IPC_RMID, 0 );
+    shmctl( p_shminfo->shmid, IPC_RMID, 0 );
+#endif
 
-    return( 0 );
+    return( p_xvimage );
 }
 
 /*****************************************************************************
- * XVideoDestroyShmImage
+ * DestroyShmImage
  *****************************************************************************
  * Destroy XImage AND associated data. Detach shared memory segment from
  * server and process, then free it. If pointer is NULL, the image won't be
- * destroyed (see vout_ManageOutputMethod())
+ * destroyed (see vout_Manage())
  *****************************************************************************/
-static void XVideoDestroyShmImage( vout_thread_t *p_vout, XvImage *p_xvimage,
-                                   XShmSegmentInfo *p_shm_info )
+static void DestroyShmImage( Display *p_display, XvImage *p_xvimage,
+                             XShmSegmentInfo *p_shminfo )
 {
-    /* If pointer is NULL, do nothing */
-    if( p_xvimage == NULL )
-    {
-        return;
-    }
+    /* Detach from server */
+    XShmDetach( p_display, p_shminfo );
+    XSync( p_display, False );
 
-    XSync( p_vout->p_sys->p_display, False );
-    XShmDetach( p_vout->p_sys->p_display, p_shm_info );/* detach from server */
 #if 0
-    XDestroyImage( p_ximage ); /* XXX */
+    XDestroyImage( p_xvimage ); /* XXX */
 #endif
+
     XFree( p_xvimage );
 
-    if( shmdt( p_shm_info->shmaddr ) )  /* detach shared memory from process */
+    if( shmdt( p_shminfo->shmaddr ) )   /* detach shared memory from process */
     {
         intf_ErrMsg( "vout error: cannot detach shared memory (%s)",
                      strerror(errno) );
     }
 }
 
-/*****************************************************************************
- * XVideoEnableScreenSaver: enable screen saver
- *****************************************************************************
- * This function enable the screen saver on a display after it had been
- * disabled by XDisableScreenSaver. Both functions use a counter mechanism to
- * know wether the screen saver can be activated or not: if n successive calls
- * are made to XDisableScreenSaver, n successive calls to XEnableScreenSaver
- * will be required before the screen saver could effectively be activated.
- *****************************************************************************/
-void XVideoEnableScreenSaver( vout_thread_t *p_vout )
-{
-    intf_DbgMsg( "intf: enabling screen saver" );
-    XSetScreenSaver( p_vout->p_sys->p_display, p_vout->p_sys->i_ss_timeout,
-                     p_vout->p_sys->i_ss_interval,
-                     p_vout->p_sys->i_ss_blanking,
-                     p_vout->p_sys->i_ss_exposure );
-
-    DPMSEnable( p_vout->p_sys->p_display );
-}
-
-/*****************************************************************************
- * XVideoDisableScreenSaver: disable screen saver
- *****************************************************************************
- * See XEnableScreenSaver
- *****************************************************************************/
-void XVideoDisableScreenSaver( vout_thread_t *p_vout )
-{
-    /* Save screen saver informations */
-    XGetScreenSaver( p_vout->p_sys->p_display, &p_vout->p_sys->i_ss_timeout,
-                     &p_vout->p_sys->i_ss_interval,
-                     &p_vout->p_sys->i_ss_blanking,
-                     &p_vout->p_sys->i_ss_exposure );
-
-    /* Disable screen saver */
-    intf_DbgMsg( "intf: disabling screen saver" );
-    XSetScreenSaver( p_vout->p_sys->p_display, 0,
-                     p_vout->p_sys->i_ss_interval,
-                     p_vout->p_sys->i_ss_blanking,
-                     p_vout->p_sys->i_ss_exposure );
-
-    DPMSDisable( p_vout->p_sys->p_display );
-}
-
-/*****************************************************************************
- * X11ToggleMousePointer: hide or show the mouse pointer
- *****************************************************************************
- * This function hides the X pointer if requested.
- *****************************************************************************/
-void X11ToggleMousePointer( vout_thread_t *p_vout )
+/* This based on some code in SetBufferPicture... At the moment it's only
+ * used by the xvideo plugin, but others may want to use it. */
+static void XVideoOutputCoords( const picture_t *p_pic, const boolean_t scale,
+                                const int win_w, const int win_h,
+                                int *dx, int *dy, int *w, int *h )
 {
-
-    if( p_vout->p_sys->b_mouse_pointer_visible )
+    if( !scale )
     {
-        XDefineCursor( p_vout->p_sys->p_display,
-                       p_vout->p_sys->window,
-                       p_vout->p_sys->blank_cursor );
-        p_vout->p_sys->b_mouse_pointer_visible = 0;
+        *w = p_pic->i_width;
+        *h = p_pic->i_height;
     }
     else
     {
-        XUndefineCursor( p_vout->p_sys->p_display, p_vout->p_sys->window );
-        p_vout->p_sys->b_mouse_pointer_visible = 1;
+        *h = win_h;
+        switch( p_pic->i_aspect_ratio )
+        {
+            case AR_3_4_PICTURE:
+                *w = win_h * 4 / 3;
+                break;
+
+            case AR_16_9_PICTURE:
+                *w = win_h * 16 / 9;
+                break;
+
+            case AR_221_1_PICTURE:
+                *w = win_h * 221 / 100;
+                break;
+
+            case AR_SQUARE_PICTURE:
+            default:
+                *w = win_h * p_pic->i_width / p_pic->i_height;
+                break;
+        }
     }
-}
 
-/* This based on some code in SetBufferPicture... At the moment it's only
- * used by the xvideo plugin, but others may want to use it. */
-static void XVideoOutputCoords( const picture_t *p_pic, const boolean_t scale,
-                                const int win_w, const int win_h,
-                                int *dx, int *dy, int *w, int *h )
-{
+    /* Set picture position */
+    *dx = (win_w - *w) / 2;
+    *dy = (win_h - *h) / 2;
 }
 
-
 /*****************************************************************************
- * XVideoGetPort: get YUV12 port
+ * GetXVideoPort: get YUV12 port
  *****************************************************************************
  * 
  *****************************************************************************/
-static int XVideoGetPort( Display *dpy )
+static int GetXVideoPort( Display *dpy )
 {
     XvAdaptorInfo *p_adaptor;
     int i_adaptor, i_num_adaptors, i_requested_adaptor;
@@ -1204,7 +673,7 @@ static int XVideoGetPort( Display *dpy )
                 /* Found a matching port, print a description of this port */
                 i_selected_port = i_port;
 
-                intf_WarnMsg( 3, "vout: XVideoGetPort found adaptor %i port %i",
+                intf_WarnMsg( 3, "vout: GetXVideoPort found adaptor %i port %i",
                                  i_adaptor, i_port);
                 intf_WarnMsg( 3, "  image format 0x%x (%4.4s) %s supported",
                                  p_formats[ i_format ].id,
@@ -1283,141 +752,6 @@ static int XVideoGetPort( Display *dpy )
     return( i_selected_port );
 }
 
-
-/*****************************************************************************
- * XVideoDisplay: display image
- *****************************************************************************
- * This function displays the image stored in p_vout->p_sys->p_xvimage.
- * The image is scaled to fit in the output window (and to have the correct
- * aspect ratio).
- *****************************************************************************/
-static void XVideoDisplay( vout_thread_t *p_vout )
-{
-    int         i_dest_width, i_dest_height;
-    int         i_dest_x, i_dest_y;
-
-    if( !p_vout->p_sys->p_xvimage || !p_vout->p_rendered_pic )
-    {
-        return;
-    }
-
-    i_dest_height = p_vout->p_sys->i_window_height >
-                        p_vout->p_rendered_pic->i_height
-                  ? p_vout->p_sys->i_window_height
-                  : p_vout->p_rendered_pic->i_height;
-    i_dest_width = p_vout->p_sys->i_window_width >
-                        p_vout->p_rendered_pic->i_width
-                 ? p_vout->p_sys->i_window_width
-                 : p_vout->p_rendered_pic->i_width;
-        
-    if( p_vout->b_scale )
-    {
-        int   i_ratio = 900 * i_dest_width / i_dest_height;
-        
-        switch( p_vout->p_rendered_pic->i_aspect_ratio )
-        {
-            case AR_3_4_PICTURE:
-                if( i_ratio < 1200 )
-                {
-                    i_dest_width = i_dest_height * 4 / 3;
-                }
-                else
-                {
-                    i_dest_height = i_dest_width * 3 / 4;
-                }
-                i_ratio = 1200;
-                break;
-
-            case AR_16_9_PICTURE:
-                if( i_ratio < 1600 )
-                {
-                    i_dest_width = i_dest_height * 16 / 9;
-                }
-                else
-                {
-                    i_dest_height = i_dest_width * 9 / 16;
-                }
-                i_ratio = 1600;
-                break;
-
-            case AR_221_1_PICTURE:
-                if( i_ratio < 1989 )
-                {
-                    i_dest_width = i_dest_height * 221 / 100;
-                }
-                else
-                {
-                    i_dest_height = i_dest_width * 100 / 221;
-                }
-                i_ratio = 1989;
-                break;
-
-            case AR_SQUARE_PICTURE:
-            default:
-                if( i_ratio < 900 )
-                {
-                    i_dest_width = i_dest_height * p_vout->p_rendered_pic->i_width / p_vout->p_rendered_pic->i_height;
-                }
-                else
-                {
-                    i_dest_height = i_dest_width * p_vout->p_rendered_pic->i_height / p_vout->p_rendered_pic->i_width;
-                }
-                i_ratio = 900;
-                break;
-        }
-
-        if( i_dest_width >
-            DisplayWidth( p_vout->p_sys->p_display, p_vout->p_sys->i_screen ) )
-        {
-            i_dest_width = DisplayWidth( p_vout->p_sys->p_display,
-                                         p_vout->p_sys->i_screen );
-            i_dest_height = 900 * i_dest_width / i_ratio;
-        }
-        else if( i_dest_height >
-            DisplayHeight( p_vout->p_sys->p_display, p_vout->p_sys->i_screen ) )
-        {
-            i_dest_height = DisplayHeight( p_vout->p_sys->p_display,
-                                           p_vout->p_sys->i_screen );
-            i_dest_width = i_ratio * i_dest_height / 900;
-        }
-    }
-
-    XvShmPutImage( p_vout->p_sys->p_display, p_vout->p_sys->xv_port,
-                   p_vout->p_sys->yuv_window, p_vout->p_sys->gc,
-                   p_vout->p_sys->p_xvimage,
-                   0 /*src_x*/, 0 /*src_y*/,
-                   p_vout->p_rendered_pic->i_width,
-                   p_vout->p_rendered_pic->i_height,
-                   0 /*dest_x*/, 0 /*dest_y*/, i_dest_width, i_dest_height,
-                   False );
-    
-    /* YUV window */
-    XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->yuv_window,
-                   i_dest_width, i_dest_height );
-
-    /* Root window */
-    if( ( ( i_dest_width != p_vout->p_sys->i_window_width ) ||
-          ( i_dest_height != p_vout->p_sys->i_window_height ) ) &&
-        ! p_vout->b_fullscreen )
-    {
-        p_vout->p_sys->i_window_width = i_dest_width;
-        p_vout->p_sys->i_window_height = i_dest_height;
-//        p_vout->i_changes |= VOUT_SIZE_CHANGE;
-        XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                       i_dest_width, i_dest_height );
-    }
-    
-    /* Set picture position */
-    i_dest_x = (p_vout->p_sys->i_window_width - i_dest_width) / 2;
-    i_dest_y = (p_vout->p_sys->i_window_height - i_dest_height) / 2;
-    
-    XMoveWindow( p_vout->p_sys->p_display, p_vout->p_sys->yuv_window,
-                 i_dest_x, i_dest_y );
-    
-    /* Send the order to the X server */
-    XSync( p_vout->p_sys->p_display, False );
-}
-
 #if 0
 /*****************************************************************************
  * XVideoSetAttribute
@@ -1430,10 +764,10 @@ static void XVideoSetAttribute( vout_thread_t *p_vout,
 {
     int             i_attrib;
     XvAttribute    *p_attrib;
-    Display        *p_dpy   = p_vout->p_sys->p_display;
-    int             xv_port = p_vout->p_sys->xv_port;
+    Display        *p_display = p_vout->p_sys->p_display;
+    int             i_xvport  = p_vout->p_sys->i_xvport;
 
-    p_attrib = XvQueryPortAttributes( p_dpy, xv_port, &i_attrib );
+    p_attrib = XvQueryPortAttributes( p_display, i_xvport, &i_attrib );
 
     do
     {
@@ -1445,8 +779,8 @@ static void XVideoSetAttribute( vout_thread_t *p_vout,
                                     - p_attrib[ i_attrib ].min_value + 1 )
                         + p_attrib[ i_attrib ].min_value;
 
-            XvSetPortAttribute( p_dpy, xv_port,
-                            XInternAtom( p_dpy, attr_name, False ), i_sv );
+            XvSetPortAttribute( p_display, i_xvport,
+                            XInternAtom( p_display, attr_name, False ), i_sv );
             break;
         }
 
index f52d4adaa0b723c3e24a932ef270007ec2718eea..5a3d73e60a5d879667e9df9107e2f3ec3cce1288 100644 (file)
@@ -2,7 +2,7 @@
  * x11.c : X11 plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: x11.c,v 1.8 2001/11/28 15:08:06 massiot Exp $
+ * $Id: x11.c,v 1.9 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *      
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
index 7fbc1172758fcd0ccedc89fe4850f559fcd87442..33ce5b69672e0d4e926aecb4e32d1f64bb23f514 100644 (file)
@@ -2,7 +2,7 @@
  * xvideo.c : Xvideo plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: xvideo.c,v 1.4 2001/11/28 15:08:06 massiot Exp $
+ * $Id: xvideo.c,v 1.5 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Shane Harper <shanegh@optusnet.com.au>
  *      
@@ -32,7 +32,6 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "intf_msg.h"
 #include "threads.h"
diff --git a/plugins/yuv/Makefile b/plugins/yuv/Makefile
deleted file mode 100644 (file)
index 9016abf..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-###############################################################################
-# vlc (VideoLAN Client) yuv module makefile
-# (c)2001 VideoLAN
-###############################################################################
-
-#
-# Objects
-#
-
-PLUGIN_YUV = yuv.o video_yuv.o transforms_yuv.o
-PLUGIN_YUVMMX = yuvmmx.o video_yuvmmx.o transforms_yuvmmx.o
-
-BUILTIN_YUV = $(PLUGIN_YUV:%.o=BUILTIN_%.o)
-BUILTIN_YUVMMX = $(PLUGIN_YUVMMX:%.o=BUILTIN_%.o)
-
-PLUGIN_C = $(PLUGIN_YUV) $(PLUGIN_YUVMMX)
-BUILTIN_C = $(BUILTIN_YUV) $(BUILTIN_YUVMMX)
-ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
-
-#
-# Virtual targets
-#
-
-include ../../Makefile.modules
-
-#
-# Real targets
-#
-
-../yuv.so: $(PLUGIN_YUV)
-       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_YUV)
-
-../yuv.a: $(BUILTIN_YUV)
-       ar r $@ $^
-       $(RANLIB) $@
-
-../yuvmmx.so: $(PLUGIN_YUVMMX)
-       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) 
-
-../yuvmmx.a: $(BUILTIN_YUVMMX)
-       ar r $@ $^
-       $(RANLIB) $@
-
diff --git a/plugins/yuv/transforms_common.h b/plugins/yuv/transforms_common.h
deleted file mode 100644 (file)
index 2d54270..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/*****************************************************************************
- * transforms_common.h: YUV transformation macros for truecolor
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: transforms_common.h,v 1.3 2001/10/11 13:19:27 massiot Exp $
- *
- * Authors: Vincent Seguin <seguin@via.ecp.fr>
- *
- * 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-1307, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * CONVERT_YUV_PIXEL, CONVERT_Y_PIXEL: pixel conversion blocks
- *****************************************************************************
- * These conversion routines are used by YUV conversion functions.
- * conversion are made from p_y, p_u, p_v, which are modified, to p_buffer,
- * which is also modified.
- *****************************************************************************/
-#define CONVERT_Y_PIXEL( BPP )                                                \
-    /* Only Y sample is present */                                            \
-    p_ybase = p_yuv + *p_y++;                                                 \
-    *p_buffer++ = p_ybase[RED_OFFSET-((V_RED_COEF*128)>>SHIFT) + i_red] |     \
-        p_ybase[GREEN_OFFSET-(((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT)       \
-        + i_green ] | p_ybase[BLUE_OFFSET-((U_BLUE_COEF*128)>>SHIFT) + i_blue];
-
-#define CONVERT_YUV_PIXEL( BPP )                                              \
-    /* Y, U and V samples are present */                                      \
-    i_uval =    *p_u++;                                                       \
-    i_vval =    *p_v++;                                                       \
-    i_red =     (V_RED_COEF * i_vval) >> SHIFT;                               \
-    i_green =   (U_GREEN_COEF * i_uval + V_GREEN_COEF * i_vval) >> SHIFT;     \
-    i_blue =    (U_BLUE_COEF * i_uval) >> SHIFT;                              \
-    CONVERT_Y_PIXEL( BPP )                                                    \
-
-/*****************************************************************************
- * SCALE_WIDTH: scale a line horizontally
- *****************************************************************************
- * This macro scales a line using rendering buffer and offset array. It works
- * for 1, 2 and 4 Bpp.
- *****************************************************************************/
-#define SCALE_WIDTH                                                           \
-    if( b_horizontal_scaling )                                                \
-    {                                                                         \
-        /* Horizontal scaling, conversion has been done to buffer.            \
-         * Rewind buffer and offset, then copy and scale line */              \
-        p_buffer = p_buffer_start;                                            \
-        p_offset = p_offset_start;                                            \
-        for( i_x = i_pic_width / 16; i_x--; )                                 \
-        {                                                                     \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-        }                                                                     \
-        p_pic += i_pic_line_width;                                            \
-    }                                                                         \
-    else                                                                      \
-    {                                                                         \
-        /* No scaling, conversion has been done directly in picture memory.   \
-         * Increment of picture pointer to end of line is still needed */     \
-        p_pic += i_pic_width + i_pic_line_width;                              \
-    }                                                                         \
-
-/*****************************************************************************
- * SCALE_HEIGHT: handle vertical scaling
- *****************************************************************************
- * This macro handle vertical scaling for a picture. CHROMA may be 420, 422 or
- * 444 for RGB conversion, or 400 for gray conversion. It works for 1, 2, 3
- * and 4 Bpp.
- *****************************************************************************/
-#define SCALE_HEIGHT( CHROMA, BPP )                                           \
-    /* If line is odd, rewind 4:2:0 U and V samples */                        \
-    if( (CHROMA == 420) && !(i_y & 0x1) )                                     \
-    {                                                                         \
-        p_u -= i_chroma_width;                                                \
-        p_v -= i_chroma_width;                                                \
-    }                                                                         \
-                                                                              \
-    /*                                                                        \
-     * Handle vertical scaling. The current line can be copied or next one    \
-     * can be ignored.                                                        \
-     */                                                                       \
-    switch( i_vertical_scaling )                                              \
-    {                                                                         \
-    case -1:                             /* vertical scaling factor is < 1 */ \
-        while( (i_scale_count -= i_pic_height) > 0 )                          \
-        {                                                                     \
-            /* Height reduction: skip next source line */                     \
-            p_y += i_width;                                                   \
-            i_y++;                                                            \
-            if( CHROMA == 420 )                                               \
-            {                                                                 \
-                if( i_y & 0x1 )                                               \
-                {                                                             \
-                    p_u += i_chroma_width;                                    \
-                    p_v += i_chroma_width;                                    \
-                }                                                             \
-            }                                                                 \
-            else if( (CHROMA == 422) || (CHROMA == 444) )                     \
-            {                                                                 \
-                p_u += i_width;                                               \
-                p_v += i_width;                                               \
-            }                                                                 \
-        }                                                                     \
-        i_scale_count += i_height;                                            \
-        break;                                                                \
-    case 1:                              /* vertical scaling factor is > 1 */ \
-        while( (i_scale_count -= i_height) > 0 )                              \
-        {                                                                     \
-            /* Height increment: copy previous picture line */                \
-            for( i_x = i_pic_width / 16; i_x--; )                             \
-            {                                                                 \
-                *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );           \
-                *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );           \
-                if( BPP > 1 )                               /* 2, 3, 4 Bpp */ \
-                {                                                             \
-                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
-                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
-                }                                                             \
-                if( BPP > 2 )                                  /* 3, 4 Bpp */ \
-                {                                                             \
-                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
-                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
-                }                                                             \
-                if( BPP > 3 )                                     /* 4 Bpp */ \
-                {                                                             \
-                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
-                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
-                }                                                             \
-            }                                                                 \
-            p_pic +=        i_pic_line_width;                                 \
-            p_pic_start +=  i_pic_line_width;                                 \
-        }                                                                     \
-        i_scale_count += i_pic_height;                                        \
-        break;                                                                \
-    }                                                                         \
-
diff --git a/plugins/yuv/transforms_yuv.c b/plugins/yuv/transforms_yuv.c
deleted file mode 100644 (file)
index adf5276..0000000
+++ /dev/null
@@ -1,801 +0,0 @@
-/*****************************************************************************
- * transforms_yuv.c: C YUV transformation functions
- * Provides functions to perform the YUV conversion. The functions provided
- * here are a complete and portable C implementation, and may be replaced in
- * certain cases by optimized functions.
- *****************************************************************************
- * Copyright (C) 1999-2001 VideoLAN
- * $Id: transforms_yuv.c,v 1.7 2001/11/28 15:08:06 massiot Exp $
- *
- * Authors: Vincent Seguin <ptyx@via.ecp.fr>
- *          Samuel Hocevar <sam@zoy.org>
- *          Richard Shepherd <richard@rshepherd.demon.co.uk>
- *
- * 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-1307, USA.
- *****************************************************************************/
-
-#define MODULE_NAME yuv
-#include "modules_inner.h"
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <math.h>                                            /* exp(), pow() */
-#include <errno.h>                                                 /* ENOMEM */
-#include <stdlib.h>                                                /* free() */
-#include <string.h>                                            /* strerror() */
-
-#include "config.h"
-#include "common.h"
-#include "intf_msg.h"
-#include "threads.h"
-#include "mtime.h"
-
-#include "video.h"
-#include "video_output.h"
-
-#include "video_common.h"
-#include "transforms_common.h"
-#include "transforms_yuv.h"
-
-#include "modules.h"
-#include "modules_export.h"
-
-/*****************************************************************************
- * ConvertY4Gray8: grayscale YUV 4:x:x to RGB 8 bpp
- *****************************************************************************/
-void _M( ConvertY4Gray8 )( YUV_ARGS_8BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_chroma_width;                    /* chroma width, not used */
-    u8 *        p_gray;                             /* base conversion table */
-    u8 *        p_pic_start;       /* beginning of the current line for copy */
-    u8 *        p_buffer_start;                   /* conversion buffer start */
-    u8 *        p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    p_gray =            p_vout->yuv.yuv.p_gray8;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-        }
-
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(400, 1);
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB8: color YUV 4:2:0 to RGB 8 bpp
- *****************************************************************************/
-void _M( ConvertYUV420RGB8 )( YUV_ARGS_8BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_real_y;                                           /* y % 4 */
-    u8 *        p_lookup;                                    /* lookup table */
-    int         i_chroma_width;                              /* chroma width */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /* 
-     * The dithering matrices
-     */
-    static int dither10[4] = {  0x0,  0x8,  0x2,  0xa };
-    static int dither11[4] = {  0xc,  0x4,  0xe,  0x6 };
-    static int dither12[4] = {  0x3,  0xb,  0x1,  0x9 };
-    static int dither13[4] = {  0xf,  0x7,  0xd,  0x5 };
-
-    static int dither20[4] = {  0x0, 0x10,  0x4, 0x14 };
-    static int dither21[4] = { 0x18,  0x8, 0x1c,  0xc };
-    static int dither22[4] = {  0x6, 0x16,  0x2, 0x12 };
-    static int dither23[4] = { 0x1e,  0xe, 0x1a,  0xa };
-
-   /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_offset_start =    p_vout->yuv.p_offset;
-    p_lookup =          p_vout->yuv.p_base;
-    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 1 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    i_real_y = 0;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH_DITHER( 420 );
-        SCALE_HEIGHT_DITHER( 420 );
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB8: color YUV 4:2:2 to RGB 8 bpp
- *****************************************************************************/
-void _M( ConvertYUV422RGB8 )( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, bpp = 8" );
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB8: color YUV 4:4:4 to RGB 8 bpp
- *****************************************************************************/
-void _M( ConvertYUV444RGB8 )( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, bpp = 8" );
-}
-
-/*****************************************************************************
- * ConvertY4Gray16: grayscale YUV 4:x:x to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertY4Gray16 )( YUV_ARGS_16BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_chroma_width;                    /* chroma width, not used */
-    u16 *       p_gray;                             /* base conversion table */
-    u16 *       p_pic_start;       /* beginning of the current line for copy */
-    u16 *       p_buffer_start;                   /* conversion buffer start */
-    u16 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    p_gray =            p_vout->yuv.yuv.p_gray16;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-        }
-
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(400, 2);
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB16: color YUV 4:2:0 to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertYUV420RGB16 )( YUV_ARGS_16BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_uval, i_vval;                           /* U and V samples */
-    int         i_red, i_green, i_blue;          /* U and V modified samples */
-    int         i_chroma_width;                              /* chroma width */
-    u16 *       p_yuv;                              /* base conversion table */
-    u16 *       p_ybase;                     /* Y dependant conversion table */
-    u16 *       p_pic_start;       /* beginning of the current line for copy */
-    u16 *       p_buffer_start;                   /* conversion buffer start */
-    u16 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_yuv =             p_vout->yuv.yuv.p_rgb16;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-        }
-
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(420, 2);
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB16: color YUV 4:2:2 to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertYUV422RGB16 )( YUV_ARGS_16BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_uval, i_vval;                           /* U and V samples */
-    int         i_red, i_green, i_blue;          /* U and V modified samples */
-    int         i_chroma_width;                              /* chroma width */
-    u16 *       p_yuv;                              /* base conversion table */
-    u16 *       p_ybase;                     /* Y dependant conversion table */
-    u16 *       p_pic_start;       /* beginning of the current line for copy */
-    u16 *       p_buffer_start;                   /* conversion buffer start */
-    u16 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_yuv =             p_vout->yuv.yuv.p_rgb16;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-        }
-
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(422, 2);
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB16: color YUV 4:4:4 to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertYUV444RGB16 )( YUV_ARGS_16BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_uval, i_vval;                           /* U and V samples */
-    int         i_red, i_green, i_blue;          /* U and V modified samples */
-    int         i_chroma_width;                    /* chroma width, not used */
-    u16 *       p_yuv;                              /* base conversion table */
-    u16 *       p_ybase;                     /* Y dependant conversion table */
-    u16 *       p_pic_start;       /* beginning of the current line for copy */
-    u16 *       p_buffer_start;                   /* conversion buffer start */
-    u16 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    p_yuv =             p_vout->yuv.yuv.p_rgb16;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-        }
-
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(444, 2);
-    }
-}
-
-/*****************************************************************************
- * ConvertY4Gray24: grayscale YUV 4:x:x to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertY4Gray24 )( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, grayscale, bpp = 24" );
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB24: color YUV 4:2:0 to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertYUV420RGB24 )( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 420, bpp = 24" );
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB24: color YUV 4:2:2 to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertYUV422RGB24 )( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, bpp = 24" );
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB24: color YUV 4:4:4 to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertYUV444RGB24 )( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, bpp = 24" );
-}
-
-/*****************************************************************************
- * ConvertY4Gray32: grayscale YUV 4:x:x to RGB 4 Bpp
- *****************************************************************************/
-void _M( ConvertY4Gray32 )( YUV_ARGS_32BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_chroma_width;                    /* chroma width, not used */
-    u32 *       p_gray;                             /* base conversion table */
-    u32 *       p_pic_start;       /* beginning of the current line for copy */
-    u32 *       p_buffer_start;                   /* conversion buffer start */
-    u32 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    p_gray =            p_vout->yuv.yuv.p_gray32;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-        }
-
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(400, 4);
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB32: color YUV 4:2:0 to RGB 4 Bpp
- *****************************************************************************/
-void _M( ConvertYUV420RGB32 )( YUV_ARGS_32BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_uval, i_vval;                           /* U and V samples */
-    int         i_red, i_green, i_blue;          /* U and V modified samples */
-    int         i_chroma_width;                              /* chroma width */
-    u32 *       p_yuv;                              /* base conversion table */
-    u32 *       p_ybase;                     /* Y dependant conversion table */
-    u32 *       p_pic_start;       /* beginning of the current line for copy */
-    u32 *       p_buffer_start;                   /* conversion buffer start */
-    u32 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_yuv =             p_vout->yuv.yuv.p_rgb32;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-        }
-
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(420, 4);
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB32: color YUV 4:2:2 to RGB 4 Bpp
- *****************************************************************************/
-void _M( ConvertYUV422RGB32 )( YUV_ARGS_32BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_uval, i_vval;                           /* U and V samples */
-    int         i_red, i_green, i_blue;          /* U and V modified samples */
-    int         i_chroma_width;                              /* chroma width */
-    u32 *       p_yuv;                              /* base conversion table */
-    u32 *       p_ybase;                     /* Y dependant conversion table */
-    u32 *       p_pic_start;       /* beginning of the current line for copy */
-    u32 *       p_buffer_start;                   /* conversion buffer start */
-    u32 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_yuv =             p_vout->yuv.yuv.p_rgb32;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-        }
-
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(422, 4);
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB32: color YUV 4:4:4 to RGB 4 Bpp
- *****************************************************************************/
-void _M( ConvertYUV444RGB32 )( YUV_ARGS_32BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_uval, i_vval;                           /* U and V samples */
-    int         i_red, i_green, i_blue;          /* U and V modified samples */
-    int         i_chroma_width;                    /* chroma width, not used */
-    u32 *       p_yuv;                              /* base conversion table */
-    u32 *       p_ybase;                     /* Y dependant conversion table */
-    u32 *       p_pic_start;       /* beginning of the current line for copy */
-    u32 *       p_buffer_start;                   /* conversion buffer start */
-    u32 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    p_yuv =             p_vout->yuv.yuv.p_rgb32;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-        }
-
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(444, 4);
-    }
-}
-
-static __inline__ void yuv2YCbCr422_inner( u8 *p_y, u8 *p_u, u8 *p_v,
-                                           u8 *p_out, int i_width_by_4 )
-{
-    int i_x;
-
-    for( i_x = 0 ; i_x < 4 * i_width_by_4 ; ++i_x )
-    {
-        *p_out++ = p_y[ 2 * i_x ];
-        *p_out++ = p_u[ i_x ];
-        *p_out++ = p_y[ 2 * i_x + 1 ];
-        *p_out++ = p_v[ i_x ];
-    }
-}
-
-void _M( ConvertYUV420YCbr8 )( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 420, YCbr = 8" );
-}
-
-void _M( ConvertYUV422YCbr8 )( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, YCbr = 8" );
-
-}
-
-void _M( ConvertYUV444YCbr8 )( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, YCbr = 8" );
-
-}
-
-/*****************************************************************************
- * yuv2YCbCr422: color YUV 4:2:0 to color YCbCr 16bpp
- *****************************************************************************/
-void _M( ConvertYUV420YCbr16 )( YUV_ARGS_16BPP )
-{
-    int i_y;
-
-    for( i_y = 0 ; i_y < i_height ; ++i_y )
-    {
-        yuv2YCbCr422_inner( p_y, p_u, p_v, (u8 *)p_pic, i_width / 8 );
-
-        p_pic += i_width * 2;
-        
-        p_y += i_width;
-
-        if( i_y & 0x1 )
-        {
-            p_u += i_width / 2;
-            p_v += i_width / 2;
-        }
-    }
-}
-
-void _M( ConvertYUV422YCbr16 )( YUV_ARGS_16BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, YCbr = 16" );
-
-}
-void _M( ConvertYUV444YCbr16 )( YUV_ARGS_16BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, YCbr = 16" );
-
-}
-
-void _M( ConvertYUV420YCbr24 )( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 420, YCbr = 24" );
-
-}
-
-void _M( ConvertYUV422YCbr24 )( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, YCbr = 24" );
-
-}
-
-void _M( ConvertYUV444YCbr24 )( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, YCbr = 24" );
-
-}
-
-void _M( ConvertYUV420YCbr32 )( YUV_ARGS_32BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 420, YCbr = 32" );
-
-}
-
-void _M( ConvertYUV422YCbr32 )( YUV_ARGS_32BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, YCbr = 32" );
-
-}
-void _M( ConvertYUV444YCbr32 )( YUV_ARGS_32BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, YCbr = 32" );
-
-}
-
diff --git a/plugins/yuv/transforms_yuv.h b/plugins/yuv/transforms_yuv.h
deleted file mode 100644 (file)
index b1fa9fe..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-/*****************************************************************************
- * transforms_yuv.h: C specific YUV transformation macros
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: transforms_yuv.h,v 1.3 2001/10/11 13:19:27 massiot Exp $
- *
- * Authors: Samuel Hocevar <sam@zoy.org>
- *
- * 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-1307, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * CONVERT_4YUV_PIXELS: dither 4 pixels in 8 bpp
- *****************************************************************************
- * These macros dither 4 pixels in 8 bpp
- *****************************************************************************/
-#define CONVERT_4YUV_PIXELS( CHROMA )                                         \
-    *p_pic++ = p_lookup[                                                      \
-        (((*p_y++ + dither10[i_real_y]) >> 4) << 7)                           \
-      + ((*p_u + dither20[i_real_y]) >> 5) * 9                                \
-      + ((*p_v + dither20[i_real_y]) >> 5) ];                                 \
-    *p_pic++ = p_lookup[                                                      \
-        (((*p_y++ + dither11[i_real_y]) >> 4) << 7)                           \
-      + ((*p_u++ + dither21[i_real_y]) >> 5) * 9                              \
-      + ((*p_v++ + dither21[i_real_y]) >> 5) ];                               \
-    *p_pic++ = p_lookup[                                                      \
-        (((*p_y++ + dither12[i_real_y]) >> 4) << 7)                           \
-      + ((*p_u + dither22[i_real_y]) >> 5) * 9                                \
-      + ((*p_v + dither22[i_real_y]) >> 5) ];                                 \
-    *p_pic++ = p_lookup[                                                      \
-        (((*p_y++ + dither13[i_real_y]) >> 4) << 7)                           \
-      + ((*p_u++ + dither23[i_real_y]) >> 5) * 9                              \
-      + ((*p_v++ + dither23[i_real_y]) >> 5) ];                               \
-
-/*****************************************************************************
- * CONVERT_4YUV_PIXELS_SCALE: dither and scale 4 pixels in 8 bpp
- *****************************************************************************
- * These macros dither 4 pixels in 8 bpp, with horizontal scaling
- *****************************************************************************/
-#define CONVERT_4YUV_PIXELS_SCALE( CHROMA )                                   \
-    *p_pic++ = p_lookup[                                                      \
-        ( ((*p_y + dither10[i_real_y]) >> 4) << 7)                            \
-        + ((*p_u + dither20[i_real_y]) >> 5) * 9                              \
-        + ((*p_v + dither20[i_real_y]) >> 5) ];                               \
-    p_y += *p_offset++;                                                       \
-    p_u += *p_offset;                                                         \
-    p_v += *p_offset++;                                                       \
-    *p_pic++ = p_lookup[                                                      \
-        ( ((*p_y + dither11[i_real_y]) >> 4) << 7)                            \
-        + ((*p_u + dither21[i_real_y]) >> 5) * 9                              \
-        + ((*p_v + dither21[i_real_y]) >> 5) ];                               \
-    p_y += *p_offset++;                                                       \
-    p_u += *p_offset;                                                         \
-    p_v += *p_offset++;                                                       \
-    *p_pic++ = p_lookup[                                                      \
-        ( ((*p_y + dither12[i_real_y]) >> 4) << 7)                            \
-        + ((*p_u + dither22[i_real_y]) >> 5) * 9                              \
-        + ((*p_v + dither22[i_real_y]) >> 5) ];                               \
-    p_y += *p_offset++;                                                       \
-    p_u += *p_offset;                                                         \
-    p_v += *p_offset++;                                                       \
-    *p_pic++ = p_lookup[                                                      \
-        ( ((*p_y + dither13[i_real_y]) >> 4) << 7)                            \
-        + ((*p_u + dither23[i_real_y]) >> 5) * 9                              \
-        + ((*p_v + dither23[i_real_y]) >> 5) ];                               \
-    p_y += *p_offset++;                                                       \
-    p_u += *p_offset;                                                         \
-    p_v += *p_offset++;                                                       \
-
-/*****************************************************************************
- * SCALE_WIDTH_DITHER: scale a line horizontally for dithered 8 bpp
- *****************************************************************************
- * This macro scales a line using an offset array.
- *****************************************************************************/
-#define SCALE_WIDTH_DITHER( CHROMA )                                          \
-    if( b_horizontal_scaling )                                                \
-    {                                                                         \
-        /* Horizontal scaling - we can't use a buffer due to dithering */     \
-        p_offset = p_offset_start;                                            \
-        for( i_x = i_pic_width / 16; i_x--; )                                 \
-        {                                                                     \
-            CONVERT_4YUV_PIXELS_SCALE( CHROMA )                               \
-            CONVERT_4YUV_PIXELS_SCALE( CHROMA )                               \
-            CONVERT_4YUV_PIXELS_SCALE( CHROMA )                               \
-            CONVERT_4YUV_PIXELS_SCALE( CHROMA )                               \
-        }                                                                     \
-    }                                                                         \
-    else                                                                      \
-    {                                                                         \
-        for( i_x = i_width / 16; i_x--;  )                                    \
-        {                                                                     \
-            CONVERT_4YUV_PIXELS( CHROMA )                                     \
-            CONVERT_4YUV_PIXELS( CHROMA )                                     \
-            CONVERT_4YUV_PIXELS( CHROMA )                                     \
-            CONVERT_4YUV_PIXELS( CHROMA )                                     \
-        }                                                                     \
-    }                                                                         \
-    /* Increment of picture pointer to end of line is still needed */         \
-    p_pic += i_pic_line_width;                                                \
-                                                                              \
-    /* Increment the Y coordinate in the matrix, modulo 4 */                  \
-    i_real_y = (i_real_y + 1) & 0x3;                                          \
-
-/*****************************************************************************
- * SCALE_HEIGHT_DITHER: handle vertical scaling for dithered 8 bpp
- *****************************************************************************
- * This macro handles vertical scaling for a picture. CHROMA may be 420,
- * 422 or 444 for RGB conversion, or 400 for gray conversion.
- *****************************************************************************/
-#define SCALE_HEIGHT_DITHER( CHROMA )                                         \
-                                                                              \
-    /* If line is odd, rewind 4:2:0 U and V samples */                        \
-    if( (CHROMA == 420) && !(i_y & 0x1) )                                     \
-    {                                                                         \
-        p_u -= i_chroma_width;                                                \
-        p_v -= i_chroma_width;                                                \
-    }                                                                         \
-                                                                              \
-    /*                                                                        \
-     * Handle vertical scaling. The current line can be copied or next one    \
-     * can be ignored.                                                        \
-     */                                                                       \
-                                                                              \
-    switch( i_vertical_scaling )                                              \
-    {                                                                         \
-    case -1:                             /* vertical scaling factor is < 1 */ \
-        while( (i_scale_count -= i_pic_height) > 0 )                          \
-        {                                                                     \
-            /* Height reduction: skip next source line */                     \
-            p_y += i_width;                                                   \
-            i_y++;                                                            \
-            if( CHROMA == 420 )                                               \
-            {                                                                 \
-                if( i_y & 0x1 )                                               \
-                {                                                             \
-                    p_u += i_chroma_width;                                    \
-                    p_v += i_chroma_width;                                    \
-                }                                                             \
-            }                                                                 \
-            else if( (CHROMA == 422) || (CHROMA == 444) )                     \
-            {                                                                 \
-                p_u += i_width;                                               \
-                p_v += i_width;                                               \
-            }                                                                 \
-        }                                                                     \
-        i_scale_count += i_height;                                            \
-        break;                                                                \
-    case 1:                              /* vertical scaling factor is > 1 */ \
-        while( (i_scale_count -= i_height) > 0 )                              \
-        {                                                                     \
-            p_y -= i_width;                                                   \
-            p_u -= i_chroma_width;                                            \
-            p_v -= i_chroma_width;                                            \
-            SCALE_WIDTH_DITHER( CHROMA );                                     \
-        }                                                                     \
-        i_scale_count += i_pic_height;                                        \
-        break;                                                                \
-    }                                                                         \
-
diff --git a/plugins/yuv/transforms_yuvmmx.c b/plugins/yuv/transforms_yuvmmx.c
deleted file mode 100644 (file)
index 6665794..0000000
+++ /dev/null
@@ -1,476 +0,0 @@
-/*****************************************************************************
- * transforms_yuvmmx.c: MMX YUV transformation functions
- * Provides functions to perform the YUV conversion.
- *****************************************************************************
- * Copyright (C) 1999-2001 VideoLAN
- * $Id: transforms_yuvmmx.c,v 1.7 2001/11/28 15:08:06 massiot Exp $
- *
- * Authors: Samuel Hocevar <sam@zoy.org>
- *
- * 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-1307, USA.
- *****************************************************************************/
-
-#define MODULE_NAME yuvmmx
-#include "modules_inner.h"
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <math.h>                                            /* exp(), pow() */
-#include <errno.h>                                                 /* ENOMEM */
-#include <stdlib.h>                                                /* free() */
-#include <string.h>                                            /* strerror() */
-
-#include "config.h"
-#include "common.h"
-#include "intf_msg.h"
-#include "threads.h"
-#include "mtime.h"
-
-#include "video.h"
-#include "video_output.h"
-
-#include "video_common.h"
-#include "transforms_common.h"
-#include "transforms_yuvmmx.h"
-
-#include "modules.h"
-#include "modules_export.h"
-
-/*****************************************************************************
- * ConvertY4Gray8: grayscale YUV 4:x:x to RGB 8 bpp
- *****************************************************************************/
-void _M( ConvertY4Gray8 )( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, grayscale, bpp = 8" );
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB8: color YUV 4:2:0 to RGB 8 bpp
- *****************************************************************************/
-void _M( ConvertYUV420RGB8 )( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 420, bpp = 8" );
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB8: color YUV 4:2:2 to RGB 8 bpp
- *****************************************************************************/
-void _M( ConvertYUV422RGB8 )( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, bpp = 8" );
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB8: color YUV 4:4:4 to RGB 8 bpp
- *****************************************************************************/
-void _M( ConvertYUV444RGB8 )( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, bpp = 8" );
-}
-
-/*****************************************************************************
- * ConvertY4Gray16: color YUV 4:4:4 to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertY4Gray16 )( YUV_ARGS_16BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_chroma_width;                              /* chroma width */
-    u16 *       p_pic_start;       /* beginning of the current line for copy */
-    u16 *       p_buffer_start;                   /* conversion buffer start */
-    u16 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        for ( i_x = i_width / 8; i_x--; )
-        {
-            __asm__( MMX_INIT_16_GRAY
-                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
-
-            __asm__( ".align 8"
-                     MMX_YUV_GRAY
-                     MMX_UNPACK_16_GRAY
-                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
-
-            p_y += 8;
-            p_u += 4;
-            p_v += 4;
-            p_buffer += 8;
-        }
-
-        SCALE_WIDTH;
-        SCALE_HEIGHT( 420, 2 );
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB16: color YUV 4:2:0 to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertYUV420RGB16 )( YUV_ARGS_16BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_chroma_width;                              /* chroma width */
-    u16 *       p_pic_start;       /* beginning of the current line for copy */
-    u16 *       p_buffer_start;                   /* conversion buffer start */
-    u16 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        for ( i_x = i_width / 8; i_x--; )
-        {
-            __asm__( MMX_INIT_16
-                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
-
-            __asm__( ".align 8"
-                     MMX_YUV_MUL
-                     MMX_YUV_ADD
-                     MMX_UNPACK_16
-                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
-
-            p_y += 8;
-            p_u += 4;
-            p_v += 4;
-            p_buffer += 8;
-        }
-        SCALE_WIDTH;
-        SCALE_HEIGHT( 420, 2 );
-      }
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB16: color YUV 4:2:2 to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertYUV422RGB16 )( YUV_ARGS_16BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, bpp = 16" );
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB16: color YUV 4:4:4 to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertYUV444RGB16 )( YUV_ARGS_16BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, bpp = 16" );
-}
-
-/*****************************************************************************
- * ConvertY4Gray24: grayscale YUV 4:x:x to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertY4Gray24 )( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, grayscale, bpp = 24" );
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB24: color YUV 4:2:0 to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertYUV420RGB24 )( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 420, bpp = 24" );
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB24: color YUV 4:2:2 to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertYUV422RGB24 )( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, bpp = 24" );
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB24: color YUV 4:4:4 to RGB 2 Bpp
- *****************************************************************************/
-void _M( ConvertYUV444RGB24 )( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, bpp = 24" );
-}
-
-/*****************************************************************************
- * ConvertY4Gray32: grayscale YUV 4:x:x to RGB 4 Bpp
- *****************************************************************************/
-void _M( ConvertY4Gray32 )( YUV_ARGS_32BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, grayscale, bpp = 32" );
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB32: color YUV 4:2:0 to RGB 4 Bpp
- *****************************************************************************/
-void _M( ConvertYUV420RGB32 )( YUV_ARGS_32BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_chroma_width;                              /* chroma width */
-    u32 *       p_pic_start;       /* beginning of the current line for copy */
-    u32 *       p_buffer_start;                   /* conversion buffer start */
-    u32 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        for ( i_x = i_width / 8; i_x--; )
-        {
-            __asm__( ".align 8"
-                     MMX_INIT_32
-                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
-
-            __asm__( ".align 8"
-                     MMX_YUV_MUL
-                     MMX_YUV_ADD
-                     MMX_UNPACK_32
-                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
-
-            p_y += 8;
-            p_u += 4;
-            p_v += 4;
-            p_buffer += 8;
-        }
-
-        SCALE_WIDTH;
-        SCALE_HEIGHT( 420, 4 );
-    }
-
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB32: color YUV 4:2:2 to RGB 4 Bpp
- *****************************************************************************/
-void _M( ConvertYUV422RGB32 )( YUV_ARGS_32BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, bpp = 32" );
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB32: color YUV 4:4:4 to RGB 4 Bpp
- *****************************************************************************/
-void _M( ConvertYUV444RGB32 )( YUV_ARGS_32BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, bpp = 32" );
-}
-
-/*****************************************************************************
- * ConvertYUV420YCbr8: color YUV 4:2:0 to YCbr 8 Bpp
- *****************************************************************************/
-void _M( ConvertYUV420YCbr8 )( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 420, YCbr = 8" );
-}
-
-/*****************************************************************************
- * ConvertYUV422YCbr8: color YUV 4:2:2 to YCbr 8 Bpp
- *****************************************************************************/
-void _M( ConvertYUV422YCbr8 )( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, YCbr = 8" );
-
-}
-
-/*****************************************************************************
- * ConvertYUV444YCbr8: color YUV 4:4:4 to YCbr 8 Bpp
- *****************************************************************************/
-void _M( ConvertYUV444YCbr8 )( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, YCbr = 8" );
-
-}
-
-/*****************************************************************************
- * ConvertYUV420YCbr16: color YUV 4:2:0 to YCbr 16 Bpp
- *****************************************************************************/
-void _M( ConvertYUV420YCbr16 )( YUV_ARGS_16BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_chroma_width;                              /* chroma width */
-    u16 *       p_pic_start;       /* beginning of the current line for copy */
-    u16 *       p_buffer_start;                   /* conversion buffer start */
-    u16 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        for ( i_x = i_width / 8; i_x--; )
-        {
-            __asm__( MMX_INIT_16
-                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
-
-            __asm__( ".align 8"
-                     MMX_YUV_YCBR_422
-                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
-
-            p_y += 8;
-            p_u += 4;
-            p_v += 4;
-            p_buffer += 8;
-        }
-        SCALE_WIDTH;
-        SCALE_HEIGHT( 420, 2 );
-  
-      }
-
-}
-
-/*****************************************************************************
- * ConvertYUV422YCbr8: color YUV 4:2:2 to YCbr 16 Bpp
- *****************************************************************************/
-void _M( ConvertYUV422YCbr16 )( YUV_ARGS_16BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, YCbr = 16" );
-
-}
-
-/*****************************************************************************
- * ConvertYUV424YCbr8: color YUV 4:4:4 to YCbr 16 Bpp
- *****************************************************************************/
-void _M( ConvertYUV444YCbr16 )( YUV_ARGS_16BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, YCbr = 16" );
-
-}
-
-/*****************************************************************************
- * ConvertYUV420YCbr24: color YUV 4:2:0 to YCbr 24 Bpp
- *****************************************************************************/
-void _M( ConvertYUV420YCbr24 )( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 420, YCbr = 24" );
-
-}
-
-/*****************************************************************************
- * ConvertYUV422YCbr24: color YUV 4:2:2 to YCbr 24 Bpp
- *****************************************************************************/
-void _M( ConvertYUV422YCbr24 )( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, YCbr = 24" );
-
-}
-
-/*****************************************************************************
- * ConvertYUV444YCbr24: color YUV 4:4:4 to YCbr 24 Bpp
- *****************************************************************************/
-void _M( ConvertYUV444YCbr24 )( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, YCbr = 24" );
-
-}
-
-/*****************************************************************************
- * ConvertYUV420YCbr32: color YUV 4:2:0 to YCbr 32 Bpp
- *****************************************************************************/
-void _M( ConvertYUV420YCbr32 )( YUV_ARGS_32BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 420, YCbr = 32" );
-
-}
-
-/*****************************************************************************
- * ConvertYUV422YCbr32: color YUV 4:2:2 to YCbr 32 Bpp
- *****************************************************************************/
-void _M( ConvertYUV422YCbr32 )( YUV_ARGS_32BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, YCbr = 32" );
-
-}
-
-/*****************************************************************************
- * ConvertYUV444YCbr32: color YUV 4:4:4 to YCbr 32 Bpp
- *****************************************************************************/
-void _M( ConvertYUV444YCbr32 )( YUV_ARGS_32BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, YCbr = 32" );
-
-}
-
diff --git a/plugins/yuv/transforms_yuvmmx.h b/plugins/yuv/transforms_yuvmmx.h
deleted file mode 100644 (file)
index 87aeb24..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-/*****************************************************************************
- * transforms_yuvmmx.h: MMX YUV transformation assembly
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: transforms_yuvmmx.h,v 1.6 2001/07/26 03:13:30 sam Exp $
- *
- * Authors: Olie Lho <ollie@sis.com.tw>
- *          Gaël Hendryckx <jimmy@via.ecp.fr>
- *          Samuel Hocevar <sam@zoy.org>
- *
- * 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-1307, USA.
- *****************************************************************************/
-
-/* hope these constant values are cache line aligned */
-#define UNUSED_LONGLONG(foo) \
-    static unsigned long long foo __asm__ (#foo) __attribute__((unused))
-UNUSED_LONGLONG(mmx_80w)     = 0x0080008000800080;
-UNUSED_LONGLONG(mmx_10w)     = 0x1010101010101010;
-UNUSED_LONGLONG(mmx_00ffw)   = 0x00ff00ff00ff00ff;
-UNUSED_LONGLONG(mmx_Y_coeff) = 0x253f253f253f253f;
-
-UNUSED_LONGLONG(mmx_U_green) = 0xf37df37df37df37d;
-UNUSED_LONGLONG(mmx_U_blue)  = 0x4093409340934093;
-UNUSED_LONGLONG(mmx_V_red)   = 0x3312331233123312;
-UNUSED_LONGLONG(mmx_V_green) = 0xe5fce5fce5fce5fc;
-
-UNUSED_LONGLONG(mmx_redmask) = 0xf8f8f8f8f8f8f8f8;
-UNUSED_LONGLONG(mmx_grnmask) = 0xfcfcfcfcfcfcfcfc;
-UNUSED_LONGLONG(mmx_grnshift)   = 0x03;
-UNUSED_LONGLONG(mmx_blueshift)  = 0x03;
-#undef UNUSED_LONGLONG
-
-#define MMX_INIT_16 "                                                       \n\
-movd      (%1), %%mm0       # Load 4 Cb       00 00 00 00 u3 u2 u1 u0       \n\
-movd      (%2), %%mm1       # Load 4 Cr       00 00 00 00 v3 v2 v1 v0       \n\
-pxor      %%mm4, %%mm4      # zero mm4                                      \n\
-movq      (%0), %%mm6       # Load 8 Y        Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0       \n\
-#movl      $0, (%3)         # cache preload for image                       \n\
-"
-
-#define MMX_INIT_16_GRAY "                                                  \n\
-movq      (%0), %%mm6       # Load 8 Y        Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0       \n\
-#movl      $0, (%3)         # cache preload for image                       \n\
-"
-
-#define MMX_INIT_32 "                                                       \n\
-movd      (%1), %%mm0       # Load 4 Cb       00 00 00 00 u3 u2 u1 u0       \n\
-movl      $0, (%3)          # cache preload for image                       \n\
-movd      (%2), %%mm1       # Load 4 Cr       00 00 00 00 v3 v2 v1 v0       \n\
-pxor      %%mm4, %%mm4      # zero mm4                                      \n\
-movq      (%0), %%mm6       # Load 8 Y        Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0       \n\
-"
-
-/*
- * Do the multiply part of the conversion for even and odd pixels,
- * register usage:
- * mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
- * mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd  pixels,
- * mm6 -> Y even, mm7 -> Y odd
- */
-
-#define MMX_YUV_MUL "                                                       \n\
-# convert the chroma part                                                   \n\
-punpcklbw %%mm4, %%mm0          # scatter 4 Cb    00 u3 00 u2 00 u1 00 u0   \n\
-punpcklbw %%mm4, %%mm1          # scatter 4 Cr    00 v3 00 v2 00 v1 00 v0   \n\
-psubsw    mmx_80w, %%mm0        # Cb -= 128                                 \n\
-psubsw    mmx_80w, %%mm1        # Cr -= 128                                 \n\
-psllw     $3, %%mm0             # Promote precision                         \n\
-psllw     $3, %%mm1             # Promote precision                         \n\
-movq      %%mm0, %%mm2          # Copy 4 Cb       00 u3 00 u2 00 u1 00 u0   \n\
-movq      %%mm1, %%mm3          # Copy 4 Cr       00 v3 00 v2 00 v1 00 v0   \n\
-pmulhw    mmx_U_green, %%mm2    # Mul Cb with green coeff -> Cb green       \n\
-pmulhw    mmx_V_green, %%mm3    # Mul Cr with green coeff -> Cr green       \n\
-pmulhw    mmx_U_blue, %%mm0     # Mul Cb -> Cblue 00 b3 00 b2 00 b1 00 b0   \n\
-pmulhw    mmx_V_red, %%mm1      # Mul Cr -> Cred  00 r3 00 r2 00 r1 00 r0   \n\
-paddsw    %%mm3, %%mm2          # Cb green + Cr green -> Cgreen             \n\
-                                                                            \n\
-# convert the luma part                                                     \n\
-psubusb   mmx_10w, %%mm6        # Y -= 16                                   \n\
-movq      %%mm6, %%mm7          # Copy 8 Y        Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0   \n\
-pand      mmx_00ffw, %%mm6      # get Y even      00 Y6 00 Y4 00 Y2 00 Y0   \n\
-psrlw     $8, %%mm7             # get Y odd       00 Y7 00 Y5 00 Y3 00 Y1   \n\
-psllw     $3, %%mm6             # Promote precision                         \n\
-psllw     $3, %%mm7             # Promote precision                         \n\
-pmulhw    mmx_Y_coeff, %%mm6    # Mul 4 Y even    00 y6 00 y4 00 y2 00 y0   \n\
-pmulhw    mmx_Y_coeff, %%mm7    # Mul 4 Y odd     00 y7 00 y5 00 y3 00 y1   \n\
-"
-
-#define MMX_YUV_YCBR_422 "                                                  \n\
-punpcklbw %%mm1, %%mm0                                                      \n\
-movq %%mm6, %%mm2                                                           \n\
-punpckhbw %%mm0, %%mm6                                                      \n\
-punpcklbw %%mm0, %%mm2                                                      \n\
-movq %%mm2, (%3)                                                            \n\
-movq %%mm6, 8(%3)                                                           \n\
-"
-
-/*
- * Do the addition part of the conversion for even and odd pixels,
- * register usage:
- * mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
- * mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd  pixels,
- * mm6 -> Y even, mm7 -> Y odd
- */
-
-#define MMX_YUV_ADD "                                                       \n\
-# Do horizontal and vertical scaling                                        \n\
-movq      %%mm0, %%mm3          # Copy Cblue                                \n\
-movq      %%mm1, %%mm4          # Copy Cred                                 \n\
-movq      %%mm2, %%mm5          # Copy Cgreen                               \n\
-paddsw    %%mm6, %%mm0          # Y even + Cblue  00 B6 00 B4 00 B2 00 B0   \n\
-paddsw    %%mm7, %%mm3          # Y odd  + Cblue  00 B7 00 B5 00 B3 00 B1   \n\
-paddsw    %%mm6, %%mm1          # Y even + Cred   00 R6 00 R4 00 R2 00 R0   \n\
-paddsw    %%mm7, %%mm4          # Y odd  + Cred   00 R7 00 R5 00 R3 00 R1   \n\
-paddsw    %%mm6, %%mm2          # Y even + Cgreen 00 G6 00 G4 00 G2 00 G0   \n\
-paddsw    %%mm7, %%mm5          # Y odd  + Cgreen 00 G7 00 G5 00 G3 00 G1   \n\
-                                                                            \n\
-# Limit RGB even to 0..255                                                  \n\
-packuswb  %%mm0, %%mm0          # B6 B4 B2 B0 / B6 B4 B2 B0                 \n\
-packuswb  %%mm1, %%mm1          # R6 R4 R2 R0 / R6 R4 R2 R0                 \n\
-packuswb  %%mm2, %%mm2          # G6 G4 G2 G0 / G6 G4 G2 G0                 \n\
-                                                                            \n\
-# Limit RGB odd to 0..255                                                   \n\
-packuswb  %%mm3, %%mm3          # B7 B5 B3 B1 / B7 B5 B3 B1                 \n\
-packuswb  %%mm4, %%mm4          # R7 R5 R3 R1 / R7 R5 R3 R1                 \n\
-packuswb  %%mm5, %%mm5          # G7 G5 G3 G1 / G7 G5 G3 G1                 \n\
-                                                                            \n\
-# Interleave RGB even and odd                                               \n\
-punpcklbw %%mm3, %%mm0          #                 B7 B6 B5 B4 B3 B2 B1 B0   \n\
-punpcklbw %%mm4, %%mm1          #                 R7 R6 R5 R4 R3 R2 R1 R0   \n\
-punpcklbw %%mm5, %%mm2          #                 G7 G6 G5 G4 G3 G2 G1 G0   \n\
-"
-
-/*
- * Grayscale case, only use Y
- */
-
-#define MMX_YUV_GRAY "                                                      \n\
-# convert the luma part                                                     \n\
-psubusb   mmx_10w, %%mm6                                                    \n\
-movq      %%mm6, %%mm7                                                      \n\
-pand      mmx_00ffw, %%mm6                                                  \n\
-psrlw     $8, %%mm7                                                         \n\
-psllw     $3, %%mm6                                                         \n\
-psllw     $3, %%mm7                                                         \n\
-pmulhw    mmx_Y_coeff, %%mm6                                                \n\
-pmulhw    mmx_Y_coeff, %%mm7                                                \n\
-packuswb  %%mm6, %%mm6                                                      \n\
-packuswb  %%mm7, %%mm7                                                      \n\
-punpcklbw %%mm7, %%mm6                                                      \n\
-"
-
-#define MMX_UNPACK_16_GRAY "                                                \n\
-movq      %%mm6, %%mm5                                                      \n\
-pand      mmx_redmask, %%mm6                                                \n\
-pand      mmx_grnmask, %%mm5                                                \n\
-movq      %%mm6, %%mm7                                                      \n\
-psrlw     mmx_blueshift, %%mm7                                              \n\
-pxor      %%mm3, %%mm3                                                      \n\
-movq      %%mm7, %%mm2                                                      \n\
-movq      %%mm5, %%mm0                                                      \n\
-punpcklbw %%mm3, %%mm5                                                      \n\
-punpcklbw %%mm6, %%mm7                                                      \n\
-psllw     mmx_blueshift, %%mm5                                              \n\
-por       %%mm5, %%mm7                                                      \n\
-movq      %%mm7, (%3)                                                       \n\
-punpckhbw %%mm3, %%mm0                                                      \n\
-punpckhbw %%mm6, %%mm2                                                      \n\
-psllw     mmx_blueshift, %%mm0                                              \n\
-movq      8(%0), %%mm6                                                      \n\
-por       %%mm0, %%mm2                                                      \n\
-movq      %%mm2, 8(%3)                                                      \n\
-"
-
-
-/*
- * convert RGB plane to RGB 16 bits,
- * mm0 -> B, mm1 -> R, mm2 -> G,
- * mm4 -> GB, mm5 -> AR pixel 4-7,
- * mm6 -> GB, mm7 -> AR pixel 0-3
- */
-
-#define MMX_UNPACK_16 "                                                     \n\
-# mask unneeded bits off                                                    \n\
-pand      mmx_redmask, %%mm0    # b7b6b5b4 b3______ b7b6b5b4 b3______       \n\
-pand      mmx_grnmask, %%mm2    # g7g6g5g4 g3g2____ g7g6g5g4 g3g2____       \n\
-pand      mmx_redmask, %%mm1    # r7r6r5r4 r3______ r7r6r5r4 r3______       \n\
-psrlw     mmx_blueshift,%%mm0   # ______b7 b6b5b4b3 ______b7 b6b5b4b3       \n\
-pxor      %%mm4, %%mm4          # zero mm4                                  \n\
-movq      %%mm0, %%mm5          # Copy B7-B0                                \n\
-movq      %%mm2, %%mm7          # Copy G7-G0                                \n\
-                                                                            \n\
-# convert rgb24 plane to rgb16 pack for pixel 0-3                           \n\
-punpcklbw %%mm4, %%mm2          # ________ ________ g7g6g5g4 g3g2____       \n\
-punpcklbw %%mm1, %%mm0          # r7r6r5r4 r3______ ______b7 b6b5b4b3       \n\
-psllw     mmx_blueshift,%%mm2   # ________ __g7g6g5 g4g3g2__ ________       \n\
-por       %%mm2, %%mm0          # r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3       \n\
-movq      8(%0), %%mm6          # Load 8 Y        Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0   \n\
-movq      %%mm0, (%3)           # store pixel 0-3                           \n\
-                                                                            \n\
-# convert rgb24 plane to rgb16 pack for pixel 0-3                           \n\
-punpckhbw %%mm4, %%mm7          # ________ ________ g7g6g5g4 g3g2____       \n\
-punpckhbw %%mm1, %%mm5          # r7r6r5r4 r3______ ______b7 b6b5b4b3       \n\
-psllw     mmx_blueshift,%%mm7   # ________ __g7g6g5 g4g3g2__ ________       \n\
-movd      4(%1), %%mm0          # Load 4 Cb       __ __ __ __ u3 u2 u1 u0   \n\
-por       %%mm7, %%mm5          # r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3       \n\
-movd      4(%2), %%mm1          # Load 4 Cr       __ __ __ __ v3 v2 v1 v0   \n\
-movq      %%mm5, 8(%3)          # store pixel 4-7                           \n\
-"
-
-/*
- * convert RGB plane to RGB packed format,
- * mm0 -> B, mm1 -> R, mm2 -> G, mm3 -> 0,
- * mm4 -> GB, mm5 -> AR pixel 4-7,
- * mm6 -> GB, mm7 -> AR pixel 0-3
- */
-
-#define MMX_UNPACK_32 "                                                     \n\
-pxor      %%mm3, %%mm3  # zero mm3                                          \n\
-movq      %%mm0, %%mm6  #                 B7 B6 B5 B4 B3 B2 B1 B0           \n\
-movq      %%mm1, %%mm7  #                 R7 R6 R5 R4 R3 R2 R1 R0           \n\
-movq      %%mm0, %%mm4  #                 B7 B6 B5 B4 B3 B2 B1 B0           \n\
-movq      %%mm1, %%mm5  #                 R7 R6 R5 R4 R3 R2 R1 R0           \n\
-punpcklbw %%mm2, %%mm6  #                 G3 B3 G2 B2 G1 B1 G0 B0           \n\
-punpcklbw %%mm3, %%mm7  #                 00 R3 00 R2 00 R1 00 R0           \n\
-punpcklwd %%mm7, %%mm6  #                 00 R1 B1 G1 00 R0 B0 G0           \n\
-movq      %%mm6, (%3)   # Store ARGB1 ARGB0                                 \n\
-movq      %%mm0, %%mm6  #                 B7 B6 B5 B4 B3 B2 B1 B0           \n\
-punpcklbw %%mm2, %%mm6  #                 G3 B3 G2 B2 G1 B1 G0 B0           \n\
-punpckhwd %%mm7, %%mm6  #                 00 R3 G3 B3 00 R2 B3 G2           \n\
-movq      %%mm6, 8(%3)  # Store ARGB3 ARGB2                                 \n\
-punpckhbw %%mm2, %%mm4  #                 G7 B7 G6 B6 G5 B5 G4 B4           \n\
-punpckhbw %%mm3, %%mm5  #                 00 R7 00 R6 00 R5 00 R4           \n\
-punpcklwd %%mm5, %%mm4  #                 00 R5 B5 G5 00 R4 B4 G4           \n\
-movq      %%mm4, 16(%3) # Store ARGB5 ARGB4                                 \n\
-movq      %%mm0, %%mm4  #                 B7 B6 B5 B4 B3 B2 B1 B0           \n\
-punpckhbw %%mm2, %%mm4  #                 G7 B7 G6 B6 G5 B5 G4 B4           \n\
-punpckhwd %%mm5, %%mm4  #                 00 R7 G7 B7 00 R6 B6 G6           \n\
-movq      %%mm4, 24(%3) # Store ARGB7 ARGB6                                 \n\
-                                                                            \n\
-#movd      4(%1), %%mm0  # Load 4 Cb       00 00 00 00 u3 u2 u1 u0           \n\
-#movd      4(%2), %%mm1  # Load 4 Cr       00 00 00 00 v3 v2 v1 v0           \n\
-#pxor      %%mm4, %%mm4  # zero mm4                                          \n\
-#movq      8(%0), %%mm6  # Load 8 Y        Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0           \n\
-"
-
diff --git a/plugins/yuv/video_common.h b/plugins/yuv/video_common.h
deleted file mode 100644 (file)
index 7d51c16..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*****************************************************************************
- * video_common.h: YUV transformation functions
- * Provides functions to perform the YUV conversion. The functions provided here
- * are a complete and portable C implementation, and may be replaced in certain
- * case by optimized functions.
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_common.h,v 1.4 2001/04/15 04:19:58 sam Exp $
- *
- * Authors: Vincent Seguin <seguin@via.ecp.fr>
- *
- * 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-1307, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Constants
- *****************************************************************************/
-
-/* Margins and offsets in conversion tables - Margins are used in case a RGB
- * RGB conversion would give a value outside the 0-255 range. Offsets have been
- * calculated to avoid using the same cache line for 2 tables. conversion tables
- * are 2*MARGIN + 256 long and stores pixels.*/
-#define RED_MARGIN      178
-#define GREEN_MARGIN    135
-#define BLUE_MARGIN     224
-#define RED_OFFSET      1501                                 /* 1323 to 1935 */
-#define GREEN_OFFSET    135                                      /* 0 to 526 */
-#define BLUE_OFFSET     818                                   /* 594 to 1298 */
-#define RGB_TABLE_SIZE  1935                             /* total table size */
-
-#define GRAY_MARGIN     384
-#define GRAY_TABLE_SIZE 1024                             /* total table size */
-
-#define PALETTE_TABLE_SIZE 2176          /* YUV -> 8bpp palette lookup table */
-
-/* macros used for YUV pixel conversions */
-#define SHIFT 20
-#define U_GREEN_COEF    ((int)(-0.391 * (1<<SHIFT) / 1.164))
-#define U_BLUE_COEF     ((int)(2.018 * (1<<SHIFT) / 1.164))
-#define V_RED_COEF      ((int)(1.596 * (1<<SHIFT) / 1.164))
-#define V_GREEN_COEF    ((int)(-0.813 * (1<<SHIFT) / 1.164))
-
-/* argument lists for YUV functions */
-#define YUV_ARGS( word_size ) p_vout_thread_t p_vout, word_size *p_pic, \
-yuv_data_t *p_y, yuv_data_t *p_u, yuv_data_t *p_v, int i_width, int i_height, \
-int i_pic_width, int i_pic_height, int i_pic_line_width, \
-int i_matrix_coefficients
-
-#define YUV_ARGS_8BPP    YUV_ARGS( u8 )
-#define YUV_ARGS_16BPP   YUV_ARGS( u16 )
-#define YUV_ARGS_24BPP   YUV_ARGS( u32 )
-#define YUV_ARGS_32BPP   YUV_ARGS( u32 )
-
-/*****************************************************************************
- * Extern prototypes
- *****************************************************************************/
-
-void _M( SetOffset )( int i_width, int i_height, int i_pic_width,
-                      int i_pic_height, boolean_t *pb_h_scaling,
-                      int *pi_v_scaling, int *p_offset, boolean_t b_double );
-
-void _M( ConvertY4Gray8 )     ( YUV_ARGS_8BPP );
-void _M( ConvertYUV420RGB8 )  ( YUV_ARGS_8BPP );
-void _M( ConvertYUV422RGB8 )  ( YUV_ARGS_8BPP );
-void _M( ConvertYUV444RGB8 )  ( YUV_ARGS_8BPP );
-
-void _M( ConvertY4Gray16 )    ( YUV_ARGS_16BPP );
-void _M( ConvertYUV420RGB16 ) ( YUV_ARGS_16BPP );
-void _M( ConvertYUV422RGB16 ) ( YUV_ARGS_16BPP );
-void _M( ConvertYUV444RGB16 ) ( YUV_ARGS_16BPP );
-
-void _M( ConvertY4Gray24 )    ( YUV_ARGS_24BPP );
-void _M( ConvertYUV420RGB24 ) ( YUV_ARGS_24BPP );
-void _M( ConvertYUV422RGB24 ) ( YUV_ARGS_24BPP );
-void _M( ConvertYUV444RGB24 ) ( YUV_ARGS_24BPP );
-
-void _M( ConvertY4Gray32 )    ( YUV_ARGS_32BPP );
-void _M( ConvertYUV420RGB32 ) ( YUV_ARGS_32BPP );
-void _M( ConvertYUV422RGB32 ) ( YUV_ARGS_32BPP );
-void _M( ConvertYUV444RGB32 ) ( YUV_ARGS_32BPP );
-
-void _M( ConvertYUV420YCbr8 )  ( YUV_ARGS_8BPP );
-void _M( ConvertYUV422YCbr8 )  ( YUV_ARGS_8BPP );
-void _M( ConvertYUV444YCbr8 )  ( YUV_ARGS_8BPP );
-
-void _M( ConvertYUV420YCbr16 )  ( YUV_ARGS_16BPP );
-void _M( ConvertYUV422YCbr16 )  ( YUV_ARGS_16BPP );
-void _M( ConvertYUV444YCbr16 )  ( YUV_ARGS_16BPP );
-
-void _M( ConvertYUV420YCbr24 )  ( YUV_ARGS_24BPP );
-void _M( ConvertYUV422YCbr24 )  ( YUV_ARGS_24BPP );
-void _M( ConvertYUV444YCbr24 )  ( YUV_ARGS_24BPP );
-
-void _M( ConvertYUV420YCbr32 )  ( YUV_ARGS_32BPP );
-void _M( ConvertYUV422YCbr32 )  ( YUV_ARGS_32BPP );
-void _M( ConvertYUV444YCbr32 )  ( YUV_ARGS_32BPP );
-
diff --git a/plugins/yuv/video_yuv.c b/plugins/yuv/video_yuv.c
deleted file mode 100644 (file)
index f613870..0000000
+++ /dev/null
@@ -1,643 +0,0 @@
-/*****************************************************************************
- * video_yuv.c: YUV transformation functions
- * Provides functions to perform the YUV conversion. The functions provided here
- * are a complete and portable C implementation, and may be replaced in certain
- * case by optimized functions.
- *****************************************************************************
- * Copyright (C) 1999-2001 VideoLAN
- * $Id: video_yuv.c,v 1.16 2001/11/28 15:08:06 massiot Exp $
- *
- * Authors: Vincent Seguin <seguin@via.ecp.fr>
- *
- * 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-1307, USA.
- *****************************************************************************/
-
-#define MODULE_NAME yuv
-#include "modules_inner.h"
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <math.h>                                            /* exp(), pow() */
-#include <errno.h>                                                 /* ENOMEM */
-#include <stdlib.h>                                                /* free() */
-#include <string.h>                                            /* strerror() */
-
-#include "config.h"
-#include "common.h"
-#include "intf_msg.h"
-#include "threads.h"
-#include "mtime.h"
-#include "tests.h"
-
-#include "video.h"
-#include "video_output.h"
-
-#include "video_common.h"
-
-#include "modules.h"
-#include "modules_export.h"
-
-static int     yuv_Probe      ( probedata_t *p_data );
-static int     yuv_Init       ( vout_thread_t *p_vout );
-static int     yuv_Reset      ( vout_thread_t *p_vout );
-static void    yuv_End        ( vout_thread_t *p_vout );
-
-static void    SetGammaTable  ( int *pi_table, double f_gamma );
-static void    SetYUV         ( vout_thread_t *p_vout );
-
-/*****************************************************************************
- * Functions exported as capabilities. They are declared as static so that
- * we don't pollute the namespace too much.
- *****************************************************************************/
-void _M( yuv_getfunctions )( function_list_t * p_function_list )
-{
-    p_function_list->pf_probe = yuv_Probe;
-    p_function_list->functions.yuv.pf_init = yuv_Init;
-    p_function_list->functions.yuv.pf_reset = yuv_Reset;
-    p_function_list->functions.yuv.pf_end = yuv_End;
-}
-
-/*****************************************************************************
- * yuv_Probe: tests probe the audio device and return a score
- *****************************************************************************
- * This function tries to open the DSP and returns a score to the plugin
- * manager so that it can choose the most appropriate one.
- *****************************************************************************/
-static int yuv_Probe( probedata_t *p_data )
-{
-    if( TestMethod( YUV_METHOD_VAR, "yuv" )
-         || TestMethod( YUV_METHOD_VAR, "c" ) )
-    {
-        return( 999 );
-    }
-
-    /* This module always works */
-    return( 50 );
-}
-
-/*****************************************************************************
- * yuv_Init: allocate and initialize translations tables
- *****************************************************************************
- * This function will allocate memory to store translation tables, depending
- * of the screen depth.
- *****************************************************************************/
-static int yuv_Init( vout_thread_t *p_vout )
-{
-    size_t      tables_size;                        /* tables size, in bytes */
-
-    /* Computes tables size - 3 Bpp use 32 bits pixel entries in tables */
-    switch( p_vout->i_bytes_per_pixel )
-    {
-    case 1:
-        tables_size = sizeof( u8 )
-                * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : PALETTE_TABLE_SIZE);
-        break;
-    case 2:
-        tables_size = sizeof( u16 )
-                * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
-        break;
-    case 3:
-    case 4:
-    default:
-        tables_size = sizeof( u32 )
-                * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
-        break;
-    }
-
-    /* Allocate memory */
-    p_vout->yuv.p_base = malloc( tables_size );
-    if( p_vout->yuv.p_base == NULL )
-    {
-        intf_ErrMsg("error: %s", strerror(ENOMEM));
-        return( 1 );
-    }
-
-    /* Allocate memory for conversion buffer and offset array */
-    p_vout->yuv.p_buffer = malloc( VOUT_MAX_WIDTH * p_vout->i_bytes_per_pixel );
-    if( p_vout->yuv.p_buffer == NULL )
-    {
-        intf_ErrMsg("error: %s", strerror(ENOMEM));
-        free( p_vout->yuv.p_base );
-        return( 1 );
-    }
-
-    /* In 8bpp we have a twice as big offset table because we also
-     * need the offsets for U and V (not only Y) */
-    p_vout->yuv.p_offset = malloc( p_vout->i_width * sizeof( int ) *
-                             ( ( p_vout->i_bytes_per_pixel == 1 ) ? 2 : 1 ) );
-    if( p_vout->yuv.p_offset == NULL )
-    {
-        intf_ErrMsg("error: %s", strerror(ENOMEM));
-        free( p_vout->yuv.p_base );
-        free( p_vout->yuv.p_buffer );
-        return( 1 );
-    }
-
-    /* Initialize tables */
-    SetYUV( p_vout );
-    return( 0 );
-}
-
-/*****************************************************************************
- * yuv_End: destroy translations tables
- *****************************************************************************
- * Free memory allocated by yuv_CCreate.
- *****************************************************************************/
-static void yuv_End( vout_thread_t *p_vout )
-{
-    free( p_vout->yuv.p_base );
-    free( p_vout->yuv.p_buffer );
-    free( p_vout->yuv.p_offset );
-}
-
-/*****************************************************************************
- * yuv_Reset: re-initialize translations tables
- *****************************************************************************
- * This function will initialize the tables allocated by vout_CreateTables and
- * set functions pointers.
- *****************************************************************************/
-static int yuv_Reset( vout_thread_t *p_vout )
-{
-    yuv_End( p_vout );
-    return( yuv_Init( p_vout ) );
-}
-
-/*****************************************************************************
- * SetGammaTable: return intensity table transformed by gamma curve.
- *****************************************************************************
- * pi_table is a table of 256 entries from 0 to 255.
- *****************************************************************************/
-static void SetGammaTable( int *pi_table, double f_gamma )
-{
-    int         i_y;                                       /* base intensity */
-
-    /* Use exp(gamma) instead of gamma */
-    f_gamma = exp( f_gamma );
-
-    /* Build gamma table */
-    for( i_y = 0; i_y < 256; i_y++ )
-    {
-        pi_table[ i_y ] = pow( (double)i_y / 256, f_gamma ) * 256;
-    }
- }
-
-/*****************************************************************************
- * SetYUV: compute tables and set function pointers
- *****************************************************************************/
-static void SetYUV( vout_thread_t *p_vout )
-{
-    int         pi_gamma[256];                                /* gamma table */
-    int         i_index;                                  /* index in tables */
-
-    /* Build gamma table */
-    SetGammaTable( pi_gamma, p_vout->f_gamma );
-
-    /*
-     * Set pointers and build YUV tables
-     */
-    if( p_vout->b_grayscale )
-    {
-        /* Grayscale: build gray table */
-        switch( p_vout->i_bytes_per_pixel )
-        {
-        case 1:
-            {
-                u16 bright[256], transp[256];
-
-                p_vout->yuv.yuv.p_gray8 =  (u8 *)p_vout->yuv.p_base + GRAY_MARGIN;
-                for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
-                {
-                    p_vout->yuv.yuv.p_gray8[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
-                    p_vout->yuv.yuv.p_gray8[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
-                }
-                for( i_index = 0; i_index < 256; i_index++)
-                {
-                    p_vout->yuv.yuv.p_gray8[ i_index ] = pi_gamma[ i_index ];
-                    bright[ i_index ] = i_index << 8;
-                    transp[ i_index ] = 0;
-                }
-                /* the colors have been allocated, we can set the palette */
-                p_vout->pf_setpalette( p_vout, bright, bright, bright, transp );
-                p_vout->i_white_pixel = 0xff;
-                p_vout->i_black_pixel = 0x00;
-                p_vout->i_gray_pixel = 0x44;
-                p_vout->i_blue_pixel = 0x3b;
-
-                break;
-            }
-        case 2:
-            p_vout->yuv.yuv.p_gray16 =  (u16 *)p_vout->yuv.p_base + GRAY_MARGIN;
-            for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
-            {
-                p_vout->yuv.yuv.p_gray16[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
-                p_vout->yuv.yuv.p_gray16[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
-            }
-            for( i_index = 0; i_index < 256; i_index++)
-            {
-                p_vout->yuv.yuv.p_gray16[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
-            }
-            break;
-        case 3:
-        case 4:
-            p_vout->yuv.yuv.p_gray32 =  (u32 *)p_vout->yuv.p_base + GRAY_MARGIN;
-            for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
-            {
-                p_vout->yuv.yuv.p_gray32[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
-                p_vout->yuv.yuv.p_gray32[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
-            }
-            for( i_index = 0; i_index < 256; i_index++)
-            {
-                p_vout->yuv.yuv.p_gray32[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
-            }
-            break;
-         }
-    }
-    else
-    {
-        /* Color: build red, green and blue tables */
-        switch( p_vout->i_bytes_per_pixel )
-        {
-        case 1:
-            {
-                #define RGB_MIN 0
-                #define RGB_MAX 255
-                #define CLIP( x ) ( ((x < 0) ? 0 : (x > 255) ? 255 : x) << 8 )
-
-                int y,u,v;
-                int r,g,b;
-                int uvr, uvg, uvb;
-                int i = 0, j = 0;
-                u16 red[256], green[256], blue[256], transp[256];
-                unsigned char lookup[PALETTE_TABLE_SIZE];
-
-                p_vout->yuv.yuv.p_rgb8 = (u8 *)p_vout->yuv.p_base;
-
-                /* this loop calculates the intersection of an YUV box
-                 * and the RGB cube. */
-                for ( y = 0; y <= 256; y += 16 )
-                {
-                    for ( u = 0; u <= 256; u += 32 )
-                    for ( v = 0; v <= 256; v += 32 )
-                    {
-                        uvr = (V_RED_COEF*(v-128)) >> SHIFT;
-                        uvg = (U_GREEN_COEF*(u-128) + V_GREEN_COEF*(v-128)) >> SHIFT;
-                        uvb = (U_BLUE_COEF*(u-128)) >> SHIFT;
-                        r = y + uvr;
-                        g = y + uvg;
-                        b = y + uvb;
-
-                        if( r >= RGB_MIN && g >= RGB_MIN && b >= RGB_MIN
-                                && r <= RGB_MAX && g <= RGB_MAX && b <= RGB_MAX )
-                        {
-                            /* this one should never happen unless someone fscked up my code */
-                            if(j == 256) { intf_ErrMsg( "vout error: no colors left to build palette" ); break; }
-
-                            /* clip the colors */
-                            red[j] = CLIP( r );
-                            green[j] = CLIP( g );
-                            blue[j] = CLIP( b );
-                            transp[j] = 0;
-
-                            /* allocate color */
-                            lookup[i] = 1;
-                            p_vout->yuv.yuv.p_rgb8[i++] = j;
-                            j++;
-                        }
-                        else
-                        {
-                            lookup[i] = 0;
-                            p_vout->yuv.yuv.p_rgb8[i++] = 0;
-                        }
-                    }
-                    i += 128-81;
-                }
-
-                /* the colors have been allocated, we can set the palette */
-                /* there will eventually be a way to know which colors
-                 * couldn't be allocated and try to find a replacement */
-                p_vout->pf_setpalette( p_vout, red, green, blue, transp );
-
-                p_vout->i_white_pixel = 0xff;
-                p_vout->i_black_pixel = 0x00;
-                p_vout->i_gray_pixel = 0x44;
-                p_vout->i_blue_pixel = 0x3b;
-
-                i = 0;
-                /* this loop allocates colors that got outside
-                 * the RGB cube */
-                for ( y = 0; y <= 256; y += 16 )
-                {
-                    for ( u = 0; u <= 256; u += 32 )
-                    for ( v = 0; v <= 256; v += 32 )
-                    {
-                        int u2, v2;
-                        int dist, mindist = 100000000;
-
-                        if( lookup[i] || y==0)
-                        {
-                            i++;
-                            continue;
-                        }
-
-                        /* heavy. yeah. */
-                        for( u2 = 0; u2 <= 256; u2 += 32 )
-                        for( v2 = 0; v2 <= 256; v2 += 32 )
-                        {
-                            j = ((y>>4)<<7) + (u2>>5)*9 + (v2>>5);
-                            dist = (u-u2)*(u-u2) + (v-v2)*(v-v2);
-                            if( lookup[j] )
-                            /* find the nearest color */
-                            if( dist < mindist )
-                            {
-                                p_vout->yuv.yuv.p_rgb8[i] = p_vout->yuv.yuv.p_rgb8[j];
-                                mindist = dist;
-                            }
-                            j -= 128;
-                            if( lookup[j] )
-                            /* find the nearest color */
-                            if( dist + 128 < mindist )
-                            {
-                                p_vout->yuv.yuv.p_rgb8[i] = p_vout->yuv.yuv.p_rgb8[j];
-                                mindist = dist + 128;
-                            }
-                        }
-                        i++;
-                    }
-                    i += 128-81;
-                }
-
-                break;
-            }
-        case 2:
-            p_vout->yuv.yuv.p_rgb16 = (u16 *)p_vout->yuv.p_base;
-            for( i_index = 0; i_index < RED_MARGIN; i_index++ )
-            {
-                p_vout->yuv.yuv.p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
-                p_vout->yuv.yuv.p_rgb16[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
-            }
-            for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
-            {
-                p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
-                p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
-            }
-            for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
-            {
-                p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
-                p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
-            }
-            for( i_index = 0; i_index < 256; i_index++ )
-            {
-                p_vout->yuv.yuv.p_rgb16[RED_OFFSET + i_index] =   RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
-                p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
-                p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
-            }
-            break;
-        case 3:
-        case 4:
-            p_vout->yuv.yuv.p_rgb32 = (u32 *)p_vout->yuv.p_base;
-            for( i_index = 0; i_index < RED_MARGIN; i_index++ )
-            {
-                p_vout->yuv.yuv.p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
-                p_vout->yuv.yuv.p_rgb32[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
-            }
-            for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
-            {
-                p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
-                p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
-            }
-            for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
-            {
-                p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
-                p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
-            }
-            for( i_index = 0; i_index < 256; i_index++ )
-            {
-                p_vout->yuv.yuv.p_rgb32[RED_OFFSET + i_index] =   RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
-                p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
-                p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
-            }
-            break;
-        }
-    }
-
-    /*
-     * Set functions pointers
-     */
-    if( p_vout->b_YCbr)
-    {
-        switch( p_vout->i_bytes_per_pixel)
-        {
-#define _X( foo ) (vout_yuv_convert_t *) _M( foo )
-        case 1:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420YCbr8 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422YCbr8 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444YCbr8 );
-            break;
-        
-        case 2:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420YCbr16 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422YCbr16 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444YCbr16 );
-           break;
-        
-        case 3:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420YCbr24 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422YCbr24 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444YCbr24 );
-             break;
-        
-        case 4:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420YCbr32 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422YCbr32 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444YCbr32 );
-            break;
-        }
-#undef _X
-    }    
-    else if( p_vout->b_grayscale )
-    {
-        /* Grayscale */
-        switch( p_vout->i_bytes_per_pixel )
-        {
-#define _X( foo ) (vout_yuv_convert_t *) _M( foo )
-        case 1:
-            p_vout->yuv.pf_yuv420 = _X( ConvertY4Gray8 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertY4Gray8 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertY4Gray8 );
-            break;
-        case 2:
-            p_vout->yuv.pf_yuv420 = _X( ConvertY4Gray16 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertY4Gray16 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertY4Gray16 );
-            break;
-        case 3:
-            p_vout->yuv.pf_yuv420 = _X( ConvertY4Gray24 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertY4Gray24 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertY4Gray24 );
-            break;
-        case 4:
-            p_vout->yuv.pf_yuv420 = _X( ConvertY4Gray32 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertY4Gray32 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertY4Gray32 );
-            break;
-#undef _X
-        }
-    }
-    else
-    {
-        /* Color */
-        switch( p_vout->i_bytes_per_pixel )
-        {
-#define _X( foo ) (vout_yuv_convert_t *) _M( foo )
-        case 1:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420RGB8 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422RGB8 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444RGB8 );
-            break;
-        case 2:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420RGB16 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422RGB16 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444RGB16 );
-            break;
-        case 3:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420RGB24 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422RGB24 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444RGB24 );
-            break;
-        case 4:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420RGB32 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422RGB32 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444RGB32 );
-            break;
-#undef _X
-      }
-    }
-}
-
-/*****************************************************************************
- * SetOffset: build offset array for conversion functions
- *****************************************************************************
- * This function will build an offset array used in later conversion functions.
- * It will also set horizontal and vertical scaling indicators. If b_double
- * is set, the p_offset structure has interleaved Y and U/V offsets.
- *****************************************************************************/
-void _M( SetOffset )( int i_width, int i_height, int i_pic_width,
-                      int i_pic_height, boolean_t *pb_h_scaling,
-                      int *pi_v_scaling, int *p_offset, boolean_t b_double )
-{
-    int i_x;                                    /* x position in destination */
-    int i_scale_count;                                     /* modulo counter */
-
-    /*
-     * Prepare horizontal offset array
-     */
-    if( i_pic_width - i_width == 0 )
-    {
-        /* No horizontal scaling: YUV conversion is done directly to picture */
-        *pb_h_scaling = 0;
-    }
-    else if( i_pic_width - i_width > 0 )
-    {
-        /* Prepare scaling array for horizontal extension */
-        *pb_h_scaling = 1;
-        i_scale_count = i_pic_width;
-        if( !b_double )
-        {
-            for( i_x = i_width; i_x--; )
-            {
-                while( (i_scale_count -= i_width) > 0 )
-                {
-                    *p_offset++ = 0;
-                }
-                *p_offset++ = 1;
-                i_scale_count += i_pic_width;
-            }
-        }
-        else
-        {
-            int i_dummy = 0;
-            for( i_x = i_width; i_x--; )
-            {
-                while( (i_scale_count -= i_width) > 0 )
-                {
-                    *p_offset++ = 0;
-                    *p_offset++ = 0;
-                }
-                *p_offset++ = 1;
-                *p_offset++ = i_dummy;
-                i_dummy = 1 - i_dummy;
-                i_scale_count += i_pic_width;
-            }
-        }
-    }
-    else /* if( i_pic_width - i_width < 0 ) */
-    {
-        /* Prepare scaling array for horizontal reduction */
-        *pb_h_scaling = 1;
-        i_scale_count = i_width;
-        if( !b_double )
-        {
-           for( i_x = i_pic_width; i_x--; )
-            {
-                *p_offset = 1;
-                while( (i_scale_count -= i_pic_width) > 0 )
-                {
-                    *p_offset += 1;
-                }
-                p_offset++;
-                i_scale_count += i_width;
-            }
-        }
-        else
-        {
-            int i_remainder = 0;
-            int i_jump;
-            for( i_x = i_pic_width; i_x--; )
-            {
-                i_jump = 1;
-                while( (i_scale_count -= i_pic_width) > 0 )
-                {
-                    i_jump += 1;
-                }
-                *p_offset++ = i_jump;
-                *p_offset++ = ( i_jump += i_remainder ) >> 1;
-                i_remainder = i_jump & 1;
-                i_scale_count += i_width;
-            }
-        }
-     }
-
-    /*
-     * Set vertical scaling indicator
-     */
-    if( i_pic_height - i_height == 0 )
-    {
-        *pi_v_scaling = 0;
-    }
-    else if( i_pic_height - i_height > 0 )
-    {
-        *pi_v_scaling = 1;
-    }
-    else /* if( i_pic_height - i_height < 0 ) */
-    {
-        *pi_v_scaling = -1;
-    }
-}
-
diff --git a/plugins/yuv/video_yuvmmx.c b/plugins/yuv/video_yuvmmx.c
deleted file mode 100644 (file)
index c62c925..0000000
+++ /dev/null
@@ -1,489 +0,0 @@
-/*****************************************************************************
- * video_yuvmmx.c: MMX YUV transformation functions
- * Provides functions to perform the YUV conversion.
- *****************************************************************************
- * Copyright (C) 1999-2001 VideoLAN
- * $Id: video_yuvmmx.c,v 1.13 2001/11/28 15:08:06 massiot Exp $
- *
- * Authors: Samuel Hocevar <sam@zoy.org>
- *
- * 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-1307, USA.
- *****************************************************************************/
-
-#define MODULE_NAME yuvmmx
-#include "modules_inner.h"
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <math.h>                                            /* exp(), pow() */
-#include <errno.h>                                                 /* ENOMEM */
-#include <stdlib.h>                                                /* free() */
-#include <string.h>                                            /* strerror() */
-
-#include "config.h"
-#include "common.h"
-#include "intf_msg.h"
-#include "threads.h"
-#include "mtime.h"
-#include "tests.h"
-
-#include "video.h"
-#include "video_output.h"
-
-#include "video_common.h"
-
-#include "modules.h"
-#include "modules_export.h"
-
-static int     yuv_Probe      ( probedata_t *p_data );
-static int     yuv_Init       ( vout_thread_t *p_vout );
-static int     yuv_Reset      ( vout_thread_t *p_vout );
-static void    yuv_End        ( vout_thread_t *p_vout );
-
-static void    SetYUV         ( vout_thread_t *p_vout );
-
-/*****************************************************************************
- * Functions exported as capabilities. They are declared as static so that
- * we don't pollute the namespace too much.
- *****************************************************************************/
-void _M( yuv_getfunctions )( function_list_t * p_function_list )
-{
-    p_function_list->pf_probe = yuv_Probe;
-    p_function_list->functions.yuv.pf_init = yuv_Init;
-    p_function_list->functions.yuv.pf_reset = yuv_Reset;
-    p_function_list->functions.yuv.pf_end = yuv_End;
-}
-
-/*****************************************************************************
- * yuv_Probe: tests probe the audio device and return a score
- *****************************************************************************
- * This function tries to open the DSP and returns a score to the plugin
- * manager so that it can choose the most appropriate one.
- *****************************************************************************/
-static int yuv_Probe( probedata_t *p_data )
-{
-    /* Test for MMX support in the CPU */
-    if( !TestCPU( CPU_CAPABILITY_MMX ) )
-    {
-        return( 0 );
-    }
-
-    if( TestMethod( YUV_METHOD_VAR, "yuvmmx" )
-         || TestMethod( YUV_METHOD_VAR, "mmx" ) )
-    {
-        return( 999 );
-    }
-
-    return( 100 );
-}
-
-/*****************************************************************************
- * yuv_Init: allocate and initialize translations tables
- *****************************************************************************
- * This function will allocate memory to store translation tables, depending
- * of the screen depth.
- *****************************************************************************/
-static int yuv_Init( vout_thread_t *p_vout )
-{
-    size_t      tables_size;                        /* tables size, in bytes */
-
-    /* Computes tables size for 8bbp only */
-    if( p_vout->i_bytes_per_pixel == 1 )
-    {
-        tables_size = sizeof( u8 )
-                * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : PALETTE_TABLE_SIZE);
-
-        /* Allocate memory */
-        p_vout->yuv.p_base = malloc( tables_size );
-        if( p_vout->yuv.p_base == NULL )
-        {
-            intf_ErrMsg("error: %s", strerror(ENOMEM));
-            return( 1 );
-        }
-    }
-    else
-    {
-        p_vout->yuv.p_base = NULL;
-    }
-
-    /* Allocate memory for conversion buffer and offset array */
-    p_vout->yuv.p_buffer = malloc( VOUT_MAX_WIDTH * p_vout->i_bytes_per_pixel );
-    if( p_vout->yuv.p_buffer == NULL )
-    {
-        intf_ErrMsg("error: %s", strerror(ENOMEM));
-        if( p_vout->yuv.p_base )
-            free( p_vout->yuv.p_base );
-        return( 1 );
-    }
-    p_vout->yuv.p_offset = malloc( p_vout->i_width * sizeof( int ) );
-    if( p_vout->yuv.p_offset == NULL )
-    {
-        intf_ErrMsg("error: %s", strerror(ENOMEM));
-        if( p_vout->yuv.p_base )
-            free( p_vout->yuv.p_base );
-        free( p_vout->yuv.p_buffer );
-        return( 1 );
-    }
-
-    /* Initialize tables */
-    SetYUV( p_vout );
-    return( 0 );
-}
-
-/*****************************************************************************
- * yuv_End: destroy translations tables
- *****************************************************************************
- * Free memory allocated by yuv_CCreate.
- *****************************************************************************/
-static void yuv_End( vout_thread_t *p_vout )
-{
-    if( p_vout->yuv.p_base )
-        free( p_vout->yuv.p_base );
-    free( p_vout->yuv.p_buffer );
-    free( p_vout->yuv.p_offset );
-}
-
-/*****************************************************************************
- * yuv_Reset: re-initialize translations tables
- *****************************************************************************
- * This function will initialize the tables allocated by vout_CreateTables and
- * set functions pointers.
- *****************************************************************************/
-static int yuv_Reset( vout_thread_t *p_vout )
-{
-    yuv_End( p_vout );
-    return( yuv_Init( p_vout ) );
-}
-
-/*****************************************************************************
- * SetYUV: compute tables and set function pointers
- *****************************************************************************/
-static void SetYUV( vout_thread_t *p_vout )
-{
-    int         i_index;                                  /* index in tables */
-
-    /*
-     * Set pointers and build YUV tables
-     */
-    if( p_vout->b_grayscale )
-    {
-        /* Grayscale: build gray table */
-        if( p_vout->i_bytes_per_pixel == 1 )
-        {
-            u16 bright[256], transp[256];
-
-            for( i_index = 0; i_index < 256; i_index++)
-            {
-                bright[ i_index ] = i_index << 8;
-                transp[ i_index ] = 0;
-            }
-            /* the colors have been allocated, we can set the palette */
-            p_vout->pf_setpalette( p_vout, bright, bright, bright, transp );
-            p_vout->i_white_pixel = 0xff;
-            p_vout->i_black_pixel = 0x00;
-            p_vout->i_gray_pixel = 0x44;
-            p_vout->i_blue_pixel = 0x3b;
-        }
-    }
-    else
-    {
-        /* Color: build red, green and blue tables */
-        if( p_vout->i_bytes_per_pixel == 1 )
-        {
-            #define RGB_MIN 0
-            #define RGB_MAX 255
-            #define CLIP( x ) ( ((x < 0) ? 0 : (x > 255) ? 255 : x) << 8 )
-            #define SHIFT 20
-            #define U_GREEN_COEF    ((int)(-0.391 * (1<<SHIFT) / 1.164))
-            #define U_BLUE_COEF     ((int)(2.018 * (1<<SHIFT) / 1.164))
-            #define V_RED_COEF      ((int)(1.596 * (1<<SHIFT) / 1.164))
-            #define V_GREEN_COEF    ((int)(-0.813 * (1<<SHIFT) / 1.164))
-
-            int y,u,v;
-            int r,g,b;
-            int uvr, uvg, uvb;
-            int i = 0, j = 0;
-            u16 red[256], green[256], blue[256], transp[256];
-            unsigned char lookup[PALETTE_TABLE_SIZE];
-
-            p_vout->yuv.yuv.p_rgb8 = (u8 *)p_vout->yuv.p_base;
-
-            /* this loop calculates the intersection of an YUV box
-             * and the RGB cube. */
-            for ( y = 0; y <= 256; y += 16 )
-            {
-                for ( u = 0; u <= 256; u += 32 )
-                for ( v = 0; v <= 256; v += 32 )
-                {
-                    uvr = (V_RED_COEF*(v-128)) >> SHIFT;
-                    uvg = (U_GREEN_COEF*(u-128) + V_GREEN_COEF*(v-128)) >> SHIFT;
-                    uvb = (U_BLUE_COEF*(u-128)) >> SHIFT;
-                    r = y + uvr;
-                    g = y + uvg;
-                    b = y + uvb;
-
-                    if( r >= RGB_MIN && g >= RGB_MIN && b >= RGB_MIN
-                            && r <= RGB_MAX && g <= RGB_MAX && b <= RGB_MAX )
-                    {
-                        /* this one should never happen unless someone fscked up my code */
-                        if(j == 256) { intf_ErrMsg( "vout error: no colors left to build palette" ); break; }
-
-                        /* clip the colors */
-                        red[j] = CLIP( r );
-                        green[j] = CLIP( g );
-                        blue[j] = CLIP( b );
-                        transp[j] = 0;
-
-                        /* allocate color */
-                        lookup[i] = 1;
-                        p_vout->yuv.yuv.p_rgb8[i++] = j;
-                        j++;
-                    }
-                    else
-                    {
-                        lookup[i] = 0;
-                        p_vout->yuv.yuv.p_rgb8[i++] = 0;
-                    }
-                }
-                i += 128-81;
-            }
-
-            /* the colors have been allocated, we can set the palette */
-            /* there will eventually be a way to know which colors
-             * couldn't be allocated and try to find a replacement */
-            p_vout->pf_setpalette( p_vout, red, green, blue, transp );
-
-            p_vout->i_white_pixel = 0xff;
-            p_vout->i_black_pixel = 0x00;
-            p_vout->i_gray_pixel = 0x44;
-            p_vout->i_blue_pixel = 0x3b;
-
-            i = 0;
-            /* this loop allocates colors that got outside
-             * the RGB cube */
-            for ( y = 0; y <= 256; y += 16 )
-            {
-                for ( u = 0; u <= 256; u += 32 )
-                {
-                    for ( v = 0; v <= 256; v += 32 )
-                    {
-                        int u2, v2;
-                        int dist, mindist = 100000000;
-
-                        if( lookup[i] || y==0)
-                        {
-                            i++;
-                            continue;
-                        }
-
-                        /* heavy. yeah. */
-                        for( u2 = 0; u2 <= 256; u2 += 32 )
-                        for( v2 = 0; v2 <= 256; v2 += 32 )
-                        {
-                            j = ((y>>4)<<7) + (u2>>5)*9 + (v2>>5);
-                            dist = (u-u2)*(u-u2) + (v-v2)*(v-v2);
-                            if( lookup[j] )
-                            /* find the nearest color */
-                            if( dist < mindist )
-                            {
-                                p_vout->yuv.yuv.p_rgb8[i] = p_vout->yuv.yuv.p_rgb8[j];
-                                mindist = dist;
-                            }
-                            j -= 128;
-                            if( lookup[j] )
-                            /* find the nearest color */
-                            if( dist + 128 < mindist )
-                            {
-                                p_vout->yuv.yuv.p_rgb8[i] = p_vout->yuv.yuv.p_rgb8[j];
-                                mindist = dist + 128;
-                            }
-                        }
-                        i++;
-                    }
-                }
-                i += 128-81;
-            }
-        }
-    }
-
-    /*
-     * Set functions pointers
-     */
-    if( p_vout->b_YCbr)
-    {
-        switch( p_vout->i_bytes_per_pixel)
-        {
-#define _X( foo ) (vout_yuv_convert_t *) _M( foo )
-        case 1:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420YCbr8 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422YCbr8 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444YCbr8 );
-            break;
-        
-        case 2:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420YCbr16 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422YCbr16 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444YCbr16 );
-            break;
-        
-        case 3:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420YCbr24 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422YCbr24 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444YCbr24 );
-            break;
-        
-        case 4:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420YCbr32 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422YCbr32 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444YCbr32 );
-            break;
-#undef _X
-        }
-    }    
-    else if( p_vout->b_grayscale )
-    {
-        /* Grayscale */
-        switch( p_vout->i_bytes_per_pixel )
-        {
-#define _X( foo ) (vout_yuv_convert_t *) _M( foo )
-        case 1:
-            p_vout->yuv.pf_yuv420 = _X( ConvertY4Gray8 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertY4Gray8 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertY4Gray8 );
-            break;
-        case 2:
-            p_vout->yuv.pf_yuv420 = _X( ConvertY4Gray16 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertY4Gray16 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertY4Gray16 );
-            break;
-        case 3:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420RGB24 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertY4Gray24 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertY4Gray24 );
-            break;
-        case 4:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420RGB32 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertY4Gray32 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertY4Gray32 );
-            break;
-#undef _X
-        }
-    }
-    else
-    {
-        /* Color */
-        switch( p_vout->i_bytes_per_pixel )
-        {
-#define _X( foo ) (vout_yuv_convert_t *) _M( foo )
-        case 1:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420RGB8 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422RGB8 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444RGB8 );
-            break;
-        case 2:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420RGB16 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422RGB16 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444RGB16 );
-            break;
-        case 3:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420RGB24 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422RGB24 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444RGB24 );
-            break;
-        case 4:
-            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420RGB32 );
-            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422RGB32 );
-            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444RGB32 );
-            break;
-#undef _X
-        }
-    }
-}
-
-/*****************************************************************************
- * SetOffset: build offset array for conversion functions
- *****************************************************************************
- * This function will build an offset array used in later conversion functions.
- * It will also set horizontal and vertical scaling indicators. If b_double
- * is set, the p_offset structure has interleaved Y and U/V offsets.
- *****************************************************************************/
-void _M( SetOffset )( int i_width, int i_height, int i_pic_width,
-                      int i_pic_height, boolean_t *pb_h_scaling,
-                      int *pi_v_scaling, int *p_offset, boolean_t b_double )
-{
-    int i_x;                                    /* x position in destination */
-    int i_scale_count;                                     /* modulo counter */
-
-    /*
-     * Prepare horizontal offset array
-     */
-    if( i_pic_width - i_width == 0 )
-    {
-        /* No horizontal scaling: YUV conversion is done directly to picture */
-        *pb_h_scaling = 0;
-    }
-    else if( i_pic_width - i_width > 0 )
-    {
-        /* Prepare scaling array for horizontal extension */
-        *pb_h_scaling =  1;
-        i_scale_count =  i_pic_width;
-        for( i_x = i_width; i_x--; )
-        {
-            while( (i_scale_count -= i_width) > 0 )
-            {
-                *p_offset++ = 0;
-            }
-            *p_offset++ = 1;
-            i_scale_count += i_pic_width;
-        }
-    }
-    else /* if( i_pic_width - i_width < 0 ) */
-    {
-        /* Prepare scaling array for horizontal reduction */
-        *pb_h_scaling =  1;
-        i_scale_count =  i_width;
-        for( i_x = i_pic_width; i_x--; )
-        {
-            *p_offset = 1;
-            while( (i_scale_count -= i_pic_width) > 0 )
-            {
-                *p_offset += 1;
-            }
-            p_offset++;
-            i_scale_count += i_width;
-        }
-    }
-
-    /*
-     * Set vertical scaling indicator
-     */
-    if( i_pic_height - i_height == 0 )
-    {
-        *pi_v_scaling = 0;
-    }
-    else if( i_pic_height - i_height > 0 )
-    {
-        *pi_v_scaling = 1;
-    }
-    else /* if( i_pic_height - i_height < 0 ) */
-    {
-        *pi_v_scaling = -1;
-    }
-}
-
diff --git a/plugins/yuv/yuv.c b/plugins/yuv/yuv.c
deleted file mode 100644 (file)
index ededd4a..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*****************************************************************************
- * yuv.c : C YUV module for vlc
- *****************************************************************************
- * Copyright (C) 2000-2001 VideoLAN
- * $Id: yuv.c,v 1.9 2001/11/28 15:08:06 massiot Exp $
- *
- * Authors: Vincent Seguin <seguin@via.ecp.fr>
- *
- * 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.
- *****************************************************************************/
-
-#define MODULE_NAME yuv
-#include "modules_inner.h"
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-
-#include "config.h"
-#include "common.h"                                     /* boolean_t, byte_t */
-#include "intf_msg.h"
-#include "threads.h"
-#include "mtime.h"
-
-#include "video.h"
-#include "video_output.h"
-
-#include "modules.h"
-#include "modules_export.h"
-
-/*****************************************************************************
- * Local and extern prototypes.
- *****************************************************************************/
-void _M( yuv_getfunctions )( function_list_t * p_function_list );
-
-/*****************************************************************************
- * Build configuration tree.
- *****************************************************************************/
-MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for YUV module" )
-    ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
-MODULE_CONFIG_STOP
-
-MODULE_INIT_START
-    p_module->i_capabilities = MODULE_CAPABILITY_NULL
-                                | MODULE_CAPABILITY_YUV;
-    p_module->psz_longname = "YUV transformations module";
-MODULE_INIT_STOP
-
-MODULE_ACTIVATE_START
-    _M( yuv_getfunctions )( &p_module->p_functions->yuv );
-MODULE_ACTIVATE_STOP
-
-MODULE_DEACTIVATE_START
-MODULE_DEACTIVATE_STOP
-
diff --git a/plugins/yuv/yuvmmx.c b/plugins/yuv/yuvmmx.c
deleted file mode 100644 (file)
index 8ca8574..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*****************************************************************************
- * yuvmmx.c : Accelerated MMX YUV module for vlc
- *****************************************************************************
- * Copyright (C) 2000-2001 VideoLAN
- * $Id: yuvmmx.c,v 1.7 2001/11/28 15:08:06 massiot Exp $
- *
- * Authors: Samuel Hocevar <sam@zoy.org>
- *
- * 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.
- *****************************************************************************/
-
-#define MODULE_NAME yuvmmx
-#include "modules_inner.h"
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-
-#include "config.h"
-#include "common.h"                                     /* boolean_t, byte_t */
-#include "intf_msg.h"
-#include "threads.h"
-#include "mtime.h"
-
-#include "video.h"
-#include "video_output.h"
-
-#include "modules.h"
-#include "modules_export.h"
-
-/*****************************************************************************
- * Local and extern prototypes.
- *****************************************************************************/
-void _M( yuv_getfunctions )( function_list_t * p_function_list );
-
-/*****************************************************************************
- * Build configuration tree.
- *****************************************************************************/
-MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for MMX YUV module" )
-    ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
-MODULE_CONFIG_STOP
-
-MODULE_INIT_START
-    p_module->i_capabilities = MODULE_CAPABILITY_NULL
-                                | MODULE_CAPABILITY_YUV;
-    p_module->psz_longname = "MMX YUV transformations module";
-MODULE_INIT_STOP
-
-MODULE_ACTIVATE_START
-    _M( yuv_getfunctions )( &p_module->p_functions->yuv );
-MODULE_ACTIVATE_STOP
-
-MODULE_DEACTIVATE_START
-MODULE_DEACTIVATE_STOP
-
index 9bafc42073cfe7fd9ec02de313c37bb54455773a..d6b2c17b9fb8fd3f1f0dd7fc29af9bbff240b961 100644 (file)
@@ -2,7 +2,7 @@
  * aout_s8.c: 8 bit signed audio output functions
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: aout_s8.c,v 1.3 2001/11/28 15:08:06 massiot Exp $
+ * $Id: aout_s8.c,v 1.4 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *
@@ -30,7 +30,6 @@
 #include <stdlib.h>                            /* calloc(), malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 #include "threads.h"
index 58de1de0b74553afc7660a9a65234511955a06e7..cd5d80de30dd9543a4ee575f8d39eb9fba53fe98 100644 (file)
@@ -2,7 +2,7 @@
  * aout_spdif: ac3 passthrough output
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: aout_spdif.c,v 1.19 2001/11/28 15:08:06 massiot Exp $
+ * $Id: aout_spdif.c,v 1.20 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -31,7 +31,6 @@
 #include <stdlib.h>                            /* calloc(), malloc(), free() */
 #include <string.h>                                              /* memset() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 #include "threads.h"
index 68b053b645fed3e09b7e1586b2de79d79f6dbdbe..0bcb338f4c3ce5308d8f9bc10b5409a0d94543b6 100644 (file)
@@ -2,7 +2,7 @@
  * aout_u16.c: 16 bit unsigned audio output functions
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: aout_u16.c,v 1.3 2001/11/28 15:08:06 massiot Exp $
+ * $Id: aout_u16.c,v 1.4 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *
@@ -30,7 +30,6 @@
 #include <stdlib.h>                            /* calloc(), malloc(), free() */
 #include <string.h>
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 #include "threads.h"
index c8307c98f1ee83d7fa8e6afdc2277f724a95adc5..6fb12d3887ed0667f17543ecc94aed12f3e4643c 100644 (file)
@@ -2,7 +2,7 @@
  * input_dec.c: Functions for the management of decoders
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: input_dec.c,v 1.19 2001/12/03 16:18:37 sam Exp $
+ * $Id: input_dec.c,v 1.20 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -30,7 +30,6 @@
 #include <string.h>                                    /* memcpy(), memset() */
 #include <sys/types.h>                                              /* off_t */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index 013a8c0cd8fd6f7ee433dc9b1ade73f0b2885166..c8a0a127cfb53b4934a60e753708dbe3e4757f06 100644 (file)
@@ -2,7 +2,7 @@
  * input_ext-dec.c: services to the decoders
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input_ext-dec.c,v 1.21 2001/11/28 15:08:06 massiot Exp $
+ * $Id: input_ext-dec.c,v 1.22 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -29,7 +29,6 @@
 #include <string.h>                                    /* memcpy(), memset() */
 #include <sys/types.h>                                              /* off_t */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index 60d3683cafde0a7245d5e347b4c62a5da6e1a95b..1c08b7aacfb930a5760f9d3ac8d5135694090ede 100644 (file)
@@ -2,7 +2,7 @@
  * input_ext-intf.c: services to the interface
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input_ext-intf.c,v 1.30 2001/12/07 16:47:47 jobi Exp $
+ * $Id: input_ext-intf.c,v 1.31 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -29,7 +29,6 @@
 #include <string.h>                                    /* memcpy(), memset() */
 #include <sys/types.h>                                              /* off_t */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index 4437675899a70d4a5c32f94d22b310f9747775d7..b63aa853f281793ad2d99de11edf299dd518881a 100644 (file)
@@ -6,7 +6,7 @@
  * will only be given back to netlist when refcount is zero.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input_netlist.c,v 1.47 2001/12/03 17:34:08 stef Exp $
+ * $Id: input_netlist.c,v 1.48 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Henri Fallon <henri@videolan.org>
  *          Stéphane Borel <stef@videolan.org>
@@ -45,7 +45,6 @@
 #   include <sys/uio.h>                                      /* struct iovec */
 #endif
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"                                           /* intf_*Msg */
 #include "threads.h"                                                /* mutex */
index c6374a2df98e65810769b3022ad10f898bb167aa..baf7f5dbbca005e7b8d0b386058a73cf2c9670e6 100644 (file)
@@ -2,7 +2,7 @@
  * mpeg_system.c: TS, PS and PES management
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: mpeg_system.c,v 1.69 2001/12/07 18:33:08 sam Exp $
+ * $Id: mpeg_system.c,v 1.70 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Michel Lespinasse <walken@via.ecp.fr>
@@ -136,7 +136,7 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
     if( MoveChunk( p_header, &p_data, &p_byte, PES_HEADER_SIZE )
             != PES_HEADER_SIZE )
     {
-        intf_WarnMsg( 1, "PES packet too short to have a header" );
+        intf_WarnMsg( 1, "input: PES packet too short to have a header" );
         p_input->pf_delete_pes( p_input->p_method_data, p_pes );
         p_pes = NULL;
         return;
@@ -154,7 +154,8 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
     if( (p_header[0] || p_header[1] || (p_header[2] != 1)) )
     {
         /* packet_start_code_prefix != 0x000001 */
-        intf_ErrMsg( "PES packet doesn't start with 0x000001 : data loss" );
+        intf_ErrMsg( "input error: data loss, "
+                     "PES packet doesn't start with 0x000001" );
         p_input->pf_delete_pes( p_input->p_method_data, p_pes );
         p_pes = NULL;
     }
@@ -167,7 +168,8 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
         {
             /* PES_packet_length is set and != total received payload */
             /* Warn the decoder that the data may be corrupt. */
-            intf_WarnMsg( 1, "PES sizes do not match : packet corrupted" );
+            intf_WarnMsg( 1, "input: packet corrupted, "
+                             "PES sizes do not match" );
         }
 
         switch( p_es->i_stream_id )
@@ -273,7 +275,7 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
                 }
                 if( i_pes_header_size == 23 )
                 {
-                    intf_ErrMsg( "Too much MPEG-1 stuffing" );
+                    intf_ErrMsg( "input error: too much MPEG-1 stuffing" );
                     p_input->pf_delete_pes( p_input->p_method_data, p_pes );
                     p_pes = NULL;
                     return;
@@ -288,8 +290,8 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
                     i_pes_header_size += 2;
                     if( MoveChunk( NULL, &p_data, &p_byte, 2 ) != 2 )
                     {
-                        intf_WarnMsg( 1,
-                            "PES packet too short to have a MPEG-1 header" );
+                        intf_WarnMsg( 1, "input: PES packet too short "
+                                         "to have a MPEG-1 header" );
                         p_input->pf_delete_pes( p_input->p_method_data, p_pes );
                         p_pes = NULL;
                         return;
@@ -308,8 +310,8 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
                     i_pes_header_size += 4;
                     if( MoveChunk( p_ts, &p_data, &p_byte, 5 ) != 5 )
                     {
-                        intf_WarnMsg( 1,
-                            "PES packet too short to have a MPEG-1 header" );
+                        intf_WarnMsg( 1, "input: PES packet too short "
+                                         "to have a MPEG-1 header" );
                         p_input->pf_delete_pes( p_input->p_method_data, p_pes );
                         p_pes = NULL;
                         return;
@@ -326,8 +328,8 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
                         i_pes_header_size += 5;
                         if( MoveChunk( p_ts, &p_data, &p_byte, 5 ) != 5 )
                         {
-                            intf_WarnMsg( 1,
-                              "PES packet too short to have a MPEG-1 header" );
+                            intf_WarnMsg( 1, "input: PES packet too short "
+                                             "to have a MPEG-1 header" );
                             p_input->pf_delete_pes( p_input->p_method_data,
                                                     p_pes );
                             p_pes = NULL;
@@ -369,7 +371,7 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
             /* Go to the next data packet. */
             if( (p_data = p_data->p_next) == NULL )
             {
-                intf_ErrMsg( "PES header bigger than payload" );
+                intf_ErrMsg( "input error: PES header bigger than payload" );
                 p_input->pf_delete_pes( p_input->p_method_data, p_pes );
                 p_pes = NULL;
                 return;
@@ -380,7 +382,7 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
         /* This last packet is partly header, partly payload. */
         if( i_payload_size < i_pes_header_size )
         {
-            intf_ErrMsg( "PES header bigger than payload" );
+            intf_ErrMsg( "input error: PES header bigger than payload" );
             p_input->pf_delete_pes( p_input->p_method_data, p_pes );
             p_pes = NULL;
             return;
@@ -395,8 +397,8 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
         }
         else
         {
-            intf_ErrMsg("No fifo to receive PES %p (who wrote this damn code ?)",
-                        p_pes);
+            intf_ErrMsg( "input error: no fifo to receive PES %p "
+                         "(who wrote this damn code ?)", p_pes );
             p_input->pf_delete_pes( p_input->p_method_data, p_pes );
         }
         p_pes = NULL;
@@ -450,7 +452,7 @@ void input_GatherPES( input_thread_t * p_input, data_packet_t * p_data,
              * started. */
             if( (p_pes = p_input->pf_new_pes( p_input->p_method_data ) ) == NULL )
             {
-                intf_ErrMsg("Out of memory");
+                intf_ErrMsg( "input error: out of memory" );
                 p_input->b_error = 1;
                 return;
             }
@@ -532,7 +534,7 @@ static void DecodePSM( input_thread_t * p_input, data_packet_t * p_data )
 
     if( p_data->p_payload_start + 10 > p_data->p_payload_end )
     {
-        intf_ErrMsg( "PSM too short : packet corrupt" );
+        intf_ErrMsg( "input error: PSM too short : packet corrupt" );
         return;
     }
 
@@ -543,7 +545,7 @@ static void DecodePSM( input_thread_t * p_input, data_packet_t * p_data )
         return;
     }
 
-    intf_DbgMsg( "Building PSM" );
+    intf_DbgMsg( "input: building PSM" );
     p_demux->b_has_PSM = 1;
     p_demux->i_PSM_version = p_data->p_payload_start[6] & 0x1F;
 
@@ -553,7 +555,7 @@ static void DecodePSM( input_thread_t * p_input, data_packet_t * p_data )
               + U16_AT(&p_data->p_payload_start[8]);
     if( p_byte > p_data->p_payload_end )
     {
-        intf_ErrMsg( "PSM too short : packet corrupt" );
+        intf_ErrMsg( "input error: PSM too short, packet corrupt" );
         return;
     }
     /* This is the full size of the elementary_stream_map.
@@ -563,7 +565,7 @@ static void DecodePSM( input_thread_t * p_input, data_packet_t * p_data )
     p_byte += 2;
     if( p_end > p_data->p_payload_end )
     {
-        intf_ErrMsg( "PSM too short : packet corrupt" );
+        intf_ErrMsg( "input error: PSM too short, packet corrupt" );
         return;
     }
 
@@ -816,7 +818,8 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
 
                     if( MoveChunk( p_header, &p_data, &p_byte, 14 ) != 14 )
                     {
-                        intf_WarnMsg( 1, "Packet too short to have a header" );
+                        intf_WarnMsg( 1, "input: packet too short "
+                                         "to have a header" );
                         b_trash = 1;
                         break;
                     }
@@ -847,7 +850,8 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
 
                     if( MoveChunk( p_header, &p_data, &p_byte, 12 ) != 12 )
                     {
-                        intf_WarnMsg( 1, "Packet too short to have a header" );
+                        intf_WarnMsg( 1, "input: packet too short "
+                                         "to have a header" );
                         b_trash = 1;
                         break;
                     }
@@ -867,8 +871,8 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
                 if( i_mux_rate != p_input->stream.i_mux_rate
                      && p_input->stream.i_mux_rate )
                 {
-                    intf_WarnMsg(2,
-                                 "Mux_rate changed - expect cosmetic errors");
+                    intf_WarnMsg( 2, "input: mux_rate changed, "
+                                     "expect cosmetic errors" );
                 }
                 p_input->stream.i_mux_rate = i_mux_rate;
 
@@ -892,8 +896,8 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
         default:
             /* This should not happen */
             b_trash = 1;
-            intf_WarnMsg( 3, "Unwanted packet received with start code 0x%.8x",
-                          i_code );
+            intf_WarnMsg( 3, "input: unwanted packet received "
+                             "with start code 0x%.8x", i_code );
         }
     }
     else
@@ -1020,7 +1024,7 @@ void input_DemuxTS( input_thread_t * p_input, data_packet_t * p_data )
                 if( b_payload ? (p[4] > 182) : (p[4] != 183) )
                 {
                     intf_WarnMsg( 2,
-                        "Invalid TS adaptation field (%p)",
+                        "input: invalid TS adaptation field (%p)",
                         p_data );
                     p_data->b_discard_payload = 1;
                     p_es->c_invalid_packets++;
@@ -1034,7 +1038,7 @@ void input_DemuxTS( input_thread_t * p_input, data_packet_t * p_data )
                     if( p[5] & 0x80 )
                     {
                         intf_WarnMsg( 2,
-                            "discontinuity_indicator"
+                            "input: discontinuity_indicator"
                             " encountered by TS demux (position read: %d,"
                             " saved: %d)",
                             p[5] & 0x80, p_es_demux->i_continuity_counter );
@@ -1091,14 +1095,15 @@ void input_DemuxTS( input_thread_t * p_input, data_packet_t * p_data )
                  * draft. As there is nothing interesting in this packet
                  * (except PCR that have already been handled), we can trash
                  * the packet. */
-                intf_WarnMsg( 3,
-                              "Packet without payload received by TS demux" );
+                intf_WarnMsg( 3, "input: packet without payload received "
+                                 "by TS demux" );
                 b_trash = 1;
             }
             else if( i_dummy <= 0 )
             {
                 /* Duplicate packet: mark it as being to be trashed. */
-                intf_WarnMsg( 3, "Duplicate packet received by TS demux" );
+                intf_WarnMsg( 3, "input: duplicate packet received "
+                                 "by TS demux" );
                 b_trash = 1;
             }
             else if( p_es_demux->i_continuity_counter == 0xFF )
@@ -1107,8 +1112,8 @@ void input_DemuxTS( input_thread_t * p_input, data_packet_t * p_data )
                  * this ES since the continuity counter ranges between 0 and
                  * 0x0F excepts when it has been initialized by the input:
                  * init the counter to the correct value. */
-                intf_WarnMsg( 3, "First packet for PID %d received by TS demux",
-                              p_es->i_id );
+                intf_WarnMsg( 3, "input: first packet for PID %d received "
+                             "by TS demux", p_es->i_id );
                 p_es_demux->i_continuity_counter = (p[3] & 0x0f);
             }
             else
@@ -1117,10 +1122,10 @@ void input_DemuxTS( input_thread_t * p_input, data_packet_t * p_data )
                  * continuity_counter wrapped and we received a dup packet:
                  * as we don't know, do as if we missed a packet to be sure
                  * to recover from this situation */
-                intf_WarnMsg( 2,
-                           "Packet lost by TS demux: current %d, packet %d",
-                           p_es_demux->i_continuity_counter & 0x0f,
-                           p[3] & 0x0f );
+                intf_WarnMsg( 2, "input: packet lost by TS demux: "
+                                 "current %d, packet %d",
+                              p_es_demux->i_continuity_counter & 0x0f,
+                              p[3] & 0x0f );
                 b_lost = 1;
                 p_es_demux->i_continuity_counter = p[3] & 0x0f;
             } /* not continuous */
@@ -1177,8 +1182,8 @@ void input_DemuxPSI( input_thread_t * p_input, data_packet_t * p_data,
          * (see ISO/IEC 13818 (2.4.4.2) which should be set to 0x00 */
         if( (u8)p[0] != 0x00 )
         {
-            intf_WarnMsg( 2, 
-                          "Non zero pointer field found. Trying to continue" );
+            intf_WarnMsg( 2, "input: non zero pointer field found, "
+                             "trying to continue" );
             p+=(u8)p[0];
         }
         else
@@ -1190,7 +1195,7 @@ void input_DemuxPSI( input_thread_t * p_input, data_packet_t * p_data,
 
         if( ((u8)(p[1]) & 0xc0) != 0x80 ) 
         {
-            intf_WarnMsg( 2, "Invalid PSI packet" );
+            intf_WarnMsg( 2, "input: invalid PSI packet" );
             p_psi->b_trash = 1;
         }
         else 
@@ -1220,14 +1225,14 @@ void input_DemuxPSI( input_thread_t * p_input, data_packet_t * p_data,
                     
                     if( p_psi->i_version_number != (( p[5] >> 1 ) & 0x1f) )
                     {
-                        intf_WarnMsg( 2,
-                                      "PSI version differs inside same PAT" );
+                        intf_WarnMsg( 2, "input: PSI version differs "
+                                         "inside same PAT" );
                         p_psi->b_trash = 1;
                     }
                     if( p_psi->i_section_number + 1 != (u8)p[6] )
                     {
-                        intf_WarnMsg( 2, 
-                                "PSI Section discontinuity. Packet lost ?");
+                        intf_WarnMsg( 2, "input: PSI Section discontinuity, "
+                                         "packet lost ?" );
                         p_psi->b_trash = 1;
                     }
                     else
@@ -1235,7 +1240,7 @@ void input_DemuxPSI( input_thread_t * p_input, data_packet_t * p_data,
                 }
                 else
                 {
-                    intf_WarnMsg( 2, "Received unexpected new PSI section" );
+                    intf_WarnMsg( 2, "input: got unexpected new PSI section" );
                     p_psi->b_trash = 1;
                 }
             }
@@ -1540,12 +1545,12 @@ static void input_DecodePMT( input_thread_t * p_input, es_descriptor_t * p_es )
 
         if( i_required_audio_es > i_audio_es )
         {
-            intf_WarnMsg( 2, "TS input: Non-existing audio ES required." );
+            intf_WarnMsg( 2, "input: non-existing audio ES required" );
         }
         
         if( i_required_spu_es > i_spu_es )
         {
-            intf_WarnMsg( 2, "TS input: Non-existing subtitles ES required." );
+            intf_WarnMsg( 2, "input: non-existing subtitles ES required" );
         }
         
         p_pgrm_data->i_pmt_version = p_psi->i_version_number;
@@ -1558,3 +1563,4 @@ static void input_DecodePMT( input_thread_t * p_input, es_descriptor_t * p_es )
     
 #undef p_psi
 }
+
index 0b9d18b9e1081bbfc500f645181081183ab5646b..d263c8a05fd95a6dbec3e2279f4083776eb4ddae 100644 (file)
@@ -4,7 +4,7 @@
  * interface, such as command line.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: interface.c,v 1.82 2001/12/07 18:33:08 sam Exp $
+ * $Id: interface.c,v 1.83 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -100,7 +100,6 @@ intf_thread_t* intf_Create( void )
     p_intf->b_die         = 0;
 
     p_intf->p_input       = NULL;
-    p_intf->p_keys        = NULL;
     p_intf->b_menu        = 0;
     p_intf->b_menu_change = 0;
 
@@ -200,9 +199,6 @@ static void intf_Manage( intf_thread_t *p_intf )
  *****************************************************************************/
 void intf_Destroy( intf_thread_t *p_intf )
 {
-    p_intf_key  p_cur;
-    p_intf_key  p_next;
-
     /* Unload channels */
     intf_UnloadChannels( p_intf );
 
@@ -215,15 +211,6 @@ void intf_Destroy( intf_thread_t *p_intf )
         input_DestroyThread( p_intf->p_input, NULL );
     }
 
-    /* Destroy keymap */
-    p_cur = p_intf->p_keys;
-    while( p_cur != NULL)
-    {
-        p_next = p_cur->next;
-        free(p_cur);
-        p_cur = p_next;
-    }
-         
     /* Unlock module */
     module_Unneed( p_intf->p_module );
 
@@ -233,223 +220,3 @@ void intf_Destroy( intf_thread_t *p_intf )
     free( p_intf );
 }
 
-/*****************************************************************************
- * intf_AssignKey: assign standartkeys                                       *
- *****************************************************************************
- * This function fills in the associative array that links the key pressed   *
- * and the key we use internally. Support one extra parameter.               *
- ****************************************************************************/
-void intf_AssignKey( intf_thread_t *p_intf, int r_key, int f_key, int param)
-{
-    p_intf_key  p_cur =  p_intf->p_keys;
-    if( p_cur == NULL )
-    {
-        p_cur = (p_intf_key )(malloc ( sizeof( intf_key ) ) );
-        p_cur->received_key = r_key;
-        p_cur->forwarded.key = f_key;
-        p_cur->forwarded.param = param; 
-        p_cur->next = NULL;
-        p_intf->p_keys = p_cur;
-    } 
-    else 
-    {
-        while( p_cur->next != NULL && p_cur ->received_key != r_key)
-        {
-            p_cur = p_cur->next;
-        }
-        if( p_cur->next == NULL )
-        {   
-            p_cur->next  = ( p_intf_key )( malloc( sizeof( intf_key ) ) );
-            p_cur = p_cur->next;
-            p_cur->next = NULL;
-            p_cur->forwarded.param = param; 
-            p_cur->received_key = r_key;
-        }
-        p_cur->forwarded.key = f_key;
-    }        
-}
-
-/* Basic getKey function... */
-keyparm intf_GetKey( intf_thread_t *p_intf, int r_key)
-{   
-    keyparm reply;
-    
-    p_intf_key current = p_intf->p_keys;
-    while(current != NULL && current->received_key != r_key)
-    {    
-        current = current->next;
-    }
-    if(current == NULL)
-    {   /* didn't find any key in the array */ 
-        reply.key = INTF_KEY_UNKNOWN;
-        reply.param = 0;
-    }
-    else
-    {
-        reply.key = current->forwarded.key;
-        reply.param = current->forwarded.param;
-    }
-    return reply;
-}
-
-/*****************************************************************************
-* intf_AssignNormalKeys: used for normal interfaces.
-*****************************************************************************
-* This function assign the basic key to the normal keys.
-*****************************************************************************/
-
-void intf_AssignNormalKeys( intf_thread_t *p_intf)
-{
-    p_intf->p_intf_get_key = intf_GetKey;
-
-    intf_AssignKey( p_intf , 'Q', INTF_KEY_QUIT, 0);
-    intf_AssignKey( p_intf , 'q', INTF_KEY_QUIT, 0);
-    intf_AssignKey( p_intf ,  27, INTF_KEY_QUIT, 0);
-    intf_AssignKey( p_intf ,   3, INTF_KEY_QUIT, 0);
-    intf_AssignKey( p_intf , '0', INTF_KEY_SET_CHANNEL, 0);
-    intf_AssignKey( p_intf , '1', INTF_KEY_SET_CHANNEL, 1);
-    intf_AssignKey( p_intf , '2', INTF_KEY_SET_CHANNEL, 2);
-    intf_AssignKey( p_intf , '3', INTF_KEY_SET_CHANNEL, 3);
-    intf_AssignKey( p_intf , '4', INTF_KEY_SET_CHANNEL, 4);
-    intf_AssignKey( p_intf , '5', INTF_KEY_SET_CHANNEL, 5);
-    intf_AssignKey( p_intf , '6', INTF_KEY_SET_CHANNEL, 6);
-    intf_AssignKey( p_intf , '7', INTF_KEY_SET_CHANNEL, 7);
-    intf_AssignKey( p_intf , '8', INTF_KEY_SET_CHANNEL, 8);
-    intf_AssignKey( p_intf , '9', INTF_KEY_SET_CHANNEL, 9);
-    intf_AssignKey( p_intf , '0', INTF_KEY_SET_CHANNEL, 0);
-    intf_AssignKey( p_intf , '+', INTF_KEY_INC_VOLUME, 0);
-    intf_AssignKey( p_intf , '-', INTF_KEY_DEC_VOLUME, 0);
-    intf_AssignKey( p_intf , 'm', INTF_KEY_TOGGLE_VOLUME, 0);
-    intf_AssignKey( p_intf , 'M', INTF_KEY_TOGGLE_VOLUME, 0);
-    intf_AssignKey( p_intf , 'g', INTF_KEY_DEC_GAMMA, 0);
-    intf_AssignKey( p_intf , 'G', INTF_KEY_INC_GAMMA, 0);
-    intf_AssignKey( p_intf , 'c', INTF_KEY_TOGGLE_GRAYSCALE, 0);
-    intf_AssignKey( p_intf , ' ', INTF_KEY_TOGGLE_INTERFACE, 0);
-    intf_AssignKey( p_intf , 'i', INTF_KEY_TOGGLE_INFO, 0);
-    intf_AssignKey( p_intf , 's', INTF_KEY_TOGGLE_SCALING, 0);
-    intf_AssignKey( p_intf , 'd', INTF_KEY_DUMP_STREAM, 0);
-}   
-
-/*****************************************************************************
- * intf_ProcessKey: process standard keys
- *****************************************************************************
- * This function will process standard keys and return non 0 if the key was
- * unknown.
- *****************************************************************************/
-int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
-{
-    int i_index;
-    keyparm k_reply;
-    
-    k_reply = intf_GetKey( p_intf, g_key); 
-    switch( k_reply.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 */
-/*        intf_SelectChannel( p_intf, k_reply.param ); */
-/*        network_ChannelJoin() */
-/* 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 + */
-        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 - */
-        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 */
-        /* Start/stop feeding audio data. */
-        if( p_intf->p_input != NULL )
-        {
-            input_ToggleMute( p_intf->p_input );
-        }
-
-        /* Start/stop playing sound. */
-        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_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;
-            }
-        }
-        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) )
-        {
-            /* FIXME: we should lock if called from the interface */
-            p_main->p_vout->f_gamma   -= INTF_GAMMA_STEP;
-            p_main->p_vout->i_changes |= VOUT_GAMMA_CHANGE;
-        }
-        break;
-    case INTF_KEY_INC_GAMMA:                                      /* gamma + */
-        if( (p_main->p_vout != NULL) && (p_main->p_vout->f_gamma < INTF_GAMMA_LIMIT) )
-        {
-            /* FIXME: we should lock if called from the interface */
-            p_main->p_vout->f_gamma   += INTF_GAMMA_STEP;
-            p_main->p_vout->i_changes |= VOUT_GAMMA_CHANGE;
-        }
-        break;
-#endif
-
-   case INTF_KEY_DUMP_STREAM:
-        if( p_intf->p_input != NULL )
-        {
-            vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
-            input_DumpStream( p_intf->p_input );
-            vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
-        }
-        break;
-
-    default:                                                  /* unknown key */
-        return( 1 );
-    }
-
-    return( 0 );
-}
-
index 614eb931409e3ade8d76e93e9ed63f787b97b18f..a8b675750827df5dca02dfcd50d9cf2917568e7b 100644 (file)
@@ -4,7 +4,7 @@
  * and spawn threads.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: main.c,v 1.132 2001/12/07 18:33:08 sam Exp $
+ * $Id: main.c,v 1.133 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -1330,29 +1330,27 @@ static int CPUCapabilities( void )
  *****************************************************************************/
 static int RedirectSTDOUT( void )
 {
-    int  i_stdout_filedesc;
-    char *psz_stdout_filename;
+    int  i_fd;
+    char *psz_filename;
 
-    psz_stdout_filename = main_GetPszVariable( INTF_STDOUT_VAR,
-                                               INTF_STDOUT_DEFAULT );
-    if( strcmp( "", psz_stdout_filename ) != 0 )
+    psz_filename = main_GetPszVariable( INTF_STDOUT_VAR, INTF_STDOUT_DEFAULT );
+
+    if( *psz_filename )
     {
         ShowConsole();
-        i_stdout_filedesc = open( psz_stdout_filename,
-                                  O_CREAT | O_TRUNC | O_RDWR,
-                                  S_IREAD | S_IWRITE );
-
-        if( dup2( i_stdout_filedesc, fileno(stdout) ) == -1 )
+        i_fd = open( psz_filename, O_CREAT | O_TRUNC | O_RDWR,
+                                   S_IREAD | S_IWRITE );
+        if( dup2( i_fd, fileno(stdout) ) == -1 )
         {
             intf_ErrMsg( "warning: unable to redirect stdout" );
         }
 
-        if( dup2( i_stdout_filedesc, fileno(stderr) ) == -1 )
+        if( dup2( i_fd, fileno(stderr) ) == -1 )
         {
             intf_ErrMsg( "warning: unable to redirect stderr" );
         }
 
-        close( i_stdout_filedesc );
+        close( i_fd );
     }
     else
     {
index d68ec6fe57b6b1338dac03c87fa4d6ae572e79e2..b0a3daab263380ae7f56e23ae1ecbd671fd0b4ee 100644 (file)
@@ -2,7 +2,7 @@
  * beos_init.cpp: Initialization for BeOS specific features 
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: beos_specific.cpp,v 1.12 2001/11/28 15:08:06 massiot Exp $
+ * $Id: beos_specific.cpp,v 1.13 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *
@@ -32,7 +32,6 @@
 
 extern "C"
 {
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index dea1d8ba05dbd7b706fb560b0de422b001e7b457..70d131fa6b10dc2078e404a1fcbd67630f19c946 100644 (file)
@@ -2,7 +2,7 @@
  * darwin_specific.c: Darwin specific features 
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: darwin_specific.c,v 1.5 2001/11/28 15:08:06 massiot Exp $
+ * $Id: darwin_specific.c,v 1.6 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -25,7 +25,6 @@
 #include <string.h>                                              /* strdup() */
 #include <stdlib.h>                                                /* free() */
 
-#include "config.h"
 #include "common.h"
 #include "intf_msg.h"
 #include "threads.h"
index 67783a82e5c7bb6f9693325bd297659748acf778..43fb94815c5ca1ef420004287f4378044d321e42 100644 (file)
@@ -2,7 +2,7 @@
  * iso_lang.c: function to decode language code (in dvd or a52 for instance).
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: iso_lang.c,v 1.1 2001/11/07 17:37:16 stef Exp $
+ * $Id: iso_lang.c,v 1.2 2001/12/09 17:01:37 sam Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -28,7 +28,6 @@
 
 #include <stdio.h>
 
-#include "config.h"
 #include "common.h"
 
 /*****************************************************************************
index 22722064d330255dc633d9f8a609578c84cd2618..7a053893fdd4ed79934eccf9c7098d52edcf50c3 100644 (file)
@@ -3,7 +3,7 @@
  * Functions are prototyped in mtime.h.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: mtime.c,v 1.25 2001/11/28 15:08:06 massiot Exp $
+ * $Id: mtime.c,v 1.26 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -52,7 +52,6 @@
 #   include <sys/time.h>
 #endif
 
-#include "config.h"
 #include "common.h"
 #include "mtime.h"
 
@@ -97,11 +96,9 @@ mtime_t mdate( void )
         QueryPerformanceCounter( (LARGE_INTEGER *)&usec_time );
         return ( usec_time * 1000000 ) / freq;
     }
-    else
-    {
-        /* Milisecond resolution */
-        return 1000 * GetTickCount();
-    }
+
+    /* Milisecond resolution */
+    return 1000 * GetTickCount();
 
 #else
     struct timeval tv_date;
index 14e2bded98608f008fb72030cddccc8d60f45abe..8121458d21f440176aedda76edcff2235f80b91a 100644 (file)
@@ -2,7 +2,7 @@
  * win32_specific.c: Win32 specific features 
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: win32_specific.c,v 1.3 2001/11/28 15:08:06 massiot Exp $
+ * $Id: win32_specific.c,v 1.4 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -28,7 +28,6 @@
 
 #include <winsock2.h>
 
-#include "config.h"
 #include "common.h"
 
 #include "win32_specific.h"
index 1053aa05705793682bfe6c3ff9649b171b0f3224..4cca13dbf34b977d80c090023fd5582ab1290ad6 100644 (file)
@@ -5,7 +5,7 @@
  * thread, and destroy a previously oppened video output thread.
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: video_output.c,v 1.145 2001/12/07 18:33:08 sam Exp $
+ * $Id: video_output.c,v 1.146 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
 
 #include "video.h"
 #include "video_output.h"
-#include "video_text.h"
-#include "video_spu.h"
-#include "video_yuv.h"
 
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int      BinaryLog         ( u32 i );
-static void     MaskToShift       ( int *pi_left, int *pi_right, u32 i_mask );
 static int      InitThread        ( vout_thread_t *p_vout );
 static void     RunThread         ( vout_thread_t *p_vout );
 static void     ErrorThread       ( vout_thread_t *p_vout );
 static void     EndThread         ( vout_thread_t *p_vout );
 static void     DestroyThread     ( vout_thread_t *p_vout, int i_status );
-static void     Print             ( vout_thread_t *p_vout, int i_x, int i_y,
-                                    int i_h_align, int i_v_align,
-                                    unsigned char *psz_text );
-static void     SetBuffers        ( vout_thread_t *p_vout, void *, void * );
-static void     SetBufferArea     ( vout_thread_t *p_vout, int i_x, int i_y,
-                                    int i_w, int i_h );
-static void     SetBufferPicture  ( vout_thread_t *p_vout, picture_t *p_pic );
-static void     RenderPicture     ( vout_thread_t *p_vout, picture_t *p_pic );
-static void     RenderPictureInfo ( vout_thread_t *p_vout, picture_t *p_pic );
-static void     RenderSubPicture  ( vout_thread_t *p_vout, picture_t *p_pic,
-                                    subpicture_t *p_subpic );
-static int      RenderIdle        ( vout_thread_t *p_vout );
-static void     RenderInfo        ( vout_thread_t *p_vout );
-static int      Manage            ( vout_thread_t *p_vout );
-static int      Align             ( vout_thread_t *p_vout, int *pi_x,
-                                    int *pi_y, int i_width, int i_height,
-                                    int i_h_align, int i_v_align );
-static void     SetPalette        ( p_vout_thread_t p_vout, u16 *red,
-                                    u16 *green, u16 *blue, u16 *transp );
 
 /*****************************************************************************
  * vout_InitBank: initialize the video output bank.
@@ -116,11 +92,13 @@ void vout_EndBank ( void )
  * If pi_status is NULL, then the function will block until the thread is ready.
  * If not, it will be updated using one of the THREAD_* constants.
  *****************************************************************************/
-vout_thread_t * vout_CreateThread   ( int *pi_status, int i_width, int i_height )
+vout_thread_t * vout_CreateThread   ( int *pi_status,
+                                      int i_width, int i_height,
+                                      int i_chroma, int i_aspect_ratio )
 {
     vout_thread_t * p_vout;                             /* thread descriptor */
     int             i_status;                               /* thread status */
-    int             i_index;               /* index for array initialization */
+    int             i_index;                                /* loop variable */
 
     /* Allocate descriptor */
     p_vout = (vout_thread_t *) malloc( sizeof(vout_thread_t) );
@@ -151,14 +129,6 @@ vout_thread_t * vout_CreateThread   ( int *pi_status, int i_width, int i_height
     p_vout->pf_setpalette = f.pf_setpalette;
 #undef f
 
-    /* Initialize callbacks */
-    p_vout->pf_setbuffers       = SetBuffers;
-
-    if( p_vout->pf_setpalette == NULL )
-    {
-        p_vout->pf_setpalette   = SetPalette;
-    }
-
     /* Initialize thread properties - thread id and locks will be initialized
      * later */
     p_vout->b_die               = 0;
@@ -167,77 +137,39 @@ vout_thread_t * vout_CreateThread   ( int *pi_status, int i_width, int i_height
     p_vout->pi_status           = (pi_status != NULL) ? pi_status : &i_status;
     *p_vout->pi_status          = THREAD_CREATE;
 
-    /* Initialize some fields used by the system-dependant method - these
-     * fields will probably be modified by the method, and are only
-     * preferences */
-    p_vout->i_changes           = 0;
-    p_vout->i_width             = main_GetIntVariable( VOUT_WIDTH_VAR, 0 );
-    if( !p_vout->i_width )
-    {
-        p_vout->i_width         = i_width ? i_width : VOUT_WIDTH_DEFAULT;
-    }
-    p_vout->i_height            = main_GetIntVariable( VOUT_HEIGHT_VAR, 0 );
-    if( !p_vout->i_height )
-    {
-        p_vout->i_height        = i_height ? i_height : VOUT_HEIGHT_DEFAULT;
-    }
-    p_vout->i_bytes_per_line    = p_vout->i_width * 2;
-    p_vout->i_screen_depth      = main_GetIntVariable( VOUT_DEPTH_VAR,
-                                                         VOUT_DEPTH_DEFAULT );
-    p_vout->i_bytes_per_pixel   = 2;
-    p_vout->f_gamma             = VOUT_GAMMA_DEFAULT; // FIXME: replace with
-                                                      // variable
-    p_vout->b_need_render       = 1;
-    p_vout->b_YCbr              = 0;
-
-    p_vout->b_grayscale         = main_GetIntVariable( VOUT_GRAYSCALE_VAR,
-                                                       VOUT_GRAYSCALE_DEFAULT );
-    p_vout->b_info              = 0;
-    p_vout->b_interface         = 0;
-    p_vout->b_scale             = 1;
-    p_vout->b_fullscreen        = main_GetIntVariable( VOUT_FULLSCREEN_VAR,
-                                                     VOUT_FULLSCREEN_DEFAULT );
-
-    intf_WarnMsg( 3, "vout info: asking for %dx%d, %d/%d bpp (%d Bpl)",
-                  p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth,
-                  p_vout->i_bytes_per_pixel * 8, p_vout->i_bytes_per_line );
-
-    /* Initialize idle screen */
-    p_vout->last_display_date   = 0;
-    p_vout->last_idle_date      = 0;
-    p_vout->init_display_date   = mdate();
-    p_vout->render_time         = 10000;
-
-    /* Initialize statistics fields */
-    p_vout->c_fps_samples       = 0;
-    p_vout->c_pictures          = 0;
-    p_vout->c_late_pictures     = 0;
-    p_vout->c_jitter_samples    = 0;
-    p_vout->display_jitter      = 0;
-    p_vout->c_loops             = 0;
-
-    /* Initialize buffer index */
-    p_vout->i_buffer_index      = 0;
-
-    /* Initialize fonts */
-    p_vout->p_default_font      = NULL;
-    p_vout->p_large_font        = NULL;
-
     /* Initialize pictures and subpictures - translation tables and functions
      * will be initialized later in InitThread */
     for( i_index = 0; i_index < VOUT_MAX_PICTURES; i_index++)
     {
-        p_vout->p_picture[i_index].i_type   = EMPTY_PICTURE;
         p_vout->p_picture[i_index].i_status = FREE_PICTURE;
+        p_vout->p_picture[i_index].i_chroma = EMPTY_PICTURE;
+        p_vout->p_picture[i_index].i_aspect_ratio = i_aspect_ratio;
+        p_vout->p_picture[i_index].b_directbuffer = 0;
     }
 
     for( i_index = 0; i_index < VOUT_MAX_SUBPICTURES; i_index++)
     {
-        p_vout->p_subpicture[i_index].i_type   = EMPTY_SUBPICTURE;
         p_vout->p_subpicture[i_index].i_status = FREE_SUBPICTURE;
+        p_vout->p_subpicture[i_index].i_type   = EMPTY_SUBPICTURE;
     }
 
+    p_vout->i_width         = i_width;
+    p_vout->i_height        = i_height;
+    p_vout->i_chroma        = i_chroma;
+    p_vout->i_aspect_ratio  = i_aspect_ratio;
     p_vout->i_pictures = 0;
+    p_vout->i_directbuffers = 0;
+
+    /* Initialize misc stuff */
+    p_vout->i_changes = 0;
+    p_vout->f_gamma = 0;
+    p_vout->b_grayscale = 0;
+    p_vout->b_info = 0;
+    p_vout->b_interface = 0;
+    p_vout->b_scale = 1;
+    p_vout->b_fullscreen = main_GetIntVariable( VOUT_FULLSCREEN_VAR,
+                                                VOUT_FULLSCREEN_DEFAULT );
+    p_vout->render_time = 10;
 
     /* Create thread and set locks */
     vlc_mutex_init( &p_vout->picture_lock );
@@ -248,6 +180,7 @@ vout_thread_t * vout_CreateThread   ( int *pi_status, int i_width, int i_height
                            (void *) RunThread, (void *) p_vout) )
     {
         intf_ErrMsg("vout error: %s", strerror(ENOMEM));
+        p_vout->pf_destroy( p_vout );
         module_Unneed( p_vout->p_module );
         free( p_vout );
         return( NULL );
@@ -266,6 +199,7 @@ vout_thread_t * vout_CreateThread   ( int *pi_status, int i_width, int i_height
             return( NULL );
         }
     }
+
     return( p_vout );
 }
 
@@ -282,7 +216,6 @@ void vout_DestroyThread( vout_thread_t *p_vout, int *pi_status )
     int     i_status;                                       /* thread status */
 
     /* Set status */
-    intf_DbgMsg("");
     p_vout->pi_status = (pi_status != NULL) ? pi_status : &i_status;
     *p_vout->pi_status = THREAD_DESTROY;
 
@@ -301,1899 +234,348 @@ void vout_DestroyThread( vout_thread_t *p_vout, int *pi_status )
 }
 
 /*****************************************************************************
- * vout_DisplaySubPicture: display a subpicture unit
+ * InitThread: initialize video output thread
  *****************************************************************************
- * Remove the reservation flag of a subpicture, which will cause it to be ready
- * for display. The picture does not need to be locked, since it is ignored by
- * the output thread if is reserved.
+ * This function is called from RunThread and performs the second step of the
+ * initialization. It returns 0 on success. Note that the thread's flag are not
+ * modified inside this function.
  *****************************************************************************/
-void  vout_DisplaySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
+static int InitThread( vout_thread_t *p_vout )
 {
-#ifdef TRACE_VOUT
-    char        psz_start[ MSTRTIME_MAX_SIZE ];    /* buffer for date string */
-    char        psz_stop[ MSTRTIME_MAX_SIZE ];     /* buffer for date string */
+    /* Update status */
+    *p_vout->pi_status = THREAD_START;
+
+    vlc_mutex_lock( &p_vout->change_lock );
+
+#ifdef STATS
+    p_vout->c_loops = 0;
 #endif
 
-#ifdef DEBUG
-    /* Check if status is valid */
-    if( p_subpic->i_status != RESERVED_SUBPICTURE )
+    /* Initialize output method, it issues its own error messages */
+    if( p_vout->pf_init( p_vout ) )
     {
-        intf_ErrMsg("error: subpicture %p has invalid status %d", p_subpic,
-                    p_subpic->i_status );
+        vlc_mutex_unlock( &p_vout->change_lock );
+        return( 1 );
+    }
+
+    if( !p_vout->i_directbuffers )
+    {
+        intf_ErrMsg( "vout error: plugin was unable to allocate at least "
+                     "one direct buffer" );
+        vlc_mutex_unlock( &p_vout->change_lock );
+        return( 1 );
     }
-#endif
 
-    /* Remove reservation flag */
-    p_subpic->i_status = READY_SUBPICTURE;
+    intf_WarnMsg( 1, "vout info: got %i direct buffer(s)",
+                  p_vout->i_directbuffers );
 
-#ifdef TRACE_VOUT
-    /* Send subpicture information */
-    intf_DbgMsg("subpicture %p: type=%d, begin date=%s, end date=%s",
-                p_subpic, p_subpic->i_type,
-                mstrtime( psz_start, p_subpic->i_start ),
-                mstrtime( psz_stop, p_subpic->i_stop ) );
-#endif
+    /* Mark thread as running and return */
+    p_vout->b_active =          1;
+    *p_vout->pi_status =        THREAD_READY;
+
+    intf_DbgMsg("thread ready");
+    return( 0 );
 }
 
 /*****************************************************************************
- * vout_CreateSubPicture: allocate a subpicture in the video output heap.
+ * RunThread: video output thread
  *****************************************************************************
- * This function create a reserved subpicture in the video output heap.
- * A null pointer is returned if the function fails. This method provides an
- * already allocated zone of memory in the spu data fields. It needs locking
- * since several pictures can be created by several producers threads.
+ * Video output thread. This function does only returns when the thread is
+ * terminated. It handles the pictures arriving in the video heap and the
+ * display device events.
  *****************************************************************************/
-subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
-                                     int i_size )
+static void RunThread( vout_thread_t *p_vout)
 {
-    int                 i_subpic;                        /* subpicture index */
-    subpicture_t *      p_free_subpic = NULL;       /* first free subpicture */
-    subpicture_t *      p_destroyed_subpic = NULL; /* first destroyed subpic */
+    int             i_index;                                /* index in heap */
+    mtime_t         current_date;                            /* current date */
+    mtime_t         display_date;                            /* display date */
+
+    picture_t *     p_picture;                            /* picture pointer */
+    picture_t *     p_directbuffer;              /* direct buffer to display */
+
+    subpicture_t *  p_subpic;                          /* subpicture pointer */
+
+    /* Create and initialize system-dependant method - this function issues its
+     * own error messages */
+    if( p_vout->pf_create( p_vout ) )
+    {
+        DestroyThread( p_vout, THREAD_ERROR );
+        return;
+    }
+
+    /*
+     * Initialize thread
+     */
+    p_vout->b_error = InitThread( p_vout );
+    if( p_vout->b_error )
+    {
+        /* Destroy thread structures allocated by Create and InitThread */
+        p_vout->pf_destroy( p_vout );
 
-    /* Get lock */
-    vlc_mutex_lock( &p_vout->subpicture_lock );
+        DestroyThread( p_vout, THREAD_ERROR );
+        return;
+    }
 
     /*
-     * Look for an empty place
+     * Main loop - it is not executed if an error occured during
+     * initialization
      */
-    for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ )
+    while( (!p_vout->b_die) && (!p_vout->b_error) )
     {
-        if( p_vout->p_subpicture[i_subpic].i_status == DESTROYED_SUBPICTURE )
+        /* Initialize loop variables */
+        p_picture =      NULL;
+        p_directbuffer = NULL;
+        display_date =   0;
+        current_date =   mdate();
+
+#ifdef STATS
+        p_vout->c_loops++;
+        if( !(p_vout->c_loops % VOUT_STATS_NB_LOOPS) )
         {
-            /* Subpicture is marked for destruction, but is still allocated */
-            if( (p_vout->p_subpicture[i_subpic].i_type  == i_type)   &&
-                (p_vout->p_subpicture[i_subpic].i_size  >= i_size) )
-            {
-                /* Memory size do match or is smaller : memory will not be
-                 * reallocated, and function can end immediately - this is
-                 * the best possible case, since no memory allocation needs
-                 * to be done */
-                p_vout->p_subpicture[i_subpic].i_status = RESERVED_SUBPICTURE;
-#ifdef TRACE_VOUT
-                intf_DbgMsg("subpicture %p (in destroyed subpicture slot)",
-                            &p_vout->p_subpicture[i_subpic] );
+            intf_Msg( "vout stats: picture heap: %d/%d",
+                      p_vout->i_pictures, VOUT_MAX_PICTURES );
+        }
 #endif
-                vlc_mutex_unlock( &p_vout->subpicture_lock );
-                return( &p_vout->p_subpicture[i_subpic] );
-            }
-            else if( p_destroyed_subpic == NULL )
+
+        /*
+         * Find the picture to display - this operation does not need lock,
+         * since only READY_PICTUREs are handled
+         */
+        for( i_index = 0; i_index < VOUT_MAX_PICTURES; i_index++ )
+        {
+            if( (p_vout->p_picture[i_index].i_status == READY_PICTURE) &&
+            ( (p_picture == NULL) ||
+              (p_vout->p_picture[i_index].date < display_date) ) )
             {
-                /* Memory size do not match, but subpicture index will be kept
-                 * in case we find no other place */
-                p_destroyed_subpic = &p_vout->p_subpicture[i_subpic];
+                p_picture = &p_vout->p_picture[i_index];
+                display_date = p_picture->date;
             }
         }
-        else if( (p_free_subpic == NULL) &&
-                 (p_vout->p_subpicture[i_subpic].i_status == FREE_SUBPICTURE ))
+
+        if( p_picture != NULL )
         {
-            /* Subpicture is empty and ready for allocation */
-            p_free_subpic = &p_vout->p_subpicture[i_subpic];
+            /* Compute FPS rate */
+            p_vout->p_fps_sample[ p_vout->c_fps_samples++ % VOUT_FPS_SAMPLES ]
+                = display_date;
+
+            if( display_date < current_date + p_vout->render_time )
+            {
+                /* Picture is late: it will be destroyed and the thread
+                 * will directly choose the next picture */
+                vlc_mutex_lock( &p_vout->picture_lock );
+                if( p_picture->i_refcount )
+                {
+                    /* Pretend we displayed the picture, but don't destroy
+                     * it since the decoder might still need it. */
+                    p_picture->i_status = DISPLAYED_PICTURE;
+                }
+                else
+                {
+                    /* Destroy the picture without displaying it */
+                    p_picture->i_status = DESTROYED_PICTURE;
+                    p_vout->i_pictures--;
+                }
+                intf_WarnMsg( 1, "vout warning: late picture skipped (%p)",
+                              p_picture );
+                vlc_mutex_unlock( &p_vout->picture_lock );
+
+                continue;
+            }
+            else if( display_date > current_date + VOUT_DISPLAY_DELAY )
+            {
+                /* A picture is ready to be rendered, but its rendering date
+                 * is far from the current one so the thread will perform an
+                 * empty loop as if no picture were found. The picture state
+                 * is unchanged */
+                p_picture    = NULL;
+                display_date = 0;
+            }
         }
-    }
 
-    /* If no free subpictures are available, use a destroyed subpicture */
-    if( (p_free_subpic == NULL) && (p_destroyed_subpic != NULL ) )
-    {
-        /* No free subpicture or matching destroyed subpictures have been
-         * found, but a destroyed subpicture is still avalaible */
-        free( p_destroyed_subpic->p_data );
-        p_free_subpic = p_destroyed_subpic;
-    }
+        /*
+         * Check for subpictures to display
+         */
+        p_subpic = vout_SortSubPictures( p_vout, display_date );
 
-    /*
-     * Prepare subpicture
-     */
-    if( p_free_subpic != NULL )
-    {
-        /* Allocate memory */
-        switch( i_type )
+        /*
+         * Perform rendering
+         */
+        p_directbuffer = vout_RenderPicture( p_vout, p_picture, p_subpic );
+
+        /*
+         * Sleep, wake up
+         */
+        if( display_date != 0 )
         {
-        case TEXT_SUBPICTURE:                             /* text subpicture */
-            p_free_subpic->p_data = memalign( 16, i_size + 1 );
-            break;
-        case DVD_SUBPICTURE:                          /* DVD subpicture unit */
-            p_free_subpic->p_data = memalign( 16, i_size );
-            break;
-#ifdef DEBUG
-        default:
-            intf_ErrMsg("error: unknown subpicture type %d", i_type );
-            p_free_subpic->p_data   =  NULL;
-            break;
-#endif
+            /* Store render time using Bresenham algorithm */
+            p_vout->render_time += mdate() - current_date;
+            p_vout->render_time >>= 1;
         }
 
-        if( p_free_subpic->p_data != NULL )
+        /* Give back change lock */
+        vlc_mutex_unlock( &p_vout->change_lock );
+
+        /* Sleep a while or until a given date */
+        if( display_date != 0 )
         {
-            /* Copy subpicture information, set some default values */
-            p_free_subpic->i_type                      = i_type;
-            p_free_subpic->i_status                    = RESERVED_SUBPICTURE;
-            p_free_subpic->i_size                      = i_size;
-            p_free_subpic->i_x                         = 0;
-            p_free_subpic->i_y                         = 0;
-            p_free_subpic->i_width                     = 0;
-            p_free_subpic->i_height                    = 0;
-            p_free_subpic->i_horizontal_align          = CENTER_RALIGN;
-            p_free_subpic->i_vertical_align            = CENTER_RALIGN;
+            mwait( display_date - VOUT_MWAIT_TOLERANCE );
         }
         else
         {
-            /* Memory allocation failed : set subpicture as empty */
-            p_free_subpic->i_type   =  EMPTY_SUBPICTURE;
-            p_free_subpic->i_status =  FREE_SUBPICTURE;
-            p_free_subpic =            NULL;
-            intf_ErrMsg( "vout error: spu allocation returned %s",
-                         strerror( ENOMEM ) );
+            msleep( VOUT_IDLE_SLEEP );
         }
 
+        /* On awakening, take back lock and send immediately picture
+         * to display. */
+        vlc_mutex_lock( &p_vout->change_lock );
+
 #ifdef TRACE_VOUT
-        intf_DbgMsg("subpicture %p (in free subpicture slot)", p_free_subpic );
+        intf_DbgMsg( "picture %p, subpicture %p", p_picture, p_subpic );
 #endif
-        vlc_mutex_unlock( &p_vout->subpicture_lock );
-        return( p_free_subpic );
-    }
-
-    /* No free or destroyed subpicture could be found */
-    intf_DbgMsg( "warning: subpicture heap is full" );
-    vlc_mutex_unlock( &p_vout->subpicture_lock );
-    return( NULL );
-}
 
-/*****************************************************************************
- * vout_DestroySubPicture: remove a subpicture from the heap
- *****************************************************************************
- * This function frees a previously reserved subpicture.
- * It is meant to be used when the construction of a picture aborted.
- * This function does not need locking since reserved subpictures are ignored
- * by the output thread.
- *****************************************************************************/
-void vout_DestroySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
-{
-#ifdef DEBUG
-   /* Check if status is valid */
-   if( p_subpic->i_status != RESERVED_SUBPICTURE )
-   {
-       intf_ErrMsg("error: subpicture %p has invalid status %d",
-                   p_subpic, p_subpic->i_status );
-   }
-#endif
+        /*
+         * Display the previously rendered picture
+         */
+        if( p_picture != NULL )
+        {
+            /* Display the direct buffer returned by vout_RenderPicture */
+            p_vout->pf_display( p_vout, p_directbuffer );
 
-    p_subpic->i_status = DESTROYED_SUBPICTURE;
+            /* Remove picture from heap */
+            vlc_mutex_lock( &p_vout->picture_lock );
+            if( p_picture->i_refcount )
+            {
+                p_picture->i_status = DISPLAYED_PICTURE;
+            }
+            else
+            {
+                p_picture->i_status = DESTROYED_PICTURE;
+                p_vout->i_pictures--;
+            }
+            vlc_mutex_unlock( &p_vout->picture_lock );
+        }
 
-#ifdef TRACE_VOUT
-    intf_DbgMsg("subpicture %p", p_subpic);
-#endif
-}
+        /*
+         * Check events and manage thread
+         */
+        if( p_vout->pf_manage( p_vout ) )
+        {
+            /* A fatal error occured, and the thread must terminate immediately,
+             * without displaying anything - setting b_error to 1 causes the
+             * immediate end of the main while() loop. */
+            p_vout->b_error = 1;
+        }
+    }
 
-/*****************************************************************************
- * vout_DisplayPicture: display a picture
- *****************************************************************************
- * Remove the reservation flag of a picture, which will cause it to be ready for
- * display. The picture won't be displayed until vout_DatePicture has been
- * called.
- *****************************************************************************/
-void  vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic )
-{
-    vlc_mutex_lock( &p_vout->picture_lock );
-    switch( p_pic->i_status )
+    /*
+     * Error loop - wait until the thread destruction is requested
+     */
+    if( p_vout->b_error )
     {
-    case RESERVED_PICTURE:
-        p_pic->i_status = RESERVED_DISP_PICTURE;
-        break;
-    case RESERVED_DATED_PICTURE:
-        p_pic->i_status = READY_PICTURE;
-        break;
-#ifdef DEBUG
-    default:
-        intf_ErrMsg("error: picture %p has invalid status %d", p_pic, p_pic->i_status );
-        break;
-#endif
+        ErrorThread( p_vout );
     }
 
-#ifdef TRACE_VOUT
-    intf_DbgMsg("picture %p", p_pic);
-#endif
-    vlc_mutex_unlock( &p_vout->picture_lock );
+    /* End of thread */
+    EndThread( p_vout );
+
+    /* Destroy method-dependant resources */
+    p_vout->pf_destroy( p_vout );
+
+    /* Destroy thread structures allocated by CreateThread */
+    DestroyThread( p_vout, THREAD_OVER );
+    intf_DbgMsg( "thread end" );
 }
 
 /*****************************************************************************
- * vout_DatePicture: date a picture
+ * ErrorThread: RunThread() error loop
  *****************************************************************************
- * Remove the reservation flag of a picture, which will cause it to be ready for
- * display. The picture won't be displayed until vout_DisplayPicture has been
- * called.
+ * This function is called when an error occured during thread main's loop. The
+ * thread can still receive feed, but must be ready to terminate as soon as
+ * possible.
  *****************************************************************************/
-void  vout_DatePicture( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date )
+static void ErrorThread( vout_thread_t *p_vout )
 {
-#ifdef TRACE_VOUT
-    char        psz_date[MSTRTIME_MAX_SIZE];                         /* date */
-#endif
-
-    vlc_mutex_lock( &p_vout->picture_lock );
-    p_pic->date = date;
-    switch( p_pic->i_status )
+    /* Wait until a `die' order */
+    while( !p_vout->b_die )
     {
-    case RESERVED_PICTURE:
-        p_pic->i_status = RESERVED_DATED_PICTURE;
-        break;
-    case RESERVED_DISP_PICTURE:
-        p_pic->i_status = READY_PICTURE;
-        break;
-#ifdef DEBUG
-    default:
-        intf_ErrMsg("error: picture %p has invalid status %d", p_pic, p_pic->i_status );
-        break;
-#endif
+        /* Sleep a while */
+        msleep( VOUT_IDLE_SLEEP );
     }
-
-#ifdef TRACE_VOUT
-    intf_DbgMsg("picture %p, display date: %s", p_pic, mstrtime( psz_date, p_pic->date) );
-#endif
-    vlc_mutex_unlock( &p_vout->picture_lock );
 }
 
 /*****************************************************************************
- * vout_CreatePicture: allocate a picture in the video output heap.
+ * EndThread: thread destruction
  *****************************************************************************
- * This function create a reserved image in the video output heap.
- * A null pointer is returned if the function fails. This method provides an
- * already allocated zone of memory in the picture data fields. It needs locking
- * since several pictures can be created by several producers threads.
+ * This function is called when the thread ends after a sucessful
+ * initialization. It frees all ressources allocated by InitThread.
  *****************************************************************************/
-picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
-                               int i_width, int i_height )
+static void EndThread( vout_thread_t *p_vout )
 {
-    int         i_picture;                                  /* picture index */
-    int         i_chroma_width = 0;                          /* chroma width */
-    picture_t * p_free_picture = NULL;                 /* first free picture */
-    picture_t * p_destroyed_picture = NULL;       /* first destroyed picture */
+    int     i_index;                                        /* index in heap */
 
-    /* Get lock */
-    vlc_mutex_lock( &p_vout->picture_lock );
+    /* Store status */
+    *p_vout->pi_status = THREAD_END;
 
-    /*
-     * Look for an empty place
-     */
-    for( i_picture = 0; i_picture < VOUT_MAX_PICTURES; i_picture++ )
+#ifdef STATS
     {
-        if( p_vout->p_picture[i_picture].i_status == DESTROYED_PICTURE )
-        {
-            /* Picture is marked for destruction, but is still allocated - note
-             * that if width and type are the same for two pictures, chroma_width
-             * should also be the same */
-            if( (p_vout->p_picture[i_picture].i_type           == i_type)   &&
-                (p_vout->p_picture[i_picture].i_height         == i_height) &&
-                (p_vout->p_picture[i_picture].i_width          == i_width) )
-            {
-                /* Memory size do match : memory will not be reallocated, and function
-                 * can end immediately - this is the best possible case, since no
-                 * memory allocation needs to be done */
-                p_vout->p_picture[i_picture].i_status = RESERVED_PICTURE;
-                p_vout->i_pictures++;
-#ifdef TRACE_VOUT
-                intf_DbgMsg("picture %p (in destroyed picture slot)",
-                            &p_vout->p_picture[i_picture] );
-#endif
-                vlc_mutex_unlock( &p_vout->picture_lock );
-                return( &p_vout->p_picture[i_picture] );
-            }
-            else if( p_destroyed_picture == NULL )
-            {
-                /* Memory size do not match, but picture index will be kept in
-                 * case no other place are left */
-                p_destroyed_picture = &p_vout->p_picture[i_picture];
-            }
-        }
-        else if( (p_free_picture == NULL) &&
-                 (p_vout->p_picture[i_picture].i_status == FREE_PICTURE ))
-        {
-            /* Picture is empty and ready for allocation */
-            p_free_picture = &p_vout->p_picture[i_picture];
-        }
-    }
+        struct tms cpu_usage;
+        times( &cpu_usage );
 
-    /* If no free picture is available, use a destroyed picture */
-    if( (p_free_picture == NULL) && (p_destroyed_picture != NULL ) )
-    {
-        /* No free picture or matching destroyed picture has been found, but
-         * a destroyed picture is still avalaible */
-        free( p_destroyed_picture->p_data );
-        p_free_picture = p_destroyed_picture;
+        intf_Msg( "vout stats: cpu usage (user: %d, system: %d)",
+                  cpu_usage.tms_utime, cpu_usage.tms_stime );
     }
+#endif
 
-    /*
-     * Prepare picture
-     */
-    if( p_free_picture != NULL )
+    /* Destroy all remaining pictures */
+    for( i_index = p_vout->i_directbuffers;
+         i_index < VOUT_MAX_PICTURES;
+         i_index++ )
     {
-        /* Allocate memory */
-        switch( i_type )
+        if( p_vout->p_picture[i_index].i_status != FREE_PICTURE )
         {
-        case YUV_420_PICTURE:        /* YUV 420: 1,1/4,1/4 samples per pixel */
-            i_chroma_width = i_width / 2;
-            p_free_picture->p_data = memalign( 16, i_height * i_chroma_width
-                                                 * 3 * sizeof( yuv_data_t ) );
-            p_free_picture->p_y = (yuv_data_t *)p_free_picture->p_data;
-            p_free_picture->p_u = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*4/2;
-            p_free_picture->p_v = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*5/2;
-            break;
-        case YUV_422_PICTURE:        /* YUV 422: 1,1/2,1/2 samples per pixel */
-            i_chroma_width = i_width / 2;
-            p_free_picture->p_data = memalign( 16, i_height * i_chroma_width
-                                                 * 4 * sizeof( yuv_data_t ) );
-            p_free_picture->p_y = (yuv_data_t *)p_free_picture->p_data;
-            p_free_picture->p_u = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*2;
-            p_free_picture->p_v = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*3;
-            break;
-        case YUV_444_PICTURE:            /* YUV 444: 1,1,1 samples per pixel */
-            i_chroma_width = i_width;
-            p_free_picture->p_data = memalign( 16, i_height * i_chroma_width
-                                                 * 3 * sizeof( yuv_data_t ) );
-            p_free_picture->p_y = (yuv_data_t *)p_free_picture->p_data;
-            p_free_picture->p_u = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width;
-            p_free_picture->p_v = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*2;
-            break;
-#ifdef DEBUG
-        default:
-            intf_ErrMsg("error: unknown picture type %d", i_type );
-            p_free_picture->p_data   =  NULL;
-            break;
-#endif
+            free( p_vout->p_picture[i_index].planes[0].p_data );
         }
+    }
 
-        if( p_free_picture->p_data != NULL )
-        {
-            /* Copy picture information, set some default values */
-            p_free_picture->i_type                      = i_type;
-            p_free_picture->i_status                    = RESERVED_PICTURE;
-            p_free_picture->i_matrix_coefficients       = 1;
-            p_free_picture->i_width                     = i_width;
-            p_free_picture->i_height                    = i_height;
-            p_free_picture->i_chroma_width              = i_chroma_width;
-            p_free_picture->i_size                      = i_width * i_height;
-            p_free_picture->i_chroma_size               = i_chroma_width
-                                                            * i_height;
-            p_free_picture->i_display_horizontal_offset = 0;
-            p_free_picture->i_display_vertical_offset   = 0;
-            p_free_picture->i_display_width             = i_width;
-            p_free_picture->i_display_height            = i_height;
-            p_free_picture->i_aspect_ratio              = AR_SQUARE_PICTURE;
-            p_free_picture->i_refcount                  = 0;
-            p_vout->i_pictures++;
-        }
-        else
+    /* Destroy all remaining subpictures */
+    for( i_index = 0; i_index < VOUT_MAX_SUBPICTURES; i_index++ )
+    {
+        if( p_vout->p_subpicture[i_index].i_status != FREE_SUBPICTURE )
         {
-            /* Memory allocation failed : set picture as empty */
-            p_free_picture->i_type   =  EMPTY_PICTURE;
-            p_free_picture->i_status =  FREE_PICTURE;
-            p_free_picture =            NULL;
-            intf_ErrMsg( "vout error: picture allocation returned %s",
-                         strerror( ENOMEM ) );
+            free( p_vout->p_subpicture[i_index].p_data );
         }
-
-#ifdef TRACE_VOUT
-        intf_DbgMsg("picture %p (in free picture slot)", p_free_picture );
-#endif
-        vlc_mutex_unlock( &p_vout->picture_lock );
-
-        return( p_free_picture );
     }
 
-    /* No free or destroyed picture could be found */
-    intf_DbgMsg( "warning: picture heap is full" );
-    vlc_mutex_unlock( &p_vout->picture_lock );
-    return( NULL );
+    /* Destroy translation tables */
+    p_vout->pf_end( p_vout );
+
+    /* Release the change lock */
+    vlc_mutex_unlock( &p_vout->change_lock );
 }
 
 /*****************************************************************************
- * vout_DestroyPicture: remove a permanent or reserved picture from the heap
+ * DestroyThread: thread destruction
  *****************************************************************************
- * This function frees a previously reserved picture or a permanent
- * picture. It is meant to be used when the construction of a picture aborted.
- * Note that the picture will be destroyed even if it is linked !
+ * This function is called when the thread ends. It frees all ressources
+ * allocated by CreateThread. Status is available at this stage.
  *****************************************************************************/
-void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic )
+static void DestroyThread( vout_thread_t *p_vout, int i_status )
 {
-    vlc_mutex_lock( &p_vout->picture_lock );
-
-#ifdef DEBUG
-    /* Check if picture status is valid */
-    if( (p_pic->i_status != RESERVED_PICTURE) &&
-        (p_pic->i_status != RESERVED_DATED_PICTURE) &&
-        (p_pic->i_status != RESERVED_DISP_PICTURE) )
-    {
-        intf_ErrMsg("error: picture %p has invalid status %d", p_pic, p_pic->i_status );
-    }
-#endif
-
-    p_pic->i_status = DESTROYED_PICTURE;
-    p_vout->i_pictures--;
-
-#ifdef TRACE_VOUT
-    intf_DbgMsg("picture %p", p_pic);
-#endif
-
-    vlc_mutex_unlock( &p_vout->picture_lock );
-}
-
-/*****************************************************************************
- * vout_LinkPicture: increment reference counter of a picture
- *****************************************************************************
- * This function increment the reference counter of a picture in the video
- * heap. It needs a lock since several producer threads can access the picture.
- *****************************************************************************/
-void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
-{
-    vlc_mutex_lock( &p_vout->picture_lock );
-    p_pic->i_refcount++;
-
-#ifdef TRACE_VOUT
-    intf_DbgMsg("picture %p refcount=%d", p_pic, p_pic->i_refcount );
-#endif
-
-    vlc_mutex_unlock( &p_vout->picture_lock );
-}
-
-/*****************************************************************************
- * vout_UnlinkPicture: decrement reference counter of a picture
- *****************************************************************************
- * This function decrement the reference counter of a picture in the video heap.
- *****************************************************************************/
-void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
-{
-    vlc_mutex_lock( &p_vout->picture_lock );
-    p_pic->i_refcount--;
-
-#ifdef TRACE_VOUT
-    if( p_pic->i_refcount < 0 )
-    {
-        intf_DbgMsg("error: refcount < 0");
-        p_pic->i_refcount = 0;
-    }
-#endif
-
-    if( (p_pic->i_refcount == 0) && (p_pic->i_status == DISPLAYED_PICTURE) )
-    {
-        p_pic->i_status = DESTROYED_PICTURE;
-        p_vout->i_pictures--;
-    }
-
-#ifdef TRACE_VOUT
-    intf_DbgMsg("picture %p refcount=%d", p_pic, p_pic->i_refcount );
-#endif
-
-    vlc_mutex_unlock( &p_vout->picture_lock );
-}
-
-/*****************************************************************************
- * vout_Pixel2RGB: return red, green and blue from pixel value
- *****************************************************************************
- * Return color values, in 0-255 range, of the decomposition of a pixel. This
- * is a slow routine and should only be used for initialization phase.
- *****************************************************************************/
-void vout_Pixel2RGB( vout_thread_t *p_vout, u32 i_pixel, int *pi_red, int *pi_green, int *pi_blue )
-{
-    *pi_red =   i_pixel & p_vout->i_red_mask;
-    *pi_green = i_pixel & p_vout->i_green_mask;
-    *pi_blue =  i_pixel & p_vout->i_blue_mask;
-}
-
-/* following functions are local */
-
-/*****************************************************************************
- * BinaryLog: computes the base 2 log of a binary value
- *****************************************************************************
- * This functions is used by MaskToShift, to get a bit index from a binary
- * value.
- *****************************************************************************/
-static int BinaryLog(u32 i)
-{
-    int i_log = 0;
-
-    if(i & 0xffff0000)
-    {
-        i_log += 16;
-    }
-    if(i & 0xff00ff00)
-    {
-        i_log += 8;
-    }
-    if(i & 0xf0f0f0f0)
-    {
-        i_log += 4;
-    }
-    if(i & 0xcccccccc)
-    {
-        i_log += 2;
-    }
-    if(i & 0xaaaaaaaa)
-    {
-        i_log += 1;
-    }
-
-    if (i != ((u32)1 << i_log))
-    {
-        intf_DbgMsg("internal error: binary log overflow");
-    }
-
-    return( i_log );
-}
-
-/*****************************************************************************
- * MaskToShift: transform a color mask into right and left shifts
- *****************************************************************************
- * This function is used for obtaining color shifts from masks.
- *****************************************************************************/
-static void MaskToShift( int *pi_left, int *pi_right, u32 i_mask )
-{
-    u32 i_low, i_high;                 /* lower hand higher bits of the mask */
-
-    /* Get bits */
-    i_low =  i_mask & (- i_mask);                   /* lower bit of the mask */
-    i_high = i_mask + i_low;                       /* higher bit of the mask */
-
-    /* Transform bits into an index */
-    i_low =  BinaryLog (i_low);
-    i_high = BinaryLog (i_high);
-
-    /* Update pointers and return */
-    *pi_left =   i_low;
-    *pi_right = (8 - i_high + i_low);
-}
-
-/*****************************************************************************
- * InitThread: initialize video output thread
- *****************************************************************************
- * This function is called from RunThread and performs the second step of the
- * initialization. It returns 0 on success. Note that the thread's flag are not
- * modified inside this function.
- *****************************************************************************/
-static int InitThread( vout_thread_t *p_vout )
-{
-    /* Update status */
-    *p_vout->pi_status = THREAD_START;
-
-    vlc_mutex_lock( &p_vout->change_lock );
-
-    /* Create and initialize system-dependant method - this function issues its
-     * own error messages */
-    if( p_vout->pf_create( p_vout ) )
-    {
-        /* If pf_create has failed then we have to make sure
-         * pf_destroy won't be called, because the plugin should have
-         * cleaned up all its mess */
-        p_vout->pf_destroy = NULL;
-        return( 1 );
-    }
-
-    intf_WarnMsg( 1, "vout: video display initialized (%dx%d, %d/%d bpp)",
-              p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth,
-              p_vout->i_bytes_per_pixel * 8 );
-
-    intf_WarnMsg( 3, "vout info: got %dx%d, %d/%d bpp (%d Bpl), "
-                  "masks: 0x%x/0x%x/0x%x",
-                  p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth,
-                  p_vout->i_bytes_per_pixel * 8, p_vout->i_bytes_per_line,
-                  p_vout->i_red_mask, p_vout->i_green_mask,
-                  p_vout->i_blue_mask );
-
-    /* Calculate shifts from system-updated masks */
-    MaskToShift( &p_vout->i_red_lshift, &p_vout->i_red_rshift,
-                 p_vout->i_red_mask );
-    MaskToShift( &p_vout->i_green_lshift, &p_vout->i_green_rshift,
-                 p_vout->i_green_mask );
-    MaskToShift( &p_vout->i_blue_lshift, &p_vout->i_blue_rshift,
-                 p_vout->i_blue_mask );
-
-    /* Set some useful colors */
-    p_vout->i_white_pixel = RGB2PIXEL( p_vout, 255, 255, 255 );
-    p_vout->i_black_pixel = RGB2PIXEL( p_vout, 0, 0, 0 );
-    p_vout->i_gray_pixel  = RGB2PIXEL( p_vout, 128, 128, 128 );
-    p_vout->i_blue_pixel  = RGB2PIXEL( p_vout, 0, 0, 50 );
-
-    /* Load fonts - fonts must be initialized after the system method since
-     * they may be dependant on screen depth and other thread properties */
-    p_vout->p_default_font = vout_LoadFont( VOUT_DEFAULT_FONT );
-    if( p_vout->p_default_font == NULL )
-    {
-        intf_ErrMsg( "vout error: could not load default font" );
-    }
-
-    p_vout->p_large_font = vout_LoadFont( VOUT_LARGE_FONT );
-    if( p_vout->p_large_font == NULL )
-    {
-        intf_ErrMsg( "vout error: could not load large font" );
-    }
-
-    /* Initialize output method. This function issues its own error messages */
-    if( p_vout->pf_init( p_vout ) )
-    {
-        /* If pf_init has failed then we have to make sure
-         * pf_destroy won't be called, because the plugin should have
-         * cleaned up all its mess */
-        p_vout->pf_destroy = NULL;
-        return( 1 );
-    }
-
-    /* Initialize convertion tables and functions */
-    if( vout_InitYUV( p_vout ) )
-    {
-        intf_ErrMsg("vout error: can't allocate YUV translation tables");
-        p_vout->pf_destroy( p_vout );
-        /* Make sure pf_destroy won't be called again */
-        p_vout->pf_destroy = NULL;
-        return( 1 );
-    }
-
-    /* Mark thread as running and return */
-    p_vout->b_active =          1;
-    *p_vout->pi_status =        THREAD_READY;
-
-
-    intf_DbgMsg("thread ready");
-    return( 0 );
-}
-
-/*****************************************************************************
- * RunThread: video output thread
- *****************************************************************************
- * Video output thread. This function does only returns when the thread is
- * terminated. It handles the pictures arriving in the video heap and the
- * display device events.
- *****************************************************************************/
-static void RunThread( vout_thread_t *p_vout)
-{
-    int             i_index;                                /* index in heap */
-    mtime_t         current_date;                            /* current date */
-    mtime_t         display_date;                            /* display date */
-    boolean_t       b_display;                               /* display flag */
-
-    picture_t *     p_pic;                                /* picture pointer */
-
-    subpicture_t *  p_subpic;                          /* subpicture pointer */
-    subpicture_t *  p_ephemer;        /* youngest ephemer subpicture pointer */
-    mtime_t         ephemer_date;                /* earliest subpicture date */
-
-    /*
-     * Initialize thread
-     */
-    if( InitThread( p_vout ) )
-    {
-        /* Something bad happened */
-        DestroyThread( p_vout, THREAD_ERROR );
-        return;
-    }
-    /*
-     * Main loop - it is not executed if an error occured during
-     * initialization
-     */
-    while( (!p_vout->b_die) && (!p_vout->b_error) )
-    {
-        /* Initialize loop variables */
-        p_vout->p_rendered_pic = NULL;
-        p_pic =         NULL;
-        p_subpic =      NULL;
-        p_ephemer =     NULL;
-        ephemer_date =  0;
-        display_date =  0;
-        current_date =  mdate();
-
-        p_vout->c_loops++;
-        if( !(p_vout->c_loops % VOUT_STATS_NB_LOOPS) )
-        {
-            intf_StatMsg( "vout info: picture heap: %d/%d",
-                          p_vout->i_pictures, VOUT_MAX_PICTURES );
-        }
-
-        /*
-         * Find the picture to display - this operation does not need lock,
-         * since only READY_PICTUREs are handled
-         */
-        for( i_index = 0; i_index < VOUT_MAX_PICTURES; i_index++ )
-        {
-            if( (p_vout->p_picture[i_index].i_status == READY_PICTURE) &&
-            ( (p_pic == NULL) ||
-              (p_vout->p_picture[i_index].date < display_date) ) )
-            {
-                p_pic = &p_vout->p_picture[i_index];
-                display_date = p_pic->date;
-            }
-        }
-
-        if( p_pic )
-        {
-            p_vout->c_pictures++;
-
-            /* Computes FPS rate */
-            p_vout->p_fps_sample[ p_vout->c_fps_samples++ % VOUT_FPS_SAMPLES ] = display_date;
-
-            if( display_date < current_date + p_vout->render_time )
-            {
-                /* Picture is late: it will be destroyed and the thread
-                 * will sleep and go to next picture */
-
-                vlc_mutex_lock( &p_vout->picture_lock );
-                if( p_pic->i_refcount )
-                {
-                    p_pic->i_status = DISPLAYED_PICTURE;
-                }
-                else
-                {
-                    p_pic->i_status = DESTROYED_PICTURE;
-                    p_vout->i_pictures--;
-                }
-                vlc_mutex_unlock( &p_vout->picture_lock );
-
-                intf_WarnMsg( 1,
-                        "vout warning: late picture skipped (%p)", p_pic );
-                p_vout->c_late_pictures++;
-
-                continue;
-            }
-            else if( display_date > current_date + VOUT_DISPLAY_DELAY )
-            {
-                /* A picture is ready to be rendered, but its rendering date
-                 * is far from the current one so the thread will perform an
-                 * empty loop as if no picture were found. The picture state
-                 * is unchanged */
-                p_pic =         NULL;
-                display_date =  0;
-            }
-        }
-
-        /*
-         * Find the subpictures to display - this operation does not need
-         * lock, since only READY_SUBPICTURE are handled. If no picture
-         * has been selected, display_date will depend on the subpicture.
-         *
-         * We also check for ephemer DVD subpictures (subpictures that have
-         * to be removed if a newer one is available), which makes it a lot
-         * more difficult to guess if a subpicture has to be rendered or not.
-         *
-         * We get an easily parsable chained list of subpictures which
-         * ends with NULL since p_subpic was initialized to NULL.
-         */
-        for( i_index = 0; i_index < VOUT_MAX_SUBPICTURES; i_index++ )
-        {
-            if( p_vout->p_subpicture[i_index].i_status == READY_SUBPICTURE )
-            {
-                /* If it is a DVD subpicture, check its date */
-                if( p_vout->p_subpicture[i_index].i_type == DVD_SUBPICTURE )
-                {
-                    if( display_date > p_vout->p_subpicture[i_index].i_stop )
-                    {
-                        /* Too late, destroy the subpic */
-                        vout_DestroySubPicture( p_vout,
-                                        &p_vout->p_subpicture[i_index] );
-                        continue;
-                    }
-
-                    if( display_date < p_vout->p_subpicture[i_index].i_start )
-                    {
-                        /* Too early, come back next monday */
-                        continue;
-                    }
-
-                    /* If this is an ephemer subpic, see if it's the
-                     * youngest we have */
-                    if( p_vout->p_subpicture[i_index].b_ephemer )
-                    {
-                        if( p_ephemer == NULL )
-                        {
-                            p_ephemer = &p_vout->p_subpicture[i_index];
-                            continue;
-                        }
-
-                        if( p_vout->p_subpicture[i_index].i_start
-                                                         < p_ephemer->i_start )
-                        {
-                            /* Link the previous ephemer subpicture and
-                             * replace it with the current one */
-                            p_ephemer->p_next = p_subpic;
-                            p_subpic = p_ephemer;
-                            p_ephemer = &p_vout->p_subpicture[i_index];
-
-                            /* If it's the 2nd youngest subpicture,
-                             * register its date */
-                            if( !ephemer_date
-                                  || ephemer_date > p_subpic->i_start )
-                            {
-                                ephemer_date = p_subpic->i_start;
-                            }
-
-                            continue;
-                        }
-                    }
-
-                    p_vout->p_subpicture[i_index].p_next = p_subpic;
-                    p_subpic = &p_vout->p_subpicture[i_index];
-
-                    /* If it's the 2nd youngest subpicture, register its date */
-                    if( !ephemer_date || ephemer_date > p_subpic->i_start )
-                    {
-                        ephemer_date = p_subpic->i_start;
-                    }
-                }
-                /* If it's not a DVD subpicture, just register it */
-                else
-                {
-                    p_vout->p_subpicture[i_index].p_next = p_subpic;
-                    p_subpic = &p_vout->p_subpicture[i_index];
-                }
-            }
-        }
-
-        /* If we found an ephemer subpicture, check if it has to be
-         * displayed */
-        if( p_ephemer != NULL )
-        {
-            if( p_ephemer->i_start < ephemer_date )
-            {
-                /* Ephemer subpicture has lived too long */
-                vout_DestroySubPicture( p_vout, p_ephemer );
-            }
-            else
-            {
-                /* Ephemer subpicture can still live a bit */
-                p_ephemer->p_next = p_subpic;
-                p_subpic = p_ephemer;
-            }
-        }
-
-        /*
-         * Perform rendering, sleep and display rendered picture
-         */
-        if( p_pic )                        /* picture and perhaps subpicture */
-        {
-            b_display = p_vout->b_active;
-            p_vout->last_display_date = display_date;
-            p_vout->p_rendered_pic = p_pic;
-
-            /* FIXME: if b_need_render == 0 we need to do something with
-             * the subpictures one day. */
-
-            if( p_vout->b_need_render && b_display )
-            {
-                /* Set picture dimensions and clear buffer */
-                SetBufferPicture( p_vout, p_pic );
-
-                /* Render picture and information */
-                RenderPicture( p_vout, p_pic );
-                if( p_vout->b_info )
-                {
-                    RenderPictureInfo( p_vout, p_pic );
-                    RenderInfo( p_vout );
-                }
-            }
-            if( b_display ) /* XXX: quick HACK */
-            {
-                if( p_subpic )
-                {
-                    RenderSubPicture( p_vout, p_pic, p_subpic );
-                }
-            }
-        }
-        else if( p_vout->b_active && p_vout->b_need_render
-                  && p_vout->init_display_date == 0)
-        {
-            /* Idle or interface screen alone */
-
-            if( p_vout->b_interface && 0 /* && XXX?? intf_change */ )
-            {
-                /* Interface has changed, so a new rendering is required - force
-                 * it by setting last idle date to 0 */
-                p_vout->last_idle_date = 0;
-            }
-
-            /* Render idle screen and update idle date, then render interface if
-             * required */
-            b_display = RenderIdle( p_vout );
-            if( b_display )
-            {
-                p_vout->last_idle_date = current_date;
-            }
-
-        }
-        else
-        {
-            b_display = 0;
-        }
-
-
-        /*
-         * Check for the current time and
-         * display splash screen if everything is on time
-         */
-        if( p_vout->init_display_date > 0 && p_vout->b_need_render )
-        {
-            p_vout->init_display_date = 0;
-        }
-
-
-        /*
-         * Sleep, wake up and display rendered picture
-         */
-
-        if( display_date != 0 )
-        {
-            /* Store render time using Bresenham algorithm */
-            p_vout->render_time += mdate() - current_date;
-            p_vout->render_time >>= 1;
-        }
-
-        /* Give back change lock */
-        vlc_mutex_unlock( &p_vout->change_lock );
-
-        /* Sleep a while or until a given date */
-        if( display_date != 0 )
-        {
-            mwait( display_date - VOUT_MWAIT_TOLERANCE );
-        }
-        else
-        {
-            msleep( VOUT_IDLE_SLEEP );
-        }
-
-        /* On awakening, take back lock and send immediately picture to display,
-         * then swap buffers */
-        vlc_mutex_lock( &p_vout->change_lock );
-#ifdef TRACE_VOUT
-        intf_DbgMsg( "picture %p, subpicture %p in buffer %d, display=%d", p_pic, p_subpic,
-                     p_vout->i_buffer_index, b_display /* && !(p_vout->i_changes & VOUT_NODISPLAY_CHANGE) */ );
-#endif
-        if( b_display /* && !(p_vout->i_changes & VOUT_NODISPLAY_CHANGE) */ )
-        {
-            mtime_t     jitter;
-
-            p_vout->pf_display( p_vout );
-#ifndef SYS_BEOS
-            p_vout->i_buffer_index = ++p_vout->i_buffer_index & 1;
-#endif
-
-            /* Update statistics */
-            jitter = display_date - mdate();
-            if( jitter < 0 ) jitter = -jitter;
-            p_vout->display_jitter = ((p_vout->display_jitter
-                                        * p_vout->c_jitter_samples) + jitter)
-                                       / (p_vout->c_jitter_samples + 1);
-            if( p_vout->c_jitter_samples < MAX_JITTER_SAMPLES )
-            {
-                p_vout->c_jitter_samples++;
-            }
-        }
-
-        if( p_pic )
-        {
-            /* Remove picture from heap */
-            vlc_mutex_lock( &p_vout->picture_lock );
-            if( p_pic->i_refcount )
-            {
-                p_pic->i_status = DISPLAYED_PICTURE;
-            }
-            else
-            {
-                p_pic->i_status = DESTROYED_PICTURE;
-                p_vout->i_pictures--;
-            }
-            vlc_mutex_unlock( &p_vout->picture_lock );
-        }
-
-
-        /*
-         * Check events and manage thread
-         */
-        if( p_vout->pf_manage( p_vout ) | Manage( p_vout ) )
-        {
-            /* A fatal error occured, and the thread must terminate immediately
-             * without displaying anything - setting b_error to 1 cause the
-             * immediate end of the main while() loop. */
-            p_vout->b_error = 1;
-        }
-    }
-
-    /*
-     * Error loop - wait until the thread destruction is requested
-     */
-    if( p_vout->b_error )
-    {
-        ErrorThread( p_vout );
-    }
-
-    /* End of thread */
-    EndThread( p_vout );
-    DestroyThread( p_vout, THREAD_OVER );
-    intf_DbgMsg( "thread end" );
-}
-
-/*****************************************************************************
- * ErrorThread: RunThread() error loop
- *****************************************************************************
- * This function is called when an error occured during thread main's loop. The
- * thread can still receive feed, but must be ready to terminate as soon as
- * possible.
- *****************************************************************************/
-static void ErrorThread( vout_thread_t *p_vout )
-{
-    /* Wait until a `die' order */
-    while( !p_vout->b_die )
-    {
-        /* Sleep a while */
-        msleep( VOUT_IDLE_SLEEP );
-    }
-}
-
-/*****************************************************************************
- * EndThread: thread destruction
- *****************************************************************************
- * This function is called when the thread ends after a sucessful
- * initialization. It frees all ressources allocated by InitThread.
- *****************************************************************************/
-static void EndThread( vout_thread_t *p_vout )
-{
-    int     i_index;                                        /* index in heap */
-
-    /* Store status */
-    *p_vout->pi_status = THREAD_END;
-
-    if( p_main->b_stats )
-    {
-#ifdef HAVE_SYS_TIMES_H
-        struct tms cpu_usage;
-        times( &cpu_usage );
-
-        intf_StatMsg( "vout info: %d loops consuming user: %d, system: %d",
-                      p_vout->c_loops, cpu_usage.tms_utime, cpu_usage.tms_stime );
-#else
-        intf_StatMsg( "vout info: %d loops", p_vout->c_loops );
-#endif
-
-        intf_StatMsg( "vout info: %d pictures received, discarded %d",
-                      p_vout->c_pictures, p_vout->c_late_pictures );
-        intf_StatMsg( "vout info: average display jitter of %lld Âµs",
-                      p_vout->display_jitter );
-    }
-
-    /* Destroy all remaining pictures and subpictures */
-    for( i_index = 0; i_index < VOUT_MAX_PICTURES; i_index++ )
-    {
-        if( p_vout->p_picture[i_index].i_status != FREE_PICTURE )
-        {
-            free( p_vout->p_picture[i_index].p_data );
-        }
-    }
-
-    for( i_index = 0; i_index < VOUT_MAX_SUBPICTURES; i_index++ )
-    {
-        if( p_vout->p_subpicture[i_index].i_status != FREE_SUBPICTURE )
-        {
-            free( p_vout->p_subpicture[i_index].p_data );
-        }
-    }
-
-    /* Destroy translation tables */
-    vout_EndYUV( p_vout );
-    p_vout->pf_end( p_vout );
-
-    /* Release the change lock */
-    vlc_mutex_unlock( &p_vout->change_lock );
-}
-
-/*****************************************************************************
- * DestroyThread: thread destruction
- *****************************************************************************
- * This function is called when the thread ends. It frees all ressources
- * allocated by CreateThread. Status is available at this stage.
- *****************************************************************************/
-static void DestroyThread( vout_thread_t *p_vout, int i_status )
-{
-    int *pi_status;                                         /* status adress */
-
-    /* Store status adress */
-    pi_status = p_vout->pi_status;
-
-    /* Destroy thread structures allocated by Create and InitThread */
-    vout_UnloadFont( p_vout->p_default_font );
-    vout_UnloadFont( p_vout->p_large_font );
-    if( p_vout->pf_destroy != NULL ) p_vout->pf_destroy( p_vout );
-
-    /* Destroy the locks */
-    vlc_mutex_destroy( &p_vout->picture_lock );
-    vlc_mutex_destroy( &p_vout->subpicture_lock );
-    vlc_mutex_destroy( &p_vout->change_lock );
-
-    /* Release the module */
-    module_Unneed( p_vout->p_module );
-
-    /* Free structure */
-    free( p_vout );
-    *pi_status = i_status;
-}
-
-/*****************************************************************************
- * Print: print simple text on a picture
- *****************************************************************************
- * This function will print a simple text on the picture. It is designed to
- * print debugging or general information.
- *****************************************************************************/
-void Print( vout_thread_t *p_vout, int i_x, int i_y, int i_h_align, int i_v_align, unsigned char *psz_text )
-{
-    int                 i_text_height;                  /* total text height */
-    int                 i_text_width;                    /* total text width */
-
-    /* Update upper left coordinates according to alignment */
-    vout_TextSize( p_vout->p_default_font, 0, psz_text, &i_text_width, &i_text_height );
-    if( !Align( p_vout, &i_x, &i_y, i_text_width, i_text_height, i_h_align, i_v_align ) )
-    {
-        /* Set area and print text */
-        SetBufferArea( p_vout, i_x, i_y, i_text_width, i_text_height );
-        vout_Print( p_vout->p_default_font, p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
-                    i_y * p_vout->i_bytes_per_line + i_x * p_vout->i_bytes_per_pixel,
-                    p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
-                    p_vout->i_white_pixel, 0, 0,
-                    0, psz_text, 100 );
-    }
-}
-
-/*****************************************************************************
- * SetBuffers: set buffers adresses
- *****************************************************************************
- * This function is called by system drivers to set buffers video memory
- * adresses.
- *****************************************************************************/
-static void SetBuffers( vout_thread_t *p_vout, void *p_buf1, void *p_buf2 )
-{
-    /* No picture previously */
-    p_vout->p_buffer[0].i_pic_x =         0;
-    p_vout->p_buffer[0].i_pic_y =         0;
-    p_vout->p_buffer[0].i_pic_width =     0;
-    p_vout->p_buffer[0].i_pic_height =    0;
-    p_vout->p_buffer[1].i_pic_x =         0;
-    p_vout->p_buffer[1].i_pic_y =         0;
-    p_vout->p_buffer[1].i_pic_width =     0;
-    p_vout->p_buffer[1].i_pic_height =    0;
-
-    /* The first area covers all the screen */
-    p_vout->p_buffer[0].i_areas =                 1;
-    p_vout->p_buffer[0].pi_area_begin[0] =        0;
-    p_vout->p_buffer[0].pi_area_end[0] =          p_vout->i_height - 1;
-    p_vout->p_buffer[1].i_areas =                 1;
-    p_vout->p_buffer[1].pi_area_begin[0] =        0;
-    p_vout->p_buffer[1].pi_area_end[0] =          p_vout->i_height - 1;
-
-    /* Set adresses */
-    p_vout->p_buffer[0].p_data = p_buf1;
-    p_vout->p_buffer[1].p_data = p_buf2;
-}
-
-/*****************************************************************************
- * SetBufferArea: activate an area in current buffer
- *****************************************************************************
- * This function is called when something is rendered on the current buffer.
- * It set the area as active and prepare it to be cleared on next rendering.
- * Pay attention to the fact that in this functions, i_h is in fact the end y
- * coordinate of the new area.
- *****************************************************************************/
-static void SetBufferArea( vout_thread_t *p_vout, int i_x, int i_y, int i_w, int i_h )
-{
-    vout_buffer_t *     p_buffer;                          /* current buffer */
-    int                 i_area_begin, i_area_end; /* area vertical extension */
-    int                 i_area, i_area_copy;                   /* area index */
-    int                 i_area_shift;            /* shift distance for areas */
-
-    /* Choose buffer and modify h to end of area position */
-    p_buffer =  &p_vout->p_buffer[ p_vout->i_buffer_index ];
-    i_h +=      i_y - 1;
-
-    /*
-     * Remove part of the area which is inside the picture - this is done
-     * by calling again SetBufferArea with the correct areas dimensions.
-     */
-    if( (i_x >= p_buffer->i_pic_x) && (i_x + i_w <= p_buffer->i_pic_x + p_buffer->i_pic_width) )
-    {
-        i_area_begin =  p_buffer->i_pic_y;
-        i_area_end =    i_area_begin + p_buffer->i_pic_height - 1;
-
-        if( ((i_y >= i_area_begin) && (i_y <= i_area_end)) ||
-            ((i_h >= i_area_begin) && (i_h <= i_area_end)) ||
-            ((i_y <  i_area_begin) && (i_h > i_area_end)) )
-        {
-            /* Keep the stripe above the picture, if any */
-            if( i_y < i_area_begin )
-            {
-                SetBufferArea( p_vout, i_x, i_y, i_w, i_area_begin - i_y );
-            }
-            /* Keep the stripe below the picture, if any */
-            if( i_h > i_area_end )
-            {
-                SetBufferArea( p_vout, i_x, i_area_end, i_w, i_h - i_area_end );
-            }
-            return;
-        }
-    }
-
-    /* Skip some extensions until interesting areas */
-    for( i_area = 0;
-         (i_area < p_buffer->i_areas) &&
-             (p_buffer->pi_area_end[i_area] + 1 <= i_y);
-         i_area++ )
-    {
-        ;
-    }
-
-    if( i_area == p_buffer->i_areas )
-    {
-        /* New area is below all existing ones: just add it at the end of the
-         * array, if possible - otherwise, append it to the last one */
-        if( i_area < VOUT_MAX_AREAS )
-        {
-            p_buffer->pi_area_begin[i_area] = i_y;
-            p_buffer->pi_area_end[i_area] = i_h;
-            p_buffer->i_areas++;
-        }
-        else
-        {
-#ifdef TRACE_VOUT
-            intf_DbgMsg("area overflow");
-#endif
-            p_buffer->pi_area_end[VOUT_MAX_AREAS - 1] = i_h;
-        }
-    }
-    else
-    {
-        i_area_begin =  p_buffer->pi_area_begin[i_area];
-        i_area_end =    p_buffer->pi_area_end[i_area];
-
-        if( i_y < i_area_begin )
-        {
-            if( i_h >= i_area_begin - 1 )
-            {
-                /* Extend area above */
-                p_buffer->pi_area_begin[i_area] = i_y;
-            }
-            else
-            {
-                /* Create a new area above : merge last area if overflow, then
-                 * move all old areas down */
-                if( p_buffer->i_areas == VOUT_MAX_AREAS )
-                {
-#ifdef TRACE_VOUT
-                    intf_DbgMsg("areas overflow");
-#endif
-                    p_buffer->pi_area_end[VOUT_MAX_AREAS - 2] = p_buffer->pi_area_end[VOUT_MAX_AREAS - 1];
-                }
-                else
-                {
-                    p_buffer->i_areas++;
-                }
-                for( i_area_copy = p_buffer->i_areas - 1; i_area_copy > i_area; i_area_copy-- )
-                {
-                    p_buffer->pi_area_begin[i_area_copy] = p_buffer->pi_area_begin[i_area_copy - 1];
-                    p_buffer->pi_area_end[i_area_copy] =   p_buffer->pi_area_end[i_area_copy - 1];
-                }
-                p_buffer->pi_area_begin[i_area] = i_y;
-                p_buffer->pi_area_end[i_area] = i_h;
-                return;
-            }
-        }
-        if( i_h > i_area_end )
-        {
-            /* Find further areas which can be merged with the new one */
-            for( i_area_copy = i_area + 1;
-                 (i_area_copy < p_buffer->i_areas) &&
-                     (p_buffer->pi_area_begin[i_area] <= i_h);
-                 i_area_copy++ )
-            {
-                ;
-            }
-            i_area_copy--;
-
-            if( i_area_copy != i_area )
-            {
-                /* Merge with last possible areas */
-                //p_buffer->pi_area_end[i_area] = MAX( i_h, p_buffer->pi_area_end[i_area_copy] );
-
-                /* Shift lower areas upward */
-                i_area_shift = i_area_copy - i_area;
-                p_buffer->i_areas -= i_area_shift;
-                for( i_area_copy = i_area + 1; i_area_copy < p_buffer->i_areas; i_area_copy++ )
-                {
-                    p_buffer->pi_area_begin[i_area_copy] = p_buffer->pi_area_begin[i_area_copy + i_area_shift];
-                    p_buffer->pi_area_end[i_area_copy] =   p_buffer->pi_area_end[i_area_copy + i_area_shift];
-                }
-            }
-            else
-            {
-                /* Extend area below */
-                p_buffer->pi_area_end[i_area] = i_h;
-            }
-        }
-    }
-}
-
-/*****************************************************************************
- * SetBufferPicture: clear buffer and set picture area
- *****************************************************************************
- * This function is called before any rendering. It clears the current
- * rendering buffer and set the new picture area. If the picture pointer is
- * NULL, then no picture area is defined. Floating operations are avoided since
- * some MMX calculations may follow.
- *****************************************************************************/
-static void SetBufferPicture( vout_thread_t *p_vout, picture_t *p_pic )
-{
-    vout_buffer_t *     p_buffer;                          /* current buffer */
-    int                 i_pic_x, i_pic_y;                /* picture position */
-    int                 i_pic_width, i_pic_height;     /* picture dimensions */
-    int                 i_old_pic_y, i_old_pic_height;   /* old picture area */
-    int                 i_vout_width, i_vout_height;   /* display dimensions */
-    int                 i_area;                                /* area index */
-    int                 i_data_index;                     /* area data index */
-    int                 i_data_size;   /* area data size, in 256 bytes blocs */
-    u64 *               p_data;                   /* area data, for clearing */
-    byte_t *            p_data8;           /* area data, for clearing (slow) */
-
-    /* Choose buffer and set display dimensions */
-    p_buffer =          &p_vout->p_buffer[ p_vout->i_buffer_index ];
-    i_vout_width =      p_vout->i_width;
-    i_vout_height =     p_vout->i_height;
-
-    /*
-     * Computes new picture size
-     */
-    if( p_pic != NULL )
-    {
-        /* Try horizontal scaling first - width must be a mutiple of 16 */
-        i_pic_width = (( p_vout->b_scale || (p_pic->i_width > i_vout_width)) ?
-                       i_vout_width : p_pic->i_width) & ~0xf;
-        switch( p_pic->i_aspect_ratio )
-        {
-        case AR_3_4_PICTURE:
-            i_pic_height = i_pic_width * 3 / 4;
-            break;
-        case AR_16_9_PICTURE:
-            i_pic_height = i_pic_width * 9 / 16;
-            break;
-        case AR_221_1_PICTURE:
-            i_pic_height = i_pic_width * 100 / 221;
-            break;
-        case AR_SQUARE_PICTURE:
-        default:
-            i_pic_height = p_pic->i_height * i_pic_width / p_pic->i_width;
-            break;
-        }
-
-        /* If picture dimensions using horizontal scaling are too large, use
-         * vertical scaling. Since width must be a multiple of 16, height is
-         * adjusted again after. */
-        if( i_pic_height > i_vout_height )
-        {
-            i_pic_height = ( p_vout->b_scale || (p_pic->i_height > i_vout_height)) ?
-                i_vout_height : p_pic->i_height;
-            switch( p_pic->i_aspect_ratio )
-            {
-            case AR_3_4_PICTURE:
-                i_pic_width = (i_pic_height * 4 / 3) & ~0xf;
-                i_pic_height = i_pic_width * 3 / 4;
-                break;
-            case AR_16_9_PICTURE:
-                i_pic_width = (i_pic_height * 16 / 9) & ~0xf;
-                i_pic_height = i_pic_width * 9 / 16;
-                break;
-            case AR_221_1_PICTURE:
-                i_pic_width = (i_pic_height * 221 / 100) & ~0xf;
-                i_pic_height = i_pic_width * 100 / 221;
-                break;
-            case AR_SQUARE_PICTURE:
-            default:
-                i_pic_width = (p_pic->i_width * i_pic_height / p_pic->i_height) & ~0xf;
-                i_pic_height = p_pic->i_height * i_pic_width / p_pic->i_width;
-                break;
-            }
-        }
-
-        /* Set picture position */
-        i_pic_x = (p_vout->i_width - i_pic_width) / 2;
-        i_pic_y = (p_vout->i_height - i_pic_height) / 2;
-
-    }
-    else
-    {
-        /* No picture: size is 0 */
-        i_pic_x =       0;
-        i_pic_y =       0;
-        i_pic_width =   0;
-        i_pic_height =  0;
-    }
-
-    /*
-     * Set new picture size - if it is smaller than the previous one, clear
-     * around it. Since picture are centered, only their size is tested.
-     */
-    if( (p_buffer->i_pic_width > i_pic_width) || (p_buffer->i_pic_height > i_pic_height) )
-    {
-        i_old_pic_y =            p_buffer->i_pic_y;
-        i_old_pic_height =       p_buffer->i_pic_height;
-        p_buffer->i_pic_x =      i_pic_x;
-        p_buffer->i_pic_y =      i_pic_y;
-        p_buffer->i_pic_width =  i_pic_width;
-        p_buffer->i_pic_height = i_pic_height;
-        SetBufferArea( p_vout, 0, i_old_pic_y, p_vout->i_width, i_old_pic_height );
-    }
-    else
-    {
-        p_buffer->i_pic_x =      i_pic_x;
-        p_buffer->i_pic_y =      i_pic_y;
-        p_buffer->i_pic_width =  i_pic_width;
-        p_buffer->i_pic_height = i_pic_height;
-    }
-
-    /*
-     * Clear areas
-     */
-    for( i_area = 0; i_area < p_buffer->i_areas; i_area++ )
-    {
-#ifdef TRACE_VOUT
-        intf_DbgMsg("clearing picture %p area in buffer %d: %d-%d", p_pic,
-                    p_vout->i_buffer_index, p_buffer->pi_area_begin[i_area], p_buffer->pi_area_end[i_area] );
-#endif
-        i_data_size = (p_buffer->pi_area_end[i_area] - p_buffer->pi_area_begin[i_area] + 1) * p_vout->i_bytes_per_line;
-        p_data = (u64*) (p_buffer->p_data + p_vout->i_bytes_per_line * p_buffer->pi_area_begin[i_area]);
-
-        for( i_data_index = i_data_size / 256; i_data_index-- ; )
-        {
-            /* Clear 256 bytes block */
-            *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;
-            *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;
-            *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;
-            *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;
-            *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;
-            *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;
-            *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;
-            *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;  *p_data++ = 0;
-        }
-        for( i_data_index = (i_data_size % 256) / 16; i_data_index--; )
-        {
-            /* Clear remaining 16 bytes blocks */
-            *p_data++ = 0;  *p_data++ = 0;
-        }
-        p_data8 = (byte_t *)p_data;
-        for( i_data_index = i_data_size % 16; i_data_index--; )
-        {
-            /* Clear remaining bytes */
-            *p_data8++ = 0;
-        }
-    }
-
-    /*
-     * Clear areas array
-     */
-    p_buffer->i_areas = 0;
-}
-
-/*****************************************************************************
- * RenderPicture: render a picture
- *****************************************************************************
- * This function converts a picture from a video heap to a pixel-encoded image
- * and copies it to the current rendering buffer. No lock is required, since
- * the * rendered picture has been determined as existant, and will only be
- * destroyed by the vout thread later.
- *****************************************************************************/
-static void RenderPicture( vout_thread_t *p_vout, picture_t *p_pic )
-{
-#ifdef TRACE_VOUT
-    char                psz_date[MSTRTIME_MAX_SIZE];         /* picture date */
-    mtime_t             render_time;               /* picture rendering time */
-#endif
-    vout_buffer_t *     p_buffer;                        /* rendering buffer */
-    byte_t *            p_pic_data;                /* convertion destination */
-
-    /* Get and set rendering information */
-    p_buffer =          &p_vout->p_buffer[ p_vout->i_buffer_index ];
-    p_pic_data =        p_buffer->p_data +
-                        p_buffer->i_pic_x * p_vout->i_bytes_per_pixel +
-                        p_buffer->i_pic_y * p_vout->i_bytes_per_line;
-#ifdef TRACE_VOUT
-    render_time = mdate();
-#endif
-
-
-
-    /*
-     * Choose appropriate rendering function and render picture
-     */
-    switch( p_pic->i_type )
-    {
-    case YUV_420_PICTURE:
-        p_vout->yuv.pf_yuv420( p_vout, p_pic_data,
-                               p_pic->p_y, p_pic->p_u, p_pic->p_v,
-                               p_pic->i_width, p_pic->i_height,
-                               p_buffer->i_pic_width, p_buffer->i_pic_height,
-                               p_vout->i_bytes_per_line / p_vout->i_bytes_per_pixel,
-                               p_pic->i_matrix_coefficients );
-        break;
-    case YUV_422_PICTURE:
-        p_vout->yuv.pf_yuv422( p_vout, p_pic_data,
-                               p_pic->p_y, p_pic->p_u, p_pic->p_v,
-                               p_pic->i_width, p_pic->i_height,
-                               p_buffer->i_pic_width, p_buffer->i_pic_height,
-                               p_vout->i_bytes_per_line / p_vout->i_bytes_per_pixel,
-                               p_pic->i_matrix_coefficients );
-        break;
-    case YUV_444_PICTURE:
-        p_vout->yuv.pf_yuv444( p_vout, p_pic_data,
-                               p_pic->p_y, p_pic->p_u, p_pic->p_v,
-                               p_pic->i_width, p_pic->i_height,
-                               p_buffer->i_pic_width, p_buffer->i_pic_height,
-                               p_vout->i_bytes_per_line / p_vout->i_bytes_per_pixel,
-                               p_pic->i_matrix_coefficients );
-        break;
-#ifdef DEBUG
-    default:
-        intf_ErrMsg("error: unknown picture type %d", p_pic->i_type );
-        break;
-#endif
-    }
-
-#ifdef TRACE_VOUT
-    /* Print picture date and rendering time */
-    intf_DbgMsg("picture %p rendered in buffer %d (%ld us), display date: %s", p_pic,
-                p_vout->i_buffer_index, (long) (mdate() - render_time),
-                mstrtime( psz_date, p_pic->date ));
-#endif
-}
-
-/*****************************************************************************
- * RenderPictureInfo: print additionnal information on a picture
- *****************************************************************************
- * This function will print information such as fps and other picture
- * dependant information.
- *****************************************************************************/
-static void RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic )
-{
-    char        psz_buffer[256];                            /* string buffer */
-
-    /*
-     * Print FPS rate in upper right corner
-     */
-    if( p_vout->c_fps_samples > VOUT_FPS_SAMPLES )
-    {
-        long i_fps = VOUT_FPS_SAMPLES * 1000000 * 10 /
-                           ( p_vout->p_fps_sample[ (p_vout->c_fps_samples - 1)
-                                                   % VOUT_FPS_SAMPLES ] -
-                             p_vout->p_fps_sample[ p_vout->c_fps_samples
-                                                   % VOUT_FPS_SAMPLES ] );
-        sprintf( psz_buffer, "%li.%i fps", i_fps / 10, (int)i_fps % 10 );
-        Print( p_vout, 0, 0, RIGHT_RALIGN, TOP_RALIGN, psz_buffer );
-    }
-
-    /*
-     * Print frames count and loop time in upper left corner
-     */
-    sprintf( psz_buffer, "%ld frames, render: %ldus",
-             (long) p_vout->c_fps_samples, (long) p_vout->render_time );
-    Print( p_vout, 0, 0, LEFT_RALIGN, TOP_RALIGN, psz_buffer );
-
-    if( p_main->b_stats )
-    {
-        /*
-         * Print picture information in lower right corner
-         */
-        sprintf( psz_buffer, "%s picture %dx%d (%dx%d%+d%+d %s) -> %dx%d+%d+%d",
-             (p_pic->i_type == YUV_420_PICTURE) ? "4:2:0" :
-             ((p_pic->i_type == YUV_422_PICTURE) ? "4:2:2" :
-              ((p_pic->i_type == YUV_444_PICTURE) ? "4:4:4" : "ukn-type")),
-             p_pic->i_width, p_pic->i_height,
-             p_pic->i_display_width, p_pic->i_display_height,
-             p_pic->i_display_horizontal_offset, p_pic->i_display_vertical_offset,
-             (p_pic->i_aspect_ratio == AR_SQUARE_PICTURE) ? "sq" :
-             ((p_pic->i_aspect_ratio == AR_3_4_PICTURE) ? "4:3" :
-              ((p_pic->i_aspect_ratio == AR_16_9_PICTURE) ? "16:9" :
-               ((p_pic->i_aspect_ratio == AR_221_1_PICTURE) ? "2.21:1" : "ukn-ar" ))),
-             p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_width,
-             p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_height,
-             p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_x,
-             p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_y );
-        Print( p_vout, 0, 0, RIGHT_RALIGN, BOTTOM_RALIGN, psz_buffer );
-    }
-}
-
-/*****************************************************************************
- * RenderIdle: render idle picture
- *****************************************************************************
- * This function will print something on the screen. It will return 0 if
- * nothing has been rendered, or 1 if something has been changed on the screen.
- * Note that if you absolutely want something to be printed, you will have
- * to force it by setting the last idle date to 0.
- * Unlike other rendering functions, this one calls the SetBufferPicture
- * function when needed.
- *****************************************************************************/
-int RenderIdle( vout_thread_t *p_vout )
-{
-#if 0
-    int         i_x = 0, i_y = 0;                           /* text position */
-    int         i_width, i_height;                              /* text size */
-    int         i_amount = 0;                             /*  amount to draw */
-    char *psz_text =    "Waiting for stream";            /* text to display */
-    char *psz_wtext =   "[................]";
-#endif
-    mtime_t     current_date;                                /* current date */
-
-
-    memset( p_vout->p_buffer[ p_vout->i_buffer_index ].p_data,
-                    p_vout->i_bytes_per_line * p_vout->i_height, 12);
-
-
-    current_date = mdate();
-    if( (current_date - p_vout->last_display_date) > VOUT_IDLE_DELAY
-//            && (current_date - p_vout->last_idle_date) > VOUT_IDLE_DELAY
-    )
-    {
-        /* FIXME: idle screen disabled */
-#if 0
-        SetBufferPicture( p_vout, NULL );
-        vout_TextSize( p_vout->p_large_font, WIDE_TEXT | OUTLINED_TEXT, psz_text,
-                       &i_width, &i_height );
-        if( !Align( p_vout, &i_x, &i_y, i_width, i_height * 2, CENTER_RALIGN, CENTER_RALIGN ) )
-        {
-            i_amount = (int) ((current_date - p_vout->last_display_date ) / 5000LL);
-            vout_Print( p_vout->p_large_font,
-                        p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
-                        i_x * p_vout->i_bytes_per_pixel + i_y * p_vout->i_bytes_per_line,
-                        p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
-                        p_vout->i_white_pixel, p_vout->i_gray_pixel, 0,
-                        WIDE_TEXT | OUTLINED_TEXT, psz_text,  (i_amount / 3 ) %110);
-
-            vout_Print( p_vout->p_large_font,
-                    p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
-                    i_x * p_vout->i_bytes_per_pixel + (i_y + 16) * p_vout->i_bytes_per_line,
-                    p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
-                    p_vout->i_white_pixel, p_vout->i_gray_pixel, 0,
-                    WIDE_TEXT | OUTLINED_TEXT, psz_wtext,  (i_amount/5)%110 );
-
-
-            SetBufferArea( p_vout, i_x, i_y, i_width, i_height * 2 );
-        }
-#endif
-        return( 1 );
-    }
-    return( 0 );
-}
-
-/*****************************************************************************
- * RenderInfo: render additionnal information
- *****************************************************************************
- * This function renders information which do not depend on the current
- * picture rendered.
- *****************************************************************************/
-static void RenderInfo( vout_thread_t *p_vout )
-{
-#ifdef DEBUG
-    char        psz_buffer[256];                            /* string buffer */
-    int         i_ready_pic = 0;                           /* ready pictures */
-    int         i_reserved_pic = 0;                     /* reserved pictures */
-    int         i_picture;                                  /* picture index */
-#endif
-
-#ifdef DEBUG
-    /*
-     * Print thread state in lower left corner
-     */
-    for( i_picture = 0; i_picture < VOUT_MAX_PICTURES; i_picture++ )
-    {
-        switch( p_vout->p_picture[i_picture].i_status )
-        {
-        case RESERVED_PICTURE:
-        case RESERVED_DATED_PICTURE:
-        case RESERVED_DISP_PICTURE:
-            i_reserved_pic++;
-            break;
-        case READY_PICTURE:
-            i_ready_pic++;
-            break;
-        }
-    }
-    sprintf( psz_buffer, "pic: %d (%d/%d)/%d",
-             p_vout->i_pictures, i_reserved_pic, i_ready_pic, VOUT_MAX_PICTURES );
-    Print( p_vout, 0, 0, LEFT_RALIGN, BOTTOM_RALIGN, psz_buffer );
-#endif
-}
-
-/*****************************************************************************
- * RenderSubPicture: render a subpicture
- *****************************************************************************
- * This function renders a sub picture unit.
- *****************************************************************************/
-static void RenderSubPicture( vout_thread_t *p_vout, picture_t *p_pic,
-                              subpicture_t *p_subpic )
-{
-    p_vout_font_t       p_font;                                 /* text font */
-    int                 i_width, i_height;          /* subpicture dimensions */
-
-    while( p_subpic != NULL )
-    {
-        switch( p_subpic->i_type )
-        {
-        case DVD_SUBPICTURE:                          /* DVD subpicture unit */
-            if( p_vout->b_need_render )
-            {
-                vout_RenderRGBSPU( p_pic, p_subpic,
-                                   &p_vout->p_buffer[ p_vout->i_buffer_index ],
-                                   p_vout->i_bytes_per_pixel,
-                                   p_vout->i_bytes_per_line );
-            }
-            else
-            {
-                vout_RenderYUVSPU( p_pic, p_subpic );
-            }
-            break;
-
-        case TEXT_SUBPICTURE:                            /* single line text */
-            /* Select default font if not specified */
-            p_font = p_subpic->type.text.p_font;
-            if( p_font == NULL )
-            {
-                p_font = p_vout->p_default_font;
-            }
-
-            /* Compute text size (width and height fields are ignored)
-             * and print it */
-            vout_TextSize( p_font, p_subpic->type.text.i_style,
-                           p_subpic->p_data, &i_width, &i_height );
-            if( !Align( p_vout, &p_subpic->i_x, &p_subpic->i_y,
-                        i_width, i_height, p_subpic->i_horizontal_align,
-                        p_subpic->i_vertical_align ) )
-            {
-                vout_Print( p_font,
-                            p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
-                            p_subpic->i_x * p_vout->i_bytes_per_pixel +
-                            p_subpic->i_y * p_vout->i_bytes_per_line,
-                            p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
-                            p_subpic->type.text.i_char_color,
-                            p_subpic->type.text.i_border_color,
-                            p_subpic->type.text.i_bg_color,
-                            p_subpic->type.text.i_style, p_subpic->p_data, 100 );
-                SetBufferArea( p_vout, p_subpic->i_x, p_subpic->i_y,
-                               i_width, i_height );
-            }
-            break;
-
-        default:
-#ifdef DEBUG
-            intf_ErrMsg( "error: unknown subpicture %p type %d",
-                         p_subpic, p_subpic->i_type );
-#endif
-            break;
-        }
-
-        p_subpic = p_subpic->p_next;
-    }
-}
-
-/*****************************************************************************
- * Manage: manage thread
- *****************************************************************************
- * This function will handle changes in thread configuration.
- *****************************************************************************/
-static int Manage( vout_thread_t *p_vout )
-{
-#ifdef TRACE_VOUT
-    if( p_vout->i_changes )
-    {
-        intf_DbgMsg("changes: 0x%x (no display: 0x%x)", p_vout->i_changes,
-                    0 /* p_vout->i_changes & VOUT_NODISPLAY_CHANGE */ );
-    }
-#endif
-
-    /* On gamma or grayscale change, rebuild tables */
-    if( p_vout->i_changes & (VOUT_GAMMA_CHANGE | VOUT_GRAYSCALE_CHANGE |
-                             VOUT_YUV_CHANGE) )
-    {
-        if( vout_ResetYUV( p_vout ) )
-        {
-            intf_ErrMsg( "vout error: can't rebuild conversion tables" );
-            return( 1 );
-        }
-    }
-
-    /* Clear changes flags which does not need management or have been
-     * handled */
-    p_vout->i_changes &= ~(VOUT_GAMMA_CHANGE  | VOUT_GRAYSCALE_CHANGE |
-                           VOUT_YUV_CHANGE    | VOUT_INFO_CHANGE |
-                           VOUT_INTF_CHANGE   | VOUT_SCALE_CHANGE |
-                           VOUT_CURSOR_CHANGE | VOUT_FULLSCREEN_CHANGE );
-
-    /* Detect unauthorized changes */
-    if( p_vout->i_changes )
-    {
-        /* Some changes were not acknowledged by p_vout->pf_manage or this
-         * function, it means they should not be authorized */
-        intf_ErrMsg( "vout error: unauthorized changes in the vout thread" );
-        return( 1 );
-    }
-
-    return( 0 );
-}
+    int *pi_status;                                         /* status adress */
 
-/*****************************************************************************
- * Align: align a subpicture in the screen
- *****************************************************************************
- * This function is used for rendering text or subpictures. It returns non 0
- * it the final aera is not fully included in display area. Return coordinates
- * are absolute.
- *****************************************************************************/
-static int Align( vout_thread_t *p_vout, int *pi_x, int *pi_y,
-                   int i_width, int i_height, int i_h_align, int i_v_align )
-{
-    /* Align horizontally */
-    switch( i_h_align )
-    {
-    case CENTER_ALIGN:
-        *pi_x -= i_width / 2;
-        break;
-    case CENTER_RALIGN:
-        *pi_x += (p_vout->i_width - i_width) / 2;
-        break;
-    case RIGHT_ALIGN:
-        *pi_x -= i_width;
-        break;
-    case RIGHT_RALIGN:
-        *pi_x += p_vout->i_width - i_width;
-        break;
-    }
+    /* Store status adress */
+    pi_status = p_vout->pi_status;
 
-    /* Align vertically */
-    switch( i_v_align )
-    {
-    case CENTER_ALIGN:
-        *pi_y -= i_height / 2;
-        break;
-    case CENTER_RALIGN:
-        *pi_y += (p_vout->i_height - i_height) / 2;
-        break;
-    case BOTTOM_ALIGN:
-        *pi_y -= i_height;
-        break;
-    case BOTTOM_RALIGN:
-        *pi_y += p_vout->i_height - i_height;
-        break;
-    case SUBTITLE_RALIGN:
-        *pi_y += (p_vout->i_height + p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_y +
-                  p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_height - i_height) / 2;
-        break;
-    }
+    /* Destroy the locks */
+    vlc_mutex_destroy( &p_vout->picture_lock );
+    vlc_mutex_destroy( &p_vout->subpicture_lock );
+    vlc_mutex_destroy( &p_vout->change_lock );
 
-    /* Return non 0 if clipping failed */
-    return( (*pi_x < 0) || (*pi_y < 0) ||
-            (*pi_x + i_width > p_vout->i_width) || (*pi_y + i_height > p_vout->i_height) );
-}
+    /* Release the module */
+    module_Unneed( p_vout->p_module );
 
-/*****************************************************************************
- * SetPalette: sets an 8 bpp palette
- *****************************************************************************
- * This function is just a prototype that does nothing. Architectures that
- * support palette allocation should override it.
- *****************************************************************************/
-static void     SetPalette        ( p_vout_thread_t p_vout, u16 *red,
-                                    u16 *green, u16 *blue, u16 *transp )
-{
-    intf_ErrMsg( "vout error: method does not support palette changing" );
+    /* Free structure */
+    free( p_vout );
+    *pi_status = i_status;
 }
 
diff --git a/src/video_output/video_spu.c b/src/video_output/video_spu.c
deleted file mode 100644 (file)
index 2232ebd..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*****************************************************************************
- * video_spu.c : DVD subpicture units functions
- *****************************************************************************
- * Copyright (C) 1999-2001 VideoLAN
- * $Id: video_spu.c,v 1.22 2001/11/28 15:08:06 massiot Exp $
- *
- * Authors: Samuel Hocevar <sam@zoy.org>
- * 
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <stdio.h>
-#include <string.h>                                    /* memcpy(), memset() */
-
-#include "config.h"
-#include "common.h"
-#include "intf_msg.h"
-#include "threads.h"
-#include "mtime.h"
-
-#include "video.h"
-#include "video_output.h"
-#include "video_spu.h"
-
-/* FIXME: fake palette - the real one has to be sought in the .IFO */
-static int p_palette[4] = { 0x0000, 0xffff, 0x5555, 0x8888 };
-
-/*****************************************************************************
- * vout_RenderRGBSPU: draw an SPU on a picture
- *****************************************************************************
- * This is a fast implementation of the subpicture drawing code. The data
- * has been preprocessed once in spu_decoder.c, so we don't need to parse the
- * RLE buffer again and again. Most sanity checks are done in spu_decoder.c
- * so that this routine can be as fast as possible.
- *****************************************************************************/
-void   vout_RenderRGBSPU( picture_t *p_pic, const subpicture_t *p_spu,
-                          vout_buffer_t *p_buffer,
-                          int i_bytes_per_pixel, int i_bytes_per_line )
-{
-    int  i_len, i_color;
-    u16 *p_source = (u16 *)p_spu->p_data;
-
-    int i_xscale = ( p_buffer->i_pic_width << 6 ) / p_pic->i_width;
-    int i_yscale = ( p_buffer->i_pic_height << 6 ) / p_pic->i_height;
-
-    int i_width  = p_spu->i_width  * i_xscale;
-    int i_height = p_spu->i_height * i_yscale;
-
-    int i_x, i_y, i_ytmp, i_yreal, i_ynext;
-
-    u8 *p_dest = p_buffer->p_data + ( i_width >> 6 ) * i_bytes_per_pixel
-                  /* Add the picture coordinates and the SPU coordinates */
-                  + ( p_buffer->i_pic_x + ((p_spu->i_x * i_xscale) >> 6))
-                       * i_bytes_per_pixel
-                  + ( p_buffer->i_pic_y + ((p_spu->i_y * i_yscale) >> 6))
-                       * i_bytes_per_line;
-
-    /* Draw until we reach the bottom of the subtitle */
-    i_y = 0;
-
-    while( i_y < i_height )
-    {
-        i_ytmp = i_y >> 6;
-        i_y += i_yscale;
-
-        /* Check whether we need to draw one line or more than one */
-        if( i_ytmp + 1 >= ( i_y >> 6 ) )
-        {
-            /* Just one line : we precalculate i_y >> 6 */
-            i_yreal = i_bytes_per_line * i_ytmp;
-
-            /* Draw until we reach the end of the line */
-           i_x = i_width;
-
-            while( i_x )
-            {
-                /* Get the RLE part */
-                i_color = *p_source & 0x3;
-
-                /* Draw the line */
-                if( i_color )
-                {
-                    i_len = i_xscale * ( *p_source++ >> 2 );
-
-                    memset( p_dest - i_bytes_per_pixel * ( i_x >> 6 )
-                                   + i_yreal,
-                            p_palette[ i_color ],
-                            i_bytes_per_pixel * ( ( i_len >> 6 ) + 1 ) );
-
-                    i_x -= i_len;
-                    continue;
-                }
-
-                i_x -= i_xscale * ( *p_source++ >> 2 );
-            }
-        }
-        else
-        {
-            i_yreal = i_bytes_per_line * i_ytmp;
-            i_ynext = i_bytes_per_line * i_y >> 6;
-
-            /* Draw until we reach the end of the line */
-            i_x = i_width;
-
-            while( i_x )
-            {
-                /* Get the RLE part */
-                i_color = *p_source & 0x3;
-
-                /* Draw as many lines as needed */
-                if( i_color )
-                {
-                    i_len = i_xscale * ( *p_source++ >> 2 );
-
-                    for( i_ytmp = i_yreal ;
-                         i_ytmp < i_ynext ;
-                         i_ytmp += i_bytes_per_line )
-                    {
-                        memset( p_dest - i_bytes_per_pixel * ( i_x >> 6 )
-                                       + i_ytmp,
-                                p_palette[ i_color ],
-                                i_bytes_per_pixel * ( ( i_len >> 6 ) + 1 ) );
-                    }
-
-                    i_x -= i_len;
-                    continue;
-                }
-
-                i_x -= i_xscale * ( *p_source++ >> 2 );
-            }
-        }
-    }
-}
-
-/*****************************************************************************
- * vout_RenderYUVSPU: draw an SPU on an YUV overlay
- *****************************************************************************
- * This is a fast implementation of the subpicture drawing code. The data
- * has been preprocessed once in spu_decoder.c, so we don't need to parse the
- * RLE buffer again and again. Most sanity checks are done in spu_decoder.c
- * so that this routine can be as fast as possible.
- *****************************************************************************/
-void vout_RenderYUVSPU( picture_t *p_pic, const subpicture_t *p_spu )
-{
-    int  i_len, i_color;
-    u16 *p_source = (u16 *)p_spu->p_data;
-
-    int i_x, i_y;
-
-    u8 *p_dest = p_pic->p_y + p_spu->i_x + p_spu->i_width
-                        + p_pic->i_width * ( p_spu->i_y + p_spu->i_height );
-
-    /* Draw until we reach the bottom of the subtitle */
-    i_y = p_spu->i_height * p_pic->i_width;
-
-    while( i_y )
-    {
-        /* Draw until we reach the end of the line */
-        i_x = p_spu->i_width;
-
-        while( i_x )
-        {
-            /* Draw the line if needed */
-            i_color = *p_source & 0x3;
-
-            if( i_color )
-            {
-                i_len = *p_source++ >> 2;
-                memset( p_dest - i_x - i_y, p_palette[ i_color ], i_len );
-                i_x -= i_len;
-                continue;
-            }
-
-            i_x -= *p_source++ >> 2;
-        }
-
-        i_y -= p_pic->i_width;
-    }
-}
-
diff --git a/src/video_output/video_spu.h b/src/video_output/video_spu.h
deleted file mode 100644 (file)
index 6823a52..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*****************************************************************************
- * video_spu.h : DVD subpicture units functions
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_spu.h,v 1.9 2001/05/08 20:38:25 sam Exp $
- *
- * Authors: Samuel Hocevar <sam@zoy.org>
- *          Henri Fallon <henri@via.ecp.fr>
- *
- * 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   vout_RenderRGBSPU( picture_t *p_pic, const subpicture_t *p_spu,
-                          vout_buffer_t *p_buffer,
-                          int i_bytes_per_pixel, int i_bytes_per_line );
-void   vout_RenderYUVSPU( picture_t *p_pic, const subpicture_t *p_spu );
-
index c134b92b873eece375344fd1f9c92d8b9a110c6d..0010d86290d942749bb62412bf776e3e17760aa0 100644 (file)
@@ -2,7 +2,7 @@
  * video_text.c : text manipulation functions
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: video_text.c,v 1.31 2001/11/28 15:08:06 massiot Exp $
+ * $Id: video_text.c,v 1.32 2001/12/09 17:01:37 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -51,7 +51,6 @@
 #   include <io.h>
 #endif
 
-#include "config.h"
 #include "common.h"
 #include "video_text.h"
 
diff --git a/src/video_output/video_yuv.c b/src/video_output/video_yuv.c
deleted file mode 100644 (file)
index 576a783..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*****************************************************************************
- * video_yuv.c: YUV transformation functions
- * These functions set up YUV tables for colorspace conversion
- *****************************************************************************
- * Copyright (C) 1999-2001 VideoLAN
- * $Id: video_yuv.c,v 1.49 2001/11/28 15:08:06 massiot Exp $
- *
- * Authors: Vincent Seguin <seguin@via.ecp.fr>
- *
- * 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-1307, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <math.h>                                            /* exp(), pow() */
-#include <errno.h>                                                 /* ENOMEM */
-#include <stdlib.h>                                                /* free() */
-#include <string.h>                                            /* strerror() */
-
-#include "config.h"
-#include "common.h"
-#include "intf_msg.h"
-#include "threads.h"
-#include "mtime.h"
-#include "modules.h"
-
-#include "video.h"
-#include "video_output.h"
-#include "video_yuv.h"
-
-/*****************************************************************************
- * vout_InitYUV: allocate and initialize translation tables
- *****************************************************************************
- * This function will allocate memory to store translation tables, depending
- * on the screen depth.
- *****************************************************************************/
-int vout_InitYUV( vout_thread_t *p_vout )
-{
-    /* Choose the best module */
-    p_vout->yuv.p_module = module_Need( MODULE_CAPABILITY_YUV, NULL );
-
-    if( p_vout->yuv.p_module == NULL )
-    {
-        intf_ErrMsg( "vout error: no suitable yuv module" );
-        return( -1 );
-    }
-
-#define yuv_functions p_vout->yuv.p_module->p_functions->yuv.functions.yuv
-    p_vout->yuv.pf_init       = yuv_functions.pf_init;
-    p_vout->yuv.pf_reset      = yuv_functions.pf_reset;
-    p_vout->yuv.pf_end        = yuv_functions.pf_end;
-#undef yuv_functions
-
-    return( p_vout->yuv.pf_init( p_vout ) );
-}
-
-/*****************************************************************************
- * vout_ResetYUV: re-initialize translation tables
- *****************************************************************************
- * This function will initialize the tables allocated by vout_InitYUV and
- * set functions pointers.
- *****************************************************************************/
-int vout_ResetYUV( vout_thread_t *p_vout )
-{
-    p_vout->yuv.pf_end( p_vout );
-    return( p_vout->yuv.pf_init( p_vout ) );
-}
-
-/*****************************************************************************
- * vout_EndYUV: destroy translation tables
- *****************************************************************************
- * Free memory allocated by vout_InitYUV
- *****************************************************************************/
-void vout_EndYUV( vout_thread_t *p_vout )
-{
-    p_vout->yuv.pf_end( p_vout );
-    module_Unneed( p_vout->yuv.p_module );
-}
-
diff --git a/src/video_output/video_yuv.h b/src/video_output/video_yuv.h
deleted file mode 100644 (file)
index 061c505..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************************
- * video_yuv.h: YUV transformation functions
- * These functions set up YUV tables for colorspace conversion
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_yuv.h,v 1.7 2001/03/21 13:42:35 sam Exp $
- *
- * Authors: Vincent Seguin <seguin@via.ecp.fr>
- *
- * 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
- *****************************************************************************/
-int             vout_InitYUV      ( vout_thread_t *p_vout );
-int             vout_ResetYUV     ( vout_thread_t *p_vout );
-void            vout_EndYUV       ( vout_thread_t *p_vout );
-
diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c
new file mode 100644 (file)
index 0000000..94d0e8f
--- /dev/null
@@ -0,0 +1,483 @@
+/*****************************************************************************
+ * vout_pictures.c : picture management functions
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ * $Id: vout_pictures.c,v 1.1 2001/12/09 17:01:37 sam Exp $
+ *
+ * Authors: Vincent Seguin <seguin@via.ecp.fr>
+ *          Samuel Hocevar <sam@zoy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <stdio.h>                                              /* sprintf() */
+#include <string.h>                                            /* strerror() */
+
+#include "common.h"
+#include "intf_msg.h"
+#include "threads.h"
+#include "mtime.h"
+
+#include "video.h"
+#include "video_output.h"
+
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+static void     NewPicture        ( picture_t *, int, int, int );
+
+/*****************************************************************************
+ * vout_DisplayPicture: display a picture
+ *****************************************************************************
+ * Remove the reservation flag of a picture, which will cause it to be ready for
+ * display. The picture won't be displayed until vout_DatePicture has been
+ * called.
+ *****************************************************************************/
+void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_picture )
+{
+    vlc_mutex_lock( &p_vout->picture_lock );
+    switch( p_picture->i_status )
+    {
+    case RESERVED_PICTURE:
+        p_picture->i_status = RESERVED_DISP_PICTURE;
+        break;
+    case RESERVED_DATED_PICTURE:
+        p_picture->i_status = READY_PICTURE;
+        break;
+#ifdef DEBUG
+    default:
+        intf_ErrMsg("error: picture %p has invalid status %d", p_picture, p_picture->i_status );
+        break;
+#endif
+    }
+
+#ifdef TRACE_VOUT
+    intf_DbgMsg("picture %p", p_picture);
+#endif
+    vlc_mutex_unlock( &p_vout->picture_lock );
+}
+
+/*****************************************************************************
+ * vout_DatePicture: date a picture
+ *****************************************************************************
+ * Remove the reservation flag of a picture, which will cause it to be ready
+ * for display. The picture won't be displayed until vout_DisplayPicture has
+ * been called.
+ *****************************************************************************/
+void vout_DatePicture( vout_thread_t *p_vout,
+                       picture_t *p_picture, mtime_t date )
+{
+#ifdef TRACE_VOUT
+    char        psz_date[ MSTRTIME_MAX_SIZE ];                       /* date */
+#endif
+
+    vlc_mutex_lock( &p_vout->picture_lock );
+    p_picture->date = date;
+    switch( p_picture->i_status )
+    {
+    case RESERVED_PICTURE:
+        p_picture->i_status = RESERVED_DATED_PICTURE;
+        break;
+    case RESERVED_DISP_PICTURE:
+        p_picture->i_status = READY_PICTURE;
+        break;
+#ifdef DEBUG
+    default:
+        intf_ErrMsg("error: picture %p has invalid status %d", p_picture, p_picture->i_status );
+        break;
+#endif
+    }
+
+#ifdef TRACE_VOUT
+    intf_DbgMsg("picture %p, display date: %s", p_picture, mstrtime( psz_date, p_picture->date) );
+#endif
+    vlc_mutex_unlock( &p_vout->picture_lock );
+}
+
+/*****************************************************************************
+ * vout_CreatePicture: allocate a picture in the video output heap.
+ *****************************************************************************
+ * This function creates a reserved image in the video output heap.
+ * A null pointer is returned if the function fails. This method provides an
+ * already allocated zone of memory in the picture data fields. It needs locking
+ * since several pictures can be created by several producers threads.
+ *****************************************************************************/
+picture_t *vout_CreatePicture( vout_thread_t *p_vout,
+                               int i_width, int i_height,
+                               int i_chroma, int i_aspect_ratio )
+{
+    int         i_picture;                                  /* picture index */
+    picture_t * p_picture;
+    picture_t * p_free_picture = NULL;                 /* first free picture */
+    picture_t * p_destroyed_picture = NULL;       /* first destroyed picture */
+
+    /* Get lock */
+    vlc_mutex_lock( &p_vout->picture_lock );
+
+    /*
+     * Look for an empty place. XXX: we start at 1 because the first
+     * directbuffer is reserved for memcpy()ed pictures.
+     */
+    for( i_picture = 1; i_picture < VOUT_MAX_PICTURES; i_picture++ )
+    {
+        p_picture = p_vout->p_picture + i_picture;
+
+        if( p_picture->i_status == DESTROYED_PICTURE )
+        {
+            /* Picture is marked for destruction, but is still allocated.
+             * Note that if width and type are the same for two pictures,
+             * chroma_width should also be the same */
+            if( ( p_picture->i_chroma == i_chroma ) &&
+                ( p_picture->i_height == i_height ) &&
+                ( p_picture->i_width  == i_width ) )
+            {
+                /* Memory size do match : memory will not be reallocated,
+                 * and function can end immediately - this is the best
+                 * possible case, since no memory allocation needs to be
+                 * done */
+                p_picture->i_status = RESERVED_PICTURE;
+                p_vout->i_pictures++;
+
+                vlc_mutex_unlock( &p_vout->picture_lock );
+
+                return( p_picture );
+            }
+            else if( ( p_destroyed_picture == NULL )
+                     && !p_picture->b_directbuffer )
+            {
+                /* Memory size do not match, but picture index will be kept in
+                 * case no other place are left */
+                p_destroyed_picture = p_picture;
+            }
+        }
+        else if( ( p_free_picture == NULL )
+                 && ( p_picture->i_status == FREE_PICTURE ) )
+        {
+            /* Picture is empty and ready for allocation */
+            p_free_picture = p_picture;
+        }
+    }
+
+    /* If no free picture is available, use a destroyed picture */
+    if( ( p_free_picture == NULL ) && ( p_destroyed_picture != NULL ) )
+    {
+        /* No free picture or matching destroyed picture has been found, but
+         * a destroyed picture is still avalaible */
+        free( p_destroyed_picture->planes[0].p_data );
+        p_destroyed_picture->i_planes = 0;
+        p_free_picture = p_destroyed_picture;
+    }
+
+    /*
+     * Prepare picture
+     */
+    if( p_free_picture != NULL )
+    {
+        NewPicture( p_free_picture, i_chroma, i_width, i_height );
+
+        if( p_free_picture->i_planes != 0 )
+        {
+            /* Copy picture information, set some default values */
+            p_free_picture->i_width               = i_width;
+            p_free_picture->i_height              = i_height;
+            p_free_picture->i_chroma              = i_chroma;
+            p_free_picture->i_aspect_ratio        = i_aspect_ratio;
+            p_free_picture->i_status              = RESERVED_PICTURE;
+            p_free_picture->i_matrix_coefficients = 1;
+            p_free_picture->i_refcount            = 0;
+            p_vout->i_pictures++;
+        }
+        else
+        {
+            /* Memory allocation failed : set picture as empty */
+            p_free_picture->i_chroma =  EMPTY_PICTURE;
+            p_free_picture->i_status =  FREE_PICTURE;
+            p_free_picture =            NULL;
+
+            intf_ErrMsg( "vout error: picture allocation failed" );
+        }
+
+        vlc_mutex_unlock( &p_vout->picture_lock );
+
+        /* Initialize mutex */
+        vlc_mutex_init( &(p_free_picture->lock_deccount) );
+
+        return( p_free_picture );
+    }
+
+    /* No free or destroyed picture could be found, but the decoder
+     * will try again in a while. */
+    vlc_mutex_unlock( &p_vout->picture_lock );
+
+    return( NULL );
+}
+
+/*****************************************************************************
+ * vout_DestroyPicture: remove a permanent or reserved picture from the heap
+ *****************************************************************************
+ * This function frees a previously reserved picture or a permanent
+ * picture. It is meant to be used when the construction of a picture aborted.
+ * Note that the picture will be destroyed even if it is linked !
+ *****************************************************************************/
+void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_picture )
+{
+    vlc_mutex_lock( &p_vout->picture_lock );
+
+#ifdef DEBUG
+    /* Check if picture status is valid */
+    if( (p_picture->i_status != RESERVED_PICTURE) &&
+        (p_picture->i_status != RESERVED_DATED_PICTURE) &&
+        (p_picture->i_status != RESERVED_DISP_PICTURE) )
+    {
+        intf_ErrMsg( "error: picture %p has invalid status %d",
+                     p_picture, p_picture->i_status );
+    }
+#endif
+
+    p_picture->i_status = DESTROYED_PICTURE;
+    p_vout->i_pictures--;
+
+    /* destroy the lock that had been initialized in CreatePicture */
+    vlc_mutex_destroy( &(p_picture->lock_deccount) );
+
+    vlc_mutex_unlock( &p_vout->picture_lock );
+}
+
+/*****************************************************************************
+ * vout_LinkPicture: increment reference counter of a picture
+ *****************************************************************************
+ * This function increments the reference counter of a picture in the video
+ * heap. It needs a lock since several producer threads can access the picture.
+ *****************************************************************************/
+void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_picture )
+{
+    vlc_mutex_lock( &p_vout->picture_lock );
+    p_picture->i_refcount++;
+
+#ifdef TRACE_VOUT
+    intf_DbgMsg( "picture %p refcount=%d", p_picture, p_picture->i_refcount );
+#endif
+
+    vlc_mutex_unlock( &p_vout->picture_lock );
+}
+
+/*****************************************************************************
+ * vout_UnlinkPicture: decrement reference counter of a picture
+ *****************************************************************************
+ * This function decrement the reference counter of a picture in the video heap.
+ *****************************************************************************/
+void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_picture )
+{
+    vlc_mutex_lock( &p_vout->picture_lock );
+    p_picture->i_refcount--;
+
+#ifdef TRACE_VOUT
+    if( p_picture->i_refcount < 0 )
+    {
+        intf_DbgMsg( "error: refcount < 0" );
+        p_picture->i_refcount = 0;
+    }
+#endif
+
+    if( ( p_picture->i_refcount == 0 ) &&
+        ( p_picture->i_status == DISPLAYED_PICTURE ) )
+    {
+        p_picture->i_status = DESTROYED_PICTURE;
+        p_vout->i_pictures--;
+    }
+
+#ifdef TRACE_VOUT
+    intf_DbgMsg( "picture %p refcount=%d", p_picture, p_picture->i_refcount );
+#endif
+
+    vlc_mutex_unlock( &p_vout->picture_lock );
+}
+
+/*****************************************************************************
+ * vout_RenderPicture: render a picture
+ *****************************************************************************
+ * This function chooses whether the current picture needs to be copied
+ * before rendering, does the subpicture magic, and tells the video output
+ * thread which direct buffer needs to be displayed.
+ *****************************************************************************/
+picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_picture,
+                                                       subpicture_t *p_subpic )
+{
+    int i_index;
+
+    if( p_picture == NULL )
+    {
+        /* XXX: subtitles */
+
+        return NULL;
+    }
+
+    if( p_picture->b_directbuffer )
+    {
+        if( p_picture->i_refcount )
+        {
+            /* Picture is in a direct buffer and is still in use,
+             * we need to copy it to another direct buffer before
+             * displaying it if there are subtitles. */
+            if( p_subpic != NULL )
+            {
+                /* We have subtitles. First copy the picture to
+                 * the spare direct buffer, then render the
+                 * subtitles. */
+                for( i_index = 0 ; i_index < p_picture->i_planes ; i_index++ )
+                {
+                    p_main->fast_memcpy(
+                        p_vout->p_picture[0].planes[ i_index ].p_data,
+                        p_picture->planes[ i_index ].p_data,
+                        p_picture->planes[ i_index ].i_bytes );
+                }
+
+                vout_RenderSubPictures( &p_vout->p_picture[0], p_subpic );
+
+                return &p_vout->p_picture[0];
+            }
+
+            /* No subtitles, picture is in a directbuffer so
+             * we can display it directly even if it is still
+             * in use. */
+            return p_picture;
+        }
+
+        /* Picture is in a direct buffer but isn't used by the
+         * decoder. We can safely render subtitles on it and
+         * display it. */
+        vout_RenderSubPictures( p_picture, p_subpic );
+
+        return p_picture;
+    }
+
+    /* Not a direct buffer. We either need to copy it to a direct buffer,
+     * or render it if the chroma isn't the same. */
+    if( ( p_picture->i_chroma == p_vout->p_picture[0].i_chroma ) &&
+        ( p_picture->i_height == p_vout->p_picture[0].i_height ) &&
+        ( p_picture->i_width  == p_vout->p_picture[0].i_width ) )
+    {
+        /* Picture is not in a direct buffer, but is exactly the
+         * same size as the direct buffers. A memcpy() is enough,
+         * then render the subtitles. */
+        for( i_index = 0; i_index < p_picture->i_planes; i_index++ )
+        {
+            p_main->fast_memcpy( p_vout->p_picture[0].planes[ i_index ].p_data,
+                                 p_picture->planes[ i_index ].p_data,
+                                 p_picture->planes[ i_index ].i_bytes );
+        }
+
+        vout_RenderSubPictures( &p_vout->p_picture[0], p_subpic );
+
+        return &p_vout->p_picture[0];
+    }
+
+    /* Picture is not in a direct buffer, and needs to be converted to
+     * another size/chroma. Then the subtitles need to be rendered as
+     * well. */
+
+    /* This usually means software YUV, or hardware YUV with a
+     * different chroma. */
+
+    /* XXX: render to direct buffer */
+
+    vout_RenderSubPictures( p_picture, p_subpic );
+
+    return &p_vout->p_picture[0];
+}
+
+/* Following functions are local */
+
+/*****************************************************************************
+ * NewPicture: allocate a new picture in the heap.
+ *****************************************************************************
+ * This function allocates a fake direct buffer in memory, which can be
+ * used exactly like a video buffer. The video output thread then manages
+ * how it gets displayed.
+ *****************************************************************************/
+static void NewPicture( picture_t *p_picture, int i_chroma,
+                        int i_width, int i_height )
+{
+    int i_data_size = 0;
+
+    p_picture->i_size = i_width * i_height;
+
+    /* Calculate coordinates */
+    switch( i_chroma )
+    {
+        case YUV_420_PICTURE:        /* YUV 420: 1,1/4,1/4 samples per pixel */
+            p_picture->i_chroma_size = p_picture->i_size / 4;
+            p_picture->i_chroma_width = i_width / 2;
+            break;
+
+        case YUV_422_PICTURE:        /* YUV 422: 1,1/2,1/2 samples per pixel */
+            p_picture->i_chroma_size = p_picture->i_size / 2;
+            p_picture->i_chroma_width = i_width / 2;
+            break;
+
+        case YUV_444_PICTURE:            /* YUV 444: 1,1,1 samples per pixel */
+            p_picture->i_chroma_size = p_picture->i_size;
+            p_picture->i_chroma_width = i_width;
+            break;
+
+        default:
+            intf_ErrMsg("error: unknown chroma type %d", i_chroma );
+            p_picture->i_planes = 0;
+            return;
+    }
+
+    /* Allocate memory */
+    switch( i_chroma )
+    {
+        case YUV_420_PICTURE:        /* YUV 420: 1,1/4,1/4 samples per pixel */
+        case YUV_422_PICTURE:        /* YUV 422: 1,1/2,1/2 samples per pixel */
+        case YUV_444_PICTURE:            /* YUV 444: 1,1,1 samples per pixel */
+
+            i_data_size = p_picture->i_size + 2 * p_picture->i_chroma_size;
+
+            /* The Y plane */
+            p_picture->planes[ Y_PLANE ].i_bytes =
+                 p_picture->i_size * sizeof(pixel_data_t);
+            p_picture->planes[ Y_PLANE ].p_data =
+                 memalign( 16, i_data_size * sizeof(pixel_data_t) * 4 );
+            /* The U plane */
+            p_picture->planes[ U_PLANE ].i_bytes =
+                 p_picture->i_chroma_size * sizeof(pixel_data_t);
+            p_picture->planes[ U_PLANE ].p_data =
+                 p_picture->planes[ Y_PLANE ].p_data + p_picture->i_size;
+            /* The V plane */
+            p_picture->planes[ V_PLANE ].i_bytes =
+                 p_picture->i_chroma_size * sizeof(pixel_data_t);
+            p_picture->planes[ V_PLANE ].p_data =
+                 p_picture->planes[ U_PLANE ].p_data + p_picture->i_chroma_size;
+
+            p_picture->i_planes = 3;
+
+            break;
+
+        default:
+            p_picture->i_planes = 0;
+
+            break;
+    }
+}
+
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
new file mode 100644 (file)
index 0000000..ea506ec
--- /dev/null
@@ -0,0 +1,562 @@
+/*****************************************************************************
+ * vout_subpictures.c : subpicture management functions
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ * $Id: vout_subpictures.c,v 1.1 2001/12/09 17:01:37 sam Exp $
+ *
+ * Authors: Vincent Seguin <seguin@via.ecp.fr>
+ *          Samuel Hocevar <sam@zoy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <stdio.h>                                              /* sprintf() */
+#include <string.h>                                            /* strerror() */
+
+#include "common.h"
+#include "intf_msg.h"
+#include "threads.h"
+#include "mtime.h"
+
+#include "video.h"
+#include "video_output.h"
+
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+static void vout_RenderRGBSPU( picture_t *p_pic, const subpicture_t *p_spu );
+static void vout_RenderYUVSPU( picture_t *p_pic, const subpicture_t *p_spu );
+
+/* FIXME: fake palette - the real one has to be sought in the .IFO */
+static int p_palette[4] = { 0x0000, 0x0000, 0xffff, 0x8888 };
+
+/*****************************************************************************
+ * vout_DisplaySubPicture: display a subpicture unit
+ *****************************************************************************
+ * Remove the reservation flag of a subpicture, which will cause it to be ready
+ * for display. The picture does not need to be locked, since it is ignored by
+ * the output thread if is reserved.
+ *****************************************************************************/
+void  vout_DisplaySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
+{
+#ifdef TRACE_VOUT
+    char        psz_start[ MSTRTIME_MAX_SIZE ];    /* buffer for date string */
+    char        psz_stop[ MSTRTIME_MAX_SIZE ];     /* buffer for date string */
+#endif
+
+#ifdef DEBUG
+    /* Check if status is valid */
+    if( p_subpic->i_status != RESERVED_SUBPICTURE )
+    {
+        intf_ErrMsg("error: subpicture %p has invalid status %d", p_subpic,
+                    p_subpic->i_status );
+    }
+#endif
+
+    /* Remove reservation flag */
+    p_subpic->i_status = READY_SUBPICTURE;
+
+#ifdef TRACE_VOUT
+    /* Send subpicture information */
+    intf_DbgMsg("subpicture %p: type=%d, begin date=%s, end date=%s",
+                p_subpic, p_subpic->i_type,
+                mstrtime( psz_start, p_subpic->i_start ),
+                mstrtime( psz_stop, p_subpic->i_stop ) );
+#endif
+}
+
+/*****************************************************************************
+ * vout_CreateSubPicture: allocate a subpicture in the video output heap.
+ *****************************************************************************
+ * This function create a reserved subpicture in the video output heap.
+ * A null pointer is returned if the function fails. This method provides an
+ * already allocated zone of memory in the spu data fields. It needs locking
+ * since several pictures can be created by several producers threads.
+ *****************************************************************************/
+subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
+                                     int i_size )
+{
+    int                 i_subpic;                        /* subpicture index */
+    subpicture_t *      p_free_subpic = NULL;       /* first free subpicture */
+    subpicture_t *      p_destroyed_subpic = NULL; /* first destroyed subpic */
+
+    /* Get lock */
+    vlc_mutex_lock( &p_vout->subpicture_lock );
+
+    /*
+     * Look for an empty place
+     */
+    for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ )
+    {
+        if( p_vout->p_subpicture[i_subpic].i_status == DESTROYED_SUBPICTURE )
+        {
+            /* Subpicture is marked for destruction, but is still allocated */
+            if( (p_vout->p_subpicture[i_subpic].i_type  == i_type)   &&
+                (p_vout->p_subpicture[i_subpic].i_size  >= i_size) )
+            {
+                /* Memory size do match or is smaller : memory will not be
+                 * reallocated, and function can end immediately - this is
+                 * the best possible case, since no memory allocation needs
+                 * to be done */
+                p_vout->p_subpicture[i_subpic].i_status = RESERVED_SUBPICTURE;
+#ifdef TRACE_VOUT
+                intf_DbgMsg("subpicture %p (in destroyed subpicture slot)",
+                            &p_vout->p_subpicture[i_subpic] );
+#endif
+                vlc_mutex_unlock( &p_vout->subpicture_lock );
+                return( &p_vout->p_subpicture[i_subpic] );
+            }
+            else if( p_destroyed_subpic == NULL )
+            {
+                /* Memory size do not match, but subpicture index will be kept
+                 * in case we find no other place */
+                p_destroyed_subpic = &p_vout->p_subpicture[i_subpic];
+            }
+        }
+        else if( (p_free_subpic == NULL) &&
+                 (p_vout->p_subpicture[i_subpic].i_status == FREE_SUBPICTURE ))
+        {
+            /* Subpicture is empty and ready for allocation */
+            p_free_subpic = &p_vout->p_subpicture[i_subpic];
+        }
+    }
+
+    /* If no free subpictures are available, use a destroyed subpicture */
+    if( (p_free_subpic == NULL) && (p_destroyed_subpic != NULL ) )
+    {
+        /* No free subpicture or matching destroyed subpictures have been
+         * found, but a destroyed subpicture is still avalaible */
+        free( p_destroyed_subpic->p_data );
+        p_free_subpic = p_destroyed_subpic;
+    }
+
+    /*
+     * Prepare subpicture
+     */
+    if( p_free_subpic != NULL )
+    {
+        /* Allocate memory */
+        switch( i_type )
+        {
+        case TEXT_SUBPICTURE:                             /* text subpicture */
+            p_free_subpic->p_data = memalign( 16, i_size + 1 );
+            break;
+        case DVD_SUBPICTURE:                          /* DVD subpicture unit */
+            p_free_subpic->p_data = memalign( 16, i_size );
+            break;
+#ifdef DEBUG
+        default:
+            intf_ErrMsg("error: unknown subpicture type %d", i_type );
+            p_free_subpic->p_data   =  NULL;
+            break;
+#endif
+        }
+
+        if( p_free_subpic->p_data != NULL )
+        {
+            /* Copy subpicture information, set some default values */
+            p_free_subpic->i_type                      = i_type;
+            p_free_subpic->i_status                    = RESERVED_SUBPICTURE;
+            p_free_subpic->i_size                      = i_size;
+            p_free_subpic->i_x                         = 0;
+            p_free_subpic->i_y                         = 0;
+            p_free_subpic->i_width                     = 0;
+            p_free_subpic->i_height                    = 0;
+            p_free_subpic->i_horizontal_align          = CENTER_RALIGN;
+            p_free_subpic->i_vertical_align            = CENTER_RALIGN;
+        }
+        else
+        {
+            /* Memory allocation failed : set subpicture as empty */
+            p_free_subpic->i_type   =  EMPTY_SUBPICTURE;
+            p_free_subpic->i_status =  FREE_SUBPICTURE;
+            p_free_subpic =            NULL;
+            intf_ErrMsg( "vout error: spu allocation returned %s",
+                         strerror( ENOMEM ) );
+        }
+
+#ifdef TRACE_VOUT
+        intf_DbgMsg("subpicture %p (in free subpicture slot)", p_free_subpic );
+#endif
+        vlc_mutex_unlock( &p_vout->subpicture_lock );
+        return( p_free_subpic );
+    }
+
+    /* No free or destroyed subpicture could be found */
+    intf_DbgMsg( "warning: subpicture heap is full" );
+    vlc_mutex_unlock( &p_vout->subpicture_lock );
+    return( NULL );
+}
+
+/*****************************************************************************
+ * vout_DestroySubPicture: remove a subpicture from the heap
+ *****************************************************************************
+ * This function frees a previously reserved subpicture.
+ * It is meant to be used when the construction of a picture aborted.
+ * This function does not need locking since reserved subpictures are ignored
+ * by the output thread.
+ *****************************************************************************/
+void vout_DestroySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
+{
+#ifdef DEBUG
+   /* Check if status is valid */
+   if( p_subpic->i_status != RESERVED_SUBPICTURE )
+   {
+       intf_ErrMsg("error: subpicture %p has invalid status %d",
+                   p_subpic, p_subpic->i_status );
+   }
+#endif
+
+    p_subpic->i_status = DESTROYED_SUBPICTURE;
+
+#ifdef TRACE_VOUT
+    intf_DbgMsg("subpicture %p", p_subpic);
+#endif
+}
+
+/*****************************************************************************
+ * vout_RenderSubPictures: render a subpicture list
+ *****************************************************************************
+ * This function renders a sub picture unit.
+ *****************************************************************************/
+void vout_RenderSubPictures( picture_t *p_pic, subpicture_t *p_subpic )
+{
+#if 0
+    p_vout_font_t       p_font;                                 /* text font */
+    int                 i_width, i_height;          /* subpicture dimensions */
+#endif
+
+    while( p_subpic != NULL )
+    {
+        switch( p_subpic->i_type )
+        {
+        case DVD_SUBPICTURE:                          /* DVD subpicture unit */
+            vout_RenderRGBSPU( p_pic, p_subpic );
+            vout_RenderYUVSPU( p_pic, p_subpic );
+            break;
+
+#if 0
+        case TEXT_SUBPICTURE:                            /* single line text */
+            /* Select default font if not specified */
+            p_font = p_subpic->type.text.p_font;
+            if( p_font == NULL )
+            {
+                p_font = p_vout->p_default_font;
+            }
+
+            /* Compute text size (width and height fields are ignored)
+             * and print it */
+            vout_TextSize( p_font, p_subpic->type.text.i_style,
+                           p_subpic->p_data, &i_width, &i_height );
+            if( !Align( p_vout, &p_subpic->i_x, &p_subpic->i_y,
+                        i_width, i_height, p_subpic->i_horizontal_align,
+                        p_subpic->i_vertical_align ) )
+            {
+                vout_Print( p_font,
+                            p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
+                            p_subpic->i_x * p_vout->i_bytes_per_pixel +
+                            p_subpic->i_y * p_vout->i_bytes_per_line,
+                            p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,                            p_subpic->type.text.i_char_color,
+                            p_subpic->type.text.i_border_color,
+                            p_subpic->type.text.i_bg_color,
+                            p_subpic->type.text.i_style, p_subpic->p_data, 100 );
+                SetBufferArea( p_vout, p_subpic->i_x, p_subpic->i_y,
+                               i_width, i_height );
+            }
+            break;
+#endif
+
+        default:
+#ifdef DEBUG
+            intf_ErrMsg( "error: unknown subpicture %p type %d",
+                         p_subpic, p_subpic->i_type );
+#endif
+            break;
+        }
+
+        p_subpic = p_subpic->p_next;
+    }
+}
+
+/*****************************************************************************
+ * vout_SortSubPictures: find the subpictures to display
+ *****************************************************************************
+ * This function parses all subpictures and decides which ones need to be
+ * displayed. This operation does not need lock, since only READY_SUBPICTURE
+ * are handled. If no picture has been selected, display_date will depend on
+ * the subpicture.
+ * We also check for ephemer DVD subpictures (subpictures that have
+ * to be removed if a newer one is available), which makes it a lot
+ * more difficult to guess if a subpicture has to be rendered or not.
+ *****************************************************************************/
+subpicture_t *vout_SortSubPictures( vout_thread_t *p_vout,
+                                    mtime_t display_date )
+{
+    int i_index;
+    subpicture_t *p_subpic     = NULL;
+    subpicture_t *p_ephemer    = NULL;
+    mtime_t       ephemer_date = 0;
+
+    /* We get an easily parsable chained list of subpictures which
+     * ends with NULL since p_subpic was initialized to NULL. */
+    for( i_index = 0; i_index < VOUT_MAX_SUBPICTURES; i_index++ )
+    {
+        if( p_vout->p_subpicture[i_index].i_status == READY_SUBPICTURE )
+        {
+            /* If it is a DVD subpicture, check its date */
+            if( p_vout->p_subpicture[i_index].i_type == DVD_SUBPICTURE )
+            {
+                if( display_date > p_vout->p_subpicture[i_index].i_stop )
+                {
+                    /* Too late, destroy the subpic */
+                    vout_DestroySubPicture( p_vout,
+                                    &p_vout->p_subpicture[i_index] );
+                    continue;
+                }
+
+                if( display_date < p_vout->p_subpicture[i_index].i_start )
+                {
+                    /* Too early, come back next monday */
+                    continue;
+                }
+
+                /* If this is an ephemer subpic, see if it's the
+                 * youngest we have */
+                if( p_vout->p_subpicture[i_index].b_ephemer )
+                {
+                    if( p_ephemer == NULL )
+                    {
+                        p_ephemer = &p_vout->p_subpicture[i_index];
+                        continue;
+                    }
+
+                    if( p_vout->p_subpicture[i_index].i_start
+                                                     < p_ephemer->i_start )
+                    {
+                        /* Link the previous ephemer subpicture and
+                         * replace it with the current one */
+                        p_ephemer->p_next = p_subpic;
+                        p_subpic = p_ephemer;
+                        p_ephemer = &p_vout->p_subpicture[i_index];
+
+                        /* If it's the 2nd youngest subpicture,
+                         * register its date */
+                        if( !ephemer_date
+                              || ephemer_date > p_subpic->i_start )
+                        {
+                            ephemer_date = p_subpic->i_start;
+                        }
+
+                        continue;
+                    }
+                }
+
+                p_vout->p_subpicture[i_index].p_next = p_subpic;
+                p_subpic = &p_vout->p_subpicture[i_index];
+
+                /* If it's the 2nd youngest subpicture, register its date */                    if( !ephemer_date || ephemer_date > p_subpic->i_start )
+                {
+                    ephemer_date = p_subpic->i_start;
+                }
+            }
+            /* If it's not a DVD subpicture, just register it */
+            else
+            {
+                p_vout->p_subpicture[i_index].p_next = p_subpic;
+                p_subpic = &p_vout->p_subpicture[i_index];
+            }
+        }
+    }
+
+    /* If we found an ephemer subpicture, check if it has to be
+     * displayed */
+    if( p_ephemer != NULL )
+    {
+        if( p_ephemer->i_start < ephemer_date )
+        {
+            /* Ephemer subpicture has lived too long */
+            vout_DestroySubPicture( p_vout, p_ephemer );
+        }
+        else
+        {
+            /* Ephemer subpicture can still live a bit */
+            p_ephemer->p_next = p_subpic;
+            return p_ephemer;
+        }
+    }
+
+    return p_subpic;
+}
+
+/*****************************************************************************
+ * vout_RenderRGBSPU: draw an SPU on a picture
+ *****************************************************************************
+ * This is a fast implementation of the subpicture drawing code. The data
+ * has been preprocessed once in spu_decoder.c, so we don't need to parse the
+ * RLE buffer again and again. Most sanity checks are done in spu_decoder.c
+ * so that this routine can be as fast as possible.
+ *****************************************************************************/
+static void vout_RenderRGBSPU( picture_t *p_pic, const subpicture_t *p_spu )
+{
+#if 0
+    int  i_len, i_color;
+    u16 *p_source = (u16 *)p_spu->p_data;
+
+    int i_xscale = ( p_buffer->i_pic_width << 6 ) / p_pic->i_width;
+    int i_yscale = ( p_buffer->i_pic_height << 6 ) / p_pic->i_height;
+
+    int i_width  = p_spu->i_width  * i_xscale;
+    int i_height = p_spu->i_height * i_yscale;
+
+    int i_x, i_y, i_ytmp, i_yreal, i_ynext;
+
+    u8 *p_dest = p_buffer->p_data + ( i_width >> 6 ) * i_bytes_per_pixel
+                  /* Add the picture coordinates and the SPU coordinates */
+                  + ( p_buffer->i_pic_x + ((p_spu->i_x * i_xscale) >> 6))
+                       * i_bytes_per_pixel
+                  + ( p_buffer->i_pic_y + ((p_spu->i_y * i_yscale) >> 6))
+                       * i_bytes_per_line;
+
+    /* Draw until we reach the bottom of the subtitle */
+    i_y = 0;
+
+    while( i_y < i_height )
+    {
+        i_ytmp = i_y >> 6;
+        i_y += i_yscale;
+
+        /* Check whether we need to draw one line or more than one */
+        if( i_ytmp + 1 >= ( i_y >> 6 ) )
+        {
+            /* Just one line : we precalculate i_y >> 6 */
+            i_yreal = i_bytes_per_line * i_ytmp;
+
+            /* Draw until we reach the end of the line */
+            i_x = i_width;
+
+            while( i_x )
+            {
+                /* Get the RLE part */
+                i_color = *p_source & 0x3;
+
+                /* Draw the line */
+                if( i_color )
+                {
+                    i_len = i_xscale * ( *p_source++ >> 2 );
+
+                    memset( p_dest - i_bytes_per_pixel * ( i_x >> 6 )
+                                   + i_yreal,
+                            p_palette[ i_color ],
+                            i_bytes_per_pixel * ( ( i_len >> 6 ) + 1 ) );
+
+                    i_x -= i_len;
+                    continue;
+                }
+
+                i_x -= i_xscale * ( *p_source++ >> 2 );
+            }
+        }
+        else
+        {
+            i_yreal = i_bytes_per_line * i_ytmp;
+            i_ynext = i_bytes_per_line * i_y >> 6;
+
+            /* Draw until we reach the end of the line */
+            i_x = i_width;
+
+            while( i_x )
+            {
+                /* Get the RLE part */
+                i_color = *p_source & 0x3;
+
+                /* Draw as many lines as needed */
+                if( i_color )
+                {
+                    i_len = i_xscale * ( *p_source++ >> 2 );
+
+                    for( i_ytmp = i_yreal ;
+                         i_ytmp < i_ynext ;
+                         i_ytmp += i_bytes_per_line )
+                    {
+                        memset( p_dest - i_bytes_per_pixel * ( i_x >> 6 )
+                                       + i_ytmp,
+                                p_palette[ i_color ],
+                                i_bytes_per_pixel * ( ( i_len >> 6 ) + 1 ) );
+                    }
+
+                    i_x -= i_len;
+                    continue;
+                }
+
+                i_x -= i_xscale * ( *p_source++ >> 2 );
+            }
+        }
+    }
+#endif
+}
+
+/*****************************************************************************
+ * vout_RenderYUVSPU: draw an SPU on an YUV overlay
+ *****************************************************************************
+ * This is a fast implementation of the subpicture drawing code. The data
+ * has been preprocessed once in spu_decoder.c, so we don't need to parse the
+ * RLE buffer again and again. Most sanity checks are done in spu_decoder.c
+ * so that this routine can be as fast as possible.
+ *****************************************************************************/
+static void vout_RenderYUVSPU( picture_t *p_pic, const subpicture_t *p_spu )
+{
+    int  i_len, i_color;
+    u16 *p_source = (u16 *)p_spu->p_data;
+
+    int i_x, i_y;
+
+    u8 *p_dest = p_pic->planes[ Y_PLANE ].p_data + p_spu->i_x + p_spu->i_width
+                        + p_pic->i_width * ( p_spu->i_y + p_spu->i_height );
+
+    /* Draw until we reach the bottom of the subtitle */
+    i_y = p_spu->i_height * p_pic->i_width;
+
+    while( i_y )
+    {
+        /* Draw until we reach the end of the line */
+        i_x = p_spu->i_width;
+
+        while( i_x )
+        {
+            /* Draw the line if needed */
+            i_color = *p_source & 0x3;
+
+            if( i_color )
+            {
+                i_len = *p_source++ >> 2;
+                memset( p_dest - i_x - i_y, p_palette[ i_color ], i_len );
+                i_x -= i_len;
+                continue;
+            }
+
+            i_x -= *p_source++ >> 2;
+        }
+
+        i_y -= p_pic->i_width;
+    }
+}
+