summaryrefslogtreecommitdiff
path: root/gst/gststructure.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2011-08-15 14:32:17 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2011-08-15 14:32:17 +0200
commitbd20d2d19907f0474e55d1ca8447e182b307ba12 (patch)
tree4123d38967e9e4af425442ab03f95ee67749e8f3 /gst/gststructure.c
parentd12738b4fa3e058a2cb0a51c3e61085ec2010ac5 (diff)
downloadgstreamer-bd20d2d19907f0474e55d1ca8447e182b307ba12.tar.gz
structure: add function to fixate
Add a function to fixate a structure and use it for the default fixate function in gstpad.c.
Diffstat (limited to 'gst/gststructure.c')
-rw-r--r--gst/gststructure.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gst/gststructure.c b/gst/gststructure.c
index 9f66bc9901..b04236ea7d 100644
--- a/gst/gststructure.c
+++ b/gst/gststructure.c
@@ -3191,3 +3191,29 @@ gst_structure_is_subset (const GstStructure * subset,
return gst_structure_foreach ((GstStructure *) subset,
gst_caps_structure_is_subset_field, (gpointer) superset);
}
+
+static gboolean
+default_fixate (GQuark field_id, const GValue * value, gpointer data)
+{
+ GstStructure *s = data;
+ GValue v = { 0 };
+
+ if (gst_value_fixate (&v, value)) {
+ gst_structure_id_set_value (s, field_id, &v);
+ g_value_unset (&v);
+ }
+ return TRUE;
+}
+
+/**
+ * gst_structure_fixate:
+ * @structure: a #GstStructure
+ *
+ * Fixate all values in @structure using gst_value_fixate().
+ * @structure will be modified in-place and should be writable.
+ */
+void
+gst_structure_fixate (GstStructure * structure)
+{
+ gst_structure_foreach (structure, default_fixate, structure);
+}