[SCM] morituri/master: * morituri/common/encode.py: Convert TagReadTask to gstreamer.GstPipelineTask and remove lots of duplicate code.

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:09:26 UTC 2014


The following commit has been merged in the master branch:
commit eef8b184354dd6a184ea6d53ab09aff86ecccab3
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Mon May 23 18:05:31 2011 +0000

    	* morituri/common/encode.py:
    	  Convert TagReadTask to gstreamer.GstPipelineTask and
    	  remove lots of duplicate code.

diff --git a/ChangeLog b/ChangeLog
index 7d91d67..5de7d68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-05-23  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+	* morituri/common/encode.py:
+	  Convert TagReadTask to gstreamer.GstPipelineTask and
+	  remove lots of duplicate code.
+
+2011-05-23  Thomas Vander Stichele  <thomas at apestaart dot org>
+
 	* morituri/common/checksum.py:
 	* morituri/common/encode.py:
 	* morituri/common/gstreamer.py:
diff --git a/morituri/common/encode.py b/morituri/common/encode.py
index 207993b..a069f9a 100644
--- a/morituri/common/encode.py
+++ b/morituri/common/encode.py
@@ -251,7 +251,7 @@ class EncodeTask(gstreamer.GstPipelineTask):
         else:
             self.warning('No peak found, something went wrong!')
 
-class TagReadTask(task.Task):
+class TagReadTask(gstreamer.GstPipelineTask):
     """
     I am a task that reads tags.
 
@@ -272,54 +272,21 @@ class TagReadTask(task.Task):
         
         self._path = path
 
-    def start(self, runner):
-        task.Task.start(self, runner)
-
-        # here to avoid import gst eating our options
-        import gst
-
-        self._pipeline = gst.parse_launch('''
+    def getPipelineDesc(self):
+        return '''
             filesrc location="%s" !
             decodebin name=decoder !
             fakesink''' % (
-                common.quoteParse(self._path).encode('utf-8')))
-
-        self.debug('pausing pipeline')
-        self._pipeline.set_state(gst.STATE_PAUSED)
-        ret = self._pipeline.get_state()
-        self.debug('paused pipeline, get_state returned %r', ret)
-
-        # add eos handling
-        bus = self._pipeline.get_bus()
-        bus.add_signal_watch()
-        bus.connect('message::eos', self._message_eos_cb)
-
-        # set up tag callbacks
-        bus.connect('message::tag', self._message_tag_cb)
+                common.quoteParse(self._path).encode('utf-8'))
 
-        def play():
-            self._pipeline.set_state(gst.STATE_PLAYING)
-            return False
-        self.runner.schedule(0, play)
-
-    def _message_eos_cb(self, bus, message):
+    def bus_eos_cb(self, bus, message):
         self.debug('eos, scheduling stop')
         self.runner.schedule(0, self.stop)
 
-    def _message_tag_cb(self, bus, message):
+    def bus_tag_cb(self, bus, message):
         taglist = message.parse_tag()
         self.taglist = taglist
 
-    def stop(self):
-        # here to avoid import gst eating our options
-        import gst
-
-        self.debug('stopping')
-        self.debug('setting state to NULL')
-        self._pipeline.set_state(gst.STATE_NULL)
-        self.debug('set state to NULL')
-        task.Task.stop(self)
-
 class TagWriteTask(task.Task):
     """
     I am a task that retags an encoded file.

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list