Commit 1cb32fae authored by Laurent Aimar's avatar Laurent Aimar

Improved Qt4 teletext button.

parent ae4ee908
...@@ -463,21 +463,21 @@ void InputManager::UpdateTeletext() ...@@ -463,21 +463,21 @@ void InputManager::UpdateTeletext()
/* Teletext is possible. Show the buttons */ /* Teletext is possible. Show the buttons */
emit teletextPossible( b_enabled ); emit teletextPossible( b_enabled );
msg_Err( p_intf, "InputManager::UpdateTeletext: %d %d", b_enabled, i_teletext_es );
/* If Teletext is selected */ /* If Teletext is selected */
if( b_enabled && i_teletext_es >= 0 ) if( b_enabled && i_teletext_es >= 0 )
{ {
/* Then, find the current page */ /* Then, find the current page */
int i_page = 100; int i_page = 100;
vlc_object_t *p_vbi = (vlc_object_t *) vlc_object_t *p_vbi = (vlc_object_t *)
vlc_object_find_name( p_input, "zvbi", FIND_ANYWHERE ); vlc_object_find_name( p_input, "zvbi", FIND_ANYWHERE );
if( p_vbi ) if( p_vbi )
{ {
i_page = var_GetInteger( p_vbi, "vbi-page" ); i_page = var_GetInteger( p_vbi, "vbi-page" );
vlc_object_release( p_vbi ); vlc_object_release( p_vbi );
emit newTelexPageSet( i_page );
} }
emit newTelexPageSet( i_page );
} }
emit teletextActivated( b_enabled && i_teletext_es >= 0 ); emit teletextActivated( b_enabled && i_teletext_es >= 0 );
} }
...@@ -701,12 +701,25 @@ void InputManager::telexSetTransparency( bool b_transparentTelextext ) ...@@ -701,12 +701,25 @@ void InputManager::telexSetTransparency( bool b_transparentTelextext )
void InputManager::activateTeletext( bool b_enable ) void InputManager::activateTeletext( bool b_enable )
{ {
vlc_value_t list; vlc_value_t list;
if( hasInput() && !var_Change( p_input, "teletext-es", VLC_VAR_GETLIST, &list, NULL ) ) vlc_value_t text;
if( hasInput() && !var_Change( p_input, "teletext-es", VLC_VAR_GETLIST, &list, &text ) )
{ {
if( list.p_list->i_count > 0 ) if( list.p_list->i_count > 0 )
var_SetInteger( p_input, "spu-es", b_enable ? list.p_list->p_values[0].i_int : -1 ); {
/* Prefer the page 100 if it is present */
var_Change( p_input, "teletext-es", VLC_VAR_FREELIST, &list, NULL ); int i;
for( i = 0; i < text.p_list->i_count; i++ )
{
/* The description is the page number as a string */
const char *psz_page = text.p_list->p_values[i].psz_string;
if( psz_page && !strcmp( psz_page, "100" ) )
break;
}
if( i >= list.p_list->i_count )
i = 0;
var_SetInteger( p_input, "spu-es", b_enable ? list.p_list->p_values[i].i_int : -1 );
}
var_Change( p_input, "teletext-es", VLC_VAR_FREELIST, &list, &text );
} }
} }
......
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