[pitivi] pipeline: Remove unneeded fields
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] pipeline: Remove unneeded fields
- Date: Fri, 25 Jan 2019 21:36:26 +0000 (UTC)
commit fa01d1e6bf00c7fc32826587cef9d5bff74269cd
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Mon Jan 14 23:15:16 2019 +0100
pipeline: Remove unneeded fields
pitivi/mediafilespreviewer.py | 3 ++-
pitivi/utils/pipeline.py | 38 ++++++++++++++++++++++----------------
pitivi/viewer/viewer.py | 4 ++--
3 files changed, 26 insertions(+), 19 deletions(-)
---
diff --git a/pitivi/mediafilespreviewer.py b/pitivi/mediafilespreviewer.py
index 74ee274c..a2f266df 100644
--- a/pitivi/mediafilespreviewer.py
+++ b/pitivi/mediafilespreviewer.py
@@ -102,7 +102,8 @@ class PreviewWidget(Gtk.Grid, Loggable):
# Gui elements:
# Drawing area for video output
- self.preview_video = ViewerWidget(self.player.sink_widget)
+ unused_sink, sink_widget = self.player.create_sink()
+ self.preview_video = ViewerWidget(sink_widget)
self.preview_video.props.hexpand = minimal
self.preview_video.props.vexpand = minimal
self.preview_video.show_all()
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index fe008139..44757de0 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -101,21 +101,26 @@ class SimplePipeline(GObject.Object, Loggable):
self._timeout_async_id = 0
self._force_position_listener = False
- self.video_sink = None
- self.sink_widget = None
-
def create_sink(self):
- sink = Gst.ElementFactory.make(videosink_factory.get_name(), None)
- self.sink_widget = sink.props.widget
+ """Creates a video sink and a widget for displaying it.
+
+ Returns:
+ (Gst.Element, Gtk.Widget): An element of type Gst.ElementFlags.SINK
+ and a widget connected to it.
+ """
+ factory_name = videosink_factory.get_name()
+ sink = Gst.ElementFactory.make(factory_name, None)
+ widget = sink.props.widget
- if videosink_factory.get_name() == "gtksink":
+ if factory_name == "gtksink":
self.info("Using gtksink")
- self.video_sink = sink
+ video_sink = sink
else:
self.info("Using glsinkbin around %s", videosink_factory.get_name())
- sinkbin = Gst.ElementFactory.make("glsinkbin", None)
- sinkbin.props.sink = sink
- self.video_sink = sinkbin
+ video_sink = Gst.ElementFactory.make("glsinkbin", None)
+ video_sink.props.sink = sink
+
+ return video_sink, widget
def setForcePositionListener(self, force):
self._force_position_listener = force
@@ -507,15 +512,15 @@ class AssetPipeline(SimplePipeline):
ges_pipeline = Gst.ElementFactory.make("playbin", name)
SimplePipeline.__init__(self, ges_pipeline)
- self.create_sink()
-
self.clip = clip
if self.clip:
self.setClipUri(self.clip.props.uri)
def create_sink(self):
- SimplePipeline.create_sink(self)
- self._pipeline.set_property("video_sink", self.video_sink)
+ video_sink, sink_widget = SimplePipeline.create_sink(self)
+ self._pipeline.set_property("video_sink", video_sink)
+
+ return video_sink, sink_widget
def setClipUri(self, uri):
self._pipeline.set_property("uri", uri)
@@ -546,8 +551,9 @@ class Pipeline(GES.Pipeline, SimplePipeline):
self.props.audio_filter = watchdog
def create_sink(self):
- SimplePipeline.create_sink(self)
- self._pipeline.preview_set_video_sink(self.video_sink)
+ video_sink, sink_widget = SimplePipeline.create_sink(self)
+ self._pipeline.preview_set_video_sink(video_sink)
+ return video_sink, sink_widget
def set_mode(self, mode):
self._next_seek = None
diff --git a/pitivi/viewer/viewer.py b/pitivi/viewer/viewer.py
index 00c5b923..7856169c 100644
--- a/pitivi/viewer/viewer.py
+++ b/pitivi/viewer/viewer.py
@@ -135,9 +135,9 @@ class ViewerContainer(Gtk.Box, Loggable):
self.pipeline.pause()
def __createNewViewer(self):
- self.pipeline.create_sink()
+ _, sink_widget = self.pipeline.create_sink()
- self.overlay_stack = OverlayStack(self.app, self.pipeline.sink_widget)
+ self.overlay_stack = OverlayStack(self.app, sink_widget)
self.target = ViewerWidget(self.overlay_stack)
if self.docked:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]