From 72ca053968c0d15b46acc544a0a3626b4a5e6aeb Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Borel?= Date: Sun, 8 Apr 2001 07:24:47 +0000 Subject: [PATCH 1/1] -changes in gnome interface -bugfix in input dvd --- include/input_ext-intf.h | 13 +- plugins/dvd/dvd_ifo.c | 14 +- plugins/dvd/dvd_ifo.h | 4 +- plugins/dvd/input_dvd.c | 28 ++-- plugins/gnome/gnome_callbacks.c | 176 ++++++++++++++-------- plugins/gnome/gnome_callbacks.h | 18 +-- plugins/gnome/gnome_interface.c | 179 +++++++++++++++++++--- plugins/gnome/intf_gnome.c | 185 +++++++++++++++-------- plugins/gnome/intf_gnome.glade | 256 ++++++++++++++++++++++++++++++-- plugins/gnome/intf_gnome.h | 6 +- plugins/gtk/intf_gtk.c | 27 ++-- src/input/input_ext-intf.c | 13 +- src/input/input_programs.c | 8 +- src/input/mpeg_system.c | 8 +- src/interface/intf_playlist.c | 6 +- 15 files changed, 726 insertions(+), 215 deletions(-) diff --git a/include/input_ext-intf.h b/include/input_ext-intf.h index 16b76e2294..9cf96aef7a 100644 --- a/include/input_ext-intf.h +++ b/include/input_ext-intf.h @@ -4,7 +4,7 @@ * control the pace of reading. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: input_ext-intf.h,v 1.29 2001/04/01 07:31:38 stef Exp $ + * $Id: input_ext-intf.h,v 1.30 2001/04/08 07:24:47 stef Exp $ * * Authors: Christophe Massiot * @@ -52,7 +52,8 @@ typedef struct es_descriptor_s boolean_t b_audio; /* is the stream an audio stream that * will need to be discarded with * fast forward and slow motion ? */ - boolean_t b_spu; + u8 i_cat; /* stream category: video, audio, + * spu, other */ char psz_desc[20]; /* description of ES: audio language * for instance ; NULL if not @@ -96,6 +97,12 @@ typedef struct es_descriptor_s #define LPCM_AUDIO_ES 0x83 #define UNKNOWN_ES 0xFF +/* ES Categories */ +#define VIDEO_ES 0x00 +#define AUDIO_ES 0x01 +#define SPU_ES 0x02 +#define NAV_ES 0x03 +#define UNKNOWN_ES 0xFF /***************************************************************************** * pgrm_descriptor_t ***************************************************************************** @@ -352,7 +359,7 @@ void input_SetRate ( struct input_thread_s *, int ); void input_Seek ( struct input_thread_s *, off_t ); void input_DumpStream( struct input_thread_s * ); char * input_OffsetToTime( struct input_thread_s *, char * psz_buffer, off_t ); -int input_ChangeES ( struct input_thread_s *, struct es_descriptor_s *, int ); +int input_ChangeES ( struct input_thread_s *, struct es_descriptor_s *, u8 ); int input_ToggleES ( struct input_thread_s *, struct es_descriptor_s *, boolean_t ); diff --git a/plugins/dvd/dvd_ifo.c b/plugins/dvd/dvd_ifo.c index 10a67cc390..20833a426e 100644 --- a/plugins/dvd/dvd_ifo.c +++ b/plugins/dvd/dvd_ifo.c @@ -2,7 +2,7 @@ * dvd_ifo.c: Functions for ifo parsing ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: dvd_ifo.c,v 1.16 2001/04/01 07:31:38 stef Exp $ + * $Id: dvd_ifo.c,v 1.17 2001/04/08 07:24:47 stef Exp $ * * Author: Stéphane Borel * @@ -539,11 +539,19 @@ FLUSH(2); { GETLL( &i_temp ); //fprintf( stderr, "Audio %d: %llx\n", i, i_temp ); - i_temp >>= 32; + i_temp >>= 8; + manager_inf.p_audio_attr[i].i_bar = i_temp & 0xff; + i_temp >>= 8; + manager_inf.p_audio_attr[i].i_caption = i_temp & 0xff; + i_temp >>= 8; + manager_inf.p_audio_attr[i].i_foo = i_temp & 0xff; + i_temp >>= 8; manager_inf.p_audio_attr[i].i_lang_code = i_temp & 0xffff; i_temp >>= 16; manager_inf.p_audio_attr[i].i_num_channels = i_temp & 0x7; - i_temp >>= 4; + i_temp >>= 3; + manager_inf.p_audio_attr[i].i_test = i_temp & 0x1; + i_temp >>= 1; manager_inf.p_audio_attr[i].i_sample_freq = i_temp & 0x3; i_temp >>= 2; manager_inf.p_audio_attr[i].i_quantization = i_temp & 0x3; diff --git a/plugins/dvd/dvd_ifo.h b/plugins/dvd/dvd_ifo.h index a0b1a60ee3..b3e2d8a1fb 100644 --- a/plugins/dvd/dvd_ifo.h +++ b/plugins/dvd/dvd_ifo.h @@ -2,7 +2,7 @@ * dvd_ifo.h: Structures for ifo parsing ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: dvd_ifo.h,v 1.10 2001/04/04 02:49:18 sam Exp $ + * $Id: dvd_ifo.h,v 1.11 2001/04/08 07:24:47 stef Exp $ * * Author: Stéphane Borel * @@ -57,7 +57,7 @@ typedef struct ifo_audio_s u8 i_quantization ;// 2; u8 i_sample_freq ;// 2; -// u8 ;// 1; + u8 i_test ;// 1; u8 i_num_channels ;// 3; u16 i_lang_code ;// 16; // description u8 i_foo ;// 8; // 0x00000000 ? diff --git a/plugins/dvd/input_dvd.c b/plugins/dvd/input_dvd.c index c271e757ed..7483959b0d 100644 --- a/plugins/dvd/input_dvd.c +++ b/plugins/dvd/input_dvd.c @@ -10,7 +10,7 @@ * -dvd_udf to find files ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: input_dvd.c,v 1.37 2001/04/03 03:39:41 stef Exp $ + * $Id: input_dvd.c,v 1.38 2001/04/08 07:24:47 stef Exp $ * * Author: Stéphane Borel * @@ -365,6 +365,7 @@ static int DVDFindCell( thread_dvd_data_t * p_dvd ) if( i_cell == cell.i_cell_nb ) { + intf_ErrMsg( "dvd error: can't find cell" ); return -1; } else @@ -392,6 +393,7 @@ static int DVDFindSector( thread_dvd_data_t * p_dvd ) if( DVDFindCell( p_dvd ) < 0 ) { + intf_ErrMsg( "dvd error: can't find sector" ); return -1; } @@ -421,6 +423,7 @@ static int DVDChapterSelect( thread_dvd_data_t * p_dvd, int i_chapter ) /* Find cell index in Program chain for current chapter */ p_dvd->i_prg_cell = title.chapter_map.pi_start_cell[i_chapter-1] - 1; p_dvd->i_cell = 0; + p_dvd->i_sector = 0; /* Search for cell_index in cell adress_table and initialize start sector */ DVDFindSector( p_dvd ); @@ -561,12 +564,17 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) input_AddProgram( p_input, 0, sizeof( stream_ps_data_t ) ); + /* No PSM to read in DVD mode, we already have all information */ + p_input->stream.pp_programs[0]->b_is_ok = 1; + p_input->stream.pp_programs[0]->i_synchro_state = SYNCHRO_START; + p_es = NULL; /* ES 0 -> video MPEG2 */ p_es = input_AddES( p_input, p_input->stream.pp_programs[0], 0xe0, 0 ); p_es->i_stream_id = 0xe0; p_es->i_type = MPEG2_VIDEO_ES; + p_es->i_cat = VIDEO_ES; input_SelectES( p_input, p_es ); intf_WarnMsg( 1, "dvd info: video MPEG2 stream" ); @@ -579,15 +587,15 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) { #ifdef DEBUG - intf_DbgMsg( "Audio %d: %x %x %x %x %x %x %x %x %x %x %x %x\n", i, + intf_WarnMsg( 1, "Audio %d: %x %x %x %x %x %x %x %x %x %x %x %x", i, vts.manager_inf.p_audio_attr[i-1].i_num_channels, vts.manager_inf.p_audio_attr[i-1].i_coding_mode, vts.manager_inf.p_audio_attr[i-1].i_multichannel_extension, vts.manager_inf.p_audio_attr[i-1].i_type, vts.manager_inf.p_audio_attr[i-1].i_appl_mode, vts.manager_inf.p_audio_attr[i-1].i_foo, + vts.manager_inf.p_audio_attr[i-1].i_test, vts.manager_inf.p_audio_attr[i-1].i_bar, - vts.manager_inf.p_audio_attr[i-1].i_appl_mode, vts.manager_inf.p_audio_attr[i-1].i_quantization, vts.manager_inf.p_audio_attr[i-1].i_sample_freq, vts.manager_inf.p_audio_attr[i-1].i_lang_code, @@ -603,8 +611,10 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) p_es->i_stream_id = 0xbd; p_es->i_type = AC3_AUDIO_ES; p_es->b_audio = 1; + p_es->i_cat = AUDIO_ES; strcpy( p_es->psz_desc, Language( hton16( vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) ); + strcat( p_es->psz_desc, " (ac3)" ); intf_WarnMsg( 1, "dvd info: audio stream %d %s\t(0x%x)", i, p_es->psz_desc, i_id ); @@ -618,8 +628,10 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) p_es->i_stream_id = i_id; p_es->i_type = MPEG2_AUDIO_ES; p_es->b_audio = 1; + p_es->i_cat = AUDIO_ES; strcpy( p_es->psz_desc, Language( hton16( vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) ); + strcat( p_es->psz_desc, " (mpeg)" ); intf_WarnMsg( 1, "dvd info: audio stream %d %s\t(0x%x)", i, p_es->psz_desc, i_id ); @@ -655,7 +667,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) p_input->stream.pp_programs[0], i_id, 0 ); p_es->i_stream_id = 0xbd; p_es->i_type = DVD_SPU_ES; - p_es->b_spu = 1; + p_es->i_cat = SPU_ES; strcpy( p_es->psz_desc, Language( hton16( vts.manager_inf.p_spu_attr[i-1].i_lang_code ) ) ); intf_WarnMsg( 1, "dvd info: spu stream %d %s\t(0x%x)", @@ -674,7 +686,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) main_PutIntVariable( INPUT_CHANNEL_VAR, 1 ); i_audio = 1; } - if( i_audio > 0 ) + if( i_audio > 0 && vts.manager_inf.i_audio_nb > 0 ) { input_SelectES( p_input, p_input->stream.pp_es[i_audio] ); } @@ -686,7 +698,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) main_PutIntVariable( INPUT_CHANNEL_VAR, 1 ); i_spu = 0; } - if( i_spu > 0 ) + if( i_spu > 0 && vts.manager_inf.i_spu_nb > 0 ) { i_spu += vts.manager_inf.i_audio_nb; input_SelectES( p_input, p_input->stream.pp_es[i_spu] ); @@ -714,10 +726,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) p_area->i_part, p_area->i_tell ); } - /* No PSM to read in DVD mode, we already have all information */ - p_input->stream.pp_programs[0]->b_is_ok = 1; - p_input->stream.pp_programs[0]->i_synchro_state = SYNCHRO_START; - vlc_mutex_unlock( &p_input->stream.stream_lock ); #undef vts #undef vmg diff --git a/plugins/gnome/gnome_callbacks.c b/plugins/gnome/gnome_callbacks.c index 3bdaae865c..98f38a719f 100644 --- a/plugins/gnome/gnome_callbacks.c +++ b/plugins/gnome/gnome_callbacks.c @@ -2,7 +2,7 @@ * gnome_callbacks.c : Callbacks for the Gnome plugin. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: gnome_callbacks.c,v 1.20 2001/04/03 03:39:41 stef Exp $ + * $Id: gnome_callbacks.c,v 1.21 2001/04/08 07:24:47 stef Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -160,6 +160,54 @@ on_intf_window_drag_data_received (GtkWidget *widget, } +void +on_button_title_prev_clicked (GtkButton *button, + gpointer user_data) +{ + intf_thread_t * p_intf; + input_area_t * p_area; + int i_id; + + p_intf = GetIntf( GTK_WIDGET(button), "intf_window" ); + i_id = p_intf->p_input->stream.p_selected_area->i_id - 1; + + if( i_id >= 0 ) + { + p_area = p_intf->p_input->stream.pp_areas[i_id]; + p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area ); + p_intf->p_sys->b_menus_update = 1; + + input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); + + p_intf->p_sys->b_menus_update = 1; + } +} + + +void +on_button_title_next_clicked (GtkButton *button, + gpointer user_data) +{ + intf_thread_t * p_intf; + input_area_t * p_area; + int i_id; + + p_intf = GetIntf( GTK_WIDGET(button), "intf_window" ); + i_id = p_intf->p_input->stream.p_selected_area->i_id + 1; + + if( i_id < p_intf->p_input->stream.i_area_nb ) + { + p_area = p_intf->p_input->stream.pp_areas[i_id]; + p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area ); + p_intf->p_sys->b_menus_update = 1; + + input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); + + p_intf->p_sys->b_menus_update = 1; + } +} + + void on_button_chapter_prev_clicked (GtkButton *button, gpointer user_data) @@ -170,11 +218,14 @@ on_button_chapter_prev_clicked (GtkButton *button, p_intf = GetIntf( GTK_WIDGET(button), "intf_window" ); p_area = p_intf->p_input->stream.p_selected_area; - if( p_area->i_part - 1 >= 0 ) + if( p_area->i_part > 0 ) { p_area->i_part--; p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area ); + input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); + + p_intf->p_sys->b_menus_update = 1; } } @@ -189,11 +240,14 @@ on_button_chapter_next_clicked (GtkButton *button, p_intf = GetIntf( GTK_WIDGET(button), "intf_window" ); p_area = p_intf->p_input->stream.p_selected_area; - if( p_area->i_part + 1 < p_area->i_part_nb ) + if( p_area->i_part < p_area->i_part_nb ) { p_area->i_part++; p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area ); + input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); + + p_intf->p_sys->b_menus_update = 1; } } @@ -278,13 +332,13 @@ void on_menubar_audio_toggle (GtkCheckMenuItem *menuitem, gpointer user_data) { - intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); + intf_thread_t * p_intf; es_descriptor_t * p_es; - p_es = (es_descriptor_t*)user_data; - - if( p_intf->p_sys->b_menus_ready ) + if( !p_intf->p_sys->b_menus_update ) { + p_es = (es_descriptor_t*)user_data; + input_ToggleES( p_intf->p_input, p_es, menuitem->active ); } } @@ -294,13 +348,15 @@ void on_menubar_subtitle_toggle (GtkCheckMenuItem *menuitem, gpointer user_data) { - intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); + intf_thread_t * p_intf; es_descriptor_t * p_es; - p_es = (es_descriptor_t*)user_data; + p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); - if( p_intf->p_sys->b_menus_ready ) + if( !p_intf->p_sys->b_menus_update ) { + p_es = (es_descriptor_t*)user_data; + input_ToggleES( p_intf->p_input, p_es, menuitem->active ); } } @@ -310,14 +366,16 @@ void on_menubar_title_toggle (GtkCheckMenuItem *menuitem, gpointer user_data) { - intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); + intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" ); - if( menuitem->active && p_intf->p_sys->b_menus_ready ) + if( menuitem->active && !p_intf->p_sys->b_menus_update ) { p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)user_data ); - p_intf->p_sys->b_menus_update = 1; + input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); + + p_intf->p_sys->b_menus_update = 1; } } @@ -329,14 +387,21 @@ on_menubar_chapter_toggle (GtkCheckMenuItem *menuitem, 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_chapter = (gint)user_data; + char psz_chapter[3]; - if( menuitem->active && p_intf->p_sys->b_menus_ready ) + if( menuitem->active && !p_intf->p_sys->b_menus_update ) { p_area->i_part = i_chapter; p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area ); + + snprintf( psz_chapter, 3, "%02d", p_area->i_part ); + gtk_label_set_text( p_intf->p_sys->p_label_chapter, psz_chapter ); + + input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); + + p_intf->p_sys->b_menus_update = 1; } - input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); } void @@ -526,6 +591,8 @@ on_toolbar_prev_clicked (GtkButton *button, intf_PlaylistPrev( p_main->p_playlist ); p_intf->p_input->b_eof = 1; } + + p_intf->p_sys->b_mode_changed = 1; } @@ -540,48 +607,8 @@ on_toolbar_next_clicked (GtkButton *button, /* FIXME: temporary hack */ p_intf->p_input->b_eof = 1; } -} - - -void -on_toolbar_prev_title_clicked (GtkButton *button, - gpointer user_data) -{ - intf_thread_t * p_intf; - input_area_t * p_area; - int i_id; - - p_intf = GetIntf( GTK_WIDGET(button), "intf_window" ); - i_id = p_intf->p_input->stream.p_selected_area->i_id - 1; - - if( i_id >= 0 ) - { - p_area = p_intf->p_input->stream.pp_areas[i_id]; - p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area ); - p_intf->p_sys->b_menus_update = 1; - input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); - } -} - - -void -on_toolbar_next_title_clicked (GtkButton *button, - gpointer user_data) -{ - intf_thread_t * p_intf; - input_area_t * p_area; - int i_id; - - p_intf = GetIntf( GTK_WIDGET(button), "intf_window" ); - i_id = p_intf->p_input->stream.p_selected_area->i_id + 1; - if( i_id < p_intf->p_input->stream.i_area_nb ) - { - p_area = p_intf->p_input->stream.pp_areas[i_id]; - p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area ); - p_intf->p_sys->b_menus_update = 1; - input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); - } + p_intf->p_sys->b_mode_changed = 1; } @@ -652,7 +679,7 @@ on_popup_audio_toggle (GtkCheckMenuItem *menuitem, p_es = (es_descriptor_t*)user_data; - if( p_intf->p_sys->b_menus_ready ) + if( !p_intf->p_sys->b_menus_update ) { input_ToggleES( p_intf->p_input, p_es, menuitem->active ); } @@ -668,7 +695,7 @@ on_popup_subtitle_toggle (GtkCheckMenuItem *menuitem, p_es = (es_descriptor_t*)user_data; - if( p_intf->p_sys->b_menus_ready ) + if( !p_intf->p_sys->b_menus_update ) { input_ToggleES( p_intf->p_input, p_es, menuitem->active ); } @@ -681,7 +708,7 @@ on_popup_navigation_toggle (GtkCheckMenuItem *menuitem, { intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" ); - if( menuitem->active && p_intf->p_sys->b_menus_ready ) + if( menuitem->active && !p_intf->p_sys->b_menus_update ) { input_area_t * p_area; gint i_title; @@ -690,16 +717,14 @@ on_popup_navigation_toggle (GtkCheckMenuItem *menuitem, i_title = (gint)(user_data) / 100; i_chapter = (gint)(user_data) - ( 100 * i_title ); - if( i_title != p_intf->p_input->stream.p_selected_area->i_id ) - { - p_intf->p_sys->b_menus_update = 1; - } - p_area = p_intf->p_input->stream.pp_areas[i_title]; p_area->i_part = i_chapter; p_intf->p_input->pf_set_area( p_intf->p_input, (input_area_t*)p_area ); + input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY ); + + p_intf->p_sys->b_menus_update = 1; } } @@ -793,6 +818,8 @@ void on_fileopen_ok_clicked (GtkButton *button, gpointer user_data) { + intf_thread_t *p_intf = GetIntf( GTK_WIDGET(button), "intf_fileopen" ); + GtkWidget *filesel; gchar *filename; @@ -801,6 +828,13 @@ on_fileopen_ok_clicked (GtkButton *button, filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel)); 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; } @@ -937,7 +971,6 @@ on_disc_ok_clicked (GtkButton *button, { psz_method = "dvd"; p_intf->p_sys->i_intf_mode = DVD_MODE; - p_intf->p_sys->b_mode_changed = 1; } else if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button), "disc_vcd" ) )->active ) @@ -965,6 +998,12 @@ on_disc_ok_clicked (GtkButton *button, intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_source ); free( psz_source ); + /* Select added item and switch to DVD 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->b_mode_changed = 1; + gtk_widget_hide( p_intf->p_sys->p_disc ); } @@ -1030,6 +1069,13 @@ on_network_ok_clicked (GtkButton *button, intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_source ); free( psz_source ); + /* Select added item and switch to network 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->b_mode_changed = 1; + p_intf->p_sys->i_intf_mode = NET_MODE; + gtk_widget_hide( p_intf->p_sys->p_network ); } diff --git a/plugins/gnome/gnome_callbacks.h b/plugins/gnome/gnome_callbacks.h index dc3b7d9a5d..1582e9202f 100644 --- a/plugins/gnome/gnome_callbacks.h +++ b/plugins/gnome/gnome_callbacks.h @@ -2,7 +2,7 @@ * gnome_callbacks.h : Callbacks for the Gnome plugin. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: gnome_callbacks.h,v 1.13 2001/04/03 03:39:41 stef Exp $ + * $Id: gnome_callbacks.h,v 1.14 2001/04/08 07:24:47 stef Exp $ * * Authors: Samuel Hocevar * @@ -86,14 +86,6 @@ void on_toolbar_next_clicked (GtkButton *button, gpointer user_data); -void -on_toolbar_prev_title_clicked (GtkButton *button, - gpointer user_data); - -void -on_toolbar_next_title_clicked (GtkButton *button, - gpointer user_data); - void on_popup_play_activate (GtkMenuItem *menuitem, gpointer user_data); @@ -289,3 +281,11 @@ on_button_chapter_prev_clicked (GtkButton *button, void on_button_chapter_next_clicked (GtkButton *button, gpointer user_data); + +void +on_button_title_prev_clicked (GtkButton *button, + gpointer user_data); + +void +on_button_title_next_clicked (GtkButton *button, + gpointer user_data); diff --git a/plugins/gnome/gnome_interface.c b/plugins/gnome/gnome_interface.c index 7568653b19..50a908cf73 100644 --- a/plugins/gnome/gnome_interface.c +++ b/plugins/gnome/gnome_interface.c @@ -140,12 +140,27 @@ create_intf_window (void) GtkWidget *label_status; GtkWidget *label_bar; GtkWidget *slider; + GtkWidget *file_box; + GtkWidget *label_file; GtkWidget *dvd_box; + GtkWidget *title_chapter_box; + GtkWidget *label19; GtkWidget *label_title; - GtkWidget *hbox6; - GtkWidget *button_chapter_prev; + GtkWidget *button_title_prev; + GtkWidget *button_title_next; + GtkWidget *dvd_chapter_box; + GtkWidget *label20; GtkWidget *label_chapter; + GtkWidget *button_chapter_prev; GtkWidget *button_chapter_next; + GtkWidget *network_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; GtkWidget *appbar; GtkTooltips *tooltips; @@ -471,51 +486,173 @@ create_intf_window (void) gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE); gtk_scale_set_digits (GTK_SCALE (slider), 3); + file_box = gtk_hbox_new (FALSE, 0); + gtk_widget_ref (file_box); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "file_box", file_box, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (file_box); + gtk_box_pack_start (GTK_BOX (vbox2), file_box, TRUE, TRUE, 0); + + label_file = gtk_label_new (_("Vlc File Mode")); + gtk_widget_ref (label_file); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "label_file", label_file, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (label_file); + gtk_box_pack_start (GTK_BOX (file_box), label_file, TRUE, TRUE, 0); + gtk_widget_set_usize (label_file, -2, 24); + dvd_box = gtk_hbox_new (FALSE, 0); gtk_widget_ref (dvd_box); gtk_object_set_data_full (GTK_OBJECT (intf_window), "dvd_box", dvd_box, (GtkDestroyNotify) gtk_widget_unref); gtk_box_pack_start (GTK_BOX (vbox2), dvd_box, TRUE, TRUE, 0); + gtk_widget_set_usize (dvd_box, -2, 24); - label_title = gtk_label_new (_("Title:")); + title_chapter_box = gtk_hbox_new (FALSE, 10); + gtk_widget_ref (title_chapter_box); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "title_chapter_box", title_chapter_box, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (title_chapter_box); + gtk_box_pack_start (GTK_BOX (dvd_box), title_chapter_box, TRUE, FALSE, 0); + + label19 = gtk_label_new (_("Title:")); + gtk_widget_ref (label19); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "label19", label19, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (label19); + gtk_box_pack_start (GTK_BOX (title_chapter_box), label19, FALSE, FALSE, 0); + + label_title = gtk_label_new (_("--")); gtk_widget_ref (label_title); gtk_object_set_data_full (GTK_OBJECT (intf_window), "label_title", label_title, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label_title); - gtk_box_pack_start (GTK_BOX (dvd_box), label_title, TRUE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (title_chapter_box), label_title, FALSE, FALSE, 0); + + button_title_prev = gnome_stock_button (GNOME_STOCK_BUTTON_PREV); + gtk_widget_ref (button_title_prev); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "button_title_prev", button_title_prev, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (button_title_prev); + gtk_box_pack_start (GTK_BOX (title_chapter_box), button_title_prev, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, button_title_prev, _("Select previous title"), NULL); + gtk_button_set_relief (GTK_BUTTON (button_title_prev), GTK_RELIEF_NONE); + + button_title_next = gnome_stock_button (GNOME_STOCK_BUTTON_NEXT); + gtk_widget_ref (button_title_next); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "button_title_next", button_title_next, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (button_title_next); + gtk_box_pack_start (GTK_BOX (title_chapter_box), button_title_next, FALSE, FALSE, 0); + gtk_button_set_relief (GTK_BUTTON (button_title_next), GTK_RELIEF_NONE); - hbox6 = gtk_hbox_new (FALSE, 10); - gtk_widget_ref (hbox6); - gtk_object_set_data_full (GTK_OBJECT (intf_window), "hbox6", hbox6, + dvd_chapter_box = gtk_hbox_new (FALSE, 10); + gtk_widget_ref (dvd_chapter_box); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "dvd_chapter_box", dvd_chapter_box, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (hbox6); - gtk_box_pack_start (GTK_BOX (dvd_box), hbox6, TRUE, FALSE, 0); + gtk_widget_show (dvd_chapter_box); + gtk_box_pack_start (GTK_BOX (dvd_box), dvd_chapter_box, TRUE, FALSE, 0); + + label20 = gtk_label_new (_("Chapter:")); + gtk_widget_ref (label20); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "label20", label20, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (label20); + gtk_box_pack_start (GTK_BOX (dvd_chapter_box), label20, FALSE, FALSE, 0); + + label_chapter = gtk_label_new (_("--")); + gtk_widget_ref (label_chapter); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "label_chapter", label_chapter, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (label_chapter); + gtk_box_pack_start (GTK_BOX (dvd_chapter_box), label_chapter, FALSE, FALSE, 0); button_chapter_prev = gnome_stock_button (GNOME_STOCK_BUTTON_PREV); gtk_widget_ref (button_chapter_prev); gtk_object_set_data_full (GTK_OBJECT (intf_window), "button_chapter_prev", button_chapter_prev, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (button_chapter_prev); - gtk_box_pack_start (GTK_BOX (hbox6), button_chapter_prev, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (dvd_chapter_box), button_chapter_prev, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, button_chapter_prev, _("Select previous chapter"), NULL); gtk_button_set_relief (GTK_BUTTON (button_chapter_prev), GTK_RELIEF_NONE); - label_chapter = gtk_label_new (_("Chapter: ")); - gtk_widget_ref (label_chapter); - gtk_object_set_data_full (GTK_OBJECT (intf_window), "label_chapter", label_chapter, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (label_chapter); - gtk_box_pack_start (GTK_BOX (hbox6), label_chapter, FALSE, FALSE, 0); - button_chapter_next = gnome_stock_button (GNOME_STOCK_BUTTON_NEXT); gtk_widget_ref (button_chapter_next); gtk_object_set_data_full (GTK_OBJECT (intf_window), "button_chapter_next", button_chapter_next, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (button_chapter_next); - gtk_box_pack_start (GTK_BOX (hbox6), button_chapter_next, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (dvd_chapter_box), button_chapter_next, FALSE, FALSE, 0); 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); + 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); + + 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); + + 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, + (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); + appbar = gnome_appbar_new (TRUE, TRUE, GNOME_PREFERENCES_NEVER); gtk_widget_ref (appbar); gtk_object_set_data_full (GTK_OBJECT (intf_window), "appbar", appbar, @@ -572,6 +709,12 @@ create_intf_window (void) gtk_signal_connect (GTK_OBJECT (slider), "button_release_event", GTK_SIGNAL_FUNC (on_slider_button_release_event), NULL); + gtk_signal_connect (GTK_OBJECT (button_title_prev), "clicked", + GTK_SIGNAL_FUNC (on_button_title_prev_clicked), + NULL); + gtk_signal_connect (GTK_OBJECT (button_title_next), "clicked", + GTK_SIGNAL_FUNC (on_button_title_next_clicked), + NULL); gtk_signal_connect (GTK_OBJECT (button_chapter_prev), "clicked", GTK_SIGNAL_FUNC (on_button_chapter_prev_clicked), NULL); diff --git a/plugins/gnome/intf_gnome.c b/plugins/gnome/intf_gnome.c index 4c126eb67e..064249b81f 100644 --- a/plugins/gnome/intf_gnome.c +++ b/plugins/gnome/intf_gnome.c @@ -2,7 +2,7 @@ * intf_gnome.c: Gnome interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: intf_gnome.c,v 1.25 2001/04/03 03:39:41 stef Exp $ + * $Id: intf_gnome.c,v 1.26 2001/04/08 07:24:47 stef Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -76,6 +76,8 @@ static gint GnomeTitleMenu ( gpointer, GtkWidget *, static gint GnomeSetupMenu ( intf_thread_t * p_intf ); static void GnomeDisplayDate ( GtkAdjustment *p_adj ); static gint GnomeDVDModeManage( intf_thread_t * p_intf ); +static gint GnomeFileModeManage( intf_thread_t * p_intf ); +static gint GnomeNetworkModeManage( intf_thread_t * p_intf ); /***************************************************************************** * g_atexit: kludge to avoid the Gnome thread to segfault at exit @@ -147,13 +149,14 @@ static int intf_Open( intf_thread_t *p_intf ) p_intf->p_sys->b_window_changed = 0; p_intf->p_sys->b_playlist_changed = 0; p_intf->p_sys->b_menus_update = 1; - p_intf->p_sys->b_menus_ready = 0; p_intf->p_sys->b_slider_free = 1; - p_intf->p_sys->b_mode_changed = 0; + 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; @@ -203,16 +206,6 @@ static void intf_Run( intf_thread_t *p_intf ) p_intf->p_sys->p_disc = create_intf_disc( ); p_intf->p_sys->p_network = create_intf_network( ); - /* Sets the interface mode according to playlist item */ - if( p_main->p_playlist->p_item != NULL ) - { - if( !strncmp( p_main->p_playlist->p_item->psz_name, "dvd:", 4 ) ) - { - p_intf->p_sys->i_intf_mode = DVD_MODE; - p_intf->p_sys->b_mode_changed = 1; - } - } - /* Set the title of the main window */ gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window), VOUT_TITLE " (Gnome interface)"); @@ -313,35 +306,66 @@ static gint GnomeManage( gpointer p_data ) p_intf->b_menu_change = 0; } - if( p_intf->p_input != NULL && p_intf->p_sys->p_window != NULL && - p_intf->p_sys->b_mode_changed ) + if( p_intf->p_sys->b_mode_changed ) { + /* Sets the interface mode according to playlist item */ + if( p_main->p_playlist->p_item != NULL ) + { + if( !strncmp( p_main->p_playlist->p_item->psz_name, "dvd:", 4 ) ) + { + p_intf->p_sys->i_intf_mode = DVD_MODE; + } + else if( !strncmp( + p_main->p_playlist->p_item->psz_name, "ts:", 4 ) ) + { + p_intf->p_sys->i_intf_mode = NET_MODE; + } + } + switch( p_intf->p_sys->i_intf_mode ) { case DVD_MODE: GnomeDVDModeManage( p_intf ); break; + case NET_MODE: + GnomeNetworkModeManage( p_intf ); + break; + case FILE_MODE: + default: + GnomeFileModeManage( p_intf ); + break; } p_intf->p_sys->b_mode_changed = 0; } - /* Update language/chapter menus after user request */ - if( p_intf->p_input != NULL && p_intf->p_sys->p_window != NULL && - p_intf->p_sys->b_menus_update ) - { - p_intf->p_sys->b_menus_ready = 0; - GnomeSetupMenu( p_intf ); - p_intf->p_sys->b_menus_ready = 1; - } - - /* Manage the slider */ if( p_intf->p_input != NULL ) { - float newvalue = p_intf->p_sys->p_adj->value; + float newvalue; + char psz_title[3]; + char psz_chapter[3]; #define p_area p_intf->p_input->stream.p_selected_area + /* Update language/chapter menus after user request */ + if( ( p_intf->p_sys->b_menus_update ) || + ( p_intf->p_sys->i_part != p_area->i_part ) ) + { + p_intf->p_sys->b_menus_update = 1; + GnomeSetupMenu( p_intf ); + p_intf->p_sys->b_menus_update = 0; + + snprintf( psz_title, 3, "%02d", p_area->i_id ); + gtk_label_set_text( p_intf->p_sys->p_label_title, psz_title ); + + p_intf->p_sys->i_part = p_area->i_part; + snprintf( psz_chapter, 3, "%02d", p_area->i_part ); + gtk_label_set_text( p_intf->p_sys->p_label_chapter, psz_chapter ); + } + + /* Manage the slider */ + newvalue = p_intf->p_sys->p_adj->value; + /* If the user hasn't touched the slider since the last time, * then the input can safely change it */ if( newvalue == p_intf->p_sys->f_adj_oldvalue ) @@ -400,7 +424,7 @@ static gint GnomeManage( gpointer p_data ) static gint GnomeLanguageMenus( gpointer p_data, GtkWidget * p_root, es_descriptor_t * p_es, - gint i_type, + gint i_cat, void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) ) { intf_thread_t * p_intf; @@ -410,8 +434,6 @@ static gint GnomeLanguageMenus( gpointer p_data, GtkWidget * p_item_active; GSList * p_group; char * psz_name; - gint b_audio; - gint b_spu; gint i_item; gint i; @@ -455,11 +477,7 @@ static gint GnomeLanguageMenus( gpointer p_data, /* create a set of language buttons and append them to the container */ for( i = 0 ; i < p_intf->p_input->stream.i_es_number ; i++ ) { - - b_audio = ( i_type == 1 ) && p_intf->p_input->stream.pp_es[i]->b_audio; - b_spu = ( i_type == 2 ) && p_intf->p_input->stream.pp_es[i]->b_spu; - - if( b_audio || b_spu ) + if( p_intf->p_input->stream.pp_es[i]->i_cat == i_cat ) { i_item++; psz_name = p_intf->p_input->stream.pp_es[i]->psz_desc; @@ -747,11 +765,13 @@ static gint GnomeTitleMenu( gpointer p_data, GTK_RADIO_MENU_ITEM( p_item ) ); gtk_widget_show( p_item ); - if( p_intf->p_input->stream.pp_areas[i_title]->i_part - == i_chapter + 1 ) +#define p_area p_intf->p_input->stream.pp_areas[i_title] + if( ( p_area == p_intf->p_input->stream.p_selected_area ) && + ( p_area->i_part == i_chapter + 1 ) ) { p_item_active = p_item; } +#undef p_area /* setup signal hanling */ gtk_signal_connect( GTK_OBJECT( p_item ), @@ -855,12 +875,12 @@ static gint GnomeSetupMenu( intf_thread_t * p_intf ) for( i = 0 ; i < p_intf->p_input->stream.i_selected_es_number ; i++ ) { - if( p_intf->p_input->stream.pp_selected_es[i]->b_audio ) + if( p_intf->p_input->stream.pp_selected_es[i]->i_cat == AUDIO_ES ) { p_audio_es = p_intf->p_input->stream.pp_selected_es[i]; } - if( p_intf->p_input->stream.pp_selected_es[i]->b_spu ) + if( p_intf->p_input->stream.pp_selected_es[i]->i_cat == SPU_ES ) { p_spu_es = p_intf->p_input->stream.pp_selected_es[i]; } @@ -875,9 +895,9 @@ static gint GnomeSetupMenu( intf_thread_t * p_intf ) p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_popup ), "popup_audio" ) ); - GnomeLanguageMenus( p_intf, p_menubar_menu, p_audio_es, 1, + GnomeLanguageMenus( p_intf, p_menubar_menu, p_audio_es, AUDIO_ES, on_menubar_audio_toggle ); - GnomeLanguageMenus( p_intf, p_popup_menu, p_audio_es, 1, + GnomeLanguageMenus( p_intf, p_popup_menu, p_audio_es, AUDIO_ES, on_popup_audio_toggle ); /* sub picture menus */ @@ -889,14 +909,11 @@ static gint GnomeSetupMenu( intf_thread_t * p_intf ) p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_popup ), "popup_subtitle" ) ); - GnomeLanguageMenus( p_intf, p_menubar_menu, p_spu_es, 2, + GnomeLanguageMenus( p_intf, p_menubar_menu, p_spu_es, SPU_ES, on_menubar_subtitle_toggle ); - GnomeLanguageMenus( p_intf, p_popup_menu, p_spu_es, 2, + GnomeLanguageMenus( p_intf, p_popup_menu, p_spu_es, SPU_ES, on_popup_subtitle_toggle ); - /* everything is ready */ - p_intf->p_sys->b_menus_update = 0; - return TRUE; } @@ -935,27 +952,77 @@ void GnomeDisplayDate( GtkAdjustment *p_adj ) static gint GnomeDVDModeManage( intf_thread_t * p_intf ) { GtkWidget * p_dvd_box; - GtkWidget * p_toolbar_next; - GtkWidget * p_toolbar_prev; + GtkWidget * p_file_box; + GtkWidget * p_network_box; + + p_file_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_window ), "file_box" ) ); + gtk_widget_hide( GTK_WIDGET( p_file_box ) ); + + p_network_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_window ), "network_box" ) ); + gtk_widget_hide( GTK_WIDGET( p_network_box ) ); p_dvd_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_window ), "dvd_box" ) ); gtk_widget_show( GTK_WIDGET( p_dvd_box ) ); - p_toolbar_next = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( - p_intf->p_sys->p_window ), "toolbar_next" ) ); - gtk_signal_disconnect_by_data( GTK_OBJECT( p_toolbar_next ), NULL ); - gtk_signal_connect( GTK_OBJECT( p_toolbar_next ), "clicked", - GTK_SIGNAL_FUNC( on_toolbar_next_title_clicked ), - NULL); + gtk_label_set_text( p_intf->p_sys->p_label_status, + "Status: playing DVD" ); + + return TRUE; +} + +/***************************************************************************** + * GnomeFileModeManage + *****************************************************************************/ +static gint GnomeFileModeManage( intf_thread_t * p_intf ) +{ + GtkWidget * p_dvd_box; + GtkWidget * p_file_box; + GtkWidget * p_network_box; + + p_network_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_window ), "network_box" ) ); + gtk_widget_hide( GTK_WIDGET( p_network_box ) ); + + p_dvd_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_window ), "dvd_box" ) ); + gtk_widget_hide( GTK_WIDGET( p_dvd_box ) ); + + 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 ) ); - p_toolbar_prev = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( - p_intf->p_sys->p_window ), "toolbar_prev" ) ); - gtk_signal_disconnect_by_data( GTK_OBJECT( p_toolbar_prev ), NULL ); - gtk_signal_connect( GTK_OBJECT( p_toolbar_prev ), "clicked", - GTK_SIGNAL_FUNC( on_toolbar_prev_title_clicked ), - NULL); + gtk_label_set_text( p_intf->p_sys->p_label_status, + "Status: foo" ); return TRUE; } +/***************************************************************************** + * GnomeNetworkModeManage + *****************************************************************************/ +static gint GnomeNetworkModeManage( intf_thread_t * p_intf ) +{ + GtkWidget * p_dvd_box; + GtkWidget * p_file_box; + GtkWidget * p_network_box; + + p_dvd_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_window ), "dvd_box" ) ); + gtk_widget_hide( GTK_WIDGET( p_dvd_box ) ); + + p_file_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_window ), "file_box" ) ); + gtk_widget_hide( GTK_WIDGET( p_file_box ) ); + + p_network_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_window ), "network_box" ) ); + gtk_widget_show( GTK_WIDGET( p_network_box ) ); + + gtk_label_set_text( p_intf->p_sys->p_label_status, + "Status: waiting for stream" ); + + return TRUE; +} diff --git a/plugins/gnome/intf_gnome.glade b/plugins/gnome/intf_gnome.glade index 116c07c76d..4af20b736b 100644 --- a/plugins/gnome/intf_gnome.glade +++ b/plugins/gnome/intf_gnome.glade @@ -584,8 +584,7 @@ GtkHBox - dvd_box - False + file_box False 0 @@ -596,8 +595,9 @@ GtkLabel - label_title - + label_file + 24 + GTK_JUSTIFY_CENTER False 0.5 @@ -607,13 +607,27 @@ 0 True - False + True + + + + GtkHBox + dvd_box + 24 + False + False + 0 + + 0 + True + True + GtkHBox - hbox6 + title_chapter_box False 10 @@ -622,15 +636,49 @@ False + + GtkLabel + label19 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkLabel + label_title + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + GtkButton - button_chapter_prev - Select previous chapter + button_title_prev + Select previous title True clicked - on_button_chapter_prev_clicked - Tue, 03 Apr 2001 00:53:47 GMT + on_button_title_prev_clicked + Tue, 03 Apr 2001 03:46:25 GMT GNOME_STOCK_BUTTON_PREV GTK_RELIEF_NONE @@ -641,10 +689,57 @@ + + GtkButton + button_title_next + True + + clicked + on_button_title_next_clicked + Tue, 03 Apr 2001 03:47:01 GMT + + GNOME_STOCK_BUTTON_NEXT + GTK_RELIEF_NONE + + 0 + False + False + + + + + + GtkHBox + dvd_chapter_box + False + 10 + + 0 + True + False + + + + GtkLabel + label20 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + GtkLabel label_chapter - + GTK_JUSTIFY_CENTER False 0.5 @@ -658,6 +753,25 @@ + + GtkButton + button_chapter_prev + Select previous chapter + True + + clicked + on_button_chapter_prev_clicked + Tue, 03 Apr 2001 00:53:47 GMT + + GNOME_STOCK_BUTTON_PREV + GTK_RELIEF_NONE + + 0 + False + False + + + GtkButton button_chapter_next @@ -678,6 +792,126 @@ + + + GtkHBox + network_box + 24 + False + False + 0 + + 0 + True + True + + + + GtkLabel + label_network + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + True + False + + + + + GtkToggleButton + button_network_channel_1 + True + + GTK_RELIEF_HALF + True + + 2 + False + True + + + + + GtkToggleButton + button_network_channel_2 + False + True + + GTK_RELIEF_HALF + False + + 2 + False + True + + + + + GtkToggleButton + button_network_channel_3 + False + True + + GTK_RELIEF_HALF + False + + 2 + False + True + + + + + GtkToggleButton + button_network_channel_4 + False + True + + GTK_RELIEF_HALF + False + + 2 + False + True + + + + + GtkToggleButton + button_network_channel_5 + False + True + + GTK_RELIEF_HALF + False + + 2 + False + True + + + + + GtkToggleButton + button_network_channel_6 + False + True + + GTK_RELIEF_HALF + False + + 2 + False + True + + + diff --git a/plugins/gnome/intf_gnome.h b/plugins/gnome/intf_gnome.h index 3d04f9c6cf..fd519eddb6 100644 --- a/plugins/gnome/intf_gnome.h +++ b/plugins/gnome/intf_gnome.h @@ -2,7 +2,7 @@ * intf_gnome.h: private Gnome interface description ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: intf_gnome.h,v 1.5 2001/04/03 03:39:41 stef Exp $ + * $Id: intf_gnome.h,v 1.6 2001/04/08 07:24:47 stef Exp $ * * Authors: Samuel Hocevar * @@ -46,7 +46,6 @@ typedef struct intf_sys_s boolean_t b_playlist_changed; /* playlist display toggled ? */ boolean_t b_slider_free; /* slider status */ boolean_t b_menus_update; /* do we need to update menus */ - boolean_t b_menus_ready; /* has the update been commpleted */ /* Windows and widgets */ GtkWidget * p_window; /* main window */ @@ -72,9 +71,10 @@ typedef struct intf_sys_s boolean_t b_mode_changed; gint i_intf_mode; /* interface mode: file, net, disc */ + gint i_part; /* current chapter */ + /* XXX: Ugly kludge, see intf_gnome.c */ void ( *pf_gtk_callback ) ( void ); void ( *pf_gdk_callback ) ( void ); } intf_sys_t; - diff --git a/plugins/gtk/intf_gtk.c b/plugins/gtk/intf_gtk.c index 04b40ecd67..23abc28312 100644 --- a/plugins/gtk/intf_gtk.c +++ b/plugins/gtk/intf_gtk.c @@ -2,7 +2,7 @@ * intf_gtk.c: Gtk+ interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: intf_gtk.c,v 1.10 2001/03/15 01:42:20 sam Exp $ + * $Id: intf_gtk.c,v 1.11 2001/04/08 07:24:47 stef Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -347,12 +347,12 @@ static gint GtkManage( gpointer p_data ) for( i = 0 ; i < p_intf->p_input->stream.i_selected_es_number ; i++ ) { - if( p_intf->p_input->stream.pp_es[i]->b_audio ) + if( p_intf->p_input->stream.pp_es[i]->i_cat == AUDIO_ES ) { p_audio_es = p_intf->p_input->stream.pp_es[i]; } - if( p_intf->p_input->stream.pp_es[i]->b_spu ) + if( p_intf->p_input->stream.pp_es[i]->i_cat == SPU_ES ) { p_spu_es = p_intf->p_input->stream.pp_es[i]; } @@ -367,9 +367,9 @@ static gint GtkManage( gpointer p_data ) p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_popup ), "popup_audio" ) ); - GtkLanguageMenus( p_intf, p_menubar_menu, p_audio_es, 1, + GtkLanguageMenus( p_intf, p_menubar_menu, p_audio_es, AUDIO_ES, on_menubar_audio_activate ); - GtkLanguageMenus( p_intf, p_popup_menu, p_audio_es, 1, + GtkLanguageMenus( p_intf, p_popup_menu, p_audio_es, AUDIO_ES, on_popup_audio_activate ); /* sub picture menus */ @@ -381,9 +381,9 @@ static gint GtkManage( gpointer p_data ) p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_popup ), "popup_subpictures" ) ); - GtkLanguageMenus( p_intf, p_menubar_menu, p_spu_es, 2, + GtkLanguageMenus( p_intf, p_menubar_menu, p_spu_es, SPU_ES, on_menubar_subpictures_activate ); - GtkLanguageMenus( p_intf, p_popup_menu, p_spu_es, 2, + GtkLanguageMenus( p_intf, p_popup_menu, p_spu_es, SPU_ES, on_popup_subpictures_activate ); /* everything is ready */ @@ -510,7 +510,7 @@ static GtkWidget * GtkMenuRadioItem( GtkWidget * p_menu, static gint GtkLanguageMenus( gpointer p_data, GtkWidget * p_root, es_descriptor_t * p_es, - gint i_type, + gint i_cat, void(*pf_activate )( GtkMenuItem *, gpointer ) ) { intf_thread_t * p_intf; @@ -520,8 +520,6 @@ static gint GtkLanguageMenus( gpointer p_data, GSList * p_button_group; char * psz_name; gint b_active; - gint b_audio; - gint b_spu; gint i; @@ -531,14 +529,13 @@ static gint GtkLanguageMenus( gpointer p_data, vlc_mutex_lock( &p_intf->p_input->stream.stream_lock ); - b_audio = ( i_type == 1 ); p_button_group = NULL; /* menu container for audio */ p_menu = gtk_menu_new(); /* create a set of language buttons and append them to the container */ - b_active = ( p_es == NULL ) ? 1 : 0; + b_active = ( p_es == NULL ); psz_name = "Off"; p_item = GtkMenuRadioItem( p_menu, &p_button_group, b_active, psz_name ); @@ -554,11 +551,7 @@ static gint GtkLanguageMenus( gpointer p_data, for( i = 0 ; i < p_intf->p_input->stream.i_es_number ; i++ ) { - - b_audio = ( i_type == 1 ) && p_intf->p_input->stream.pp_es[i]->b_audio; - b_spu = ( i_type == 2 ) && p_intf->p_input->stream.pp_es[i]->b_spu; - - if( b_audio || b_spu ) + if( p_intf->p_input->stream.pp_es[i]->i_cat == i_cat ) { b_active = ( p_es == p_intf->p_input->stream.pp_es[i] ) ? 1 : 0; psz_name = p_intf->p_input->stream.pp_es[i]->psz_desc; diff --git a/src/input/input_ext-intf.c b/src/input/input_ext-intf.c index 9646324ce2..765ceefa4b 100644 --- a/src/input/input_ext-intf.c +++ b/src/input/input_ext-intf.c @@ -2,7 +2,7 @@ * input_ext-intf.c: services to the interface ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: input_ext-intf.c,v 1.19 2001/04/06 09:15:47 sam Exp $ + * $Id: input_ext-intf.c,v 1.20 2001/04/08 07:24:47 stef Exp $ * * Authors: Christophe Massiot * @@ -235,23 +235,18 @@ void input_DumpStream( input_thread_t * p_input ) * Useful since the interface plugins know p_es *****************************************************************************/ int input_ChangeES( input_thread_t * p_input, es_descriptor_t * p_es, - int i_type ) + u8 i_cat ) { - boolean_t b_audio; - boolean_t b_spu; int i_index; int i; i_index = -1; - b_audio = ( i_type == 1 ) ? 1 : 0; - b_spu = ( i_type == 2 ) ? 1 : 0; vlc_mutex_lock( &p_input->stream.stream_lock ); for( i = 0 ; i < p_input->stream.i_selected_es_number ; i++ ) { - if( ( b_audio && p_input->stream.pp_selected_es[i]->b_audio ) - || ( b_spu && p_input->stream.pp_selected_es[i]->b_spu ) ) + if( p_input->stream.pp_selected_es[i]->i_cat == i_cat ) { i_index = i; break; @@ -313,7 +308,7 @@ int input_ToggleES( input_thread_t * p_input, es_descriptor_t * p_es, vlc_mutex_lock( &p_input->stream.stream_lock ); - if( p_es != NULL && ( p_es->b_audio || p_es->b_spu ) ) + if( p_es != NULL ) { if( b_select ) { diff --git a/src/input/input_programs.c b/src/input/input_programs.c index 943c7c809e..d62f00b6c0 100644 --- a/src/input/input_programs.c +++ b/src/input/input_programs.c @@ -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.44 2001/04/06 09:15:47 sam Exp $ + * $Id: input_programs.c,v 1.45 2001/04/08 07:24:47 stef Exp $ * * Authors: Christophe Massiot * @@ -373,7 +373,7 @@ es_descriptor_t * input_AddES( input_thread_t * p_input, p_es->p_pes = NULL; p_es->p_decoder_fifo = NULL; p_es->b_audio = 0; - p_es->b_spu = 0; + p_es->i_cat = UNKNOWN_ES; if( i_data_len ) { @@ -730,7 +730,9 @@ int input_UnselectES( input_thread_t * p_input, es_descriptor_t * p_es ) if( p_input->stream.pp_selected_es == NULL ) { - intf_ErrMsg( "No more selected ES in input_UnselectES" ); +#ifdef DEBUG_INPUT + intf_DbgMsg( "No more selected ES in input_UnselectES" ); +#endif return( 1 ); } } diff --git a/src/input/mpeg_system.c b/src/input/mpeg_system.c index 59d515e11e..92cb693b85 100644 --- a/src/input/mpeg_system.c +++ b/src/input/mpeg_system.c @@ -2,7 +2,7 @@ * mpeg_system.c: TS, PS and PES management ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: mpeg_system.c,v 1.47 2001/04/06 09:15:47 sam Exp $ + * $Id: mpeg_system.c,v 1.48 2001/04/08 07:24:47 stef Exp $ * * Authors: Christophe Massiot * Michel Lespinasse @@ -703,6 +703,7 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input, { /* MPEG video */ p_es->i_type = MPEG2_VIDEO_ES; + p_es->i_cat = VIDEO_ES; #ifdef AUTO_SPAWN if( !p_input->stream.b_seekable ) input_SelectES( p_input, p_es ); @@ -713,6 +714,7 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input, /* MPEG audio */ p_es->i_type = MPEG2_AUDIO_ES; p_es->b_audio = 1; + p_es->i_cat = AUDIO_ES; #ifdef AUTO_SPAWN if( !p_input->stream.b_seekable ) if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 ) @@ -732,6 +734,7 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input, /* AC3 audio (0x80->0x8F) */ p_es->i_type = AC3_AUDIO_ES; p_es->b_audio = 1; + p_es->i_cat = AUDIO_ES; #ifdef AUTO_SPAWN if( !p_input->stream.b_seekable ) if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 ) @@ -750,7 +753,7 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input, { /* Subtitles video (0x20->0x3F) */ p_es->i_type = DVD_SPU_ES; - p_es->b_spu = 1; + p_es->i_cat = SPU_ES; #ifdef AUTO_SPAWN if( main_GetIntVariable( INPUT_SUBTITLE_VAR, -1 ) == ((p_es->i_id & 0x1F00) >> 8) ) @@ -765,6 +768,7 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input, /* LPCM audio (0xA0->0xAF) */ p_es->i_type = LPCM_AUDIO_ES; p_es->b_audio = 1; + p_es->i_cat = AUDIO_ES; /* FIXME : write the decoder */ } else diff --git a/src/interface/intf_playlist.c b/src/interface/intf_playlist.c index c2b1d06519..d3d8df6ba9 100644 --- a/src/interface/intf_playlist.c +++ b/src/interface/intf_playlist.c @@ -2,7 +2,7 @@ * intf_playlist.c : Playlist management functions ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: intf_playlist.c,v 1.2 2001/03/21 13:42:34 sam Exp $ + * $Id: intf_playlist.c,v 1.3 2001/04/08 07:24:47 stef Exp $ * * Authors: Samuel Hocevar * @@ -244,6 +244,10 @@ void intf_PlaylistDestroy( playlist_t * p_playlist ) intf_WarnMsg( 1, "intf: playlist destroyed" ); } + +/***************************************************************************** + * intf_PlaylistJumpto + *****************************************************************************/ void intf_PlaylistJumpto( playlist_t * p_playlist , int i_pos) { vlc_mutex_lock( &p_playlist->change_lock ); -- 2.39.2