]> git.sesse.net Git - vlc/commitdiff
Changes to vlc:
authorSam Hocevar <sam@videolan.org>
Sun, 9 Sep 2001 13:43:25 +0000 (13:43 +0000)
committerSam Hocevar <sam@videolan.org>
Sun, 9 Sep 2001 13:43:25 +0000 (13:43 +0000)
  * Fixed arch-dependant build dependencies (Closes Debian bug #109722).
  * Minor changes to the (non-working) ncurses interface.

 Changes to libdvdcss (courtesy of H�kan Hjort <d95hjort@dtek.chalmers.se>):

  * If we see 3000 unencrypted blocks assume that the title is unencrypted.
  * If we have not seen any encrypted block and then discover that the block
    just read is not a valid block of an MPEG2 Program stream, assume that the
    title is unencrypted.
  * Empty keys (for unscrambled sectors) are now cached as well.
  * We try to decrypt the file even if DVD ioctls are not available.

AUTHORS
ChangeLog
ChangeLog.libdvdcss
debian/changelog
debian/control
extras/libdvdcss/css.c
extras/libdvdcss/libdvdcss.c
extras/libdvdcss/libdvdcss.h
plugins/text/intf_ncurses.c

diff --git a/AUTHORS b/AUTHORS
index 83f6f497517cde5196505fc7d267b12707471f05..776302b1af9319fa4807e6d1114c7dc5b095b34a 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -109,6 +109,7 @@ D: IDCT and YUV transformations
 N: Håkan Hjort
 E: d95hjort@dtek.chalmers.se
 D: Solaris port of the DVD ioctls
+D: libdvdcss enhancements
 
 N: Samuel Hocevar
 E: sam@zoy.org
index 2767ff97168e5fe9b631af8bf2d4c5cbc0bf01f9..efea567a39450f96784778f6a44af84ab23f1ea3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
 
 HEAD
 
+  * Minor changes to the (non-working) ncurses interface.
   * Fixed a packet leak in DemuxPSI.
   * Added gnome.h check and cleaned the error messages in the configure script.
   * Tiny small optim in LPCM decoder.
index 7227c802501489a0377aaa4673400dc4b9daec11..cba1151bbe45c45103ca39c505cae6430f2358e0 100644 (file)
@@ -4,7 +4,12 @@
 
 HEAD
 
-  * Nothing yet.
+  * If we see 3000 unencrypted blocks assume that the title is unencrypted.
+  * If we have not seen any encrypted block and then discover that the block
+    just read is not a valid block of an MPEG2 Program stream, assume that the
+    title is unencrypted.
+  * Empty keys (for unscrambled sectors) are now cached as well.
+  * We try to decrypt the file even if DVD ioctls are not available.
 
 0.0.3
 Wed, 22 Aug 2001 15:18:01 +0200
index ca7c29db478ed5d86266149e168ec77ecb8abc54..8391ecc3741d2410579f525077f6b0be8962f157 100644 (file)
@@ -1,3 +1,9 @@
+vlc (0.2.83-3) unstable; urgency=low
+
+  * Fixed syntax error in build dependencies (Closes: #109722).
+
+ -- Samuel Hocevar <sam@zoy.org>  Sun,  9 Sep 2001 09:28:06 +0200
+
 vlc (0.2.83-2) unstable; urgency=low
 
   * Fixed build dependencies for architectures not supporting libasound2
index d30698ab0a012c5d2260b84b41822b549d77b9e8..2af7e944c3e6c751816ed61005997afa4c28277c 100644 (file)
@@ -2,7 +2,7 @@ Source: vlc
 Section: graphics
 Priority: optional
 Maintainer: Samuel Hocevar <sam@zoy.org>
-Build-Depends: debhelper (>=2.2.0), xlibs-dev, libgnome-dev, libggi2-dev, libglide2-dev [i386], libesd0-dev, libsdl1.2-dev, libqt-dev, libasound2-dev [alpha|i386|ia64|m68k|powerpc]
+Build-Depends: debhelper (>=2.2.0), xlibs-dev, libgnome-dev, libggi2-dev, libglide2-dev [i386], libesd0-dev, libsdl1.2-dev, libqt-dev, libasound2-dev [alpha i386 ia64 m68k powerpc]
 Standards-Version: 3.0.1
 
 Package: vlc
index dcf4d6b32b37a335c4363dd0b512a02b4f4f0f0b..6232a6a0e5562ef2217cfbdeef951445dac1e52e 100644 (file)
@@ -2,9 +2,10 @@
  * css.c: Functions for DVD authentification and unscrambling
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: css.c,v 1.8 2001/08/06 13:27:59 sam Exp $
+ * $Id: css.c,v 1.9 2001/09/09 13:43:25 sam Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
+ *         Håkan Hjort <d95hjort@dtek.chalmers.se>
  *
  * based on:
  *  - css-auth by Derek Fawcus <derek@spider.com>
@@ -295,6 +296,7 @@ int CSSGetKey( dvdcss_handle dvdcss, int i_pos, dvd_key_t p_titlekey )
      * 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;
@@ -310,14 +312,30 @@ int CSSGetKey( dvdcss_handle dvdcss, int i_pos, dvd_key_t p_titlekey )
 
     b_encrypted = 0;
     b_stop_scanning = 0;
+    i_blocks_read = 0;
 
     do
     {
         i_pos = dvdcss_seek( dvdcss, i_pos );
-        i_blocks_read = dvdcss_read( dvdcss, p_buf, 1, DVDCSS_NOFLAGS );
+        if( dvdcss_read( dvdcss, p_buf, 1, DVDCSS_NOFLAGS ) != 1 ) break;
 
-        /* PES_scrambling_control */
-        if( p_buf[0x14] & 0x30 )
+        /* Stop when we find a non MPEG stream block */
+        if( memcmp( p_buf, p_packstart, 4 ) )
+        {
+            /* 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;
@@ -347,9 +365,13 @@ int CSSGetKey( dvdcss_handle dvdcss, int i_pos, dvd_key_t p_titlekey )
             }
         }
 
-        i_pos += i_blocks_read;
+        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;
 
-    } while( i_blocks_read == 0x1 && !b_stop_scanning );
+    } while( !b_stop_scanning );
 
     if( b_stop_scanning )
     {
index 2c20d2b72ecfd9664f39f2f862154d5bb153a68a..e9d1c876147fb6ab07cee8adfd45a8848bbffc61 100644 (file)
@@ -2,10 +2,11 @@
  * libdvdcss.c: DVD reading library.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: libdvdcss.c,v 1.14 2001/08/06 13:28:00 sam Exp $
+ * $Id: libdvdcss.c,v 1.15 2001/09/09 13:43:25 sam Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
+ *          Håkan Hjort <d95hjort@dtek.chalmers.se>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -113,16 +114,19 @@ extern dvdcss_handle dvdcss_open ( char *psz_target, int i_flags )
     i_ret = CSSTest( dvdcss );
     if( i_ret < 0 )
     {
-        _dvdcss_error( dvdcss, "css test failed" );
-        _dvdcss_close( dvdcss );
-        free( dvdcss );
-        return NULL;
+        _dvdcss_error( dvdcss, "CSS test failed" );
+        /* Disable the CSS ioctls and hope that it works? */
+        dvdcss->b_ioctls = 0;
+        dvdcss->b_encrypted = 1;
+    }
+    else
+    {
+        dvdcss->b_ioctls = 1;
+        dvdcss->b_encrypted = i_ret;
     }
 
-    dvdcss->b_encrypted = i_ret;
-
-    /* If drive is encrypted, crack its key */
-    if( dvdcss->b_encrypted )
+    /* If disc is CSS protected and the ioctls work, authenticate the drive */
+    if( dvdcss->b_encrypted && dvdcss->b_ioctls )
     {
         i_ret = CSSInit( dvdcss );
 
@@ -203,7 +207,8 @@ extern int dvdcss_title ( dvdcss_handle dvdcss, int i_block )
     //         p_key[0], p_key[1], p_key[2], p_key[3], p_key[4] );
 
     /* Add key to keytable if it isn't empty */
-    if( p_key[0] | p_key[1] | p_key[2] | p_key[3] | p_key[4] )
+    /* 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] ) */
     {
         dvd_title_t *p_newtitle;
 
@@ -275,6 +280,24 @@ extern int dvdcss_read ( dvdcss_handle dvdcss, void *p_buffer,
         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] ) ) 
+    {
+        for( i_index = i_ret; i_index; i_index-- )
+        {
+            if( ((u8*)p_buffer)[0x14] & 0x30 )
+            {
+                _dvdcss_error( dvdcss, "no key but found encrypted block" );
+                /* Only return the initial range of unscrambled blocks? */
+                i_ret = i_index;
+                /* or fail completely? return 0; */
+            }
+            (u8*)p_buffer += DVDCSS_BLOCK_SIZE;
+        }
+    }
+
     /* Decrypt the blocks we managed to read */
     for( i_index = i_ret; i_index; i_index-- )
     {
index 19df12bd30801efb953530be0e06559ad1051d1a..0d3d7b8c913255335aa8e75fb337f93054254a46 100644 (file)
@@ -2,7 +2,7 @@
  * private.h: private DVD reading library data
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: libdvdcss.h,v 1.6 2001/07/25 08:41:21 gbazin Exp $
+ * $Id: libdvdcss.h,v 1.7 2001/09/09 13:43:25 sam Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -38,6 +38,7 @@ struct dvdcss_s
 
     /* Decryption stuff */
     css_t        css;
+    boolean_t    b_ioctls;
     boolean_t    b_encrypted;
     dvd_title_t *p_titles;
 
index 0abf52fc391f42e6a4c978a34521a31559cdc3d3..2e666b1945b282b598124673ec6ca0e390245110 100644 (file)
@@ -2,7 +2,7 @@
  * intf_ncurses.c: ncurses interface
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_ncurses.c,v 1.4 2001/07/25 03:12:33 sam Exp $
+ * $Id: intf_ncurses.c,v 1.5 2001/09/09 13:43:25 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -108,22 +108,22 @@ static int intf_Open( intf_thread_t *p_intf )
     p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
     if( p_intf->p_sys == NULL )
     {
-        intf_ErrMsg("error: %s", strerror(ENOMEM));
+        intf_ErrMsg( "intf error: %s", strerror(ENOMEM) );
         return( 1 );
     }
 
     /* Initialize the curses library */
     initscr();
-
     /* Don't do NL -> CR/NL */
     nonl();
-
     /* Take input chars one at a time */
     cbreak();
-
     /* Don't echo */
     noecho();
 
+    curs_set(0);
+    timeout(0);
+
     return( 0 );
 }
 
@@ -144,11 +144,32 @@ static void intf_Close( intf_thread_t *p_intf )
  *****************************************************************************/
 static void intf_Run( intf_thread_t *p_intf )
 {
+    signed char i_key;
+
     while( !p_intf->b_die )
     {
         p_intf->pf_manage( p_intf );
 
         msleep( INTF_IDLE_SLEEP );
+
+        mvaddstr( 1, 2, VOUT_TITLE " (ncurses interface)" );
+        mvaddstr( 3, 2, "keys:" );
+        mvaddstr( 4, 2, "Q,q.......quit" );
+        //mvaddstr( 5, 2, "No other keys are active yet." );
+
+        while( (i_key = getch()) != -1 )
+       {
+            switch( i_key )
+            {
+                case 'q':
+                case 'Q':
+                    p_intf->b_die = 1;
+                    break;
+
+                default:
+                    break;
+            }
+        }
     }
 }