From: Sam Hocevar Date: Sat, 2 Jun 2001 01:09:03 +0000 (+0000) Subject: * DirectX plugin by Gildas Bazin . X-Git-Tag: 0.2.81~87 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=945f294626b776bbabadc5627c05456a6ff0ae2b;p=vlc * DirectX plugin by Gildas Bazin . Notes: o I called it 'directx' instead of 'windx' because it made a lot more sense to me. o Completely untested. I didn't manage to compile it yet. o Code in vout_directx.c will go through a big rewrite when vout 4 is finished. Xav is already working on this. --- diff --git a/INSTALL b/INSTALL index 5dfc01ec1a..f39704fcac 100644 --- a/INSTALL +++ b/INSTALL @@ -23,6 +23,13 @@ If you intend to debug stuff, you may want to disable optimizations: --enable-mga --enable-gtk --enable-qt --enable-xvideo --enable-alsa \ --enable-debug +It is also possible to cross-compile for the Win32 platform using mingw32: + + make distclean && CC=i586-mingw32msvc-gcc CFLAGS=-I/usr/i586-mingw32msvc \ + RANLIB=i586-mingw32msvc-ranlib ./configure --host=i386-mingw32msvc \ + --target=i386-mingw32msvc --build=i386-linux --disable-dsp \ + --disable-gtk --disable-x11 --disable-xvideo + Building VideoLAN ================= diff --git a/Makefile b/Makefile index 85a3ea3ce0..7d67f142a5 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ # # All possible plugin directories, needed for make clean # -PLUGINS_DIR := alsa beos darwin dsp dummy \ +PLUGINS_DIR := alsa beos darwin directx dsp dummy \ dvd esd fb ggi glide gtk \ downmix idct imdct \ macosx mga \ @@ -22,8 +22,9 @@ PLUGINS_DIR := alsa beos darwin dsp dummy \ # # All possible plugin objects # -PLUGINS_TARGETS := alsa/alsa beos/beos darwin/darwin dsp/dsp dummy/dummy \ - dvd/dvd esd/esd fb/fb ggi/ggi glide/glide gtk/gnome gtk/gtk \ +PLUGINS_TARGETS := alsa/alsa beos/beos darwin/darwin directx/directx \ + dsp/dsp dummy/dummy 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 \ @@ -133,7 +134,7 @@ endif # # Generated header # -H_OBJ = include/modules_builtin.h +H_OBJ = src/misc/modules_builtin.h # # Other lists of files @@ -176,6 +177,7 @@ distclean: clean rm -f **/*.o **/*~ *.log rm -f Makefile.opts rm -f include/defs.h include/config.h include/modules_builtin.h + rm -f src/misc/modules_builtin.h rm -f config*status config*cache config*log rm -f gmon.out core build-stamp rm -Rf .dep diff --git a/Makefile.opts.in b/Makefile.opts.in index cbd594dfb1..13fcf0d960 100644 --- a/Makefile.opts.in +++ b/Makefile.opts.in @@ -73,6 +73,7 @@ LIB_NCURSES = @LIB_NCURSES@ LIB_QT = @LIB_QT@ LIB_TS = @LIB_TS@ LIB_SDL = @LIB_SDL@ +LIB_DIRECTX = @LIB_DIRECTX@ LIB_X11 = @LIB_X11@ LIB_XVIDEO = @LIB_XVIDEO@ LIB_YUV = @LIB_YUV@ diff --git a/configure b/configure index a86f02ccfd..4f6f492d7a 100755 --- a/configure +++ b/configure @@ -47,6 +47,8 @@ ac_help="$ac_help --with-ggi[=name] GGI support (default disabled)" ac_help="$ac_help --with-sdl[=name] SDL support (default enabled)" +ac_help="$ac_help + --with-directx[=name] Windows DirectX support (default enabled)" ac_help="$ac_help --with-glide[=name] Glide (3dfx) support (default disabled)" ac_help="$ac_help @@ -603,7 +605,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:607: checking host system type" >&5 +echo "configure:609: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -632,7 +634,7 @@ VLC_CODENAME=Ourumov save_CFLAGS="${CFLAGS}" echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:636: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:638: 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 @@ -661,7 +663,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:665: checking for $ac_word" >&5 +echo "configure:667: 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 @@ -691,7 +693,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:695: checking for $ac_word" >&5 +echo "configure:697: 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 @@ -742,7 +744,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:746: checking for $ac_word" >&5 +echo "configure:748: 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 @@ -774,7 +776,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:778: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:780: 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. @@ -785,12 +787,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 789 "configure" +#line 791 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:796: \"$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 @@ -816,12 +818,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:820: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:822: 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:825: checking whether we are using GNU C" >&5 +echo "configure:827: 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 @@ -830,7 +832,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:834: \"$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:836: \"$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 @@ -849,7 +851,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:853: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:855: 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 @@ -881,7 +883,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:885: checking how to run the C preprocessor" >&5 +echo "configure:887: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -896,13 +898,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:906: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:908: \"$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 : @@ -913,13 +915,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:923: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:925: \"$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 : @@ -930,13 +932,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:940: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:942: \"$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 : @@ -963,7 +965,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:967: checking for $ac_word" >&5 +echo "configure:969: 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 @@ -1003,7 +1005,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:1007: checking for a BSD compatible install" >&5 +echo "configure:1009: 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 @@ -1057,12 +1059,12 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1061: checking for working const" >&5 +echo "configure:1063: 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:1117: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1134,14 +1136,14 @@ fi if test x${cross_compiling} != xyes; then echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:1138: checking whether byte ordering is bigendian" >&5 +echo "configure:1140: 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 @@ -1152,11 +1154,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1158: \"$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 @@ -1167,7 +1169,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1171: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -1187,7 +1189,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:1206: \"$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 @@ -1228,12 +1230,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:1232: checking for $ac_func" >&5 +echo "configure:1234: 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:1262: \"$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 @@ -1283,12 +1285,12 @@ done for ac_func in setenv putenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1287: checking for $ac_func" >&5 +echo "configure:1289: 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:1317: \"$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 @@ -1336,12 +1338,12 @@ fi done echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:1340: checking for connect" >&5 +echo "configure:1342: 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:1370: \"$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 @@ -1383,7 +1385,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:1387: checking for connect in -lsocket" >&5 +echo "configure:1389: 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 @@ -1391,7 +1393,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:1408: \"$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 @@ -1426,12 +1428,12 @@ fi fi echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:1430: checking for gethostbyname" >&5 +echo "configure:1432: 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:1460: \"$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 @@ -1473,7 +1475,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1477: checking for gethostbyname in -lnsl" >&5 +echo "configure:1479: 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 @@ -1481,7 +1483,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:1498: \"$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 @@ -1516,12 +1518,12 @@ fi fi echo $ac_n "checking for nanosleep""... $ac_c" 1>&6 -echo "configure:1520: checking for nanosleep" >&5 +echo "configure:1522: 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:1550: \"$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 @@ -1563,7 +1565,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for nanosleep in -lrt""... $ac_c" 1>&6 -echo "configure:1567: checking for nanosleep in -lrt" >&5 +echo "configure:1569: 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 @@ -1571,7 +1573,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:1588: \"$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 @@ -1602,7 +1604,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for nanosleep in -lposix4""... $ac_c" 1>&6 -echo "configure:1606: checking for nanosleep in -lposix4" >&5 +echo "configure:1608: 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 @@ -1610,7 +1612,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:1627: \"$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 @@ -1650,12 +1652,12 @@ fi for ac_func in usleep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1654: checking for $ac_func" >&5 +echo "configure:1656: 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:1684: \"$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 @@ -1703,12 +1705,12 @@ fi done echo $ac_n "checking for inet_aton""... $ac_c" 1>&6 -echo "configure:1707: checking for inet_aton" >&5 +echo "configure:1709: 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:1737: \"$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 @@ -1750,7 +1752,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for inet_aton in -lresolv""... $ac_c" 1>&6 -echo "configure:1754: checking for inet_aton in -lresolv" >&5 +echo "configure:1756: 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 @@ -1758,7 +1760,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:1775: \"$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 @@ -1795,12 +1797,12 @@ fi for ac_func in vasprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1799: checking for $ac_func" >&5 +echo "configure:1801: 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:1829: \"$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 @@ -1850,12 +1852,12 @@ done for ac_func in swab do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1854: checking for $ac_func" >&5 +echo "configure:1856: 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:1884: \"$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 @@ -1904,12 +1906,12 @@ done echo $ac_n "checking for getopt_long""... $ac_c" 1>&6 -echo "configure:1908: checking for getopt_long" >&5 +echo "configure:1910: 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:1938: \"$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 @@ -1954,7 +1956,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:1958: checking for getopt_long in -lgnugetopt" >&5 +echo "configure:1960: 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 @@ -1962,7 +1964,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:1979: \"$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 @@ -2005,17 +2007,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:2009: checking for $ac_hdr" >&5 +echo "configure:2011: 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:2019: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2021: \"$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* @@ -2044,12 +2046,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2048: checking for $ac_func" >&5 +echo "configure:2050: 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:2078: \"$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 @@ -2097,7 +2099,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:2101: checking for working mmap" >&5 +echo "configure:2103: 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 @@ -2105,7 +2107,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:2251: \"$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 @@ -2268,12 +2270,12 @@ EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2272: checking return type of signal handlers" >&5 +echo "configure:2274: 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 @@ -2290,7 +2292,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2294: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2296: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2309,7 +2311,7 @@ EOF echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:2313: checking for dlopen in -ldl" >&5 +echo "configure:2315: 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 @@ -2317,7 +2319,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:2334: \"$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 @@ -2349,7 +2351,7 @@ else fi echo $ac_n "checking for pow in -lm""... $ac_c" 1>&6 -echo "configure:2353: checking for pow in -lm" >&5 +echo "configure:2355: 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 @@ -2357,7 +2359,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:2374: \"$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 @@ -2394,7 +2396,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:2398: checking for pthread_attr_init in -lpthread" >&5 +echo "configure:2400: 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 @@ -2402,7 +2404,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:2419: \"$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 @@ -2433,9 +2435,9 @@ else echo "$ac_t""no" 1>&6 fi -if test "x$PTHREAD_LIBS" = xerror; then +if test "x${PTHREAD_LIBS}" = xerror; then echo $ac_n "checking for pthread_attr_init in -lpthreads""... $ac_c" 1>&6 -echo "configure:2439: checking for pthread_attr_init in -lpthreads" >&5 +echo "configure:2441: 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 @@ -2443,7 +2445,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:2460: \"$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 @@ -2475,9 +2477,9 @@ else fi fi -if test "x$PTHREAD_LIBS" = xerror; then +if test "x${PTHREAD_LIBS}" = xerror; then echo $ac_n "checking for pthread_attr_init in -lc_r""... $ac_c" 1>&6 -echo "configure:2481: checking for pthread_attr_init in -lc_r" >&5 +echo "configure:2483: 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 @@ -2485,7 +2487,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:2502: \"$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 @@ -2517,15 +2519,15 @@ else fi fi -if test "x$PTHREAD_LIBS" = xerror; then +if test "x${PTHREAD_LIBS}" = xerror; then PTHREAD_LIBS="" echo $ac_n "checking for pthread_attr_init""... $ac_c" 1>&6 -echo "configure:2524: checking for pthread_attr_init" >&5 +echo "configure:2526: 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:2554: \"$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 @@ -2571,7 +2573,7 @@ fi LIB="${LIB} ${PTHREAD_LIBS}" cat > conftest.$ac_ext < EOF @@ -2588,7 +2590,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -2609,17 +2611,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:2613: checking for $ac_hdr" >&5 +echo "configure:2615: 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:2623: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2625: \"$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* @@ -2649,17 +2651,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:2653: checking for $ac_hdr" >&5 +echo "configure:2655: 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:2663: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2665: \"$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* @@ -2689,17 +2691,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:2693: checking for $ac_hdr" >&5 +echo "configure:2695: 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:2703: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2705: \"$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* @@ -2729,17 +2731,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:2733: checking for $ac_hdr" >&5 +echo "configure:2735: 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:2743: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2745: \"$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* @@ -2769,17 +2771,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:2773: checking for $ac_hdr" >&5 +echo "configure:2775: 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:2783: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2785: \"$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* @@ -2809,17 +2811,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:2813: checking for $ac_hdr" >&5 +echo "configure:2815: 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:2823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2825: \"$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* @@ -2850,17 +2852,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:2854: checking for $ac_hdr" >&5 +echo "configure:2856: 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:2864: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2866: \"$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* @@ -2889,9 +2891,9 @@ done CFLAGS="${CFLAGS} -Wall -Werror" echo $ac_n "checking for ntohl in sys/param.h""... $ac_c" 1>&6 -echo "configure:2893: checking for ntohl in sys/param.h" >&5 +echo "configure:2895: checking for ntohl in sys/param.h" >&5 cat > conftest.$ac_ext < void foo() { int meuh; ntohl(meuh); } @@ -2899,7 +2901,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2903: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define NTOHL_IN_SYS_PARAM_H 1 @@ -2917,9 +2919,9 @@ rm -f conftest* CFLAGS="${save_CFLAGS}" echo $ac_n "checking for boolean_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:2921: checking for boolean_t in sys/types.h" >&5 +echo "configure:2923: checking for boolean_t in sys/types.h" >&5 cat > conftest.$ac_ext < void quux() { boolean_t foo; } @@ -2927,7 +2929,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2931: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2933: \"$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 @@ -2942,9 +2944,9 @@ else fi rm -f conftest* echo $ac_n "checking for boolean_t in pthread.h""... $ac_c" 1>&6 -echo "configure:2946: checking for boolean_t in pthread.h" >&5 +echo "configure:2948: checking for boolean_t in pthread.h" >&5 cat > conftest.$ac_ext < void quux() { boolean_t foo; } @@ -2952,7 +2954,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2956: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define BOOLEAN_T_IN_PTHREAD_H 1 @@ -2968,12 +2970,12 @@ fi rm -f conftest* echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2972: checking for working const" >&5 +echo "configure:2974: 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:3028: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3043,12 +3045,12 @@ EOF fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3047: checking for ANSI C header files" >&5 +echo "configure:3049: 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 @@ -3056,7 +3058,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3060: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3062: \"$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* @@ -3073,7 +3075,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 @@ -3091,7 +3093,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 @@ -3112,7 +3114,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3123,7 +3125,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:3127: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -3147,12 +3149,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3151: checking for size_t" >&5 +echo "configure:3153: 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 @@ -3180,12 +3182,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:3184: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:3186: 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 @@ -3194,7 +3196,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:3198: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3200: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -3231,16 +3233,16 @@ case x$host_os in esac echo $ac_n "checking if \$CC groks MMX inline assembly""... $ac_c" 1>&6 -echo "configure:3235: checking if \$CC groks MMX inline assembly" >&5 +echo "configure:3237: checking if \$CC groks MMX inline assembly" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3246: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ACCEL_PLUGINS="${ACCEL_PLUGINS} ${MMX_PLUGINS}" echo "$ac_t""yes" 1>&6 @@ -3253,16 +3255,16 @@ fi rm -f conftest* echo $ac_n "checking if \$CC groks MMX EXT or SSE inline assembly""... $ac_c" 1>&6 -echo "configure:3257: checking if \$CC groks MMX EXT or SSE inline assembly" >&5 +echo "configure:3259: 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:3268: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ACCEL_PLUGINS="${ACCEL_PLUGINS} ${MMXEXT_PLUGINS}" echo "$ac_t""yes" 1>&6 @@ -3278,17 +3280,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:3282: checking for $ac_hdr" >&5 +echo "configure:3284: 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:3292: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3294: \"$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* @@ -3314,17 +3316,17 @@ EOF do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3318: checking for $ac_hdr" >&5 +echo "configure:3320: 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:3328: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3330: \"$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* @@ -3352,7 +3354,7 @@ done BSD_DVD_STRUCT=0 cat > conftest.$ac_ext < EOF @@ -3370,7 +3372,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -3394,7 +3396,7 @@ EOF fi cat > conftest.$ac_ext < EOF @@ -3545,7 +3547,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:3549: checking for $ac_word" >&5 +echo "configure:3551: 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 @@ -3610,17 +3612,17 @@ else do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3614: checking for $ac_hdr" >&5 +echo "configure:3616: 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:3624: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3626: \"$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* @@ -3691,17 +3693,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:3695: checking for $ac_hdr" >&5 +echo "configure:3697: 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:3705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3707: \"$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* @@ -3739,17 +3741,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3743: checking for $ac_hdr" >&5 +echo "configure:3745: 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:3753: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3755: \"$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* @@ -3778,6 +3780,108 @@ done fi +# Check whether --with-directx or --without-directx was given. +if test "${with_directx+set}" = set; then + withval="$with_directx" + if test "x$withval" != "xno"; + then + PLUGINS="${PLUGINS} directx"; + if test "x$withval" != "xyes"; + then + LIB_DIRECTX="${LIB_DIRECTX} -L"$withval"/lib -lddraw -ldsound" + 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:3799: 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:3809: \"$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 +echo "Cannot find DirectX headers !"; exit +fi +done + + LIB_DIRECTX="${LIB_DIRECTX} -L/usr/lib -lddraw -ldsound" + fi + fi +fi + + if test "x$withval" = "x"; + then + 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 +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; } +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 +fi +done + + fi + # Check whether --with-glide or --without-glide was given. if test "${with_glide+set}" = set; then withval="$with_glide" @@ -3849,7 +3953,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:3853: checking for $ac_word" >&5 +echo "configure:3957: 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 @@ -3909,17 +4013,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:3913: checking for $ac_hdr" >&5 +echo "configure:4017: 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:3923: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4027: \"$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* @@ -3971,17 +4075,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:3975: checking for $ac_hdr" >&5 +echo "configure:4079: 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:3985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4089: \"$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* @@ -4019,17 +4123,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:4023: checking for sys/asoundlib.h" >&5 +echo "configure:4127: 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:4033: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4137: \"$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* @@ -4046,7 +4150,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:4050: checking for main in -lasound" >&5 +echo "configure:4154: 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 @@ -4054,14 +4158,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:4169: \"$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 @@ -4132,6 +4236,7 @@ fi + trap '' 1 2 15 @@ -4313,6 +4418,7 @@ s%@LIB_NCURSES@%$LIB_NCURSES%g s%@LIB_QT@%$LIB_QT%g s%@LIB_TS@%$LIB_TS%g s%@LIB_SDL@%$LIB_SDL%g +s%@LIB_DIRECTX@%$LIB_DIRECTX%g s%@LIB_X11@%$LIB_X11%g s%@LIB_XVIDEO@%$LIB_XVIDEO%g s%@LIB_YUV@%$LIB_YUV%g diff --git a/configure.in b/configure.in index 5b3def3995..af464d68e0 100644 --- a/configure.in +++ b/configure.in @@ -68,13 +68,13 @@ 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 +if test "x${PTHREAD_LIBS}" = xerror; then AC_CHECK_LIB(pthreads,pthread_attr_init,PTHREAD_LIBS="-lpthreads") fi -if test "x$PTHREAD_LIBS" = xerror; then +if test "x${PTHREAD_LIBS}" = xerror; then AC_CHECK_LIB(c_r,pthread_attr_init,PTHREAD_LIBS="-lc_r") fi -if test "x$PTHREAD_LIBS" = xerror; then +if test "x${PTHREAD_LIBS}" = xerror; then PTHREAD_LIBS="" AC_CHECK_FUNC(pthread_attr_init) fi @@ -395,6 +395,30 @@ AC_ARG_WITH(sdl, LIB_SDL="${LIB_SDL} -L/usr/X11R6/lib -lSDL"]) fi +dnl +dnl Windows DirectX module +dnl +AC_ARG_WITH(directx, + [ --with-directx[=name] Windows DirectX support (default enabled)], + [ if test "x$withval" != "xno"; + then + PLUGINS="${PLUGINS} directx"; + if test "x$withval" != "xyes"; + then + LIB_DIRECTX="${LIB_DIRECTX} -L"$withval"/lib -lddraw -ldsound" + 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" + 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"]) + fi + dnl dnl Glide module dnl @@ -562,6 +586,7 @@ AC_SUBST(LIB_NCURSES) AC_SUBST(LIB_QT) AC_SUBST(LIB_TS) AC_SUBST(LIB_SDL) +AC_SUBST(LIB_DIRECTX) AC_SUBST(LIB_X11) AC_SUBST(LIB_XVIDEO) AC_SUBST(LIB_YUV) diff --git a/plugins/directx/Makefile b/plugins/directx/Makefile new file mode 100644 index 0000000000..0d246e87b4 --- /dev/null +++ b/plugins/directx/Makefile @@ -0,0 +1,31 @@ +############################################################################### +# vlc (VideoLAN Client) DirectX module Makefile +# (c)2001 VideoLAN +############################################################################### + +# +# Objects +# + +PLUGIN_C = directx.o vout_directx.o aout_directx.o +BUILTIN_C = $(PLUGIN_C:%.o=BUILTIN_%.o) + +ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C) + +# +# Virtual targets +# + +include ../../Makefile.modules + +# +# Real targets +# + +../../lib/directx.so: $(PLUGIN_C) + $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_DIRECTX) + +../../lib/directx.a: $(BUILTIN_C) + ar r $@ $^ + $(RANLIB) $@ + diff --git a/plugins/directx/aout_directx.c b/plugins/directx/aout_directx.c new file mode 100644 index 0000000000..a31237e7a1 --- /dev/null +++ b/plugins/directx/aout_directx.c @@ -0,0 +1,553 @@ +/***************************************************************************** + * aout_directx.c: Windows DirectX audio output method + ***************************************************************************** + * Copyright (C) 1999, 2000 VideoLAN + * $Id: aout_directx.c,v 1.1 2001/06/02 01:09:03 sam Exp $ + * + * Authors: Gildas Bazin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +#define MODULE_NAME directx +#include "modules_inner.h" + +/* The most important this 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 + */ + + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#include "defs.h" + +#include /* ENOMEM */ +#include /* open(), O_WRONLY */ +#include /* strerror() */ +#include /* write(), close() */ +#include /* "intf_msg.h" */ +#include /* calloc(), malloc(), free() */ + +#include "config.h" +#include "common.h" /* boolean_t, byte_t */ +#include "threads.h" +#include "mtime.h" +#include "tests.h" + +#include "directx.h" + +#include "audio_output.h" /* aout_thread_t */ + +#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */ +#include "main.h" + +#include "modules.h" + +/***************************************************************************** + * aout_sys_t: directx audio output method descriptor + ***************************************************************************** + * This structure is part of the audio output thread descriptor. + * It describes the direct sound specific properties of an audio device. + *****************************************************************************/ + +typedef struct aout_sys_s +{ + LPDIRECTSOUND p_dsobject; /* main Direct Sound object */ + + LPDIRECTSOUNDBUFFER p_dsbuffer_primary; /* the actual sound card buffer + (not used directly) */ + + LPDIRECTSOUNDBUFFER p_dsbuffer; /* the sound buffer we use (direct sound + * takes care of mixing all the + * secondary buffers into the primary) */ + + long l_buffer_size; /* secondary sound buffer size */ + long l_write_position; /* next write position for the buffer */ + + boolean_t b_active; + +} aout_sys_t; + +/***************************************************************************** + * Local prototypes. + *****************************************************************************/ +static int aout_Probe ( probedata_t *p_data ); +static int aout_Open ( aout_thread_t *p_aout ); +static int aout_SetFormat ( aout_thread_t *p_aout ); +static long aout_GetBufInfo ( aout_thread_t *p_aout, long l_buffer_info ); +static void aout_Play ( aout_thread_t *p_aout, + byte_t *buffer, int i_size ); +static void aout_Close ( aout_thread_t *p_aout ); + +/* local function */ +static int windx_CreateSecondaryBuffer( aout_thread_t *p_aout ); + +/***************************************************************************** + * Functions exported as capabilities. They are declared as static so that + * we don't pollute the namespace too much. + *****************************************************************************/ +void _M( aout_getfunctions )( function_list_t * p_function_list ) +{ + p_function_list->pf_probe = aout_Probe; + p_function_list->functions.aout.pf_open = aout_Open; + p_function_list->functions.aout.pf_setformat = aout_SetFormat; + p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo; + p_function_list->functions.aout.pf_play = aout_Play; + p_function_list->functions.aout.pf_close = aout_Close; +} + +/***************************************************************************** + * aout_Probe: probe the audio device and return a score + ***************************************************************************** + * This function tries to probe for a Direct Sound device and returns a + * score to the plugin manager so that it can select the best plugin. + *****************************************************************************/ +static int aout_Probe( probedata_t *p_data ) +{ + /* For now just assume the computer has a sound device */ + if( TestMethod( AOUT_METHOD_VAR, "directx" ) ) + { + return( 999 ); + } + return( 400 ); +} + +/***************************************************************************** + * aout_Open: open the audio device + ***************************************************************************** + * This function opens and setups Direct Sound. + *****************************************************************************/ +static int aout_Open( aout_thread_t *p_aout ) +{ +#if 0 + HRESULT dsresult; + DSBUFFERDESC dsbuffer_desc; + WAVEFORMATEX waveformat; +#endif + + /* Allocate structure */ + p_aout->p_sys = malloc( sizeof( aout_sys_t ) ); + + if( p_aout->p_sys == NULL ) + { + intf_ErrMsg( "aout error: %s", strerror(ENOMEM) ); + return( 1 ); + } + + /* Initialize some variables */ + p_aout->p_sys->p_dsobject = NULL; + p_aout->p_sys->p_dsbuffer_primary = NULL; + p_aout->p_sys->p_dsbuffer = NULL; + + p_aout->psz_device = 0; + p_aout->i_format = AOUT_FORMAT_DEFAULT; + p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR, + AOUT_STEREO_DEFAULT ); + 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 ) + { + intf_WarnMsg( 3, "aout: can't create a direct sound device "); + p_aout->p_sys->p_dsobject = 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 "); + } + +#if 0 + /* Obtain (not create) Direct Sound primary buffer */ + memset( &dsbuffer_desc, 0, sizeof(DSBUFFERDESC) ); + dsbuffer_desc.dwSize = sizeof(DSBUFFERDESC); + dsbuffer_desc.dwFlags = DSBCAPS_PRIMARYBUFFER; + intf_WarnMsg( 3, "aout: Create direct sound primary buffer "); + dsresult = IDirectSound_CreateSoundBuffer(p_aout->p_sys->p_dsobject, + &dsbuffer_desc, + &p_aout->p_sys->p_dsbuffer_primary, + NULL); + if( dsresult != DS_OK ) + { + intf_WarnMsg( 3, "aout: can't create direct sound primary buffer "); + IDirectSound_Release( p_aout->p_sys->p_dsobject ); + p_aout->p_sys->p_dsobject = NULL; + p_aout->p_sys->p_dsbuffer_primary = NULL; + return( 1 ); + } + + /* Set Direct Sound primary buffer format because the default value set by + * Windows is usually not the high quality value */ + memset(&waveformat, 0, sizeof(WAVEFORMATEX)); + waveformat.wFormatTag = WAVE_FORMAT_PCM; + waveformat.nChannels = 2; + waveformat.nSamplesPerSec = 44100; + waveformat.wBitsPerSample = 16; + waveformat.nBlockAlign = waveformat.wBitsPerSample / 8 * + waveformat.nChannels; + waveformat.nAvgBytesPerSec = waveformat.nSamplesPerSec * + waveformat.nBlockAlign; + + dsresult = IDirectSoundBuffer_SetFormat(p_aout->p_sys->p_dsbuffer_primary, + &waveformat); + if( dsresult != DS_OK ) + { + intf_WarnMsg( 3, "aout: can't set primary buffer format"); + } + + /* ensure the primary buffer is playing. We won't actually hear anything + * until the secondary buffer is playing */ + dsresult = IDirectSoundBuffer_Play( p_aout->p_sys->p_dsbuffer_primary, + 0, + 0, + DSBPLAY_LOOPING); + if( dsresult != DS_OK ) + { + intf_WarnMsg( 3, "aout: can't play direct sound primary buffer "); + IDirectSound_Release( p_aout->p_sys->p_dsbuffer_primary ); + IDirectSound_Release( p_aout->p_sys->p_dsobject ); + p_aout->p_sys->p_dsobject = NULL; + 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 ); +} + +/***************************************************************************** + * aout_SetFormat: reset the audio device and sets its format + ***************************************************************************** + * This functions set a new audio format. + * For this we need to close the current secondary buffer and create another + * one with the desired format. + *****************************************************************************/ +static int aout_SetFormat( aout_thread_t *p_aout ) +{ + HRESULT dsresult; + + /* first release the current secondary buffer */ + if( p_aout->p_sys->p_dsbuffer != NULL ) + { + IDirectSoundBuffer_Release( p_aout->p_sys->p_dsbuffer ); + p_aout->p_sys->p_dsbuffer = NULL; + } + + /* then create a new secondary buffer */ + dsresult = windx_CreateSecondaryBuffer( p_aout ); + if( dsresult != DS_OK ) + { + intf_WarnMsg( 3, "aout: WinDX aout_SetFormat cannot create buffer"); + return( 1 ); + } + + return( 0 ); +} + +/***************************************************************************** + * aout_GetBufInfo: buffer status query + ***************************************************************************** + * returns the number of bytes in the audio buffer compared to the size of + * l_buffer_limit... + *****************************************************************************/ +static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit ) +{ + long l_play_position, l_notused, l_result; + HRESULT dsresult; + + dsresult = IDirectSoundBuffer_GetCurrentPosition(p_aout->p_sys->p_dsbuffer, + &l_play_position, &l_notused); + if( dsresult == DSERR_BUFFERLOST ) + { + IDirectSoundBuffer_Restore( p_aout->p_sys->p_dsbuffer ); + dsresult = IDirectSoundBuffer_GetCurrentPosition( + p_aout->p_sys->p_dsbuffer, + &l_play_position, &l_notused + ); + } + if( dsresult != DS_OK ) + { + intf_WarnMsg( 3, "aout: WinDX 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 ); + + intf_WarnMsg( 5, "aout: WinDX aout_GetBufInfo: %li", l_result); + return l_result; +} + +/***************************************************************************** + * aout_Play: play a sound buffer + ***************************************************************************** + * This function writes a buffer of i_length bytes + *****************************************************************************/ +static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) +{ + VOID *p_write_position, *p_start_buffer; + long l_bytes1, l_bytes2; + 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 + * find out were in the buffer we can write our data */ + dsresult = IDirectSoundBuffer_GetCurrentPosition(p_aout->p_sys->p_dsbuffer, + &l_play_position, + &l_notused); + if( dsresult == DSERR_BUFFERLOST ) + { + IDirectSoundBuffer_Restore( p_aout->p_sys->p_dsbuffer ); + dsresult = IDirectSoundBuffer_GetCurrentPosition( + p_aout->p_sys->p_dsbuffer, + &l_play_position, &l_notused + ); + } + if( dsresult != DS_OK ) + { + intf_WarnMsg( 3, "aout: WinDX 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 ; + + 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); + /*i_size = l_buffer_free_length;*/ + } + + /* Before copying anything, we have to lock the buffer */ + dsresult = IDirectSoundBuffer_Lock( p_aout->p_sys->p_dsbuffer, + p_aout->p_sys->l_write_position, /* Offset of lock start */ + i_size, /* Number of bytes to lock */ + &p_write_position, /* Address of lock start */ + &l_bytes1, /* Count of bytes locked before wrap around */ + &p_start_buffer, /* Buffer adress (if wrap around) */ + &l_bytes2, /* Count of bytes after wrap around */ + 0); /* Flags */ + if( dsresult == DSERR_BUFFERLOST ) + { + IDirectSoundBuffer_Restore( p_aout->p_sys->p_dsbuffer ); + dsresult = IDirectSoundBuffer_Lock( p_aout->p_sys->p_dsbuffer, + p_aout->p_sys->l_write_position, + i_size, + &p_write_position, + &l_bytes1, + &p_start_buffer, + &l_bytes2, + 0); + + } + if( dsresult != DS_OK ) + { + intf_WarnMsg( 3, "aout: WinDX aout_Play can't lock buffer"); + return; + } + + /* Now do the actual memcopy (two memcpy because the buffer is circular) */ + memcpy( p_write_position, buffer, l_bytes1 ); + if( p_start_buffer != NULL ) + memcpy( p_start_buffer, buffer + l_bytes1, l_bytes2 ); + + /* Now the data has been copied, unlock the buffer */ + IDirectSoundBuffer_Unlock( p_aout->p_sys->p_dsbuffer, + p_write_position, l_bytes1, p_start_buffer, l_bytes2 ); + + /* Update the write position index of the buffer*/ + p_aout->p_sys->l_write_position += i_size; + p_aout->p_sys->l_write_position %= p_aout->p_sys->l_buffer_size; + + /* The play function has no effect if the buffer is already playing */ + dsresult = IDirectSoundBuffer_Play( p_aout->p_sys->p_dsbuffer, + 0, /* Unused */ + 0, /* Unused */ + DSBPLAY_LOOPING ); /* Flags */ + if( dsresult == DSERR_BUFFERLOST ) + { + IDirectSoundBuffer_Restore( p_aout->p_sys->p_dsbuffer ); + dsresult = IDirectSoundBuffer_Play( p_aout->p_sys->p_dsbuffer, + 0, /* Unused */ + 0, /* Unused */ + DSBPLAY_LOOPING ); /* Flags */ + } + if( dsresult != DS_OK ) + { + intf_WarnMsg( 3, "aout: WinDX aout_Play can't play buffer"); + return; + } + +} + +/***************************************************************************** + * aout_Close: close the audio device + *****************************************************************************/ +static void aout_Close( aout_thread_t *p_aout ) +{ + /* make sure the buffer isn't playing */ + if( p_aout->p_sys->p_dsbuffer != NULL ) + { + IDirectSoundBuffer_Stop( p_aout->p_sys->p_dsbuffer ); + } + + /* first release the secondary buffer */ + if( p_aout->p_sys->p_dsbuffer != NULL ) + { + IDirectSoundBuffer_Release( p_aout->p_sys->p_dsbuffer ); + p_aout->p_sys->p_dsbuffer = NULL; + } + + /* then release the primary buffer */ + if( p_aout->p_sys->p_dsbuffer_primary != NULL ) + { + IDirectSoundBuffer_Release( p_aout->p_sys->p_dsbuffer_primary ); + p_aout->p_sys->p_dsbuffer_primary = NULL; + } + + /* finally release the DirectSound object */ + if( p_aout->p_sys->p_dsobject != NULL ) + { + IDirectSound_Release( p_aout->p_sys->p_dsobject ); + p_aout->p_sys->p_dsobject = NULL; + } + + /* Close the Output. */ + if ( p_aout->p_sys != NULL ) + { + free( p_aout->p_sys ); + p_aout->p_sys = NULL; + } +} + +/***************************************************************************** + * windx_CreateSecondaryBuffer + ***************************************************************************** + * This function creates the buffer we'll use to play audio. + * In DirectSound there are two kinds of buffers: + * - the primary buffer: which is the actual buffer that the soundcard plays + * - the secondary buffer(s): these buffers are the one actually used by + * applications and DirectSound takes care of mixing them into the primary. + * + * 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 ) +{ + WAVEFORMATEX waveformat; + DSBUFFERDESC dsbdesc; + DSBCAPS dsbcaps; + HRESULT dsresult; + + /* First set the buffer format */ + memset(&waveformat, 0, sizeof(WAVEFORMATEX)); + waveformat.wFormatTag = WAVE_FORMAT_PCM; + waveformat.nChannels = p_aout->i_channels; + waveformat.nSamplesPerSec = p_aout->l_rate; + waveformat.wBitsPerSample = 16; + waveformat.nBlockAlign = waveformat.wBitsPerSample / 8 * + waveformat.nChannels; + waveformat.nAvgBytesPerSec = waveformat.nSamplesPerSec * + waveformat.nBlockAlign; + + /* Then fill in the descriptor */ + memset(&dsbdesc, 0, sizeof(DSBUFFERDESC)); + 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; + + if( IDirectSound_CreateSoundBuffer( p_aout->p_sys->p_dsobject, + &dsbdesc, + &p_aout->p_sys->p_dsbuffer, + NULL) != DS_OK ) + { + intf_WarnMsg( 3, "aout: can't create direct sound secondary buffer "); + p_aout->p_sys->p_dsbuffer = NULL; + return( 1 ); + } + + /* backup the size of the secondary sound buffer */ + memset(&dsbcaps, 0, 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", + 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/directx.c b/plugins/directx/directx.c new file mode 100644 index 0000000000..f2a95869ba --- /dev/null +++ b/plugins/directx/directx.c @@ -0,0 +1,75 @@ +/***************************************************************************** + * directx.c : Windows DirectX plugin for vlc + ***************************************************************************** + * Copyright (C) 2000, 2001 VideoLAN + * $Id: directx.c,v 1.1 2001/06/02 01:09:03 sam Exp $ + * + * Authors: Gildas Bazin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +#define MODULE_NAME directx +#include "modules_inner.h" + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#include "defs.h" + +#include /* malloc(), free() */ + +#include "config.h" +#include "common.h" /* boolean_t, byte_t */ +#include "threads.h" +#include "mtime.h" + +#include "audio_output.h" + +#include "video.h" +#include "video_output.h" + +#include "modules.h" +#include "modules_export.h" + +/***************************************************************************** + * Capabilities defined in the other files. + *****************************************************************************/ +void _M( aout_getfunctions )( function_list_t * p_function_list ); +void _M( vout_getfunctions )( function_list_t * p_function_list ); + +/***************************************************************************** + * Building configuration tree + *****************************************************************************/ +MODULE_CONFIG_START +ADD_WINDOW( "Configuration for Windows DirectX module" ) + ADD_COMMENT( "For now, the Windows DirectX module cannot be configured" ) +MODULE_CONFIG_STOP + +MODULE_INIT_START + p_module->i_capabilities = MODULE_CAPABILITY_NULL + | MODULE_CAPABILITY_VOUT + | MODULE_CAPABILITY_AOUT; + p_module->psz_longname = "DirectX module"; +MODULE_INIT_STOP + +MODULE_ACTIVATE_START + _M( aout_getfunctions )( &p_module->p_functions->aout ); + _M( vout_getfunctions )( &p_module->p_functions->vout ); +MODULE_ACTIVATE_STOP + +MODULE_DEACTIVATE_START +MODULE_DEACTIVATE_STOP + diff --git a/plugins/directx/vout_directx.c b/plugins/directx/vout_directx.c new file mode 100644 index 0000000000..38146f7365 --- /dev/null +++ b/plugins/directx/vout_directx.c @@ -0,0 +1,1253 @@ +/***************************************************************************** + * vout_directx.c: Windows DirectX video output display method + ***************************************************************************** + * Copyright (C) 1998, 1999, 2000 VideoLAN + * $Id: vout_directx.c,v 1.1 2001/06/02 01:09:03 sam Exp $ + * + * Authors: Gildas Bazin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +#define MODULE_NAME directx +#include "modules_inner.h" + +/* This is a list of what needs to be fixed: + * + * For now, this plugin only works when YUV overlay is supported (which it + * should be nowadays on most of the video cards under Windows)... + * + * The overlay doesn't use double-buffering. + * + * Use Shane Harper's optimizations for YUV + */ + +/***************************************************************************** + * Preamble + * + *****************************************************************************/ +#include "defs.h" + +#include /* ENOMEM */ +#include /* free() */ +#include /* strerror() */ + +#include +#include + +#include "config.h" +#include "common.h" +#include "threads.h" +#include "mtime.h" +#include "tests.h" +#include "netutils.h" + +#include "video.h" +#include "video_output.h" + +#include "intf_msg.h" +#include "interface.h" +#include "main.h" + +#include "modules.h" +#include "modules_export.h" + +#define OVERLAY_COLOR_KEY 1 /* color on top of which the overlay will be + * displayed. 1 should be almost black but + * not black (which is too common a color) */ + +/***************************************************************************** + * vout_sys_t: video output DirectX method descriptor + ***************************************************************************** + * This structure is part of the video output thread descriptor. + * It describes the DirectX specific properties of an output thread. + *****************************************************************************/ +typedef struct vout_sys_s +{ + + LPDIRECTDRAW p_ddobject; /* DirectDraw object */ + LPDIRECTDRAWSURFACE p_display; /* display device */ + LPDIRECTDRAWSURFACE p_overlay; /* overlay device */ + LPDIRECTDRAWCLIPPER p_clipper; /* clipper */ + HWND hwnd; /* Handle of the main */ + /* window */ + + int i_image_width; /* size of the decoded image */ + int i_image_height; + int i_window_width; /* size of the displayed image */ + int i_window_height; + + boolean_t b_display_enabled; + boolean_t b_overlay; + boolean_t b_cursor; + + boolean_t b_cursor_autohidden; + mtime_t i_lastmoved; + + char *p_windx_buf[2]; /* Buffer information */ + +} vout_sys_t; + +/***************************************************************************** + * Local prototypes. + *****************************************************************************/ +static int vout_Probe ( probedata_t *p_data ); +static int vout_Create ( struct vout_thread_s * ); +static int vout_Init ( struct vout_thread_s * ); +static void vout_End ( struct vout_thread_s * ); +static void vout_Destroy ( struct vout_thread_s * ); +static int vout_Manage ( struct vout_thread_s * ); +static void vout_Display ( struct vout_thread_s * ); +static void vout_SetPalette( p_vout_thread_t p_vout, u16 *red, u16 *green, + u16 *blue, u16 *transp ); + +static int 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 int WinDXClipOverlay ( 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 ); + +/***************************************************************************** + * Functions exported as capabilities. They are declared as static so that + * we don't pollute the namespace too much. + *****************************************************************************/ +void _M( vout_getfunctions )( function_list_t * p_function_list ) +{ + p_function_list->pf_probe = vout_Probe; + p_function_list->functions.vout.pf_create = vout_Create; + p_function_list->functions.vout.pf_init = vout_Init; + p_function_list->functions.vout.pf_end = vout_End; + p_function_list->functions.vout.pf_destroy = vout_Destroy; + p_function_list->functions.vout.pf_manage = vout_Manage; + p_function_list->functions.vout.pf_display = vout_Display; + p_function_list->functions.vout.pf_setpalette = vout_SetPalette; +} + +/***************************************************************************** + * vout_Probe: probe the video driver and return a score + ***************************************************************************** + * This function tries to initialize Windows DirectX and returns a score to + * the plugin manager so that it can select the best plugin. + *****************************************************************************/ +static int vout_Probe( probedata_t *p_data ) +{ + if( TestMethod( VOUT_METHOD_VAR, "directx" ) ) + { + return( 999 ); + } + + return( 400 ); +} + +/***************************************************************************** + * vout_Create: allocate DirectX video thread output method + ***************************************************************************** + * This function allocates and initialize the DirectX vout method. + *****************************************************************************/ +static int vout_Create( vout_thread_t *p_vout ) +{ + /* Allocate structure */ + p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); + if( p_vout->p_sys == NULL ) + { + intf_ErrMsg( "vout error: can't create p_sys (%s)", strerror(ENOMEM) ); + return( 1 ); + } + + 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, + VOUT_FULLSCREEN_DEFAULT ); + p_vout->p_sys->b_overlay = main_GetIntVariable( VOUT_OVERLAY_VAR, + VOUT_OVERLAY_DEFAULT ); + p_vout->p_sys->i_window_width = main_GetIntVariable( VOUT_WIDTH_VAR, + VOUT_WIDTH_DEFAULT ); + p_vout->p_sys->i_window_height = main_GetIntVariable( VOUT_HEIGHT_VAR, + VOUT_HEIGHT_DEFAULT ); + /* We don't know yet the dimensions of the video so the best guess is to + * pick the same as the window */ + p_vout->p_sys->i_image_width = p_vout->p_sys->i_window_width; + p_vout->p_sys->i_image_height = p_vout->p_sys->i_window_height; + + /* Create a window for the video */ + /* Creating a window under Windows also initializes the thread's event + * message qeue */ + if( WinDXCreateWindow( p_vout ) ) + { + intf_ErrMsg( "vout error: can't create window" ); + free( p_vout->p_sys ); + return ( 1 ); + } + + /* Initialise DirectDraw */ + if( WinDXInitDDraw( p_vout ) ) + { + intf_ErrMsg( "vout error: can't initialise DirectDraw" ); + WinDXCloseWindow( p_vout ); + free( p_vout->p_sys ); + return ( 1 ); + } + + /* create the directx display */ + if( WinDXCreateDisplay( p_vout ) ) + { + intf_ErrMsg( "vout error: can't initialise DirectDraw" ); + WinDXCloseDDraw( p_vout ); + WinDXCloseWindow( p_vout ); + free( p_vout->p_sys ); + return ( 1 ); + } + + return( 0 ); +} + +/***************************************************************************** + * vout_Init: initialize DirectX video thread output method + ***************************************************************************** + * + *****************************************************************************/ +static int vout_Init( vout_thread_t *p_vout ) +{ + return( 0 ); +} + +/***************************************************************************** + * vout_End: terminate Sys video thread output method + ***************************************************************************** + * Terminate an output method created by vout_Create. + * It is called at the end of the thread. + *****************************************************************************/ +static void vout_End( vout_thread_t *p_vout ) +{ + return; +} + +/***************************************************************************** + * vout_Destroy: destroy Sys video thread output method + ***************************************************************************** + * Terminate an output method created by vout_Create + *****************************************************************************/ +static void vout_Destroy( vout_thread_t *p_vout ) +{ + WinDXCloseDisplay( p_vout ); + WinDXCloseDDraw( p_vout ); + WinDXCloseWindow( p_vout ); + + if( p_vout->p_sys != NULL ) + { + free( p_vout->p_sys ); + p_vout->p_sys = NULL; + } + +} + +/***************************************************************************** + * vout_Manage: handle Sys events + ***************************************************************************** + * This function should be called regularly by video output thread. It returns + * a non null value if an error occured. + *****************************************************************************/ +static int vout_Manage( vout_thread_t *p_vout ) +{ + MSG msg; + WINDOWPLACEMENT window_placement; + + while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + { + if( GetMessage(&msg, NULL, 0, 0) >= 0 ) + { + switch( msg.message ) + { + case WM_QUIT: + intf_WarnMsg( 3, "vout: WinDX vout_Manage WM_QUIT" ); + p_main->p_intf->b_die = 1; + break; + + case WM_MOVE: + intf_WarnMsg( 3, "vout: WinDX vout_Manage WM_MOVE" ); + if( !p_vout->b_need_render ) + { + WinDXUpdateOverlay( p_vout ); + } + /* don't create a never ending loop */ + return( 0 ); + break; + + case WM_PAINT: + intf_WarnMsg( 3, "vout: WinDX vout_Manage WM_PAINT" ); + if( !p_vout->b_need_render ) + { + WinDXClipOverlay( p_vout ); + } + /* don't create a never ending loop */ + return( 0 ); + break; + + case WM_CHAR: + intf_WarnMsg( 3, "vout: WinDX WinProc WM_CHAR" ); + switch( msg.wParam ) + { + case 'q': + case 'Q': + p_main->p_intf->b_die = 1; + break; + + case 'f': + case 'F': + p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE; + break; + + case '0': network_ChannelJoin( 0 ); break; + case '1': network_ChannelJoin( 1 ); break; + case '2': network_ChannelJoin( 2 ); break; + case '3': network_ChannelJoin( 3 ); break; + case '4': network_ChannelJoin( 4 ); break; + case '5': network_ChannelJoin( 5 ); break; + case '6': network_ChannelJoin( 6 ); break; + case '7': network_ChannelJoin( 7 ); break; + case '8': network_ChannelJoin( 8 ); break; + case '9': network_ChannelJoin( 9 ); break; + + default: + if( intf_ProcessKey( p_main->p_intf, + (char )msg.wParam ) ) + { + intf_DbgMsg( "unhandled key '%c' (%i)", + (char)msg.wParam, msg.wParam ); + } + break; + } + + default: + break; + } + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else + { + return( 1 ); + } + + } + + + /* + * Fullscreen change + */ + if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE ) + { + p_vout->b_fullscreen = ! p_vout->b_fullscreen; + + /* We need to switch between Maximized and Normal sized window */ + window_placement.length = sizeof(WINDOWPLACEMENT); + GetWindowPlacement( p_vout->p_sys->hwnd, &window_placement ); + if( p_vout->b_fullscreen ) + { + /* Maximized window */ + window_placement.showCmd = SW_SHOWMAXIMIZED; + /* Change window style, no borders and no title bar */ + SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE, 0 ); + + } + else + { + /* Normal window */ + window_placement.showCmd = SW_SHOWNORMAL; + /* Change window style, borders and title bar */ + SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE, + WS_OVERLAPPEDWINDOW | WS_SIZEBOX | WS_VISIBLE ); + } + + SetWindowPlacement( p_vout->p_sys->hwnd, &window_placement ); + /*WinDXUpdateOverlay( p_vout );*/ + + p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE; + } + + return( 0 ); +} + +/***************************************************************************** + * vout_SetPalette: sets an 8 bpp palette + ***************************************************************************** + * This function sets the palette given as an argument. It does not return + * anything, but could later send information on which colors it was unable + * to set. + *****************************************************************************/ +static void vout_SetPalette( p_vout_thread_t p_vout, u16 *red, u16 *green, + u16 *blue, u16 *transp) +{ + /* Nothing yet */ + return; +} + +/***************************************************************************** + * vout_Display: displays previously rendered output + ***************************************************************************** + * This function send the currently rendered image to the display, wait until + * it is displayed and switch the two rendering buffer, preparing next frame. + *****************************************************************************/ +static void vout_Display( vout_thread_t *p_vout ) +{ + 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; + + + if( (p_vout->p_sys->p_display == NULL) ) + { + intf_WarnMsg( 3, "vout error: WinDX no display!!" ); + return; + } + + /* The first time this function is called it enables the display */ + p_vout->p_sys->b_display_enabled = 1; + + if( p_vout->b_need_render ) + { + /* Nothing yet */ + } + else + { + /* + * p_vout->p_rendered_pic->p_y/u/v contains the YUV buffers to + * render + */ + /* TODO: support for streams other than 4:2:0 */ + + /* if 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 ) + { + intf_WarnMsg( 3, "vout: WinDX no overlay, open one..." ); + if( WinDXCreateYUVOverlay( p_vout ) ) + { + intf_WarnMsg( 3, "vout: WinDX cannot open a new overlay !!" ); + return; + } + /* Display the Overlay */ + p_vout->p_sys->b_display_enabled = 1; + WinDXUpdateOverlay( 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); + 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); + } + if( dxresult != DD_OK ) + { + intf_WarnMsg( 3, "vout: WinDX could not lock the surface" ); + return; + } + + /* Now we can do the actual image copy. + * The copy has to be done line by line because of the special case + * when the Pitch does not equal the width of the picture */ + for( i=0; i < ddsd.dwHeight/2; i++) + { + /* copy Y, we copy two lines at once */ + memcpy(ddsd.lpSurface + i*2*ddsd.u1.lPitch, + p_vout->p_rendered_pic->p_y + i*2*i_image_width, + i_image_width); + memcpy(ddsd.lpSurface + (i*2+1)*ddsd.u1.lPitch, + p_vout->p_rendered_pic->p_y + (i*2+1)*i_image_width, + i_image_width); + /* then V */ + memcpy((ddsd.lpSurface + ddsd.dwHeight * ddsd.u1.lPitch) + + i * ddsd.u1.lPitch/2, + p_vout->p_rendered_pic->p_v + i*i_image_width/2, + i_image_width/2); + /* and U */ + memcpy((ddsd.lpSurface + ddsd.dwHeight * ddsd.u1.lPitch) + + (ddsd.dwHeight * ddsd.u1.lPitch/4) + + i * ddsd.u1.lPitch/2, + p_vout->p_rendered_pic->p_u + i*i_image_width/2, + i_image_width/2); + } + + /* Unlock the Surface */ + dxresult = IDirectDrawSurface_Unlock(p_vout->p_sys->p_overlay, + ddsd.lpSurface ); + + } + +} + + +/* following functions are local */ + + +/***************************************************************************** + * WinDXEventProc: 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 + * "Nonqueued Messages". + * Queued Messages are those picked up and retransmitted by vout_Manage + * (using the GetMessage function). + * 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 ) +{ + switch( message ) + { + + case WM_ACTIVATEAPP: + intf_WarnMsg( 3, "vout: WinDX WinProc WM_ACTIVEAPP" ); + + break; + + case WM_SETCURSOR: + intf_WarnMsg( 3, "vout: WinDX WinProc WM_SETCURSOR" ); + /* turn the cursor off by setting it's value to NULL */ + SetCursor(NULL); + break; + + case WM_CREATE: + intf_WarnMsg( 3, "vout: WinDX WinProc WM_CREATE" ); + break; + + /* test your key states in this case */ + case WM_KEYDOWN: + intf_WarnMsg( 3, "vout: WinDX WinProc WM_KEYDOWN" ); + switch( wParam ) + { + case VK_ESCAPE: + case VK_F12: + PostMessage(hwnd,WM_CLOSE,0,0); + break; + + } + break; + + /* this case is touched when the application is shutting down */ + case WM_DESTROY: + intf_WarnMsg( 3, "vout: WinDX WinProc WM_DESTROY" ); + PostQuitMessage( 0 ); + break; + + case WM_QUIT: + intf_WarnMsg( 3, "vout: WinDX WinProc WM_QUIT" ); + break; + + case WM_SYSCOMMAND: + switch (wParam) + { + case SC_SCREENSAVE: /* catch the screensaver */ + case SC_MONITORPOWER: /* catch the monitor turn-off */ + intf_WarnMsg( 3, "vout: WinDX WinProc WM_SYSCOMMAND" ); + return 0; /* this stops them from happening */ + } + break; + + case WM_MOVE: + case WM_SIZE: + case WM_WINDOWPOSCHANGED: + intf_WarnMsg( 3, "vout: WinDX WinProc WM_MOVE, WMSIZE" ); + PostMessage(hwnd,WM_MOVE,0,0); + + break; + } + + return DefWindowProc(hwnd, message, wParam, lParam); +} + +/***************************************************************************** + * WinDXCreateWindow: 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 ) +{ + HINSTANCE hInstance; + WNDCLASS wc; /* window class components */ + RECT rect_window; + + intf_WarnMsg( 3, "vout: WinDX WinDXCreateWindow" ); + + /* get this module's instance */ + hInstance = GetModuleHandle(NULL); + + /* fill in the window class structure */ + wc.style = 0; /* no special styles */ + wc.lpfnWndProc = (WNDPROC)WinDXEventProc; /* event handler */ + wc.cbClsExtra = 0; /* no extra class data */ + wc.cbWndExtra = 0; /* no extra window data */ + wc.hInstance = hInstance; /* instance */ + wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); /* load a default icon */ + wc.hCursor = LoadCursor(NULL, IDC_ARROW); /* load a default cursor */ + wc.hbrBackground = NULL; /* redraw our own bg */ + wc.lpszMenuName = NULL; /* no menu */ + wc.lpszClassName = "VLC DirectX"; /* use a special class */ + + /* register the window class */ + if (!RegisterClass(&wc)) { + intf_WarnMsg( 3, "vout: WinDX register window FAILED" ); + return (1); + } + + /* when you create a window you give the dimensions you wish it to have. + * Unfortunatly these dimensions will include the borders and title bar. + * We use the following function to find out the size of the window + * corresponding to the useable surface we want */ + rect_window.top = 10; + rect_window.left = 10; + rect_window.right = rect_window.left + p_vout->p_sys->i_window_width; + rect_window.bottom = rect_window.top + p_vout->p_sys->i_window_height; + AdjustWindowRect( &rect_window, WS_OVERLAPPEDWINDOW|WS_SIZEBOX, 0 ); + + /* create the window */ + p_vout->p_sys->hwnd = CreateWindow("VLC DirectX",/* name of window class */ + "VLC DirectX", /* window title bar text */ + WS_OVERLAPPEDWINDOW + | WS_SIZEBOX | WS_VISIBLE, /* window style */ + 10, /* default X coordinate */ + 10, /* default Y coordinate */ + rect_window.right - rect_window.left, /* window width */ + rect_window.bottom - rect_window.top, /* window height */ + NULL, /* no parent window */ + NULL, /* no menu in this window */ + hInstance, /* handle of this program instance */ + NULL); /* no additional arguments */ + + if (p_vout->p_sys->hwnd == NULL) { + intf_WarnMsg( 3, "vout: WinDX create window FAILED" ); + return (1); + } + + /* now display the window */ + ShowWindow(p_vout->p_sys->hwnd, SW_SHOW); + + return ( 0 ); +} + +/***************************************************************************** + * WinDXInitDDraw: Takes care of all the DirectDraw initialisations + ***************************************************************************** + * This function initialise and allocate resources for DirectDraw. + *****************************************************************************/ +static int WinDXInitDDraw( vout_thread_t *p_vout ) +{ + HRESULT dxresult; + DWORD flags; + + intf_WarnMsg( 3, "vout: WinDX WinDXInitDDraw" ); + + /* Initialize DirectDraw */ + dxresult = DirectDrawCreate( NULL, &p_vout->p_sys->p_ddobject, NULL ); + if( dxresult != DD_OK ) + { + intf_ErrMsg( "vout error: can't initialize Direct Draw" ); + return( 1 ); + } + + /* Set DirectDraw Cooperative level, ie what control we want over Windows + display */ + if( p_vout->b_fullscreen ) + { + flags = DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN; + } + else + { + flags = DDSCL_NORMAL; + } + + dxresult = IDirectDraw_SetCooperativeLevel( p_vout->p_sys->p_ddobject, + p_vout->p_sys->hwnd, flags ); + if( dxresult != DD_OK ) + { + intf_ErrMsg( "vout error: can't set direct draw cooperative level." ); + IDirectDraw_Release(p_vout->p_sys->p_ddobject); + p_vout->p_sys->p_ddobject = NULL; + return( 1 ); + } + + return( 0 ); +} + +/***************************************************************************** + * WinDXCreateDisplay: 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 ) +{ + DDCAPS ddcaps; + HRESULT dxresult; + DDSURFACEDESC ddsd; + BOOL bHasOverlay, bHasColorKey, bCanStretch; + + /* Now create the primary surface. This surface is the displayed surface */ + /* The following two steps are important! */ + 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 ); + if( dxresult != DD_OK ) + { + intf_ErrMsg( "vout error: can't create direct draw primary surface." ); + p_vout->p_sys->p_display = NULL; + return( 1 ); + } + + /* 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 ) + { + intf_ErrMsg( "vout error: can't create clipper." ); + IDirectDrawSurface_Release( p_vout->p_sys->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 ) + { + 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 ); + } + + dxresult = IDirectDrawSurface_SetClipper(p_vout->p_sys->p_display, + p_vout->p_sys->p_clipper); + if( dxresult != DD_OK ) + { + intf_ErrMsg( "vout error: can't attach clipper to surface." ); + IDirectDrawSurface_Release( p_vout->p_sys->p_display ); + p_vout->p_sys->p_display = NULL; + return( 1 ); + } + + + /* Probe the capabilities of the hardware */ + /* This is just an indication of whever 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 ); + if(dxresult != DD_OK ) + { + intf_ErrMsg( "vout error: can't get caps." ); + bHasOverlay = FALSE; + bHasColorKey = FALSE; + bCanStretch = FALSE; + } + else + { + /* Determine if the hardware supports overlay surfaces */ + bHasOverlay = ((ddcaps.dwCaps & DDCAPS_OVERLAY) == + DDCAPS_OVERLAY) ? TRUE : FALSE; + /* Determine if the hardware supports colorkeying */ + bHasColorKey = ((ddcaps.dwCaps & DDCAPS_COLORKEY) == + DDCAPS_COLORKEY) ? TRUE : FALSE; + /* 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", + bHasOverlay, bHasColorKey, bCanStretch ); + } + + if( bHasOverlay && bHasColorKey && bCanStretch ) + { + if( !WinDXCreateYUVOverlay( p_vout ) ) + { + /* Overlay created successfully */ + p_vout->b_need_render = 0; + } + } + + + /* 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 */ + 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 ) + { + /* 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); + } + if( dxresult != DD_OK ) + { + intf_WarnMsg( 3, "vout: WinDX could not lock the surface" ); + return( 1 ); + } + + /* 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; + + + /* Set thread information */ + p_vout->i_width = ddsd.dwWidth; + p_vout->i_height = ddsd.dwHeight; + p_vout->i_bytes_per_line = ddsd.u1.lPitch; + + p_vout->i_screen_depth = ddsd.ddpfPixelFormat.u1.dwRGBBitCount; + p_vout->i_bytes_per_pixel = ddsd.ddpfPixelFormat.u1.dwRGBBitCount/8; + + p_vout->i_red_mask = ddsd.ddpfPixelFormat.u2.dwRBitMask; + p_vout->i_green_mask = ddsd.ddpfPixelFormat.u3.dwGBitMask; + p_vout->i_blue_mask = ddsd.ddpfPixelFormat.u4.dwBBitMask; + + /* Unlock the Surface */ + dxresult = IDirectDrawSurface_Unlock(p_vout->p_sys->p_display, + ddsd.lpSurface ); + /* FIXME: palette in 8bpp ?? */ + /* Set and initialize buffers */ + vout_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; + + /* Set thread information */ + p_vout->i_width = ddsd.dwWidth; + p_vout->i_height = ddsd.dwHeight; + p_vout->i_bytes_per_line = ddsd.u1.lPitch; + + /* Unlock the Surface */ + dxresult = IDirectDrawSurface_Unlock(p_vout->p_sys->p_overlay, + ddsd.lpSurface ); + + vout_SetBuffers( p_vout, p_vout->p_sys->p_windx_buf[ 0 ], + p_vout->p_sys->p_windx_buf[ 1 ] ); + } + + return( 0 ); +} + +/***************************************************************************** + * WinDXCreateYUVOveraly: create an YUV overlay surface for the video. + ***************************************************************************** + * 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. + *****************************************************************************/ +static int WinDXCreateYUVOverlay( 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. + * This color will be painted by WinDXClipOverlay which in turn is called + * by a WM_PAINT event */ + + 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'); + ddsd.ddpfPixelFormat.u1.dwYUVBitCount = 16; + + 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 ); + if( dxresult != DD_OK ) + { + intf_ErrMsg( "vout error: can't create overlay surface." ); + } + else + { + intf_WarnMsg( 3, "vout: WinDX YUV overlay created successfully" ); + } + /* 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 ); +} + +/***************************************************************************** + * WinDXUpdateOverlay: 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 ) +{ + DDOVERLAYFX ddofx; + RECT rect_window, rect_client; + DWORD dwFlags; + HRESULT dxresult; + + if( p_vout->p_sys->p_overlay == NULL || p_vout->b_need_render) + { + intf_WarnMsg( 3, "vout: WinDX no overlay !!" ); + return( 0 ); + } + + if( !p_vout->p_sys->b_display_enabled ) + { + return( 0 ); + } + + + /* 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 rect_client.right = rect_client.top = 0 */ + GetWindowRect(p_vout->p_sys->hwnd, &rect_window); + GetClientRect(p_vout->p_sys->hwnd, &rect_client);; + rect_window.left = ( (rect_window.right - rect_window.left) - + rect_client.right ) / 2 + rect_window.left; + rect_window.right = rect_window.left + rect_client.right; + rect_window.top = rect_window.bottom - rect_client.bottom; + + /* We want to keep the aspect ratio of the video */ + if( p_vout->b_scale ) + { + switch( p_vout->p_rendered_pic->i_aspect_ratio ) + { + case AR_16_9_PICTURE: + if( ((rect_window.right-rect_window.left)*9) + > ((rect_window.bottom-rect_window.top)*16) ) + { + int temp; + temp = (rect_window.bottom-rect_window.top)*16/9; + temp = (rect_window.right-rect_window.left) - temp; + rect_window.left += (temp/2); + rect_window.right -= (temp/2); + } + else + { + int temp; + temp = (rect_window.right-rect_window.left)*9/16; + temp = (rect_window.bottom-rect_window.top) - temp; + rect_window.top += (temp/2); + rect_window.bottom -= (temp/2); + } + break; + + case AR_221_1_PICTURE: + if( ((rect_window.right-rect_window.left)*100) + > ((rect_window.bottom-rect_window.top)*221) ) + { + int temp; + temp = (rect_window.bottom-rect_window.top)*221/100; + temp = (rect_window.right-rect_window.left) - temp; + rect_window.left += (temp/2); + rect_window.right -= (temp/2); + } + else + { + int temp; + temp = (rect_window.right-rect_window.left)*100/221; + temp = (rect_window.bottom-rect_window.top) - temp; + rect_window.top += (temp/2); + rect_window.bottom -= (temp/2); + } + break; + + case AR_SQUARE_PICTURE: + if( (rect_window.right-rect_window.left) + > (rect_window.bottom-rect_window.top) ) + { + int temp; + temp = (rect_window.bottom-rect_window.top); + temp = (rect_window.right-rect_window.left) - temp; + rect_window.left += (temp/2); + rect_window.right -= (temp/2); + } + else + { + int temp; + temp = (rect_window.right-rect_window.left); + temp = (rect_window.bottom-rect_window.top) - temp; + rect_window.top += (temp/2); + rect_window.bottom -= (temp/2); + } + break; + + case AR_3_4_PICTURE: + default: + if( ((rect_window.right-rect_window.left)*3) + > ((rect_window.bottom-rect_window.top)*4) ) + { + int temp; + temp = (rect_window.bottom-rect_window.top)*4/3; + temp = (rect_window.right-rect_window.left) - temp; + rect_window.left += (temp/2); + rect_window.right -= (temp/2); + } + else + { + int temp; + temp = (rect_window.right-rect_window.left)*3/4; + temp = (rect_window.bottom-rect_window.top) - temp; + rect_window.top += (temp/2); + rect_window.bottom -= (temp/2); + } + break; + } + } + + + /* Position and show the overlay */ + memset(&ddofx, 0, sizeof(DDOVERLAYFX)); + ddofx.dwSize = sizeof(DDOVERLAYFX); + ddofx.dckDestColorkey.dwColorSpaceLowValue = OVERLAY_COLOR_KEY; + ddofx.dckDestColorkey.dwColorSpaceHighValue = OVERLAY_COLOR_KEY; + + dwFlags = DDOVER_KEYDESTOVERRIDE | DDOVER_SHOW; + + dxresult = IDirectDrawSurface_UpdateOverlay(p_vout->p_sys->p_overlay, + NULL, + p_vout->p_sys->p_display, + &rect_window, + dwFlags, + &ddofx); + if(dxresult != DD_OK) + { + intf_WarnMsg( 3, "vout: WinDX WM_MOVE can't move or resize overlay" ); + } + + return ( 0 ); +} + +/***************************************************************************** + * WinDXClipOveraly: Clip overlay surface on video display. + ***************************************************************************** + * The overlay is displayed on top of the primary surface (which is the + * screen). + * This overlay must be clipped whenever another window is supposed to cover + * it. + * For this, we use a color key which we paint on the parts of the window + * which aren't covered by anything else. The video adapter will then only + * display the overlay on the surfaces painted with this color key. + * This function is called whenever a WM_PAINT event is generated + * (in vout_Manage). + *****************************************************************************/ +static int WinDXClipOverlay( vout_thread_t *p_vout ) +{ + PAINTSTRUCT ps; + POINT ptClient; + RECT rectBlt; + DDBLTFX ddbfx; + + if( p_vout->p_sys->p_overlay == NULL || p_vout->b_need_render) + { + intf_WarnMsg( 3, "vout: WinDX no overlay !!" ); + return( 0 ); + } + + BeginPaint(p_vout->p_sys->hwnd, &ps); + + /* Fill the client area with colour key */ + ptClient.x = ps.rcPaint.left; + ptClient.y = ps.rcPaint.top; + ClientToScreen(p_vout->p_sys->hwnd, &ptClient); + rectBlt.left = ptClient.x; + rectBlt.top = ptClient.y; + + ptClient.x = ps.rcPaint.right; + ptClient.y = ps.rcPaint.bottom; + ClientToScreen(p_vout->p_sys->hwnd, &ptClient); + rectBlt.right = ptClient.x; + rectBlt.bottom = ptClient.y; + + memset(&ddbfx, 0, sizeof(DDBLTFX)); + ddbfx.dwSize = sizeof(DDBLTFX); + ddbfx.u5.dwFillColor = OVERLAY_COLOR_KEY; + + IDirectDrawSurface_Blt(p_vout->p_sys->p_display, + &rectBlt, + NULL, + &rectBlt, + DDBLT_COLORFILL, // | DDBLT_WAIT, + &ddbfx); + + EndPaint(p_vout->p_sys->hwnd, &ps); + + return ( 0 ); +} + +/***************************************************************************** + * WinDXCloseWindow: close the window created by WinDXCreateWindow + ***************************************************************************** + * This function returns all resources allocated by WinDXCreateWindow. + *****************************************************************************/ +static void WinDXCloseWindow( vout_thread_t *p_vout ) +{ + HINSTANCE hInstance; + + if( p_vout->p_sys->hwnd != INVALID_HANDLE_VALUE ) + { + DestroyWindow( p_vout->p_sys->hwnd); + p_vout->p_sys->hwnd = INVALID_HANDLE_VALUE; + } + + hInstance = GetModuleHandle(NULL); + UnregisterClass( "VLC DirectX", /* class name */ + hInstance ); /* handle to application instance */ + +} + +/***************************************************************************** + * WinDXCloseDDraw: Release the DDraw object allocated by WinDXInitDDraw + ***************************************************************************** + * This function returns all resources allocated by WinDXInitDDraw. + *****************************************************************************/ +static void WinDXCloseDDraw( vout_thread_t *p_vout ) +{ + if( p_vout->p_sys->p_ddobject != NULL ) + { + IDirectDraw_Release(p_vout->p_sys->p_ddobject); + p_vout->p_sys->p_ddobject = NULL; + } +} + +/***************************************************************************** + * WinDXCloseDisplay: close and reset DirectX device + ***************************************************************************** + * This function returns all resources allocated by WinDXCreateDisplay and + * restore the original state of the device. + *****************************************************************************/ +static void WinDXCloseDisplay( vout_thread_t *p_vout ) +{ + if( p_vout->p_sys->p_display != NULL ) + { + if( p_vout->p_sys->p_overlay != NULL ) + { + IDirectDraw_Release( p_vout->p_sys->p_overlay ); + p_vout->p_sys->p_overlay = NULL; + } + + if( p_vout->p_sys->p_clipper != NULL ) + { + IDirectDraw_Release( p_vout->p_sys->p_clipper ); + p_vout->p_sys->p_clipper = NULL; + } + + IDirectDraw_Release( p_vout->p_sys->p_display ); + p_vout->p_sys->p_display = NULL; + } +} + +/***************************************************************************** + * WinDXCloseYUVOverlay: close the overlay surface + ***************************************************************************** + * This function returns all resources allocated by the overlay 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 ) +{ + if( p_vout->p_sys->p_overlay != NULL ) + { + IDirectDraw_Release( p_vout->p_sys->p_overlay ); + p_vout->p_sys->p_overlay = NULL; + } + p_vout->p_sys->b_display_enabled = 0; +} + diff --git a/plugins/gtk/gtk_menu.c b/plugins/gtk/gtk_menu.c index 0ee02d7027..cefa5e4486 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.8 2001/05/31 16:10:05 stef Exp $ + * $Id: gtk_menu.c,v 1.9 2001/06/02 01:09:03 sam Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -59,6 +59,12 @@ #include "modules_export.h" +#ifdef WIN32 +#ifndef snprintf +#define snprintf _snprintf +#endif +#endif + /* * Local Prototypes */ diff --git a/plugins/mpeg/input_ts.c b/plugins/mpeg/input_ts.c index a85a534766..8e9bd63c41 100644 --- a/plugins/mpeg/input_ts.c +++ b/plugins/mpeg/input_ts.c @@ -2,7 +2,7 @@ * input_ts.c: TS demux and netlist management ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: input_ts.c,v 1.24 2001/05/31 03:57:54 sam Exp $ + * $Id: input_ts.c,v 1.25 2001/06/02 01:09:03 sam Exp $ * * Authors: Henri Fallon * @@ -10,7 +10,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -143,13 +143,13 @@ static int TSProbe( probedata_t * p_data ) psz_name += 5; } - if( ( strlen(psz_name) > 3 ) && + if( ( strlen(psz_name) > 3 ) && !strncasecmp( psz_name+strlen(psz_name)-3, ".ts", 3) ) { /* If it is a ".ts" file it's probably a TS file ... */ return( 900 ); } - + i_handle = open( psz_name, 0 ); if( i_handle == -1 ) { @@ -182,16 +182,16 @@ static void TSInit( input_thread_t * p_input ) p_input->p_plugin_data = (void *)p_method; p_input->p_method_data = NULL; - - + + /* Initialize netlist */ - if( input_NetlistInit( p_input, NB_DATA, NB_PES, TS_PACKET_SIZE, + if( input_NetlistInit( p_input, NB_DATA, NB_PES, TS_PACKET_SIZE, INPUT_READ_ONCE ) ) { intf_ErrMsg( "TS input : Could not initialize netlist" ); return; } - + /* Initialize the stream */ input_InitStream( p_input, sizeof( stream_ts_data_t ) ); @@ -204,7 +204,7 @@ static void TSInit( input_thread_t * p_input ) p_stream_data = (stream_ts_data_t *)p_input->stream.p_demux_data; p_stream_data->i_pat_version = PAT_UNINITIALIZED ; - /* We'll have to catch the PAT in order to continue + /* We'll have to catch the PAT in order to continue * Then the input will catch the PMT and then the others ES * The PAT es is indepedent of any program. */ p_pat_es = input_AddES( p_input, NULL, @@ -214,7 +214,7 @@ static void TSInit( input_thread_t * p_input ) p_demux_data->i_psi_type = PSI_IS_PAT; p_demux_data->p_psi_section = malloc(sizeof(psi_section_t)); p_demux_data->p_psi_section->b_is_complete = 1; - + } /***************************************************************************** @@ -247,7 +247,7 @@ void TSFakeOpen( input_thread_t * p_input ) static void TSEnd( input_thread_t * p_input ) { es_descriptor_t * p_pat_es; - + p_pat_es = input_FindES( p_input, 0x00 ); if( p_pat_es != NULL ) @@ -269,54 +269,53 @@ static int TSRead( input_thread_t * p_input, int i_data; struct iovec * p_iovec; struct timeval s_wait; - + /* Get iovecs */ p_iovec = input_NetlistGetiovec( p_input->p_method_data ); - + if ( p_iovec == NULL ) { return( -1 ); /* empty netlist */ - } + } /* Init */ p_method = ( thread_ts_data_t * )p_input->p_plugin_data; - + /* Initialize file descriptor set */ - FD_ZERO( &(p_method->s_fdset) ); - FD_SET( p_input->i_handle, &(p_method->s_fdset) ); + FD_ZERO( &(p_method->fds) ); + FD_SET( p_input->i_handle, &(p_method->fds) ); - /* We'll wait 0.5 second if nothing happens */ s_wait.tv_sec = 0; s_wait.tv_usec = 500000; - + /* Reset pointer table */ memset( pp_packets, 0, INPUT_READ_ONCE * sizeof(data_packet_t *) ); - + /* Fill if some data is available */ - i_data = select( p_input->i_handle + 1, &(p_method->s_fdset), NULL, NULL, + i_data = select( p_input->i_handle + 1, &(p_method->fds), NULL, NULL, &s_wait); - + if( i_data == -1 ) { intf_ErrMsg( "input error: TS select error (%s)", strerror(errno) ); return( -1 ); } - + if( i_data ) { i_read = readv( p_input->i_handle, p_iovec, INPUT_READ_ONCE ); - + if( i_read == -1 ) { intf_ErrMsg( "input error: TS readv error" ); return( -1 ); } - - input_NetlistMviovec( p_input->p_method_data, + + input_NetlistMviovec( p_input->p_method_data, (int)(i_read/TS_PACKET_SIZE) , pp_packets ); - + /* check correct TS header */ for( i_loop=0; i_loop * TS_PACKET_SIZE < i_read; i_loop++ ) { diff --git a/plugins/mpeg/input_ts.h b/plugins/mpeg/input_ts.h index 633c3e7b92..f37ad7b6df 100644 --- a/plugins/mpeg/input_ts.h +++ b/plugins/mpeg/input_ts.h @@ -2,7 +2,7 @@ * input_ts.h: structures of the input not exported to other modules ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: input_ts.h,v 1.6 2001/05/31 01:37:08 sam Exp $ + * $Id: input_ts.h,v 1.7 2001/06/02 01:09:03 sam Exp $ * * Authors: Henri Fallon * @@ -29,6 +29,6 @@ typedef struct thread_ts_data_s { // FILE * stream; - fd_set s_fdset; + fd_set fds; } thread_ts_data_t; diff --git a/src/interface/intf_msg.c b/src/interface/intf_msg.c index 5b47a3fdb6..62e2cc101d 100644 --- a/src/interface/intf_msg.c +++ b/src/interface/intf_msg.c @@ -4,7 +4,7 @@ * interface, such as message output. See config.h for output configuration. ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: intf_msg.c,v 1.35 2001/05/31 01:37:08 sam Exp $ + * $Id: intf_msg.c,v 1.36 2001/06/02 01:09:03 sam Exp $ * * Authors: Vincent Seguin * @@ -50,8 +50,10 @@ #include "main.h" #ifdef WIN32 +#ifndef snprintf #define snprintf _snprintf /* snprintf not defined in mingw32 (bug?) */ #endif +#endif /***************************************************************************** * intf_msg_item_t diff --git a/include/modules_builtin.h.in b/src/misc/modules_builtin.h.in similarity index 100% rename from include/modules_builtin.h.in rename to src/misc/modules_builtin.h.in diff --git a/include/modules_core.h b/src/misc/modules_core.h similarity index 98% rename from include/modules_core.h rename to src/misc/modules_core.h index c56bc0fc28..7f154283b5 100644 --- a/include/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.6 2001/05/31 12:45:39 sam Exp $ + * $Id: modules_core.h,v 1.1 2001/06/02 01:09:03 sam Exp $ * * Authors: Samuel Hocevar * diff --git a/src/misc/netutils.c b/src/misc/netutils.c index 5d163c2dfe..b1bdcc18fb 100644 --- a/src/misc/netutils.c +++ b/src/misc/netutils.c @@ -2,7 +2,7 @@ * netutils.c: various network functions ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: netutils.c,v 1.36 2001/05/31 01:37:08 sam Exp $ + * $Id: netutils.c,v 1.37 2001/06/02 01:09:03 sam Exp $ * * Authors: Vincent Seguin * Benoit Steiner @@ -262,7 +262,7 @@ int network_ChannelJoin( int i_channel ) struct timeval answer_delay; int i_nbanswer; char i_answer; - fd_set fd; + fd_set fds; unsigned int i_rc; char * psz_channel_server; @@ -369,9 +369,9 @@ int network_ChannelJoin( int i_channel ) */ answer_delay.tv_sec = 5; answer_delay.tv_usec = 0; - FD_ZERO( &fd ); - FD_SET( i_socket, &fd ); - i_nbanswer = select( i_socket + 1, &fd, NULL, NULL, &answer_delay ); + FD_ZERO( &fds ); + FD_SET( i_socket, &fds ); + i_nbanswer = select( i_socket + 1, &fds, NULL, NULL, &answer_delay ); switch( i_nbanswer ) { diff --git a/src/spu_decoder/spu_decoder.c b/src/spu_decoder/spu_decoder.c index d3818b34c5..1d02bb0dd2 100644 --- a/src/spu_decoder/spu_decoder.c +++ b/src/spu_decoder/spu_decoder.c @@ -2,7 +2,7 @@ * spu_decoder.c : spu decoder thread ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: spu_decoder.c,v 1.46 2001/05/31 01:37:08 sam Exp $ + * $Id: spu_decoder.c,v 1.47 2001/06/02 01:09:03 sam Exp $ * * Authors: Samuel Hocevar * @@ -412,6 +412,7 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, case SPU_CMD_FORCE_DISPLAY: /* 00 (force displaying) */ + p_spu->i_start = p_spudec->i_pts + ( i_date * 11000 ); b_force_display = 1; break;