From e8640eed39a52d12f97b80b816d376116aaf94d3 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sun, 9 Sep 2001 13:43:25 +0000 Subject: [PATCH] Changes to vlc: MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * 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 ): * 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 | 1 + ChangeLog | 1 + ChangeLog.libdvdcss | 7 +++++- debian/changelog | 6 +++++ debian/control | 2 +- extras/libdvdcss/css.c | 34 +++++++++++++++++++++++----- extras/libdvdcss/libdvdcss.c | 43 +++++++++++++++++++++++++++--------- extras/libdvdcss/libdvdcss.h | 3 ++- plugins/text/intf_ncurses.c | 33 ++++++++++++++++++++++----- 9 files changed, 105 insertions(+), 25 deletions(-) diff --git a/AUTHORS b/AUTHORS index 83f6f49751..776302b1af 100644 --- 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 diff --git a/ChangeLog b/ChangeLog index 2767ff9716..efea567a39 100644 --- 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. diff --git a/ChangeLog.libdvdcss b/ChangeLog.libdvdcss index 7227c80250..cba1151bbe 100644 --- a/ChangeLog.libdvdcss +++ b/ChangeLog.libdvdcss @@ -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 diff --git a/debian/changelog b/debian/changelog index ca7c29db47..8391ecc374 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vlc (0.2.83-3) unstable; urgency=low + + * Fixed syntax error in build dependencies (Closes: #109722). + + -- Samuel Hocevar Sun, 9 Sep 2001 09:28:06 +0200 + vlc (0.2.83-2) unstable; urgency=low * Fixed build dependencies for architectures not supporting libasound2 diff --git a/debian/control b/debian/control index d30698ab0a..2af7e944c3 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: vlc Section: graphics Priority: optional Maintainer: Samuel Hocevar -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 diff --git a/extras/libdvdcss/css.c b/extras/libdvdcss/css.c index dcf4d6b32b..6232a6a0e5 100644 --- a/extras/libdvdcss/css.c +++ b/extras/libdvdcss/css.c @@ -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 + * Håkan Hjort * * based on: * - css-auth by Derek Fawcus @@ -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 ) { diff --git a/extras/libdvdcss/libdvdcss.c b/extras/libdvdcss/libdvdcss.c index 2c20d2b72e..e9d1c87614 100644 --- a/extras/libdvdcss/libdvdcss.c +++ b/extras/libdvdcss/libdvdcss.c @@ -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 * Samuel Hocevar + * Håkan Hjort * * 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-- ) { diff --git a/extras/libdvdcss/libdvdcss.h b/extras/libdvdcss/libdvdcss.h index 19df12bd30..0d3d7b8c91 100644 --- a/extras/libdvdcss/libdvdcss.h +++ b/extras/libdvdcss/libdvdcss.h @@ -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 * Samuel Hocevar @@ -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; diff --git a/plugins/text/intf_ncurses.c b/plugins/text/intf_ncurses.c index 0abf52fc39..2e666b1945 100644 --- a/plugins/text/intf_ncurses.c +++ b/plugins/text/intf_ncurses.c @@ -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 * @@ -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; + } + } } } -- 2.39.2