[MPlayer-cvslog] r31890 - in branches/1.0rc4/libdvdcss: . css.c css.h libdvdcss.c

siretart subversion at mplayerhq.hu
Sun Aug 1 22:10:43 CEST 2010


Author: siretart
Date: Sun Aug  1 22:10:42 2010
New Revision: 31890

Log:
Sync libdvdcss/ directory to r31884 from trunk

Modified:
   branches/1.0rc4/libdvdcss/   (props changed)
   branches/1.0rc4/libdvdcss/css.c
   branches/1.0rc4/libdvdcss/css.h
   branches/1.0rc4/libdvdcss/libdvdcss.c

Modified: branches/1.0rc4/libdvdcss/css.c
==============================================================================
--- branches/1.0rc4/libdvdcss/css.c	Sun Aug  1 19:51:28 2010	(r31889)
+++ branches/1.0rc4/libdvdcss/css.c	Sun Aug  1 22:10:42 2010	(r31890)
@@ -90,56 +90,48 @@ static int  AttackPadding   ( uint8_t co
 /*****************************************************************************
  * _dvdcss_test: check if the disc is encrypted or not
  *****************************************************************************
- * Return values:
- *   1: DVD is scrambled but can be read
- *   0: DVD is not scrambled and can be read
- *  -1: could not get "copyright" information
- *  -2: could not get RPC information (reading the disc might be possible)
- *  -3: drive is RPC-II, region is not set, and DVD is scrambled: the RPC
- *      scheme will prevent us from reading the scrambled data
+ * Sets b_scrambled, b_ioctls
  *****************************************************************************/
-int _dvdcss_test( dvdcss_t dvdcss )
+void _dvdcss_test( dvdcss_t dvdcss )
 {
     char const *psz_type, *psz_rpc;
     int i_ret, i_copyright, i_type, i_mask, i_rpc;
 
     i_ret = ioctl_ReadCopyright( dvdcss->i_fd, 0 /* i_layer */, &i_copyright );
 
-#ifdef WIN32
     if( i_ret < 0 )
     {
         /* Maybe we didn't have enough privileges to read the copyright
          * (see ioctl_ReadCopyright comments).
          * Apparently, on unencrypted DVDs _dvdcss_disckey() always fails, so
          * we can check this as a workaround. */
+#ifdef WIN32
         i_ret = 0;
+#else
+        /* Since it's the first ioctl we try to issue, we add a notice */
+        print_error( dvdcss, "css error: could not get \"copyright\""
+                     " information, make sure there is a DVD in the drive,"
+                     " and that you have used the correct device node." );
+        /* Try without ioctls */
+        dvdcss->b_ioctls = 0;
+#endif
         i_copyright = 1;
         if( _dvdcss_disckey( dvdcss ) < 0 )
         {
             i_copyright = 0;
         }
     }
-#endif
-
-    if( i_ret < 0 )
-    {
-        /* Since it's the first ioctl we try to issue, we add a notice */
-        print_error( dvdcss, "css error: could not get \"copyright\""
-                     " information, make sure there is a DVD in the drive,"
-                     " and that you have used the correct device node." );
-
-        return -1;
-    }
 
     print_debug( dvdcss, "disc reports copyright information 0x%x",
                          i_copyright );
+    dvdcss->b_scrambled = i_copyright;
 
     i_ret = ioctl_ReportRPC( dvdcss->i_fd, &i_type, &i_mask, &i_rpc);
 
     if( i_ret < 0 )
     {
-        print_error( dvdcss, "css error: could not get RPC status" );
-        return -2;
+        print_error( dvdcss, "css error: could not get RPC status, region-free drive?" );
+        return;
     }
 
     switch( i_rpc )
@@ -165,10 +157,7 @@ int _dvdcss_test( dvdcss_t dvdcss )
     {
         print_error( dvdcss, "css error: drive will prevent access to "
                              "scrambled data" );
-        return -3;
     }
-
-    return i_copyright ? 1 : 0;
 }
 
 /*****************************************************************************

Modified: branches/1.0rc4/libdvdcss/css.h
==============================================================================
--- branches/1.0rc4/libdvdcss/css.h	Sun Aug  1 19:51:28 2010	(r31889)
+++ branches/1.0rc4/libdvdcss/css.h	Sun Aug  1 22:10:42 2010	(r31890)
@@ -48,7 +48,7 @@ typedef struct css_s
 /*****************************************************************************
  * Prototypes in css.c
  *****************************************************************************/
-int   _dvdcss_test        ( dvdcss_t );
+void  _dvdcss_test        ( dvdcss_t );
 int   _dvdcss_title       ( dvdcss_t, int );
 int   _dvdcss_disckey     ( dvdcss_t );
 int   _dvdcss_titlekey    ( dvdcss_t, int , dvd_key_t );

Modified: branches/1.0rc4/libdvdcss/libdvdcss.c
==============================================================================
--- branches/1.0rc4/libdvdcss/libdvdcss.c	Sun Aug  1 19:51:28 2010	(r31889)
+++ branches/1.0rc4/libdvdcss/libdvdcss.c	Sun Aug  1 22:10:42 2010	(r31890)
@@ -366,27 +366,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( 
 
     if( dvdcss->b_ioctls )
     {
-        i_ret = _dvdcss_test( dvdcss );
-
-        if( i_ret == -3 )
-        {
-            print_debug( dvdcss, "scrambled disc on a region-free RPC-II "
-                                 "drive: possible failure, but continuing "
-                                 "anyway" );
-        }
-        else if( i_ret < 0 )
-        {
-            /* Disable the CSS ioctls and hope that it works? */
-            print_debug( dvdcss,
-                         "could not check whether the disc was scrambled" );
-            dvdcss->b_ioctls = 0;
-        }
-        else
-        {
-            print_debug( dvdcss, i_ret ? "disc is scrambled"
-                                       : "disc is unscrambled" );
-            dvdcss->b_scrambled = i_ret;
-        }
+        _dvdcss_test( dvdcss );
     }
 
     /* If disc is CSS protected and the ioctls work, authenticate the drive */


More information about the MPlayer-cvslog mailing list