-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.
This commit is contained in:
Stéphane Borel 2001-04-22 00:08:26 +00:00
parent 224c0e0be6
commit 26300bb99a
14 changed files with 968 additions and 845 deletions

View File

@ -2,7 +2,7 @@
* dvd_css.c: Functions for DVD authentification and unscrambling
*****************************************************************************
* 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: Stéphane Borel <stef@via.ecp.fr>
*
@ -264,6 +264,12 @@ int CSSInit( int i_fd, css_t * p_css )
}
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 */
switch( CSSGetASF( i_fd ) )
{
@ -302,33 +308,25 @@ int CSSGetKey( int i_fd, css_t * p_css )
*/
u8 pi_buf[0x800];
dvd_key_t pi_key;
title_key_t p_title_key[10];
off_t i_pos;
boolean_t b_encrypted;
boolean_t b_stop_scanning;
int i_title;
int i_bytes_read;
int i_best_plen;
int i_best_p;
int i_registered_keys;
int i_total_keys_found;
int i_highest;
int i,j,k;
int i,j;
for( i = 0 ; i < KEY_SIZE ; i++ )
{
pi_key[i] = 0;
}
memset( p_title_key, 0, 10 );
memset( &pi_key, 0, 10 );
b_encrypted = 0;
b_stop_scanning = 0;
i_registered_keys = 0 ;
i_total_keys_found = 0 ;
i_highest = 0;
/* Position of the title on the disc */
i_title = p_css->i_title;
i_pos = p_css->i_title_pos;
//fprintf( stderr, "CSS %d start pos: %lld\n", i_title, i_pos );
do {
i_pos = lseek( i_fd, i_pos, SEEK_SET );
i_bytes_read = read( i_fd, pi_buf, 0x800 );
@ -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],
(dvd_key_t*)&pi_buf[0x54],
&pi_key );
while( 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;
}
b_stop_scanning = ( i >= 0 );
}
}
@ -400,8 +366,10 @@ int CSSGetKey( int i_fd, css_t * p_css )
if( b_stop_scanning)
{
intf_WarnMsg( 1,
"css info: found enough occurencies of the same key." );
memcpy( p_css->pi_title_key,
&pi_key, sizeof(dvd_key_t) );
intf_WarnMsg( 2, "css info: vts key initialized" );
return 0;
}
if( !b_encrypted )
@ -410,68 +378,7 @@ int CSSGetKey( int i_fd, css_t * p_css )
return 0;
}
if( b_encrypted && i_registered_keys == 0 )
{
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;
return -1;
#else /* HAVE_CSS */
intf_ErrMsg( "css error: css decryption unavailable" );
@ -520,9 +427,6 @@ int CSSDescrambleSector( dvd_key_t pi_key, u8* pi_sec )
pi_sec++;
i_t5 >>= 8;
}
pi_sec[0x14] &= 0x8F;
}
return 0;

View File

@ -2,7 +2,7 @@
* dvd_ifo.c: Functions for ifo parsing
*****************************************************************************
* 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: Stéphane Borel <stef@via.ecp.fr>
*
@ -663,9 +663,9 @@ DumpBits( p_ifo, pi_buffer, &p_current, 2 );
p_current = FillBuffer( p_ifo, pi_buffer, i_start +
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 );
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 );
}
}

View File

@ -2,7 +2,7 @@
* dvd_ifo.h: Structures for ifo parsing
*****************************************************************************
* 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: Stéphane Borel <stef@via.ecp.fr>
*
@ -459,8 +459,8 @@ typedef struct vts_manager_s
* we have a pointer to this structure for each tts */
typedef struct title_start_s
{
u16 i_program_chain_num; // 2 bytes; Chapters/PGs
u16 i_program_num; // 2 bytes
u16 i_title_id; // 2 bytes; Chapters/PGs
u16 i_chapter; // 2 bytes
} title_start_t;
/* Main struct for tts

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
* input_dvd.h: thread structure of the DVD plugin
*****************************************************************************
* 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>
*
@ -41,19 +41,20 @@ typedef struct thread_dvd_data_s
/* Navigation information */
int i_title;
int i_vts_title;
int i_program_chain;
int i_title_id;
int i_chapter_nb;
int i_chapter;
int i_angle_nb;
int i_angle;
int i_angle_cell; /* cell index in the current angle */
int i_cell; /* cell index in adress map */
int i_prg_cell; /* cell index in program map */
int i_cell; /* cell index in adress map */
int i_prg_cell; /* cell index in program map */
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_start;

View File

