[pitivi] Workaround to make the missing-plugin API work when using decodebin2.



commit a35296da01913969a163f0b614df122104c28d6b
Author: Alessandro Decina <alessandro d gmail com>
Date:   Sat May 23 12:44:42 2009 +0200

    Workaround to make the missing-plugin API work when using decodebin2.
    
    Decodebin2 commits its state change to PAUSED before posting missing-plugin
    messages. The workaround consists in manually popping messages off the bus
    before doing our internal check for missing plugins.
    Fixes #583487.
---
 pitivi/discoverer.py |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/pitivi/discoverer.py b/pitivi/discoverer.py
index ed8ce8f..1c358d0 100644
--- a/pitivi/discoverer.py
+++ b/pitivi/discoverer.py
@@ -136,6 +136,19 @@ class Discoverer(Signallable, Loggable):
         self.timeout_id = 0
 
     def _checkMissingPlugins(self):
+        if self.bus is not None:
+            # This method is usually called when decodebin(2) reaches PAUSED and
+            # we stop analyzing the current source.
+            # decodebin2 commits its state change to PAUSED _before_ posting
+            # missing-plugin messages, so we manually pop ELEMENT messages
+            # looking for queued missing-plugin messages.
+            while True:
+                message = self.bus.pop_filtered(gst.MESSAGE_ELEMENT)
+                if message is None:
+                    break
+
+                self._busMessageElementCb(self.bus, message)
+
         if not self.missing_plugin_messages:
             return False
 
@@ -175,8 +188,8 @@ class Discoverer(Signallable, Loggable):
         if self.timeout_id:
             self._removeTimeout()
 
-        self._resetPipeline()
         missing_plugins = self._checkMissingPlugins()
+        self._resetPipeline()
         if not self.current_streams and self.error is None:
             # EOS and no decodable streams?
             self.error = _('No streams found')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]