[vlc-devel] commit: LibVLC teletext: various fixes ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Feb 6 17:58:21 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Feb  6 18:56:17 2010 +0200| [4d76e25678ef48a4cc4bfb191df2a8d326edfe4d] | committer: Rémi Denis-Courmont 

LibVLC teletext: various fixes

 * allow setting page all the time,
 * remove dummy exception,
 * fix an object leak,
 * remove impossible error,
 * fix apparently inverted logic.

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

 include/vlc/libvlc_media_player.h |    3 +--
 src/control/media_player.c        |    1 +
 src/control/video.c               |   37 ++++++-------------------------------
 3 files changed, 8 insertions(+), 33 deletions(-)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index f14ef90..7016ee2 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -725,9 +725,8 @@ VLC_PUBLIC_API int libvlc_video_get_teletext( libvlc_media_player_t * );
  *
  * \param p_mediaplayer the media player
  * \param i_page teletex page number requested
- * \param p_e an initialized exception pointer
  */
-VLC_PUBLIC_API void libvlc_video_set_teletext( libvlc_media_player_t *, int, libvlc_exception_t * );
+VLC_PUBLIC_API void libvlc_video_set_teletext( libvlc_media_player_t *, int );
 
 /**
  * Toggle teletext transparent status on video output.
diff --git a/src/control/media_player.c b/src/control/media_player.c
index 99e4df0..c5af723 100644
--- a/src/control/media_player.c
+++ b/src/control/media_player.c
@@ -365,6 +365,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
     var_Create (mp, "crop", VLC_VAR_STRING);
     var_Create (mp, "deinterlace", VLC_VAR_INTEGER);
     var_Create (mp, "deinterlace-mode", VLC_VAR_STRING);
+    var_Create (mp, "vbi-page", VLC_VAR_INTEGER);
 
      /* Audio */
     var_Create (mp, "aout", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
diff --git a/src/control/video.c b/src/control/video.c
index 286ae18..df91345 100644
--- a/src/control/video.c
+++ b/src/control/video.c
@@ -390,37 +390,17 @@ void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi,
 
 int libvlc_video_get_teletext( libvlc_media_player_t *p_mi )
 {
-    input_thread_t *p_input_thread;
-    vlc_object_t *p_zvbi = NULL;
-    int i_ret = -1, telx;
-
-    p_input_thread = libvlc_get_input_thread( p_mi );
-    if( !p_input_thread ) return i_ret;
-
-    if( var_CountChoices( p_input_thread, "teletext-es" ) <= 0 )
-    {
-        vlc_object_release( p_input_thread );
-        return i_ret;
-    }
-
-    telx = var_GetInteger( p_input_thread, "teletext-es" );
-    if( input_GetEsObjects( p_input_thread, telx, &p_zvbi, NULL, NULL )
-        != VLC_SUCCESS )
-    {
-        i_ret = var_GetInteger( p_zvbi, "vbi-page" );
-        vlc_object_release( p_zvbi );
-    }
-    vlc_object_release( p_input_thread );
-    return i_ret;
+    return var_GetInteger (p_mi, "vbi-page");
 }
 
-void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page,
-                                libvlc_exception_t *p_e )
+void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page )
 {
     input_thread_t *p_input_thread;
     vlc_object_t *p_zvbi = NULL;
     int telx;
 
+    var_SetInteger (p_mi, "vbi-page", i_page);
+
     p_input_thread = libvlc_get_input_thread( p_mi );
     if( !p_input_thread ) return;
 
@@ -432,15 +412,10 @@ void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page,
 
     telx = var_GetInteger( p_input_thread, "teletext-es" );
     if( input_GetEsObjects( p_input_thread, telx, &p_zvbi, NULL, NULL )
-        != VLC_SUCCESS )
+        == VLC_SUCCESS )
     {
-        int i_ret = var_SetInteger( p_zvbi, "vbi-page", i_page );
+        var_SetInteger( p_zvbi, "vbi-page", i_page );
         vlc_object_release( p_zvbi );
-        if( i_ret )
-        {
-            libvlc_exception_raise( p_e );
-            libvlc_printerr( "Unexpected error while setting teletext page" );
-        }
     }
     vlc_object_release( p_input_thread );
 }




More information about the vlc-devel mailing list