Commit ec126885 authored by Stéphane Borel's avatar Stéphane Borel

-Working menus for run-time audio/spu/title/chapter selection with gtk

interface.

It is a bit buggy yet, and some pieces of code need to change,
especially to handle better menus change when title change but it
eventually works.
parent 66fc868f
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.27 2001/03/02 03:32:46 stef Exp $
* $Id: input_ext-intf.h,v 1.28 2001/03/07 10:31:10 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -52,6 +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;
char psz_desc[20]; /* description of ES: audio language
* for instance ; NULL if not
* available */
......@@ -269,6 +271,8 @@ typedef struct input_thread_s
void (* pf_delete_pes)( void *, struct pes_packet_s * );
/* Stream control capabilities */
int (* pf_set_area)( struct input_thread_s *,
struct input_area_s * );
int (* pf_rewind)( struct input_thread_s * );
/* NULL if we don't support going *
* backwards (it's gonna be fun) */
......@@ -348,3 +352,4 @@ 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 );
......@@ -49,6 +49,9 @@ typedef void * module_handle_t;
#define MODULE_CAPABILITY_AFX 1 << 11 /* Audio effects */
#define MODULE_CAPABILITY_VFX 1 << 12 /* Video effects */
/* FIXME: kludge */
struct input_area_s;
/* FIXME: not yet used */
typedef struct probedata_s
{
......@@ -81,9 +84,6 @@ typedef struct function_list_s
void ( * pf_close )( struct input_thread_s * );
void ( * pf_end ) ( struct input_thread_s * );
int ( * pf_set_area ) ( struct input_thread_s *,
int, int, int, int );
int ( * pf_read ) ( struct input_thread_s *,
struct data_packet_s *
pp_packets[] );
......@@ -95,6 +95,9 @@ typedef struct function_list_s
void ( * pf_delete_packet ) ( void *, struct data_packet_s * );
void ( * pf_delete_pes ) ( void *, struct pes_packet_s * );
int ( * pf_set_area ) ( struct input_thread_s *,
struct input_area_s * );
int ( * pf_rewind ) ( struct input_thread_s * );
void ( * pf_seek ) ( struct input_thread_s *, off_t );
} input;
......
This diff is collapsed.
......@@ -4,6 +4,7 @@
* Copyright (C) 2000, 2001 VideoLAN
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -733,3 +734,101 @@ on_popup_disc_activate (GtkMenuItem *menuitem,
gdk_window_raise( p_intf->p_sys->p_disc->window );
}
void
on_popup_audio_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
es_descriptor_t * p_es;
p_es = (es_descriptor_t*)user_data;
input_ChangeES( p_intf->p_input, p_es, 1 );
}
void
on_popup_subpictures_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
es_descriptor_t * p_es;
p_es = (es_descriptor_t*)user_data;
input_ChangeES( p_intf->p_input, p_es, 2 );
}
void
on_menubar_audio_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
es_descriptor_t * p_es;
p_es = (es_descriptor_t*)user_data;
input_ChangeES( p_intf->p_input, p_es, 1 );
}
void
on_menubar_subpictures_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
es_descriptor_t * p_es;
p_es = (es_descriptor_t*)user_data;
input_ChangeES( p_intf->p_input, p_es, 2 );
}
void
on_popup_navigation_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_popup" );
input_area_t * p_area;
gint i_title;
gint i_chapter;
i_title = (gint)(user_data) / 100 ;
i_chapter = (gint)(user_data) - ( 100 * i_title );
fprintf(stderr, "title %d chapter %d\n", i_title, i_chapter );
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 );
}
void
on_menubar_title_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
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 );
}
void
on_menubar_chapter_activate (GtkMenuItem *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_chapter = (gint)user_data;
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 );
}
......@@ -185,3 +185,31 @@ on_toolbar_disc_clicked (GtkButton *button,
void
on_popup_disc_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_audio_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_subpictures_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menubar_audio_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menubar_subpictures_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_popup_navigation_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menubar_title_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menubar_chapter_activate (GtkMenuItem *menuitem,
gpointer user_data);
......@@ -36,11 +36,18 @@ create_intf_window (void)
GtkWidget *menubar_view;
GtkWidget *menubar_view_menu;
GtkAccelGroup *menubar_view_menu_accels;
GtkWidget *menubar_title;
GtkWidget *menubar_chapter;
GtkWidget *separator11;
GtkWidget *menubar_playlist;
GtkWidget *menubar_modules;
GtkWidget *menubar_settings;
GtkWidget *menubar_settings_menu;
GtkAccelGroup *menubar_settings_menu_accels;
GtkWidget *separator7;
GtkWidget *menubar_audio;
GtkWidget *menubar_subpictures;
GtkWidget *separator8;
GtkWidget *menubar_preferences;
GtkWidget *menubar_help;
GtkWidget *menubar_help_menu;
......@@ -182,6 +189,39 @@ create_intf_window (void)
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menubar_view), menubar_view_menu);
menubar_view_menu_accels = gtk_menu_ensure_uline_accel_group (GTK_MENU (menubar_view_menu));
menubar_title = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_title)->child),
_("_Title"));
gtk_widget_add_accelerator (menubar_title, "activate_item", menubar_view_menu_accels,
tmp_key, 0, 0);
gtk_widget_ref (menubar_title);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_title", menubar_title,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (menubar_title);
gtk_container_add (GTK_CONTAINER (menubar_view_menu), menubar_title);
gtk_widget_set_sensitive (menubar_title, FALSE);
gtk_tooltips_set_tip (tooltips, menubar_title, _("Navigate through the stream"), NULL);
menubar_chapter = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_chapter)->child),
_("_Chapter"));
gtk_widget_add_accelerator (menubar_chapter, "activate_item", menubar_view_menu_accels,
tmp_key, 0, 0);
gtk_widget_ref (menubar_chapter);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_chapter", menubar_chapter,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (menubar_chapter);
gtk_container_add (GTK_CONTAINER (menubar_view_menu), menubar_chapter);
gtk_widget_set_sensitive (menubar_chapter, FALSE);
separator11 = gtk_menu_item_new ();
gtk_widget_ref (separator11);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator11", separator11,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (separator11);
gtk_container_add (GTK_CONTAINER (menubar_view_menu), separator11);
gtk_widget_set_sensitive (separator11, FALSE);
menubar_playlist = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_playlist)->child),
_("_Playlist..."));
......@@ -226,6 +266,48 @@ create_intf_window (void)
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menubar_settings), menubar_settings_menu);
menubar_settings_menu_accels = gtk_menu_ensure_uline_accel_group (GTK_MENU (menubar_settings_menu));
separator7 = gtk_menu_item_new ();
gtk_widget_ref (separator7);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator7", separator7,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (separator7);
gtk_container_add (GTK_CONTAINER (menubar_settings_menu), separator7);
gtk_widget_set_sensitive (separator7, FALSE);
menubar_audio = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_audio)->child),
_("A_udio"));
gtk_widget_add_accelerator (menubar_audio, "activate_item", menubar_settings_menu_accels,
tmp_key, 0, 0);
gtk_widget_ref (menubar_audio);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_audio", menubar_audio,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (menubar_audio);
gtk_container_add (GTK_CONTAINER (menubar_settings_menu), menubar_audio);
gtk_widget_set_sensitive (menubar_audio, FALSE);
gtk_tooltips_set_tip (tooltips, menubar_audio, _("Select audio language"), NULL);
menubar_subpictures = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_subpictures)->child),
_("Sub _Pictures"));
gtk_widget_add_accelerator (menubar_subpictures, "activate_item", menubar_settings_menu_accels,
tmp_key, 0, 0);
gtk_widget_ref (menubar_subpictures);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_subpictures", menubar_subpictures,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (menubar_subpictures);
gtk_container_add (GTK_CONTAINER (menubar_settings_menu), menubar_subpictures);
gtk_widget_set_sensitive (menubar_subpictures, FALSE);
gtk_tooltips_set_tip (tooltips, menubar_subpictures, _("Select sub-title"), NULL);
separator8 = gtk_menu_item_new ();
gtk_widget_ref (separator8);
gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator8", separator8,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (separator8);
gtk_container_add (GTK_CONTAINER (menubar_settings_menu), separator8);
gtk_widget_set_sensitive (separator8, FALSE);
menubar_preferences = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_preferences)->child),
_("_Preferences..."));
......@@ -545,6 +627,11 @@ create_intf_popup (void)
GtkWidget *popup_open;
GtkWidget *popup_disc;
GtkWidget *separator5;
GtkWidget *popup_navigation;
GtkWidget *separator10;
GtkWidget *popup_audio;
GtkWidget *popup_subpictures;
GtkWidget *separator9;
GtkWidget *popup_about;
GtkWidget *popup_exit;
GtkTooltips *tooltips;
......@@ -627,6 +714,54 @@ create_intf_popup (void)
gtk_container_add (GTK_CONTAINER (intf_popup), separator5);
gtk_widget_set_sensitive (separator5, FALSE);
popup_navigation = gtk_menu_item_new_with_label (_("Navigation"));
gtk_widget_ref (popup_navigation);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_navigation", popup_navigation,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (popup_navigation);
gtk_container_add (GTK_CONTAINER (intf_popup), popup_navigation);
gtk_widget_set_sensitive (popup_navigation, FALSE);
separator10 = gtk_menu_item_new ();
gtk_widget_ref (separator10);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator10", separator10,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (separator10);
gtk_container_add (GTK_CONTAINER (intf_popup), separator10);
gtk_widget_set_sensitive (separator10, FALSE);
popup_audio = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (popup_audio)->child),
_("A_udio"));
gtk_widget_add_accelerator (popup_audio, "activate_item", intf_popup_accels,
tmp_key, 0, 0);
gtk_widget_ref (popup_audio);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_audio", popup_audio,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (popup_audio);
gtk_container_add (GTK_CONTAINER (intf_popup), popup_audio);
gtk_widget_set_sensitive (popup_audio, FALSE);
popup_subpictures = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (popup_subpictures)->child),
_("Sub _Pictures"));
gtk_widget_add_accelerator (popup_subpictures, "activate_item", intf_popup_accels,
tmp_key, 0, 0);
gtk_widget_ref (popup_subpictures);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_subpictures", popup_subpictures,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (popup_subpictures);
gtk_container_add (GTK_CONTAINER (intf_popup), popup_subpictures);
gtk_widget_set_sensitive (popup_subpictures, FALSE);
separator9 = gtk_menu_item_new ();
gtk_widget_ref (separator9);
gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator9", separator9,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (separator9);
gtk_container_add (GTK_CONTAINER (intf_popup), separator9);
gtk_widget_set_sensitive (separator9, FALSE);
popup_about = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (popup_about)->child),
_("_About..."));
......
......@@ -2,7 +2,7 @@
* gtk_sys.h: private Gtk+ interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: gtk_sys.h,v 1.2 2001/03/04 03:12:00 sam Exp $
* $Id: gtk_sys.h,v 1.3 2001/03/07 10:31:10 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -38,6 +38,7 @@ typedef struct intf_sys_s
boolean_t b_popup_changed; /* display menu ? */
boolean_t b_window_changed; /* window display toggled ? */
boolean_t b_playlist_changed; /* playlist display toggled ? */
boolean_t b_menus_update; /* menus have changed ? */
boolean_t b_scale_isfree; /* user isn't dragging scale ? */
/* intf_Manage callback timeout */
......
This diff is collapsed.
......@@ -142,6 +142,29 @@
<class>GtkMenu</class>
<name>menubar_view_menu</name>
<widget>
<class>GtkMenuItem</class>
<name>menubar_title</name>
<sensitive>False</sensitive>
<tooltip>Navigate through the stream</tooltip>
<label>_Title</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>menubar_chapter</name>
<sensitive>False</sensitive>
<label>_Chapter</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>separator11</name>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>menubar_playlist</name>
......@@ -182,6 +205,36 @@
<class>GtkMenu</class>
<name>menubar_settings_menu</name>
<widget>
<class>GtkMenuItem</class>
<name>separator7</name>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>menubar_audio</name>
<sensitive>False</sensitive>
<tooltip>Select audio language</tooltip>
<label>A_udio</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>menubar_subpictures</name>
<sensitive>False</sensitive>
<tooltip>Select sub-title</tooltip>
<label>Sub _Pictures</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>separator8</name>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>menubar_preferences</name>
......@@ -585,6 +638,42 @@
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>popup_navigation</name>
<sensitive>False</sensitive>
<label>Navigation</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>separator10</name>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>popup_audio</name>
<sensitive>False</sensitive>
<label>A_udio</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>popup_subpictures</name>
<sensitive>False</sensitive>
<label>Sub _Pictures</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>separator9</name>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>popup_about</name>
......
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.90 2001/03/07 01:36:41 sam Exp $
* $Id: input.c,v 1.91 2001/03/07 10:31:10 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -319,6 +319,7 @@ static int InitThread( input_thread_t * p_input )
p_input->pf_close = f.pf_close;
p_input->pf_end = f.pf_end;
p_input->pf_read = f.pf_read;
p_input->pf_set_area = f.pf_set_area;
p_input->pf_demux = f.pf_demux;
p_input->pf_new_packet = f.pf_new_packet;
p_input->pf_new_pes = f.pf_new_pes;
......
......@@ -225,3 +225,69 @@ void input_DumpStream( input_thread_t * p_input )
}
}
/*****************************************************************************
* input_ChangeES: answers to a user request with calls to (Un)SelectES
* ---
* Useful since the interface plugins know p_es
*****************************************************************************/
int input_ChangeES( input_thread_t * p_input, es_descriptor_t * p_es,
int i_type )
{
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 ) )
{
i_index = i;
break;
}
}
if( p_es != NULL )
{
if( i_index != -1 )
{
if( p_input->stream.pp_selected_es[i_index] != p_es )
{
input_UnselectES( p_input,
p_input->stream.pp_selected_es[i_index] );
input_SelectES( p_input, p_es );
intf_WarnMsg( 1, "dvd info: ES selected -> %s (0x%x)",
p_es->psz_desc, p_es->i_id );
}
}
else
{
input_SelectES( p_input, p_es );
intf_WarnMsg( 1, "dvd info: selected -> %s (0x%x)",
p_es->psz_desc, p_es->i_id );
}
}
else
{
if( i_index != -1 )
{
input_UnselectES( p_input,
p_input->stream.pp_selected_es[i_index] );
}
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
return 0;
}
......@@ -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.39 2001/03/02 15:51:22 massiot Exp $
* $Id: input_programs.c,v 1.40 2001/03/07 10:31:10 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -371,6 +371,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;
if( i_data_len )
{
......@@ -508,6 +509,7 @@ static int InitDecConfig( input_thread_t * p_input, es_descriptor_t * p_es,
p_config->pf_init_bit_stream = InitBitstream;
p_input->stream.i_selected_es_number++;
p_input->stream.pp_selected_es = realloc(
p_input->stream.pp_selected_es,
p_input->stream.i_selected_es_number
......
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