Don't misuse p_this->p_libvlc for putting modules variables of zvbi.
authorJean-Paul Saman <jpsaman@videolan.org>
Sun, 16 Dec 2007 20:58:28 +0000 (20:58 +0000)
committerJean-Paul Saman <jpsaman@videolan.org>
Sun, 16 Dec 2007 20:58:28 +0000 (20:58 +0000)
modules/codec/zvbi.c
modules/gui/qt4/input_manager.cpp
src/control/video.c

index d31a340..d1cd108 100644 (file)
@@ -204,12 +204,12 @@ static int Open( vlc_object_t *p_this )
                                 event_handler, p_dec );
 
     /* Create the var on vlc_global. */
-    p_sys->i_wanted_page = var_CreateGetInteger( p_dec->p_libvlc, "vbi-page" );
-    var_AddCallback( p_dec->p_libvlc, "vbi-page",
+    p_sys->i_wanted_page = var_CreateGetInteger( p_dec, "vbi-page" );
+    var_AddCallback( p_dec, "vbi-page",
                      RequestPage, p_sys );
 
-    p_sys->b_opaque = var_CreateGetBool( p_dec->p_libvlc, "vbi-opaque" );
-    var_AddCallback( p_dec->p_libvlc, "vbi-opaque", Opaque, p_sys );
+    p_sys->b_opaque = var_CreateGetBool( p_dec, "vbi-opaque" );
+    var_AddCallback( p_dec, "vbi-opaque", Opaque, p_sys );
 
     p_sys->i_align = var_CreateGetInteger( p_dec, "vbi-position" );
     var_AddCallback( p_dec, "vbi-position", Position, p_sys );
@@ -237,10 +237,10 @@ static void Close( vlc_object_t *p_this )
     decoder_t     *p_dec = (decoder_t*) p_this;
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    var_Destroy( p_dec->p_libvlc, "vbi-opaque" );
-    var_Destroy( p_dec->p_libvlc, "vbi-page" );
-    var_DelCallback( p_dec->p_libvlc, "vbi-page", RequestPage, p_sys );
-    var_DelCallback( p_dec->p_libvlc, "vbi-opaque", Opaque, p_sys );
+    var_Destroy( p_dec, "vbi-opaque" );
+    var_Destroy( p_dec, "vbi-page" );
+    var_DelCallback( p_dec, "vbi-page", RequestPage, p_sys );
+    var_DelCallback( p_dec, "vbi-opaque", Opaque, p_sys );
 
 #ifdef HAVE_FFMPEG_SWSCALE_H
     if( p_sys->p_image ) image_HandlerDelete( p_sys->p_image );
@@ -473,7 +473,7 @@ static void event_handler( vbi_event *ev, void *user_data )
 
     if( ev->type == VBI_EVENT_TTX_PAGE )
     {
-        /* msg_Dbg( p_dec, "Page %03x.%02x ",
+        /* msg_Info( p_dec, "Page %03x.%02x ",
                     ev->ev.ttx_page.pgno,
                     ev->ev.ttx_page.subno & 0xFF);
         */
index 5b42cb5..ec3423e 100644 (file)
@@ -240,7 +240,16 @@ void InputManager::telexGotoPage( int page )
 {
     // TODO: this has only sense when telx codec is available
     if( hasInput() )
-        var_SetInteger( p_input->p_libvlc, "vbi-page", page );
+    {
+        vlc_object_t *p_vbi;
+        p_vbi = (vlc_object_t *) vlc_object_find_name( p_input,
+                    "zvbi", FIND_ANYWHERE );
+        if( p_vbi )
+        {
+            var_SetInteger( p_vbi, "vbi-page", page );
+            vlc_object_release( p_vbi );
+        }
+    }
 }
 
 void InputManager::telexToggle( bool b_enabled )
@@ -252,7 +261,16 @@ void InputManager::telexSetTransparency( bool b_transp )
 {
     // TODO: this has only sense when telx codec is available
     if( hasInput() )
-        var_SetBool( p_input->p_libvlc, "vbi-opaque", b_transp );
+    {
+        vlc_object_t *p_vbi;
+        p_vbi = (vlc_object_t *) vlc_object_find_name( p_input,
+                    "zvbi", FIND_ANYWHERE );
+        if( p_vbi )
+        {
+            var_SetBool( p_input->p_libvlc, "vbi-opaque", b_transp );
+            vlc_object_release( p_vbi );
+        }
+    }
 }
 
 void InputManager::slower()
index ba9d3b6..ebdd6df 100644 (file)
@@ -486,12 +486,20 @@ int libvlc_video_get_teletext( libvlc_media_instance_t *p_mi,
                                libvlc_exception_t *p_e )
 {
     vout_thread_t *p_vout = GetVout( p_mi, p_e );
+    vlc_object_t *p_vbi;
     int i_ret = -1;
 
     if( !p_vout )
         return i_ret;
 
-    i_ret = var_GetInteger( p_vout, "vbi-page" );
+    p_vbi = (vlc_object_t *) vlc_object_find_name( p_vout, "zvbi",
+                                                   FIND_ANYWHERE );
+    if( p_vbi )
+    {
+        i_ret = var_GetInteger( p_vout, "vbi-page" );
+        vlc_object_release( p_vbi );
+    }
+
     vlc_object_release( p_vout );
     return i_ret;
 }
@@ -500,12 +508,19 @@ void libvlc_video_set_teletext( libvlc_media_instance_t *p_mi, int i_page,
                                 libvlc_exception_t *p_e )
 {
     vout_thread_t *p_vout = GetVout( p_mi, p_e );
+    vlc_object_t *p_vbi;
     int i_ret = -1;
 
     if( !p_vout )
         return;
 
-    i_ret = var_SetInteger( p_vout, "vbi-page", i_page );
+    p_vbi = (vlc_object_t *) vlc_object_find_name( p_vout, "zvbi",
+                                                   FIND_ANYWHERE );
+    if( p_vbi )
+    {
+        i_ret = var_SetInteger( p_vbi, "vbi-page", i_page );
+        vlc_object_release( p_vbi );
+    }
     if( i_ret )
         libvlc_exception_raise( p_e,
                         "Unexpected error while setting teletext page" );