diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2009-05-29 18:22:42 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2009-05-29 19:28:10 +0100 |
commit | c8acbbfde087516135b58b6be34235390ee06e19 (patch) | |
tree | 07d4c02def8fe4c13fc119d22114aae8e0c7a93f /gst/gststructure.c | |
parent | bc7c7e983668f5379cc192935367def6831965d7 (diff) |
structure: add gst_structure_id_new() convenience function
Add convenience wrapper for gst_structure_id_empty_new() plus
gst_structure_id_set() and use it in a few places.
API: gst_structure_id_new()
Diffstat (limited to 'gst/gststructure.c')
-rw-r--r-- | gst/gststructure.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/gst/gststructure.c b/gst/gststructure.c index 13ffd220c..3ac555523 100644 --- a/gst/gststructure.c +++ b/gst/gststructure.c @@ -608,6 +608,41 @@ gst_structure_id_set_valist (GstStructure * structure, } } +/** + * gst_structure_id_new: + * @name_quark: name of new structure + * @field_quark: the GQuark for the name of the field to set + * @...: variable arguments + * + * Creates a new #GstStructure with the given name as a GQuark, followed by + * fieldname quark, GType, argument(s) "triplets" in the same format as + * gst_structure_id_set(). Basically a convenience wrapper around + * gst_structure_id_empty_new() and gst_structure_id_set(). + * + * The last variable argument must be NULL (or 0). + * + * Returns: a new #GstStructure + * + * Since: 0.10.24 + */ +GstStructure * +gst_structure_id_new (GQuark name_quark, GQuark field_quark, ...) +{ + GstStructure *s; + va_list varargs; + + g_return_val_if_fail (name_quark != 0, NULL); + g_return_val_if_fail (field_quark != 0, NULL); + + s = gst_structure_id_empty_new (name_quark); + + va_start (varargs, field_quark); + gst_structure_id_set_valist (s, field_quark, varargs); + va_end (varargs); + + return s; +} + /* If the structure currently contains a field with the same name, it is * replaced with the provided field. Otherwise, the field is added to the * structure. The field's value is not deeply copied. |