[pitivi] pipeline: Make use of the video_overlay directly
- From: Jean-François Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] pipeline: Make use of the video_overlay directly
- Date: Thu, 4 Apr 2013 20:15:59 +0000 (UTC)
commit 535a789fedae474fa787ab4979383ec73b547b9d
Author: Thibault Saunier <thibault saunier collabora com>
Date: Sat Mar 30 14:34:43 2013 +0100
pipeline: Make use of the video_overlay directly
pitivi/utils/pipeline.py | 34 +++++++---------------------------
pitivi/viewer.py | 14 +++-----------
2 files changed, 10 insertions(+), 38 deletions(-)
---
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 0081fd9..1cab100 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -146,26 +146,21 @@ class SimplePipeline(Signallable, Loggable):
"position": ["position"],
"duration-changed": ["duration"],
"eos": [],
- "error": ["message", "details"],
- "window-handle-message": ["message"]}
+ "error": ["message", "details"]
+ }
- def __init__(self, pipeline):
+ def __init__(self, pipeline, video_overlay):
Loggable.__init__(self)
Signallable.__init__(self)
self._pipeline = pipeline
self._bus = self._pipeline.get_bus()
self._bus.add_signal_watch()
self._bus.connect("message", self._busMessageCb)
- # Initially, we set a synchronous bus message handler so that the window handle
- # is known right away and we can set the viewer synchronously, avoiding
- # the creation of an external window.
- # Afterwards, the window-handle-message is handled async (to avoid deadlocks).
- self._bus.set_sync_handler(self._busSyncMessageHandler, None)
- self._has_sync_bus_handler = True
self._listening = False # for the position handler
self._listeningInterval = 300 # default 300ms
self._listeningSigId = 0
self._duration = Gst.CLOCK_TIME_NONE
+ self.video_overlay = video_overlay
def release(self):
"""
@@ -417,9 +412,6 @@ class SimplePipeline(Signallable, Loggable):
self.debug("Duration might have changed, querying it")
GLib.idle_add(self._queryDurationAsync)
else:
- if self._has_sync_bus_handler is False:
- # Pass message async to the sync bus handler
- self._busSyncMessageHandler(unused_bus, message, None)
self.log("%s [%r]" % (message.type, message.src))
def _queryDurationAsync(self, *args, **kwargs):
@@ -433,17 +425,6 @@ class SimplePipeline(Signallable, Loggable):
self.error("error from %s: %s (%s)" % (source, error, detail))
self.emit('error', error.message, detail)
- def _busSyncMessageHandler(self, unused_bus, message, unused_user_data):
- if message.type == Gst.MessageType.ELEMENT:
- if message.has_name('prepare-window-handle'):
- # handle element message synchronously
- self.emit('window-handle-message', message)
- #Remove the bus sync handler avoiding deadlocks
- #FIXME wrong anotation dont allow none, reported as bug b681139
- #self._bus.set_sync_handler(None, None)
- self._has_sync_bus_handler = False
- return Gst.BusSyncReply.PASS
-
def _getDuration(self, format=Gst.Format.TIME):
try:
res, dur = self._pipeline.query_duration(format)
@@ -477,13 +458,12 @@ class Pipeline(GES.TimelinePipeline, SimplePipeline):
(GObject.TYPE_UINT64,)),
"eos": (GObject.SignalFlags.RUN_LAST, None, ()),
"error": (GObject.SignalFlags.RUN_LAST, None,
- (GObject.TYPE_STRING, GObject.TYPE_STRING)),
- "window-handle-message": (GObject.SignalFlags.RUN_LAST, None,
- (GObject.TYPE_PYOBJECT,))}
+ (GObject.TYPE_STRING, GObject.TYPE_STRING))
+ }
def __init__(self, pipeline=None):
GES.TimelinePipeline.__init__(self)
- SimplePipeline.__init__(self, self)
+ SimplePipeline.__init__(self, self, self)
self._seeker = Seeker()
self._seeker.connect("seek", self._seekCb)
diff --git a/pitivi/viewer.py b/pitivi/viewer.py
index 923421b..0456d73 100644
--- a/pitivi/viewer.py
+++ b/pitivi/viewer.py
@@ -140,9 +140,10 @@ class PitiviViewer(Gtk.VBox, Loggable):
self.pipeline.connect("state-change", self._pipelineStateChangedCb)
self.pipeline.connect("position", self._positionCb)
- self.pipeline.connect("window-handle-message", self._windowHandleMessageCb)
self.pipeline.connect("duration-changed", self._durationChangedCb)
+ self.sink = pipeline.video_overlay
+ self._switch_output_window()
self._setUiActive()
def _disconnectFromPipeline(self):
@@ -152,7 +153,6 @@ class PitiviViewer(Gtk.VBox, Loggable):
return
self.pipeline.disconnect_by_func(self._pipelineStateChangedCb)
- self.pipeline.disconnect_by_func(self._windowHandleMessageCb)
self.pipeline.disconnect_by_func(self._positionCb)
self.pipeline.disconnect_by_func(self._durationChangedCb)
@@ -449,7 +449,7 @@ class PitiviViewer(Gtk.VBox, Loggable):
self._oldTimelinePos = self.pipeline.getPosition()
self._tmp_pipeline = Gst.ElementFactory.make("playbin", None)
self._tmp_pipeline.set_property("uri", clip_uri)
- self.setPipeline(SimplePipeline(self._tmp_pipeline))
+ self.setPipeline(SimplePipeline(self._tmp_pipeline, self._tmp_pipeline))
self._lastClipTrimTime = cur_time
if (cur_time - self._lastClipTrimTime) > 0.2:
# Do not seek more than once every 200 ms (for performance)
@@ -485,14 +485,6 @@ class PitiviViewer(Gtk.VBox, Loggable):
self.system.uninhibitScreensaver(self.INHIBIT_REASON)
self.internal._currentStateCb(self.pipeline, state)
- def _windowHandleMessageCb(self, unused_pipeline, message):
- """
- When the pipeline sends us a message to prepare-xwindow-id,
- tell the viewer to switch its output window.
- """
- self.sink = message.src
- self._switch_output_window()
-
def _switch_output_window(self):
Gdk.threads_enter()
# Prevent cases where target has no "window_xid" (yes, it happens!):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]