[pitivi] Port window handle to the GStreamer 1.0 API



commit 13687b37ae8ea51f7c34c5dc7b9ce52ae803b715
Author: Thibault Saunier <thibault saunier collabora com>
Date:   Fri Jul 27 16:28:19 2012 -0400

    Port window handle to the GStreamer 1.0 API

 pitivi/mediafilespreviewer.py |    2 +-
 pitivi/utils/pipeline.py      |   13 ++++++-------
 pitivi/viewer.py              |    8 ++++----
 3 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/pitivi/mediafilespreviewer.py b/pitivi/mediafilespreviewer.py
index 3731540..790a411 100644
--- a/pitivi/mediafilespreviewer.py
+++ b/pitivi/mediafilespreviewer.py
@@ -376,7 +376,7 @@ class PreviewWidget(gtk.VBox, Loggable):
 
     def _sync_message_cb(self, bus, mess):
         if mess.type == gst.MESSAGE_ELEMENT:
-            if mess.has_name('prepare-xwindow-id'):
+            if mess.has_name('prepare-window-handle'):
                 sink = mess.src
 
                 # We need to set force-aspect-ratio and handle-expose properties
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 99f7182..b46ffa3 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -148,7 +148,7 @@ class SimplePipeline(Loggable, Signallable):
         "duration-changed": ["duration"],
         "eos": [],
         "error": ["message", "details"],
-        "xid-message": ["message"]}
+        "window-handle-message": ["message"]}
 
     def __init__(self, pipeline):
         Loggable.__init__(self)
@@ -157,10 +157,10 @@ class SimplePipeline(Loggable, Signallable):
         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 xid
+        # 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 xid-message is handled async (to avoid deadlocks).
+        # 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
@@ -435,10 +435,9 @@ class SimplePipeline(Loggable, Signallable):
 
     def _busSyncMessageHandler(self, unused_bus, message, unused_user_data):
         if message.type == gst.MESSAGE_ELEMENT:
-            name = message.structure.get_name()
-            if name == 'prepare-xwindow-id':
+            if message.has_name('prepare-window-handle'):
                 # handle element message synchronously
-                self.emit('xid-message', message)
+                self.emit('window-handle-message', message)
                 #Remove the bus sync handler avoiding deadlocks
                 self._bus.set_sync_handler(None)
                 self._has_sync_bus_handler = False
@@ -468,7 +467,7 @@ class Pipeline(ges.TimelinePipeline, SimplePipeline):
                         ()),
         "error": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
                         (gobject.TYPE_STRING, gobject.TYPE_STRING)),
-        "xid-message": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
+        "window-handle-message": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
                         (gobject.TYPE_PYOBJECT,))}
 
     def __init__(self, pipeline=None):
diff --git a/pitivi/viewer.py b/pitivi/viewer.py
index b88008b..cc8f27b 100644
--- a/pitivi/viewer.py
+++ b/pitivi/viewer.py
@@ -133,7 +133,7 @@ class PitiviViewer(gtk.VBox, Loggable):
 
             self.pipeline.connect("state-changed", self._pipelineStateChangedCb)
             self.pipeline.connect("position", self._positionCb)
-            self.pipeline.connect("xid-message", self.xidMessageCb)
+            self.pipeline.connect("window-handle-message", self._windowHandleMessageCb)
             self.pipeline.connect("duration-changed", self._durationChangedCb)
 
         self._setUiActive()
@@ -145,7 +145,7 @@ class PitiviViewer(gtk.VBox, Loggable):
             return
 
         self.pipeline.disconnect_by_func(self._pipelineStateChangedCb)
-        self.pipeline.disconnect_by_func(self.xidMessageCb)
+        self.pipeline.disconnect_by_func(self._windowHandleMessageCb)
         self.pipeline.disconnect_by_func(self._positionCb)
         self.pipeline.disconnect_by_func(self._durationChangedCb)
 
@@ -440,7 +440,7 @@ class PitiviViewer(gtk.VBox, Loggable):
             self.system.uninhibitScreensaver(self.INHIBIT_REASON)
         self.internal._currentStateCb(self.pipeline, state)
 
-    def xidMessageCb(self, unused_pipeline, message):
+    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.
@@ -450,7 +450,7 @@ class PitiviViewer(gtk.VBox, Loggable):
 
     def _switch_output_window(self):
         gtk.gdk.threads_enter()
-        self.sink.set_xwindow_id(self.target.window_xid)
+        self.sink.set_window_handle(self.target.window_xid)
         self.sink.expose()
         gtk.gdk.threads_leave()
 



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