[vlc-devel] commit: Qt4: keep the vout thread, not its ID ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Sep 20 13:50:35 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Sep 20 14:52:37 2008 +0300| [29b12104f25f3ae2cd8753ca3c9db18fb61a59f6] | committer: Rémi Denis-Courmont 

Qt4: keep the vout thread, not its ID

The window is always created with a pre-existing video output,
and destroyed before the video outout.

Besides, using object IDs is not safe.

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

 modules/gui/qt4/components/interface_widgets.cpp |   21 ++++++++-------------
 modules/gui/qt4/components/interface_widgets.hpp |    2 +-
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index fb1e69c..ec1391d 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -66,7 +66,7 @@
 VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
 {
     /* Init */
-    i_vout = 0;
+    p_vout = NULL;
     videoSize.rwidth() = -1;
     videoSize.rheight() = -1;
 
@@ -109,15 +109,10 @@ void VideoWidget::paintEvent(QPaintEvent *ev)
 /* Kill the vout at Destruction */
 VideoWidget::~VideoWidget()
 {
-    vout_thread_t *p_vout = i_vout ?
-        (vout_thread_t *)vlc_object_get( p_intf->p_libvlc, i_vout ) : NULL;
-
-    if( p_vout )
-    {
-        if( vout_Control( p_vout, VOUT_CLOSE ) != VLC_SUCCESS )
-            vout_Control( p_vout, VOUT_REPARENT );
-        vlc_object_release( p_vout );
-    }
+    if( !p_vout )
+        return;
+    if( vout_Control( p_vout, VOUT_CLOSE ) != VLC_SUCCESS )
+        vout_Control( p_vout, VOUT_REPARENT );
 }
 
 /**
@@ -128,12 +123,12 @@ void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
 {
     msg_Dbg( p_intf, "Video was requested %i, %i", *pi_x, *pi_y );
     emit askVideoWidgetToShow( *pi_width, *pi_height );
-    if( i_vout )
+    if( p_vout )
     {
         msg_Dbg( p_intf, "embedded video already in use" );
         return NULL;
     }
-    i_vout = p_nvout->i_object_id;
+    p_vout = p_nvout;
 #ifndef NDEBUG
     msg_Dbg( p_intf, "embedded video ready (handle %p)", winId() );
 #endif
@@ -155,7 +150,7 @@ void VideoWidget::SetSizing( unsigned int w, unsigned int h )
 void VideoWidget::release( void *p_win )
 {
     msg_Dbg( p_intf, "Video is not needed anymore" );
-    i_vout = 0;
+    p_vout = NULL;
     videoSize.rwidth() = 0;
     videoSize.rheight() = 0;
     updateGeometry();
diff --git a/modules/gui/qt4/components/interface_widgets.hpp b/modules/gui/qt4/components/interface_widgets.hpp
index 85d50e1..b4fd1f7 100644
--- a/modules/gui/qt4/components/interface_widgets.hpp
+++ b/modules/gui/qt4/components/interface_widgets.hpp
@@ -65,7 +65,7 @@ public:
     virtual QSize sizeHint() const;
 private:
     intf_thread_t *p_intf;
-    int i_vout;
+    vout_thread_t *p_vout;
 
     QSize videoSize;
 




More information about the vlc-devel mailing list