[pitivi] pitivi: Start using glimagesink as default sink
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] pitivi: Start using glimagesink as default sink
- Date: Wed, 24 Sep 2014 17:04:25 +0000 (UTC)
commit ddefc36f4ebad8a87190fba091a525943e93b896
Author: Mathieu Duponchelle <mathieu duponchelle opencreed com>
Date: Tue Sep 9 21:19:03 2014 +0200
pitivi: Start using glimagesink as default sink
pitivi/utils/pipeline.py | 18 ++++++------------
pitivi/viewer.py | 24 +++++++++++++-----------
2 files changed, 19 insertions(+), 23 deletions(-)
---
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index e6c6cdb..93255f9 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -176,17 +176,11 @@ class SimplePipeline(Signallable, Loggable):
# Create a cluttersink element used for display. Subclasses must connect
# it to self._pipeline themselves
- self._clutter_sink = Gst.ElementFactory.make("cluttersink", None)
+ self._opengl_sink = Gst.ElementFactory.make("glimagesink", None)
if isinstance(pipeline, GES.Pipeline):
- self._pipeline.preview_set_video_sink(self._clutter_sink)
+ self._pipeline.preview_set_video_sink(self._opengl_sink)
else:
- self._pipeline.set_property("video_sink", self._clutter_sink)
-
- def connectWithViewer(self, viewer):
- """
- Connect the specified ViewerWidget so this pipeline can be displayed.
- """
- self._clutter_sink.props.texture = viewer.texture
+ self._pipeline.set_property("video_sink", self._opengl_sink)
def release(self):
"""
@@ -276,7 +270,7 @@ class SimplePipeline(Signallable, Loggable):
else:
self.play()
- #{ Position and Seeking methods
+ # { Position and Seeking methods
def getPosition(self, format=Gst.Format.TIME):
"""
@@ -420,8 +414,8 @@ class SimplePipeline(Signallable, Loggable):
seekvalue = max(0, min(self.getPosition() + time, self.getDuration()))
self.simple_seek(seekvalue)
- #}
- ## Private methods
+ # }
+ # Private methods
def _busMessageCb(self, unused_bus, message):
if message.type == Gst.MessageType.EOS:
diff --git a/pitivi/viewer.py b/pitivi/viewer.py
index a44a1a6..dd16d0d 100644
--- a/pitivi/viewer.py
+++ b/pitivi/viewer.py
@@ -39,6 +39,8 @@ from pitivi.utils.pipeline import AssetPipeline, Seeker
from pitivi.utils.ui import SPACING, hex_to_rgb
from pitivi.utils.widgets import TimeWidget
+import platform
+
GlobalSettings.addConfigSection("viewer")
GlobalSettings.addConfigOption("viewerDocked", section="viewer",
key="docked",
@@ -130,6 +132,8 @@ class ViewerContainer(Gtk.VBox, Loggable):
self.pipeline.connect("position", self._positionCb)
self.pipeline.connect("duration-changed", self._durationChangedCb)
+ self.sink = pipeline._opengl_sink
+
self._switch_output_window()
self._setUiActive()
@@ -461,7 +465,13 @@ class ViewerContainer(Gtk.VBox, Loggable):
if self.target.get_realized():
self.debug("Connecting the pipeline to the viewer's texture")
- self.pipeline.connectWithViewer(self.target)
+ if platform.system() == 'Windows':
+ xid = self.target.drawing_area.get_window().get_handle()
+ else:
+ xid = self.target.drawing_area.get_window().get_xid()
+
+ self.sink.set_window_handle(xid)
+ self.sink.expose()
else:
# Show the widget and wait for the realized callback
self.log("Target is not realized, showing the widget")
@@ -798,7 +808,7 @@ class ViewerWidget(Gtk.AspectFrame, Loggable):
ratio=4.0 / 3.0, obey_child=False)
Loggable.__init__(self)
- self.drawing_area = GtkClutter.Embed()
+ self.drawing_area = Gtk.DrawingArea()
self.drawing_area.set_double_buffered(False)
# We keep the ViewerWidget hidden initially, or the desktop wallpaper
# would show through the non-double-buffered widget!
@@ -806,14 +816,6 @@ class ViewerWidget(Gtk.AspectFrame, Loggable):
self.drawing_area.connect("realize", realizedCb, self)
self.add(self.drawing_area)
- layout_manager = Clutter.BinLayout(x_align=Clutter.BinAlignment.FILL,
y_align=Clutter.BinAlignment.FILL)
- self.drawing_area.get_stage().set_layout_manager(layout_manager)
- self.texture = Clutter.Texture()
- # This is a trick to make the viewer appear darker at the start.
- self.texture.set_from_rgb_data(data=[0] * 3, has_alpha=False,
- width=1, height=1, rowstride=3, bpp=3,
- flags=Clutter.TextureFlags.NONE)
- self.drawing_area.get_stage().add_child(self.texture)
self.drawing_area.show()
self.seeker = Seeker()
@@ -828,7 +830,7 @@ class ViewerWidget(Gtk.AspectFrame, Loggable):
self.transformation_properties = None
# FIXME PyGi Styling with Gtk3
# for state in range(Gtk.StateType.INSENSITIVE + 1):
- # self.modify_bg(state, self.style.black)
+ # self.modify_bg(state, self.style.black)
def setDisplayAspectRatio(self, ratio):
self.set_property("ratio", float(ratio))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]