[vlc-devel] commit: Improved Qt4 teletext button. (Laurent Aimar )
git version control
git at videolan.org
Sat Feb 14 00:46:33 CET 2009
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Feb 14 00:45:02 2009 +0100| [1cb32fae16ec90849296220e655197c1c6e19d2f] | committer: Laurent Aimar
Improved Qt4 teletext button.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1cb32fae16ec90849296220e655197c1c6e19d2f
---
modules/gui/qt4/input_manager.cpp | 27 ++++++++++++++++++++-------
1 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index a0a4ca1..301c5fb 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -463,21 +463,21 @@ void InputManager::UpdateTeletext()
/* Teletext is possible. Show the buttons */
emit teletextPossible( b_enabled );
- msg_Err( p_intf, "InputManager::UpdateTeletext: %d %d", b_enabled, i_teletext_es );
/* If Teletext is selected */
if( b_enabled && i_teletext_es >= 0 )
{
-
/* Then, find the current page */
int i_page = 100;
+
vlc_object_t *p_vbi = (vlc_object_t *)
vlc_object_find_name( p_input, "zvbi", FIND_ANYWHERE );
+
if( p_vbi )
{
i_page = var_GetInteger( p_vbi, "vbi-page" );
vlc_object_release( p_vbi );
- emit newTelexPageSet( i_page );
}
+ emit newTelexPageSet( i_page );
}
emit teletextActivated( b_enabled && i_teletext_es >= 0 );
}
@@ -701,12 +701,25 @@ void InputManager::telexSetTransparency( bool b_transparentTelextext )
void InputManager::activateTeletext( bool b_enable )
{
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 )
- var_SetInteger( p_input, "spu-es", b_enable ? list.p_list->p_values[0].i_int : -1 );
-
- var_Change( p_input, "teletext-es", VLC_VAR_FREELIST, &list, NULL );
+ {
+ /* Prefer the page 100 if it is present */
+ 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 );
}
}
More information about the vlc-devel
mailing list