[vlc-devel] commit: Qt4: wait until the video output is ready ( Rémi Denis-Courmont )

git version control git at videolan.org
Fri Jun 20 18:50:49 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Fri Jun 20 19:45:03 2008 +0300| [5f010182e0e86ef0fe7fa3ddc0345ffa034fb392]

Qt4: wait until the video output is ready

Except that this still returns an X11 invalid handle

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

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

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index 4ba788d..f31e75b 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -68,8 +68,14 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
     plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black );
     setPalette( plt );
 
-    /* The core can ask through a callback to show the video */
-    CONNECT( this, askVideoWidgetToShow(), this, show() );
+    /* The core can ask through a callback to show the video.
+     * NOTE: We need to block the video output core until the window handle
+     * is ready for use (otherwise an X11 invalid handle failure may occur).
+     * As a side effect, it is illegal to emit askVideoWidgetToShow from
+     * the same thread as the Qt4 thread that owns this. */
+    QObject::connect( this, SIGNAL(askVideoWidgetToShow()), this, SLOT(show()),
+                      Qt::BlockingQueuedConnection );
+
     /* The core can ask through a callback to resize the video */
    // CONNECT( this, askResize( int, int ), this, SetSizing( int, int ) );
 }
@@ -108,6 +114,7 @@ void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
         return NULL;
     }
     p_vout = p_nvout;
+    msg_Dbg( p_intf, "embedded video handle %p", winId() );
     return ( void* )winId();
 }
 




More information about the vlc-devel mailing list