[pitivi/sdk: 2/3] proxy: Do not set filters for track types we do not have




commit bfca79446b2758b7f61273a26275a5f1785c4f07
Author: Thibault Saunier <tsaunier igalia com>
Date:   Sun Dec 27 18:30:35 2020 -0300

    proxy: Do not set filters for track types we do not have
    
    Since 
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/commit/878a1960808d7c4d3c99f6dd3116476ae7e7aef5
    the filters are added to the bin right from the start, but we have sinks
    in our filters, which is a weird use case which would be hard to handle
    at the GStreamer level. Avoid useless filters in our transcoding pipeline
    and avoid proxy creation timeouting in our tests.

 pitivi/utils/proxy.py | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/pitivi/utils/proxy.py b/pitivi/utils/proxy.py
index bedf006c7..76e77d791 100644
--- a/pitivi/utils/proxy.py
+++ b/pitivi/utils/proxy.py
@@ -457,8 +457,11 @@ class ProxyManager(GObject.Object, Loggable):
                 self.__create_transcoder(asset)
                 return
         else:
-            transcoder.props.pipeline.props.video_filter.finalize()
-            transcoder.props.pipeline.props.audio_filter.finalize()
+            if transcoder.props.pipeline.props.video_filter:
+                transcoder.props.pipeline.props.video_filter.finalize()
+
+            if transcoder.props.pipeline.props.audio_filter:
+                transcoder.props.pipeline.props.audio_filter.finalize()
 
             del transcoder
 
@@ -676,15 +679,17 @@ class ProxyManager(GObject.Object, Loggable):
         else:
             transcoder.props.position_update_interval = 1000
 
-        thumbnailbin = Gst.ElementFactory.make("teedthumbnailbin")
-        thumbnailbin.props.uri = asset.get_id()
-
-        waveformbin = Gst.ElementFactory.make("waveformbin")
-        waveformbin.props.uri = asset.get_id()
-        waveformbin.props.duration = asset.get_duration()
-
-        transcoder.props.pipeline.props.video_filter = thumbnailbin
-        transcoder.props.pipeline.props.audio_filter = waveformbin
+        info = asset.get_info()
+        if info.get_video_streams():
+            thumbnailbin = Gst.ElementFactory.make("teedthumbnailbin")
+            thumbnailbin.props.uri = asset.get_id()
+            transcoder.props.pipeline.props.video_filter = thumbnailbin
+
+        if info.get_audio_streams():
+            waveformbin = Gst.ElementFactory.make("waveformbin")
+            waveformbin.props.uri = asset.get_id()
+            waveformbin.props.duration = asset.get_duration()
+            transcoder.props.pipeline.props.audio_filter = waveformbin
 
         transcoder.set_cpu_usage(self.app.settings.max_cpu_usage)
         transcoder.connect("position-updated",


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