[pitivi: 3/4] discoverer: fix discovery of files with unknown streams



commit d93665661d1db2a3e5737f9fd8d022e872453291
Author: Alessandro Decina <alessandro d gmail com>
Date:   Sun Mar 7 23:43:12 2010 +0100

    discoverer: fix discovery of files with unknown streams

 pitivi/discoverer.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/discoverer.py b/pitivi/discoverer.py
index 4b0d525..7ce7c25 100644
--- a/pitivi/discoverer.py
+++ b/pitivi/discoverer.py
@@ -125,6 +125,7 @@ class Discoverer(Signallable, Loggable):
         self.error = None
         self.error_detail = None
         self.unfixed_pads = 0
+        self.unknown_pads = 0
         self.missing_plugin_messages = []
         self.dynamic_elements = []
         self.thumbnails = {}
@@ -383,6 +384,7 @@ class Discoverer(Signallable, Loggable):
             dbin = gst.element_factory_make("decodebin", "dbin")
 
         dbin.connect("new-decoded-pad", self._newDecodedPadCb)
+        dbin.connect("unknown-type", self._unknownType)
 
         return dbin
 
@@ -482,7 +484,7 @@ class Discoverer(Signallable, Loggable):
         if prev == gst.STATE_READY and new == gst.STATE_PAUSED and \
                 pending == gst.STATE_VOID_PENDING:
             have_video, have_audio, have_image = self._getCurrentStreamTypes()
-            if self.unfixed_pads or have_video or have_image:
+            if self.unfixed_pads or self.unknown_pads or have_video or have_image:
                 # go to PLAYING to generate the thumbnails
                 if self.pipeline.set_state(gst.STATE_PLAYING) == gst.STATE_CHANGE_FAILURE:
                     if not self.error:
@@ -706,6 +708,11 @@ class Discoverer(Signallable, Loggable):
             self.unfixed_pads += 1
             self.debug("unfixed pads %d", self.unfixed_pads)
 
+    def _unknownType(self, decodebin, pad, caps):
+        # decodebin2 sends ASYNC_DONE when it finds an unknown type so we have
+        # to deal with that...
+        self.unknown_pads += 1
+
     def _addStreamFromPad(self, pad):
         self._maybeQueryDuration(pad)
         self.debug("adding stream from pad %s caps %s", pad, pad.props.caps)



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