From 4b921617aa95dc8c91a0c508729c16fd68199ff9 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 14 Jun 2001 01:49:44 +0000 Subject: [PATCH] * DirectX enhancements by Gildas Bazin, such as software rendering. * Merged dvdcss_init and dvdcss_open into dvdcss_open, and dvdcss_close and dvdcss_end into dvdcss_close. libdvdcss API now has 7 functions. * Another failed attempt at profiling vlc under Linux: ported the threads API to GNU Pth. Activate with --enable-pth. It doesn't seem to spawn new threads for me, maybe someone will have better luck. * Makefile optimizations. * Automatic build of libdvdcss if not found. --- Makefile | 155 ++--- Makefile.opts.in | 28 +- configure | 674 +++++++++++++------- configure.in | 112 ++-- debian/control | 2 +- extras/libdvdcss/Makefile | 19 +- extras/libdvdcss/libdvdcss.c | 111 +--- extras/libdvdcss/libdvdcss.h | 12 +- extras/libdvdcss/videolan/dvdcss.h | 8 +- include/defs.h.in | 15 + include/threads.h | 167 +++-- lib/.cvsignore | 1 + plugins/directx/aout_directx.c | 203 +++--- plugins/directx/vout_directx.c | 989 +++++++++++++++++++---------- plugins/dummy/aout_dummy.c | 6 +- plugins/dummy/intf_dummy.c | 6 +- plugins/dvd/Makefile | 11 +- plugins/dvd/input_dvd.c | 31 +- plugins/gtk/gtk_menu.c | 22 +- plugins/gtk/gtk_menu.h | 14 +- plugins/gtk/intf_gtk.h | 14 +- src/input/input.c | 16 +- src/interface/main.c | 18 +- src/misc/modules.c | 46 +- src/misc/modules_core.h | 3 +- src/misc/mtime.c | 20 +- src/video_output/video_output.c | 3 +- 27 files changed, 1634 insertions(+), 1072 deletions(-) diff --git a/Makefile b/Makefile index da2610b9a3..9301e54cb0 100644 --- a/Makefile +++ b/Makefile @@ -11,109 +11,43 @@ # # All possible plugin directories, needed for make clean # -PLUGINS_DIR := alsa beos darwin directx dsp dummy \ - dvd esd fb ggi glide gtk \ - downmix idct imdct \ - macosx mga \ - motion \ - mpeg qt sdl \ - text x11 yuv +PLUGINS_DIR := alsa beos darwin directx dsp dummy dvd esd fb ggi glide gtk downmix idct imdct macosx mga motion mpeg qt sdl text x11 yuv # # All possible plugin objects # -PLUGINS_TARGETS := alsa/alsa beos/beos darwin/darwin directx/directx \ - dsp/dsp dummy/dummy dummy/null dvd/dvd esd/esd fb/fb \ - ggi/ggi glide/glide gtk/gnome gtk/gtk \ - downmix/downmix downmix/downmixsse downmix/downmix3dn \ - idct/idct idct/idctclassic idct/idctmmx idct/idctmmxext \ - imdct/imdct imdct/imdct3dn imdct/imdctsse \ - macosx/macosx mga/mga \ - motion/motion motion/motionmmx motion/motionmmxext \ - mpeg/es mpeg/ps mpeg/ts qt/qt sdl/sdl \ - text/ncurses text/rc x11/x11 x11/xvideo yuv/yuv yuv/yuvmmx +PLUGINS_TARGETS := alsa/alsa beos/beos darwin/darwin directx/directx dsp/dsp dummy/dummy dummy/null dvd/dvd esd/esd fb/fb ggi/ggi glide/glide gtk/gnome gtk/gtk downmix/downmix downmix/downmixsse downmix/downmix3dn idct/idct idct/idctclassic idct/idctmmx idct/idctmmxext imdct/imdct imdct/imdct3dn imdct/imdctsse macosx/macosx mga/mga motion/motion motion/motionmmx motion/motionmmxext mpeg/es mpeg/ps mpeg/ts qt/qt sdl/sdl text/ncurses text/rc x11/x11 x11/xvideo yuv/yuv yuv/yuvmmx # # C Objects # -INTERFACE := src/interface/main.o \ - src/interface/interface.o \ - src/interface/intf_msg.o \ - src/interface/intf_playlist.o \ - src/interface/intf_channels.o - -INPUT := src/input/input.o \ - src/input/input_ext-dec.o \ - src/input/input_ext-intf.o \ - src/input/input_dec.o \ - src/input/input_programs.o \ - src/input/input_netlist.o \ - src/input/input_clock.o \ - src/input/mpeg_system.o - -AUDIO_OUTPUT := src/audio_output/audio_output.o \ - src/audio_output/aout_ext-dec.o \ - src/audio_output/aout_u8.o \ - src/audio_output/aout_s8.o \ - src/audio_output/aout_u16.o \ - src/audio_output/aout_s16.o \ - src/audio_output/aout_spdif.o - -VIDEO_OUTPUT := src/video_output/video_output.o \ - src/video_output/video_text.o \ - src/video_output/video_spu.o \ - src/video_output/video_yuv.o - -AC3_DECODER := src/ac3_decoder/ac3_decoder_thread.o \ - src/ac3_decoder/ac3_decoder.o \ - src/ac3_decoder/ac3_parse.o \ - src/ac3_decoder/ac3_exponent.o \ - src/ac3_decoder/ac3_bit_allocate.o \ - src/ac3_decoder/ac3_mantissa.o \ - src/ac3_decoder/ac3_rematrix.o \ - src/ac3_decoder/ac3_imdct.o - -AC3_SPDIF := src/ac3_spdif/ac3_spdif.o \ - src/ac3_spdif/ac3_iec958.o - -LPCM_DECODER := src/lpcm_decoder/lpcm_decoder_thread.o \ - -AUDIO_DECODER := src/audio_decoder/audio_decoder.o \ - src/audio_decoder/adec_generic.o \ - src/audio_decoder/adec_layer1.o \ - src/audio_decoder/adec_layer2.o \ - src/audio_decoder/adec_math.o - -SPU_DECODER := src/spu_decoder/spu_decoder.o - -#GEN_DECODER := src/generic_decoder/generic_decoder.o - -VIDEO_PARSER := src/video_parser/video_parser.o \ - src/video_parser/vpar_headers.o \ - src/video_parser/vpar_blocks.o \ - src/video_parser/vpar_synchro.o \ - src/video_parser/video_fifo.o - -VIDEO_DECODER := src/video_decoder/video_decoder.o - -MISC := src/misc/mtime.o \ - src/misc/tests.o \ - src/misc/modules.o \ - src/misc/netutils.o - -C_OBJ := $(INTERFACE) \ - $(INPUT) \ - $(VIDEO_OUTPUT) \ - $(AUDIO_OUTPUT) \ - $(AC3_DECODER) \ - $(AC3_SPDIF) \ - $(LPCM_DECODER) \ - $(AUDIO_DECODER) \ - $(SPU_DECODER) \ - $(GEN_DECODER) \ - $(VIDEO_PARSER) \ - $(VIDEO_DECODER) \ - $(MISC) +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 +AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif +AC3_DECODER := ac3_decoder_thread ac3_decoder ac3_parse ac3_exponent ac3_bit_allocate ac3_mantissa ac3_rematrix ac3_imdct +AC3_SPDIF := ac3_spdif ac3_iec958 +LPCM_DECODER := lpcm_decoder_thread +AUDIO_DECODER := audio_decoder adec_generic adec_layer1 adec_layer2 adec_math +SPU_DECODER := spu_decoder +#GEN_DECODER := generic_decoder +VIDEO_PARSER := video_parser vpar_headers vpar_blocks vpar_synchro video_fifo +VIDEO_DECODER := video_decoder +MISC := mtime tests modules netutils + +C_OBJ := $(INTERFACE:%=src/interface/%.o) \ + $(INPUT:%=src/input/%.o) \ + $(VIDEO_OUTPUT:%=src/video_output/%.o) \ + $(AUDIO_OUTPUT:%=src/audio_output/%.o) \ + $(AC3_DECODER:%=src/ac3_decoder/%.o) \ + $(AC3_SPDIF:%=src/ac3_spdif/%.o) \ + $(LPCM_DECODER:%=src/lpcm_decoder/%.o) \ + $(AUDIO_DECODER:%=src/audio_decoder/%.o) \ + $(SPU_DECODER:%=src/spu_decoder/%.o) \ + $(GEN_DECODER:%=src/generic_decoder/%.o) \ + $(VIDEO_PARSER:%=src/video_parser/%.o) \ + $(VIDEO_DECODER:%=src/video_decoder/%.o) \ + $(MISC:%=src/misc/%.o) # # Misc Objects @@ -163,13 +97,21 @@ export # all: vlc ${ALIASES} plugins vlc.app -clean: +clean: libdvdcss-clean plugins-clean vlc-clean + rm -f src/*/*.o extras/*/*.o + rm -f lib/*.so lib/*.so.* lib/*.a + +libdvdcss-clean: + cd extras/libdvdcss && $(MAKE) clean + +plugins-clean: for dir in $(PLUGINS_DIR) ; do \ ( cd plugins/$${dir} && $(MAKE) clean ) ; done rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak + +vlc-clean: rm -f $(C_OBJ) $(CPP_OBJ) - rm -f src/*/*.o extras/*/*.o - rm -f lib/*.so lib/*.a vlc gnome-vlc gvlc kvlc qvlc + rm -f vlc gnome-vlc gvlc kvlc qvlc rm -Rf vlc.app distclean: clean @@ -182,21 +124,28 @@ distclean: clean rm -Rf .dep rm -f .gdb_history -install: +install: libdvdcss-install vlc-install plugins-install + +vlc-install: mkdir -p $(DESTDIR)$(bindir) $(INSTALL) vlc $(DESTDIR)$(bindir) ifneq (,$(ALIASES)) for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done -endif - mkdir -p $(DESTDIR)$(libdir)/videolan/vlc -ifneq (,$(PLUGINS)) - $(INSTALL) -m 644 $(PLUGINS:%=lib/%.so) $(DESTDIR)$(libdir)/videolan/vlc endif mkdir -p $(DESTDIR)$(datadir)/videolan $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan +plugins-install: + mkdir -p $(DESTDIR)$(libdir)/videolan/vlc +ifneq (,$(PLUGINS)) + $(INSTALL) -m 644 $(PLUGINS:%=lib/%.so) $(DESTDIR)$(libdir)/videolan/vlc +endif + +libdvdcss-install: + cd extras/libdvdcss && $(MAKE) install + show: @echo CC: $(CC) @echo CFLAGS: $(CFLAGS) diff --git a/Makefile.opts.in b/Makefile.opts.in index 9c69056291..f8e70f2117 100644 --- a/Makefile.opts.in +++ b/Makefile.opts.in @@ -55,6 +55,7 @@ prefix = @prefix@ bindir = @bindir@ datadir = @datadir@ libdir = @libdir@ +includedir = @includedir@ # # Libraries for special cases @@ -87,6 +88,11 @@ CFLAGS_GTK = @CFLAGS_GTK@ CFLAGS_SDL = @CFLAGS_SDL@ CFLAGS_X11 = @CFLAGS_X11@ +# +# Other special cases +# +LOCAL_LIBDVDCSS = @LOCAL_LIBDVDCSS@ + ############################################################################### # Configuration pre-processing ############################################################################### @@ -140,22 +146,28 @@ endif INCLUDE += @INCLUDE@ INCLUDE += -Iinclude -Iextras -I/usr/local/include +# +# Libraries needed by built-in modules +# +ifneq (,$(BUILTINS)) +LIB_BUILTINS := $(shell for i in ${BUILTINS} ; do echo $$i | tr '[a-z]' '[A-Z]' | sed -e 's/.*/$$LIB_&/' ; done) +LIB += $(LIB_BUILTINS) +endif + # # Libraries # -LIB += @LIB@ -L/usr/local/lib +ifeq (1,$(LOCAL_LIBDVDCSS)) +ifneq (,$(findstring dvd,$(BUILTINS))) +LIB += lib/libdvdcss.a +endif +endif ifneq (,$(findstring mingw32,$(SYS))) LIB += -lws2_32 -lnetapi32 endif -# -# Libraries needed by built-in modules -# -ifneq (,$(BUILTINS)) -LIB_BUILTINS := $(shell for i in ${BUILTINS} ; do echo $$i | tr '[a-z]' '[A-Z]' | sed -e 's/.*/$$LIB_&/' ; done) -LIB += $(LIB_BUILTINS) -endif +LIB += -L/usr/local/lib @LIB@ # # C compiler flags: mainstream compilation diff --git a/configure b/configure index d46163879c..3386e690c8 100755 --- a/configure +++ b/configure @@ -12,11 +12,7 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help - --disable-dummy dummy module (default enabled)" -ac_help="$ac_help - --disable-null Null module (default enabled)" -ac_help="$ac_help - --disable-rc rc module (default enabled)" + --enable-pth Enable GNU Pth support (default disabled)" ac_help="$ac_help --disable-ppro Disable PentiumPro optimizations (default enabled for x86)" ac_help="$ac_help @@ -33,6 +29,12 @@ ac_help="$ac_help --enable-trace Enable trace mode (default disabled)" ac_help="$ac_help --disable-optimizations Disable compiler optimizations (default enabled)" +ac_help="$ac_help + --disable-dummy dummy module (default enabled)" +ac_help="$ac_help + --disable-null Null module (default enabled)" +ac_help="$ac_help + --disable-rc rc module (default enabled)" ac_help="$ac_help --disable-dsp Linux /dev/dsp support (default enabled)" ac_help="$ac_help @@ -605,7 +607,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:609: checking host system type" >&5 +echo "configure:611: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -634,7 +636,7 @@ VLC_CODENAME=Ourumov save_CFLAGS="${CFLAGS}" echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:638: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:640: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -663,7 +665,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:667: checking for $ac_word" >&5 +echo "configure:669: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -693,7 +695,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:697: checking for $ac_word" >&5 +echo "configure:699: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -744,7 +746,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:748: checking for $ac_word" >&5 +echo "configure:750: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -776,7 +778,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:780: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:782: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -787,12 +789,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 791 "configure" +#line 793 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -818,12 +820,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:822: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:824: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:827: checking whether we are using GNU C" >&5 +echo "configure:829: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -832,7 +834,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:838: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -851,7 +853,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:855: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:857: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -883,7 +885,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:887: checking how to run the C preprocessor" >&5 +echo "configure:889: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -898,13 +900,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:910: \"$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 : @@ -915,13 +917,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:925: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:927: \"$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 : @@ -932,13 +934,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:942: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:944: \"$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 : @@ -965,7 +967,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:969: checking for $ac_word" >&5 +echo "configure:971: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1005,7 +1007,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1009: checking for a BSD compatible install" >&5 +echo "configure:1011: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1059,12 +1061,12 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1063: checking for working const" >&5 +echo "configure:1065: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1119: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1136,14 +1138,14 @@ fi if test x${cross_compiling} != xyes; then echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:1140: checking whether byte ordering is bigendian" >&5 +echo "configure:1142: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -1154,11 +1156,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1160: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -1169,7 +1171,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1175: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -1189,7 +1191,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1208: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -1230,12 +1232,12 @@ fi for ac_func in gettimeofday select strerror strtod strtol do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1234: checking for $ac_func" >&5 +echo "configure:1236: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1285,12 +1287,12 @@ done for ac_func in setenv putenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1289: checking for $ac_func" >&5 +echo "configure:1291: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1338,12 +1340,12 @@ fi done echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:1342: checking for connect" >&5 +echo "configure:1344: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1372: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -1385,7 +1387,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:1389: checking for connect in -lsocket" >&5 +echo "configure:1391: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1393,7 +1395,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1410: \"$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 @@ -1428,12 +1430,12 @@ fi fi echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:1432: checking for gethostbyname" >&5 +echo "configure:1434: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -1475,7 +1477,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1479: checking for gethostbyname in -lnsl" >&5 +echo "configure:1481: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1483,7 +1485,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1500: \"$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 @@ -1518,12 +1520,12 @@ fi fi echo $ac_n "checking for nanosleep""... $ac_c" 1>&6 -echo "configure:1522: checking for nanosleep" >&5 +echo "configure:1524: checking for nanosleep" >&5 if eval "test \"`echo '$''{'ac_cv_func_nanosleep'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_nanosleep=yes" else @@ -1565,7 +1567,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for nanosleep in -lrt""... $ac_c" 1>&6 -echo "configure:1569: checking for nanosleep in -lrt" >&5 +echo "configure:1571: checking for nanosleep in -lrt" >&5 ac_lib_var=`echo rt'_'nanosleep | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1573,7 +1575,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lrt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1590: \"$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 @@ -1604,7 +1606,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for nanosleep in -lposix4""... $ac_c" 1>&6 -echo "configure:1608: checking for nanosleep in -lposix4" >&5 +echo "configure:1610: checking for nanosleep in -lposix4" >&5 ac_lib_var=`echo posix4'_'nanosleep | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1612,7 +1614,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix4 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1629: \"$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 @@ -1652,12 +1654,12 @@ fi for ac_func in usleep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1656: checking for $ac_func" >&5 +echo "configure:1658: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1705,12 +1707,12 @@ fi done echo $ac_n "checking for inet_aton""... $ac_c" 1>&6 -echo "configure:1709: checking for inet_aton" >&5 +echo "configure:1711: checking for inet_aton" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_inet_aton=yes" else @@ -1752,7 +1754,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for inet_aton in -lresolv""... $ac_c" 1>&6 -echo "configure:1756: checking for inet_aton in -lresolv" >&5 +echo "configure:1758: checking for inet_aton in -lresolv" >&5 ac_lib_var=`echo resolv'_'inet_aton | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1760,7 +1762,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1777: \"$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 @@ -1797,12 +1799,12 @@ fi for ac_func in vasprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1801: checking for $ac_func" >&5 +echo "configure:1803: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1852,12 +1854,68 @@ done for ac_func in swab do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1856: checking for $ac_func" >&5 +echo "configure:1858: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* 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 $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + +for ac_func in sigrelse +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1914: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1906,12 +1964,12 @@ done echo $ac_n "checking for getopt_long""... $ac_c" 1>&6 -echo "configure:1910: checking for getopt_long" >&5 +echo "configure:1968: checking for getopt_long" >&5 if eval "test \"`echo '$''{'ac_cv_func_getopt_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_getopt_long=yes" else @@ -1956,7 +2014,7 @@ else echo "$ac_t""no" 1>&6 # FreeBSD has a gnugetopt library for this: echo $ac_n "checking for getopt_long in -lgnugetopt""... $ac_c" 1>&6 -echo "configure:1960: checking for getopt_long in -lgnugetopt" >&5 +echo "configure:2018: checking for getopt_long in -lgnugetopt" >&5 ac_lib_var=`echo gnugetopt'_'getopt_long | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1964,7 +2022,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgnugetopt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2037: \"$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 @@ -2007,17 +2065,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2011: checking for $ac_hdr" >&5 +echo "configure:2069: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2021: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2079: \"$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* @@ -2046,12 +2104,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2050: checking for $ac_func" >&5 +echo "configure:2108: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2136: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2099,7 +2157,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:2103: checking for working mmap" >&5 +echo "configure:2161: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2107,7 +2165,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2309: \"$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 @@ -2270,12 +2328,12 @@ EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2274: checking return type of signal handlers" >&5 +echo "configure:2332: 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 < #include @@ -2292,7 +2350,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2296: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2354: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2311,7 +2369,7 @@ EOF echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:2315: checking for dlopen in -ldl" >&5 +echo "configure:2373: 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 @@ -2319,7 +2377,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2392: \"$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 @@ -2351,7 +2409,7 @@ else fi echo $ac_n "checking for pow in -lm""... $ac_c" 1>&6 -echo "configure:2355: checking for pow in -lm" >&5 +echo "configure:2413: 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 @@ -2359,7 +2417,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2432: \"$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 @@ -2396,7 +2454,7 @@ CFLAGS="${CFLAGS} -I/usr/local/include" PTHREAD_LIBS=error echo $ac_n "checking for pthread_attr_init in -lpthread""... $ac_c" 1>&6 -echo "configure:2400: checking for pthread_attr_init in -lpthread" >&5 +echo "configure:2458: 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 @@ -2404,7 +2462,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2477: \"$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 @@ -2430,14 +2488,14 @@ LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - PTHREAD_LIBS="-lpthread" + THREAD_LIB="-lpthread" else echo "$ac_t""no" 1>&6 fi -if test "x${PTHREAD_LIBS}" = xerror; then +if test "x${THREAD_LIB}" = xerror; then echo $ac_n "checking for pthread_attr_init in -lpthreads""... $ac_c" 1>&6 -echo "configure:2441: checking for pthread_attr_init in -lpthreads" >&5 +echo "configure:2499: 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 @@ -2445,7 +2503,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthreads $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2518: \"$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 @@ -2471,15 +2529,15 @@ LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - PTHREAD_LIBS="-lpthreads" + THREAD_LIB="-lpthreads" else echo "$ac_t""no" 1>&6 fi fi -if test "x${PTHREAD_LIBS}" = xerror; then +if test "x${THREAD_LIB}" = xerror; then echo $ac_n "checking for pthread_attr_init in -lc_r""... $ac_c" 1>&6 -echo "configure:2483: checking for pthread_attr_init in -lc_r" >&5 +echo "configure:2541: 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 @@ -2487,7 +2545,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc_r $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2560: \"$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 @@ -2513,21 +2571,21 @@ LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - PTHREAD_LIBS="-lc_r" + THREAD_LIB="-lc_r" else echo "$ac_t""no" 1>&6 fi fi -if test "x${PTHREAD_LIBS}" = xerror; then - PTHREAD_LIBS="" +if test "x${THREAD_LIB}" = xerror; then + THREAD_LIBS="" echo $ac_n "checking for pthread_attr_init""... $ac_c" 1>&6 -echo "configure:2526: checking for pthread_attr_init" >&5 +echo "configure:2584: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2612: \"$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 @@ -2570,10 +2628,9 @@ else fi fi -LIB="${LIB} ${PTHREAD_LIBS}" cat > conftest.$ac_ext < EOF @@ -2585,12 +2642,11 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | #define PTHREAD_COND_T_IN_PTHREAD_H 1 EOF - fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -2602,7 +2658,6 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | #define STRNCASECMP_IN_STRINGS_H 1 EOF - fi rm -f conftest* @@ -2611,17 +2666,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:2615: checking for $ac_hdr" >&5 +echo "configure:2670: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2625: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2680: \"$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* @@ -2651,17 +2706,17 @@ for ac_hdr in sys/sockio.h fcntl.h sys/time.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2655: checking for $ac_hdr" >&5 +echo "configure:2710: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2665: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2720: \"$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* @@ -2691,17 +2746,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:2695: checking for $ac_hdr" >&5 +echo "configure:2750: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2760: \"$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* @@ -2731,17 +2786,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:2735: checking for $ac_hdr" >&5 +echo "configure:2790: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2745: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2800: \"$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* @@ -2771,17 +2826,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:2775: checking for $ac_hdr" >&5 +echo "configure:2830: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2785: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2840: \"$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* @@ -2811,17 +2866,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:2815: checking for $ac_hdr" >&5 +echo "configure:2870: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2825: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2880: \"$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* @@ -2852,17 +2907,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:2856: checking for $ac_hdr" >&5 +echo "configure:2911: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2866: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2921: \"$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* @@ -2891,9 +2946,9 @@ done CFLAGS="${save_CFLAGS} -Wall -Werror" echo $ac_n "checking for ntohl in sys/param.h""... $ac_c" 1>&6 -echo "configure:2895: checking for ntohl in sys/param.h" >&5 +echo "configure:2950: checking for ntohl in sys/param.h" >&5 cat > conftest.$ac_ext < void foo() { int meuh; ntohl(meuh); } @@ -2901,7 +2956,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2960: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define NTOHL_IN_SYS_PARAM_H 1 @@ -2918,16 +2973,16 @@ rm -f conftest* CFLAGS="${save_CFLAGS} -bundle -undefined suppress" echo $ac_n "checking if \$CC compiles plugins with -bundle -undefined suppress""... $ac_c" 1>&6 -echo "configure:2922: checking if \$CC compiles plugins with -bundle -undefined suppress" >&5 +echo "configure:2977: checking if \$CC compiles plugins with -bundle -undefined suppress" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* PLCFLAGS="${PLCFLAGS} -bundle -undefined suppress"; echo "$ac_t""yes" 1>&6 else @@ -2940,16 +2995,16 @@ rm -f conftest* CFLAGS="${save_CFLAGS} -shared" echo $ac_n "checking if \$CC compiles plugins with -shared""... $ac_c" 1>&6 -echo "configure:2944: checking if \$CC compiles plugins with -shared" >&5 +echo "configure:2999: checking if \$CC compiles plugins with -shared" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3008: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* PLCFLAGS="${PLCFLAGS} -shared"; echo "$ac_t""yes" 1>&6 else @@ -2963,9 +3018,9 @@ rm -f conftest* CFLAGS="${save_CFLAGS}" echo $ac_n "checking for boolean_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:2967: checking for boolean_t in sys/types.h" >&5 +echo "configure:3022: checking for boolean_t in sys/types.h" >&5 cat > conftest.$ac_ext < void quux() { boolean_t foo; } @@ -2973,7 +3028,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3032: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define BOOLEAN_T_IN_SYS_TYPES_H 1 @@ -2988,9 +3043,9 @@ else fi rm -f conftest* echo $ac_n "checking for boolean_t in pthread.h""... $ac_c" 1>&6 -echo "configure:2992: checking for boolean_t in pthread.h" >&5 +echo "configure:3047: checking for boolean_t in pthread.h" >&5 cat > conftest.$ac_ext < void quux() { boolean_t foo; } @@ -2998,7 +3053,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3057: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define BOOLEAN_T_IN_PTHREAD_H 1 @@ -3014,12 +3069,12 @@ fi rm -f conftest* echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3018: checking for working const" >&5 +echo "configure:3073: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3127: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3089,12 +3144,12 @@ EOF fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3093: checking for ANSI C header files" >&5 +echo "configure:3148: 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 < #include @@ -3102,7 +3157,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3106: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3161: \"$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* @@ -3119,7 +3174,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 @@ -3137,7 +3192,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 @@ -3158,7 +3213,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3169,7 +3224,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:3173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -3193,12 +3248,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3197: checking for size_t" >&5 +echo "configure:3252: 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 < #if STDC_HEADERS @@ -3226,12 +3281,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:3230: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:3285: 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 < #include @@ -3240,7 +3295,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:3244: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3299: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -3278,16 +3333,16 @@ case x$host_os in esac echo $ac_n "checking if \$CC groks MMX inline assembly""... $ac_c" 1>&6 -echo "configure:3282: checking if \$CC groks MMX inline assembly" >&5 +echo "configure:3337: checking if \$CC groks MMX inline assembly" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3346: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}" echo "$ac_t""yes" 1>&6 @@ -3300,16 +3355,16 @@ fi rm -f conftest* echo $ac_n "checking if \$CC groks MMX EXT or SSE inline assembly""... $ac_c" 1>&6 -echo "configure:3304: checking if \$CC groks MMX EXT or SSE inline assembly" >&5 +echo "configure:3359: checking if \$CC groks MMX EXT or SSE inline assembly" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3368: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}" echo "$ac_t""yes" 1>&6 @@ -3325,17 +3380,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:3329: checking for $ac_hdr" >&5 +echo "configure:3384: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3339: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3394: \"$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* @@ -3356,24 +3411,22 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then #define $ac_tr_hdr 1 EOF - BUILTINS="${BUILTINS} dvd" - LIB_DVD="${LIB_DVD} -Llib -L../../lib -ldvdcss" - CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss" + LIBDVDCSS=1 for ac_hdr in sys/cdio.h sys/dvdio.h linux/cdrom.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3367: checking for $ac_hdr" >&5 +echo "configure:3420: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3377: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3430: \"$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* @@ -3401,7 +3454,7 @@ done BSD_DVD_STRUCT=0 cat > conftest.$ac_ext < EOF @@ -3419,7 +3472,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -3443,7 +3496,7 @@ EOF fi cat > conftest.$ac_ext < EOF @@ -3466,32 +3519,80 @@ fi done -# Check whether --enable-dummy or --disable-dummy was given. -if test "${enable_dummy+set}" = set; then - enableval="$enable_dummy" - : +# Check whether --enable-pth or --disable-pth was given. +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:3528: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-lpth $LIBS" +cat > conftest.$ac_ext <&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" -if test x$enable_dummy != xno; then - BUILTINS="${BUILTINS} dummy"; fi +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo pth | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 fi -if test x$enable_null != xno; then - BUILTINS="${BUILTINS} null"; fi + cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "pth_init" >/dev/null 2>&1; then + rm -rf conftest* + + cat >> confdefs.h <<\EOF +#define PTH_INIT_IN_PTH_H 1 +EOF -# Check whether --enable-rc or --disable-rc was given. -if test "${enable_rc+set}" = set; then - enableval="$enable_rc" - : + THREAD_LIB="-lpth" + fi fi +rm -f conftest* -if test x$enable_rc != xno; then - BUILTINS="${BUILTINS} rc"; fi + +fi + + +LIB="${LIB} ${THREAD_LIB}" # Check whether --enable-ppro or --disable-ppro was given. if test "${enable_ppro+set}" = set; then @@ -3567,6 +3668,83 @@ else fi +for ac_hdr in videolan/dvdcss.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:3676: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3686: \"$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* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +if test x${LIBDVDCSS} = x1; then + # local libdvdcss + LOCAL_LIBDVDCSS=1 + BUILTINS="${BUILTINS} dvd" + CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss" + fi +fi +done + + +# Check whether --enable-dummy or --disable-dummy was given. +if test "${enable_dummy+set}" = set; then + enableval="$enable_dummy" + : +fi + +if test x$enable_dummy != xno; then + BUILTINS="${BUILTINS} dummy"; fi + +# Check whether --enable-null or --disable-null was given. +if test "${enable_null+set}" = set; then + enableval="$enable_null" + : +fi + +if test x$enable_null != xno; then + BUILTINS="${BUILTINS} null"; fi + +# Check whether --enable-rc or --disable-rc was given. +if test "${enable_rc+set}" = set; then + enableval="$enable_rc" + : +fi + +if test x$enable_rc != xno; then + BUILTINS="${BUILTINS} rc"; fi + SYS=${host_os} if test x$host_os = xbeos; then @@ -3595,7 +3773,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:3599: checking for $ac_word" >&5 +echo "configure:3777: 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 @@ -3660,17 +3838,17 @@ else do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3664: checking for $ac_hdr" >&5 +echo "configure:3842: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3674: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3852: \"$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* @@ -3741,17 +3919,17 @@ if test "${with_sdl+set}" = set; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3745: checking for $ac_hdr" >&5 +echo "configure:3923: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3755: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3933: \"$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* @@ -3789,17 +3967,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3793: checking for $ac_hdr" >&5 +echo "configure:3971: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3803: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3981: \"$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* @@ -3836,24 +4014,24 @@ if test "${with_directx+set}" = set; then PLUGINS="${PLUGINS} directx"; if test "x$withval" != "xyes"; then - LIB_DIRECTX="${LIB_DIRECTX} -L"$withval"/lib -lddraw -ldsound" + LIB_DIRECTX="${LIB_DIRECTX} -L"$withval"/lib -lgdi32 -ldxguid" INCLUDE="${INCLUDE} -I"$withval"/include" else for ac_hdr in directx.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3847: checking for $ac_hdr" >&5 +echo "configure:4025: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3857: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4035: \"$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* @@ -3880,7 +4058,7 @@ echo "Cannot find DirectX headers !"; exit fi done - LIB_DIRECTX="${LIB_DIRECTX} -L/usr/lib -lddraw -ldsound" + LIB_DIRECTX="${LIB_DIRECTX} -L/usr/lib -lgdi32 -ldxguid" fi fi fi @@ -3891,17 +4069,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3895: checking for $ac_hdr" >&5 +echo "configure:4073: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3905: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4083: \"$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* @@ -3922,7 +4100,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then #define $ac_tr_hdr 1 EOF PLUGINS="${PLUGINS} directx" - LIB_DIRECTX="${LIB_DIRECTX} -L/usr/lib -lddraw -ldsound" + LIB_DIRECTX="${LIB_DIRECTX} -L/usr/lib -lgdi32 -ldxguid" else echo "$ac_t""no" 1>&6 fi @@ -4001,7 +4179,7 @@ if test x$enable_gtk != xno; then # Extract the first word of "gtk-config", so it can be a program name with args. set dummy gtk-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4005: checking for $ac_word" >&5 +echo "configure:4183: 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 @@ -4061,17 +4239,17 @@ if test x$enable_x11 != xno; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4065: checking for $ac_hdr" >&5 +echo "configure:4243: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4075: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4253: \"$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* @@ -4123,17 +4301,17 @@ if test x$enable_xvideo != xno; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4127: checking for $ac_hdr" >&5 +echo "configure:4305: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4137: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4315: \"$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* @@ -4171,17 +4349,17 @@ if test "${enable_alsa+set}" = set; then enableval="$enable_alsa" if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6 -echo "configure:4175: checking for sys/asoundlib.h" >&5 +echo "configure:4353: checking for sys/asoundlib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4185: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4363: \"$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* @@ -4198,7 +4376,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:4202: checking for main in -lasound" >&5 +echo "configure:4380: 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 @@ -4206,14 +4384,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lasound $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4395: \"$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 @@ -4287,6 +4465,9 @@ fi + + + @@ -4450,6 +4631,7 @@ s%@DEFINE@%$DEFINE%g s%@INCLUDE@%$INCLUDE%g s%@DEBUG@%$DEBUG%g s%@STATS@%$STATS%g +s%@ASM@%$ASM%g s%@TRACE@%$TRACE%g s%@OPTIMS@%$OPTIMS%g s%@CSS@%$CSS%g @@ -4481,6 +4663,7 @@ s%@CFLAGS_DVD@%$CFLAGS_DVD%g s%@CFLAGS_GTK@%$CFLAGS_GTK%g s%@CFLAGS_SDL@%$CFLAGS_SDL%g s%@CFLAGS_X11@%$CFLAGS_X11%g +s%@LOCAL_LIBDVDCSS@%$LOCAL_LIBDVDCSS%g CEOF EOF @@ -4707,6 +4890,7 @@ global configuration system : ${SYS} architecture : ${ARCH} optimizations : ${OPTIMS} +inline assembly : ${ASM} vlc configuration ----------------- diff --git a/configure.in b/configure.in index 1525a275d1..d59cd2d56a 100644 --- a/configure.in +++ b/configure.in @@ -50,6 +50,8 @@ AC_CHECK_FUNC(inet_aton,,[ AC_CHECK_FUNCS(vasprintf) AC_CHECK_FUNCS(swab) +AC_CHECK_FUNCS(sigrelse) + AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)], [ # FreeBSD has a gnugetopt library for this: AC_CHECK_LIB([gnugetopt],[getopt_long], @@ -67,28 +69,25 @@ CFLAGS="${CFLAGS} -I/usr/local/include" dnl Check for pthreads - borrowed from XMMS PTHREAD_LIBS=error -AC_CHECK_LIB(pthread,pthread_attr_init,PTHREAD_LIBS="-lpthread") -if test "x${PTHREAD_LIBS}" = xerror; then - AC_CHECK_LIB(pthreads,pthread_attr_init,PTHREAD_LIBS="-lpthreads") +AC_CHECK_LIB(pthread,pthread_attr_init,THREAD_LIB="-lpthread") +if test "x${THREAD_LIB}" = xerror; then + AC_CHECK_LIB(pthreads,pthread_attr_init,THREAD_LIB="-lpthreads") fi -if test "x${PTHREAD_LIBS}" = xerror; then - AC_CHECK_LIB(c_r,pthread_attr_init,PTHREAD_LIBS="-lc_r") +if test "x${THREAD_LIB}" = xerror; then + AC_CHECK_LIB(c_r,pthread_attr_init,THREAD_LIB="-lc_r") fi -if test "x${PTHREAD_LIBS}" = xerror; then - PTHREAD_LIBS="" +if test "x${THREAD_LIB}" = xerror; then + THREAD_LIBS="" AC_CHECK_FUNC(pthread_attr_init) fi -LIB="${LIB} ${PTHREAD_LIBS}" dnl Check for misc headers AC_EGREP_HEADER(pthread_cond_t,pthread.h,[ AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1, - Define if defines pthread_cond_t.) -]) + Define if defines pthread_cond_t.)]) AC_EGREP_HEADER(strncasecmp,strings.h,[ AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1, - Define if defines strncasecmp.) -]) + Define if defines strncasecmp.)]) dnl Check for headers AC_CHECK_HEADERS(stddef.h getopt.h strings.h) @@ -176,12 +175,10 @@ AC_TRY_COMPILE([void quux(){void *p;asm("maskmovq %%mm1,%%mm2"::"r"(p));}],, AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl -dnl DVD module: check for DVD ioctls +dnl libdvdcss: check for DVD ioctls dnl AC_CHECK_HEADERS(sys/ioctl.h,[ - BUILTINS="${BUILTINS} dvd" - LIB_DVD="${LIB_DVD} -Llib -L../../lib -ldvdcss" - CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss" + LIBDVDCSS=1 AC_CHECK_HEADERS(sys/cdio.h sys/dvdio.h linux/cdrom.h) BSD_DVD_STRUCT=0 dnl @@ -214,34 +211,26 @@ AC_CHECK_HEADERS(sys/ioctl.h,[ ]) dnl -dnl dummy plugin -dnl -AC_ARG_ENABLE(dummy, - [ --disable-dummy dummy module (default enabled)]) -if test x$enable_dummy != xno; then - BUILTINS="${BUILTINS} dummy"; fi - -dnl -dnl null plugin +dnl GNU portable threads dnl -AC_ARG_ENABLE(null, - [ --disable-null Null module (default enabled)]) -if test x$enable_null != xno; then - BUILTINS="${BUILTINS} null"; fi +AC_ARG_ENABLE(pth, + [ --enable-pth Enable GNU Pth support (default disabled)], + [ if test x$enableval = xyes; then + AC_CHECK_LIB(pth,pth_init) + AC_EGREP_HEADER(pth_init,pth.h,[ + AC_DEFINE(PTH_INIT_IN_PTH_H, 1, + Define if defines pth_init) + THREAD_LIB="-lpth" + fi]) +]) -dnl -dnl rc plugin -dnl -AC_ARG_ENABLE(rc, - [ --disable-rc rc module (default enabled)]) -if test x$enable_rc != xno; then - BUILTINS="${BUILTINS} rc"; fi +LIB="${LIB} ${THREAD_LIB}" dnl dnl PentiumPro acceleration dnl AC_ARG_ENABLE(ppro, -[ --disable-ppro Disable PentiumPro optimizations (default enabled for x86)], + [ --disable-ppro Disable PentiumPro optimizations (default enabled for x86)], [ if test x$enableval = xyes; then ARCH="${ARCH} ppro"; fi ], [ if test x${host_cpu} = xi686; then ARCH="${ARCH} ppro"; fi ]) @@ -303,6 +292,45 @@ AC_ARG_ENABLE(optimizations, [ if test x$enableval = xno; then OPTIMS=0; fi ], [ OPTIMS=1 ]) +dnl +dnl DVD module: check for installed libdvdcss or local libdvdcss +dnl TODO: use user-provided --with-dvdcss flag +dnl +AC_CHECK_HEADERS(videolan/dvdcss.h,[ + # installed libdvdcss + BUILTINS="${BUILTINS} dvd" + LIB_DVD="${LIB_DVD} -ldvdcss"], + [if test x${LIBDVDCSS} = x1; then + # local libdvdcss + LOCAL_LIBDVDCSS=1 + BUILTINS="${BUILTINS} dvd" + CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss" + fi]) + +dnl +dnl dummy plugin +dnl +AC_ARG_ENABLE(dummy, + [ --disable-dummy dummy module (default enabled)]) +if test x$enable_dummy != xno; then + BUILTINS="${BUILTINS} dummy"; fi + +dnl +dnl null plugin +dnl +AC_ARG_ENABLE(null, + [ --disable-null Null module (default enabled)]) +if test x$enable_null != xno; then + BUILTINS="${BUILTINS} null"; fi + +dnl +dnl rc plugin +dnl +AC_ARG_ENABLE(rc, + [ --disable-rc rc module (default enabled)]) +if test x$enable_rc != xno; then + BUILTINS="${BUILTINS} rc"; fi + SYS=${host_os} dnl special case for BeOS @@ -423,18 +451,18 @@ AC_ARG_WITH(directx, PLUGINS="${PLUGINS} directx"; if test "x$withval" != "xyes"; then - LIB_DIRECTX="${LIB_DIRECTX} -L"$withval"/lib -lddraw -ldsound" + LIB_DIRECTX="${LIB_DIRECTX} -L"$withval"/lib -lgdi32 -ldxguid" INCLUDE="${INCLUDE} -I"$withval"/include" else AC_CHECK_HEADERS(directx.h, , [echo "Cannot find DirectX headers !"; exit]) - LIB_DIRECTX="${LIB_DIRECTX} -L/usr/lib -lddraw -ldsound" + LIB_DIRECTX="${LIB_DIRECTX} -L/usr/lib -lgdi32 -ldxguid" fi fi ]) if test "x$withval" = "x"; then AC_CHECK_HEADERS(directx.h, [PLUGINS="${PLUGINS} directx" - LIB_DIRECTX="${LIB_DIRECTX} -L/usr/lib -lddraw -ldsound"]) + LIB_DIRECTX="${LIB_DIRECTX} -L/usr/lib -lgdi32 -ldxguid"]) fi dnl @@ -582,6 +610,7 @@ AC_SUBST(DEFINE) AC_SUBST(INCLUDE) AC_SUBST(DEBUG) AC_SUBST(STATS) +AC_SUBST(ASM) AC_SUBST(TRACE) AC_SUBST(OPTIMS) AC_SUBST(CSS) @@ -617,6 +646,8 @@ AC_SUBST(CFLAGS_GTK) AC_SUBST(CFLAGS_SDL) AC_SUBST(CFLAGS_X11) +AC_SUBST(LOCAL_LIBDVDCSS) + AC_OUTPUT([Makefile.opts include/config.h]) echo " @@ -625,6 +656,7 @@ global configuration system : ${SYS} architecture : ${ARCH} optimizations : ${OPTIMS} +inline assembly : ${ASM} vlc configuration ----------------- diff --git a/debian/control b/debian/control index 9d77cfbc0f..71d480c435 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: vlc Section: graphics Priority: optional Maintainer: Samuel Hocevar -Build-Depends: debhelper (>=2.2.0), xlib6g-dev, libgnome-dev, libggi2-dev, libglide-dev [i386], libesd0-dev, libsdl1.2-dev, libqt-dev, libasound2-dev +Build-Depends: debhelper (>=2.2.0), xlib6g-dev, libgnome-dev, libggi2-dev, libglide3-dev [i386], libesd0-dev, libsdl1.2-dev, libqt-dev, libasound2-dev Standards-Version: 3.0.1 Package: vlc diff --git a/extras/libdvdcss/Makefile b/extras/libdvdcss/Makefile index 149859ebf8..4b06ce5366 100644 --- a/extras/libdvdcss/Makefile +++ b/extras/libdvdcss/Makefile @@ -5,6 +5,9 @@ include ../../Makefile.opts +LIBDVDCSS_VERSION = 0.0.1 +LIBDVDCSS_MAJOR = 0 + # # Objects # @@ -18,13 +21,23 @@ $(LIBDVDCSS_O): %.o: .dep/%.d $(LIBDVDCSS_O): %.o: %.c $(CC) $(CFLAGS) $(PCFLAGS) -c -o $@ $< -../../lib/libdvdcss.so: $(LIBDVDCSS_O) +../../lib/libdvdcss.so.$(LIBDVDCSS_VERSION): $(LIBDVDCSS_O) $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) + rm -f ../../lib/libdvdcss.so && ln -s libdvdcss.so.$(LIBDVDCSS_VERSION) ../../lib/libdvdcss.so + rm -f ../../lib/libdvdcss.so.$(LIBDVDCSS_MAJOR) && ln -s libdvdcss.so.$(LIBDVDCSS_VERSION) ../../lib/libdvdcss.so.$(LIBDVDCSS_MAJOR) ../../lib/libdvdcss.a: $(LIBDVDCSS_O) ar r $@ $^ $(RANLIB) $@ -#all: ../../lib/libdvdcss.so ../../lib/libdvdcss.a -all: ../../lib/libdvdcss.a +all: ../../lib/libdvdcss.so.$(LIBDVDCSS_VERSION) ../../lib/libdvdcss.a + +install: + mkdir -p $(DESTDIR)$(includedir)/videolan + $(INSTALL) -m 644 videolan/dvdcss.h $(DESTDIR)$(includedir)/videolan + mkdir -p $(DESTDIR)$(libdir) + $(INSTALL) -m 644 ../../lib/libdvdcss.a $(DESTDIR)$(libdir) + $(INSTALL) -m 644 ../../lib/libdvdcss.so.$(LIBDVDCSS_VERSION) $(DESTDIR)$(libdir) + rm -f $(DESTDIR)$(libdir)/libdvdcss.so && ln -s libdvdcss.so.$(LIBDVDCSS_VERSION) $(DESTDIR)$(libdir)/libdvdcss.so + rm -f $(DESTDIR)$(libdir)/libdvdcss.so.$(LIBDVDCSS_MAJOR) && ln -s libdvdcss.so.$(LIBDVDCSS_VERSION) $(DESTDIR)$(libdir)/libdvdcss.so.$(LIBDVDCSS_MAJOR) diff --git a/extras/libdvdcss/libdvdcss.c b/extras/libdvdcss/libdvdcss.c index d20ef9b558..c3404bea7b 100644 --- a/extras/libdvdcss/libdvdcss.c +++ b/extras/libdvdcss/libdvdcss.c @@ -2,7 +2,7 @@ * libdvdcss.c: DVD reading library. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: libdvdcss.c,v 1.1 2001/06/12 22:14:44 sam Exp $ + * $Id: libdvdcss.c,v 1.2 2001/06/14 01:49:44 sam Exp $ * * Authors: Stéphane Borel * Samuel Hocevar @@ -57,10 +57,12 @@ static int _dvdcss_read ( dvdcss_handle, void *p_buffer, int i_blocks ); static int _dvdcss_readv ( dvdcss_handle, struct iovec *p_iovec, int i_blocks ); /***************************************************************************** - * dvdcss_init: initialize libdvdcss + * dvdcss_open: initialize library, open a DVD device, crack CSS key *****************************************************************************/ -extern dvdcss_handle dvdcss_init ( int i_flags ) +extern dvdcss_handle dvdcss_open ( char *psz_target, int i_flags ) { + int i_ret; + dvdcss_handle dvdcss; /* Allocate the library structure */ @@ -76,50 +78,15 @@ extern dvdcss_handle dvdcss_init ( int i_flags ) } /* Initialize structure */ - dvdcss->i_status = DVDCSS_STATUS_NONE; - dvdcss->b_debug = i_flags & DVDCSS_INIT_DEBUG; dvdcss->b_errors = !(i_flags & DVDCSS_INIT_QUIET); dvdcss->psz_error = "no error"; - /* XXX: additional initialization stuff might come here */ - - dvdcss->i_status |= DVDCSS_STATUS_INIT; - - return dvdcss; -} - -/***************************************************************************** - * dvdcss_error: return the last libdvdcss error message - *****************************************************************************/ -extern char * dvdcss_error ( dvdcss_handle dvdcss ) -{ - return dvdcss->psz_error; -} - -/***************************************************************************** - * dvdcss_open: open a DVD device, crack CSS key if disc is encrypted - *****************************************************************************/ -extern int dvdcss_open ( dvdcss_handle dvdcss, char *psz_target ) -{ - int i_ret; - - if( ! (dvdcss->i_status & DVDCSS_STATUS_INIT) ) - { - _dvdcss_error( dvdcss, "library not initialized" ); - return -1; - } - - if( dvdcss->i_status & DVDCSS_STATUS_OPEN ) - { - _dvdcss_error( dvdcss, "a device is already opened" ); - return -1; - } - i_ret = _dvdcss_open( dvdcss, psz_target ); if( i_ret < 0 ) { - return i_ret; + free( dvdcss ); + return NULL; } i_ret = CSSTest( dvdcss ); @@ -127,7 +94,8 @@ extern int dvdcss_open ( dvdcss_handle dvdcss, char *psz_target ) { _dvdcss_error( dvdcss, "css test failed" ); _dvdcss_close( dvdcss ); - return i_ret; + free( dvdcss ); + return NULL; } dvdcss->b_encrypted = i_ret; @@ -140,13 +108,20 @@ extern int dvdcss_open ( dvdcss_handle dvdcss, char *psz_target ) if( i_ret < 0 ) { _dvdcss_close( dvdcss ); - return i_ret; + free( dvdcss ); + return NULL; } } - dvdcss->i_status |= DVDCSS_STATUS_OPEN; + return dvdcss; +} - return 0; +/***************************************************************************** + * dvdcss_error: return the last libdvdcss error message + *****************************************************************************/ +extern char * dvdcss_error ( dvdcss_handle dvdcss ) +{ + return dvdcss->psz_error; } /***************************************************************************** @@ -154,12 +129,6 @@ extern int dvdcss_open ( dvdcss_handle dvdcss, char *psz_target ) *****************************************************************************/ extern int dvdcss_seek ( dvdcss_handle dvdcss, int i_blocks ) { - if( ! (dvdcss->i_status & DVDCSS_STATUS_OPEN) ) - { - _dvdcss_error( dvdcss, "no device opened" ); - return -1; - } - return _dvdcss_seek( dvdcss, i_blocks ); } @@ -170,12 +139,6 @@ extern int dvdcss_crack ( dvdcss_handle dvdcss, int i_title, int i_block ) { int i_ret; - if( ! (dvdcss->i_status & DVDCSS_STATUS_OPEN) ) - { - _dvdcss_error( dvdcss, "no device opened" ); - return -1; - } - if( ! dvdcss->b_encrypted ) { return 0; @@ -210,12 +173,6 @@ extern int dvdcss_read ( dvdcss_handle dvdcss, void *p_buffer, { int i_ret; - if( ! (dvdcss->i_status & DVDCSS_STATUS_OPEN) ) - { - _dvdcss_error( dvdcss, "no device opened" ); - return -1; - } - i_ret = _dvdcss_read( dvdcss, p_buffer, i_blocks ); if( i_ret != i_blocks @@ -248,12 +205,6 @@ extern int dvdcss_readv ( dvdcss_handle dvdcss, void *p_iovec, void *iov_base; size_t iov_len; - if( ! (dvdcss->i_status & DVDCSS_STATUS_OPEN) ) - { - _dvdcss_error( dvdcss, "no device opened" ); - return -1; - } - i_ret = _dvdcss_readv( dvdcss, P_IOVEC, i_blocks ); if( i_ret != i_blocks @@ -296,18 +247,12 @@ extern int dvdcss_readv ( dvdcss_handle dvdcss, void *p_iovec, } /***************************************************************************** - * dvdcss_close: close the DVD device + * dvdcss_close: close the DVD device and clean up the library *****************************************************************************/ extern int dvdcss_close ( dvdcss_handle dvdcss ) { int i_ret; - if( ! (dvdcss->i_status & DVDCSS_STATUS_OPEN) ) - { - _dvdcss_error( dvdcss, "no device opened" ); - return -1; - } - i_ret = _dvdcss_close( dvdcss ); if( i_ret < 0 ) @@ -315,22 +260,6 @@ extern int dvdcss_close ( dvdcss_handle dvdcss ) return i_ret; } - dvdcss->i_status &= ~DVDCSS_STATUS_OPEN; - - return 0; -} - -/***************************************************************************** - * dvdcss_end: clean up the library - *****************************************************************************/ -extern int dvdcss_end ( dvdcss_handle dvdcss ) -{ - if( dvdcss->i_status & DVDCSS_STATUS_OPEN ) - { - _dvdcss_error( dvdcss, "a device is still open" ); - return -1; - } - free( dvdcss ); return 0; diff --git a/extras/libdvdcss/libdvdcss.h b/extras/libdvdcss/libdvdcss.h index 4870ee0125..8fadec1df9 100644 --- a/extras/libdvdcss/libdvdcss.h +++ b/extras/libdvdcss/libdvdcss.h @@ -2,7 +2,7 @@ * private.h: private DVD reading library data ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: libdvdcss.h,v 1.1 2001/06/12 22:14:44 sam Exp $ + * $Id: libdvdcss.h,v 1.2 2001/06/14 01:49:44 sam Exp $ * * Authors: Stéphane Borel * Samuel Hocevar @@ -32,9 +32,6 @@ *****************************************************************************/ struct dvdcss_s { - /* Status */ - int i_status; - /* File descriptor */ int i_fd; @@ -49,13 +46,6 @@ struct dvdcss_s }; -/***************************************************************************** - * Flags - *****************************************************************************/ -#define DVDCSS_STATUS_NONE 0 -#define DVDCSS_STATUS_INIT 1 << 0 -#define DVDCSS_STATUS_OPEN 1 << 1 - /***************************************************************************** * Error management *****************************************************************************/ diff --git a/extras/libdvdcss/videolan/dvdcss.h b/extras/libdvdcss/videolan/dvdcss.h index 63dacac616..4ec87de3e4 100644 --- a/extras/libdvdcss/videolan/dvdcss.h +++ b/extras/libdvdcss/videolan/dvdcss.h @@ -2,7 +2,7 @@ * libdvdcss.h: DVD reading library, exported functions. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: dvdcss.h,v 1.1 2001/06/12 22:14:44 sam Exp $ + * $Id: dvdcss.h,v 1.2 2001/06/14 01:49:44 sam Exp $ * * Authors: Stéphane Borel * Samuel Hocevar @@ -42,10 +42,8 @@ typedef struct dvdcss_s* dvdcss_handle; /***************************************************************************** * Exported prototypes *****************************************************************************/ -extern dvdcss_handle dvdcss_init ( int i_flags ); -extern int dvdcss_end ( dvdcss_handle ); -extern int dvdcss_open ( dvdcss_handle, - char *psz_target ); +extern dvdcss_handle dvdcss_open ( char *psz_target, + int i_flags ); extern int dvdcss_close ( dvdcss_handle ); extern int dvdcss_crack ( dvdcss_handle, int i_title, diff --git a/include/defs.h.in b/include/defs.h.in index 693b60fd50..9baf7bd49f 100644 --- a/include/defs.h.in +++ b/include/defs.h.in @@ -37,6 +37,9 @@ /* Define if you have the setenv function. */ #undef HAVE_SETENV +/* Define if you have the sigrelse function. */ +#undef HAVE_SIGRELSE + /* Define if you have the strerror function. */ #undef HAVE_STRERROR @@ -73,6 +76,9 @@ /* Define if you have the header file. */ #undef HAVE_CTHREADS_H +/* Define if you have the header file. */ +#undef HAVE_DIRECTX_H + /* Define if you have the header file. */ #undef HAVE_DLFCN_H @@ -139,6 +145,12 @@ /* Define if you have the header file. */ #undef HAVE_UNISTD_H +/* Define if you have the header file. */ +#undef HAVE_VIDEOLAN_DVDCSS_H + +/* Define if you have the pth library (-lpth). */ +#undef HAVE_LIBPTH + /* long getopt support */ #undef HAVE_GETOPT_LONG @@ -172,6 +184,9 @@ /* Define if defines DVD_STRUCT. */ #undef DVD_STRUCT_IN_LINUX_CDROM_H +/* Define if defines pth_init */ +#undef PTH_INIT_IN_PTH_H + /* Define if you want DVD CSS decryption. */ #undef HAVE_CSS diff --git a/include/threads.h b/include/threads.h index bf67af4f19..7984ca93c9 100644 --- a/include/threads.h +++ b/include/threads.h @@ -3,7 +3,7 @@ * This header provides a portable threads implementation. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: threads.h,v 1.17 2001/04/28 03:36:25 sam Exp $ + * $Id: threads.h,v 1.18 2001/06/14 01:49:44 sam Exp $ * * Authors: Jean-Marc Dressler * Samuel Hocevar @@ -25,25 +25,29 @@ #include -#if defined(PTHREAD_COND_T_IN_PTHREAD_H) /* pthreads (like Linux & BSD) */ -#include +#if defined( PTH_INIT_IN_PTH_H ) /* GNU Pth */ +# include -#elif defined(HAVE_CTHREADS_H) /* GNUMach */ -#include +#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) /* pthreads (like Linux & BSD) */ +# include -#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) /* BeOS */ -#undef MAX -#undef MIN -#include -#include -#include +#elif defined( HAVE_CTHREADS_H ) /* GNUMach */ +# include -#elif defined(WIN32) /* Win32 with MinGW32 compiler */ -#include -#include +#elif defined( HAVE_KERNEL_SCHEDULER_H ) /* BeOS */ +# undef MAX +# undef MIN +# include +# include +# include + +#elif defined( WIN32 ) /* Win32 with MinGW32 compiler */ +# include +# include #else -#error no threads available on your system ! +# error no threads available on your system ! + #endif /***************************************************************************** @@ -76,12 +80,17 @@ * Types definition *****************************************************************************/ -#if defined(PTHREAD_COND_T_IN_PTHREAD_H) +#if defined( PTH_INIT_IN_PTH_H ) +typedef pth_t vlc_thread_t; +typedef pth_mutex_t vlc_mutex_t; +typedef pth_cond_t vlc_cond_t; + +#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) typedef pthread_t vlc_thread_t; typedef pthread_mutex_t vlc_mutex_t; typedef pthread_cond_t vlc_cond_t; -#elif defined(HAVE_CTHREADS_H) +#elif defined( HAVE_CTHREADS_H ) typedef cthread_t vlc_thread_t; /* Those structs are the ones defined in /include/cthreads.h but we need @@ -101,7 +110,7 @@ typedef struct s_condition { struct cond_imp *implications; } vlc_cond_t; -#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) +#elif defined( HAVE_KERNEL_SCHEDULER_H ) /* This is the BeOS implementation of the vlc threads, note that the mutex is * not a real mutex and the cond_var is not like a pthread cond_var but it is * enough for what wee need */ @@ -120,7 +129,7 @@ typedef struct thread_id thread; } vlc_cond_t; -#elif defined(WIN32) +#elif defined( WIN32 ) typedef HANDLE vlc_thread_t; typedef HANDLE vlc_mutex_t; typedef HANDLE vlc_cond_t; @@ -159,21 +168,25 @@ static __inline__ int vlc_cond_timedwait( vlc_cond_t *, vlc_mutex_t *, *****************************************************************************/ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread, char *psz_name, vlc_thread_func_t func, - void *p_data) + void *p_data ) { -#if defined(PTHREAD_COND_T_IN_PTHREAD_H) +#if defined( PTH_INIT_IN_PTH_H ) + *p_thread = pth_spawn( PTH_ATTR_DEFAULT, func, p_data ); + return ( p_thread == NULL ); + +#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) return pthread_create( p_thread, NULL, func, p_data ); -#elif defined(HAVE_CTHREADS_H) +#elif defined( HAVE_CTHREADS_H ) *p_thread = cthread_fork( (cthread_fn_t)func, (any_t)p_data ); return 0; -#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) +#elif defined( HAVE_KERNEL_SCHEDULER_H ) *p_thread = spawn_thread( (thread_func)func, psz_name, B_NORMAL_PRIORITY, p_data ); return resume_thread( *p_thread ); -#elif defined(WIN32) +#elif defined( WIN32 ) #if 0 DWORD threadID; /* This method is not recommended when using the MSVCRT C library, @@ -198,17 +211,20 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread, *****************************************************************************/ static __inline__ void vlc_thread_exit( void ) { -#if defined(PTHREAD_COND_T_IN_PTHREAD_H) +#if defined( PTH_INIT_IN_PTH_H ) + pth_exit( 0 ); + +#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) pthread_exit( 0 ); -#elif defined(HAVE_CTHREADS_H) +#elif defined( HAVE_CTHREADS_H ) int result; cthread_exit( &result ); -#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) +#elif defined( HAVE_KERNEL_SCHEDULER_H ) exit_thread( 0 ); -#elif defined(WIN32) +#elif defined( WIN32 ) #if 0 ExitThread( 0 ); #endif @@ -224,17 +240,20 @@ static __inline__ void vlc_thread_exit( void ) *****************************************************************************/ static __inline__ void vlc_thread_join( vlc_thread_t thread ) { -#if defined(PTHREAD_COND_T_IN_PTHREAD_H) +#if defined( PTH_INIT_IN_PTH_H ) + pth_join( thread, NULL ); + +#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) pthread_join( thread, NULL ); -#elif defined(HAVE_CTHREADS_H) +#elif defined( HAVE_CTHREADS_H ) cthread_join( thread ); -#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) +#elif defined( HAVE_KERNEL_SCHEDULER_H ) int32 exit_value; wait_for_thread( thread, &exit_value ); -#elif defined(WIN32) +#elif defined( WIN32 ) WaitForSingleObject( thread, INFINITE); #endif @@ -245,14 +264,17 @@ static __inline__ void vlc_thread_join( vlc_thread_t thread ) *****************************************************************************/ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex ) { -#if defined(PTHREAD_COND_T_IN_PTHREAD_H) +#if defined( PTH_INIT_IN_PTH_H ) + return pth_mutex_init( p_mutex ); + +#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) return pthread_mutex_init( p_mutex, NULL ); -#elif defined(HAVE_CTHREADS_H) +#elif defined( HAVE_CTHREADS_H ) mutex_init( p_mutex ); return 0; -#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) +#elif defined( HAVE_KERNEL_SCHEDULER_H ) /* check the arguments and whether it's already been initialized */ if( p_mutex == NULL ) @@ -274,7 +296,7 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex ) p_mutex->init = 9999; return B_OK; -#elif defined(WIN32) +#elif defined( WIN32 ) *p_mutex = CreateMutex(0,FALSE,0); return (*p_mutex?0:1); @@ -286,14 +308,17 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex ) *****************************************************************************/ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex ) { -#if defined(PTHREAD_COND_T_IN_PTHREAD_H) +#if defined( PTH_INIT_IN_PTH_H ) + return pth_mutex_acquire( p_mutex, TRUE, NULL ); + +#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) return pthread_mutex_lock( p_mutex ); -#elif defined(HAVE_CTHREADS_H) +#elif defined( HAVE_CTHREADS_H ) mutex_lock( p_mutex ); return 0; -#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) +#elif defined( HAVE_KERNEL_SCHEDULER_H ) status_t err; if( !p_mutex ) @@ -309,7 +334,7 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex ) err = acquire_sem( p_mutex->lock ); return err; -#elif defined(WIN32) +#elif defined( WIN32 ) WaitForSingleObject( *p_mutex, INFINITE ); return 0; @@ -321,14 +346,17 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex ) *****************************************************************************/ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex ) { -#if defined(PTHREAD_COND_T_IN_PTHREAD_H) +#if defined( PTH_INIT_IN_PTH_H ) + return pth_mutex_release( p_mutex ); + +#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) return pthread_mutex_unlock( p_mutex ); -#elif defined(HAVE_CTHREADS_H) +#elif defined( HAVE_CTHREADS_H ) mutex_unlock( p_mutex ); return 0; -#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) +#elif defined( HAVE_KERNEL_SCHEDULER_H ) if( !p_mutex) { return B_BAD_VALUE; @@ -342,7 +370,7 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex ) release_sem( p_mutex->lock ); return B_OK; -#elif defined(WIN32) +#elif defined( WIN32 ) ReleaseMutex( *p_mutex ); return 0; @@ -354,10 +382,13 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex ) *****************************************************************************/ static __inline__ int vlc_mutex_destroy( vlc_mutex_t *p_mutex ) { -#if defined(PTHREAD_COND_T_IN_PTHREAD_H) +#if defined( PTH_INIT_IN_PTH_H ) + return 0; + +#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) return pthread_mutex_destroy( p_mutex ); -#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) +#elif defined( HAVE_KERNEL_SCHEDULER_H ) if( p_mutex->init == 9999 ) { delete_sem( p_mutex->lock ); @@ -366,7 +397,7 @@ static __inline__ int vlc_mutex_destroy( vlc_mutex_t *p_mutex ) p_mutex->init = 0; return B_OK; -#elif defined(WIN32) +#elif defined( WIN32 ) CloseHandle(*p_mutex); return 0; @@ -378,10 +409,13 @@ static __inline__ int vlc_mutex_destroy( vlc_mutex_t *p_mutex ) *****************************************************************************/ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar ) { -#if defined(PTHREAD_COND_T_IN_PTHREAD_H) +#if defined( PTH_INIT_IN_PTH_H ) + return pth_cond_init( p_condvar ); + +#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) return pthread_cond_init( p_condvar, NULL ); -#elif defined(HAVE_CTHREADS_H) +#elif defined( HAVE_CTHREADS_H ) /* condition_init() */ spin_lock_init( &p_condvar->lock ); cthread_queue_init( &p_condvar->queue ); @@ -390,7 +424,7 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar ) return 0; -#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) +#elif defined( HAVE_KERNEL_SCHEDULER_H ) if( !p_condvar ) { return B_BAD_VALUE; @@ -405,7 +439,7 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar ) p_condvar->init = 9999; return 0; -#elif defined(WIN32) +#elif defined( WIN32 ) /* Create an auto-reset event. */ *p_condvar = CreateEvent( NULL, /* no security */ FALSE, /* auto-reset event */ @@ -422,10 +456,13 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar ) *****************************************************************************/ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar ) { -#if defined(PTHREAD_COND_T_IN_PTHREAD_H) +#if defined( PTH_INIT_IN_PTH_H ) + return pth_cond_notify( p_condvar, FALSE ); + +#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) return pthread_cond_signal( p_condvar ); -#elif defined(HAVE_CTHREADS_H) +#elif defined( HAVE_CTHREADS_H ) /* condition_signal() */ if ( p_condvar->queue.head || p_condvar->implications ) { @@ -433,7 +470,7 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar ) } return 0; -#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) +#elif defined( HAVE_KERNEL_SCHEDULER_H ) if( !p_condvar ) { return B_BAD_VALUE; @@ -469,7 +506,7 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar ) } return 0; -#elif defined(WIN32) +#elif defined( WIN32 ) /* Try to release one waiting thread. */ PulseEvent ( *p_condvar ); return 0; @@ -482,14 +519,17 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar ) *****************************************************************************/ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex ) { -#if defined(PTHREAD_COND_T_IN_PTHREAD_H) +#if defined( PTH_INIT_IN_PTH_H ) + return pth_cond_await( p_condvar, p_mutex, NULL ); + +#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) return pthread_cond_wait( p_condvar, p_mutex ); -#elif defined(HAVE_CTHREADS_H) +#elif defined( HAVE_CTHREADS_H ) condition_wait( (condition_t)p_condvar, (mutex_t)p_mutex ); return 0; -#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) +#elif defined( HAVE_KERNEL_SCHEDULER_H ) if( !p_condvar ) { return B_BAD_VALUE; @@ -516,7 +556,7 @@ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex vlc_mutex_lock( p_mutex ); return 0; -#elif defined(WIN32) +#elif defined( WIN32 ) /* Release the here and wait for the event * to become signaled, due to being * called. */ @@ -536,14 +576,17 @@ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex *****************************************************************************/ static __inline__ int vlc_cond_destroy( vlc_cond_t *p_condvar ) { -#if defined(PTHREAD_COND_T_IN_PTHREAD_H) +#if defined( PTH_INIT_IN_PTH_H ) + return 0; + +#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) return pthread_cond_destroy( p_condvar ); -#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) +#elif defined( HAVE_KERNEL_SCHEDULER_H ) p_condvar->init = 0; return 0; -#elif defined(WIN32) +#elif defined( WIN32 ) CloseHandle( *p_condvar ); return 0; diff --git a/lib/.cvsignore b/lib/.cvsignore index 140f8cf80f..952bbd3b58 100644 --- a/lib/.cvsignore +++ b/lib/.cvsignore @@ -1 +1,2 @@ *.so +*.so.* diff --git a/plugins/directx/aout_directx.c b/plugins/directx/aout_directx.c index 8396d30b06..b7406e58f1 100644 --- a/plugins/directx/aout_directx.c +++ b/plugins/directx/aout_directx.c @@ -2,7 +2,7 @@ * aout_directx.c: Windows DirectX audio output method ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: aout_directx.c,v 1.2 2001/06/03 12:47:21 sam Exp $ + * $Id: aout_directx.c,v 1.3 2001/06/14 01:49:44 sam Exp $ * * Authors: Gildas Bazin * @@ -24,7 +24,7 @@ #define MODULE_NAME directx #include "modules_inner.h" -/* The most important this to do for now is to fix the audio bug we've got +/* The most important thing to do for now is to fix the audio bug we've got * on startup: the audio will start later than the video (sometimes) and * is trying to catching up with it. * At first sight it seems to be a scheduling problem @@ -77,6 +77,8 @@ typedef struct aout_sys_s * takes care of mixing all the * secondary buffers into the primary) */ + HINSTANCE hdsound_dll; /* handle of the opened dsound dll */ + long l_buffer_size; /* secondary sound buffer size */ long l_write_position; /* next write position for the buffer */ @@ -96,7 +98,8 @@ static void aout_Play ( aout_thread_t *p_aout, static void aout_Close ( aout_thread_t *p_aout ); /* local function */ -static int windx_CreateSecondaryBuffer( aout_thread_t *p_aout ); +static int DirectxCreateSecondaryBuffer( aout_thread_t *p_aout ); +static int DirectxInitDSound( aout_thread_t *p_aout ); /***************************************************************************** * Functions exported as capabilities. They are declared as static so that @@ -135,11 +138,11 @@ static int aout_Probe( probedata_t *p_data ) *****************************************************************************/ static int aout_Open( aout_thread_t *p_aout ) { -#if 0 HRESULT dsresult; DSBUFFERDESC dsbuffer_desc; WAVEFORMATEX waveformat; -#endif + + intf_WarnMsg( 3, "aout: DirectX aout_Open "); /* Allocate structure */ p_aout->p_sys = malloc( sizeof( aout_sys_t ) ); @@ -162,32 +165,13 @@ static int aout_Open( aout_thread_t *p_aout ) p_aout->l_rate = main_GetIntVariable( AOUT_RATE_VAR, AOUT_RATE_DEFAULT ); - /* Create the direct sound object */ - if( DirectSoundCreate(NULL, &p_aout->p_sys->p_dsobject, NULL) != DS_OK ) + /* Initialise DirectSound */ + if( DirectxInitDSound( p_aout ) ) { - intf_WarnMsg( 3, "aout: can't create a direct sound device "); - p_aout->p_sys->p_dsobject = NULL; + intf_WarnMsg( 3, "aout: can't initialise DirectSound "); return( 1 ); } - /* Set DirectSound Cooperative level, ie what control we want over Windows - * sound device. In our case, DSSCL_EXCLUSIVE means that we can modify the - * settings of the primary buffer, but also that only the sound of our - * application will be hearable when it will have the focus. - * !!! (this is not really working as intended yet because to set the - * cooperative level you need the window handle of your application, and - * I don't know of any easy way to get it. Especially since we might play - * sound without any video, and so what window handle should we use ??? - * The hack for now is to use the Desktop window handle - it seems to be - * working */ - if( IDirectSound_SetCooperativeLevel(p_aout->p_sys->p_dsobject, - GetDesktopWindow(), - DSSCL_EXCLUSIVE) ) - { - intf_WarnMsg( 3, "aout: can't set direct sound cooperative level "); - } - -#if 0 /* Obtain (not create) Direct Sound primary buffer */ memset( &dsbuffer_desc, 0, sizeof(DSBUFFERDESC) ); dsbuffer_desc.dwSize = sizeof(DSBUFFERDESC); @@ -240,21 +224,6 @@ static int aout_Open( aout_thread_t *p_aout ) p_aout->p_sys->p_dsbuffer_primary = NULL; return( 1 ); } -#endif - - /* Now create the buffer that we'll actually use: the secondary buffer */ - if( windx_CreateSecondaryBuffer( p_aout ) ) - { - intf_WarnMsg( 3, "aout: can't create direct sound secondary buffer "); -#if 0 - IDirectSound_Release( p_aout->p_sys->p_dsbuffer_primary ); -#endif - IDirectSound_Release( p_aout->p_sys->p_dsobject ); - p_aout->p_sys->p_dsobject = NULL; - p_aout->p_sys->p_dsbuffer_primary = NULL; - p_aout->p_sys->p_dsbuffer = NULL; - return( 1 ); - } return( 0 ); } @@ -270,6 +239,8 @@ static int aout_SetFormat( aout_thread_t *p_aout ) { HRESULT dsresult; + intf_WarnMsg( 3, "aout: DirectX aout_SetFormat "); + /* first release the current secondary buffer */ if( p_aout->p_sys->p_dsbuffer != NULL ) { @@ -278,10 +249,10 @@ static int aout_SetFormat( aout_thread_t *p_aout ) } /* then create a new secondary buffer */ - dsresult = windx_CreateSecondaryBuffer( p_aout ); + dsresult = DirectxCreateSecondaryBuffer( p_aout ); if( dsresult != DS_OK ) { - intf_WarnMsg( 3, "aout: WinDX aout_SetFormat cannot create buffer"); + intf_WarnMsg( 3, "aout: DirectX aout_SetFormat cannot create buffer"); return( 1 ); } @@ -311,16 +282,25 @@ static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit ) } if( dsresult != DS_OK ) { - intf_WarnMsg( 3, "aout: WinDX aout_GetBufInfo cannot get current pos"); + intf_WarnMsg(3,"aout: DirectX aout_GetBufInfo cannot get current pos"); return( l_buffer_limit ); } - l_result = ((p_aout->p_sys->l_write_position >= l_play_position) ? - (p_aout->p_sys->l_write_position - l_play_position)/2 - : (p_aout->p_sys->l_buffer_size - l_play_position - + p_aout->p_sys->l_write_position)/2 ); + /* temporary hack. When you start playing a new file, the play position + * doesn't start changing immediatly, even though sound is already + * playing from the sound card */ + if( l_play_position == 0 ) + { + intf_WarnMsg( 5, "aout: DirectX aout_GetBufInfo: %li", l_buffer_limit); + return( l_buffer_limit ); + } + + l_result = (p_aout->p_sys->l_write_position >= l_play_position) ? + (p_aout->p_sys->l_write_position - l_play_position) /2 + : (p_aout->p_sys->l_buffer_size - l_play_position + + p_aout->p_sys->l_write_position) /2 ; - intf_WarnMsg( 5, "aout: WinDX aout_GetBufInfo: %li", l_result); + intf_WarnMsg( 5, "aout: DirectX aout_GetBufInfo: %li", l_result); return l_result; } @@ -336,7 +316,7 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) long l_play_position, l_notused, l_buffer_free_length; HRESULT dsresult; - /* We want to copy data to the circular sound buffer, so first we need to + /* We want to copy data to the circular sound buffer, so we first need to * find out were in the buffer we can write our data */ dsresult = IDirectSoundBuffer_GetCurrentPosition(p_aout->p_sys->p_dsbuffer, &l_play_position, @@ -351,20 +331,31 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) } if( dsresult != DS_OK ) { - intf_WarnMsg( 3, "aout: WinDX aout_Play can'get buffer position"); + intf_WarnMsg( 3, "aout: DirectX aout_Play can'get buffer position"); } /* check that we are not overflowing the circular buffer (everything should * be alright but just in case) */ l_buffer_free_length = l_play_position - p_aout->p_sys->l_write_position; if( l_buffer_free_length <= 0 ) - l_buffer_free_length += p_aout->p_sys->l_buffer_size ; + l_buffer_free_length += p_aout->p_sys->l_buffer_size; if( i_size > l_buffer_free_length ) { - intf_WarnMsg( 3, "aout: WinDX aout_Play buffer overflow: size %i, free %i !!!", i_size, l_buffer_free_length); - intf_WarnMsg( 3, "aout: WinDX aout_Play buffer overflow: writepos %i, readpos %i !!!", l_play_position, p_aout->p_sys->l_write_position); + intf_WarnMsg( 3, "aout: DirectX aout_Play buffer overflow: size %i, free %i !!!", i_size, l_buffer_free_length); + intf_WarnMsg( 3, "aout: DirectX aout_Play buffer overflow: writepos %i, readpos %i !!!", p_aout->p_sys->l_write_position, l_play_position); /*i_size = l_buffer_free_length;*/ + + /* Update the write pointer */ + p_aout->p_sys->l_write_position = l_notused; + + } + else + { + intf_WarnMsg( 4, "aout: DirectX aout_Play buffer: size %i, free %i !!!" + , i_size, l_buffer_free_length); + intf_WarnMsg( 4, "aout: DirectX aout_Play buffer: writepos %i, readpos %i !!!", p_aout->p_sys->l_write_position, l_play_position); + } /* Before copying anything, we have to lock the buffer */ @@ -391,7 +382,7 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) } if( dsresult != DS_OK ) { - intf_WarnMsg( 3, "aout: WinDX aout_Play can't lock buffer"); + intf_WarnMsg( 3, "aout: DirectX aout_Play can't lock buffer"); return; } @@ -423,7 +414,7 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) } if( dsresult != DS_OK ) { - intf_WarnMsg( 3, "aout: WinDX aout_Play can't play buffer"); + intf_WarnMsg( 3, "aout: DirectX aout_Play can't play buffer"); return; } @@ -434,6 +425,9 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) *****************************************************************************/ static void aout_Close( aout_thread_t *p_aout ) { + + intf_WarnMsg( 3, "aout: DirectX aout_Close "); + /* make sure the buffer isn't playing */ if( p_aout->p_sys->p_dsbuffer != NULL ) { @@ -461,6 +455,13 @@ static void aout_Close( aout_thread_t *p_aout ) p_aout->p_sys->p_dsobject = NULL; } + /* free DSOUND.DLL */ + if( p_aout->p_sys->hdsound_dll != NULL ) + { + FreeLibrary( p_aout->p_sys->hdsound_dll ); + p_aout->p_sys->hdsound_dll = NULL; + } + /* Close the Output. */ if ( p_aout->p_sys != NULL ) { @@ -470,7 +471,63 @@ static void aout_Close( aout_thread_t *p_aout ) } /***************************************************************************** - * windx_CreateSecondaryBuffer + * DirectxInitDSound + ***************************************************************************** + *****************************************************************************/ +static int DirectxInitDSound( aout_thread_t *p_aout ) +{ + HRESULT (WINAPI *OurDirectSoundCreate)(LPGUID, LPDIRECTSOUND *, LPUNKNOWN); + + p_aout->p_sys->hdsound_dll = LoadLibrary("DSOUND.DLL"); + if( p_aout->p_sys->hdsound_dll == NULL ) + { + intf_WarnMsg( 3, "aout: can't open DSOUND.DLL "); + return( 1 ); + } + + OurDirectSoundCreate = (void *)GetProcAddress( p_aout->p_sys->hdsound_dll, + "DirectSoundCreate" ); + + if( OurDirectSoundCreate == NULL ) + { + intf_WarnMsg( 3, "aout: GetProcAddress FAILED "); + FreeLibrary( p_aout->p_sys->hdsound_dll ); + p_aout->p_sys->hdsound_dll = NULL; + return( 1 ); + } + + /* Create the direct sound object */ + if( OurDirectSoundCreate(NULL, &p_aout->p_sys->p_dsobject, NULL) != DS_OK ) + { + intf_WarnMsg( 3, "aout: can't create a direct sound device "); + p_aout->p_sys->p_dsobject = NULL; + FreeLibrary( p_aout->p_sys->hdsound_dll ); + p_aout->p_sys->hdsound_dll = NULL; + return( 1 ); + } + + /* Set DirectSound Cooperative level, ie what control we want over Windows + * sound device. In our case, DSSCL_EXCLUSIVE means that we can modify the + * settings of the primary buffer, but also that only the sound of our + * application will be hearable when it will have the focus. + * !!! (this is not really working as intended yet because to set the + * cooperative level you need the window handle of your application, and + * I don't know of any easy way to get it. Especially since we might play + * sound without any video, and so what window handle should we use ??? + * The hack for now is to use the Desktop window handle - it seems to be + * working */ + if( IDirectSound_SetCooperativeLevel(p_aout->p_sys->p_dsobject, + GetDesktopWindow(), + DSSCL_EXCLUSIVE) ) + { + intf_WarnMsg( 3, "aout: can't set direct sound cooperative level "); + } + + return( 0 ); +} + +/***************************************************************************** + * DirectxCreateSecondaryBuffer ***************************************************************************** * This function creates the buffer we'll use to play audio. * In DirectSound there are two kinds of buffers: @@ -481,7 +538,7 @@ static void aout_Close( aout_thread_t *p_aout ) * Once you create a secondary buffer, you cannot change its format anymore so * you have to release the current and create another one. *****************************************************************************/ -static int windx_CreateSecondaryBuffer( aout_thread_t *p_aout ) +static int DirectxCreateSecondaryBuffer( aout_thread_t *p_aout ) { WAVEFORMATEX waveformat; DSBUFFERDESC dsbdesc; @@ -504,10 +561,6 @@ static int windx_CreateSecondaryBuffer( aout_thread_t *p_aout ) dsbdesc.dwSize = sizeof(DSBUFFERDESC); dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2/* Better position accuracy */ | DSBCAPS_GLOBALFOCUS; /* Allows background playing */ - /* | DSBCAPS_CTRLPAN - | DSBCAPS_CTRLVOLUME - | DSBCAPS_CTRLFREQUENCY; - */ dsbdesc.dwBufferBytes = waveformat.nAvgBytesPerSec * 4; /* 4 sec buffer */ dsbdesc.lpwfxFormat = &waveformat; @@ -523,32 +576,12 @@ static int windx_CreateSecondaryBuffer( aout_thread_t *p_aout ) /* backup the size of the secondary sound buffer */ memset(&dsbcaps, 0, sizeof(DSBCAPS)); - dsbcaps.dwSize = sizeof(DSBCAPS); + dsbcaps.dwSize = sizeof(DSBCAPS); IDirectSoundBuffer_GetCaps( p_aout->p_sys->p_dsbuffer, &dsbcaps ); p_aout->p_sys->l_buffer_size = dsbcaps.dwBufferBytes; p_aout->p_sys->l_write_position = 0; - intf_WarnMsg( 3, "aout: WinDX WinDX_CreateSecondaryBuffer: %li", + intf_WarnMsg( 3, "aout: DirectX DirectxCreateSecondaryBuffer: %li", p_aout->p_sys->l_buffer_size); - /* make sure the buffer isn't playing */ - IDirectSoundBuffer_Stop( p_aout->p_sys->p_dsbuffer ); - - /* reset play position, just to be sure (and after some tests it seems - * indeed necessary */ - dsresult = IDirectSoundBuffer_SetCurrentPosition(p_aout->p_sys->p_dsbuffer, - 0 ); - if( dsresult == DSERR_BUFFERLOST ) - { - IDirectSoundBuffer_Restore( p_aout->p_sys->p_dsbuffer ); - dsresult = IDirectSoundBuffer_SetCurrentPosition( - p_aout->p_sys->p_dsbuffer, - 0 ); - } - if( dsresult != DS_OK ) - { - intf_WarnMsg( 3, "aout: WinDX CreateSecondary cannot wet current pos"); - } - return( 0 ); } - diff --git a/plugins/directx/vout_directx.c b/plugins/directx/vout_directx.c index bc6d3b74fb..907e752c85 100644 --- a/plugins/directx/vout_directx.c +++ b/plugins/directx/vout_directx.c @@ -2,7 +2,7 @@ * vout_directx.c: Windows DirectX video output display method ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: vout_directx.c,v 1.3 2001/06/08 20:03:15 sam Exp $ + * $Id: vout_directx.c,v 1.4 2001/06/14 01:49:44 sam Exp $ * * Authors: Gildas Bazin * @@ -82,10 +82,11 @@ typedef struct vout_sys_s { - LPDIRECTDRAW p_ddobject; /* DirectDraw object */ - LPDIRECTDRAWSURFACE p_display; /* display device */ - LPDIRECTDRAWSURFACE p_overlay; /* overlay device */ - LPDIRECTDRAWCLIPPER p_clipper; /* clipper */ + LPDIRECTDRAW2 p_ddobject; /* DirectDraw object */ + LPDIRECTDRAWSURFACE3 p_display; /* Display device */ + LPDIRECTDRAWSURFACE3 p_surface; /* surface where we display the video */ + LPDIRECTDRAWCLIPPER p_clipper; /* clipper used for blitting */ + HINSTANCE hddraw_dll; /* handle of the opened ddraw dll */ HBRUSH hbrush; /* window backgound brush (color) */ HWND hwnd; /* Handle of the main window */ @@ -103,7 +104,7 @@ typedef struct vout_sys_s boolean_t b_cursor_autohidden; mtime_t i_lastmoved; - char *p_windx_buf[2]; /* Buffer information */ + char *p_directx_buf[2]; /* Buffer information */ } vout_sys_t; @@ -120,15 +121,16 @@ 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 WinDXCreateWindow ( vout_thread_t *p_vout ); -static int WinDXInitDDraw ( vout_thread_t *p_vout ); -static int WinDXCreateDisplay ( vout_thread_t *p_vout ); -static int WinDXCreateYUVOverlay ( vout_thread_t *p_vout ); -static int WinDXUpdateOverlay ( vout_thread_t *p_vout ); -static void WinDXCloseDDraw ( vout_thread_t *p_vout ); -static void WinDXCloseWindow ( vout_thread_t *p_vout ); -static void WinDXCloseDisplay ( vout_thread_t *p_vout ); -static void WinDXCloseYUVOverlay ( vout_thread_t *p_vout ); +static int DirectXCreateWindow ( vout_thread_t *p_vout ); +static int DirectXInitDDraw ( vout_thread_t *p_vout ); +static int DirectXCreateDisplay ( vout_thread_t *p_vout ); +static int DirectXCreateSurface ( vout_thread_t *p_vout ); +static int DirectXCreateClipper ( vout_thread_t *p_vout ); +static int DirectXUpdateOverlay ( vout_thread_t *p_vout ); +static void DirectXCloseDDraw ( vout_thread_t *p_vout ); +static void DirectXCloseWindow ( vout_thread_t *p_vout ); +static void DirectXCloseDisplay ( vout_thread_t *p_vout ); +static void DirectXCloseSurface ( vout_thread_t *p_vout ); /***************************************************************************** * Functions exported as capabilities. They are declared as static so that @@ -154,11 +156,15 @@ void _M( vout_getfunctions )( function_list_t * p_function_list ) *****************************************************************************/ static int vout_Probe( probedata_t *p_data ) { + if( TestMethod( VOUT_METHOD_VAR, "directx" ) ) { return( 999 ); } + /* Check that at least DirectX5 is installed on the computer */ + /* Fixme */ + return( 400 ); } @@ -180,15 +186,16 @@ static int vout_Create( vout_thread_t *p_vout ) /* Initialisations */ p_vout->p_sys->p_ddobject = NULL; p_vout->p_sys->p_display = NULL; - p_vout->p_sys->p_overlay = NULL; + p_vout->p_sys->p_surface = NULL; p_vout->p_sys->p_clipper = NULL; - p_vout->p_sys->hbrush = INVALID_HANDLE_VALUE; - p_vout->p_sys->hwnd = INVALID_HANDLE_VALUE; + p_vout->p_sys->hbrush = NULL; + p_vout->p_sys->hwnd = NULL; + p_vout->p_sys->b_display_enabled = 0; + p_vout->b_need_render = 0; /* by default try an YUV overlay display */ 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->b_display_enabled = 0; p_vout->p_sys->i_lastmoved = mdate(); p_vout->b_fullscreen = main_GetIntVariable( VOUT_FULLSCREEN_VAR, @@ -207,7 +214,7 @@ static int vout_Create( vout_thread_t *p_vout ) /* Create a window for the video */ /* Creating a window under Windows also initializes the thread's event * message qeue */ - if( WinDXCreateWindow( p_vout ) ) + if( DirectXCreateWindow( p_vout ) ) { intf_ErrMsg( "vout error: can't create window" ); free( p_vout->p_sys ); @@ -215,20 +222,20 @@ static int vout_Create( vout_thread_t *p_vout ) } /* Initialise DirectDraw */ - if( WinDXInitDDraw( p_vout ) ) + if( DirectXInitDDraw( p_vout ) ) { intf_ErrMsg( "vout error: can't initialise DirectDraw" ); - WinDXCloseWindow( p_vout ); + DirectXCloseWindow( p_vout ); free( p_vout->p_sys ); return ( 1 ); } - /* create the directx display */ - if( WinDXCreateDisplay( p_vout ) ) + /* Create the directx display */ + if( DirectXCreateDisplay( p_vout ) ) { intf_ErrMsg( "vout error: can't initialise DirectDraw" ); - WinDXCloseDDraw( p_vout ); - WinDXCloseWindow( p_vout ); + DirectXCloseDDraw( p_vout ); + DirectXCloseWindow( p_vout ); free( p_vout->p_sys ); return ( 1 ); } @@ -265,9 +272,9 @@ static void vout_End( vout_thread_t *p_vout ) static void vout_Destroy( vout_thread_t *p_vout ) { intf_WarnMsg( 3, "vout: vout_Destroy" ); - WinDXCloseDisplay( p_vout ); - WinDXCloseDDraw( p_vout ); - WinDXCloseWindow( p_vout ); + DirectXCloseDisplay( p_vout ); + DirectXCloseDDraw( p_vout ); + DirectXCloseWindow( p_vout ); if( p_vout->p_sys != NULL ) { @@ -297,17 +304,17 @@ static int vout_Manage( vout_thread_t *p_vout ) { case WM_CLOSE: - intf_WarnMsg( 3, "vout: WinDX vout_Manage WM_CLOSE" ); + intf_WarnMsg( 4, "vout: vout_Manage WM_CLOSE" ); p_vout->b_die = 1; break; case WM_QUIT: - intf_WarnMsg( 3, "vout: WinDX vout_Manage WM_QUIT" ); + intf_WarnMsg( 4, "vout: vout_Manage WM_QUIT" ); p_main->p_intf->b_die = 1; break; case WM_MOVE: - intf_WarnMsg( 3, "vout: WinDX vout_Manage WM_MOVE" ); + intf_WarnMsg( 3, "vout: vout_Manage WM_MOVE" ); if( !p_vout->b_need_render ) { p_vout->i_changes |= VOUT_SIZE_CHANGE; @@ -317,7 +324,7 @@ static int vout_Manage( vout_thread_t *p_vout ) break; case WM_APP: - intf_WarnMsg( 3, "vout: WinDX vout_Manage WM_APP" ); + intf_WarnMsg( 3, "vout: vout_Manage WM_APP" ); if( !p_vout->b_need_render ) { p_vout->i_changes |= VOUT_SIZE_CHANGE; @@ -327,18 +334,18 @@ static int vout_Manage( vout_thread_t *p_vout ) break; case WM_PAINT: - intf_WarnMsg( 3, "vout: WinDX vout_Manage WM_PAINT" ); + intf_WarnMsg( 4, "vout: vout_Manage WM_PAINT" ); break; case WM_ERASEBKGND: - intf_WarnMsg( 3, "vout: WinDX vout_Manage WM_ERASEBKGND" ); + intf_WarnMsg( 4, "vout: vout_Manage WM_ERASEBKGND" ); break; case WM_MOUSEMOVE: - intf_WarnMsg( 3, "vout: WinDX vout_Manage WM_MOUSEMOVE" ); + intf_WarnMsg( 4, "vout: vout_Manage WM_MOUSEMOVE" ); if( p_vout->p_sys->b_cursor ) { - if( p_vout->p_sys->b_cursor_autohidden ) + if( p_vout->p_sys->b_cursor_autohidden ) { p_vout->p_sys->b_cursor_autohidden = 0; p_vout->p_sys->i_lastmoved = mdate(); @@ -355,7 +362,7 @@ static int vout_Manage( vout_thread_t *p_vout ) /* the key events are first processed here. The next * message processed by this main message loop will be the * char translation of the key event */ - intf_WarnMsg( 3, "vout: WinDX vout_Manage WM_KEYDOWN" ); + intf_WarnMsg( 3, "vout: vout_Manage WM_KEYDOWN" ); switch( msg.wParam ) { case VK_ESCAPE: @@ -368,7 +375,7 @@ static int vout_Manage( vout_thread_t *p_vout ) break; case WM_CHAR: - intf_WarnMsg( 3, "vout: WinDX vout_Manage WM_CHAR" ); + intf_WarnMsg( 3, "vout: vout_Manage WM_CHAR" ); switch( msg.wParam ) { case 'q': @@ -376,11 +383,39 @@ static int vout_Manage( vout_thread_t *p_vout ) p_main->p_intf->b_die = 1; break; - case 'f': + case 'f': /* switch to fullscreen */ case 'F': p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE; break; + case 'y': /* switch to hard YUV */ + case 'Y': + p_vout->i_changes |= VOUT_YUV_CHANGE; + break; + + case 'c': /* toggle grayscale */ + case 'C': + p_vout->b_grayscale = ! p_vout->b_grayscale; + p_vout->i_changes |= VOUT_GRAYSCALE_CHANGE; + break; + + case 'i': /* toggle info */ + case 'I': + p_vout->b_info = ! p_vout->b_info; + p_vout->i_changes |= VOUT_INFO_CHANGE; + break; + + case 's': /* toggle scaling */ + case 'S': + p_vout->b_scale = ! p_vout->b_scale; + p_vout->i_changes |= VOUT_SCALE_CHANGE; + break; + + case ' ': /* toggle interface */ + p_vout->b_interface = ! p_vout->b_interface; + p_vout->i_changes |= VOUT_INTF_CHANGE; + break; + case '0': network_ChannelJoin( 0 ); break; case '1': network_ChannelJoin( 1 ); break; case '2': network_ChannelJoin( 2 ); break; @@ -403,7 +438,7 @@ static int vout_Manage( vout_thread_t *p_vout ) } default: - intf_WarnMsg( 3, "vout: WinDX vout_Manage WM Default %i", + intf_WarnMsg( 4, "vout: vout_Manage WM Default %i", msg.message ); break; } @@ -425,16 +460,52 @@ static int vout_Manage( vout_thread_t *p_vout ) } + /* + * Scale Change + */ + if( p_vout->i_changes & VOUT_SCALE_CHANGE ) + { + intf_WarnMsg( 3, "vout: vout_Manage Scale Change" ); + DirectXUpdateOverlay( p_vout ); + p_vout->i_changes &= ~VOUT_SCALE_CHANGE; + } + /* * Size Change */ if( p_vout->i_changes & VOUT_SIZE_CHANGE ) { - intf_WarnMsg( 3, "vout: WinDX vout_Manage Size Change" ); - WinDXUpdateOverlay( p_vout ); + intf_WarnMsg( 3, "vout: vout_Manage Size Change" ); + DirectXUpdateOverlay( p_vout ); 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 */ + DirectXCloseSurface( p_vout ); + if( DirectXCreateSurface( p_vout ) ) + { + intf_ErrMsg( "error: can't reopen display after YUV change" ); + return( 1 ); + } + + /* Repaint the window background (needed by the overlay surface) */ + if( !p_vout->b_need_render ) + { + InvalidateRect( p_vout->p_sys->hwnd, NULL, TRUE ); + p_vout->p_sys->b_display_enabled = 1; + DirectXUpdateOverlay( p_vout ); + } + + p_vout->i_changes &= ~VOUT_YUV_CHANGE; + } + /* * Fullscreen change */ @@ -463,7 +534,6 @@ static int vout_Manage( vout_thread_t *p_vout ) } SetWindowPlacement( p_vout->p_sys->hwnd, &window_placement ); - /*WinDXUpdateOverlay( p_vout );*/ p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE; } @@ -472,7 +542,7 @@ static int vout_Manage( vout_thread_t *p_vout ) * Pointer change */ if( ! p_vout->p_sys->b_cursor_autohidden && - ( mdate() - p_vout->p_sys->i_lastmoved > 2000000 ) ) + ( mdate() - p_vout->p_sys->i_lastmoved > 5000000 ) ) { /* Hide the mouse automatically */ p_vout->p_sys->b_cursor_autohidden = 1; @@ -517,22 +587,86 @@ static void vout_Display( vout_thread_t *p_vout ) DDSURFACEDESC ddsd; HRESULT dxresult; int i; - int i_image_width = p_vout->p_rendered_pic->i_width; - int i_image_height = p_vout->p_rendered_pic->i_height; + int i_image_width; + int i_image_height; + intf_WarnMsg( 5, "vout: vout_Display" ); + if( (p_vout->p_sys->p_display == NULL) ) { - intf_WarnMsg( 3, "vout error: WinDX no display!!" ); + intf_WarnMsg( 3, "vout error: vout_Display no display!!" ); return; } /* The first time this function is called it enables the display */ p_vout->p_sys->b_display_enabled = 1; + /* if the size of the decoded pictures has changed then we close the + * video surface (which doesn't have the right size anymore). */ + i_image_width = ( p_vout->p_rendered_pic ) ? + p_vout->p_rendered_pic->i_width : p_vout->p_sys->i_image_width; + i_image_height = ( p_vout->p_rendered_pic ) ? + p_vout->p_rendered_pic->i_height : p_vout->p_sys->i_image_height; + + if( p_vout->p_sys->i_image_width != i_image_width + || p_vout->p_sys->i_image_height != i_image_height ) + { + intf_WarnMsg( 3, "vout: video surface size changed" ); + p_vout->p_sys->i_image_width = i_image_width; + p_vout->p_sys->i_image_height = i_image_height; + DirectXCloseSurface( p_vout ); + } + if( p_vout->b_need_render ) { + RECT rect_window; + POINT point_window; + /* Nothing yet */ + if( p_vout->p_sys->p_surface == NULL ) + { + intf_WarnMsg( 3, "vout: no video surface, open one..." ); + if( DirectXCreateSurface( p_vout ) ) + { + intf_WarnMsg( 3, "vout: cannot open a new video surface !!" ); + return; + } + /* Display the surface */ + p_vout->p_sys->b_display_enabled = 1; + } + + /* Now get the coordinates of the window. We don't actually want the + * window coordinates but these of the usable surface inside the window + * By specification GetClientRect will always set rect_window.left and + * rect_window.top to 0 because the Client area is always relative to + * the container window */ + GetClientRect(p_vout->p_sys->hwnd, &rect_window); + + point_window.x = 0; + point_window.y = 0; + ClientToScreen(p_vout->p_sys->hwnd, &point_window); + rect_window.left = point_window.x; + rect_window.top = point_window.y; + + point_window.x = rect_window.right; + point_window.y = rect_window.bottom; + ClientToScreen(p_vout->p_sys->hwnd, &point_window); + rect_window.right = point_window.x; + rect_window.bottom = point_window.y; + + /* Blit video surface to display */ + dxresult = IDirectDrawSurface3_Blt(p_vout->p_sys->p_display, + &rect_window, + p_vout->p_sys->p_surface, + NULL, + 0, NULL ); + if( dxresult != DD_OK ) + { + intf_WarnMsg( 3, "vout: could not Blit the surface" ); + return; + } + } else { @@ -542,47 +676,36 @@ static void vout_Display( vout_thread_t *p_vout ) */ /* TODO: support for streams other than 4:2:0 */ - /* if the size of the decoded pictures has changed then we close the - * YUVOverlay (which doesn't have the right size anymore). */ - if( p_vout->p_sys->i_image_width != i_image_width - || p_vout->p_sys->i_image_height != i_image_height ) - { - intf_WarnMsg( 3, "vout: WinDX overlay size changed" ); - p_vout->p_sys->i_image_width = i_image_width; - p_vout->p_sys->i_image_height = i_image_height; - WinDXCloseYUVOverlay( p_vout ); - } - - if( p_vout->p_sys->p_overlay == NULL ) + if( p_vout->p_sys->p_surface == NULL ) { - intf_WarnMsg( 3, "vout: WinDX no overlay, open one..." ); - if( WinDXCreateYUVOverlay( p_vout ) ) + intf_WarnMsg( 3, "vout: no video surface, open one..." ); + if( DirectXCreateSurface( p_vout ) ) { - intf_WarnMsg( 3, "vout: WinDX cannot open a new overlay !!" ); + intf_WarnMsg( 3, "vout: cannot open a new video surface !!" ); return; } /* Display the Overlay */ p_vout->p_sys->b_display_enabled = 1; - WinDXUpdateOverlay( p_vout ); + DirectXUpdateOverlay( p_vout ); } /* Lock the overlay surface */ memset( &ddsd, 0, sizeof( DDSURFACEDESC )); ddsd.dwSize = sizeof(DDSURFACEDESC); - dxresult = IDirectDrawSurface_Lock(p_vout->p_sys->p_overlay, NULL, - &ddsd, DDLOCK_NOSYSLOCK, NULL); + dxresult = IDirectDrawSurface3_Lock(p_vout->p_sys->p_surface, NULL, + &ddsd, DDLOCK_NOSYSLOCK, NULL); if ( dxresult == DDERR_SURFACELOST ) { /* Your surface can be lost (thanks to windows) so be sure * to check this and restore it if needed */ - dxresult = IDirectDrawSurface_Restore( p_vout->p_sys->p_overlay ); - dxresult = IDirectDrawSurface_Lock( p_vout->p_sys->p_overlay, - NULL, &ddsd, DDLOCK_NOSYSLOCK - | DDLOCK_WAIT, NULL); + dxresult = IDirectDrawSurface3_Restore( p_vout->p_sys->p_surface ); + dxresult = IDirectDrawSurface3_Lock( p_vout->p_sys->p_surface, + NULL, &ddsd, DDLOCK_NOSYSLOCK + | DDLOCK_WAIT, NULL); } if( dxresult != DD_OK ) { - intf_WarnMsg( 3, "vout: WinDX could not lock the surface" ); + intf_WarnMsg( 3, "vout: could not lock the surface" ); return; } @@ -634,8 +757,8 @@ static void vout_Display( vout_thread_t *p_vout ) } /* Unlock the Surface */ - dxresult = IDirectDrawSurface_Unlock(p_vout->p_sys->p_overlay, - ddsd.lpSurface ); + dxresult = IDirectDrawSurface3_Unlock(p_vout->p_sys->p_surface, + ddsd.lpSurface ); } @@ -646,7 +769,7 @@ static void vout_Display( vout_thread_t *p_vout ) /***************************************************************************** - * WinDXEventProc: This is the window event processing function. + * DirectXEventProc: This is the window event processing function. ***************************************************************************** * On Windows, when you create a window you have to attach an event processing * function to it. The aim of this function is to manage "Queued Messages" and @@ -656,28 +779,30 @@ static void vout_Display( vout_thread_t *p_vout ) * Nonqueued Messages are those that Windows will send directly to this * function (like WM_DESTROY, WM_WINDOWPOSCHANGED...) *****************************************************************************/ -long FAR PASCAL WinDXEventProc( HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam ) +long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam ) { switch( message ) { +#if 0 case WM_ACTIVATE: - intf_WarnMsg( 3, "vout: WinDX WinProc WM_ACTIVED" ); + intf_WarnMsg( 4, "vout: WinProc WM_ACTIVED" ); break; case WM_CREATE: - intf_WarnMsg( 3, "vout: WinDX WinProc WM_CREATE" ); + intf_WarnMsg( 4, "vout: WinProc WM_CREATE" ); break; /* the user wants to close the window */ case WM_CLOSE: - intf_WarnMsg( 3, "vout: WinDX WinProc WM_CLOSE" ); + intf_WarnMsg( 4, "vout: WinProc WM_CLOSE" ); break; +#endif /* the window has been closed so shut down everything now */ case WM_DESTROY: - intf_WarnMsg( 3, "vout: WinDX WinProc WM_DESTROY" ); + intf_WarnMsg( 4, "vout: WinProc WM_DESTROY" ); PostQuitMessage( 0 ); break; @@ -686,60 +811,64 @@ long FAR PASCAL WinDXEventProc( HWND hwnd, UINT message, { case SC_SCREENSAVE: /* catch the screensaver */ case SC_MONITORPOWER: /* catch the monitor turn-off */ - intf_WarnMsg( 3, "vout: WinDX WinProc WM_SYSCOMMAND" ); + intf_WarnMsg( 3, "vout: WinProc WM_SYSCOMMAND" ); return 0; /* this stops them from happening */ } break; +#if 0 case WM_MOVE: - intf_WarnMsg( 3, "vout: WinDX WinProc WM_MOVE" ); + intf_WarnMsg( 4, "vout: WinProc WM_MOVE" ); break; case WM_SIZE: - intf_WarnMsg( 3, "vout: WinDX WinProc WM_SIZE" ); + intf_WarnMsg( 4, "vout: WinProc WM_SIZE" ); break; case WM_MOVING: - intf_WarnMsg( 3, "vout: WinDX WinProc WM_MOVING" ); + intf_WarnMsg( 4, "vout: WinProc WM_MOVING" ); break; case WM_SIZING: - intf_WarnMsg( 3, "vout: WinDX WinProc WM_SIZING" ); + intf_WarnMsg( 4, "vout: WinProc WM_SIZING" ); break; +#endif case WM_WINDOWPOSCHANGED: - intf_WarnMsg( 3, "vout: WinDX WinProc WM_WINDOWPOSCHANGED" ); + intf_WarnMsg( 3, "vout: WinProc WM_WINDOWPOSCHANGED" ); PostMessage( NULL, WM_APP, 0, 0); break; +#if 0 case WM_WINDOWPOSCHANGING: - intf_WarnMsg( 3, "vout: WinDX WinProc WM_WINDOWPOSCHANGING" ); + intf_WarnMsg( 3, "vout: WinProc WM_WINDOWPOSCHANGING" ); break; case WM_PAINT: - intf_WarnMsg( 3, "vout: WinDX WinProc WM_PAINT" ); + intf_WarnMsg( 4, "vout: WinProc WM_PAINT" ); break; case WM_ERASEBKGND: - intf_WarnMsg( 3, "vout: WinDX WinProc WM_ERASEBKGND" ); + intf_WarnMsg( 4, "vout: WinProc WM_ERASEBKGND" ); break; default: - intf_WarnMsg( 3, "vout: WinDX WinProc WM Default %i", message ); + intf_WarnMsg( 4, "vout: WinProc WM Default %i", message ); break; +#endif } return DefWindowProc(hwnd, message, wParam, lParam); } /***************************************************************************** - * WinDXCreateWindow: create a windows window where the video will play. + * DirectXCreateWindow: create a windows window where the video will play. ***************************************************************************** * Before creating a direct draw surface, we need to create a window in which * the video will be displayed. This window will also allow us to capture the * events. *****************************************************************************/ -static int WinDXCreateWindow( vout_thread_t *p_vout ) +static int DirectXCreateWindow( vout_thread_t *p_vout ) { HINSTANCE hInstance; WNDCLASS wc; /* window class components */ @@ -770,7 +899,7 @@ static int WinDXCreateWindow( vout_thread_t *p_vout ) if( colorkey == GetNearestColor( hdc, colorkey ) ) break; } - intf_WarnMsg( 3, "vout: WinDXCreateWindow background color:%i", colorkey ); + intf_WarnMsg(3,"vout: DirectXCreateWindow background color:%i", colorkey); ReleaseDC( p_vout->p_sys->hwnd, hdc ); /* create the actual brush */ @@ -779,7 +908,7 @@ static int WinDXCreateWindow( vout_thread_t *p_vout ) /* fill in the window class structure */ wc.style = 0; /* no special styles */ - wc.lpfnWndProc = (WNDPROC)WinDXEventProc; /* event handler */ + wc.lpfnWndProc = (WNDPROC)DirectXEventProc; /* event handler */ wc.cbClsExtra = 0; /* no extra class data */ wc.cbWndExtra = 0; /* no extra window data */ wc.hInstance = hInstance; /* instance */ @@ -791,7 +920,7 @@ static int WinDXCreateWindow( vout_thread_t *p_vout ) /* register the window class */ if (!RegisterClass(&wc)) { - intf_WarnMsg( 3, "vout: WinDX register window FAILED" ); + intf_WarnMsg( 3, "vout: DirectXCreateWindow register window FAILED" ); return (1); } @@ -820,7 +949,7 @@ static int WinDXCreateWindow( vout_thread_t *p_vout ) NULL); /* no additional arguments */ if (p_vout->p_sys->hwnd == NULL) { - intf_WarnMsg( 3, "vout: WinDX create window FAILED" ); + intf_WarnMsg( 3, "vout: DirectXCreateWindow create window FAILED" ); return (1); } @@ -831,72 +960,107 @@ static int WinDXCreateWindow( vout_thread_t *p_vout ) } /***************************************************************************** - * WinDXInitDDraw: Takes care of all the DirectDraw initialisations + * DirectXInitDDraw: Takes care of all the DirectDraw initialisations ***************************************************************************** * This function initialise and allocate resources for DirectDraw. *****************************************************************************/ -static int WinDXInitDDraw( vout_thread_t *p_vout ) +static int DirectXInitDDraw( vout_thread_t *p_vout ) { - HRESULT dxresult; - DWORD flags; + HRESULT dxresult; + HRESULT (WINAPI *OurDirectDrawCreate)(GUID *,LPDIRECTDRAW *,IUnknown *); + LPDIRECTDRAW p_ddobject; - intf_WarnMsg( 3, "vout: WinDX WinDXInitDDraw" ); + intf_WarnMsg( 3, "vout: DirectXInitDDraw" ); - /* Initialize DirectDraw */ - dxresult = DirectDrawCreate( NULL, &p_vout->p_sys->p_ddobject, NULL ); - if( dxresult != DD_OK ) + /* load direct draw DLL */ + p_vout->p_sys->hddraw_dll = LoadLibrary("DDRAW.DLL"); + if( p_vout->p_sys->hddraw_dll == NULL ) { - intf_ErrMsg( "vout error: can't initialize Direct Draw" ); + intf_WarnMsg( 3, "vout: DirectXInitDDraw failed loading ddraw.dll" ); return( 1 ); } - - /* Set DirectDraw Cooperative level, ie what control we want over Windows - display */ - if( p_vout->b_fullscreen ) + + OurDirectDrawCreate = + (void *)GetProcAddress(p_vout->p_sys->hddraw_dll, "DirectDrawCreate"); + if ( OurDirectDrawCreate == NULL ) { - flags = DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN; + intf_ErrMsg( "vout error: DirectXInitDDraw failed GetProcAddress" ); + FreeLibrary( p_vout->p_sys->hddraw_dll ); + p_vout->p_sys->hddraw_dll = NULL; + return( 1 ); } - else + + /* Initialize DirectDraw now */ + dxresult = OurDirectDrawCreate( NULL, &p_ddobject, NULL ); + if( dxresult != DD_OK ) { - flags = DDSCL_NORMAL; + intf_ErrMsg( "vout error: DirectXInitDDraw can't initialize DDraw" ); + p_vout->p_sys->p_ddobject = NULL; + FreeLibrary( p_vout->p_sys->hddraw_dll ); + p_vout->p_sys->hddraw_dll = NULL; + return( 1 ); } - dxresult = IDirectDraw_SetCooperativeLevel( p_vout->p_sys->p_ddobject, - p_vout->p_sys->hwnd, flags ); + /* Set DirectDraw Cooperative level, ie what control we want over Windows + * display */ + dxresult = IDirectDraw_SetCooperativeLevel( p_ddobject, + p_vout->p_sys->hwnd, DDSCL_NORMAL ); if( dxresult != DD_OK ) { intf_ErrMsg( "vout error: can't set direct draw cooperative level." ); - IDirectDraw_Release(p_vout->p_sys->p_ddobject); + IDirectDraw_Release( p_ddobject ); p_vout->p_sys->p_ddobject = NULL; + FreeLibrary( p_vout->p_sys->hddraw_dll ); + p_vout->p_sys->hddraw_dll = NULL; return( 1 ); } + /* Get the IDirectDraw2 interface */ + dxresult = IDirectDraw_QueryInterface( p_ddobject, &IID_IDirectDraw2, + (LPVOID *)&p_vout->p_sys->p_ddobject ); + if( dxresult != DD_OK ) + { + intf_ErrMsg( "vout error: can't get IDirectDraw2 interface." ); + IDirectDraw_Release( p_ddobject ); + p_vout->p_sys->p_ddobject = NULL; + FreeLibrary( p_vout->p_sys->hddraw_dll ); + p_vout->p_sys->hddraw_dll = NULL; + return( 1 ); + } + else + { + /* Release the unused interface */ + IDirectDraw_Release( p_ddobject ); + } + return( 0 ); } /***************************************************************************** - * WinDXCreateDisplay: create the DirectDraw display. + * DirectXCreateDisplay: create the DirectDraw display. ***************************************************************************** * Create and initialize display according to preferences specified in the vout * thread fields. *****************************************************************************/ -static int WinDXCreateDisplay( vout_thread_t *p_vout ) +static int DirectXCreateDisplay( vout_thread_t *p_vout ) { - DDCAPS ddcaps; - HRESULT dxresult; - DDSURFACEDESC ddsd; - BOOL bHasOverlay, bHasColorKey, bCanStretch; + HRESULT dxresult; + DDSURFACEDESC ddsd; + LPDIRECTDRAWSURFACE p_display; + DDPIXELFORMAT ddpfPixelFormat; + + intf_WarnMsg( 3, "vout: DirectXCreateDisplay" ); - /* Now create the primary surface. This surface is the displayed surface */ - /* The following two steps are important! */ + /* Now create the primary surface. This surface is what you actually see + * on your screen */ memset( &ddsd, 0, sizeof( DDSURFACEDESC )); ddsd.dwSize = sizeof(DDSURFACEDESC); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - dxresult = IDirectDraw_CreateSurface( p_vout->p_sys->p_ddobject, - &ddsd, - &p_vout->p_sys->p_display, NULL ); + dxresult = IDirectDraw2_CreateSurface( p_vout->p_sys->p_ddobject, + &ddsd, + &p_display, NULL ); if( dxresult != DD_OK ) { intf_ErrMsg( "vout error: can't create direct draw primary surface." ); @@ -904,57 +1068,97 @@ static int WinDXCreateDisplay( vout_thread_t *p_vout ) return( 1 ); } -#if 0 - /* Now create a clipper for our window. - * This clipper prevents us to modify by mistake anything on the screen - * (primary surface) which doesn't belong to our window */ - dxresult = IDirectDraw_CreateClipper(p_vout->p_sys->p_ddobject, 0, - &p_vout->p_sys->p_clipper, NULL); - if( dxresult != DD_OK ) + dxresult = IDirectDrawSurface_QueryInterface( p_display, + &IID_IDirectDrawSurface3, + (LPVOID *)&p_vout->p_sys->p_display ); + if ( dxresult != DD_OK ) { - intf_ErrMsg( "vout error: can't create clipper." ); - IDirectDrawSurface_Release( p_vout->p_sys->p_display ); + intf_ErrMsg( "vout error: can't get IDirectDrawSurface3 interface." ); + IDirectDrawSurface_Release( p_display ); p_vout->p_sys->p_display = NULL; return( 1 ); } - - dxresult = IDirectDrawClipper_SetHWnd(p_vout->p_sys->p_clipper, 0, - p_vout->p_sys->hwnd); - if( dxresult != DD_OK ) + else { - intf_ErrMsg( "vout error: can't attach clipper to window." ); - IDirectDrawSurface_Release( p_vout->p_sys->p_display ); - p_vout->p_sys->p_display = NULL; - return( 1 ); + /* Release the old interface */ + IDirectDrawSurface_Release( p_display ); } - dxresult = IDirectDrawSurface_SetClipper(p_vout->p_sys->p_display, - p_vout->p_sys->p_clipper); - if( dxresult != DD_OK ) + + /* We need to fill in some information for the video output thread. + * We do this here because it must be done before the video_output + * thread enters its main loop - and DirectXCreateSurface can be called + * after that ! */ + ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); + IDirectDrawSurface3_GetPixelFormat( p_vout->p_sys->p_display, + &ddpfPixelFormat ); +#ifdef NONAMELESSUNION + p_vout->i_screen_depth = ddpfPixelFormat.u1.dwRGBBitCount; + p_vout->i_bytes_per_pixel = ddpfPixelFormat.u1.dwRGBBitCount/8; + + p_vout->i_red_mask = ddpfPixelFormat.u2.dwRBitMask; + p_vout->i_green_mask = ddpfPixelFormat.u3.dwGBitMask; + p_vout->i_blue_mask = ddpfPixelFormat.u4.dwBBitMask; +#else + p_vout->i_screen_depth = ddpfPixelFormat.dwRGBBitCount; + p_vout->i_bytes_per_pixel = ddpfPixelFormat.dwRGBBitCount/8; + + p_vout->i_red_mask = ddpfPixelFormat.dwRBitMask; + p_vout->i_green_mask = ddpfPixelFormat.dwGBitMask; + p_vout->i_blue_mask = ddpfPixelFormat.dwBBitMask; +#endif /* NONAMELESSUNION */ + + /* Create a video surface. This function will try to create an + * YUV overlay first and if it can't it will create a simple RGB surface */ + if( DirectXCreateSurface( p_vout ) ) { - intf_ErrMsg( "vout error: can't attach clipper to surface." ); - IDirectDrawSurface_Release( p_vout->p_sys->p_display ); + intf_ErrMsg( "vout error: can't create a video surface." ); + IDirectDrawSurface3_Release( p_vout->p_sys->p_display ); p_vout->p_sys->p_display = NULL; return( 1 ); } -#endif + + return( 0 ); +} +/***************************************************************************** + * DirectXCreateSurface: create an YUV overlay or RGB surface for the video. + ***************************************************************************** + * The best method of display is with an YUV overlay because the YUV->RGB + * conversion is done in hardware, so we'll try to create this surface first. + * If we fail, we'll try to create a plain RGB surface. + * ( Maybe we could also try an RGB overlay surface, which could have hardware + * scaling and which would also be faster in window mode because you don't + * need to do any blitting to the main display...) + *****************************************************************************/ +static int DirectXCreateSurface( vout_thread_t *p_vout ) +{ + HRESULT dxresult; + DDSURFACEDESC ddsd; + LPDIRECTDRAWSURFACE p_surface; + DDCAPS ddcaps; + + intf_WarnMsg( 3, "vout: DirectXCreateSurface" ); + + /* Disable display */ + p_vout->p_sys->b_display_enabled = 0; + +#if 1 /* Probe the capabilities of the hardware */ - /* This is just an indication of whever or not we'll support overlay, + /* This is just an indication of whether or not we'll support overlay, * but with this test we don't know if we support YUV overlay */ memset( &ddcaps, 0, sizeof( DDCAPS )); ddcaps.dwSize = sizeof(DDCAPS); - dxresult = IDirectDraw_GetCaps( p_vout->p_sys->p_ddobject, - &ddcaps, NULL ); + dxresult = IDirectDraw2_GetCaps( p_vout->p_sys->p_ddobject, + &ddcaps, NULL ); if(dxresult != DD_OK ) { - intf_ErrMsg( "vout error: can't get caps." ); - bHasOverlay = FALSE; - bHasColorKey = FALSE; - bCanStretch = FALSE; + intf_WarnMsg( 3,"vout error: can't get caps." ); } else { + BOOL bHasOverlay, bHasColorKey, bCanStretch; + /* Determine if the hardware supports overlay surfaces */ bHasOverlay = ((ddcaps.dwCaps & DDCAPS_OVERLAY) == DDCAPS_OVERLAY) ? TRUE : FALSE; @@ -964,59 +1168,158 @@ static int WinDXCreateDisplay( vout_thread_t *p_vout ) /* Determine if the hardware supports scaling of the overlay surface */ bCanStretch = ((ddcaps.dwCaps & DDCAPS_OVERLAYSTRETCH) == DDCAPS_OVERLAYSTRETCH) ? TRUE : FALSE; - intf_WarnMsg( 3, "vout: WinDX Caps: overlay=%i colorkey=%i stretch=%i", + intf_WarnMsg( 3, "vout: Dx Caps: overlay=%i colorkey=%i stretch=%i", bHasOverlay, bHasColorKey, bCanStretch ); + + if( !bHasOverlay ) p_vout->b_need_render = 1; } +#endif + - p_vout->p_sys->p_overlay = NULL; - if( bHasOverlay && bHasColorKey && bCanStretch ) + /* Create the video surface */ + if( !p_vout->b_need_render ) { - if( !WinDXCreateYUVOverlay( p_vout ) ) + /* Now try to create the YUV overlay surface. + * This overlay will be displayed on top of the primary surface. + * A color key is used to determine whether or not the overlay will be + * displayed, ie the overlay will be displayed in place of the primary + * surface wherever the primary surface will have this color. + * The video window has been created with a background of this color so + * the overlay will be only displayed on top of this window */ + + memset( &ddsd, 0, sizeof( DDSURFACEDESC )); + ddsd.dwSize = sizeof(DDSURFACEDESC); + ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); + ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; + ddsd.ddpfPixelFormat.dwFourCC = mmioFOURCC('Y','V','1','2'); +#ifdef NONAMELESSUNION + ddsd.ddpfPixelFormat.u1.dwYUVBitCount = 16; +#else + ddsd.ddpfPixelFormat.dwYUVBitCount = 16; +#endif + ddsd.dwFlags = DDSD_CAPS | + DDSD_HEIGHT | + DDSD_WIDTH | + DDSD_PIXELFORMAT; + ddsd.ddsCaps.dwCaps = DDSCAPS_OVERLAY | DDSCAPS_VIDEOMEMORY; + ddsd.dwHeight = p_vout->p_sys->i_image_height; + ddsd.dwWidth = p_vout->p_sys->i_image_width; + + dxresult = IDirectDraw2_CreateSurface( p_vout->p_sys->p_ddobject, + &ddsd, &p_surface, NULL ); + if( dxresult == DD_OK ) + { + intf_WarnMsg( 3,"vout: DirectX YUV overlay created successfully" ); + } + else { - /* Overlay created successfully */ - p_vout->b_need_render = 0; + intf_ErrMsg( "vout error: can't create YUV overlay surface." ); + p_vout->b_need_render = 1; } } - - /* Now do some initialisation for video_output */ if( p_vout->b_need_render ) { - /* if we want a valid pointer to the surface memory, we must lock - * the surface */ + /* Now try to create a plain RGB surface. */ memset( &ddsd, 0, sizeof( DDSURFACEDESC )); ddsd.dwSize = sizeof(DDSURFACEDESC); - dxresult = IDirectDrawSurface_Lock(p_vout->p_sys->p_display, - NULL, &ddsd, - DDLOCK_NOSYSLOCK, NULL); - if ( dxresult == DDERR_SURFACELOST ) + ddsd.dwFlags = DDSD_HEIGHT | + DDSD_WIDTH | + DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddsd.dwHeight = p_vout->p_sys->i_image_height; + ddsd.dwWidth = p_vout->p_sys->i_image_width; + + dxresult = IDirectDraw2_CreateSurface( p_vout->p_sys->p_ddobject, + &ddsd, &p_surface, NULL ); + if( dxresult == DD_OK ) { - /* Your surface can be lost so be sure - * to check this and restore it if needed */ - dxresult = IDirectDrawSurface_Restore( p_vout->p_sys->p_display ); - dxresult = IDirectDrawSurface_Lock( p_vout->p_sys->p_display, - NULL, &ddsd, DDLOCK_NOSYSLOCK - | DDLOCK_WAIT, NULL); + intf_WarnMsg( 3,"vout: DirectX RGB surface created successfully" ); } - if( dxresult != DD_OK ) + else { - intf_WarnMsg( 3, "vout: WinDX could not lock the surface" ); + intf_ErrMsg( "vout error: can't create RGB surface." ); + p_vout->p_sys->p_surface = NULL; return( 1 ); } + } + + /* Now that the surface is created, try to get a newer DirectX interface */ + dxresult = IDirectDrawSurface_QueryInterface( p_surface, + &IID_IDirectDrawSurface3, + (LPVOID *)&p_vout->p_sys->p_surface ); + if ( dxresult != DD_OK ) + { + intf_ErrMsg( "vout error: can't get IDirectDrawSurface3 interface." ); + IDirectDrawSurface_Release( p_surface ); + p_vout->p_sys->p_surface = NULL; + return( 1 ); + } + else + { + /* Release the old interface */ + IDirectDrawSurface_Release( p_surface ); + } + + if( !p_vout->b_need_render ) + { + /* Hide the overlay for now */ + IDirectDrawSurface3_UpdateOverlay(p_vout->p_sys->p_surface, + NULL, + p_vout->p_sys->p_display, + NULL, + DDOVER_HIDE, + NULL); + } + else + { + DirectXCreateClipper( p_vout ); + } - /* Set the pointer to the surface memory */ - p_vout->p_sys->p_windx_buf[ 0 ] = ddsd.lpSurface; - /* back buffer, none for now */ - p_vout->p_sys->p_windx_buf[ 1 ] = ddsd.lpSurface; + /* From now on, do some initialisation for video_output */ - /* Set thread information */ - p_vout->i_width = ddsd.dwWidth; - p_vout->i_height = ddsd.dwHeight; + /* if we want a valid pointer to the surface memory, we must lock + * the surface */ + memset( &ddsd, 0, sizeof( DDSURFACEDESC )); + ddsd.dwSize = sizeof(DDSURFACEDESC); + dxresult = IDirectDrawSurface3_Lock( p_vout->p_sys->p_surface, NULL, &ddsd, + DDLOCK_NOSYSLOCK | DDLOCK_WAIT, NULL); + if ( dxresult == DDERR_SURFACELOST ) + { + /* Your surface can be lost so be sure + * to check this and restore it if needed */ + dxresult = IDirectDrawSurface3_Restore( p_vout->p_sys->p_surface ); + dxresult = IDirectDrawSurface3_Lock( p_vout->p_sys->p_surface, + NULL, &ddsd, DDLOCK_NOSYSLOCK + | DDLOCK_WAIT, NULL); + } + if( dxresult != DD_OK ) + { + intf_ErrMsg( "vout: DirectXCreateDisplay could not lock the surface" ); + return( 1 ); + } + + /* Set the pointer to the surface memory */ + p_vout->p_sys->p_directx_buf[ 0 ] = ddsd.lpSurface; + /* back buffer, none for now */ + p_vout->p_sys->p_directx_buf[ 1 ] = ddsd.lpSurface; + + /* Set thread information */ + p_vout->i_width = ddsd.dwWidth; + p_vout->i_height = ddsd.dwHeight; #ifdef NONAMELESSUNION - p_vout->i_bytes_per_line = ddsd.u1.lPitch; + p_vout->i_bytes_per_line = ddsd.u1.lPitch; +#else + p_vout->i_bytes_per_line = ddsd.lPitch; +#endif /* NONAMELESSUNION */ + + if( p_vout->b_need_render ) + { + /* For an RGB surface we need to fill in some more info */ +#ifdef NONAMELESSUNION p_vout->i_screen_depth = ddsd.ddpfPixelFormat.u1.dwRGBBitCount; p_vout->i_bytes_per_pixel = ddsd.ddpfPixelFormat.u1.dwRGBBitCount/8; @@ -1024,8 +1327,6 @@ static int WinDXCreateDisplay( vout_thread_t *p_vout ) p_vout->i_green_mask = ddsd.ddpfPixelFormat.u3.dwGBitMask; p_vout->i_blue_mask = ddsd.ddpfPixelFormat.u4.dwBBitMask; #else - p_vout->i_bytes_per_line = ddsd.lPitch; - p_vout->i_screen_depth = ddsd.ddpfPixelFormat.dwRGBBitCount; p_vout->i_bytes_per_pixel = ddsd.ddpfPixelFormat.dwRGBBitCount/8; @@ -1034,144 +1335,95 @@ static int WinDXCreateDisplay( vout_thread_t *p_vout ) p_vout->i_blue_mask = ddsd.ddpfPixelFormat.dwBBitMask; #endif /* NONAMELESSUNION */ - - /* Unlock the Surface */ - dxresult = IDirectDrawSurface_Unlock(p_vout->p_sys->p_display, - ddsd.lpSurface ); - /* FIXME: palette in 8bpp ?? */ - /* Set and initialize buffers */ - p_vout->pf_setbuffers( p_vout, p_vout->p_sys->p_windx_buf[ 0 ], - p_vout->p_sys->p_windx_buf[ 1 ] ); } - else - { - /* Lock the surface */ - memset( &ddsd, 0, sizeof( DDSURFACEDESC )); - ddsd.dwSize = sizeof(DDSURFACEDESC); - dxresult = IDirectDrawSurface_Lock(p_vout->p_sys->p_overlay, - NULL, &ddsd, DDLOCK_NOSYSLOCK, NULL); - if ( dxresult == DDERR_SURFACELOST ) - { - /* Your surface can be lost (thanks to windows) so be sure - * to check this every time you want to do something with - * it */ - dxresult = IDirectDrawSurface_Restore( - p_vout->p_sys->p_overlay ); - dxresult = IDirectDrawSurface_Lock( p_vout->p_sys->p_overlay - , NULL, &ddsd,DDLOCK_NOSYSLOCK| DDLOCK_WAIT, NULL); - } - if( dxresult != DD_OK ) - { - intf_WarnMsg( 3, "vout: WinDX could not lock the surface" ); - return( 1 ); - } - p_vout->p_sys->p_windx_buf[ 0 ] = ddsd.lpSurface; - p_vout->p_sys->p_windx_buf[ 1 ] = ddsd.lpSurface; + /* Unlock the Surface */ + dxresult = IDirectDrawSurface3_Unlock(p_vout->p_sys->p_surface, + ddsd.lpSurface ); - /* Set thread information */ - p_vout->i_width = ddsd.dwWidth; - p_vout->i_height = ddsd.dwHeight; -#ifdef NONAMELESSUNION - p_vout->i_bytes_per_line = ddsd.u1.lPitch; -#else - p_vout->i_bytes_per_line = ddsd.lPitch; -#endif /* NONAMELESSUNION */ + /* Set and initialize buffers */ + p_vout->pf_setbuffers( p_vout, p_vout->p_sys->p_directx_buf[ 0 ], + p_vout->p_sys->p_directx_buf[ 1 ] ); - /* Unlock the Surface */ - dxresult = IDirectDrawSurface_Unlock(p_vout->p_sys->p_overlay, - ddsd.lpSurface ); - p_vout->pf_setbuffers( p_vout, p_vout->p_sys->p_windx_buf[ 0 ], - p_vout->p_sys->p_windx_buf[ 1 ] ); - } - - return( 0 ); + return ( 0 ); } + /***************************************************************************** - * WinDXCreateYUVOveraly: create an YUV overlay surface for the video. + * DirectXCreateClipper: Create a clipper that will be used when blitting the + * RGB surface to the main display. ***************************************************************************** - * The best method of display is with an YUV overlay because the YUV->RGB - * conversion is done in hardware. - * This function will try to create an YUV overlay. + * This clipper prevents us to modify by mistake anything on the screen + * which doesn't belong to our window. For example when a part of our video + * window is hidden by another window. *****************************************************************************/ -static int WinDXCreateYUVOverlay( vout_thread_t *p_vout ) +static int DirectXCreateClipper( vout_thread_t *p_vout ) { HRESULT dxresult; - DDSURFACEDESC ddsd; - /* Now create the overlay surface. This overlay will be displayed on - * top of the primary surface. - * A color key is used to determine whether or not the overlay will be - * displayed, ie the overlay will be displayed in place of the primary - * surface wherever the primary surface will have this color. - * The video window has been created with a background of this color so - * the overlay will be only displayed on top of this window */ + intf_WarnMsg( 3, "vout: DirectXCreateClipper" ); - memset( &ddsd, 0, sizeof( DDSURFACEDESC )); - ddsd.dwSize = sizeof(DDSURFACEDESC); - ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; - ddsd.ddpfPixelFormat.dwFourCC = mmioFOURCC('Y','V','1','2'); -#ifdef NONAMELESSUNION - ddsd.ddpfPixelFormat.u1.dwYUVBitCount = 16; -#else - ddsd.ddpfPixelFormat.dwYUVBitCount = 16; -#endif - - ddsd.dwSize = sizeof(DDSURFACEDESC); - ddsd.dwFlags = DDSD_CAPS | - DDSD_HEIGHT | - DDSD_WIDTH | - DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_OVERLAY | DDSCAPS_VIDEOMEMORY; - ddsd.dwHeight = p_vout->p_sys->i_image_height; - ddsd.dwWidth = p_vout->p_sys->i_image_width; - - dxresult = IDirectDraw_CreateSurface( p_vout->p_sys->p_ddobject, - &ddsd, - &p_vout->p_sys->p_overlay, NULL ); + /* Create the clipper */ + dxresult = IDirectDraw2_CreateClipper( p_vout->p_sys->p_ddobject, 0, + &p_vout->p_sys->p_clipper, NULL ); if( dxresult != DD_OK ) { - intf_ErrMsg( "vout error: can't create overlay surface." ); - p_vout->p_sys->p_overlay = NULL; + intf_WarnMsg( 3, "vout: DirectXCreateClipper can't create clipper." ); + IDirectDrawSurface_Release( p_vout->p_sys->p_clipper ); + p_vout->p_sys->p_clipper = NULL; + return( 1 ); } - else + + /* associate the clipper to the window */ + dxresult = IDirectDrawClipper_SetHWnd(p_vout->p_sys->p_clipper, 0, + p_vout->p_sys->hwnd); + if( dxresult != DD_OK ) { - intf_WarnMsg( 3, "vout: WinDX YUV overlay created successfully" ); + intf_WarnMsg( 3, + "vout: DirectXCreateClipper can't attach clipper to window." ); + IDirectDrawSurface_Release( p_vout->p_sys->p_clipper ); + p_vout->p_sys->p_clipper = NULL; + return( 1 ); } - /* Hide the overlay for now */ - IDirectDrawSurface_UpdateOverlay(p_vout->p_sys->p_overlay, - NULL, - p_vout->p_sys->p_display, - NULL, - DDOVER_HIDE, - NULL); - - return ( 0 ); + + /* associate the clipper with the surface */ + dxresult = IDirectDrawSurface_SetClipper(p_vout->p_sys->p_display, + p_vout->p_sys->p_clipper); + if( dxresult != DD_OK ) + { + intf_WarnMsg( 3, + "vout: DirectXCreateClipper can't attach clipper to surface." ); + IDirectDrawSurface_Release( p_vout->p_sys->p_clipper ); + p_vout->p_sys->p_clipper = NULL; + return( 1 ); + } + + return( 0 ); } + /***************************************************************************** - * WinDXUpdateOverlay: Move or resize overlay surface on video display. + * DirectXUpdateOverlay: Move or resize overlay surface on video display. ***************************************************************************** * This function is used to move or resize an overlay surface on the screen. * Ususally the overlay is moved by the user and thus, by a move or resize * event (in vout_Manage). *****************************************************************************/ -static int WinDXUpdateOverlay( vout_thread_t *p_vout ) +static int DirectXUpdateOverlay( vout_thread_t *p_vout ) { DDOVERLAYFX ddofx; - RECT rect_window, rect_image; + RECT rect_window, rect_window_backup, rect_image; POINT point_window; DWORD dwFlags; HRESULT dxresult; DWORD dw_colorkey; DDPIXELFORMAT pixel_format; + DDSURFACEDESC ddsd; - if( p_vout->p_sys->p_overlay == NULL || p_vout->b_need_render) + if( p_vout->p_sys->p_surface == NULL || p_vout->b_need_render ) { - intf_WarnMsg( 3, "vout: WinDX no overlay !!" ); + intf_WarnMsg( 3, "vout: DirectXUpdateOverlay no overlay !!" ); return( 0 ); } @@ -1292,16 +1544,65 @@ static int WinDXUpdateOverlay( vout_thread_t *p_vout ) /* It seems we can't feed the UpdateOverlay directdraw function with * negative values so we have to clip the computed rectangles */ - /* FIXME */ - + memset( &ddsd, 0, sizeof( DDSURFACEDESC )); + ddsd.dwSize = sizeof(DDSURFACEDESC); + ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH; + IDirectDraw2_GetDisplayMode( p_vout->p_sys->p_ddobject, &ddsd ); + + rect_window_backup = rect_window; + + /* Clip the destination window */ + rect_window.left = (rect_window.left < 0) ? 0 : rect_window.left; + rect_window.right = (rect_window.right < 0) ? 0 : rect_window.right; + rect_window.top = (rect_window.top < 0) ? 0 : rect_window.top; + rect_window.bottom = (rect_window.bottom < 0) ? 0 : rect_window.bottom; + + rect_window.left = (rect_window.left > ddsd.dwWidth) ? ddsd.dwWidth + : rect_window.left; + rect_window.right = (rect_window.right > ddsd.dwWidth) ? ddsd.dwWidth + : rect_window.right; + rect_window.top = (rect_window.top > ddsd.dwHeight) ? ddsd.dwHeight + : rect_window.top; + rect_window.bottom = (rect_window.bottom > ddsd.dwHeight) ? ddsd.dwHeight + : rect_window.bottom; + + intf_WarnMsg( 3, "vout: DirectXUpdateOverlay window coords: %i,%i,%i,%i", + rect_window.left, rect_window.top, + rect_window.right, rect_window.bottom); + + /* Clip the source image */ + rect_image.left = ( rect_window.left == rect_window_backup.left ) ? 0 + : labs(rect_window_backup.left - rect_window.left) * + p_vout->p_rendered_pic->i_width / + (rect_window_backup.right - rect_window_backup.left); + rect_image.right = ( rect_window.right == rect_window_backup.right ) ? + p_vout->p_rendered_pic->i_width + : p_vout->p_rendered_pic->i_width - + labs(rect_window_backup.right - rect_window.right) * + p_vout->p_rendered_pic->i_width / + (rect_window_backup.right - rect_window_backup.left); + rect_image.top = ( rect_window.top == rect_window_backup.top ) ? 0 + : labs(rect_window_backup.top - rect_window.top) * + p_vout->p_rendered_pic->i_height / + (rect_window_backup.bottom - rect_window_backup.top); + rect_image.bottom = ( rect_window.bottom == rect_window_backup.bottom ) ? + p_vout->p_rendered_pic->i_height + : p_vout->p_rendered_pic->i_height - + labs(rect_window_backup.bottom - rect_window.bottom) * + p_vout->p_rendered_pic->i_height / + (rect_window_backup.bottom - rect_window_backup.top); + + intf_WarnMsg( 3, "vout: DirectXUpdateOverlay image coords: %i,%i,%i,%i", + rect_image.left, rect_image.top, + rect_image.right, rect_image.bottom); /* compute the colorkey pixel value from the RGB value we've got */ memset( &pixel_format, 0, sizeof( DDPIXELFORMAT )); pixel_format.dwSize = sizeof( DDPIXELFORMAT ); - dxresult = IDirectDrawSurface_GetPixelFormat( p_vout->p_sys->p_display, - &pixel_format ); + dxresult = IDirectDrawSurface3_GetPixelFormat( p_vout->p_sys->p_display, + &pixel_format ); if( dxresult != DD_OK ) - intf_WarnMsg( 3, "vout: WinDX GetPixelFormat failed !!" ); + intf_WarnMsg( 3, "vout: DirectXUpdateOverlay GetPixelFormat failed" ); dw_colorkey = (DWORD)p_vout->p_sys->i_colorkey; #ifdef NONAMELESSUNION dw_colorkey = (DWORD)((( dw_colorkey * pixel_format.u2.dwRBitMask) / 255) @@ -1319,34 +1620,35 @@ static int WinDXUpdateOverlay( vout_thread_t *p_vout ) dwFlags = DDOVER_KEYDESTOVERRIDE | DDOVER_SHOW; - dxresult = IDirectDrawSurface_UpdateOverlay(p_vout->p_sys->p_overlay, - NULL, /*&rect_image,*/ - p_vout->p_sys->p_display, - &rect_window, - dwFlags, - &ddofx); + dxresult = IDirectDrawSurface3_UpdateOverlay(p_vout->p_sys->p_surface, + &rect_image, + p_vout->p_sys->p_display, + &rect_window, + dwFlags, + &ddofx); if(dxresult != DD_OK) { - intf_WarnMsg( 3, "vout: WinDX can't move or resize overlay" ); + intf_WarnMsg( 3, + "vout: DirectXUpdateOverlay can't move or resize overlay" ); } return ( 0 ); } /***************************************************************************** - * WinDXCloseWindow: close the window created by WinDXCreateWindow + * DirectXCloseWindow: close the window created by DirectXCreateWindow ***************************************************************************** - * This function returns all resources allocated by WinDXCreateWindow. + * This function returns all resources allocated by DirectXCreateWindow. *****************************************************************************/ -static void WinDXCloseWindow( vout_thread_t *p_vout ) +static void DirectXCloseWindow( vout_thread_t *p_vout ) { HINSTANCE hInstance; - intf_WarnMsg( 3, "vout: WinDXCloseWindow" ); - if( p_vout->p_sys->hwnd != INVALID_HANDLE_VALUE ) + intf_WarnMsg( 3, "vout: DirectXCloseWindow" ); + if( p_vout->p_sys->hwnd != NULL ) { DestroyWindow( p_vout->p_sys->hwnd); - p_vout->p_sys->hwnd = INVALID_HANDLE_VALUE; + p_vout->p_sys->hwnd = NULL; } hInstance = GetModuleHandle(NULL); @@ -1354,74 +1656,77 @@ static void WinDXCloseWindow( vout_thread_t *p_vout ) hInstance ); /* handle to application instance */ /* free window background brush */ - if( p_vout->p_sys->hwnd != INVALID_HANDLE_VALUE ) + if( p_vout->p_sys->hwnd != NULL ) { DeleteObject( p_vout->p_sys->hbrush ); - p_vout->p_sys->hbrush = INVALID_HANDLE_VALUE; + p_vout->p_sys->hbrush = NULL; } } /***************************************************************************** - * WinDXCloseDDraw: Release the DDraw object allocated by WinDXInitDDraw + * DirectXCloseDDraw: Release the DDraw object allocated by DirectXInitDDraw ***************************************************************************** - * This function returns all resources allocated by WinDXInitDDraw. + * This function returns all resources allocated by DirectXInitDDraw. *****************************************************************************/ -static void WinDXCloseDDraw( vout_thread_t *p_vout ) +static void DirectXCloseDDraw( vout_thread_t *p_vout ) { - intf_WarnMsg(3, "vout: WinDXCloseDDraw" ); + intf_WarnMsg(3, "vout: DirectXCloseDDraw" ); if( p_vout->p_sys->p_ddobject != NULL ) { - IDirectDraw_Release(p_vout->p_sys->p_ddobject); + IDirectDraw2_Release(p_vout->p_sys->p_ddobject); p_vout->p_sys->p_ddobject = NULL; } + + if( p_vout->p_sys->hddraw_dll != NULL ) + { + FreeLibrary( p_vout->p_sys->hddraw_dll ); + p_vout->p_sys->hddraw_dll = NULL; + } } /***************************************************************************** - * WinDXCloseDisplay: close and reset DirectX device + * DirectXCloseDisplay: close and reset the DirectX display device ***************************************************************************** - * This function returns all resources allocated by WinDXCreateDisplay and - * restore the original state of the device. + * This function returns all resources allocated by DirectXCreateDisplay. *****************************************************************************/ -static void WinDXCloseDisplay( vout_thread_t *p_vout ) +static void DirectXCloseDisplay( vout_thread_t *p_vout ) { - intf_WarnMsg( 3, "vout: WinDXCloseDisplay" ); + intf_WarnMsg( 3, "vout: DirectXCloseDisplay" ); if( p_vout->p_sys->p_display != NULL ) { - if( p_vout->p_sys->p_overlay != NULL ) - { - intf_WarnMsg( 3, "vout: WinDXCloseDisplay overlay" ); - IDirectDraw_Release( p_vout->p_sys->p_overlay ); - p_vout->p_sys->p_overlay = NULL; - } + DirectXCloseSurface( p_vout ); - if( p_vout->p_sys->p_clipper != NULL ) - { - intf_WarnMsg( 3, "vout: WinDXCloseDisplay clipper" ); - IDirectDraw_Release( p_vout->p_sys->p_clipper ); - p_vout->p_sys->p_clipper = NULL; - } - - intf_WarnMsg( 3, "vout: WinDXCloseDisplay display" ); - IDirectDraw_Release( p_vout->p_sys->p_display ); + intf_WarnMsg( 3, "vout: DirectXCloseDisplay display" ); + IDirectDraw2_Release( p_vout->p_sys->p_display ); p_vout->p_sys->p_display = NULL; } } /***************************************************************************** - * WinDXCloseYUVOverlay: close the overlay surface + * DirectXCloseSurface: close the YUV overlay or RGB surface. ***************************************************************************** - * This function returns all resources allocated by the overlay surface. + * This function returns all resources allocated by the surface. * We also call this function when the decoded picture change its dimensions * (in that case we close the overlay surface and reopen another with the * right dimensions). *****************************************************************************/ -static void WinDXCloseYUVOverlay( vout_thread_t *p_vout ) +static void DirectXCloseSurface( vout_thread_t *p_vout ) { - intf_WarnMsg( 3, "vout: WinDXCloseYUVOverlay" ); - if( p_vout->p_sys->p_overlay != NULL ) + intf_WarnMsg( 3, "vout: DirectXCloseSurface" ); + if( p_vout->p_sys->p_surface != NULL ) + { + intf_WarnMsg( 3, "vout: DirectXCloseSurface surface" ); + IDirectDraw2_Release( p_vout->p_sys->p_surface ); + p_vout->p_sys->p_surface = NULL; + } + + if( p_vout->p_sys->p_clipper != NULL ) { - IDirectDraw_Release( p_vout->p_sys->p_overlay ); - p_vout->p_sys->p_overlay = NULL; + intf_WarnMsg( 3, "vout: DirectXCloseSurface clipper" ); + IDirectDraw2_Release( p_vout->p_sys->p_clipper ); + p_vout->p_sys->p_clipper = NULL; } + + /* Disable any display */ p_vout->p_sys->b_display_enabled = 0; } diff --git a/plugins/dummy/aout_dummy.c b/plugins/dummy/aout_dummy.c index ef779eed82..397ef0eb73 100644 --- a/plugins/dummy/aout_dummy.c +++ b/plugins/dummy/aout_dummy.c @@ -2,7 +2,7 @@ * aout_dummy.c : dummy audio output plugin ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: aout_dummy.c,v 1.12 2001/05/31 01:37:08 sam Exp $ + * $Id: aout_dummy.c,v 1.13 2001/06/14 01:49:44 sam Exp $ * * Authors: Samuel Hocevar * @@ -50,9 +50,9 @@ *****************************************************************************/ typedef struct aout_sys_s { -#if defined( _MSC_VER ) + /* Prevent malloc(0) */ int i_dummy; -#endif + } aout_sys_t; /***************************************************************************** diff --git a/plugins/dummy/intf_dummy.c b/plugins/dummy/intf_dummy.c index 0961f6d122..361e7d6fe3 100644 --- a/plugins/dummy/intf_dummy.c +++ b/plugins/dummy/intf_dummy.c @@ -2,7 +2,7 @@ * intf_dummy.c: dummy interface plugin ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: intf_dummy.c,v 1.9 2001/05/31 01:37:08 sam Exp $ + * $Id: intf_dummy.c,v 1.10 2001/06/14 01:49:44 sam Exp $ * * Authors: Samuel Hocevar * @@ -50,9 +50,9 @@ *****************************************************************************/ typedef struct intf_sys_s { -#if defined( _MSC_VER ) + /* Prevent malloc(0) */ int i_dummy; -#endif + } intf_sys_t; /***************************************************************************** diff --git a/plugins/dvd/Makefile b/plugins/dvd/Makefile index 0407932092..fb9e9fda8b 100644 --- a/plugins/dvd/Makefile +++ b/plugins/dvd/Makefile @@ -30,12 +30,21 @@ $(BUILTIN_DVD): BUILTIN_%.o: %.c # Real targets # +ifeq (1,$(LOCAL_LIBDVDCSS)) ../../lib/dvd.so: libdvdcss $(PLUGIN_DVD) - $(CC) $(PCFLAGS) -o $@ $(PLUGIN_DVD) $(PLCFLAGS) $(LIB_DVD) + $(CC) $(PCFLAGS) -o $@ $(PLUGIN_DVD) $(PLCFLAGS) ../../lib/libdvdcss.a $(LIB_DVD) ../../lib/dvd.a: libdvdcss $(BUILTIN_DVD) ar r $@ $(BUILTIN_DVD) $(RANLIB) $@ +else +../../lib/dvd.so: $(PLUGIN_DVD) + $(CC) $(PCFLAGS) -o $@ $(PLUGIN_DVD) $(PLCFLAGS) $(LIB_DVD) + +../../lib/dvd.a: $(BUILTIN_DVD) + ar r $@ $(BUILTIN_DVD) + $(RANLIB) $@ +endif libdvdcss: cd ../../ && $(MAKE) libdvdcss diff --git a/plugins/dvd/input_dvd.c b/plugins/dvd/input_dvd.c index 3512d8e247..a46b9eb6a0 100644 --- a/plugins/dvd/input_dvd.c +++ b/plugins/dvd/input_dvd.c @@ -10,7 +10,7 @@ * -dvd_udf to find files ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: input_dvd.c,v 1.72 2001/06/13 00:03:08 stef Exp $ + * $Id: input_dvd.c,v 1.73 2001/06/14 01:49:44 sam Exp $ * * Author: Stéphane Borel * @@ -215,7 +215,6 @@ static void DVDInit( input_thread_t * p_input ) input_area_t * p_area; int i_title; int i_chapter; - int i_ret; int i; p_dvd = malloc( sizeof(thread_dvd_data_t) ); @@ -229,29 +228,21 @@ static void DVDInit( input_thread_t * p_input ) p_input->p_plugin_data = (void *)p_dvd; p_input->p_method_data = NULL; - p_dvd->dvdhandle = dvdcss_init( DVDCSS_INIT_QUIET ); - - if( p_dvd->dvdhandle == NULL ) - { - free( p_dvd ); - p_input->b_error = 1; - return; - } - /* XXX: put this shit in an access plugin */ if( strlen( p_input->p_source ) > 4 && !strncasecmp( p_input->p_source, "dvd:", 4 ) ) { - i_ret = dvdcss_open( p_dvd->dvdhandle, p_input->p_source + 4 ); + p_dvd->dvdhandle = dvdcss_open( p_input->p_source + 4, + DVDCSS_INIT_QUIET ); } else { - i_ret = dvdcss_open( p_dvd->dvdhandle, p_input->p_source ); + p_dvd->dvdhandle = dvdcss_open( p_input->p_source, + DVDCSS_INIT_QUIET ); } - if( i_ret < 0 ) + if( p_dvd->dvdhandle == NULL ) { - dvdcss_end( p_dvd->dvdhandle ); free( p_dvd ); p_input->b_error = 1; return; @@ -276,7 +267,6 @@ static void DVDInit( input_thread_t * p_input ) { intf_ErrMsg( "dvd error: allcation error in ifo" ); dvdcss_close( p_dvd->dvdhandle ); - dvdcss_end( p_dvd->dvdhandle ); free( p_dvd ); p_input->b_error = 1; return; @@ -287,7 +277,6 @@ static void DVDInit( input_thread_t * p_input ) intf_ErrMsg( "dvd error: fatal failure in ifo" ); IfoDestroy( p_dvd->p_ifo ); dvdcss_close( p_dvd->dvdhandle ); - dvdcss_end( p_dvd->dvdhandle ); free( p_dvd ); p_input->b_error = 1; return; @@ -378,7 +367,6 @@ static void DVDEnd( input_thread_t * p_input ) /* Clean up libdvdcss */ dvdcss_close( p_dvd->dvdhandle ); - dvdcss_end( p_dvd->dvdhandle ); free( p_dvd ); @@ -441,10 +429,8 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) p_dvd->i_title_id = vts.title_inf.p_title_start[i_vts_title-1].i_title_id; - intf_WarnMsg( 3, "dvd: title %d vts_title %d pgc %d", - p_dvd->i_title, - i_vts_title, - p_dvd->i_title_id ); + intf_WarnMsgImm( 3, "dvd: title %d vts_title %d pgc %d", + p_dvd->i_title, i_vts_title, p_dvd->i_title_id ); /* * CSS cracking has to be done again @@ -473,7 +459,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) /* last video cell */ p_dvd->i_cell = 0; - intf_FlushMsg(); p_dvd->i_prg_cell = -1 + vts.title_unit.p_title[p_dvd->i_title_id-1].title.i_cell_nb; diff --git a/plugins/gtk/gtk_menu.c b/plugins/gtk/gtk_menu.c index cefa5e4486..50b7eade9f 100644 --- a/plugins/gtk/gtk_menu.c +++ b/plugins/gtk/gtk_menu.c @@ -2,7 +2,7 @@ * gtk_menu.c : functions to handle menu items. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: gtk_menu.c,v 1.9 2001/06/02 01:09:03 sam Exp $ + * $Id: gtk_menu.c,v 1.10 2001/06/14 01:49:44 sam Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -92,7 +92,7 @@ gint GtkSetupMenus( intf_thread_t * p_intf ); * user_data to transmit intf_* and we need to refresh the other menu. ****************************************************************************/ -#define GtkLangToggle( intf, window, menu, type, callback, b_update ) \ +#define GTKLANGTOGGLE( intf, window, menu, type, callback, b_update ) \ intf_thread_t * p_intf; \ GtkWidget * p_menu; \ es_descriptor_t * p_es; \ @@ -123,13 +123,13 @@ gint GtkSetupMenus( intf_thread_t * p_intf ); void GtkMenubarAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) { - GtkLangToggle( "intf_window", p_popup, "popup_audio", AUDIO_ES, + GTKLANGTOGGLE( "intf_window", p_popup, "popup_audio", AUDIO_ES, GtkPopupAudioToggle, b_audio_update ); } void GtkPopupAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) { - GtkLangToggle( "intf_popup", p_window, "menubar_audio", AUDIO_ES, + GTKLANGTOGGLE( "intf_popup", p_window, "menubar_audio", AUDIO_ES, GtkMenubarAudioToggle, b_audio_update ); } @@ -139,17 +139,17 @@ void GtkPopupAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) void GtkMenubarSubtitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) { - GtkLangToggle( "intf_window", p_popup, "popup_subpictures", SPU_ES, + GTKLANGTOGGLE( "intf_window", p_popup, "popup_subpictures", SPU_ES, GtkPopupSubtitleToggle, b_spu_update ); } void GtkPopupSubtitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) { - GtkLangToggle( "intf_popup", p_window, "menubar_subpictures", SPU_ES, + GTKLANGTOGGLE( "intf_popup", p_window, "menubar_subpictures", SPU_ES, GtkMenubarSubtitleToggle, b_spu_update ); } -#undef GtkLangToggle +#undef GTKLANGTOGGLE /* * Navigation @@ -259,7 +259,7 @@ void GtkMenubarChapterToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) * Angle */ -#define GtkAngleToggle( intf, window, menu, callback ) \ +#define GTKANGLETOGGLE( intf, window, menu, callback ) \ intf_thread_t * p_intf; \ GtkWidget * p_menu; \ input_area_t * p_area; \ @@ -285,17 +285,17 @@ void GtkMenubarChapterToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) void GtkMenubarAngleToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) { - GtkAngleToggle( "intf_window", p_popup, "popup_angle", + GTKANGLETOGGLE( "intf_window", p_popup, "popup_angle", GtkPopupAngleToggle ); } void GtkPopupAngleToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) { - GtkAngleToggle( "intf_popup", p_window, "menubar_angle", + GTKANGLETOGGLE( "intf_popup", p_window, "menubar_angle", GtkMenubarAngleToggle ); } -#undef GtkAngleToggle +#undef GTKANGLETOGGLE /**************************************************************************** * Functions to generate menus diff --git a/plugins/gtk/gtk_menu.h b/plugins/gtk/gtk_menu.h index 3cc2d1829b..6e3ef82b26 100644 --- a/plugins/gtk/gtk_menu.h +++ b/plugins/gtk/gtk_menu.h @@ -2,7 +2,7 @@ * gtk_menu.h: prototypes for menu functions ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: gtk_menu.h,v 1.3 2001/05/19 00:39:30 stef Exp $ + * $Id: gtk_menu.h,v 1.4 2001/06/14 01:49:44 sam Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -26,3 +26,15 @@ struct intf_thread_s; gint GtkSetupMenus( struct intf_thread_s * ); +/***************************************************************************** + * String sizes + *****************************************************************************/ +#define GTK_MENU_LABEL_SIZE 64 + +/***************************************************************************** + * Convert user_data structures to title and chapter information + *****************************************************************************/ +#define DATA2TITLE( user_data ) ( (gint)(user_data) >> 16 ) +#define DATA2CHAPTER( user_data ) ( (gint)(user_data) & 0xffff ) +#define POS2DATA( title, chapter ) ( ((title) << 16) | ((chapter) & 0xffff) ) + diff --git a/plugins/gtk/intf_gtk.h b/plugins/gtk/intf_gtk.h index 5427c123ac..b4c8b98477 100644 --- a/plugins/gtk/intf_gtk.h +++ b/plugins/gtk/intf_gtk.h @@ -2,7 +2,7 @@ * intf_gtk.h: private Gtk+ interface description ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: intf_gtk.h,v 1.6 2001/05/23 23:08:20 stef Exp $ + * $Id: intf_gtk.h,v 1.7 2001/06/14 01:49:44 sam Exp $ * * Authors: Samuel Hocevar * @@ -27,18 +27,6 @@ #define DROP_ACCEPT_TEXT_URI_LIST 0 #define DROP_ACCEPT_TEXT_PLAIN 1 -/***************************************************************************** - * String sizes - *****************************************************************************/ -#define GTK_MENU_LABEL_SIZE 64 - -/***************************************************************************** - * Convert user_data structures to title and chapter information - *****************************************************************************/ -#define DATA2TITLE( user_data ) ( (gint)(user_data) >> 16 ) -#define DATA2CHAPTER( user_data ) ( (gint)(user_data) & 0xffff ) -#define POS2DATA( title, chapter ) ( ((title) << 16) | ((chapter) & 0xffff) ) - /***************************************************************************** * Useful inline function ****************************************************************************/ diff --git a/src/input/input.c b/src/input/input.c index bac0a0506e..cca1ae7344 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -4,7 +4,7 @@ * decoders. ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: input.c,v 1.120 2001/06/12 18:16:49 stef Exp $ + * $Id: input.c,v 1.121 2001/06/14 01:49:44 sam Exp $ * * Authors: Christophe Massiot * @@ -145,7 +145,8 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status ) p_input->stream.pp_areas = NULL; p_input->stream.p_selected_area = NULL; p_input->stream.p_new_area = NULL; - /* By default there is one areas in a stream */ + + /* By default there is one area in a stream */ input_AddArea( p_input ); p_input->stream.p_selected_area = p_input->stream.pp_areas[0]; @@ -163,10 +164,7 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status ) p_input->pf_network_close = NetworkClose; #endif - /* Create thread and set locks. */ - vlc_mutex_init( &p_input->stream.stream_lock ); - vlc_cond_init( &p_input->stream.stream_wait ); - vlc_mutex_init( &p_input->stream.control.control_lock ); + /* Create thread. */ if( vlc_thread_create( &p_input->thread_id, "input", (void *) RunThread, (void *) p_input ) ) { @@ -242,6 +240,7 @@ static void RunThread( input_thread_t *p_input ) p_input->b_error = 1; ErrorThread( p_input ); DestroyThread( p_input ); + free( p_input ); return; } @@ -378,6 +377,11 @@ static int InitThread( input_thread_t * p_input ) p_input->c_packets_trashed = 0; #endif + /* Set locks. */ + vlc_mutex_init( &p_input->stream.stream_lock ); + vlc_cond_init( &p_input->stream.stream_wait ); + vlc_mutex_init( &p_input->stream.control.control_lock ); + /* Default, might get overwritten */ p_input->pf_open = p_input->pf_file_open; p_input->pf_close = p_input->pf_file_close; diff --git a/src/interface/main.c b/src/interface/main.c index c5d701db50..f7c825840c 100644 --- a/src/interface/main.c +++ b/src/interface/main.c @@ -4,7 +4,7 @@ * and spawn threads. ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: main.c,v 1.102 2001/06/12 22:14:44 sam Exp $ + * $Id: main.c,v 1.103 2001/06/14 01:49:44 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -251,6 +251,13 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) p_aout_bank = &aout_bank; p_vout_bank = &vout_bank; + /* + * Initialize threads + */ +#if defined( PTH_INIT_IN_PTH_H ) + pth_init( ); +#endif + /* * Test if our code is likely to run on this CPU */ @@ -385,12 +392,17 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) system_End(); #endif + /* * Terminate messages interface and program */ intf_Msg( "intf: program terminated" ); intf_MsgDestroy(); +#if defined( PTH_INIT_IN_PTH_H ) + pth_kill( ); +#endif + return 0; } @@ -926,7 +938,9 @@ static void InstructionSignalHandler( int i_signal ) i_illegal = 1; +#ifdef HAVE_SIGRELSE sigrelse( i_signal ); +#endif longjmp( env, 1 ); } @@ -980,7 +994,7 @@ static int CPUCapabilities( void ) volatile unsigned int i_eax, i_ebx, i_ecx, i_edx; volatile boolean_t b_amd; - signal( SIGILL, InstructionSignalHandler ); + signal( SIGILL, InstructionSignalHandler ); /* test for a 486 CPU */ asm volatile ( "pushfl\n\t" diff --git a/src/misc/modules.c b/src/misc/modules.c index befb69a9eb..4af7d2dbfa 100644 --- a/src/misc/modules.c +++ b/src/misc/modules.c @@ -2,7 +2,7 @@ * modules.c : Built-in and plugin modules management functions ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: modules.c,v 1.34 2001/06/03 12:47:22 sam Exp $ + * $Id: modules.c,v 1.35 2001/06/14 01:49:44 sam Exp $ * * Authors: Samuel Hocevar * Ethan C. Baldridge @@ -515,10 +515,27 @@ static int AllocatePluginModule( char * psz_filename ) || p_module->psz_version == NULL ) { intf_ErrMsg( "module error: can't duplicate strings" ); - free( p_module->is.plugin.psz_filename ); - free( p_module->psz_name ); - free( p_module->psz_longname ); - free( p_module->psz_version ); + + if( p_module->is.plugin.psz_filename != NULL ) + { + free( p_module->is.plugin.psz_filename ); + } + + if( p_module->psz_name != NULL ) + { + free( p_module->psz_name ); + } + + if( p_module->psz_longname != NULL ) + { + free( p_module->psz_longname ); + } + + if( p_module->psz_version != NULL ) + { + free( p_module->psz_version ); + } + free( p_module ); module_unload( handle ); return( -1 ); @@ -619,9 +636,22 @@ static int AllocateBuiltinModule( int ( *pf_init ) ( module_t * ), || p_module->psz_version == NULL ) { intf_ErrMsg( "module error: can't duplicate strings" ); - free( p_module->psz_name ); - free( p_module->psz_longname ); - free( p_module->psz_version ); + + if( p_module->psz_name != NULL ) + { + free( p_module->psz_name ); + } + + if( p_module->psz_longname != NULL ) + { + free( p_module->psz_longname ); + } + + if( p_module->psz_version != NULL ) + { + free( p_module->psz_version ); + } + free( p_module ); return( -1 ); } diff --git a/src/misc/modules_core.h b/src/misc/modules_core.h index 7f154283b5..19148a2a94 100644 --- a/src/misc/modules_core.h +++ b/src/misc/modules_core.h @@ -2,7 +2,7 @@ * modules_core.h : Module management functions used by the core application. ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: modules_core.h,v 1.1 2001/06/02 01:09:03 sam Exp $ + * $Id: modules_core.h,v 1.2 2001/06/14 01:49:44 sam Exp $ * * Authors: Samuel Hocevar * @@ -116,6 +116,7 @@ module_getsymbol( module_handle_t handle, char * psz_function ) #else return( dlsym( handle, psz_function ) ); + #endif } diff --git a/src/misc/mtime.c b/src/misc/mtime.c index 2afe4289fd..27b45a79a9 100644 --- a/src/misc/mtime.c +++ b/src/misc/mtime.c @@ -3,7 +3,7 @@ * Functions are prototyped in mtime.h. ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: mtime.c,v 1.21 2001/05/31 12:45:39 sam Exp $ + * $Id: mtime.c,v 1.22 2001/06/14 01:49:44 sam Exp $ * * Authors: Vincent Seguin * @@ -34,6 +34,10 @@ #include /* sprintf() */ +#if defined( PTH_INIT_IN_PTH_H ) /* GNU Pth */ +# include +#endif + #ifdef HAVE_UNISTD_H # include /* select() */ #endif @@ -198,14 +202,18 @@ void mwait( mtime_t date ) return; } -# ifdef HAVE_USLEEP +# if defined( PTH_INIT_IN_PTH_H ) + pth_usleep( delay ); + +# elif defined( HAVE_USLEEP ) usleep( delay ); + # else tv_delay.tv_sec = delay / 1000000; tv_delay.tv_usec = delay % 1000000; - /* see msleep() about select() errors */ select( 0, NULL, NULL, NULL, &tv_delay ); + # endif #endif @@ -224,6 +232,12 @@ void msleep( mtime_t delay ) #elif defined( HAVE_USLEEP ) || defined( WIN32 ) usleep( delay ); +#elif defined( PTH_INIT_IN_PTH_H ) + struct timeval tv_delay; + tv_delay.tv_sec = delay / 1000000; + tv_delay.tv_usec = delay % 1000000; + pth_select( 0, NULL, NULL, NULL, &tv_delay ); + #else struct timeval tv_delay; diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index 406fa4ec9d..2778fbf559 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -5,7 +5,7 @@ * thread, and destroy a previously oppened video output thread. ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: video_output.c,v 1.131 2001/05/31 03:57:54 sam Exp $ + * $Id: video_output.c,v 1.132 2001/06/14 01:49:44 sam Exp $ * * Authors: Vincent Seguin * @@ -979,6 +979,7 @@ static void RunThread( vout_thread_t *p_vout) 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; -- 2.39.5