From c2532a48c2b39cd6121fa2811c662fb84bab8552 Mon Sep 17 00:00:00 2001 From: Henry Wilkes Date: Mon, 13 Jan 2020 13:08:24 +0000 Subject: [PATCH] pipeline: stop setting the track caps 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: --- ges/ges-internal.h | 1 - ges/ges-pipeline.c | 47 +--------------------------------------------- ges/ges-track.c | 1 + 3 files changed, 2 insertions(+), 47 deletions(-) diff --git a/ges/ges-internal.h b/ges/ges-internal.h index 85594d46e0..7884c8ed42 100644 --- a/ges/ges-internal.h +++ b/ges/ges-internal.h @@ -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); diff --git a/ges/ges-pipeline.c b/ges/ges-pipeline.c index 179f44c4b7..3e76dd1ed4 100644 --- a/ges/ges-pipeline.c +++ b/ges/ges-pipeline.c @@ -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"); diff --git a/ges/ges-track.c b/ges/ges-track.c index 6451b6dd58..8ac2868be8 100644 --- a/ges/ges-track.c +++ b/ges/ges-track.c @@ -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