pipeline: Be smarter about how we match encoding profiles and tracks

This commit is contained in:
Thibault Saunier 2019-10-17 16:19:11 +02:00 committed by Thibault Saunier
parent b9307eaac1
commit 5234885c8a

View file

@ -1041,6 +1041,7 @@ ges_pipeline_set_render_settings (GESPipeline * pipeline,
{ {
GError *err = NULL; GError *err = NULL;
GstEncodingProfile *set_profile; GstEncodingProfile *set_profile;
guint n_videotracks = 0, n_audiotracks = 0;
g_return_val_if_fail (GES_IS_PIPELINE (pipeline), FALSE); g_return_val_if_fail (GES_IS_PIPELINE (pipeline), FALSE);
CHECK_THREAD (pipeline); CHECK_THREAD (pipeline);
@ -1056,21 +1057,27 @@ ges_pipeline_set_render_settings (GESPipeline * pipeline,
GList *tmptrack, *tracks = GList *tmptrack, *tracks =
ges_timeline_get_tracks (pipeline->priv->timeline); ges_timeline_get_tracks (pipeline->priv->timeline);
for (; tmpprofiles; tmpprofiles = tmpprofiles->next) { for (tmptrack = tracks; tmptrack; tmptrack = tmptrack->next) {
for (tmptrack = tracks; tmptrack; tmptrack = tmptrack->next) { if (GES_IS_AUDIO_TRACK (tmptrack->data))
if ((GST_IS_ENCODING_AUDIO_PROFILE (tmpprofiles->data) && n_audiotracks++;
GES_IS_AUDIO_TRACK (tmptrack->data)) || else if (GES_IS_VIDEO_TRACK (tmptrack->data))
(GST_IS_ENCODING_VIDEO_PROFILE (tmpprofiles->data) && n_videotracks++;
GES_IS_VIDEO_TRACK (tmptrack->data))) {
GST_DEBUG_OBJECT (pipeline, "Setting presence to 1!");
gst_encoding_profile_set_presence (tmpprofiles->data, 1);
gst_encoding_profile_set_allow_dynamic_output (tmpprofiles->data,
FALSE);
}
}
} }
g_list_free_full (tracks, gst_object_unref); g_list_free_full (tracks, gst_object_unref);
for (; tmpprofiles; tmpprofiles = tmpprofiles->next) {
if ((GST_IS_ENCODING_AUDIO_PROFILE (tmpprofiles->data) && n_audiotracks))
n_audiotracks--;
else if ((GST_IS_ENCODING_VIDEO_PROFILE (tmpprofiles->data)
&& n_videotracks))
n_videotracks--;
else
continue;
GST_DEBUG_OBJECT (pipeline, "Setting presence to 1!");
gst_encoding_profile_set_presence (tmpprofiles->data, 1);
gst_encoding_profile_set_allow_dynamic_output (tmpprofiles->data, FALSE);
}
} }
/* Clear previous URI sink if it existed */ /* Clear previous URI sink if it existed */