gessrc: Remember the URI set by user

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4882>
This commit is contained in:
Thibault Saunier 2023-06-15 17:38:30 -04:00 committed by GStreamer Marge Bot
parent 50393a809d
commit a8b3e6122f

View file

@ -57,6 +57,8 @@ G_DECLARE_FINAL_TYPE (GESSrc, ges_src, GES, SRC, GESBaseBin);
struct _GESSrc struct _GESSrc
{ {
GESBaseBin parent; GESBaseBin parent;
gchar *uri;
}; };
#define GES_SRC(obj) ((GESSrc*) obj) #define GES_SRC(obj) ((GESSrc*) obj)
@ -82,6 +84,16 @@ ges_src_uri_get_uri (GstURIHandler * handler)
GESSrc *self = GES_SRC (handler); GESSrc *self = GES_SRC (handler);
GESTimeline *timeline = ges_base_bin_get_timeline (GES_BASE_BIN (self)); GESTimeline *timeline = ges_base_bin_get_timeline (GES_BASE_BIN (self));
GST_OBJECT_LOCK (self);
if (self->uri) {
gchar *uri = g_strdup (self->uri);
GST_OBJECT_UNLOCK (self);
return uri;
}
GST_OBJECT_UNLOCK (self);
return ges_command_line_formatter_get_timeline_uri (timeline); return ges_command_line_formatter_get_timeline_uri (timeline);
} }
@ -90,6 +102,7 @@ ges_src_uri_set_uri (GstURIHandler * handler, const gchar * uristr,
GError ** error) GError ** error)
{ {
gboolean res = FALSE; gboolean res = FALSE;
GESSrc *self = GES_SRC (handler);
GstUri *uri = gst_uri_from_string (uristr); GstUri *uri = gst_uri_from_string (uristr);
GESProject *project = NULL; GESProject *project = NULL;
GESTimeline *timeline = NULL; GESTimeline *timeline = NULL;
@ -110,6 +123,11 @@ done:
gst_uri_unref (uri); gst_uri_unref (uri);
gst_clear_object (&project); gst_clear_object (&project);
GST_OBJECT_LOCK (handler);
g_free (self->uri);
self->uri = g_strdup (uristr);
GST_OBJECT_UNLOCK (handler);
return res; return res;
} }