From c940333d18c731aed58cff2a2710772725bb3471 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sat, 11 Apr 2020 11:40:06 -0400 Subject: [PATCH] ges: Place imagefreeze at right place Negotiation fails when having the imagefreeze after videorate and frame positioning won't happen after seeks if we do not put it before the postioner --- ges/ges-image-source.c | 2 +- ges/ges-video-uri-source.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ges/ges-image-source.c b/ges/ges-image-source.c index 49661b6021..8b7ee455dc 100644 --- a/ges/ges-image-source.c +++ b/ges/ges-image-source.c @@ -97,7 +97,7 @@ ges_image_source_dispose (GObject * object) } static void -pad_added_cb (GstElement * timeline, GstPad * pad, GstElement * scale) +pad_added_cb (GstElement * source, GstPad * pad, GstElement * scale) { GstPad *sinkpad; GstPadLinkReturn ret; diff --git a/ges/ges-video-uri-source.c b/ges/ges-video-uri-source.c index f20fe4fd71..dea68f9825 100644 --- a/ges/ges-video-uri-source.c +++ b/ges/ges-video-uri-source.c @@ -216,6 +216,13 @@ G_DEFINE_TYPE_WITH_CODE (GESVideoUriSource, ges_video_uri_source, G_IMPLEMENT_INTERFACE (GES_TYPE_EXTRACTABLE, ges_extractable_interface_init)); +static gboolean +_find_positioner (GstElement * a, GstElement * b) +{ + return !g_strcmp0 (GST_OBJECT_NAME (gst_element_get_factory (a)), + "framepositioner"); +} + /* GObject VMethods */ static gboolean @@ -229,8 +236,16 @@ ges_video_uri_source_create_filters (GESVideoSource * source, ->ABI.abi.create_filters (source, elements, needs_converters)) return FALSE; - if (ges_uri_source_asset_is_image (GES_URI_SOURCE_ASSET (asset))) - g_ptr_array_add (elements, gst_element_factory_make ("imagefreeze", NULL)); + if (ges_uri_source_asset_is_image (GES_URI_SOURCE_ASSET (asset))) { + guint i; + + g_ptr_array_find_with_equal_func (elements, NULL, + (GEqualFunc) _find_positioner, &i); + /* Adding the imagefreeze right before the positionner so positioning can happen + * properly */ + g_ptr_array_insert (elements, i, + gst_element_factory_make ("imagefreeze", NULL)); + } return TRUE; }