pipeline: stop setting the track caps
authorHenry Wilkes <hwilkes@igalia.com>
Mon, 13 Jan 2020 13:08:24 +0000 (13:08 +0000)
committerThibault Saunier <tsaunier@igalia.com>
Thu, 30 Jul 2020 22:44:13 +0000 (18:44 -0400)
Stop setting the track 'caps' property. The previous code could
overwrite a users own setting of the caps for video and audio caps.
Moreover, the 'caps' property is listed as construct only, and users
will likely expect it to stay the same after a track has been added to a
timeline.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/198>

ges/ges-internal.h
ges/ges-pipeline.c
ges/ges-track.c

index 85594d46e038a9cfee2e999b113a8801c54fcb58..7884c8ed425f609829855de38853fb4fba836f44 100644 (file)
@@ -475,7 +475,6 @@ G_GNUC_INTERNAL GstElement* ges_source_create_topbin  (GESSource *source,
                                                        const gchar* bin_name,
                                                        GstElement* sub_element,
                                                        GPtrArray* elements);
-G_GNUC_INTERNAL void ges_track_set_caps                (GESTrack* track, const GstCaps* caps);
 G_GNUC_INTERNAL GstElement * ges_track_get_composition (GESTrack *track);
 
 
index 179f44c4b702fcc104110eabba6c1a2e3016e1a0..3e76dd1ed407278e4fcd7c64ffffb1d3b6200da1 100644 (file)
@@ -442,37 +442,8 @@ static gboolean
 _track_is_compatible_with_profile (GESPipeline * self, GESTrack * track,
     GstEncodingProfile * prof)
 {
-  if (TRACK_COMPATIBLE_PROFILE (track->type, prof)) {
-    if (self->priv->mode == GES_PIPELINE_MODE_SMART_RENDER) {
-      GstCaps *ocaps, *rcaps;
-
-      GST_DEBUG ("Smart Render mode, setting input caps");
-      ocaps = gst_encoding_profile_get_input_caps (prof);
-      ocaps = gst_caps_make_writable (ocaps);
-      if (track->type == GES_TRACK_TYPE_AUDIO)
-        rcaps = gst_caps_new_empty_simple ("audio/x-raw");
-      else
-        rcaps = gst_caps_new_empty_simple ("video/x-raw");
-      gst_caps_append (ocaps, rcaps);
-      ges_track_set_caps (track, ocaps);
-      gst_caps_unref (ocaps);
-    } else {
-      GstCaps *caps = NULL;
-
-      /* Raw preview or rendering mode */
-      if (track->type == GES_TRACK_TYPE_VIDEO)
-        caps = gst_caps_new_empty_simple ("video/x-raw");
-      else if (track->type == GES_TRACK_TYPE_AUDIO)
-        caps = gst_caps_new_empty_simple ("audio/x-raw");
-
-      if (caps) {
-        ges_track_set_caps (track, caps);
-        gst_caps_unref (caps);
-      }
-    }
-
+  if (TRACK_COMPATIBLE_PROFILE (track->type, prof))
     return TRUE;
-  }
 
   return FALSE;
 }
@@ -1253,22 +1224,6 @@ ges_pipeline_set_mode (GESPipeline * pipeline, GESPipelineFlags mode)
   if ((pipeline->priv->mode &
           (GES_PIPELINE_MODE_RENDER | GES_PIPELINE_MODE_SMART_RENDER)) &&
       !(mode & (GES_PIPELINE_MODE_RENDER | GES_PIPELINE_MODE_SMART_RENDER))) {
-    GList *tmp;
-    GstCaps *caps;
-
-    for (tmp = pipeline->priv->timeline->tracks; tmp; tmp = tmp->next) {
-      GESTrackType type = GES_TRACK (tmp->data)->type;
-
-      if (type == GES_TRACK_TYPE_AUDIO)
-        caps = gst_caps_new_empty_simple ("audio/x-raw");
-      else if (type == GES_TRACK_TYPE_VIDEO)
-        caps = gst_caps_new_empty_simple ("video/x-raw");
-      else
-        continue;
-
-      ges_track_set_caps (GES_TRACK (tmp->data), caps);
-      gst_caps_unref (caps);
-    }
 
     /* Disable render bin */
     GST_DEBUG ("Disabling rendering bin");
index 6451b6dd58b19946d656ae40e587624a37653e85..8ac2868be887576066582df3ff132e0651f6f075 100644 (file)
@@ -129,6 +129,7 @@ G_DEFINE_TYPE_WITH_CODE (GESTrack, ges_track, GST_TYPE_BIN,
 
 static void composition_duration_cb (GstElement * composition, GParamSpec * arg
     G_GNUC_UNUSED, GESTrack * obj);
+static void ges_track_set_caps (GESTrack * track, const GstCaps * caps);
 
 /* Private methods/functions/callbacks */
 static void