[pitivi] viewer: First commit to prove the cluttersink concept.



commit fea934d44b07dfc578d64c0faeae0a4bf7825666
Author: Mathieu Duponchelle <mduponchelle1 gmail com>
Date:   Wed Oct 2 04:07:27 2013 +0200

    viewer: First commit to prove the cluttersink concept.

 pitivi/application.py    |    1 +
 pitivi/check.py          |   10 ++++++++++
 pitivi/utils/pipeline.py |    3 +++
 pitivi/viewer.py         |   22 ++++++++++++----------
 4 files changed, 26 insertions(+), 10 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 81b1c58..787e9ef 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -35,6 +35,7 @@ Pitivi
 """
 import os
 import sys
+
 from gi.repository import GES
 from gi.repository import Gio
 from gi.repository import GLib
diff --git a/pitivi/check.py b/pitivi/check.py
index 895f7a3..3a7e53c 100644
--- a/pitivi/check.py
+++ b/pitivi/check.py
@@ -34,6 +34,16 @@ when called from application.py instead of bin/pitivi, if it has an impact.
 from sys import modules
 from gettext import gettext as _
 
+# SHENANIGANS
+from gi.repository import Gdk
+Gdk.init([])
+
+from gi.repository import GtkClutter
+GtkClutter.init([])
+
+from gi.repository import ClutterGst
+ClutterGst.init([])
+
 # This list is meant to be a complete list for packagers.
 # Unless otherwise noted, modules are accessed through gobject introspection
 HARD_DEPS = {
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 0b035ef..14aaee4 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -538,6 +538,9 @@ class Pipeline(GES.Pipeline, SimplePipeline):
         GES.Pipeline.__init__(self)
         SimplePipeline.__init__(self, self, self)
 
+        self._clutter_sink = Gst.ElementFactory.make("cluttersink", None)
+        self.preview_set_video_sink(self._clutter_sink)
+
         self._seeker = Seeker()
         self._seeker.connect("seek", self._seekCb)
         self._seeker.connect("seek-relative", self._seekRelativeCb)
diff --git a/pitivi/viewer.py b/pitivi/viewer.py
index 9a2baed..2945406 100644
--- a/pitivi/viewer.py
+++ b/pitivi/viewer.py
@@ -21,6 +21,8 @@
 
 import platform
 from gi.repository import Gtk
+from gi.repository import Clutter
+from gi.repository import GtkClutter
 from gi.repository import Gdk
 from gi.repository import Gst
 from gi.repository import GdkX11
@@ -137,7 +139,8 @@ class ViewerContainer(Gtk.VBox, Loggable):
         self.pipeline.connect("position", self._positionCb)
         self.pipeline.connect("duration-changed", self._durationChangedCb)
 
-        self.sink = self.pipeline.video_overlay
+        #self.sink = self.pipeline.video_overlay
+        self.sink = pipeline.video_overlay._clutter_sink
         self.target.sink = self.sink
         self._switch_output_window()
         self._setUiActive()
@@ -273,6 +276,7 @@ class ViewerContainer(Gtk.VBox, Loggable):
             width += 110
             height = int(width / self.internal_aframe.props.ratio)
             self.internal_aframe.set_size_request(width, height)
+            self.internal.texture.set_size(width, height)
 
         self.buttons = bbox
         self.buttons_container = boxalign
@@ -484,13 +488,7 @@ class ViewerContainer(Gtk.VBox, Loggable):
             return
 
         if self.target.get_realized():
-            if platform.system() == 'Windows':
-                xid = self.target.get_window().get_handle()
-            else:
-                xid = self.target.get_window().get_xid()
-
-            self.sink.set_window_handle(xid)
-            self.sink.expose()
+            self.sink.props.texture = self.target.texture
         else:
             # Show the widget and wait for the realized callback
             self.target.show()
@@ -809,7 +807,7 @@ class TransformationBox():
             self.transformation_properties.connectSpinButtonsToFlush()
 
 
-class ViewerWidget(Gtk.DrawingArea, Loggable):
+class ViewerWidget(GtkClutter.Embed, Loggable):
     """
     Widget for displaying properly GStreamer video sink
 
@@ -820,7 +818,11 @@ class ViewerWidget(Gtk.DrawingArea, Loggable):
     __gsignals__ = {}
 
     def __init__(self, settings=None):
-        Gtk.DrawingArea.__init__(self)
+        GtkClutter.Embed.__init__(self)
+        self._stage = self.get_stage()
+        self.texture = Clutter.Texture()
+        self.texture.set_sync_size(False)
+        self._stage.add_child(self.texture)
         Loggable.__init__(self)
         self.seeker = Seeker()
         self.settings = settings


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