[rygel] engine-gst: Restore potential transmuxing capabilities



commit 1dc3275a43e8467ee77128d44f5169d9fcfacce5
Author: Jens Georg <mail jensge org>
Date:   Fri May 1 13:47:42 2020 +0200

    engine-gst: Restore potential transmuxing capabilities

 .../gstreamer/rygel-gst-transcoder.vala            | 28 ++++++++++++++++------
 src/media-engines/gstreamer/rygel-gst-utils.vala   |  2 +-
 2 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/src/media-engines/gstreamer/rygel-gst-transcoder.vala 
b/src/media-engines/gstreamer/rygel-gst-transcoder.vala
index 8f999374..2747e9fd 100644
--- a/src/media-engines/gstreamer/rygel-gst-transcoder.vala
+++ b/src/media-engines/gstreamer/rygel-gst-transcoder.vala
@@ -149,6 +149,7 @@ internal abstract class Rygel.GstTranscoder : GLib.Object {
 
         orig_source.src.link (decoder);
 
+        decoder.autoplug_continue.connect (this.on_decode_autoplug_continue);
         decoder.pad_added.connect (this.on_decoder_pad_added);
         decoder.no_more_pads.connect (this.on_no_more_pads);
 
@@ -171,20 +172,33 @@ internal abstract class Rygel.GstTranscoder : GLib.Object {
     protected abstract EncodingProfile get_encoding_profile
                                         (MediaFileItem item);
 
-    private void on_decoder_pad_added (Element decodebin, Pad new_pad) {
-        Gst.Pad sinkpad;
-
-        sinkpad = this.encoder.get_compatible_pad (new_pad, null);
+    private Gst.Pad? get_compatible_sink_pad (Pad pad, Caps caps) {
+        var sinkpad = this.encoder.get_compatible_pad (pad, null);
 
         if (sinkpad == null) {
-            var caps = new_pad.query_caps (null);
             Signal.emit_by_name (this.encoder, "request-pad", caps, out sinkpad);
         }
 
         if (sinkpad == null) {
-            debug ("No compatible encodebin pad found for pad '%s', ignoring..",
-                   new_pad.name);
+            debug ("No compatible encodebin pad found for pad '%s', ignoring...",
+                   pad.name);
+        }
+
+        return sinkpad;
+    }
 
+    private bool on_decode_autoplug_continue (Element decodebin,
+                                              Pad     new_pad,
+                                              Caps    caps) {
+        return this.get_compatible_sink_pad (new_pad, caps) == null;
+    }
+
+    private void on_decoder_pad_added (Element decodebin, Pad new_pad) {
+        var sinkpad = this.get_compatible_sink_pad (new_pad, new_pad.query_caps (null));
+
+        if (sinkpad == null) {
+            debug ("No compatible encodebin pad found for pad '%s', ignoring...",
+                   new_pad.name);
             return;
         }
 
diff --git a/src/media-engines/gstreamer/rygel-gst-utils.vala 
b/src/media-engines/gstreamer/rygel-gst-utils.vala
index a1f7b4c2..a9dcf7f2 100644
--- a/src/media-engines/gstreamer/rygel-gst-utils.vala
+++ b/src/media-engines/gstreamer/rygel-gst-utils.vala
@@ -85,7 +85,7 @@ internal abstract class Rygel.GstUtils {
             }
 
             if (src.get_class ().find_property ("tcp-timeout") != null) {
-   // For rtspsrc since some RTSP sources takes a while to start
+                // For rtspsrc since some RTSP sources takes a while to start
                 // transmitting
                 src.tcp_timeout = (int64) 60000000;
             }


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