[vlc-commits] libvlc: libvlc_video_set_teletext(0) to disable teletext

Thomas Guillem git at videolan.org
Mon Mar 27 14:48:23 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Mar 27 11:45:16 2017 +0200| [76c74ca0cffb0396874e17d2a010ea323389aa49] | committer: Thomas Guillem

libvlc: libvlc_video_set_teletext(0) to disable teletext

Since 0 is an invalid page for the zvbi plugin.

libvlc_video_get_teletext() will now return 0 if teletext is disabled. The
teletext was already disabled by default, and libvlc_video_get_teletext() could
be misleading since it returned 100 by default.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=76c74ca0cffb0396874e17d2a010ea323389aa49
---

 include/vlc/libvlc_media_player.h |  9 ++++++---
 lib/media_player.c                |  2 +-
 lib/video.c                       | 14 +++++++-------
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index f1bd456..a208881 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1352,7 +1352,10 @@ LIBVLC_API
 void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi, const char *psz_geometry );
 
 /**
- * Get current teletext page requested.
+ * Get current teletext page requested or 0 if it's disabled.
+ *
+ * Teletext is disabled by default, call libvlc_video_set_teletext() to enable
+ * it.
  *
  * \param p_mi the media player
  * \return the current teletext page requested.
@@ -1365,8 +1368,8 @@ LIBVLC_API int libvlc_video_get_teletext( libvlc_media_player_t *p_mi );
  * This function can also be used to send a teletext key.
  *
  * \param p_mi the media player
- * \param i_page teletex page number requested. This value can be -1 to disable
- * teletext, a number in the range [0;1000[ to show the requested page, or a
+ * \param i_page teletex page number requested. This value can be 0 to disable
+ * teletext, a number in the range ]0;1000[ to show the requested page, or a
  * \ref libvlc_teletext_key_t. 100 is the default teletext page.
  */
 LIBVLC_API void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page );
diff --git a/lib/media_player.c b/lib/media_player.c
index a0ef780..2c5aa72 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -648,7 +648,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
     var_Create (mp, "deinterlace-mode", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
 
     var_Create (mp, "vbi-page", VLC_VAR_INTEGER);
-    var_SetInteger (mp, "vbi-page", 100);
+    var_SetInteger (mp, "vbi-page", 0);
 
     var_Create (mp, "video-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
     var_Create (mp, "sub-source", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
diff --git a/lib/video.c b/lib/video.c
index 2b9dcf8..d25fadf 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -518,12 +518,7 @@ void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page )
 
     if( i_page >= 0 && i_page < 1000 )
         var_SetInteger( p_mi, "vbi-page", i_page );
-    else if( i_page < -1 )
-    {
-        libvlc_printerr("Invalid page number");
-        return;
-    }
-    else
+    else if( i_page >= 1000 )
     {
         switch (i_page)
         {
@@ -539,6 +534,11 @@ void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page )
                 return;
         }
     }
+    else
+    {
+        libvlc_printerr("Invalid page number");
+        return;
+    }
 
     p_input_thread = libvlc_get_input_thread( p_mi );
     if( !p_input_thread ) return;
@@ -549,7 +549,7 @@ void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page )
         return;
     }
 
-    if( i_page == -1 )
+    if( i_page == 0 )
     {
         teletext_enable( p_input_thread, false );
     }



More information about the vlc-commits mailing list