structure: Add gst_structure_new_from_string()

Convenience API for bindings, gst_structure_from_string() returns
a tuple (structure, end_ptr) in bindings and is unintuitive to use
because of that.
This commit is contained in:
Sebastian Dröge 2013-06-14 13:05:38 +02:00
parent 7fc2602761
commit bd48ba333d
4 changed files with 26 additions and 1 deletions

View file

@ -2474,6 +2474,7 @@ gst_structure_new_id_empty
gst_structure_new gst_structure_new
gst_structure_new_valist gst_structure_new_valist
gst_structure_new_id gst_structure_new_id
gst_structure_new_from_string
gst_structure_copy gst_structure_copy
gst_structure_free gst_structure_free
gst_structure_get_name gst_structure_get_name

View file

@ -2307,10 +2307,31 @@ priv_gst_structure_parse_fields (gchar * str, gchar ** end,
return TRUE; return TRUE;
} }
/**
* gst_structure_new_from_string:
* @string: a string representation of a #GstStructure
*
* Creates a #GstStructure from a string representation.
* If end is not NULL, a pointer to the place inside the given string
* where parsing ended will be returned.
*
* Free-function: gst_structure_free
*
* Returns: (transfer full): a new #GstStructure or NULL when the string could
* not be parsed. Free with gst_structure_free() after use.
*
* Since: 1.2
*/
GstStructure *
gst_structure_new_from_string (const gchar * string)
{
return gst_structure_from_string (string, NULL);
}
/** /**
* gst_structure_from_string: * gst_structure_from_string:
* @string: a string representation of a #GstStructure. * @string: a string representation of a #GstStructure.
* @end: (out) (allow-none) (transfer none): pointer to store the end of the string in. * @end: (out) (allow-none) (transfer none) (skip): pointer to store the end of the string in.
* *
* Creates a #GstStructure from a string representation. * Creates a #GstStructure from a string representation.
* If end is not NULL, a pointer to the place inside the given string * If end is not NULL, a pointer to the place inside the given string

View file

@ -101,6 +101,8 @@ GstStructure * gst_structure_new_id (GQuark name_quark,
GQuark field_quark, GQuark field_quark,
...) G_GNUC_MALLOC; ...) G_GNUC_MALLOC;
GstStructure * gst_structure_new_from_string (const gchar * string);
GstStructure * gst_structure_copy (const GstStructure * structure) G_GNUC_MALLOC; GstStructure * gst_structure_copy (const GstStructure * structure) G_GNUC_MALLOC;
gboolean gst_structure_set_parent_refcount (GstStructure * structure, gboolean gst_structure_set_parent_refcount (GstStructure * structure,

View file

@ -1102,6 +1102,7 @@ EXPORTS
gst_structure_n_fields gst_structure_n_fields
gst_structure_new gst_structure_new
gst_structure_new_empty gst_structure_new_empty
gst_structure_new_from_string
gst_structure_new_id gst_structure_new_id
gst_structure_new_id_empty gst_structure_new_id_empty
gst_structure_new_valist gst_structure_new_valist