[vlc-commits] lib/video: refactor teletext activation
Thomas Guillem
git at videolan.org
Tue Mar 14 17:30:26 CET 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Mar 14 10:00:02 2017 +0100| [d05d123fc9f93fe15dc0f9ffad382dc1f5838b52] | committer: Thomas Guillem
lib/video: refactor teletext activation
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d05d123fc9f93fe15dc0f9ffad382dc1f5838b52
---
lib/video.c | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/lib/video.c b/lib/video.c
index a5157fd..587a8f7 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -490,6 +490,25 @@ int libvlc_video_get_teletext( libvlc_media_player_t *p_mi )
return var_GetInteger (p_mi, "vbi-page");
}
+static void teletext_enable( input_thread_t *p_input_thread, bool b_enable )
+{
+ if( b_enable )
+ {
+ vlc_value_t list;
+ if( !var_Change( p_input_thread, "teletext-es", VLC_VAR_GETCHOICES,
+ &list, NULL ) )
+ {
+ if( list.p_list->i_count > 0 )
+ var_SetInteger( p_input_thread, "spu-es",
+ list.p_list->p_values[0].i_int );
+
+ var_FreeList( &list, NULL );
+ }
+ }
+ else
+ var_SetInteger( p_input_thread, "spu-es", -1 );
+}
+
void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page )
{
input_thread_t *p_input_thread;
@@ -533,21 +552,7 @@ void libvlc_toggle_teletext( libvlc_media_player_t *p_mi )
return;
}
const bool b_selected = var_GetInteger( p_input_thread, "teletext-es" ) >= 0;
- if( b_selected )
- {
- var_SetInteger( p_input_thread, "spu-es", -1 );
- }
- else
- {
- vlc_value_t list;
- if( !var_Change( p_input_thread, "teletext-es", VLC_VAR_GETCHOICES, &list, NULL ) )
- {
- if( list.p_list->i_count > 0 )
- var_SetInteger( p_input_thread, "spu-es", list.p_list->p_values[0].i_int );
-
- var_FreeList( &list, NULL );
- }
- }
+ teletext_enable( p_input_thread, !b_selected );
vlc_object_release( p_input_thread );
}
More information about the vlc-commits
mailing list