Index: src/css.c =================================================================== RCS file: /var/cvs/videolan/libdvdcss/src/css.c,v retrieving revision 1.24 diff -u -r1.24 css.c --- src/css.c 4 Feb 2003 11:54:36 -0000 1.24 +++ src/css.c 21 Mar 2003 16:27:45 -0000 @@ -426,7 +426,27 @@ if( ioctl_ReadDiscKey( dvdcss->i_fd, &dvdcss->css.i_agid, p_buffer ) < 0 ) { _dvdcss_error( dvdcss, "ioctl ReadDiscKey failed" ); - return -1; + + /* Try to fallback to the TITLE method. */ + dvdcss->i_method = DVDCSS_METHOD_TITLE; + memset( dvdcss->css.p_disc_key, 0, KEY_SIZE ); + + if( GetASF( dvdcss ) != 1 ) + { + /* Region mismatch (or region not set) is the most likely source */ + _dvdcss_error( dvdcss, + "ASF not 1 after reading disc key (region mismatch?)" ); + } + + /* AGID might have been invalidated, try to authenticate again. */ + ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid ); + + if( GetBusKey( dvdcss ) < 0 ) + { + return -1; + } + + return 1; } /* This should have invaidated the AGID and got us ASF=1. */ @@ -435,8 +455,20 @@ /* Region mismatch (or region not set) is the most likely source. */ _dvdcss_error( dvdcss, "ASF not 1 after reading disc key (region mismatch?)" ); + + /* Try to fallback to the TITLE method. */ + dvdcss->i_method = DVDCSS_METHOD_TITLE; + memset( dvdcss->css.p_disc_key, 0, KEY_SIZE ); + + /* AGID might have been invalidated, try to authenticate again. */ ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid ); - return -1; + + if( GetBusKey( dvdcss ) < 0 ) + { + return -1; + } + + return 1; } /* Decrypt disc key using bus key */