summaryrefslogtreecommitdiff
path: root/subprojects/gst-editing-services/ges/ges-structured-interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/gst-editing-services/ges/ges-structured-interface.c')
-rw-r--r--subprojects/gst-editing-services/ges/ges-structured-interface.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/subprojects/gst-editing-services/ges/ges-structured-interface.c b/subprojects/gst-editing-services/ges/ges-structured-interface.c
index 2aff457782..b3576aadc7 100644
--- a/subprojects/gst-editing-services/ges/ges-structured-interface.c
+++ b/subprojects/gst-editing-services/ges/ges-structured-interface.c
@@ -156,18 +156,17 @@ enum_from_str (GType type, const gchar * str_enum, guint * enum_value)
}
static gboolean
-_check_field (GQuark field_id, const GValue * value, FieldsError * fields_error)
+_check_field (const GstIdStr * fieldname, const GValue * value,
+ FieldsError * fields_error)
{
- guint i;
- const gchar *field = g_quark_to_string (field_id);
+ const gchar *field = gst_id_str_as_str (fieldname);
- for (i = 0; fields_error->fields[i]; i++) {
- if (g_strcmp0 (fields_error->fields[i], field) == 0) {
-
- return TRUE;
- }
- }
+ if (g_strv_contains (fields_error->fields, gst_id_str_as_str (fieldname)))
+ return TRUE;
+ // The pointers to the field names are only valid for as long as the structure
+ // is, but they're only used in the direct caller while the structure lives
+ // longer.
fields_error->invalid_fields =
g_list_append (fields_error->invalid_fields, (gpointer) field);
@@ -178,8 +177,8 @@ static gboolean
_check_fields (GstStructure * structure, FieldsError fields_error,
GError ** error)
{
- gst_structure_foreach (structure,
- (GstStructureForeachFunc) _check_field, &fields_error);
+ gst_structure_foreach_id_str (structure,
+ (GstStructureForeachIdStrFunc) _check_field, &fields_error);
if (fields_error.invalid_fields) {
GList *tmp;
@@ -199,6 +198,7 @@ _check_fields (GstStructure * structure, FieldsError fields_error,
g_list_free (fields_error.invalid_fields);
g_string_free (msg, TRUE);
+ g_list_free (fields_error.invalid_fields);
return FALSE;
}
@@ -351,24 +351,21 @@ value_to_double (const GValue * v)
}
static gboolean
-un_set_keyframes_foreach (GQuark field_id, const GValue * value,
+un_set_keyframes_foreach (const GstIdStr * fieldname, const GValue * value,
SetKeyframesData * d)
{
GError **error = &d->error;
gchar *tmp;
- gint i;
const gchar *valid_fields[] = {
"element-name", "property-name", "value", "timestamp", "project-uri",
"binding-type", "source-type", "interpolation-mode", "interpolation-mode",
NULL
};
- const gchar *field = g_quark_to_string (field_id);
+ const gchar *field = gst_id_str_as_str (fieldname);
gdouble ts;
- for (i = 0; valid_fields[i]; i++) {
- if (g_quark_from_string (valid_fields[i]) == field_id)
- return TRUE;
- }
+ if (g_strv_contains (valid_fields, gst_id_str_as_str (fieldname)))
+ return TRUE;
errno = 0;
ts = g_strtod (field, &tmp);
@@ -456,8 +453,8 @@ _ges_add_remove_keyframe_from_struct (GESTimeline * timeline,
SetKeyframesData d = {
source, structure, NULL, property_name, TRUE,
};
- gst_structure_foreach (structure,
- (GstStructureForeachFunc) un_set_keyframes_foreach, &d);
+ gst_structure_foreach_id_str (structure,
+ (GstStructureForeachIdStrFunc) un_set_keyframes_foreach, &d);
if (!d.res)
g_propagate_error (error, d.error);