Commit 26300bb9 authored by Stéphane Borel's avatar Stéphane Borel

-better handling of angles: you should be able to change on the fly now

-removed � bug added at my last commit in css code; cleaned CSSGetKey

-various changes and bugfixes in the gnome interface.
parent 224c0e0b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_css.c: Functions for DVD authentification and unscrambling * dvd_css.c: Functions for DVD authentification and unscrambling
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.c,v 1.25 2001/04/20 05:40:03 stef Exp $ * $Id: dvd_css.c,v 1.26 2001/04/22 00:08:25 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -264,6 +264,12 @@ int CSSInit( int i_fd, css_t * p_css ) ...@@ -264,6 +264,12 @@ int CSSInit( int i_fd, css_t * p_css )
} }
memcpy( p_css->disc.pi_key_check, p_buffer, 2048 ); memcpy( p_css->disc.pi_key_check, p_buffer, 2048 );
/* initialize title key to know it empty */
for( i = 0 ; i < KEY_SIZE ; i++ )
{
p_css->pi_title_key[i] = 0;
}
/* Test authentication success */ /* Test authentication success */
switch( CSSGetASF( i_fd ) ) switch( CSSGetASF( i_fd ) )
{ {
...@@ -302,33 +308,25 @@ int CSSGetKey( int i_fd, css_t * p_css ) ...@@ -302,33 +308,25 @@ int CSSGetKey( int i_fd, css_t * p_css )
*/ */
u8 pi_buf[0x800]; u8 pi_buf[0x800];
dvd_key_t pi_key; dvd_key_t pi_key;
title_key_t p_title_key[10];
off_t i_pos; off_t i_pos;
boolean_t b_encrypted; boolean_t b_encrypted;
boolean_t b_stop_scanning; boolean_t b_stop_scanning;
int i_title;
int i_bytes_read; int i_bytes_read;
int i_best_plen; int i_best_plen;
int i_best_p; int i_best_p;
int i_registered_keys; int i,j;
int i_total_keys_found;
int i_highest; for( i = 0 ; i < KEY_SIZE ; i++ )
int i,j,k; {
pi_key[i] = 0;
}
memset( p_title_key, 0, 10 );
memset( &pi_key, 0, 10 );
b_encrypted = 0; b_encrypted = 0;
b_stop_scanning = 0; b_stop_scanning = 0;
i_registered_keys = 0 ;
i_total_keys_found = 0 ;
i_highest = 0;
/* Position of the title on the disc */ /* Position of the title on the disc */
i_title = p_css->i_title;
i_pos = p_css->i_title_pos; i_pos = p_css->i_title_pos;
//fprintf( stderr, "CSS %d start pos: %lld\n", i_title, i_pos );
do { do {
i_pos = lseek( i_fd, i_pos, SEEK_SET ); i_pos = lseek( i_fd, i_pos, SEEK_SET );
i_bytes_read = read( i_fd, pi_buf, 0x800 ); i_bytes_read = read( i_fd, pi_buf, 0x800 );
...@@ -359,39 +357,7 @@ int CSSGetKey( int i_fd, css_t * p_css ) ...@@ -359,39 +357,7 @@ int CSSGetKey( int i_fd, css_t * p_css )
&pi_buf[0x80 - ( i_best_plen / i_best_p) *i_best_p], &pi_buf[0x80 - ( i_best_plen / i_best_p) *i_best_p],
(dvd_key_t*)&pi_buf[0x54], (dvd_key_t*)&pi_buf[0x54],
&pi_key ); &pi_key );
while( i>=0 ) b_stop_scanning = ( i >= 0 );
{
k = 0;
for( j=0 ; j<i_registered_keys ; j++ )
{
if( memcmp( &(p_title_key[j].pi_key),
&pi_key, sizeof(dvd_key_t) ) == 0 )
{
p_title_key[j].i_occ++;
i_total_keys_found++;
k = 1;
}
}
if( k == 0 )
{
memcpy( &(p_title_key[i_registered_keys].pi_key),
&pi_key, sizeof(dvd_key_t) );
p_title_key[i_registered_keys++].i_occ = 1;
i_total_keys_found++;
}
i = CSSCracker( i, &pi_buf[0x80],
&pi_buf[0x80 - ( i_best_plen / i_best_p) *i_best_p],
(dvd_key_t*)&pi_buf[0x54], &pi_key);
}
/* Stop search if we find one occurence of the key
* I have never found a DVD for which it is not enough
* but we should take care of that */
if( i_registered_keys == 1 && p_title_key[0].i_occ >= 1 )
{
b_stop_scanning = 1;
}
} }
} }
...@@ -400,8 +366,10 @@ int CSSGetKey( int i_fd, css_t * p_css ) ...@@ -400,8 +366,10 @@ int CSSGetKey( int i_fd, css_t * p_css )
if( b_stop_scanning) if( b_stop_scanning)
{ {
intf_WarnMsg( 1, memcpy( p_css->pi_title_key,
"css info: found enough occurencies of the same key." ); &pi_key, sizeof(dvd_key_t) );
intf_WarnMsg( 2, "css info: vts key initialized" );
return 0;
} }
if( !b_encrypted ) if( !b_encrypted )
...@@ -410,68 +378,7 @@ int CSSGetKey( int i_fd, css_t * p_css ) ...@@ -410,68 +378,7 @@ int CSSGetKey( int i_fd, css_t * p_css )
return 0; return 0;
} }
if( b_encrypted && i_registered_keys == 0 ) return -1;
{
intf_ErrMsg( "css error: unable to determine keys from file" );
return -1;
}
for( i = 0 ; i < i_registered_keys - 1 ; i++ )
{
for( j = i + 1 ; j < i_registered_keys ; j++ )
{
if( p_title_key[j].i_occ > p_title_key[i].i_occ )
{
memcpy( &pi_key, &(p_title_key[j].pi_key), sizeof(dvd_key_t) );
k = p_title_key[j].i_occ;
memcpy( &(p_title_key[j].pi_key),
&(p_title_key[i].pi_key), sizeof(dvd_key_t) );
p_title_key[j].i_occ = p_title_key[i].i_occ;
memcpy( &(p_title_key[i].pi_key),&pi_key, sizeof(dvd_key_t) );
p_title_key[i].i_occ = k;
}
}
}
#ifdef STATS
intf_WarnMsg( 1, "css info: key(s) & key probability" );
intf_WarnMsg( 1, "----------------------------------" );
#endif
for( i=0 ; i<i_registered_keys ; i++ )
{
#ifdef STATS
intf_WarnMsg( 1, "%d) %02X %02X %02X %02X %02X - %3.2f%%", i,
p_title_key[i].pi_key[0], p_title_key[i].pi_key[1],
p_title_key[i].pi_key[2], p_title_key[i].pi_key[3],
p_title_key[i].pi_key[4],
p_title_key[i].i_occ * 100.0 / i_total_keys_found );
#endif
if( p_title_key[i_highest].i_occ * 100.0 / i_total_keys_found
<= p_title_key[i].i_occ*100.0 / i_total_keys_found )
{
i_highest = i;
}
}
/* The "find the key with the highest probability" code
* is untested, as I haven't been able to find a VOB that
* produces multiple keys (RT)
*/
intf_WarnMsg( 3, "css info: title %d, key %02X %02X %02X %02X %02X",
i_title, p_title_key[i_highest].pi_key[0],
p_title_key[i_highest].pi_key[1],
p_title_key[i_highest].pi_key[2],
p_title_key[i_highest].pi_key[3],
p_title_key[i_highest].pi_key[4] );
memcpy( p_css->pi_title_key,
p_title_key[i_highest].pi_key, KEY_SIZE );
intf_WarnMsg( 2, "css info: vts key initialized" );
return 0;
#else /* HAVE_CSS */ #else /* HAVE_CSS */
intf_ErrMsg( "css error: css decryption unavailable" ); intf_ErrMsg( "css error: css decryption unavailable" );
...@@ -520,9 +427,6 @@ int CSSDescrambleSector( dvd_key_t pi_key, u8* pi_sec ) ...@@ -520,9 +427,6 @@ int CSSDescrambleSector( dvd_key_t pi_key, u8* pi_sec )
pi_sec++; pi_sec++;
i_t5 >>= 8; i_t5 >>= 8;
} }
pi_sec[0x14] &= 0x8F;
} }
return 0; return 0;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_ifo.c: Functions for ifo parsing * dvd_ifo.c: Functions for ifo parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.c,v 1.23 2001/04/20 05:40:03 stef Exp $ * $Id: dvd_ifo.c,v 1.24 2001/04/22 00:08:25 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -663,9 +663,9 @@ DumpBits( p_ifo, pi_buffer, &p_current, 2 ); ...@@ -663,9 +663,9 @@ DumpBits( p_ifo, pi_buffer, &p_current, 2 );
p_current = FillBuffer( p_ifo, pi_buffer, i_start + p_current = FillBuffer( p_ifo, pi_buffer, i_start +
title_inf.pi_start_byte[i] ); title_inf.pi_start_byte[i] );
title_inf.p_title_start[i].i_program_chain_num = title_inf.p_title_start[i].i_title_id =
ReadWord( p_ifo, pi_buffer, &p_current ); ReadWord( p_ifo, pi_buffer, &p_current );
title_inf.p_title_start[i].i_program_num = ReadWord( p_ifo, pi_buffer, &p_current ); title_inf.p_title_start[i].i_chapter = ReadWord( p_ifo, pi_buffer, &p_current );
//fprintf( stderr, "VTS %d title_inf Pgc: %d Prg: %d\n", i,title_inf.p_title_start[i].i_program_chain_num, title_inf.p_title_start[i].i_program_num ); //fprintf( stderr, "VTS %d title_inf Pgc: %d Prg: %d\n", i,title_inf.p_title_start[i].i_program_chain_num, title_inf.p_title_start[i].i_program_num );
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_ifo.h: Structures for ifo parsing * dvd_ifo.h: Structures for ifo parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.h,v 1.13 2001/04/20 05:40:03 stef Exp $ * $Id: dvd_ifo.h,v 1.14 2001/04/22 00:08:25 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -459,8 +459,8 @@ typedef struct vts_manager_s ...@@ -459,8 +459,8 @@ typedef struct vts_manager_s
* we have a pointer to this structure for each tts */ * we have a pointer to this structure for each tts */
typedef struct title_start_s typedef struct title_start_s
{ {
u16 i_program_chain_num; // 2 bytes; Chapters/PGs u16 i_title_id; // 2 bytes; Chapters/PGs
u16 i_program_num; // 2 bytes u16 i_chapter; // 2 bytes
} title_start_t; } title_start_t;
/* Main struct for tts /* Main struct for tts
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_dvd.h: thread structure of the DVD plugin * input_dvd.h: thread structure of the DVD plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: input_dvd.h,v 1.20 2001/04/20 05:40:03 stef Exp $ * $Id: input_dvd.h,v 1.21 2001/04/22 00:08:26 stef Exp $
* *
* Author: Stéphane Borel <stef@via.ecp.fr> * Author: Stéphane Borel <stef@via.ecp.fr>
* *
...@@ -41,19 +41,20 @@ typedef struct thread_dvd_data_s ...@@ -41,19 +41,20 @@ typedef struct thread_dvd_data_s
/* Navigation information */ /* Navigation information */
int i_title; int i_title;
int i_vts_title; int i_vts_title;
int i_program_chain; int i_title_id;
int i_chapter_nb; int i_chapter_nb;
int i_chapter; int i_chapter;
int i_angle_nb; int i_angle_nb;
int i_angle; int i_angle;
int i_angle_cell; /* cell index in the current angle */
int i_cell; /* cell index in adress map */ int i_cell; /* cell index in adress map */
int i_prg_cell; /* cell index in program map */ int i_prg_cell; /* cell index in program map */
int i_sector; int i_sector;
int i_end_sector; /* last sector of current cell */ int i_end_sector; /* last sector of current cell */
off_t i_title_start; off_t i_title_start;
off_t i_start; off_t i_start;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gnome_callbacks.c : Callbacks for the Gnome plugin. * gnome_callbacks.c : Callbacks for the Gnome plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gnome_callbacks.c,v 1.23 2001/04/20 05:40:03 stef Exp $ * $Id: gnome_callbacks.c,v 1.24 2001/04/22 00:08:26 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>
...@@ -408,6 +408,25 @@ on_menubar_chapter_toggle (GtkCheckMenuItem *menuitem, ...@@ -408,6 +408,25 @@ on_menubar_chapter_toggle (GtkCheckMenuItem *menuitem,
} }
void
on_menubar_angle_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
input_area_t * p_area = p_intf->p_input->stream.p_selected_area;
gint i_angle = (gint)user_data;
if( menuitem->active && !p_intf->p_sys->b_angle_update )
{
p_area->i_angle = i_angle;
p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
p_intf->p_sys->b_angle_update = 1;
}
}
void void
on_menubar_modules_activate (GtkMenuItem *menuitem, on_menubar_modules_activate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
...@@ -745,6 +764,24 @@ on_popup_navigation_toggle (GtkCheckMenuItem *menuitem, ...@@ -745,6 +764,24 @@ on_popup_navigation_toggle (GtkCheckMenuItem *menuitem,
} }
void
on_popup_angle_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
input_area_t * p_area = p_intf->p_input->stream.p_selected_area;
gint i_angle = (gint)user_data;
if( menuitem->active && !p_intf->p_sys->b_angle_update )
{
p_area->i_angle = i_angle;
p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area );
p_intf->p_sys->b_angle_update = 1;
}
}
void void
on_popup_open_activate (GtkMenuItem *menuitem, on_popup_open_activate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
...@@ -846,11 +883,10 @@ on_fileopen_ok_clicked (GtkButton *button, ...@@ -846,11 +883,10 @@ on_fileopen_ok_clicked (GtkButton *button,
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, (char*)filename ); intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, (char*)filename );
/* Select added item and switch to file interface */ /* Select added item and switch to file interface */
intf_PlaylistJumpto( p_main->p_playlist, p_main->p_playlist->i_size-2 );
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
p_intf->p_input->b_eof = 1; p_intf->p_input->b_eof = 1;
p_intf->p_sys->i_intf_mode = FILE_MODE;
p_intf->p_sys->b_mode_changed = 1; // p_intf->p_sys->b_mode_changed = 1;
} }
...@@ -1018,7 +1054,7 @@ on_disc_ok_clicked (GtkButton *button, ...@@ -1018,7 +1054,7 @@ on_disc_ok_clicked (GtkButton *button,
intf_PlaylistJumpto( p_main->p_playlist, p_main->p_playlist->i_size-2 ); intf_PlaylistJumpto( p_main->p_playlist, p_main->p_playlist->i_size-2 );
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
p_intf->p_input->b_eof = 1; p_intf->p_input->b_eof = 1;
p_intf->p_sys->b_mode_changed = 1; // p_intf->p_sys->b_mode_changed = 1;
gtk_widget_hide( p_intf->p_sys->p_disc ); gtk_widget_hide( p_intf->p_sys->p_disc );
} }
...@@ -1089,8 +1125,7 @@ on_network_ok_clicked (GtkButton *button, ...@@ -1089,8 +1125,7 @@ on_network_ok_clicked (GtkButton *button,
intf_PlaylistJumpto( p_main->p_playlist, p_main->p_playlist->i_size-2 ); intf_PlaylistJumpto( p_main->p_playlist, p_main->p_playlist->i_size-2 );
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
p_intf->p_input->b_eof = 1; p_intf->p_input->b_eof = 1;
p_intf->p_sys->b_mode_changed = 1; // p_intf->p_sys->b_mode_changed = 1;
p_intf->p_sys->i_intf_mode = NET_MODE;
gtk_widget_hide( p_intf->p_sys->p_network ); gtk_widget_hide( p_intf->p_sys->p_network );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gnome_callbacks.h : Callbacks for the Gnome plugin. * gnome_callbacks.h : Callbacks for the Gnome plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gnome_callbacks.h,v 1.14 2001/04/08 07:24:47 stef Exp $ * $Id: gnome_callbacks.h,v 1.15 2001/04/22 00:08:26 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -289,3 +289,11 @@ on_button_title_prev_clicked (GtkButton *button, ...@@ -289,3 +289,11 @@ on_button_title_prev_clicked (GtkButton *button,
void void
on_button_title_next_clicked (GtkButton *button, on_button_title_next_clicked (GtkButton *button,
gpointer user_data); gpointer user_data);
void
on_menubar_angle_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data);
void
on_popup_angle_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data);
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_gnome.c: Gnome interface * intf_gnome.c: Gnome interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_gnome.c,v 1.31 2001/04/20 05:40:03 stef Exp $ * $Id: intf_gnome.c,v 1.32 2001/04/22 00:08:26 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>
...@@ -71,6 +71,8 @@ static gint GnomeLanguageMenus( gpointer, GtkWidget *, es_descriptor_t *, gint, ...@@ -71,6 +71,8 @@ static gint GnomeLanguageMenus( gpointer, GtkWidget *, es_descriptor_t *, gint,
void (*pf_toggle)(GtkCheckMenuItem *, gpointer) ); void (*pf_toggle)(GtkCheckMenuItem *, gpointer) );
static gint GnomeChapterMenu ( gpointer, GtkWidget *, static gint GnomeChapterMenu ( gpointer, GtkWidget *,
void (*pf_toggle)(GtkCheckMenuItem *, gpointer) ); void (*pf_toggle)(GtkCheckMenuItem *, gpointer) );
static gint GnomeAngleMenu ( gpointer, GtkWidget *,
void (*pf_toggle)(GtkCheckMenuItem *, gpointer) );
static gint GnomeTitleMenu ( gpointer, GtkWidget *, static gint GnomeTitleMenu ( gpointer, GtkWidget *,
void (*pf_toggle)(GtkCheckMenuItem *, gpointer) ); void (*pf_toggle)(GtkCheckMenuItem *, gpointer) );
static gint GnomeSetupMenu ( intf_thread_t * p_intf ); static gint GnomeSetupMenu ( intf_thread_t * p_intf );
...@@ -153,18 +155,12 @@ static int intf_Open( intf_thread_t *p_intf ) ...@@ -153,18 +155,12 @@ static int intf_Open( intf_thread_t *p_intf )
p_intf->p_sys->b_popup_changed = 0; p_intf->p_sys->b_popup_changed = 0;
p_intf->p_sys->b_window_changed = 0; p_intf->p_sys->b_window_changed = 0;
p_intf->p_sys->b_playlist_changed = 0; p_intf->p_sys->b_playlist_changed = 0;
p_intf->p_sys->b_title_update = 1;
p_intf->p_sys->b_chapter_update = 1;
p_intf->p_sys->b_audio_update = 1;
p_intf->p_sys->b_spu_update = 1;
p_intf->p_sys->b_slider_free = 1; p_intf->p_sys->b_slider_free = 1;
p_intf->p_sys->b_mode_changed = 1; p_intf->p_sys->b_mode_changed = 1;
p_intf->p_sys->i_intf_mode = FILE_MODE; p_intf->p_sys->i_intf_mode = FILE_MODE;
p_intf->p_sys->i_part = 0;
p_intf->p_sys->pf_gtk_callback = NULL; p_intf->p_sys->pf_gtk_callback = NULL;
p_intf->p_sys->pf_gdk_callback = NULL; p_intf->p_sys->pf_gdk_callback = NULL;
...@@ -316,8 +312,10 @@ static gint GnomeManage( gpointer p_data ) ...@@ -316,8 +312,10 @@ static gint GnomeManage( gpointer p_data )
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
GtkWidget * p_slider;
float newvalue; float newvalue;
// vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
/* New input or stream map change */ /* New input or stream map change */
if( p_intf->p_input->stream.b_changed || p_intf->p_sys->b_mode_changed ) if( p_intf->p_input->stream.b_changed || p_intf->p_sys->b_mode_changed )
{ {
...@@ -336,13 +334,35 @@ static gint GnomeManage( gpointer p_data ) ...@@ -336,13 +334,35 @@ static gint GnomeManage( gpointer p_data )
intf_ErrMsg( "intf error: can't determine input method" ); intf_ErrMsg( "intf error: can't determine input method" );
break; break;
} }
p_slider = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "slider" ) );
if( p_intf->p_input->stream.b_seekable )
{
gtk_widget_show( GTK_WIDGET( p_slider ) );
}
else
{
gtk_widget_hide( GTK_WIDGET( p_slider ) );
}
/* get ready for menu regeneration */
p_intf->p_sys->b_title_update = 1;
p_intf->p_sys->b_chapter_update = 1;
p_intf->p_sys->b_angle_update = 1;
p_intf->p_sys->b_audio_update = 1;
p_intf->p_sys->b_spu_update = 1;
p_intf->p_sys->i_part = 0;
p_intf->p_input->stream.b_changed = 0; p_intf->p_input->stream.b_changed = 0;
p_intf->p_sys->b_mode_changed = 0; p_intf->p_sys->b_mode_changed = 0;
intf_WarnMsg( 2, intf_WarnMsg( 2,
"Interface menus refreshed as stream has changed" ); "intf info: menus refreshed as stream has changed" );
} }
// vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
/* Update language/chapter menus after user request */ /* Update language/chapter menus after user request */
GnomeSetupMenu( p_intf ); GnomeSetupMenu( p_intf );
...@@ -520,6 +540,77 @@ static gint GnomeLanguageMenus( gpointer p_data, ...@@ -520,6 +540,77 @@ static gint GnomeLanguageMenus( gpointer p_data,
return TRUE; return TRUE;
} }
/*****************************************************************************
* GnomeAngleMenu: generate angle menu for current title
*****************************************************************************/
static gint GnomeAngleMenu( gpointer p_data, GtkWidget * p_angle,
void(*pf_toggle)( GtkCheckMenuItem *, gpointer ) )
{
intf_thread_t * p_intf;
char psz_name[10];
GtkWidget * p_angle_menu;
GSList * p_angle_group;
GtkWidget * p_item;
GtkWidget * p_item_active;
gint i_angle;
/* cast */
p_intf = (intf_thread_t*)p_data;
/* removes previous menu */
gtk_menu_item_remove_submenu( GTK_MENU_ITEM( p_angle ) );
gtk_widget_set_sensitive( p_angle, FALSE );
p_angle_menu = gtk_menu_new();;
p_angle_group = NULL;
p_item = NULL;
p_item_active = NULL;
for( i_angle = 0 ;
i_angle < p_intf->p_input->stream.p_selected_area->i_angle_nb ;
i_angle++ )
{
sprintf( psz_name, "Angle %d", i_angle + 1 );
p_item = gtk_radio_menu_item_new_with_label( p_angle_group,
psz_name );
p_angle_group =
gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) );
if( p_intf->p_input->stream.p_selected_area->i_angle ==
( i_angle + 1 ) )
{
p_item_active = p_item;
}
gtk_widget_show( p_item );
/* setup signal hanling */
gtk_signal_connect( GTK_OBJECT( p_item ),
"toggled",
GTK_SIGNAL_FUNC( pf_toggle ),
(gpointer)(i_angle + 1) );
gtk_menu_append( GTK_MENU( p_angle_menu ), p_item );
}
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_angle ), p_angle_menu );
if( p_item_active != NULL )
{
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ),
TRUE );
}
/* be sure that menu is sensitive if non empty */
if( p_intf->p_input->stream.p_selected_area->i_angle_nb > 1 )
{
gtk_widget_set_sensitive( p_angle, TRUE );
}
return TRUE;
}
/***************************************************************************** /*****************************************************************************
* GnomeChapterMenu: generate chapter menu for current title * GnomeChapterMenu: generate chapter menu for current title
*****************************************************************************/ *****************************************************************************/
...@@ -662,6 +753,10 @@ static gint GnomeTitleMenu( gpointer p_data, ...@@ -662,6 +753,10 @@ static gint GnomeTitleMenu( gpointer p_data,
/* cast */ /* cast */
p_intf = (intf_thread_t*)p_data; p_intf = (intf_thread_t*)p_data;
/* removes previous menu */
gtk_menu_item_remove_submenu( GTK_MENU_ITEM( p_navigation ) );
gtk_widget_set_sensitive( p_navigation, FALSE );
p_title_menu = gtk_menu_new(); p_title_menu = gtk_menu_new();
p_title_group = NULL; p_title_group = NULL;
p_title_submenu = NULL; p_title_submenu = NULL;
...@@ -845,8 +940,8 @@ static gint GnomeSetupMenu( intf_thread_t * p_intf ) ...@@ -845,8 +940,8 @@ static gint GnomeSetupMenu( intf_thread_t * p_intf )
GtkWidget * p_popup_menu; GtkWidget * p_popup_menu;
gint i; gint i;
p_intf->p_sys->b_title_update &= ( p_intf->p_input->stream.i_area_nb > 1 );
p_intf->p_sys->b_chapter_update |= p_intf->p_sys->b_title_update; p_intf->p_sys->b_chapter_update |= p_intf->p_sys->b_title_update;
p_intf->p_sys->b_angle_update |= p_intf->p_sys->b_title_update;
p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_title_update; p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_title_update;
p_intf->p_sys->b_spu_update |= p_intf->p_sys->b_title_update; p_intf->p_sys->b_spu_update |= p_intf->p_sys->b_title_update;
...@@ -883,8 +978,22 @@ static gint GnomeSetupMenu( intf_thread_t * p_intf ) ...@@ -883,8 +978,22 @@ static gint GnomeSetupMenu( intf_thread_t * p_intf )
p_intf->p_sys->i_part = p_intf->p_sys->i_part =
p_intf->p_input->stream.p_selected_area->i_part; p_intf->p_input->stream.p_selected_area->i_part;
p_intf->p_sys->b_chapter_update = 0; p_intf->p_sys->b_chapter_update = 0;
} }
if( p_intf->p_sys->b_angle_update )
{
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_angle" ) );
GnomeAngleMenu( p_intf, p_menubar_menu, on_menubar_angle_toggle );
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_angle" ) );
GnomeAngleMenu( p_intf, p_popup_menu, on_popup_angle_toggle );
p_intf->p_sys->b_angle_update = 0;
}
/* look for selected ES */ /* look for selected ES */
p_audio_es = NULL; p_audio_es = NULL;
...@@ -1006,7 +1115,7 @@ static gint GnomeFileModeManage( intf_thread_t * p_intf ) ...@@ -1006,7 +1115,7 @@ static gint GnomeFileModeManage( intf_thread_t * p_intf )
GtkWidget * p_dvd_box; GtkWidget * p_dvd_box;
GtkWidget * p_file_box; GtkWidget * p_file_box;
GtkWidget * p_network_box; GtkWidget * p_network_box;
// char * psz_name; char * psz_name;
p_network_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_network_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "network_box" ) ); p_intf->p_sys->p_window ), "network_box" ) );
...@@ -1019,9 +1128,12 @@ static gint GnomeFileModeManage( intf_thread_t * p_intf ) ...@@ -1019,9 +1128,12 @@ static gint GnomeFileModeManage( intf_thread_t * p_intf )
p_file_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_file_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "file_box" ) ); p_intf->p_sys->p_window ), "file_box" ) );
gtk_widget_show( GTK_WIDGET( p_file_box ) ); gtk_widget_show( GTK_WIDGET( p_file_box ) );
#if 0
psz_name = malloc( 16 + strlen( p_intf->p_input->p_source ) ); #if 1
sprintf( psz_name, "Status: playing %s", p_intf->p_input->p_source ); // psz_name = malloc( 16 + strlen( p_intf->p_input->p_source ) );
// sprintf( psz_name, "Status: playing %s", p_intf->p_input->p_source );
psz_name = strdup( p_intf->p_input->p_source );
gtk_label_set_text( p_intf->p_sys->p_label_status, psz_name ); gtk_label_set_text( p_intf->p_sys->p_label_status, psz_name );
......
...@@ -157,6 +157,7 @@ ...@@ -157,6 +157,7 @@
<class>GtkMenuItem</class> <class>GtkMenuItem</class>
<name>menubar_title</name> <name>menubar_title</name>
<sensitive>False</sensitive> <sensitive>False</sensitive>
<tooltip>Choose title</tooltip>
<label>_Title</label> <label>_Title</label>
<right_justify>False</right_justify> <right_justify>False</right_justify>
</widget> </widget>
...@@ -165,10 +166,20 @@ ...@@ -165,10 +166,20 @@
<class>GtkMenuItem</class> <class>GtkMenuItem</class>
<name>menubar_chapter</name> <name>menubar_chapter</name>
<sensitive>False</sensitive> <sensitive>False</sensitive>
<tooltip>Choose chapter</tooltip>
<label>_Chapter</label> <label>_Chapter</label>
<right_justify>False</right_justify> <right_justify>False</right_justify>
</widget> </widget>
<widget>
<class>GtkMenuItem</class>
<name>menubar_angle</name>
<sensitive>False</sensitive>
<tooltip>Choose angle</tooltip>
<label>An_gle</label>
<right_justify>False</right_justify>
</widget>
<widget> <widget>
<class>GtkMenuItem</class> <class>GtkMenuItem</class>
<name>separator7</name> <name>separator7</name>
...@@ -491,6 +502,7 @@ ...@@ -491,6 +502,7 @@
<widget> <widget>
<class>GtkHBox</class> <class>GtkHBox</class>
<name>hbox4</name> <name>hbox4</name>
<width>650</width>
<homogeneous>True</homogeneous> <homogeneous>True</homogeneous>
<spacing>0</spacing> <spacing>0</spacing>
<child> <child>
...@@ -519,6 +531,7 @@ ...@@ -519,6 +531,7 @@
<widget> <widget>
<class>GtkLabel</class> <class>GtkLabel</class>
<name>label_status</name> <name>label_status</name>
<width>350</width>
<label>Status: foo</label> <label>Status: foo</label>
<justify>GTK_JUSTIFY_CENTER</justify> <justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap> <wrap>False</wrap>
...@@ -528,8 +541,8 @@ ...@@ -528,8 +541,8 @@
<ypad>0</ypad> <ypad>0</ypad>
<child> <child>
<padding>0</padding> <padding>0</padding>
<expand>True</expand> <expand>False</expand>
<fill>True</fill> <fill>False</fill>
</child> </child>
</widget> </widget>
...@@ -796,9 +809,8 @@ ...@@ -796,9 +809,8 @@
<widget> <widget>
<class>GtkHBox</class> <class>GtkHBox</class>
<name>network_box</name> <name>network_box</name>
<height>24</height>
<visible>False</visible> <visible>False</visible>
<homogeneous>False</homogeneous> <homogeneous>True</homogeneous>
<spacing>0</spacing> <spacing>0</spacing>
<child> <child>
<padding>0</padding> <padding>0</padding>
...@@ -807,109 +819,64 @@ ...@@ -807,109 +819,64 @@
</child> </child>
<widget> <widget>
<class>GtkLabel</class> <class>Placeholder</class>
<name>label_network</name>
<label>Network Channel:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>False</fill>
</child>
</widget> </widget>
<widget> <widget>
<class>GtkToggleButton</class> <class>Placeholder</class>
<name>button_network_channel_1</name>
<can_focus>True</can_focus>
<label>Channel 1</label>
<relief>GTK_RELIEF_HALF</relief>
<active>True</active>
<child>
<padding>2</padding>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkToggleButton</class>
<name>button_network_channel_2</name>
<sensitive>False</sensitive>
<can_focus>True</can_focus>
<label>Channel 2</label>
<relief>GTK_RELIEF_HALF</relief>
<active>False</active>
<child>
<padding>2</padding>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkToggleButton</class>
<name>button_network_channel_3</name>
<sensitive>False</sensitive>
<can_focus>True</can_focus>
<label>Channel 3</label>
<relief>GTK_RELIEF_HALF</relief>
<active>False</active>
<child>
<padding>2</padding>
<expand>False</expand>
<fill>True</fill>
</child>
</widget> </widget>
<widget> <widget>
<class>GtkToggleButton</class> <class>GtkHBox</class>
<name>button_network_channel_4</name> <name>network_channel_box</name>
<sensitive>False</sensitive> <homogeneous>False</homogeneous>
<can_focus>True</can_focus> <spacing>0</spacing>
<label>Channel 4</label>
<relief>GTK_RELIEF_HALF</relief>
<active>False</active>
<child> <child>
<padding>2</padding> <padding>0</padding>
<expand>False</expand> <expand>True</expand>
<fill>True</fill> <fill>True</fill>
</child> </child>
</widget>
<widget> <widget>
<class>GtkToggleButton</class> <class>GtkLabel</class>
<name>button_network_channel_5</name> <name>label_network</name>
<sensitive>False</sensitive> <label>Network Channel:</label>
<can_focus>True</can_focus> <justify>GTK_JUSTIFY_CENTER</justify>
<label>Channel 5</label> <wrap>False</wrap>
<relief>GTK_RELIEF_HALF</relief> <xalign>0.5</xalign>
<active>False</active> <yalign>0.5</yalign>
<child> <xpad>0</xpad>
<padding>2</padding> <ypad>0</ypad>
<expand>False</expand> <child>
<fill>True</fill> <padding>0</padding>
</child> <expand>True</expand>
</widget> <fill>False</fill>
</child>
</widget>
<widget> <widget>
<class>GtkToggleButton</class> <class>GtkSpinButton</class>
<name>button_network_channel_6</name> <name>network_spinbutton</name>
<sensitive>False</sensitive> <sensitive>False</sensitive>
<can_focus>True</can_focus> <can_focus>True</can_focus>
<label>Channel 6</label> <climb_rate>1</climb_rate>
<relief>GTK_RELIEF_HALF</relief> <digits>0</digits>
<active>False</active> <numeric>False</numeric>
<child> <update_policy>GTK_UPDATE_ALWAYS</update_policy>
<padding>2</padding> <snap>False</snap>
<expand>False</expand> <wrap>False</wrap>
<fill>True</fill> <value>1</value>
</child> <lower>0</lower>
<upper>100</upper>
<step>1</step>
<page>10</page>
<page_size>10</page_size>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
</widget> </widget>
</widget> </widget>
</widget> </widget>
...@@ -1000,6 +967,14 @@ ...@@ -1000,6 +967,14 @@
<right_justify>False</right_justify> <right_justify>False</right_justify>
</widget> </widget>
<widget>
<class>GtkMenuItem</class>
<name>popup_angle</name>
<sensitive>False</sensitive>
<label>An_gle</label>
<right_justify>False</right_justify>
</widget>
<widget> <widget>
<class>GtkMenuItem</class> <class>GtkMenuItem</class>
<name>popup_audio</name> <name>popup_audio</name>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_gnome.h: private Gnome interface description * intf_gnome.h: private Gnome interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_gnome.h,v 1.7 2001/04/20 05:40:03 stef Exp $ * $Id: intf_gnome.h,v 1.8 2001/04/22 00:08:26 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -48,6 +48,7 @@ typedef struct intf_sys_s ...@@ -48,6 +48,7 @@ typedef struct intf_sys_s
boolean_t b_title_update; /* do we need to update title menus */ boolean_t b_title_update; /* do we need to update title menus */
boolean_t b_chapter_update; /* do we need to update boolean_t b_chapter_update; /* do we need to update
chapter menus */ chapter menus */
boolean_t b_angle_update; /* do we need to update angle menus */
boolean_t b_audio_update; /* do we need to update audio menus */ boolean_t b_audio_update; /* do we need to update audio menus */
boolean_t b_spu_update; /* do we need to update spu menus */ boolean_t b_spu_update; /* do we need to update spu menus */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management * input_ps.c: PS demux and packet management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ps.c,v 1.16 2001/04/20 05:40:03 stef Exp $ * $Id: input_ps.c,v 1.17 2001/04/22 00:08:26 stef Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr> * Cyril Deguet <asmax@via.ecp.fr>
...@@ -348,6 +348,7 @@ static void PSInit( input_thread_t * p_input ) ...@@ -348,6 +348,7 @@ static void PSInit( input_thread_t * p_input )
{ {
/* The programs will be added when we read them. */ /* The programs will be added when we read them. */
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.i_method = INPUT_METHOD_FILE;
p_input->stream.pp_programs[0]->b_is_ok = 0; p_input->stream.pp_programs[0]->b_is_ok = 0;
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.98 2001/04/15 04:19:58 sam Exp $ * $Id: input.c,v 1.99 2001/04/22 00:08:26 stef Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -225,6 +225,11 @@ static void RunThread( input_thread_t *p_input ) ...@@ -225,6 +225,11 @@ static void RunThread( input_thread_t *p_input )
return; return;
} }
/* initialization is completed */
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.b_changed = 1;
vlc_mutex_unlock( &p_input->stream.stream_lock );
while( !p_input->b_die && !p_input->b_error && !p_input->b_eof ) while( !p_input->b_die && !p_input->b_error && !p_input->b_eof )
{ {
data_packet_t * pp_packets[p_input->i_read_once]; data_packet_t * pp_packets[p_input->i_read_once];
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: input_programs.c,v 1.49 2001/04/13 05:36:12 stef Exp $ * $Id: input_programs.c,v 1.50 2001/04/22 00:08:26 stef Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -57,7 +57,10 @@ int input_InitStream( input_thread_t * p_input, size_t i_data_len ) ...@@ -57,7 +57,10 @@ int input_InitStream( input_thread_t * p_input, size_t i_data_len )
p_input->stream.i_method = INPUT_METHOD_NONE; p_input->stream.i_method = INPUT_METHOD_NONE;
p_input->stream.i_stream_id = 0; p_input->stream.i_stream_id = 0;
p_input->stream.b_changed = 1;
/* initialized to 0 since we don't give the signal to the interface
* before the end of input initialization */
p_input->stream.b_changed = 0;
p_input->stream.pp_es = NULL; p_input->stream.pp_es = NULL;
p_input->stream.pp_selected_es = NULL; p_input->stream.pp_selected_es = NULL;
p_input->stream.pp_programs = NULL; p_input->stream.pp_programs = NULL;
...@@ -281,6 +284,8 @@ input_area_t * input_AddArea( input_thread_t * p_input ) ...@@ -281,6 +284,8 @@ input_area_t * input_AddArea( input_thread_t * p_input )
p_input->stream.pp_areas[i_area_index]->i_seek = NO_SEEK; p_input->stream.pp_areas[i_area_index]->i_seek = NO_SEEK;
p_input->stream.pp_areas[i_area_index]->i_part_nb = 1; p_input->stream.pp_areas[i_area_index]->i_part_nb = 1;
p_input->stream.pp_areas[i_area_index]->i_part= 0; p_input->stream.pp_areas[i_area_index]->i_part= 0;
p_input->stream.pp_areas[i_area_index]->i_angle_nb = 1;
p_input->stream.pp_areas[i_area_index]->i_angle = 0;
return p_input->stream.pp_areas[i_area_index]; return p_input->stream.pp_areas[i_area_index];
} }
......
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