From ac49f22530634db74f01963cdb995323160b3232 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 10 Jun 2015 17:54:20 +0200 Subject: [PATCH] pipeline: Handle rendering with disabled tracks Summary: The user might want to render only some media type of the timeline, for example he wants to only render the audio part of the timeline. It was failing as we were not connecting the track but were still trying to 'render' it. Depends on D153 Reviewers: Mathieu_Du Reviewed By: Mathieu_Du Differential Revision: http://phabricator.freedesktop.org/D154 --- ges/ges-pipeline.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ges/ges-pipeline.c b/ges/ges-pipeline.c index 3f081b6..9feefa0 100644 --- a/ges/ges-pipeline.c +++ b/ges/ges-pipeline.c @@ -69,6 +69,7 @@ struct _GESPipelinePrivate GMutex dyn_mutex; GList *chains; + GList *not_rendered_tracks; GstEncodingProfile *profile; }; @@ -560,6 +561,14 @@ ges_pipeline_change_state (GstElement * element, GstStateChange transition) } _link_tracks (self); break; + case GST_STATE_CHANGE_PAUSED_TO_READY: + { + GList *tmp; + + for (tmp = self->priv->not_rendered_tracks; tmp; tmp = tmp->next) + gst_element_set_locked_state (tmp->data, FALSE); + } + break; default: break; } @@ -816,7 +825,13 @@ _link_track (GESPipeline * self, GESTrack * track) gst_caps_unref (caps); if (G_UNLIKELY (sinkpad == NULL)) { - GST_ERROR_OBJECT (self, "Couldn't get a pad from encodebin !"); + GST_INFO_OBJECT (self, "Couldn't get a pad from encodebin !"); + gst_element_set_locked_state (GST_ELEMENT (track), TRUE); + + self->priv->not_rendered_tracks = + g_list_append (self->priv->not_rendered_tracks, track); + + goto error; } } @@ -843,10 +858,12 @@ _link_track (GESPipeline * self, GESTrack * track) error: { if (chain->tee) { + gst_element_set_state (chain->tee, GST_STATE_NULL); gst_bin_remove (GST_BIN_CAST (self), chain->tee); } if (sinkpad) gst_object_unref (sinkpad); + g_free (chain); } } -- 2.7.4