From 88a154951c7ed40ebe06896208fab71e91537971 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Borel?= Date: Sat, 13 Oct 2001 15:34:21 +0000 Subject: [PATCH] New features for libdvdcss: we have three ways now to decode a title key. 1) Crack the title key (the method that was here before). The only change here is that we search the key for the exact chapter we are seeking with DVDSetArea (in case the key has changed within a title). It is maybe not a good idea. 2) Crack the disc key, which allows us to decode instantly all title keys. I've used an algorithm from Frank Stevenson ; it eats much memory (64MB), and takes about 15 s at launch time. 3) Decode the disc key with player keys (libcss method). However, you need licensed player keys at build time for that to work. To choose between libdvdcss methods, a command line options is supplied: vlc --dvdcss where method is one of title, disc, key. Note that all these changes only work with linux now, since we have to add a specific ioctl to read title key. I hope that I haven't broken too many things. --- configure | 567 +++++++++++++------------- configure.in | 3 + extras/libdvdcss/css.c | 624 +++++++++++++++++++++++------ extras/libdvdcss/css.h | 10 +- extras/libdvdcss/csstables.h | 3 +- extras/libdvdcss/ioctl.c | 63 ++- extras/libdvdcss/ioctl.h | 6 +- extras/libdvdcss/libdvdcss.c | 132 +++--- extras/libdvdcss/libdvdcss.h | 3 +- extras/libdvdcss/videolan/dvdcss.h | 16 +- include/config.h.in | 2 + include/defs.h.in | 3 + plugins/dvd/dvd_ifo.c | 7 +- plugins/dvd/dvd_udf.c | 4 +- plugins/dvd/input_dvd.c | 54 ++- src/audio_output/aout_spdif.c | 4 +- src/interface/main.c | 49 ++- 17 files changed, 1011 insertions(+), 539 deletions(-) diff --git a/configure b/configure index e19db23fc2..91f2f93c53 100755 --- a/configure +++ b/configure @@ -719,13 +719,19 @@ if test -r extras/libdvdcss/libdvdcss.c; then HAVE_LIBDVDCSS=1 LIBDVDCSS_VERSION=0.0.3 + if test -r extras/libdvdcss/csskeys.h; then + cat >> confdefs.h <<\EOF +#define HAVE_CSSKEYS 1 +EOF + + fi fi save_CFLAGS="${CFLAGS}" save_LDFLAGS="${LDFLAGS}" echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:729: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:735: 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 @@ -754,7 +760,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:758: checking for $ac_word" >&5 +echo "configure:764: 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 @@ -784,7 +790,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:788: checking for $ac_word" >&5 +echo "configure:794: 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 @@ -835,7 +841,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:839: checking for $ac_word" >&5 +echo "configure:845: 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 @@ -867,7 +873,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:871: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:877: 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. @@ -878,12 +884,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 882 "configure" +#line 888 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:893: \"$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 @@ -909,12 +915,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:913: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:919: 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:918: checking whether we are using GNU C" >&5 +echo "configure:924: 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 @@ -923,7 +929,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:927: \"$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:933: \"$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 @@ -942,7 +948,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:946: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:952: 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 @@ -974,7 +980,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:978: checking how to run the C preprocessor" >&5 +echo "configure:984: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -989,13 +995,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:999: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1005: \"$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 : @@ -1006,13 +1012,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:1016: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1022: \"$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 : @@ -1023,13 +1029,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:1033: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1039: \"$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 : @@ -1056,7 +1062,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:1060: checking for $ac_word" >&5 +echo "configure:1066: 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 @@ -1096,7 +1102,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:1100: checking for a BSD compatible install" >&5 +echo "configure:1106: 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 @@ -1151,14 +1157,14 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' if test x${cross_compiling} != xyes; then echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:1155: checking whether byte ordering is bigendian" >&5 +echo "configure:1161: 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 @@ -1169,11 +1175,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1179: \"$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 @@ -1184,7 +1190,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1188: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1194: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -1204,7 +1210,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:1227: \"$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 @@ -1257,7 +1263,7 @@ fi *) ac_cv_c_bigendian=unknown echo $ac_n "checking what the byte order looks to be""... $ac_c" 1>&6 -echo "configure:1261: checking what the byte order looks to be" >&5 +echo "configure:1267: checking what the byte order looks to be" >&5 cat >conftest.c <&6 -echo "configure:1306: checking for $ac_func" >&5 +echo "configure:1312: 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:1340: \"$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 @@ -1357,12 +1363,12 @@ done for ac_func in setenv putenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1361: checking for $ac_func" >&5 +echo "configure:1367: 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:1395: \"$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 @@ -1410,12 +1416,12 @@ fi done echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:1414: checking for connect" >&5 +echo "configure:1420: 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:1448: \"$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 @@ -1457,7 +1463,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:1461: checking for connect in -lsocket" >&5 +echo "configure:1467: 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 @@ -1465,7 +1471,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:1486: \"$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 @@ -1500,12 +1506,12 @@ fi fi echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:1504: checking for gethostbyname" >&5 +echo "configure:1510: 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:1538: \"$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 @@ -1547,7 +1553,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1551: checking for gethostbyname in -lnsl" >&5 +echo "configure:1557: 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 @@ -1555,7 +1561,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:1576: \"$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 @@ -1590,12 +1596,12 @@ fi fi echo $ac_n "checking for nanosleep""... $ac_c" 1>&6 -echo "configure:1594: checking for nanosleep" >&5 +echo "configure:1600: 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:1628: \"$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 @@ -1637,7 +1643,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for nanosleep in -lrt""... $ac_c" 1>&6 -echo "configure:1641: checking for nanosleep in -lrt" >&5 +echo "configure:1647: 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 @@ -1645,7 +1651,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:1666: \"$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 @@ -1676,7 +1682,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for nanosleep in -lposix4""... $ac_c" 1>&6 -echo "configure:1680: checking for nanosleep in -lposix4" >&5 +echo "configure:1686: 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 @@ -1684,7 +1690,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:1705: \"$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 @@ -1724,12 +1730,12 @@ fi for ac_func in usleep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1728: checking for $ac_func" >&5 +echo "configure:1734: 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:1762: \"$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 @@ -1777,12 +1783,12 @@ fi done echo $ac_n "checking for inet_aton""... $ac_c" 1>&6 -echo "configure:1781: checking for inet_aton" >&5 +echo "configure:1787: 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:1815: \"$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 @@ -1824,7 +1830,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for inet_aton in -lresolv""... $ac_c" 1>&6 -echo "configure:1828: checking for inet_aton in -lresolv" >&5 +echo "configure:1834: 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 @@ -1832,7 +1838,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:1853: \"$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 @@ -1869,12 +1875,12 @@ fi for ac_func in vasprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1873: checking for $ac_func" >&5 +echo "configure:1879: 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:1907: \"$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 @@ -1924,12 +1930,12 @@ done for ac_func in swab do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1928: checking for $ac_func" >&5 +echo "configure:1934: 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:1962: \"$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 @@ -1979,12 +1985,12 @@ done for ac_func in memalign valloc do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1983: checking for $ac_func" >&5 +echo "configure:1989: 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:2017: \"$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 @@ -2035,12 +2041,12 @@ done for ac_func in sigrelse do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2039: checking for $ac_func" >&5 +echo "configure:2045: 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:2073: \"$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 @@ -2090,12 +2096,12 @@ done NEED_GETOPT=0 echo $ac_n "checking for getopt_long""... $ac_c" 1>&6 -echo "configure:2094: checking for getopt_long" >&5 +echo "configure:2100: 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:2128: \"$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 @@ -2140,7 +2146,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:2144: checking for getopt_long in -lgnugetopt" >&5 +echo "configure:2150: 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 @@ -2148,7 +2154,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:2169: \"$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 @@ -2190,17 +2196,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:2194: checking for $ac_hdr" >&5 +echo "configure:2200: 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:2204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2210: \"$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* @@ -2229,12 +2235,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2233: checking for $ac_func" >&5 +echo "configure:2239: 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:2267: \"$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 @@ -2282,7 +2288,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:2286: checking for working mmap" >&5 +echo "configure:2292: 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 @@ -2290,7 +2296,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext < #include #include -#include -#include - -#ifdef HAVE_UNISTD_H -# include -#endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include +# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -2380,7 +2383,7 @@ main() /* * First, make a file with some known garbage in it. */ - data = (char*)malloc(pagesize); + data = malloc(pagesize); if (!data) exit(1); for (i = 0; i < pagesize; ++i) @@ -2401,7 +2404,7 @@ main() fd = open("conftestmmap", O_RDWR); if (fd < 0) exit(1); - data2 = (char*)malloc(2 * pagesize); + data2 = malloc(2 * pagesize); if (!data2) exit(1); data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); @@ -2419,7 +2422,7 @@ main() */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; - data3 = (char*)malloc(pagesize); + data3 = malloc(pagesize); if (!data3) exit(1); if (read(fd, data3, pagesize) != pagesize) @@ -2433,7 +2436,7 @@ main() } EOF -if { (eval echo configure:2437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2440: \"$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 @@ -2456,12 +2459,12 @@ EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2460: checking return type of signal handlers" >&5 +echo "configure:2463: 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 @@ -2478,7 +2481,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2482: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2485: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2497,7 +2500,7 @@ EOF echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:2501: checking for dlopen in -ldl" >&5 +echo "configure:2504: 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 @@ -2505,7 +2508,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:2523: \"$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 @@ -2537,7 +2540,7 @@ else fi echo $ac_n "checking for pow in -lm""... $ac_c" 1>&6 -echo "configure:2541: checking for pow in -lm" >&5 +echo "configure:2544: 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 @@ -2545,7 +2548,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:2563: \"$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 @@ -2580,7 +2583,7 @@ fi THREAD_LIB=error if test "x${THREAD_LIB}" = xerror; then echo $ac_n "checking for pthread_attr_init in -lpthread""... $ac_c" 1>&6 -echo "configure:2584: checking for pthread_attr_init in -lpthread" >&5 +echo "configure:2587: 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 @@ -2588,7 +2591,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:2606: \"$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 @@ -2622,7 +2625,7 @@ fi fi if test "x${THREAD_LIB}" = xerror; then echo $ac_n "checking for pthread_attr_init in -lpthreads""... $ac_c" 1>&6 -echo "configure:2626: checking for pthread_attr_init in -lpthreads" >&5 +echo "configure:2629: 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 @@ -2630,7 +2633,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:2648: \"$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 @@ -2664,7 +2667,7 @@ fi fi if test "x${THREAD_LIB}" = xerror; then echo $ac_n "checking for pthread_attr_init in -lc_r""... $ac_c" 1>&6 -echo "configure:2668: checking for pthread_attr_init in -lc_r" >&5 +echo "configure:2671: 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 @@ -2672,7 +2675,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:2690: \"$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 @@ -2706,12 +2709,12 @@ fi fi if test "x${THREAD_LIB}" = xerror; then echo $ac_n "checking for pthread_attr_init""... $ac_c" 1>&6 -echo "configure:2710: checking for pthread_attr_init" >&5 +echo "configure:2713: 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:2741: \"$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 @@ -2757,7 +2760,7 @@ fi fi echo $ac_n "checking for cthread_fork in -lthreads""... $ac_c" 1>&6 -echo "configure:2761: checking for cthread_fork in -lthreads" >&5 +echo "configure:2764: checking for cthread_fork in -lthreads" >&5 ac_lib_var=`echo threads'_'cthread_fork | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2765,7 +2768,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lthreads $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2783: \"$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 @@ -2798,7 +2801,7 @@ fi cat > conftest.$ac_ext < EOF @@ -2814,7 +2817,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -2834,17 +2837,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:2838: checking for $ac_hdr" >&5 +echo "configure:2841: 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:2848: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2851: \"$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* @@ -2874,17 +2877,17 @@ for ac_hdr in sys/sockio.h fcntl.h sys/time.h sys/times.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2878: checking for $ac_hdr" >&5 +echo "configure:2881: 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:2888: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2891: \"$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* @@ -2914,17 +2917,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:2918: checking for $ac_hdr" >&5 +echo "configure:2921: 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:2928: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2931: \"$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* @@ -2954,17 +2957,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:2958: checking for $ac_hdr" >&5 +echo "configure:2961: 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:2968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2971: \"$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* @@ -2994,17 +2997,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:2998: checking for $ac_hdr" >&5 +echo "configure:3001: 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:3008: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3011: \"$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* @@ -3034,17 +3037,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:3038: checking for $ac_hdr" >&5 +echo "configure:3041: 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:3048: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3051: \"$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* @@ -3075,17 +3078,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:3079: checking for $ac_hdr" >&5 +echo "configure:3082: 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:3089: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3092: \"$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* @@ -3113,20 +3116,20 @@ done echo $ac_n "checking for ntohl in sys/param.h""... $ac_c" 1>&6 -echo "configure:3117: checking for ntohl in sys/param.h" >&5 +echo "configure:3120: checking for ntohl in sys/param.h" >&5 if eval "test \"`echo '$''{'ac_cv_c_ntohl_sys_param_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else CFLAGS="${save_CFLAGS} -Wall -Werror" cat > conftest.$ac_ext < int main() { void foo() { int meuh; ntohl(meuh); } ; return 0; } EOF -if { (eval echo configure:3130: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_ntohl_sys_param_h=yes else @@ -3147,20 +3150,20 @@ EOF fi echo $ac_n "checking if \$CC accepts -finline-limit""... $ac_c" 1>&6 -echo "configure:3151: checking if \$CC accepts -finline-limit" >&5 +echo "configure:3154: checking if \$CC accepts -finline-limit" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline_limit'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else CFLAGS="${save_CFLAGS} -finline-limit-30000" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3167: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline_limit=yes else @@ -3178,20 +3181,20 @@ if test x"$ac_cv_c_inline_limit" != x"no"; then fi echo $ac_n "checking if \$CC accepts -bundle -undefined error""... $ac_c" 1>&6 -echo "configure:3182: checking if \$CC accepts -bundle -undefined error" >&5 +echo "configure:3185: checking if \$CC accepts -bundle -undefined error" >&5 if eval "test \"`echo '$''{'ac_cv_ld_darwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else CFLAGS="${save_CFLAGS} -bundle -undefined error" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3198: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_ld_darwin=yes else @@ -3209,20 +3212,20 @@ if test x"$ac_cv_ld_darwin" != x"no"; then fi echo $ac_n "checking if \$CC accepts -shared""... $ac_c" 1>&6 -echo "configure:3213: checking if \$CC accepts -shared" >&5 +echo "configure:3216: checking if \$CC accepts -shared" >&5 if eval "test \"`echo '$''{'ac_cv_ld_plugins'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else CFLAGS="${save_CFLAGS} -shared" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3229: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_ld_plugins=yes else @@ -3241,7 +3244,7 @@ fi if test x"${SOFLAGS}" = x; then echo $ac_n "checking for soname setting""... $ac_c" 1>&6 -echo "configure:3245: checking for soname setting" >&5 +echo "configure:3248: checking for soname setting" >&5 if eval "test \"`echo '$''{'ac_cv_ld_soname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3250,14 +3253,14 @@ else try_SOFLAGS="-Wl,-soname -Wl," LDFLAGS="${save_LDFLAGS} ${try_SOFLAGS}foo.so.0" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_ld_soname="${try_SOFLAGS}" else @@ -3269,14 +3272,14 @@ else try_SOFLAGS="-Wl,-h -Wl," LDFLAGS="${save_LDFLAGS} ${try_SOFLAGS}foo.so.0" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_ld_soname="${try_SOFLAGS}" else @@ -3308,19 +3311,19 @@ CFLAGS="${save_CFLAGS}" LDFLAGS="${save_LDFLAGS}" echo $ac_n "checking for boolean_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:3312: checking for boolean_t in sys/types.h" >&5 +echo "configure:3315: checking for boolean_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_c_boolean_t_sys_types_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { void quux() { boolean_t foo; } ; return 0; } EOF -if { (eval echo configure:3324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3327: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_boolean_t_sys_types_h=yes else @@ -3341,19 +3344,19 @@ EOF fi echo $ac_n "checking for boolean_t in pthread.h""... $ac_c" 1>&6 -echo "configure:3345: checking for boolean_t in pthread.h" >&5 +echo "configure:3348: checking for boolean_t in pthread.h" >&5 if eval "test \"`echo '$''{'ac_cv_c_boolean_t_pthread_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { void quux() { boolean_t foo; } ; return 0; } EOF -if { (eval echo configure:3357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3360: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_boolean_t_pthread_h=yes else @@ -3374,19 +3377,19 @@ EOF fi echo $ac_n "checking for boolean_t in cthreads.h""... $ac_c" 1>&6 -echo "configure:3378: checking for boolean_t in cthreads.h" >&5 +echo "configure:3381: checking for boolean_t in cthreads.h" >&5 if eval "test \"`echo '$''{'ac_cv_c_boolean_t_cthreads_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { void quux() { boolean_t foo; } ; return 0; } EOF -if { (eval echo configure:3390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3393: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_boolean_t_cthreads_h=yes else @@ -3407,18 +3410,18 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3411: checking for working const" >&5 +echo "configure:3414: 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:3468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3482,12 +3485,12 @@ EOF fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3486: checking for ANSI C header files" >&5 +echo "configure:3489: 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 @@ -3495,7 +3498,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3499: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3502: \"$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* @@ -3512,7 +3515,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 @@ -3530,7 +3533,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 @@ -3551,7 +3554,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3562,7 +3565,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:3566: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -3586,12 +3589,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3590: checking for size_t" >&5 +echo "configure:3593: 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 @@ -3619,12 +3622,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:3623: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:3626: 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 @@ -3633,7 +3636,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:3637: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3640: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -3655,21 +3658,21 @@ fi echo $ac_n "checking __attribute__ ((aligned ())) support""... $ac_c" 1>&6 -echo "configure:3659: checking __attribute__ ((aligned ())) support" >&5 +echo "configure:3662: checking __attribute__ ((aligned ())) support" >&5 if eval "test \"`echo '$''{'ac_cv_c_attribute_aligned'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_attribute_aligned=0 for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3676: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_attribute_aligned=$ac_cv_c_attr_align_try else @@ -3702,19 +3705,19 @@ SSE_MODULES="imdctsse downmixsse" ALTIVEC_MODULES="idctaltivec motionaltivec" echo $ac_n "checking if \$CC groks MMX inline assembly""... $ac_c" 1>&6 -echo "configure:3706: checking if \$CC groks MMX inline assembly" >&5 +echo "configure:3709: checking if \$CC groks MMX inline assembly" >&5 if eval "test \"`echo '$''{'ac_cv_mmx_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3721: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mmx_inline=yes else @@ -3732,19 +3735,19 @@ if test x"$ac_cv_mmx_inline" != x"no"; then fi echo $ac_n "checking if \$CC groks MMX EXT inline assembly""... $ac_c" 1>&6 -echo "configure:3736: checking if \$CC groks MMX EXT inline assembly" >&5 +echo "configure:3739: checking if \$CC groks MMX EXT inline assembly" >&5 if eval "test \"`echo '$''{'ac_cv_mmxext_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mmxext_inline=yes else @@ -3762,19 +3765,19 @@ if test x"$ac_cv_mmxext_inline" != x"no"; then fi echo $ac_n "checking if \$CC groks 3D Now! inline assembly""... $ac_c" 1>&6 -echo "configure:3766: checking if \$CC groks 3D Now! inline assembly" >&5 +echo "configure:3769: checking if \$CC groks 3D Now! inline assembly" >&5 if eval "test \"`echo '$''{'ac_cv_3dnow_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3781: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_3dnow_inline=yes else @@ -3792,19 +3795,19 @@ if test x"$ac_cv_3dnow_inline" != x"no"; then fi echo $ac_n "checking if \$CC groks SSE inline assembly""... $ac_c" 1>&6 -echo "configure:3796: checking if \$CC groks SSE inline assembly" >&5 +echo "configure:3799: checking if \$CC groks SSE inline assembly" >&5 if eval "test \"`echo '$''{'ac_cv_sse_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3811: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sse_inline=yes else @@ -3822,19 +3825,19 @@ if test x"$ac_cv_sse_inline" != x"no"; then fi echo $ac_n "checking if \$CC groks Altivec inline assembly""... $ac_c" 1>&6 -echo "configure:3826: checking if \$CC groks Altivec inline assembly" >&5 +echo "configure:3829: checking if \$CC groks Altivec inline assembly" >&5 if eval "test \"`echo '$''{'ac_cv_altivec_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3841: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_altivec_inline=yes else @@ -3844,14 +3847,14 @@ else save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -Wa,-m7400" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3858: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_altivec_inline=yes; CFLAGS_ALTIVEC="-Wa,-m7400" else @@ -3873,7 +3876,7 @@ if test x"$ac_cv_altivec_inline" != x"no"; then fi echo $ac_n "checking if \$CC groks Altivec C extensions""... $ac_c" 1>&6 -echo "configure:3877: checking if \$CC groks Altivec C extensions" >&5 +echo "configure:3880: checking if \$CC groks Altivec C extensions" >&5 if eval "test \"`echo '$''{'ac_cv_c_altivec'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3881,14 +3884,14 @@ else CFLAGS="$CFLAGS -faltivec" # Darwin test cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_altivec=-faltivec else @@ -3899,14 +3902,14 @@ else # Linux/PPC test CFLAGS="$save_CFLAGS $CFLAGS_ALTIVEC -fvec" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3913: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_altivec="-fvec" else @@ -3933,21 +3936,21 @@ EOF fi echo $ac_n "checking if linker needs -framework vecLib""... $ac_c" 1>&6 -echo "configure:3937: checking if linker needs -framework vecLib" >&5 +echo "configure:3940: checking if linker needs -framework vecLib" >&5 if eval "test \"`echo '$''{'ac_cv_ld_altivec'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -framework vecLib" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_ld_altivec=yes else @@ -3973,17 +3976,17 @@ for ac_hdr in winioctl.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3977: checking for $ac_hdr" >&5 +echo "configure:3980: 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:3987: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3990: \"$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* @@ -4016,17 +4019,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:4020: checking for $ac_hdr" >&5 +echo "configure:4023: 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:4030: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4033: \"$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* @@ -4052,17 +4055,17 @@ EOF do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4056: checking for $ac_hdr" >&5 +echo "configure:4059: 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:4066: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4069: \"$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* @@ -4091,7 +4094,7 @@ done BSD_DVD_STRUCT=0 LINUX_DVD_STRUCT=0 cat > conftest.$ac_ext < EOF @@ -4109,7 +4112,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -4127,7 +4130,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -4146,7 +4149,7 @@ rm -f conftest* NEED_BSDI_LIBDVD=0 cat > conftest.$ac_ext < EOF @@ -4168,17 +4171,17 @@ else do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4172: checking for $ac_hdr" >&5 +echo "configure:4175: 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:4182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4185: \"$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* @@ -4218,17 +4221,17 @@ rm -f conftest* ac_safe=`echo "sys/scsi/scsi_types.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/scsi/scsi_types.h""... $ac_c" 1>&6 -echo "configure:4222: checking for sys/scsi/scsi_types.h" >&5 +echo "configure:4225: checking for sys/scsi/scsi_types.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4232: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4235: \"$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* @@ -4247,17 +4250,17 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ac_safe=`echo "sys/scsi/impl/uscsi.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/scsi/impl/uscsi.h""... $ac_c" 1>&6 -echo "configure:4251: checking for sys/scsi/impl/uscsi.h" >&5 +echo "configure:4254: checking for sys/scsi/impl/uscsi.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4261: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4264: \"$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* @@ -4409,7 +4412,7 @@ if test "${enable_pth+set}" = set; then enableval="$enable_pth" if test x$enableval = xyes; then echo $ac_n "checking for pth_init in -lpth""... $ac_c" 1>&6 -echo "configure:4413: checking for pth_init in -lpth" >&5 +echo "configure:4416: checking for pth_init in -lpth" >&5 ac_lib_var=`echo pth'_'pth_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4417,7 +4420,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpth $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4435: \"$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 @@ -4456,7 +4459,7 @@ else fi cat > conftest.$ac_ext < EOF @@ -4620,7 +4623,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:4624: checking for $ac_word" >&5 +echo "configure:4627: 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 @@ -4687,17 +4690,17 @@ else do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4691: checking for $ac_hdr" >&5 +echo "configure:4694: 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:4701: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4704: \"$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* @@ -4742,17 +4745,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4746: checking for $ac_hdr" >&5 +echo "configure:4749: 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:4756: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4759: \"$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* @@ -4830,7 +4833,7 @@ fi # Extract the first word of "sdl12-config", so it can be a program name with args. set dummy sdl12-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4834: checking for $ac_word" >&5 +echo "configure:4837: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SDL12_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4870,7 +4873,7 @@ fi # Extract the first word of "sdl11-config", so it can be a program name with args. set dummy sdl11-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4874: checking for $ac_word" >&5 +echo "configure:4877: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SDL11_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4911,7 +4914,7 @@ fi # Extract the first word of "sdl-config", so it can be a program name with args. set dummy sdl-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4915: checking for $ac_word" >&5 +echo "configure:4918: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SDL_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4957,17 +4960,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4961: checking for $ac_hdr" >&5 +echo "configure:4964: 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:4971: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4974: \"$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* @@ -5030,17 +5033,17 @@ if test "${with_directx+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:5034: checking for $ac_hdr" >&5 +echo "configure:5037: 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:5044: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5047: \"$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* @@ -5079,17 +5082,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5083: checking for $ac_hdr" >&5 +echo "configure:5086: 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:5093: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5096: \"$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* @@ -5186,7 +5189,7 @@ if test "${enable_gnome+set}" = set; then # Extract the first word of "gnome-config", so it can be a program name with args. set dummy gnome-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5190: checking for $ac_word" >&5 +echo "configure:5193: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GNOME_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5231,17 +5234,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5235: checking for $ac_hdr" >&5 +echo "configure:5238: 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:5245: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5248: \"$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* @@ -5291,7 +5294,7 @@ 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:5295: checking for $ac_word" >&5 +echo "configure:5298: 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 @@ -5336,17 +5339,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5340: checking for $ac_hdr" >&5 +echo "configure:5343: 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:5350: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5353: \"$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* @@ -5397,17 +5400,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:5401: checking for $ac_hdr" >&5 +echo "configure:5404: 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:5411: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5414: \"$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* @@ -5459,17 +5462,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:5463: checking for $ac_hdr" >&5 +echo "configure:5466: 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:5473: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5476: \"$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* @@ -5509,17 +5512,17 @@ if test "${enable_alsa+set}" = set; then then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6 -echo "configure:5513: checking for sys/asoundlib.h" >&5 +echo "configure:5516: 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:5523: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5526: \"$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* @@ -5536,7 +5539,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:5540: checking for main in -lasound" >&5 +echo "configure:5543: 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 @@ -5544,14 +5547,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:5558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else diff --git a/configure.in b/configure.in index f27c22d561..1ed187484a 100644 --- a/configure.in +++ b/configure.in @@ -18,6 +18,9 @@ if test -r extras/libdvdcss/libdvdcss.c; then HAVE_LIBDVDCSS=1 LIBDVDCSS_VERSION=0.0.3 AC_SUBST(LIBDVDCSS_VERSION) + if test -r extras/libdvdcss/csskeys.h; then + AC_DEFINE(HAVE_CSSKEYS,1,css decryption with player keys) + fi fi dnl Save CFLAGS and LDFLAGS diff --git a/extras/libdvdcss/css.c b/extras/libdvdcss/css.c index 6232a6a0e5..ab77984ce7 100644 --- a/extras/libdvdcss/css.c +++ b/extras/libdvdcss/css.c @@ -2,7 +2,7 @@ * css.c: Functions for DVD authentification and unscrambling ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: css.c,v 1.9 2001/09/09 13:43:25 sam Exp $ + * $Id: css.c,v 1.10 2001/10/13 15:34:21 stef Exp $ * * Author: Stéphane Borel * Håkan Hjort @@ -40,6 +40,18 @@ #include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + #include "config.h" #include "common.h" @@ -49,13 +61,20 @@ #include "csstables.h" #include "ioctl.h" +#ifdef HAVE_CSSKEYS +# include "csskeys.h" +#endif + + /***************************************************************************** * Local prototypes *****************************************************************************/ static int CSSGetASF ( dvdcss_handle dvdcss ); static void CSSCryptKey ( int i_key_type, int i_varient, u8 const * p_challenge, u8* p_key ); -static int CSSCracker ( int i_start, unsigned char * p_crypted, +static void CSSDecryptKey( u8* p_crypted, u8* p_key, u8 ); +static int CSSDiscCrack ( u8 * p_disc_key ); +static int CSSTitleCrack( int i_start, unsigned char * p_crypted, unsigned char * p_decrypted, dvd_key_t * p_sector_key, dvd_key_t * p_key ); @@ -81,21 +100,22 @@ int CSSTest( dvdcss_handle dvdcss ) } /***************************************************************************** - * CSSInit : CSS Structure initialisation and DVD authentication. + * CSSAuth : CSS Structure initialisation and DVD authentication. ***************************************************************************** * It simulates the mutual authentication between logical unit and host. * Since we don't need the disc key to find the title key, we just run the * basic unavoidable commands to authenticate device and disc. *****************************************************************************/ -int CSSInit( dvdcss_handle dvdcss ) +int CSSAuth( dvdcss_handle dvdcss ) { /* structures defined in cdrom.h or dvdio.h */ - unsigned char p_buffer[2048 + 4 + 1]; + unsigned char p_buffer[10]; char psz_warning[32]; - int i_agid = 0; int i_ret = -1; int i; + dvdcss->css.i_agid = 0; + /* Test authentication success */ switch( CSSGetASF( dvdcss ) ) { @@ -104,10 +124,11 @@ int CSSInit( dvdcss_handle dvdcss ) case 1: _dvdcss_debug( dvdcss, "already authenticated" ); - return 0; + break; case 0: _dvdcss_debug( dvdcss, "need to authenticate" ); + break; } /* Init sequence, request AGID */ @@ -116,7 +137,7 @@ int CSSInit( dvdcss_handle dvdcss ) sprintf( psz_warning, "requesting AGID %d", i ); _dvdcss_debug( dvdcss, psz_warning ); - i_ret = ioctl_ReportAgid( dvdcss->i_fd, &i_agid ); + i_ret = ioctl_ReportAgid( dvdcss->i_fd, &dvdcss->css.i_agid ); if( i_ret != -1 ) { @@ -126,8 +147,8 @@ int CSSInit( dvdcss_handle dvdcss ) _dvdcss_error( dvdcss, "ioctl_ReportAgid failed, invalidating" ); - i_agid = 0; - ioctl_InvalidateAgid( dvdcss->i_fd, &i_agid ); + dvdcss->css.i_agid = 0; + ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid ); } /* Unable to authenticate without AGID */ @@ -149,14 +170,14 @@ int CSSInit( dvdcss_handle dvdcss ) } /* Send challenge to LU */ - if( ioctl_SendChallenge( dvdcss->i_fd, &i_agid, p_buffer ) < 0 ) + if( ioctl_SendChallenge( dvdcss->i_fd, &dvdcss->css.i_agid, p_buffer ) < 0 ) { _dvdcss_error( dvdcss, "ioctl_SendChallenge failed" ); return -1; } /* Get key1 from LU */ - if( ioctl_ReportKey1( dvdcss->i_fd, &i_agid, p_buffer ) < 0) + if( ioctl_ReportKey1( dvdcss->i_fd, &dvdcss->css.i_agid, p_buffer ) < 0) { _dvdcss_error( dvdcss, "ioctl_ReportKey1 failed" ); return -1; @@ -190,7 +211,7 @@ int CSSInit( dvdcss_handle dvdcss ) } /* Get challenge from LU */ - if( ioctl_ReportChallenge( dvdcss->i_fd, &i_agid, p_buffer ) < 0 ) + if( ioctl_ReportChallenge( dvdcss->i_fd, &dvdcss->css.i_agid, p_buffer ) < 0 ) { _dvdcss_error( dvdcss, "ioctl_ReportKeyChallenge failed" ); return -1; @@ -213,7 +234,7 @@ int CSSInit( dvdcss_handle dvdcss ) } /* Send key2 to LU */ - if( ioctl_SendKey2( dvdcss->i_fd, &i_agid, p_buffer ) < 0 ) + if( ioctl_SendKey2( dvdcss->i_fd, &dvdcss->css.i_agid, p_buffer ) < 0 ) { _dvdcss_error( dvdcss, "ioctl_SendKey2 failed" ); return -1; @@ -232,7 +253,7 @@ int CSSInit( dvdcss_handle dvdcss ) _dvdcss_debug( dvdcss, "received session key" ); - if( i_agid < 0 ) + if( dvdcss->css.i_agid < 0 ) { return -1; } @@ -249,12 +270,38 @@ int CSSInit( dvdcss_handle dvdcss ) case 0: _dvdcss_debug( dvdcss, "need to get disc key" ); + return 0; + } + + return -1; +} + +/***************************************************************************** + * CSSGetDiscKey : get disc key and optionnaly decrypts it. + ***************************************************************************** + * This function should only be called if DVD ioctls are present. + * Two decryption methods are then offered: + * -disc key hash crack, + * -decryption with player keys if they are available. + *****************************************************************************/ +int CSSGetDiscKey( dvdcss_handle dvdcss ) +{ + unsigned char p_buffer[2048 + 4 + 1]; +#ifdef HAVE_CSSKEYS + dvd_key_t disc_key; + dvd_key_t test_key; +#endif + int i; + + if( CSSAuth( dvdcss ) ) + { + return -1; } /* Get encrypted disc key */ - if( ioctl_ReadKey( dvdcss->i_fd, &i_agid, p_buffer ) < 0 ) + if( ioctl_ReadDiscKey( dvdcss->i_fd, &dvdcss->css.i_agid, p_buffer ) < 0 ) { - _dvdcss_error( dvdcss, "ioctl_ReadKey failed" ); + _dvdcss_error( dvdcss, "ioctl_ReadDiscKey failed" ); return -1; } @@ -263,134 +310,195 @@ int CSSInit( dvdcss_handle dvdcss ) { p_buffer[ i ] ^= dvdcss->css.disc.p_key_check[ 4 - (i % KEY_SIZE) ]; } - memcpy( dvdcss->css.disc.p_key_check, p_buffer, 2048 ); + memcpy( dvdcss->css.disc.p_disc_key, p_buffer, 2048 ); - /* Test authentication success */ - switch( CSSGetASF( dvdcss ) ) + switch( dvdcss->i_method ) { - case -1: - return -1; + case DVDCSS_KEY: +#ifdef HAVE_CSSKEYS + /* Decrypt disc key with player keys from csskeys.h */ + _dvdcss_debug( dvdcss, "decrypting disc key with player keys" ); + i = 0; + do + { + /* Take encrypted disc key and decrypt it */ + memcpy( disc_key, + dvdcss->css.disc.p_disc_key + + playerkeys[i].i_offset, + KEY_SIZE ); + CSSDecryptKey( disc_key, playerkeys[i].p_key, 0 ); - case 1: - _dvdcss_debug( dvdcss, "successfully authenticated" ); - return 0; + /* Encrypt disc key hash with disc key to + * check we have disc key */ + memcpy( test_key, dvdcss->css.disc.p_disc_key, KEY_SIZE ); + CSSDecryptKey( test_key, disc_key, 0); - case 0: - _dvdcss_error( dvdcss, "no way to authenticate" ); - return -1; + i++; + + } while( ( playerkeys[i].i_offset != -1 ) && + ( memcmp( test_key, disc_key, KEY_SIZE ) ) ); + + /* The decrypted disk key will replace the disk key hash */ + memcpy( dvdcss->css.disc.p_disc_key, disc_key, KEY_SIZE ); + break; +#else + dvdcss->i_method = DVDCSS_DISC; +#endif + case DVDCSS_DISC: + /* Crack Disc key to be able to use it */ + _dvdcss_debug( dvdcss, "cracking disc key with key hash" ); + CSSDiscCrack( dvdcss->css.disc.p_disc_key ); + break; + + default: + _dvdcss_debug( dvdcss, "disc key won't be decrypted" ); } - return -1; + return 0; } + /***************************************************************************** - * CSSGetKey : get title key. - ***************************************************************************** - * The DVD should have been opened and authenticated before. + * CSSGetTitleKey : get title key. *****************************************************************************/ -int CSSGetKey( dvdcss_handle dvdcss, int i_pos, dvd_key_t p_titlekey ) +int CSSGetTitleKey( dvdcss_handle dvdcss, int i_pos ) { - /* - * Title key cracking method from Ethan Hawke, - * with Frank A. Stevenson algorithm. - * Does not use any player key table and ioctls. - */ - u8 p_buf[0x800]; - u8 p_packstart[4] = { 0x00, 0x00, 0x01, 0xba }; dvd_key_t p_key; - boolean_t b_encrypted; - boolean_t b_stop_scanning; - int i_blocks_read; - int i_best_plen; - int i_best_p; int i,j; - for( i = 0 ; i < KEY_SIZE ; i++ ) + if( ( dvdcss->i_method == DVDCSS_TITLE ) || ( dvdcss->b_ioctls == 0 ) ) { - p_key[i] = 0; - } - - b_encrypted = 0; - b_stop_scanning = 0; - i_blocks_read = 0; - - do - { - i_pos = dvdcss_seek( dvdcss, i_pos ); - if( dvdcss_read( dvdcss, p_buf, 1, DVDCSS_NOFLAGS ) != 1 ) break; - - /* Stop when we find a non MPEG stream block */ - if( memcmp( p_buf, p_packstart, 4 ) ) + /* + * Title key cracking method from Ethan Hawke, + * with Frank A. Stevenson algorithm. + * Does not use any player key table and ioctls. + */ + u8 p_buf[0x800]; + u8 p_packstart[4] = { 0x00, 0x00, 0x01, 0xba }; + boolean_t b_encrypted; + boolean_t b_stop_scanning; + int i_blocks_read; + int i_best_plen; + int i_best_p; + + for( i = 0 ; i < KEY_SIZE ; i++ ) { - /* The title is unencrypted */ - if( !b_encrypted ) - break; - /* dvdcss some times fail to find/crack the key, - hope that it's the same as the one in the next title - _dvdcss_debug( dvdcss, "no key found at end of title" ); - */ + p_key[i] = 0; } - /* PES_scrambling_control on and make sure that the packet type - is one that can be scrambled */ - if( p_buf[0x14] & 0x30 && ! ( p_buf[0x11] == 0xbb - || p_buf[0x11] == 0xbe - || p_buf[0x11] == 0xbf ) ) + b_encrypted = 0; + b_stop_scanning = 0; + i_blocks_read = 0; + + do { - b_encrypted = 1; - i_best_plen = 0; - i_best_p = 0; + i_pos = dvdcss_seek( dvdcss, i_pos, DVDCSS_NOFLAGS ); + if( dvdcss_read( dvdcss, p_buf, 1, DVDCSS_NOFLAGS ) != 1 ) break; - for( i = 2 ; i < 0x30 ; i++ ) + /* Stop when we find a non MPEG stream block */ + if( memcmp( p_buf, p_packstart, 4 ) ) { - for( j = i+1 ; - j < 0x80 && ( p_buf[0x7F - (j%i)] == p_buf[0x7F-j] ); - j++ ); + /* The title is unencrypted */ + if( !b_encrypted ) + break; + /* dvdcss some times fail to find/crack the key, + hope that it's the same as the one in the next title + _dvdcss_debug( dvdcss, "no key found at end of title" ); + */ + } + + /* PES_scrambling_control on and make sure that the packet type + is one that can be scrambled */ + if( p_buf[0x14] & 0x30 && ! ( p_buf[0x11] == 0xbb + || p_buf[0x11] == 0xbe + || p_buf[0x11] == 0xbf ) ) + { + b_encrypted = 1; + i_best_plen = 0; + i_best_p = 0; + + for( i = 2 ; i < 0x30 ; i++ ) { - if( j > i_best_plen ) + for( j = i+1 ; + j < 0x80 && ( p_buf[0x7F - (j%i)] == p_buf[0x7F-j] ); + j++ ); { - i_best_plen = j; - i_best_p = i; + if( j > i_best_plen ) + { + i_best_plen = j; + i_best_p = i; + } } } - } - if( ( i_best_plen > 20 ) && ( i_best_plen / i_best_p >= 2) ) - { - i = CSSCracker( 0, &p_buf[0x80], - &p_buf[0x80 - ( i_best_plen / i_best_p) *i_best_p], - (dvd_key_t*)&p_buf[0x54], - &p_key ); - b_stop_scanning = ( i >= 0 ); + if( ( i_best_plen > 20 ) && ( i_best_plen / i_best_p >= 2) ) + { + i = CSSTitleCrack( 0, &p_buf[0x80], + &p_buf[0x80 - ( i_best_plen / i_best_p) *i_best_p], + (dvd_key_t*)&p_buf[0x54], + &p_key ); + b_stop_scanning = ( i >= 0 ); + } } - } - i_pos += 1; - i_blocks_read += 1; + i_pos += 1; + i_blocks_read += 1; - /* If we haven't seen any encrypted ones after 3000 blocks stop */ - if( !b_encrypted && i_blocks_read >= 1000 ) break; + /* If we haven't seen any encrypted ones after 3000 blocks stop */ + if( !b_encrypted && i_blocks_read >= 1000 ) break; - } while( !b_stop_scanning ); + } while( !b_stop_scanning ); - if( b_stop_scanning ) - { - memcpy( p_titlekey, &p_key, sizeof(dvd_key_t) ); - _dvdcss_debug( dvdcss, "vts key initialized" ); - return 0; - } + if( b_stop_scanning ) + { + memcpy( dvdcss->css.p_title_key, &p_key, sizeof(dvd_key_t) ); + _dvdcss_debug( dvdcss, "vts key initialized" ); + return 0; + } - if( !b_encrypted ) - { - _dvdcss_debug( dvdcss, "file was unscrambled" ); - return 0; + if( !b_encrypted ) + { + _dvdcss_debug( dvdcss, "file was unscrambled" ); + return 0; + } + + return -1; } + else + { + /* + * if we are here we have a decrypted disc key and ioctls are available + * so we can read the title key and decrypt it. + */ + + /* We need to authenticate again for every key + * (to get a new session key ?) */ + CSSAuth( dvdcss ); + + /* Get encrypted title key */ + if( ioctl_ReadTitleKey( dvdcss->i_fd, &dvdcss->css.i_agid, + i_pos, p_key ) < 0 ) + { + _dvdcss_error( dvdcss, "ioctl_ReadTitleKey failed" ); + return -1; + } + /* Unencrypt title key using bus key */ + for( i = 0 ; i < KEY_SIZE ; i++ ) + { + p_key[ i ] ^= dvdcss->css.disc.p_key_check[ 4 - (i % KEY_SIZE) ]; + } - return -1; + /* Title key decryption needs one inversion 0xff */ + CSSDecryptKey( p_key, dvdcss->css.disc.p_disc_key, 0xff ); + + memcpy( dvdcss->css.p_title_key, p_key, sizeof(dvd_key_t) ); + + return 0; + } // ( dvdcss->i_method == DVDCSS_TITLECRACK ) || ( dvdcss->b_ioctls == 0 ) } /***************************************************************************** - * CSSDescrambleSector + * CSSDescrambleSector: does the actual descrambling of data ***************************************************************************** * sec : sector to descramble * key : title key for this sector @@ -420,7 +528,7 @@ int CSSDescrambleSector( dvd_key_t p_key, u8* p_sec ) i_t1 = ( ( i_t1 & 1 ) << 8 ) ^ i_t4; i_t4 = p_css_tab5[i_t4]; i_t6 = ((((((( i_t3 >> 3 ) ^ i_t3 ) >> 1 ) ^ - i_t3 ) >> 8 ) ^ i_t3 ) >> 5) & 0xff; + i_t3 ) >> 8 ) ^ i_t3 ) >> 5 ) & 0xff; i_t3 = (i_t3 << 8 ) | i_t6; i_t6 = p_css_tab4[i_t6]; i_t5 += i_t6 + i_t4; @@ -473,7 +581,7 @@ static int CSSGetASF( dvdcss_handle dvdcss ) /***************************************************************************** * CSSCryptKey : shuffles bits and unencrypt keys. ***************************************************************************** - * Used during authentication and disc key negociation in CSSInit. + * Used during authentication and disc key negociation in CSSAuth. * i_key_type : 0->key1, 1->key2, 2->buskey. * i_varient : between 0 and 31. *****************************************************************************/ @@ -678,15 +786,296 @@ static void CSSCryptKey( int i_key_type, int i_varient, } /***************************************************************************** - * CSSCracker : title key decryption by cracking + * CSSDecryptKey: decrypt p_crypted with p_key. + ***************************************************************************** + * Decryption is slightly dependant on the type of key: + * -for disc key, invert is 0x00, + * -for title key, invert if 0xff. + *****************************************************************************/ +static void CSSDecryptKey( u8* p_crypted, u8* p_key, u8 invert ) +{ + unsigned int i_lfsr1_lo; + unsigned int i_lfsr1_hi; + unsigned int i_lfsr0; + unsigned int i_combined; + byte_t o_lfsr0; + byte_t o_lfsr1; + byte_t k[5]; + int i; + + i_lfsr1_lo = p_key[0] | 0x100; + i_lfsr1_hi = p_key[1]; + + i_lfsr0 = ( ( p_key[4] << 17 ) + | ( p_key[3] << 9 ) + | ( p_key[2] << 1 ) ) + + 8 - ( p_key[2] & 7 ); + i_lfsr0 = ( p_css_tab4[i_lfsr0 & 0xff] << 24 ) | + ( p_css_tab4[( i_lfsr0 >> 8 ) & 0xff] << 16 ) | + ( p_css_tab4[( i_lfsr0 >> 16 ) & 0xff] << 8 ) | + p_css_tab4[( i_lfsr0 >> 24 ) & 0xff]; + + i_combined = 0; + for( i = 0 ; i < KEY_SIZE ; ++i ) + { + o_lfsr1 = p_css_tab2[i_lfsr1_hi] ^ p_css_tab3[i_lfsr1_lo]; + i_lfsr1_hi = i_lfsr1_lo >> 1; + i_lfsr1_lo = ( ( i_lfsr1_lo & 1 ) << 8 ) ^ o_lfsr1; + o_lfsr1 = p_css_tab4[o_lfsr1]; + + o_lfsr0 = ((((((( i_lfsr0 >> 8 ) ^ i_lfsr0 ) >> 1 ) + ^ i_lfsr0 ) >> 3 ) ^ i_lfsr0 ) >> 7 ); + i_lfsr0 = ( i_lfsr0 >> 8 ) | ( o_lfsr0 << 24 ); + + i_combined += ( o_lfsr0 ^ invert ) + o_lfsr1; + k[i] = i_combined & 0xff; + i_combined >>= 8; + } + + p_crypted[4] = k[4] ^ p_css_tab1[p_crypted[4]] ^ p_crypted[3]; + p_crypted[3] = k[3] ^ p_css_tab1[p_crypted[3]] ^ p_crypted[2]; + p_crypted[2] = k[2] ^ p_css_tab1[p_crypted[2]] ^ p_crypted[1]; + p_crypted[1] = k[1] ^ p_css_tab1[p_crypted[1]] ^ p_crypted[0]; + p_crypted[0] = k[0] ^ p_css_tab1[p_crypted[0]] ^ p_crypted[4]; + + p_crypted[4] = k[4] ^ p_css_tab1[p_crypted[4]] ^ p_crypted[3]; + p_crypted[3] = k[3] ^ p_css_tab1[p_crypted[3]] ^ p_crypted[2]; + p_crypted[2] = k[2] ^ p_css_tab1[p_crypted[2]] ^ p_crypted[1]; + p_crypted[1] = k[1] ^ p_css_tab1[p_crypted[1]] ^ p_crypted[0]; + p_crypted[0] = k[0] ^ p_css_tab1[p_crypted[0]]; + + return; +} + +/***************************************************************************** + * CSSDiscCrack: brute force disc key + * CSS hash reversal function designed by Frank Stevenson ***************************************************************************** - * This function is called by CSSGetKeys to find a key + * This function uses a big amount of memory to crack the disc key from the + * disc key hash, if player keys are not available. *****************************************************************************/ -static int CSSCracker( int i_start, - unsigned char * p_crypted, - unsigned char * p_decrypted, - dvd_key_t * p_sector_key, - dvd_key_t * p_key ) +#define K1TABLEWIDTH 10 + +/* + * Simple function to test if a candidate key produces the given hash + */ +static int investigate( unsigned char* hash, unsigned char *ckey ) +{ + unsigned char key[5]; + unsigned char pkey[5]; + + memcpy( key, hash, 5 ); + memcpy( pkey, ckey, 5 ); + + CSSDecryptKey( key, pkey, 0 ); + + return memcmp( key, pkey, 5 ); +} + +static int CSSDiscCrack( u8 * p_disc_key ) +{ + unsigned char B[5] = { 0,0,0,0,0 }; /* Second Stage of mangle cipher */ + unsigned char C[5] = { 0,0,0,0,0 }; /* Output Stage of mangle cipher + * IntermediateKey */ + unsigned char k[5] = { 0,0,0,0,0 }; /* Mangling cipher key + * Also output from CSS( C ) */ + unsigned char out1[5]; /* five first output bytes of LFSR1 */ + unsigned char out2[5]; /* five first output bytes of LFSR2 */ + unsigned int lfsr1a; /* upper 9 bits of LFSR1 */ + unsigned int lfsr1b; /* lower 8 bits of LFSR1 */ + unsigned int tmp, tmp2, tmp3, tmp4,tmp5; + int i,j; + unsigned int nStepA; /* iterator for LFSR1 start state */ + unsigned int nStepB; /* iterator for possible B[0] */ + unsigned int nTry; /* iterator for K[1] possibilities */ + unsigned int nPossibleK1; /* #of possible K[1] values */ + unsigned char* K1table; /* Lookup table for possible K[1] */ + unsigned int* BigTable; /* LFSR2 startstate indexed by + * 1,2,5 output byte */ + + /* + * Prepare tables for hash reversal + */ + + /* initialize lookup tables for k[1] */ + K1table = malloc( 65536 * K1TABLEWIDTH ); + memset( K1table, 0 , 65536 * K1TABLEWIDTH ); + if( K1table == NULL ) + { + return -1; + } + + tmp = p_disc_key[0] ^ p_css_tab1[ p_disc_key[1] ]; + for( i = 0 ; i < 256 ; i++ ) /* k[1] */ + { + tmp2 = p_css_tab1[ tmp ^ i ]; /* p_css_tab1[ B[1] ]*/ + + for( j = 0 ; j < 256 ; j++ ) /* B[0] */ + { + tmp3 = j ^ tmp2 ^ i; /* C[1] */ + tmp4 = K1table[ K1TABLEWIDTH * ( 256 * j + tmp3 ) ]; /* count of entries here */ + tmp4++; + if( tmp4 == K1TABLEWIDTH ) + { +// _dvdcss_debug( dvdcss, "Table disaster %d", tmp4 ); + } + if( tmp4 < K1TABLEWIDTH ) + { + K1table[ K1TABLEWIDTH * ( 256 * j + tmp3 ) + tmp4 ] = i; + } + K1table[ K1TABLEWIDTH * ( 256 * j + tmp3 ) ] = tmp4; + } + } + + /* Initing our Really big table */ + BigTable = malloc( 16777216 * sizeof(int) ); + memset( BigTable, 0 , 16777216 * sizeof(int) ); + if( BigTable == NULL ) + { + return -1; + } + + tmp3 = 0; + + for( i = 0 ; i < 16777216 ; i++ ) + { +/* + if( ( i & 0x07ffff ) == 0 ) + { + printf( "#" ); + fflush( stdout ); + } +*/ + tmp = (( i + i ) & 0x1fffff0 ) | 0x8 | ( i & 0x7 ); + + for( j = 0 ; j < 5 ; j++ ) + { + tmp2=((((((( tmp >> 3 ) ^ tmp ) >> 1 ) ^ tmp ) >> 8 ) + ^ tmp ) >> 5 ) & 0xff; + tmp = ( tmp << 8) | tmp2; + out2[j] = p_css_tab4[ tmp2 ]; + } + + j = ( out2[0] << 16 ) | ( out2[1] << 8 ) | out2[4]; + BigTable[j] = i; + } + +// printf( "\n" ); + + /* + * We are done initing, now reverse hash + */ + tmp5 = p_disc_key[0] ^ p_css_tab1[ p_disc_key[1] ]; + + for( nStepA = 0 ; nStepA < 65536 ; nStepA ++ ) + { + lfsr1a = 0x100 | ( nStepA >> 8 ); + lfsr1b = nStepA & 0xff; + + /* Generate 5 first output bytes from lfsr1 */ + for( i = 0 ; i < 5 ; i++ ) + { + tmp = p_css_tab2[ lfsr1b ] ^ p_css_tab3[ lfsr1a ]; + lfsr1b = lfsr1a >> 1; + lfsr1a = ((lfsr1a&1)<<8) ^ tmp; + out1[ i ] = p_css_tab4[ tmp ]; + } + + /* cumpute and cache some variables */ + C[0] = nStepA >> 8; + C[1] = nStepA & 0xff; + tmp = p_disc_key[3] ^ p_css_tab1[ p_disc_key[4] ]; + tmp2 = p_css_tab1[ p_disc_key[0] ]; + + /* Search through all possible B[0] */ + for( nStepB = 0 ; nStepB < 256 ; nStepB++ ) + { + /* reverse parts of the mangling cipher */ + B[0] = nStepB; + k[0] = p_css_tab1[ B[0] ] ^ C[0]; + B[4] = B[0] ^ k[0] ^ tmp2; + k[4] = B[4] ^ tmp; + nPossibleK1 = K1table[ K1TABLEWIDTH * (256 * B[0] + C[1]) ]; + + /* Try out all possible values for k[1] */ + for( nTry = 0 ; nTry < nPossibleK1 ; nTry++ ) + { + k[1] = K1table[ K1TABLEWIDTH * (256 * B[0] + C[1]) + nTry + 1 ]; + B[1] = tmp5 ^ k[1]; + + /* reconstruct output from LFSR2 */ + tmp3 = ( 0x100 + k[0] - out1[0] ); + out2[0] = tmp3 & 0xff; + tmp3 = tmp3 & 0x100 ? 0x100 : 0xff; + tmp3 = ( tmp3 + k[1] - out1[1] ); + out2[1] = tmp3 & 0xff; + tmp3 = ( 0x100 + k[4] - out1[4] ); + out2[4] = tmp3 & 0xff; /* Can be 1 off */ + + /* test first possible out2[4] */ + tmp4 = ( out2[0] << 16 ) | ( out2[1] << 8 ) | out2[4]; + tmp4 = BigTable[ tmp4 ]; + C[2] = tmp4 & 0xff; + C[3] = ( tmp4 >> 8 ) & 0xff; + C[4] = ( tmp4 >> 16 ) & 0xff; + B[3] = p_css_tab1[ B[4] ] ^ k[4] ^ C[4]; + k[3] = p_disc_key[2] ^ p_css_tab1[ p_disc_key[3] ] ^ B[3]; + B[2] = p_css_tab1[ B[3] ] ^ k[3] ^ C[3]; + k[2] = p_disc_key[1] ^ p_css_tab1[ p_disc_key[2] ] ^ B[2]; + + if( ( B[1] ^ p_css_tab1[ B[2] ] ^ k[ 2 ] ) == C[ 2 ] ) + { + if( ! investigate( &p_disc_key[0] , &C[0] ) ) + { + goto end; + } + } + + /* Test second possible out2[4] */ + out2[4] = ( out2[4] + 0xff ) & 0xff; + tmp4 = ( out2[0] << 16 ) | ( out2[1] << 8 ) | out2[4]; + tmp4 = BigTable[ tmp4 ]; + C[2] = tmp4 & 0xff; + C[3] = ( tmp4 >> 8 ) & 0xff; + C[4] = ( tmp4 >> 16 ) & 0xff; + B[3] = p_css_tab1[ B[4] ] ^ k[4] ^ C[4]; + k[3] = p_disc_key[2] ^ p_css_tab1[ p_disc_key[3] ] ^ B[3]; + B[2] = p_css_tab1[ B[3] ] ^ k[3] ^ C[3]; + k[2] = p_disc_key[1] ^ p_css_tab1[ p_disc_key[2] ] ^ B[2]; + + if( ( B[1] ^ p_css_tab1[ B[2] ] ^ k[ 2 ] ) == C[ 2 ] ) + { + if( ! investigate( &p_disc_key[0] , &C[0] ) ) + { + goto end; + } + } + } + } + } + +end: + + memcpy( p_disc_key, &C[0], KEY_SIZE ); + + free( K1table ); + free( BigTable ); + + return( 0 ); +} + +/***************************************************************************** + * CSSTitleCrack : title key decryption by cracking + * Function designed by Frank Stevenson + ***************************************************************************** + * This function is called by CSSGetTitleKey to find a title key, if we've + * chosen to crack title key instead of decrypting it with the disc key. + *****************************************************************************/ +static int CSSTitleCrack( int i_start, + unsigned char * p_crypted, + unsigned char * p_decrypted, + dvd_key_t * p_sector_key, + dvd_key_t * p_key ) { unsigned char p_buffer[10]; unsigned int i_t1, i_t2, i_t3, i_t4, i_t5, i_t6; @@ -806,4 +1195,3 @@ static int CSSCracker( int i_start, return i_exit; } - diff --git a/extras/libdvdcss/css.h b/extras/libdvdcss/css.h index 7c870ef60d..7cf3a58b29 100644 --- a/extras/libdvdcss/css.h +++ b/extras/libdvdcss/css.h @@ -2,7 +2,7 @@ * css.h: Structures for DVD authentification and unscrambling ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: css.h,v 1.5 2001/07/25 00:23:40 sam Exp $ + * $Id: css.h,v 1.6 2001/10/13 15:34:21 stef Exp $ * * Author: Stéphane Borel * @@ -37,6 +37,7 @@ typedef struct disc_s dvd_key_t p_key2; dvd_key_t p_key_check; u8 i_varient; + u8 p_disc_key[2048]; } disc_t; typedef struct dvd_title_s @@ -50,7 +51,7 @@ typedef struct css_s { int i_agid; disc_t disc; - u8 p_disc_key[2048]; + dvd_key_t p_title_key; } css_t; /***************************************************************************** @@ -59,7 +60,8 @@ typedef struct css_s struct css_s; int CSSTest ( dvdcss_handle ); -int CSSInit ( dvdcss_handle ); -int CSSGetKey ( dvdcss_handle, int, dvd_key_t ); +int CSSAuth ( dvdcss_handle ); +int CSSGetDiscKey ( dvdcss_handle ); +int CSSGetTitleKey ( dvdcss_handle, int ); int CSSDescrambleSector ( u8 * , u8 * ); diff --git a/extras/libdvdcss/csstables.h b/extras/libdvdcss/csstables.h index d8b5fcd762..861544ce3b 100644 --- a/extras/libdvdcss/csstables.h +++ b/extras/libdvdcss/csstables.h @@ -2,7 +2,7 @@ * csstables.h: CSS Tables for DVD unscrambling ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: csstables.h,v 1.2 2001/07/11 02:01:03 sam Exp $ + * $Id: csstables.h,v 1.3 2001/10/13 15:34:21 stef Exp $ * * Author: Stéphane Borel * @@ -29,6 +29,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ + static u8 p_css_tab1[ 256 ] = { 0x33, 0x73, 0x3b, 0x26, 0x63, 0x23, 0x6b, 0x76, diff --git a/extras/libdvdcss/ioctl.c b/extras/libdvdcss/ioctl.c index ed9edc8ef8..d75f2d5738 100644 --- a/extras/libdvdcss/ioctl.c +++ b/extras/libdvdcss/ioctl.c @@ -2,7 +2,7 @@ * ioctl.c: DVD ioctl replacement function ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: ioctl.c,v 1.12 2001/09/28 15:24:11 massiot Exp $ + * $Id: ioctl.c,v 1.13 2001/10/13 15:34:21 stef Exp $ * * Authors: Markus Kuespert * Samuel Hocevar @@ -30,6 +30,8 @@ *****************************************************************************/ #include "defs.h" +#include + #include /* memcpy(), memset() */ #include @@ -77,6 +79,7 @@ #include "ioctl.h" + /***************************************************************************** * Local prototypes, BeOS specific *****************************************************************************/ @@ -234,9 +237,9 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright ) } /***************************************************************************** - * ioctl_ReadKey: get the disc key + * ioctl_ReadDiscKey: get the disc key *****************************************************************************/ -int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key ) +int ioctl_ReadDiscKey( int i_fd, int *pi_agid, u8 *p_key ) { int i_ret; @@ -316,7 +319,6 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key ) dvd.grantID = *pi_agid; i_ret = ioctl( i_fd, DKIOCDVDREADSTRUCTURE, &dvd ); - memcpy( p_key, dvddki.discKeyStructures, 2048 ); #elif defined( WIN32 ) @@ -368,6 +370,57 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key ) return i_ret; } +/***************************************************************************** + * ioctl_ReadTitleKey: get the title key + *****************************************************************************/ +int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, u8 *p_key ) +{ + int i_ret; + +#if defined( HAVE_LINUX_DVD_STRUCT ) + dvd_authinfo dvd_ai; + + memset( &dvd_ai, 0, sizeof(dvd_ai) ); + dvd_ai.type = DVD_LU_SEND_TITLE_KEY; + dvd_ai.lstk.agid = *pi_agid; + dvd_ai.lstk.lba = i_pos; + + i_ret = ioctl( i_fd, DVD_AUTH, &dvd_ai ); + + if( i_ret < 0 ) + { + return i_ret; + } + + memcpy( p_key, dvd_ai.lstk.title_key, 5 ); + +#elif defined( HAVE_BSD_DVD_STRUCT ) + i_ret = -1; + +#elif defined( SYS_BEOS ) + i_ret = -1; + +#elif defined( SOLARIS_USCSI ) + i_ret = -1; + +#elif defined( SYS_DARWIN ) + i_ret = 0; + + memset( p_key, 0x00, KEY_SIZE ); + +#elif defined( WIN32 ) + i_ret = -1; + +#else + + i_ret = -1; + +#endif + + return i_ret; +} + + /***************************************************************************** * ioctl_ReportAgid: get AGID from the drive *****************************************************************************/ @@ -745,14 +798,12 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, u8 *p_key ) memset(&dvd, 0, sizeof(dvd)); memset(&dvdk1i, 0, sizeof(dvdk1i)); - dvd.buffer = &dvdk1i; dvd.bufferLength = sizeof(dvdk1i); dvd.format = kDVDKeyFormatKey1; dvd.grantID = *pi_agid; i_ret = ioctl( i_fd, DKIOCDVDREPORTKEY, &dvd ); - memcpy( p_key, dvdk1i.key1Value, 5 ); #elif defined( WIN32 ) diff --git a/extras/libdvdcss/ioctl.h b/extras/libdvdcss/ioctl.h index 802fd92553..0d9fc63082 100644 --- a/extras/libdvdcss/ioctl.h +++ b/extras/libdvdcss/ioctl.h @@ -2,7 +2,7 @@ * ioctl.h: DVD ioctl replacement function ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: ioctl.h,v 1.6 2001/08/08 02:48:44 sam Exp $ + * $Id: ioctl.h,v 1.7 2001/10/13 15:34:21 stef Exp $ * * Authors: Samuel Hocevar * @@ -22,8 +22,8 @@ *****************************************************************************/ int ioctl_ReadCopyright ( int, int, int * ); -int ioctl_ReadKey ( int, int *, u8 * ); - +int ioctl_ReadDiscKey ( int, int *, u8 * ); +int ioctl_ReadTitleKey ( int, int *, int, u8 * ); int ioctl_ReportAgid ( int, int * ); int ioctl_ReportChallenge ( int, int *, u8 * ); int ioctl_ReportKey1 ( int, int *, u8 * ); diff --git a/extras/libdvdcss/libdvdcss.c b/extras/libdvdcss/libdvdcss.c index e9d1c87614..2f714202b9 100644 --- a/extras/libdvdcss/libdvdcss.c +++ b/extras/libdvdcss/libdvdcss.c @@ -2,7 +2,7 @@ * libdvdcss.c: DVD reading library. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: libdvdcss.c,v 1.15 2001/09/09 13:43:25 sam Exp $ + * $Id: libdvdcss.c,v 1.16 2001/10/13 15:34:21 stef Exp $ * * Authors: Stéphane Borel * Samuel Hocevar @@ -80,7 +80,7 @@ static int _win32_dvdcss_aread ( int i_fd, void *p_data, int i_blocks ); /***************************************************************************** * dvdcss_open: initialize library, open a DVD device, crack CSS key *****************************************************************************/ -extern dvdcss_handle dvdcss_open ( char *psz_target, int i_flags ) +extern dvdcss_handle dvdcss_open ( char *psz_target, int i_method, int i_flags ) { int i_ret; @@ -102,6 +102,7 @@ extern dvdcss_handle dvdcss_open ( char *psz_target, int i_flags ) dvdcss->p_titles = NULL; dvdcss->b_debug = i_flags & DVDCSS_INIT_DEBUG; dvdcss->b_errors = !(i_flags & DVDCSS_INIT_QUIET); + dvdcss->i_method = i_method; dvdcss->psz_error = "no error"; i_ret = _dvdcss_open( dvdcss, psz_target ); @@ -128,7 +129,7 @@ extern dvdcss_handle dvdcss_open ( char *psz_target, int i_flags ) /* If disc is CSS protected and the ioctls work, authenticate the drive */ if( dvdcss->b_encrypted && dvdcss->b_ioctls ) { - i_ret = CSSInit( dvdcss ); + i_ret = CSSGetDiscKey( dvdcss ); if( i_ret < 0 ) { @@ -152,27 +153,36 @@ extern char * dvdcss_error ( dvdcss_handle dvdcss ) /***************************************************************************** * dvdcss_seek: seek into the device *****************************************************************************/ -extern int dvdcss_seek ( dvdcss_handle dvdcss, int i_blocks ) +extern int dvdcss_seek ( dvdcss_handle dvdcss, int i_blocks, int i_flags ) { + /* title cracking method is too slow to be used at each seek */ + if( ( ( i_flags & DVDCSS_SEEK_MPEG ) && ( dvdcss->i_method != DVDCSS_TITLE ) ) + || ( i_flags & DVDCSS_SEEK_INI ) ) + { + /* check the title key */ + dvdcss_title( dvdcss, i_blocks ); + } + return _dvdcss_seek( dvdcss, i_blocks ); } /***************************************************************************** - * dvdcss_title: crack the current title key if needed + * dvdcss_title: crack or decrypt the current title key if needed + ***************************************************************************** + * This function should only be called by dvdcss_seek and should eventually + * not be external if possible. *****************************************************************************/ extern int dvdcss_title ( dvdcss_handle dvdcss, int i_block ) { dvd_title_t *p_title; - dvd_key_t p_key; - int i_ret; + dvd_title_t *p_newtitle; + int i_ret; if( ! dvdcss->b_encrypted ) { return 0; } - //fprintf( stderr, "looking for a key for offset %i\n", i_block ); - /* Check if we've already cracked this key */ p_title = dvdcss->p_titles; while( p_title != NULL @@ -186,11 +196,12 @@ extern int dvdcss_title ( dvdcss_handle dvdcss, int i_block ) && p_title->i_startlb == i_block ) { /* We've already cracked this key, nothing to do */ + memcpy( dvdcss->css.p_title_key, p_title->p_key, sizeof(dvd_key_t) ); return 0; } - /* Crack CSS title key for current VTS */ - i_ret = CSSGetKey( dvdcss, i_block, p_key ); + /* Crack or decrypt CSS title key for current VTS */ + i_ret = CSSGetTitleKey( dvdcss, i_block ); if( i_ret < 0 ) { @@ -203,49 +214,39 @@ extern int dvdcss_title ( dvdcss_handle dvdcss, int i_block ) return -1; } - //fprintf( stderr, "cracked key is %.2x %.2x %.2x %.2x %.2x\n", - // p_key[0], p_key[1], p_key[2], p_key[3], p_key[4] ); - - /* Add key to keytable if it isn't empty */ - /* We need to cache the fact that a title is unencrypted - if( p_key[0] | p_key[1] | p_key[2] | p_key[3] | p_key[4] ) */ + /* Find our spot in the list */ + p_newtitle = NULL; + p_title = dvdcss->p_titles; + while( ( p_title != NULL ) && ( p_title->i_startlb < i_block ) ) { - dvd_title_t *p_newtitle; - - /* Find our spot in the list */ - p_newtitle = NULL; - p_title = dvdcss->p_titles; - while( p_title != NULL - && p_title->i_startlb < i_block ) - { - p_newtitle = p_title; - p_title = p_title->p_next; - } + p_newtitle = p_title; + p_title = p_title->p_next; + } - /* Save the found title */ - p_title = p_newtitle; + /* Save the found title */ + p_title = p_newtitle; - /* Write in the new title and its key */ - p_newtitle = malloc( sizeof( dvd_title_t ) ); - p_newtitle->i_startlb = i_block; - memcpy( p_newtitle->p_key, p_key, KEY_SIZE ); + /* Write in the new title and its key */ + p_newtitle = malloc( sizeof( dvd_title_t ) ); + p_newtitle->i_startlb = i_block; + memcpy( p_newtitle->p_key, dvdcss->css.p_title_key, KEY_SIZE ); - /* Link the new title, either at the beginning or inside the list */ - if( p_title == NULL ) - { - dvdcss->p_titles = p_newtitle; - p_newtitle->p_next = NULL; - } - else - { - p_newtitle->p_next = p_title->p_next; - p_title->p_next = p_newtitle; - } + /* Link the new title, either at the beginning or inside the list */ + if( p_title == NULL ) + { + dvdcss->p_titles = p_newtitle; + p_newtitle->p_next = NULL; + } + else + { + p_newtitle->p_next = p_title->p_next; + p_title->p_next = p_newtitle; } return 0; } +#define Pkey dvdcss->css.p_title_key /***************************************************************************** * dvdcss_read: read data from the device, decrypt if requested *****************************************************************************/ @@ -253,7 +254,6 @@ extern int dvdcss_read ( dvdcss_handle dvdcss, void *p_buffer, int i_blocks, int i_flags ) { - dvd_title_t *p_title; int i_ret, i_index; i_ret = _dvdcss_read( dvdcss, p_buffer, i_blocks ); @@ -265,25 +265,9 @@ extern int dvdcss_read ( dvdcss_handle dvdcss, void *p_buffer, return i_ret; } - /* find our key */ - p_title = dvdcss->p_titles; - while( p_title != NULL - && p_title->p_next - && p_title->p_next->i_startlb <= dvdcss->i_seekpos ) - { - p_title = p_title->p_next; - } - - if( p_title == NULL ) - { - /* no css key found to use, so no decryption to do */ - return 0; - } - /* For what we believe is an unencrypted title, check that there are no encrypted blocks */ - if( !( p_title->p_key[0] | p_title->p_key[1] | p_title->p_key[2] | - p_title->p_key[3] | p_title->p_key[4] ) ) + if( !( Pkey[0] | Pkey[1] | Pkey[2] | Pkey[3] | Pkey[4] ) ) { for( i_index = i_ret; i_index; i_index-- ) { @@ -301,7 +285,7 @@ extern int dvdcss_read ( dvdcss_handle dvdcss, void *p_buffer, /* Decrypt the blocks we managed to read */ for( i_index = i_ret; i_index; i_index-- ) { - CSSDescrambleSector( p_title->p_key, p_buffer ); + CSSDescrambleSector( dvdcss->css.p_title_key, p_buffer ); ((u8*)p_buffer)[0x14] &= 0x8f; (u8*)p_buffer += DVDCSS_BLOCK_SIZE; } @@ -310,14 +294,13 @@ extern int dvdcss_read ( dvdcss_handle dvdcss, void *p_buffer, } /***************************************************************************** - * dvdcss_readv: read data to an iovec structure, decrypt if reaquested + * dvdcss_readv: read data to an iovec structure, decrypt if requested *****************************************************************************/ extern int dvdcss_readv ( dvdcss_handle dvdcss, void *p_iovec, int i_blocks, int i_flags ) { #define P_IOVEC ((struct iovec*)p_iovec) - dvd_title_t *p_title; int i_ret, i_index; void *iov_base; size_t iov_len; @@ -331,20 +314,6 @@ extern int dvdcss_readv ( dvdcss_handle dvdcss, void *p_iovec, return i_ret; } - /* Find our key */ - p_title = dvdcss->p_titles; - while( p_title != NULL - && p_title->p_next != NULL - && p_title->p_next->i_startlb <= dvdcss->i_seekpos ) - { - p_title = p_title->p_next; - } - - if( p_title == NULL ) - { - /* no css key found to use, so no decryption to do */ - return 0; - } /* Initialize loop for decryption */ iov_base = P_IOVEC->iov_base; @@ -366,7 +335,7 @@ extern int dvdcss_readv ( dvdcss_handle dvdcss, void *p_iovec, iov_len = P_IOVEC->iov_len; } - CSSDescrambleSector( p_title->p_key, iov_base ); + CSSDescrambleSector( dvdcss->css.p_title_key, iov_base ); ((u8*)iov_base)[0x14] &= 0x8f; (u8*)iov_base += DVDCSS_BLOCK_SIZE; @@ -376,6 +345,7 @@ extern int dvdcss_readv ( dvdcss_handle dvdcss, void *p_iovec, return i_ret; #undef P_IOVEC } +#undef Pkey /***************************************************************************** * dvdcss_close: close the DVD device and clean up the library diff --git a/extras/libdvdcss/libdvdcss.h b/extras/libdvdcss/libdvdcss.h index 0d3d7b8c91..f66915794c 100644 --- a/extras/libdvdcss/libdvdcss.h +++ b/extras/libdvdcss/libdvdcss.h @@ -2,7 +2,7 @@ * private.h: private DVD reading library data ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: libdvdcss.h,v 1.7 2001/09/09 13:43:25 sam Exp $ + * $Id: libdvdcss.h,v 1.8 2001/10/13 15:34:21 stef Exp $ * * Authors: Stéphane Borel * Samuel Hocevar @@ -37,6 +37,7 @@ struct dvdcss_s int i_seekpos; /* Decryption stuff */ + int i_method; css_t css; boolean_t b_ioctls; boolean_t b_encrypted; diff --git a/extras/libdvdcss/videolan/dvdcss.h b/extras/libdvdcss/videolan/dvdcss.h index c6c0ada7e9..a685d76990 100644 --- a/extras/libdvdcss/videolan/dvdcss.h +++ b/extras/libdvdcss/videolan/dvdcss.h @@ -2,7 +2,7 @@ * libdvdcss.h: DVD reading library, exported functions. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: dvdcss.h,v 1.5 2001/07/27 14:43:30 sam Exp $ + * $Id: dvdcss.h,v 1.6 2001/10/13 15:34:21 stef Exp $ * * Authors: Stéphane Borel * Samuel Hocevar @@ -37,18 +37,30 @@ typedef struct dvdcss_s* dvdcss_handle; #define DVDCSS_READ_DECRYPT (1 << 0) +#define DVDCSS_SEEK_INI (1 << 0) +#define DVDCSS_SEEK_MPEG (2 << 0) + #define DVDCSS_BLOCK_SIZE 2048 +/***************************************************************************** + * libdvdcss method: used like init flags + *****************************************************************************/ +#define DVDCSS_KEY 0 +#define DVDCSS_DISC 1 +#define DVDCSS_TITLE 2 + /***************************************************************************** * Exported prototypes *****************************************************************************/ extern dvdcss_handle dvdcss_open ( char *psz_target, + int i_method, int i_flags ); extern int dvdcss_close ( dvdcss_handle ); extern int dvdcss_title ( dvdcss_handle, int i_block ); extern int dvdcss_seek ( dvdcss_handle, - int i_blocks ); + int i_blocks, + int i_flags ); extern int dvdcss_read ( dvdcss_handle, void *p_buffer, int i_blocks, diff --git a/include/config.h.in b/include/config.h.in index 525e779ee0..756c73a2ab 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -220,6 +220,8 @@ #define INPUT_AUDIO_VAR "vlc_input_audio" #define INPUT_CHANNEL_VAR "vlc_input_channel" #define INPUT_SUBTITLE_VAR "vlc_input_subtitle" +#define INPUT_DVDCSS_VAR "vlc_input_dvdcss" +#define INPUT_DVDCSS_DEFAULT "title" /* VCD defaults */ #define INPUT_VCD_DEVICE_VAR "vlc_vcd_device" diff --git a/include/defs.h.in b/include/defs.h.in index d3a5ef74d1..962f58cb1c 100644 --- a/include/defs.h.in +++ b/include/defs.h.in @@ -172,6 +172,9 @@ /* Define if you have the pth library (-lpth). */ #undef HAVE_LIBPTH +/* css decryption with player keys */ +#undef HAVE_CSSKEYS + /* long getopt support */ #undef HAVE_GETOPT_LONG diff --git a/plugins/dvd/dvd_ifo.c b/plugins/dvd/dvd_ifo.c index 44db22113d..5effd636ea 100644 --- a/plugins/dvd/dvd_ifo.c +++ b/plugins/dvd/dvd_ifo.c @@ -2,7 +2,7 @@ * dvd_ifo.c: Functions for ifo parsing ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: dvd_ifo.c,v 1.37 2001/08/09 20:16:17 jlj Exp $ + * $Id: dvd_ifo.c,v 1.38 2001/10/13 15:34:21 stef Exp $ * * Authors: Stéphane Borel * German Tischler @@ -1047,7 +1047,8 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, int i_block, int i_bytes if( p_title->i_chapter_map_start_byte ) { p_ifo->i_pos = dvdcss_seek( p_ifo->dvdhandle, - OFF2LB( i_start + p_title->i_chapter_map_start_byte ) ); + OFF2LB( i_start + p_title->i_chapter_map_start_byte ), + DVDCSS_NOFLAGS ); p_title->chapter_map.pi_start_cell = malloc( p_title->i_chapter_nb * sizeof(chapter_map_t) ); @@ -2098,7 +2099,7 @@ void CommandPrint( ifo_t ifo ) *****************************************************************************/ static u8* FillBuffer( ifo_t* p_ifo, u8* p_buf, int i_pos ) { - p_ifo->i_pos = dvdcss_seek( p_ifo->dvdhandle, i_pos ); + p_ifo->i_pos = dvdcss_seek( p_ifo->dvdhandle, i_pos, DVDCSS_NOFLAGS ); dvdcss_read( p_ifo->dvdhandle, p_buf, 1, DVDCSS_NOFLAGS ); return p_buf; diff --git a/plugins/dvd/dvd_udf.c b/plugins/dvd/dvd_udf.c index 9f4f89af57..880f1b4c52 100644 --- a/plugins/dvd/dvd_udf.c +++ b/plugins/dvd/dvd_udf.c @@ -5,7 +5,7 @@ * contains the basic udf handling functions ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: dvd_udf.c,v 1.13 2001/08/06 13:28:00 sam Exp $ + * $Id: dvd_udf.c,v 1.14 2001/10/13 15:34:21 stef Exp $ * * Author: Stéphane Borel * @@ -109,7 +109,7 @@ typedef struct ad_s static int UDFReadLB( dvdcss_handle dvdhandle, off_t i_lba, size_t i_block_count, u8 *pi_data ) { - if( dvdcss_seek( dvdhandle, i_lba ) < 0 ) + if( dvdcss_seek( dvdhandle, i_lba, DVDCSS_NOFLAGS ) < 0 ) { intf_ErrMsg( "UDF: Postion not found" ); return 0; diff --git a/plugins/dvd/input_dvd.c b/plugins/dvd/input_dvd.c index c1b85c8340..a32f916718 100644 --- a/plugins/dvd/input_dvd.c +++ b/plugins/dvd/input_dvd.c @@ -10,7 +10,7 @@ * -dvd_udf to find files ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: input_dvd.c,v 1.87 2001/10/02 16:46:59 massiot Exp $ + * $Id: input_dvd.c,v 1.88 2001/10/13 15:34:21 stef Exp $ * * Author: Stéphane Borel * @@ -199,7 +199,7 @@ static void DVDInit( input_thread_t * p_input ) p_dvd->dvdhandle = (dvdcss_handle) p_input->i_handle; - dvdcss_seek( p_dvd->dvdhandle, 0 ); + dvdcss_seek( p_dvd->dvdhandle, 0, DVDCSS_NOFLAGS ); /* We read DVD_BLOCK_READ_ONCE in each loop, so the input will receive * DVD_DATA_READ_ONCE at most */ @@ -306,6 +306,8 @@ static void DVDInit( input_thread_t * p_input ) static void DVDOpen( struct input_thread_s *p_input ) { dvdcss_handle dvdhandle; + char * psz_method; + int i_method; vlc_mutex_lock( &p_input->stream.stream_lock ); @@ -320,14 +322,33 @@ static void DVDOpen( struct input_thread_s *p_input ) vlc_mutex_unlock( &p_input->stream.stream_lock ); /* XXX: put this shit in an access plugin */ + psz_method = main_GetPszVariable( INPUT_DVDCSS_VAR, + INPUT_DVDCSS_DEFAULT ); + if( !strncmp( psz_method, "key", 3 ) ) + { + i_method = DVDCSS_KEY; + } + else if( !strncmp( psz_method, "disc", 4 ) ) + { + i_method = DVDCSS_DISC; + } + else + { + i_method = DVDCSS_TITLE; + } + if( strlen( p_input->p_source ) > 4 && !strncasecmp( p_input->p_source, "dvd:", 4 ) ) { - dvdhandle = dvdcss_open( p_input->p_source + 4, DVDCSS_INIT_QUIET ); + dvdhandle = dvdcss_open( p_input->p_source + 4, + i_method, + DVDCSS_INIT_QUIET ); } else { - dvdhandle = dvdcss_open( p_input->p_source, DVDCSS_INIT_QUIET ); + dvdhandle = dvdcss_open( p_input->p_source, + i_method, + DVDCSS_INIT_QUIET ); } if( dvdhandle == NULL ) @@ -429,11 +450,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) intf_WarnMsgImm( 3, "dvd: title %d vts_title %d pgc %d", p_dvd->i_title, i_vts_title, p_dvd->i_title_id ); - /* - * Tell libdvdcss we changed title - */ - dvdcss_title( p_dvd->dvdhandle, - vts.i_pos + vts.manager_inf.i_title_vob_start_sector ); /* * Angle management @@ -745,6 +761,13 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) } } + /* + * Force libdvdcss to check its title key. + * It is only useful for title cracking method. Methods using the decrypted + * disc key are fast enough to check the key at each seek + */ + dvdcss_seek( p_dvd->dvdhandle, p_dvd->i_start, DVDCSS_SEEK_INI ); + #define title \ p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title if( p_area->i_angle != p_dvd->i_angle ) @@ -809,6 +832,7 @@ static int DVDRead( input_thread_t * p_input, i_sector = p_dvd->i_title_start + p_dvd->i_sector; i_block_once = p_dvd->i_end_sector - p_dvd->i_sector + 1; + /* Get the position of the next cell if we're at cell end */ if( i_block_once <= 0 ) { @@ -827,7 +851,8 @@ static int DVDRead( input_thread_t * p_input, /* Position the fd pointer on the right address */ i_sector = dvdcss_seek( p_dvd->dvdhandle, - p_dvd->i_title_start + p_dvd->i_sector ); + p_dvd->i_title_start + p_dvd->i_sector, + DVDCSS_SEEK_MPEG ); /* update chapter : it will be easier when we have navigation * ES support */ @@ -1079,8 +1104,9 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off ) p_input->stream.p_selected_area->i_part = p_dvd->i_chapter; p_input->stream.p_selected_area->i_tell = - LB2OFF ( dvdcss_seek( p_dvd->dvdhandle, p_dvd->i_title_start - + p_dvd->i_sector ) ) + LB2OFF ( dvdcss_seek( p_dvd->dvdhandle, + p_dvd->i_title_start + p_dvd->i_sector, + DVDCSS_SEEK_MPEG ) ) - p_input->stream.p_selected_area->i_start; intf_WarnMsg( 7, "Program Cell: %d Cell: %d Chapter: %d", @@ -1211,7 +1237,9 @@ static int DVDChapterSelect( thread_dvd_data_t * p_dvd, int i_chapter ) p_dvd->i_start = p_dvd->i_title_start + p_dvd->i_sector; /* Position the fd pointer on the right address */ - p_dvd->i_start = dvdcss_seek( p_dvd->dvdhandle, p_dvd->i_start ); + p_dvd->i_start = dvdcss_seek( p_dvd->dvdhandle, + p_dvd->i_start, + DVDCSS_SEEK_MPEG ); p_dvd->i_chapter = i_chapter; return 0; diff --git a/src/audio_output/aout_spdif.c b/src/audio_output/aout_spdif.c index ac309e6757..ad0e3c535f 100644 --- a/src/audio_output/aout_spdif.c +++ b/src/audio_output/aout_spdif.c @@ -2,7 +2,7 @@ * aout_spdif: ac3 passthrough output ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: aout_spdif.c,v 1.16 2001/09/30 00:33:22 stef Exp $ + * $Id: aout_spdif.c,v 1.17 2001/10/13 15:34:21 stef Exp $ * * Authors: Michel Kaempf * Stéphane Borel @@ -118,7 +118,7 @@ void aout_SpdifThread( aout_thread_t * p_aout ) } else { - mwait( m_play - 4* m_frame_time ); + mwait( m_play - 3* m_frame_time ); } m_old = m_play; diff --git a/src/interface/main.c b/src/interface/main.c index d6cc48b809..e447aad3d8 100644 --- a/src/interface/main.c +++ b/src/interface/main.c @@ -4,7 +4,7 @@ * and spawn threads. ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: main.c,v 1.117 2001/10/03 15:10:55 sam Exp $ + * $Id: main.c,v 1.118 2001/10/13 15:34:21 stef Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -129,6 +129,7 @@ #define OPT_YUV 183 #define OPT_DOWNMIX 184 #define OPT_IMDCT 185 +#define OPT_DVDCSS 186 #define OPT_SYNCHRO 190 #define OPT_WARNING 191 @@ -199,6 +200,7 @@ static const struct option longopts[] = { "dvdaudio", 1, 0, 'a' }, { "dvdchannel", 1, 0, 'c' }, { "dvdsubtitle", 1, 0, 's' }, + { "dvdcss_method", 1, 0, OPT_DVDCSS }, /* Input options */ { "input", 1, 0, OPT_INPUT }, @@ -738,16 +740,16 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) break; /* DVD options */ - case 't': + case 't': /* --dvdtitle */ main_PutIntVariable( INPUT_TITLE_VAR, atoi(optarg) ); break; - case 'T': + case 'T': /* --dvdchapter */ main_PutIntVariable( INPUT_CHAPTER_VAR, atoi(optarg) ); break; - case 'u': + case 'u': /* --dvdangle */ main_PutIntVariable( INPUT_ANGLE_VAR, atoi(optarg) ); break; - case 'a': + case 'a': /* --dvdaudio */ if ( ! strcmp(optarg, "ac3") ) main_PutIntVariable( INPUT_AUDIO_VAR, REQUESTED_AC3 ); else if ( ! strcmp(optarg, "lpcm") ) @@ -757,12 +759,15 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) else main_PutIntVariable( INPUT_AUDIO_VAR, REQUESTED_NOAUDIO ); break; - case 'c': + case 'c': /* --dvdchannel */ main_PutIntVariable( INPUT_CHANNEL_VAR, atoi(optarg) ); break; - case 's': + case 's': /* --dvdsubtitle */ main_PutIntVariable( INPUT_SUBTITLE_VAR, atoi(optarg) ); break; + case OPT_DVDCSS: /* --dvdcss */ + main_PutPszVariable( INPUT_DVDCSS_VAR, optarg ); + break; /* Input options */ case OPT_INPUT: /* --input */ @@ -888,6 +893,7 @@ static void Usage( int i_fashion ) "\n -a, --dvdaudio \tchoose DVD audio type" "\n -c, --dvdchannel \tchoose DVD audio channel" "\n -s, --dvdsubtitle \tchoose DVD subtitle channel" + "\n , --dvdcss \tselect DVDCSS decryption method" "\n" "\n --input \tinput method" "\n --channels \tenable channels" @@ -917,7 +923,7 @@ static void Usage( int i_fashion ) "\n " AOUT_SPDIF_VAR "={1|0} \tAC3 pass-through mode" "\n " DOWNMIX_METHOD_VAR "= \tAC3 downmix method" "\n " IMDCT_METHOD_VAR "= \tAC3 IMDCT method" - "\n " AOUT_RATE_VAR "= \toutput rate" ); + "\n " AOUT_RATE_VAR "= \toutput rate" ); /* Video parameters */ intf_MsgImm( "\nVideo parameters:" @@ -938,22 +944,23 @@ static void Usage( int i_fashion ) /* DVD parameters */ intf_MsgImm( "\nDVD parameters:" - "\n " INPUT_DVD_DEVICE_VAR "= \tDVD device" - "\n " INPUT_TITLE_VAR "= \ttitle number" - "\n " INPUT_CHAPTER_VAR "=<chapter> \tchapter number" - "\n " INPUT_ANGLE_VAR "=<angle> \tangle number" - "\n " INPUT_AUDIO_VAR "={ac3|lpcm|mpeg|off} \taudio type" - "\n " INPUT_CHANNEL_VAR "=[0-15] \taudio channel" - "\n " INPUT_SUBTITLE_VAR "=[0-31] \tsubtitle channel" ); + "\n " INPUT_DVD_DEVICE_VAR "=<device> \tDVD device" + "\n " INPUT_TITLE_VAR "=<title> \ttitle number" + "\n " INPUT_CHAPTER_VAR "=<chapter> \tchapter number" + "\n " INPUT_ANGLE_VAR "=<angle> \tangle number" + "\n " INPUT_AUDIO_VAR "={ac3|lpcm|mpeg|off} \taudio type" + "\n " INPUT_CHANNEL_VAR "=[0-15] \taudio channel" + "\n " INPUT_SUBTITLE_VAR "=[0-31] \tsubtitle channel" + "\n " INPUT_DVDCSS_VAR "={csskey|disc|title} \tdvdcss method" ); /* Input parameters */ intf_MsgImm( "\nInput parameters:" - "\n " INPUT_SERVER_VAR "=<hostname> \tvideo server" - "\n " INPUT_PORT_VAR "=<port> \tvideo server port" - "\n " INPUT_IFACE_VAR "=<interface> \tnetwork interface" - "\n " INPUT_BCAST_ADDR_VAR "=<addr> \tbroadcast mode" - "\n " INPUT_CHANNEL_SERVER_VAR "=<hostname> \tchannel server" - "\n " INPUT_CHANNEL_PORT_VAR "=<port> \tchannel server port" ); + "\n " INPUT_SERVER_VAR "=<hostname> \tvideo server" + "\n " INPUT_PORT_VAR "=<port> \tvideo server port" + "\n " INPUT_IFACE_VAR "=<interface> \tnetwork interface" + "\n " INPUT_BCAST_ADDR_VAR "=<addr> \tbroadcast mode" + "\n " INPUT_CHANNEL_SERVER_VAR "=<hostname> \tchannel server" + "\n " INPUT_CHANNEL_PORT_VAR "=<port> \tchannel server port" ); } -- 2.39.5