shithub: libdvdcss

Download patch

ref: 6cd5094c9d8aef3e27dcf6783a818356dd79b83e
parent: e02b6b39da186c9ff25bcb093820f27fe105c6be
author: Sam Hocevar <sam@videolan.org>
date: Wed May 13 16:54:40 EDT 2009

Add support for the DVDCSS_IGNORE_RPC environment variable in order to
bypass our new RPC-II sanity check.

--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -91,6 +91,13 @@
  *     will use the default value which is "${HOME}/.dvdcss/" under Unix and
  *     "C:\Documents and Settings\$USER\Application Data\dvdcss\" under Win32.
  *     The special value "off" disables caching.
+ *
+ * \li \b DVDCSS_IGNORE_RPC: by default, libdvdcss will refuse to access
+ *     a scrambled disc if the drive reports itself as RPC-II with no
+ *     region set, because such drives are designed to prevent access to
+ *     both the decryption key and the DVD data, rendering any decryption
+ *     method useless. Setting this environment variable to \c 1 will
+ *     bypass this check and try to access the drive anyway.
  */
 
 /*
@@ -169,6 +176,7 @@
 #if !defined(WIN32) && !defined(SYS_OS2)
     char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
 #endif
+    char *psz_ignore_rpc = getenv( "DVDCSS_IGNORE_RPC" );
 
     dvdcss_t dvdcss;
 
@@ -194,6 +202,7 @@
     dvdcss->psz_cachefile[0] = '\0';
     dvdcss->b_debug = 0;
     dvdcss->b_errors = 0;
+    dvdcss->b_ignore_rpc = 0;
 
     /*
      *  Find verbosity from DVDCSS_VERBOSE environment variable
@@ -363,11 +372,13 @@
 
     dvdcss->b_scrambled = 1; /* Assume the worst */
     dvdcss->b_ioctls = _dvdcss_use_ioctls( dvdcss );
+    dvdcss->b_ignore_rpc = psz_ignore_rpc ? atoi( psz_ignore_rpc ) : 0;
 
     if( dvdcss->b_ioctls )
     {
         i_ret = _dvdcss_test( dvdcss );
-        if( i_ret == -2 )
+
+        if( i_ret == -2 && !dvdcss->b_ignore_rpc )
         {
             /* Scrambled disk, RPC-II drive, no region set: bail out */
             free( dvdcss->psz_device );
--- a/src/libdvdcss.h
+++ b/src/libdvdcss.h
@@ -45,6 +45,7 @@
     css_t        css;
     int          b_ioctls;
     int          b_scrambled;
+    int          b_ignore_rpc;
     dvd_title_t *p_titles;
 
     /* Key cache directory and pointer to the filename */