Commit 9db3558c authored by Stéphane Borel's avatar Stéphane Borel

Bugfix for chapters change in DVD.

parent 9c0b2a56
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* css.c: Functions for DVD authentification and unscrambling * css.c: Functions for DVD authentification and unscrambling
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: css.c,v 1.2 2001/06/14 02:47:44 sam Exp $ * $Id: css.c,v 1.3 2001/06/29 11:34:28 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -268,6 +268,8 @@ int CSSInit( dvdcss_handle dvdcss ) ...@@ -268,6 +268,8 @@ int CSSInit( dvdcss_handle dvdcss )
return -1; return -1;
} }
fprintf( stderr, "DISK KEY: %02x %02x %02x %02x %02x\n", p_buffer[0], p_buffer[1], p_buffer[2], p_buffer[3], p_buffer[4] );
/* Unencrypt disc key using bus key */ /* Unencrypt disc key using bus key */
for( i = 0 ; i < 2048 ; i++ ) for( i = 0 ; i < 2048 ; i++ )
{ {
...@@ -351,10 +353,10 @@ int CSSGetKey( dvdcss_handle dvdcss ) ...@@ -351,10 +353,10 @@ int CSSGetKey( dvdcss_handle dvdcss )
for( i = 2 ; i < 0x30 ; i++ ) for( i = 2 ; i < 0x30 ; i++ )
{ {
for( j = i ; ( j < 0x80 ) && for( j = i+1 ; ( j < 0x80 ) &&
( pi_buf[0x7F - (j%i)] == pi_buf[0x7F-j] ) ; j++ ); ( pi_buf[0x7F - (j%i)] == pi_buf[0x7F-j] ) ; j++ );
{ {
if( ( j > i_best_plen ) && ( j > i ) ) if( j > i_best_plen )
{ {
i_best_plen = j; i_best_plen = j;
i_best_p = i; i_best_p = i;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* -dvd_udf to find files * -dvd_udf to find files
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.77 2001/06/27 09:53:56 massiot Exp $ * $Id: input_dvd.c,v 1.78 2001/06/29 11:34:28 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -701,7 +701,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -701,7 +701,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
* Chapter selection * Chapter selection
*/ */
if( p_area->i_part != p_dvd->i_chapter ) if( p_area->i_part != p_dvd->i_chapter )
{ {
if( ( p_area->i_part > 0 ) && if( ( p_area->i_part > 0 ) &&
...@@ -756,7 +755,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -756,7 +755,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_input->stream.b_seekable = 1; p_input->stream.b_seekable = 1;
p_input->stream.b_changed = 1; p_input->stream.b_changed = 1;
return 0; return 0;
} }
...@@ -784,10 +782,12 @@ static int DVDRead( input_thread_t * p_input, ...@@ -784,10 +782,12 @@ static int DVDRead( input_thread_t * p_input,
int i_sector; int i_sector;
boolean_t b_eof; boolean_t b_eof;
boolean_t b_eot; boolean_t b_eot;
boolean_t b_eoc;
p_dvd = (thread_dvd_data_t *)p_input->p_plugin_data; p_dvd = (thread_dvd_data_t *)p_input->p_plugin_data;
p_netlist = (dvd_netlist_t *)p_input->p_method_data; p_netlist = (dvd_netlist_t *)p_input->p_method_data;
b_eoc = 0;
i_sector = p_dvd->i_title_start + p_dvd->i_sector; i_sector = p_dvd->i_title_start + p_dvd->i_sector;
i_block_once = p_dvd->i_end_sector - p_dvd->i_sector + 1; i_block_once = p_dvd->i_end_sector - p_dvd->i_sector + 1;
...@@ -827,6 +827,7 @@ static int DVDRead( input_thread_t * p_input, ...@@ -827,6 +827,7 @@ static int DVDRead( input_thread_t * p_input,
( p_dvd->i_prg_cell - i_angle + 1 ) ) ( p_dvd->i_prg_cell - i_angle + 1 ) )
{ {
p_dvd->i_chapter++; p_dvd->i_chapter++;
b_eoc = 1;
} }
} }
...@@ -839,8 +840,9 @@ static int DVDRead( input_thread_t * p_input, ...@@ -839,8 +840,9 @@ static int DVDRead( input_thread_t * p_input,
{ {
i_block_once = p_dvd->i_block_once; i_block_once = p_dvd->i_block_once;
} }
//intf_WarnMsg( 2, "Sector: 0x%x Read: %d Chapter: %d", p_dvd->i_sector, i_block_once, p_dvd->i_chapter ); /*
intf_WarnMsg( 2, "Sector: 0x%x Read: %d Chapter: %d", p_dvd->i_sector, i_block_once, p_dvd->i_chapter );
*/
p_netlist->i_read_once = i_block_once; p_netlist->i_read_once = i_block_once;
/* Get an iovec pointer */ /* Get an iovec pointer */
...@@ -881,23 +883,8 @@ static int DVDRead( input_thread_t * p_input, ...@@ -881,23 +883,8 @@ static int DVDRead( input_thread_t * p_input,
} }
else else
{ {
/* Pack header. */ /* MPEG-2 Pack header. */
if( ( pi_cur[4] & 0xC0 ) == 0x40 )
{
/* MPEG-2 */
i_packet_size = 8; i_packet_size = 8;
}
else if( ( pi_cur[4] & 0xF0 ) == 0x20 )
{
/* MPEG-1 */
i_packet_size = 6;
}
else
{
intf_ErrMsg( "Unable to determine stream type" );
return( -1 );
}
pp_packets[i_packet] = pp_data[i_iovec]; pp_packets[i_packet] = pp_data[i_iovec];
} }
...@@ -929,7 +916,12 @@ static int DVDRead( input_thread_t * p_input, ...@@ -929,7 +916,12 @@ static int DVDRead( input_thread_t * p_input,
p_input->stream.p_selected_area->i_tell = p_input->stream.p_selected_area->i_tell =
LB2OFF( i_sector + i_read_blocks ) - LB2OFF( i_sector + i_read_blocks ) -
p_input->stream.p_selected_area->i_start; p_input->stream.p_selected_area->i_start;
if( b_eoc )
{
/* We modify i_part only at end of chapter not to erase
* some modification from the interface */
p_input->stream.p_selected_area->i_part = p_dvd->i_chapter; p_input->stream.p_selected_area->i_part = p_dvd->i_chapter;
}
b_eot = !( p_input->stream.p_selected_area->i_tell b_eot = !( p_input->stream.p_selected_area->i_tell
< p_input->stream.p_selected_area->i_size ); < p_input->stream.p_selected_area->i_size );
...@@ -1072,10 +1064,10 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off ) ...@@ -1072,10 +1064,10 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off )
LB2OFF ( dvdcss_seek( p_dvd->dvdhandle, p_dvd->i_title_start LB2OFF ( dvdcss_seek( p_dvd->dvdhandle, p_dvd->i_title_start
+ p_dvd->i_sector ) ) + p_dvd->i_sector ) )
- p_input->stream.p_selected_area->i_start; - p_input->stream.p_selected_area->i_start;
/*
intf_WarnMsg( 3, "Program Cell: %d Cell: %d Chapter: %d", intf_WarnMsg( 7, "Program Cell: %d Cell: %d Chapter: %d",
p_dvd->i_prg_cell, p_dvd->i_cell, p_dvd->i_chapter ); p_dvd->i_prg_cell, p_dvd->i_cell, p_dvd->i_chapter );
*/
return; return;
} }
...@@ -1108,7 +1100,7 @@ static int DVDFindCell( thread_dvd_data_t * p_dvd ) ...@@ -1108,7 +1100,7 @@ static int DVDFindCell( thread_dvd_data_t * p_dvd )
} }
/* /*
intf_WarnMsg( 3, "FindCell: i_cell %d i_index %d found %d nb %d", intf_WarnMsg( 7, "FindCell: i_cell %d i_index %d found %d nb %d",
p_dvd->i_cell, p_dvd->i_cell,
p_dvd->i_prg_cell, p_dvd->i_prg_cell,
i_cell, i_cell,
...@@ -1159,7 +1151,7 @@ static int DVDFindSector( thread_dvd_data_t * p_dvd ) ...@@ -1159,7 +1151,7 @@ static int DVDFindSector( thread_dvd_data_t * p_dvd )
#endif #endif
/* /*
intf_WarnMsg( 3, "cell: %d sector1: 0x%x end1: 0x%x\n" intf_WarnMsg( 7, "cell: %d sector1: 0x%x end1: 0x%x\n"
"index: %d sector2: 0x%x end2: 0x%x\n" "index: %d sector2: 0x%x end2: 0x%x\n"
"category: 0x%x ilvu end: 0x%x vobu start 0x%x", "category: 0x%x ilvu end: 0x%x vobu start 0x%x",
p_dvd->i_cell, p_dvd->i_cell,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_menu.c : functions to handle menu items. * gtk_menu.c : functions to handle menu items.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_menu.c,v 1.10 2001/06/14 01:49:44 sam Exp $ * $Id: gtk_menu.c,v 1.11 2001/06/29 11:34:28 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -838,6 +838,7 @@ gint GtkSetupMenus( intf_thread_t * p_intf ) ...@@ -838,6 +838,7 @@ gint GtkSetupMenus( intf_thread_t * p_intf )
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_chapter" ) ); p_intf->p_sys->p_window ), "menubar_chapter" ) );
GtkRadioMenu( p_intf, p_menubar_menu, NULL, "Chapter", GtkRadioMenu( p_intf, p_menubar_menu, NULL, "Chapter",
p_intf->p_input->stream.p_selected_area->i_part_nb, p_intf->p_input->stream.p_selected_area->i_part_nb,
p_intf->p_input->stream.p_selected_area->i_part, p_intf->p_input->stream.p_selected_area->i_part,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment