Commit 40a91e26 authored by Laurent Aimar's avatar Laurent Aimar

* all: don't use input_ToggleES.

parent c57da819
......@@ -201,70 +201,18 @@ BList * VlcWrapper::GetChannels( int i_cat )
void VlcWrapper::ToggleLanguage( int i_language )
{
es_descriptor_t * p_es = NULL;
es_descriptor_t * p_es_old = NULL;
vlc_mutex_lock( &p_input->stream.stream_lock );
for( unsigned int i = 0; i < p_input->stream.i_selected_es_number ; i++ )
{
if( p_input->stream.pp_selected_es[i]->i_cat == AUDIO_ES )
{
p_es_old = p_input->stream.pp_selected_es[i];
break;
}
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
if( i_language != -1 )
{
p_es = p_input->stream.pp_es[i_language];
}
if( p_es == p_es_old )
{
return;
}
if( p_es_old )
{
input_ToggleES( p_input, p_es_old, VLC_FALSE );
}
if( p_es )
{
input_ToggleES( p_input, p_es, VLC_TRUE );
}
if( i_language < 0 )
var_SetInteger( p_input, "audio-es", -1 ); /* Disable audio */
else
var_SetInteger( p_input, "audio-es", i_language );
}
void VlcWrapper::ToggleSubtitle( int i_subtitle )
{
es_descriptor_t * p_es = NULL;
es_descriptor_t * p_es_old = NULL;
vlc_mutex_lock( &p_input->stream.stream_lock );
for( unsigned int i = 0; i < p_input->stream.i_selected_es_number ; i++ )
{
if( p_input->stream.pp_selected_es[i]->i_cat == SPU_ES )
{
p_es_old = p_input->stream.pp_selected_es[i];
break;
}
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
if( i_subtitle != -1 )
{
p_es = p_input->stream.pp_es[i_subtitle];
}
if( p_es == p_es_old )
{
return;
}
if( p_es_old )
{
input_ToggleES( p_input, p_es_old, VLC_FALSE );
}
if( p_es )
{
input_ToggleES( p_input, p_es, VLC_TRUE );
}
if( i_language < 0 )
var_SetInteger( p_input, "spu-es", -1 ); /* Disable SPU */
else
var_SetInteger( p_input, "spu-es", i_subtitle );
}
const char * VlcWrapper::GetTimeAsString()
......
......@@ -82,7 +82,7 @@ gint GtkSetupMenus( intf_thread_t * p_intf );
* user_data to transmit intf_* and we need to refresh the other menu.
****************************************************************************/
#define GTKLANGTOGGLE( window, menu, type, callback, b_update ) \
#define GTKLANGTOGGLE( window, menu, type, var_name, callback, b_update )\
intf_thread_t * p_intf; \
GtkWidget * p_menu; \
es_descriptor_t * p_es; \
......@@ -94,9 +94,10 @@ gint GtkSetupMenus( intf_thread_t * p_intf );
p_menu = GTK_WIDGET( gtk_object_get_data( \
GTK_OBJECT( p_intf->p_sys->window ), (menu) ) ); \
p_es = (es_descriptor_t*)user_data; \
\
input_ToggleES( p_intf->p_sys->p_input, \
p_es, menuitem->active ); \
if( p_es && menuitem->active ) \
var_SetInteger( p_intf->p_sys->p_input, var_name, p_es->i_id ); \
else \
var_SetInteger( p_intf->p_sys->p_input, var_name, -1 ); \
\
p_intf->p_sys->b_update = menuitem->active; \
\
......@@ -114,13 +115,13 @@ gint GtkSetupMenus( intf_thread_t * p_intf );
void GtkMenubarAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
GTKLANGTOGGLE( p_popup, "popup_language", AUDIO_ES,
GTKLANGTOGGLE( p_popup, "popup_language", AUDIO_ES, "audio-es",
GtkPopupAudioToggle, b_audio_update );
}
void GtkPopupAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
GTKLANGTOGGLE( p_window, "menubar_audio", AUDIO_ES,
GTKLANGTOGGLE( p_window, "menubar_audio", AUDIO_ES, "audio-es",
GtkMenubarAudioToggle, b_audio_update );
}
......@@ -130,13 +131,13 @@ void GtkPopupAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
void GtkMenubarSubtitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
GTKLANGTOGGLE( p_popup, "popup_subpictures", SPU_ES,
GTKLANGTOGGLE( p_popup, "popup_subpictures", SPU_ES, "spu-es",
GtkPopupSubtitleToggle, b_spu_update );
}
void GtkPopupSubtitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
GTKLANGTOGGLE( p_window, "menubar_subpictures", SPU_ES,
GTKLANGTOGGLE( p_window, "menubar_subpictures", SPU_ES, "spu-es",
GtkMenubarSubtitleToggle, b_spu_update );
}
......
......@@ -494,7 +494,10 @@ void KInterface::languageMenus(KActionMenu *root, es_descriptor_t *p_es,
void KInterface::slotSetLanguage( bool on, es_descriptor_t *p_es )
{
input_ToggleES( p_intf->p_sys->p_input, p_es, on );
if( p_es )
var_SetInteger( p_intf->p_sys->p_input, "audio-es", p_es->i_id );
else
var_SetInteger( p_intf->p_sys->p_input, "audio-es", -1 );
}
void KInterface::slotSliderChanged( int position )
......
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