@ -2,7 +2,7 @@
* gnome_callbacks.c : Callbacks for the Gnome plugin.
*****************************************************************************
* 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>
* Stéphane Borel <stef@via.ecp.fr>
@ -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
on_menubar_modules_activate (GtkMenuItem *menuitem,
gpointer user_data)
@ -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
on_popup_open_activate (GtkMenuItem *menuitem,
gpointer user_data)
@ -846,11 +883,10 @@ on_fileopen_ok_clicked (GtkButton *button,
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, (char*)filename );
/* 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 )
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,
intf_PlaylistJumpto( p_main->p_playlist, p_main->p_playlist->i_size-2 );
if( p_intf->p_input != NULL )
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 );
}
@ -1089,8 +1125,7 @@ on_network_ok_clicked (GtkButton *button,
intf_PlaylistJumpto( p_main->p_playlist, p_main->p_playlist->i_size-2 );
if( p_intf->p_input != NULL )
p_intf->p_input->b_eof = 1;
p_intf->p_sys->b_mode_changed = 1;
p_intf->p_sys->i_intf_mode = NET_MODE;
// p_intf->p_sys->b_mode_changed = 1;
gtk_widget_hide( p_intf->p_sys->p_network );
}

View File

@ -2,7 +2,7 @@
* gnome_callbacks.h : Callbacks for the Gnome plugin.
*****************************************************************************
* 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>
*
@ -289,3 +289,11 @@ on_button_title_prev_clicked (GtkButton *button,
void
on_button_title_next_clicked (GtkButton *button,
gpointer user_data);
void
on_menubar_angle_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data);
void
on_popup_angle_toggle (GtkCheckMenuItem *menuitem,
gpointer user_data);

View File

@ -49,14 +49,21 @@ static GnomeUIInfo menubar_view_menu_uiinfo[] =
{
{
GNOME_APP_UI_ITEM, N_("_Title"),
NULL,
N_("Choose title"),
(gpointer) NULL, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
},
{
GNOME_APP_UI_ITEM, N_("_Chapter"),
NULL,
N_("Choose chapter"),
(gpointer) NULL, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
},
{
GNOME_APP_UI_ITEM, N_("An_gle"),
N_("Choose angle"),
(gpointer) NULL, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
@ -154,13 +161,10 @@ create_intf_window (void)
GtkWidget *button_chapter_prev;
GtkWidget *button_chapter_next;
GtkWidget *network_box;
GtkWidget *network_channel_box;
GtkWidget *label_network;
GtkWidget *button_network_channel_1;
GtkWidget *button_network_channel_2;
GtkWidget *button_network_channel_3;
GtkWidget *button_network_channel_4;
GtkWidget *button_network_channel_5;
GtkWidget *button_network_channel_6;
GtkObject *network_spinbutton_adj;
GtkWidget *network_spinbutton;
GtkWidget *appbar;
GtkTooltips *tooltips;
@ -225,22 +229,28 @@ create_intf_window (void)
gtk_widget_set_sensitive (menubar_view_menu_uiinfo[1].widget, FALSE);
gtk_widget_ref (menubar_view_menu_uiinfo[2].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator7",
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_angle",
menubar_view_menu_uiinfo[2].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_sensitive (menubar_view_menu_uiinfo[2].widget, FALSE);
gtk_widget_ref (menubar_view_menu_uiinfo[3].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_playlist",
gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator7",
menubar_view_menu_uiinfo[3].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_sensitive (menubar_view_menu_uiinfo[3].widget, FALSE);
gtk_widget_ref (menubar_view_menu_uiinfo[4].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_modules",
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_playlist",
menubar_view_menu_uiinfo[4].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_sensitive (menubar_view_menu_uiinfo[4].widget, FALSE);
gtk_widget_ref (menubar_view_menu_uiinfo[5].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_modules",
menubar_view_menu_uiinfo[5].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_sensitive (menubar_view_menu_uiinfo[5].widget, FALSE);
gtk_widget_ref (menubar_uiinfo[2].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_settings",
menubar_uiinfo[2].widget,
@ -455,6 +465,7 @@ create_intf_window (void)
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox4);
gtk_box_pack_start (GTK_BOX (vbox2), hbox4, TRUE, TRUE, 0);
gtk_widget_set_usize (hbox4, 650, -2);
label_date = gtk_label_new (_("-:--:--"));
gtk_widget_ref (label_date);
@ -468,7 +479,8 @@ create_intf_window (void)
gtk_object_set_data_full (GTK_OBJECT (intf_window), "label_status", label_status,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label_status);
gtk_box_pack_start (GTK_BOX (hbox4), label_status, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox4), label_status, FALSE, FALSE, 0);
gtk_widget_set_usize (label_status, 350, -2);
label_bar = gtk_label_new (_("Bar: baz"));
gtk_widget_ref (label_bar);
@ -585,73 +597,34 @@ create_intf_window (void)
gtk_tooltips_set_tip (tooltips, button_chapter_next, _("Select next chapter"), NULL);
gtk_button_set_relief (GTK_BUTTON (button_chapter_next), GTK_RELIEF_NONE);
network_box = gtk_hbox_new (FALSE, 0);
network_box = gtk_hbox_new (TRUE, 0);
gtk_widget_ref (network_box);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "network_box", network_box,
(GtkDestroyNotify) gtk_widget_unref);
gtk_box_pack_start (GTK_BOX (vbox2), network_box, TRUE, TRUE, 0);
gtk_widget_set_usize (network_box, -2, 24);
network_channel_box = gtk_hbox_new (FALSE, 0);
gtk_widget_ref (network_channel_box);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "network_channel_box", network_channel_box,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (network_channel_box);
gtk_box_pack_start (GTK_BOX (network_box), network_channel_box, TRUE, TRUE, 0);
label_network = gtk_label_new (_("Network Channel:"));
gtk_widget_ref (label_network);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "label_network", label_network,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label_network);
gtk_box_pack_start (GTK_BOX (network_box), label_network, TRUE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (network_channel_box), label_network, TRUE, FALSE, 0);
button_network_channel_1 = gtk_toggle_button_new_with_label (_("Channel 1"));
gtk_widget_ref (button_network_channel_1);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "button_network_channel_1", button_network_channel_1,
network_spinbutton_adj = gtk_adjustment_new (1, 0, 100, 1, 10, 10);
network_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (network_spinbutton_adj), 1, 0);
gtk_widget_ref (network_spinbutton);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "network_spinbutton", network_spinbutton,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button_network_channel_1);
gtk_box_pack_start (GTK_BOX (network_box), button_network_channel_1, FALSE, TRUE, 2);
gtk_button_set_relief (GTK_BUTTON (button_network_channel_1), GTK_RELIEF_HALF);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_network_channel_1), TRUE);
button_network_channel_2 = gtk_toggle_button_new_with_label (_("Channel 2"));
gtk_widget_ref (button_network_channel_2);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "button_network_channel_2", button_network_channel_2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button_network_channel_2);
gtk_box_pack_start (GTK_BOX (network_box), button_network_channel_2, FALSE, TRUE, 2);
gtk_widget_set_sensitive (button_network_channel_2, FALSE);
gtk_button_set_relief (GTK_BUTTON (button_network_channel_2), GTK_RELIEF_HALF);
button_network_channel_3 = gtk_toggle_button_new_with_label (_("Channel 3"));
gtk_widget_ref (button_network_channel_3);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "button_network_channel_3", button_network_channel_3,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button_network_channel_3);
gtk_box_pack_start (GTK_BOX (network_box), button_network_channel_3, FALSE, TRUE, 2);
gtk_widget_set_sensitive (button_network_channel_3, FALSE);
gtk_button_set_relief (GTK_BUTTON (button_network_channel_3), GTK_RELIEF_HALF);
button_network_channel_4 = gtk_toggle_button_new_with_label (_("Channel 4"));
gtk_widget_ref (button_network_channel_4);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "button_network_channel_4", button_network_channel_4,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button_network_channel_4);
gtk_box_pack_start (GTK_BOX (network_box), button_network_channel_4, FALSE, TRUE, 2);
gtk_widget_set_sensitive (button_network_channel_4, FALSE);
gtk_button_set_relief (GTK_BUTTON (button_network_channel_4), GTK_RELIEF_HALF);
button_network_channel_5 = gtk_toggle_button_new_with_label (_("Channel 5"));
gtk_widget_ref (button_network_channel_5);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "button_network_channel_5", button_network_channel_5,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button_network_channel_5);
gtk_box_pack_start (GTK_BOX (network_box), button_network_channel_5, FALSE, TRUE, 2);
gtk_widget_set_sensitive (button_network_channel_5, FALSE);
gtk_button_set_relief (GTK_BUTTON (button_network_channel_5), GTK_RELIEF_HALF);
button_network_channel_6 = gtk_toggle_button_new_with_label (_("Channel 6"));
gtk_widget_ref (button_network_channel_6);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "button_network_channel_6", button_network_channel_6,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button_network_channel_6);
gtk_box_pack_start (GTK_BOX (network_box), button_network_channel_6, FALSE, TRUE, 2);
gtk_widget_set_sensitive (button_network_channel_6, FALSE);
gtk_button_set_relief (GTK_BUTTON (button_network_channel_6), GTK_RELIEF_HALF);
gtk_widget_show (network_spinbutton);
gtk_box_pack_start (GTK_BOX (network_channel_box), network_spinbutton, FALSE, TRUE, 0);
gtk_widget_set_sensitive (network_spinbutton, FALSE);
appbar = gnome_appbar_new (TRUE, TRUE, GNOME_PREFERENCES_NEVER);
gtk_widget_ref (appbar);
@ -793,6 +766,13 @@ static GnomeUIInfo intf_popup_uiinfo[] =
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
},
{
GNOME_APP_UI_ITEM, N_("An_gle"),
NULL,
(gpointer) NULL, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType) 0, NULL
},
{
GNOME_APP_UI_ITEM, N_("_Audio"),
N_("Select audio channel"),
@ -855,21 +835,27 @@ create_intf_popup (void)
gtk_widget_set_sensitive (intf_popup_uiinfo[5].widget, FALSE);
gtk_widget_ref (intf_popup_uiinfo[6].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_audio",
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_angle",
intf_popup_uiinfo[6].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_sensitive (intf_popup_uiinfo[6].widget, FALSE);
gtk_widget_ref (intf_popup_uiinfo[7].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_subtitle",
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_audio",
intf_popup_uiinfo[7].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_sensitive (intf_popup_uiinfo[7].widget, FALSE);
gtk_widget_ref (intf_popup_uiinfo[8].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_file",
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_subtitle",
intf_popup_uiinfo[8].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_set_sensitive (intf_popup_uiinfo[8].widget, FALSE);
gtk_widget_ref (intf_popup_uiinfo[9].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_file",
intf_popup_uiinfo[9].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (popup_file_menu_uiinfo[0].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_open",
@ -896,14 +882,14 @@ create_intf_popup (void)
popup_file_menu_uiinfo[4].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (intf_popup_uiinfo[9].widget);
gtk_widget_ref (intf_popup_uiinfo[10].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator2",
intf_popup_uiinfo[9].widget,
intf_popup_uiinfo[10].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (intf_popup_uiinfo[10].widget);
gtk_widget_ref (intf_popup_uiinfo[11].widget);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_exit",
intf_popup_uiinfo[10].widget,
intf_popup_uiinfo[11].widget,
(GtkDestroyNotify) gtk_widget_unref);
return intf_popup;

View File

@ -2,7 +2,7 @@
* intf_gnome.c: Gnome interface
*****************************************************************************
* 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>
* Stéphane Borel <stef@via.ecp.fr>
@ -71,6 +71,8 @@ static gint GnomeLanguageMenus( gpointer, GtkWidget *, es_descriptor_t *, gint,
void (*pf_toggle)(GtkCheckMenuItem *, gpointer) );
static gint GnomeChapterMenu ( gpointer, GtkWidget *,
void (*pf_toggle)(GtkCheckMenuItem *, gpointer) );
static gint GnomeAngleMenu ( gpointer, GtkWidget *,
void (*pf_toggle)(GtkCheckMenuItem *, gpointer) );
static gint GnomeTitleMenu ( gpointer, GtkWidget *,
void (*pf_toggle)(GtkCheckMenuItem *, gpointer) );
static gint GnomeSetupMenu ( 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_window_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_mode_changed = 1;
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_gdk_callback = NULL;
@ -316,8 +312,10 @@ static gint GnomeManage( gpointer p_data )
if( p_intf->p_input != NULL )
{
GtkWidget * p_slider;
float newvalue;
// vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
/* New input or stream map change */
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 )
intf_ErrMsg( "intf error: can't determine input method" );
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_sys->b_mode_changed = 0;
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 */
GnomeSetupMenu( p_intf );
@ -520,6 +540,77 @@ static gint GnomeLanguageMenus( gpointer p_data,
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
*****************************************************************************/
@ -662,6 +753,10 @@ static gint GnomeTitleMenu( gpointer p_data,
/* cast */
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_group = NULL;
p_title_submenu = NULL;
@ -845,8 +940,8 @@ static gint GnomeSetupMenu( intf_thread_t * p_intf )
GtkWidget * p_popup_menu;
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_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_spu_update |= p_intf->p_sys->b_title_update;
@ -883,8 +978,22 @@ static gint GnomeSetupMenu( intf_thread_t * p_intf )
p_intf->p_sys->i_part =
p_intf->p_input->stream.p_selected_area->i_part;
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 */
p_audio_es = NULL;
@ -1006,7 +1115,7 @@ static gint GnomeFileModeManage( intf_thread_t * p_intf )
GtkWidget * p_dvd_box;
GtkWidget * p_file_box;
GtkWidget * p_network_box;
// char * psz_name;
char * psz_name;
p_network_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "network_box" ) );
@ -1019,9 +1128,12 @@ static gint GnomeFileModeManage( intf_thread_t * p_intf )
p_file_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "file_box" ) );
gtk_widget_show( GTK_WIDGET( p_file_box ) );
#if 0
psz_name = malloc( 16 + strlen( p_intf->p_input->p_source ) );
sprintf( psz_name, "Status: playing %s", p_intf->p_input->p_source );
#if 1
// 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 );

