From 8af605c2c04e51c9e431d16e7c05026f2d794b9b Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Fri, 5 Aug 2011 20:19:58 +0000 Subject: [PATCH] * gstreamer.py: Document bus and pipeline. Make bus public. --- morituri/extern/task/ChangeLog | 5 +++++ morituri/extern/task/gstreamer.py | 31 +++++++++++++++++++------------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/morituri/extern/task/ChangeLog b/morituri/extern/task/ChangeLog index 907a2bf..6999323 100644 --- a/morituri/extern/task/ChangeLog +++ b/morituri/extern/task/ChangeLog @@ -1,3 +1,8 @@ +2011-08-05 Thomas Vander Stichele + + * gstreamer.py: + Document bus and pipeline. Make bus public. + 2011-08-05 Thomas Vander Stichele * gstreamer.py: diff --git a/morituri/extern/task/gstreamer.py b/morituri/extern/task/gstreamer.py index 8a38d8d..986d6b1 100644 --- a/morituri/extern/task/gstreamer.py +++ b/morituri/extern/task/gstreamer.py @@ -48,15 +48,20 @@ class GstPipelineTask(task.Task): I handle errors and raise them appropriately. - @cvar gst: the GStreamer module, so code does not have to import gst - as a module in code everywhere to avoid option stealing. - @var playing: whether the pipeline should be set to playing after - paused. Some pipelines don't need to play for a task - to be done (for example, querying length) + @cvar gst: the GStreamer module, so code does not have to import gst + as a module in code everywhere to avoid option stealing. + @var playing: whether the pipeline should be set to playing after + paused. Some pipelines don't need to play for a task + to be done (for example, querying length) + @type playing: bool + @type pipeline: L{gst.Pipeline} + @type bus: L{gst.Bus} """ gst = None playing = True + pipeline = None + bus = None ### task.Task implementations def start(self, runner): @@ -67,18 +72,20 @@ class GstPipelineTask(task.Task): self.getPipeline() - self._bus = self.pipeline.get_bus() - self.gst.debug('got bus %r' % self._bus) + self.bus = self.pipeline.get_bus() + # FIXME: remove this + self._bus = self.bus + self.gst.debug('got bus %r' % self.bus) # a signal watch calls callbacks from an idle loop - # self._bus.add_signal_watch() + # self.bus.add_signal_watch() # sync emission triggers sync-message signals which calls callbacks # from the thread that signals, but happens immediately - self._bus.enable_sync_message_emission() - self._bus.connect('sync-message::eos', self.bus_eos_cb) - self._bus.connect('sync-message::tag', self.bus_tag_cb) - self._bus.connect('sync-message::error', self.bus_error_cb) + self.bus.enable_sync_message_emission() + self.bus.connect('sync-message::eos', self.bus_eos_cb) + self.bus.connect('sync-message::tag', self.bus_tag_cb) + self.bus.connect('sync-message::error', self.bus_error_cb) self.parsed()