diff -ur orig/libdvdread-0.9.2/dvdread/dvd_reader.c libdvdread-0.9.2/dvdread/dvd_reader.c --- orig/libdvdread-0.9.2/dvdread/dvd_reader.c Tue Oct 9 21:07:40 2001 +++ libdvdread-0.9.2/dvdread/dvd_reader.c Wed Jan 16 14:39:25 2002 @@ -61,6 +61,8 @@ * Handle to the loaded dvdcss library. */ void *dvdcss_library = 0; +#define DVDCSS_ABIL_NO_TITLE_HACK 1 +int dvdcss_abilities = 0; /** * libdvdcss functions. @@ -77,6 +79,7 @@ int i_blocks, int i_title ); static char * (*dvdcss_error) ( dvdcss_handle ); +static int (*dvdcss_libabilities) ( void ); struct dvd_reader_s { /* Basic information. */ @@ -110,7 +113,12 @@ static void setupCSS( void ) { if( !dvdcss_library ) { + char *lib; + + if (!(lib = getenv("LIBDVDREADCSSLIB"))) dvdcss_library = dlopen( "libdvdcss.so.0", RTLD_LAZY ); + else + dvdcss_library = dlopen( lib, RTLD_LAZY ); if( !dvdcss_library ) { fprintf( stderr, "libdvdread: Can't open libdvdcss: %s.\n", @@ -133,7 +141,9 @@ dlsym( dvdcss_library, U_S "dvdcss_read" ); dvdcss_error = (char* (*)(dvdcss_handle)) dlsym( dvdcss_library, U_S "dvdcss_error" ); - + dvdcss_libabilities = (int (*)(void)) + dlsym( dvdcss_library, U_S "dvdcss_libabilities" ); + if( dlsym( dvdcss_library, U_S "dvdcss_crack" ) ) { fprintf( stderr, "libdvdread: Old (pre-0.0.2) version of " "libdvdcss found.\n" @@ -151,7 +161,8 @@ "newer version of libdvdread?\n" ); dlclose( dvdcss_library ); dvdcss_library = 0; - } + } else if (dvdcss_libabilities) + dvdcss_abilities = dvdcss_libabilities(); } } @@ -641,12 +652,13 @@ } /* Hack to crack all the keys on the first open. */ - if( dvdcss_library ) { + if (!(dvdcss_abilities&DVDCSS_ABIL_NO_TITLE_HACK)) + if( dvdcss_library ) { if( !dvd_file->dvd->init_keys ) { - initAllCSSKeys( dvd_file->dvd ); - dvd_file->dvd->init_keys = 1; + initAllCSSKeys( dvd_file->dvd ); + dvd_file->dvd->init_keys = 1; } - } + } /* Perform CSS key cracking for this title. */ if( dvdcss_library ) {