[vlc-commits] qt: do not retain a reference to the VBI decoder

Rémi Denis-Courmont git at videolan.org
Sat Mar 16 11:07:51 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Mar 15 11:18:55 2019 +0200| [82288cb6a9b4323365e9a344b8b3b551d3a540b1] | committer: Rémi Denis-Courmont

qt: do not retain a reference to the VBI decoder

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

 modules/gui/qt/input_manager.cpp | 50 ++++++++++++++++++++++------------------
 modules/gui/qt/input_manager.hpp |  1 -
 2 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/modules/gui/qt/input_manager.cpp b/modules/gui/qt/input_manager.cpp
index 7ae94ded59..4ce26ac38d 100644
--- a/modules/gui/qt/input_manager.cpp
+++ b/modules/gui/qt/input_manager.cpp
@@ -67,7 +67,6 @@ InputManager::InputManager( MainInputManager *mim, intf_thread_t *_p_intf) :
     oldName      = "";
     artUrl       = "";
     p_input      = NULL;
-    p_input_vbi  = NULL;
     f_rate       = 0.;
     p_item       = NULL;
     b_video      = false;
@@ -142,7 +141,6 @@ void InputManager::setInput( input_thread_t *_p_input )
     {
         p_item = NULL;
         lastURI.clear();
-        assert( !p_input_vbi );
         emit rateChanged( var_InheritFloat( p_intf, "rate" ) );
     }
 }
@@ -179,12 +177,6 @@ void InputManager::delInput()
     timeB                = VLC_TICK_INVALID;
     f_rate               = 0. ;
 
-    if( p_input_vbi )
-    {
-        vlc_object_release( p_input_vbi );
-        p_input_vbi = NULL;
-    }
-
     input_Release( p_input );
     p_input = NULL;
 
@@ -574,15 +566,11 @@ void InputManager::UpdateTeletext()
     /* If Teletext is selected */
     if( b_enabled && i_teletext_es >= 0 )
     {
+        vlc_object_t *p_input_vbi;
         /* Then, find the current page */
         int i_page = 100;
         bool b_transparent = false;
 
-        if( p_input_vbi )
-        {
-            vlc_object_release( p_input_vbi );
-        }
-
         if( input_GetEsObjects( p_input, i_teletext_es, &p_input_vbi ) )
             p_input_vbi = NULL;
 
@@ -590,6 +578,7 @@ void InputManager::UpdateTeletext()
         {
             i_page = var_GetInteger( p_input_vbi, "vbi-page" );
             b_transparent = !var_GetBool( p_input_vbi, "vbi-opaque" );
+            vlc_object_release( p_input_vbi );
         }
         emit newTelexPageSet( i_page );
         emit teletextTransparencyActivated( b_transparent );
@@ -812,24 +801,41 @@ void InputManager::changeProgram( int program )
 /* Set a new Teletext Page */
 void InputManager::telexSetPage( int page )
 {
-    if( hasInput() && p_input_vbi )
+    vlc_object_t *input_vbi;
+
+    if (!hasInput())
+        return;
+
+    const int i_teletext_es = var_GetInteger(p_input, "teletext-es");
+    if (i_teletext_es >= 0)
     {
-        const int i_teletext_es = var_GetInteger( p_input, "teletext-es" );
+        if (input_GetEsObjects(p_input, i_teletext_es, &input_vbi)
+         || input_vbi == NULL)
+            return;
 
-        if( i_teletext_es >= 0 )
-        {
-            var_SetInteger( p_input_vbi, "vbi-page", page );
-            emit newTelexPageSet( page );
-        }
+        var_SetInteger(input_vbi, "vbi-page", page);
+        vlc_object_release(input_vbi);
+        emit newTelexPageSet(page);
     }
 }
 
 /* Set the transparency on teletext */
 void InputManager::telexSetTransparency( bool b_transparentTelextext )
 {
-    if( hasInput() && p_input_vbi )
+    vlc_object_t *input_vbi;
+
+    if (!hasInput())
+        return;
+
+    const int i_teletext_es = var_GetInteger(p_input, "teletext-es");
+    if (i_teletext_es >= 0)
     {
-        var_SetBool( p_input_vbi, "vbi-opaque", !b_transparentTelextext );
+        if (input_GetEsObjects(p_input, i_teletext_es, &input_vbi)
+         || input_vbi == NULL)
+            return;
+
+        var_SetBool(input_vbi, "vbi-opaque", !b_transparentTelextext);
+        vlc_object_release(input_vbi);
         emit teletextTransparencyActivated( b_transparentTelextext );
     }
 }
diff --git a/modules/gui/qt/input_manager.hpp b/modules/gui/qt/input_manager.hpp
index eece06e13d..7fc69178f6 100644
--- a/modules/gui/qt/input_manager.hpp
+++ b/modules/gui/qt/input_manager.hpp
@@ -146,7 +146,6 @@ private:
     intf_thread_t  *p_intf;
     MainInputManager* p_mim;
     input_thread_t *p_input;
-    vlc_object_t   *p_input_vbi;
     input_item_t   *p_item;
     int             i_old_playing_status;
     QString         oldName;



More information about the vlc-commits mailing list