From 448091583ab1394874a43bafe4bb94f297d737b4 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 14 Aug 2019 15:48:46 -0400 Subject: [PATCH] structured-interface: Properly error out when a child property could not be set --- ges/ges-project.c | 2 +- ges/ges-structured-interface.c | 26 ++++++++++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ges/ges-project.c b/ges/ges-project.c index 6610a5f2f4..35f0efb798 100644 --- a/ges/ges-project.c +++ b/ges/ges-project.c @@ -47,7 +47,7 @@ * ## Subprojects * * In order to add a subproject, the only thing to do is to add the subproject - * with to the main project: + * to the main project: * * ``` c * ges_project_add_asset (project, GES_ASSET (subproject)); diff --git a/ges/ges-structured-interface.c b/ges/ges-structured-interface.c index 36d9c57a38..b35977442e 100644 --- a/ges/ges-structured-interface.c +++ b/ges/ges-structured-interface.c @@ -674,11 +674,29 @@ _ges_set_child_property_from_struct (GESTimeline * timeline, value = gst_structure_get_value (structure, "value"); - GST_DEBUG ("%s Setting %s property to %p", - element->name, property_name, value); + g_print ("%s Setting %s property to %s\n", element->name, property_name, + gst_value_serialize (value)); - ges_timeline_element_set_child_property (element, property_name, - (GValue *) value); + if (!ges_timeline_element_set_child_property (element, property_name, + (GValue *) value)) { + guint n_specs, i; + GParamSpec **specs = + ges_timeline_element_list_children_properties (element, &n_specs); + GString *errstr = g_string_new (NULL); + + g_string_append_printf (errstr, + "\n Could not set property `%s` on `%s`, valid properties:\n", + property_name, GES_TIMELINE_ELEMENT_NAME (element)); + + for (i = 0; i < n_specs; i++) + g_string_append_printf (errstr, " - %s\n", specs[i]->name); + g_free (specs); + + *error = g_error_new_literal (GES_ERROR, 0, errstr->str); + g_string_free (errstr, TRUE); + + return FALSE; + } return _ges_save_timeline_if_needed (timeline, structure, error); }