Fix readyChanged signal emit in gstreamervideorenderer
authorMithra Pattison <mithra.pattison@nokia.com>
Mon, 19 Dec 2011 09:23:21 +0000 (19:23 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 21 Dec 2011 06:36:27 +0000 (07:36 +0100)
Modified handling of source update in gstreamervideorenderer as
the existing logic meant that it would never emit the readyChanged
signal.

Change-Id: I0a1488cfc151388fe0145d231001e502e9f45f0e
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
Reviewed-by: Mithra Pattison <mithra.pattison@nokia.com>
src/plugins/gstreamer/qgstreamervideorenderer.cpp

index ead0bdc..ac3d4a1 100644 (file)
@@ -90,20 +90,19 @@ void QGstreamerVideoRenderer::setSurface(QAbstractVideoSurface *surface)
             disconnect(m_surface, SIGNAL(supportedFormatsChanged()),
                        this, SLOT(handleFormatChange()));
         }
-        
-        m_surface = surface;
 
-        if (surface && !m_surface)
-            emit readyChanged(true);
+        bool wasReady = isReady();
 
-        if (!surface && m_surface)
-            emit readyChanged(false);
+        m_surface = surface;
 
         if (m_surface) {
             connect(m_surface, SIGNAL(supportedFormatsChanged()),
                     this, SLOT(handleFormatChange()));
         }
 
+        if (wasReady != isReady())
+            emit readyChanged(isReady());
+
         emit sinkChanged();
     }
 }