View File

@ -157,6 +157,7 @@
<class>GtkMenuItem</class>
<name>menubar_title</name>
<sensitive>False</sensitive>
<tooltip>Choose title</tooltip>
<label>_Title</label>
<right_justify>False</right_justify>
</widget>
@ -165,10 +166,20 @@
<class>GtkMenuItem</class>
<name>menubar_chapter</name>
<sensitive>False</sensitive>
<tooltip>Choose chapter</tooltip>
<label>_Chapter</label>
<right_justify>False</right_justify>
</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>
<class>GtkMenuItem</class>
<name>separator7</name>
@ -491,6 +502,7 @@
<widget>
<class>GtkHBox</class>
<name>hbox4</name>
<width>650</width>
<homogeneous>True</homogeneous>
<spacing>0</spacing>
<child>
@ -519,6 +531,7 @@
<widget>
<class>GtkLabel</class>
<name>label_status</name>
<width>350</width>
<label>Status: foo</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
@ -528,8 +541,8 @@
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
@ -796,9 +809,8 @@
<widget>
<class>GtkHBox</class>
<name>network_box</name>
<height>24</height>
<visible>False</visible>
<homogeneous>False</homogeneous>
<homogeneous>True</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
@ -807,109 +819,64 @@
</child>
<widget>
<class>GtkLabel</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>
<class>Placeholder</class>
</widget>
<widget>
<class>Placeholder</class>
</widget>
<widget>
<class>GtkHBox</class>
<name>network_channel_box</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkToggleButton</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>GtkLabel</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>
<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>
<class>GtkToggleButton</class>
<name>button_network_channel_4</name>
<sensitive>False</sensitive>
<can_focus>True</can_focus>
<label>Channel 4</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_5</name>
<sensitive>False</sensitive>
<can_focus>True</can_focus>
<label>Channel 5</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_6</name>
<sensitive>False</sensitive>
<can_focus>True</can_focus>
<label>Channel 6</label>
<relief>GTK_RELIEF_HALF</relief>
<active>False</active>
<child>
<padding>2</padding>
<expand>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkSpinButton</class>
<name>network_spinbutton</name>
<sensitive>False</sensitive>
<can_focus>True</can_focus>
<climb_rate>1</climb_rate>
<digits>0</digits>
<numeric>False</numeric>
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
<snap>False</snap>
<wrap>False</wrap>
<value>1</value>
<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>
@ -1000,6 +967,14 @@
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>popup_angle</name>
<sensitive>False</sensitive>
<label>An_gle</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>popup_audio</name>

View File

@ -2,7 +2,7 @@
* intf_gnome.h: private Gnome interface description
*****************************************************************************
* 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>
*
@ -48,6 +48,7 @@ typedef struct intf_sys_s
boolean_t b_title_update; /* do we need to update title menus */
boolean_t b_chapter_update; /* do we need to update
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_spu_update; /* do we need to update spu menus */

View File

@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management
*****************************************************************************
* 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>
* Cyril Deguet <asmax@via.ecp.fr>
@ -348,6 +348,7 @@ static void PSInit( input_thread_t * p_input )
{
/* The programs will be added when we read them. */
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;
vlc_mutex_unlock( &p_input->stream.stream_lock );
}

View File

@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* 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>
*
@ -225,6 +225,11 @@ static void RunThread( input_thread_t *p_input )
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 )
{
data_packet_t * pp_packets[p_input->i_read_once];

View File

@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* 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>
*
@ -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_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_selected_es = NULL;
p_input->stream.pp_programs = NULL;
@ -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_part_nb = 1;
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];
}