mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
gst: structure: add more GstIdStr methods
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7613>
This commit is contained in:
parent
86776dc62e
commit
067fe7b9bc
3 changed files with 212 additions and 4 deletions
|
@ -42160,7 +42160,7 @@ Free-function: gst_structure_free</doc>
|
|||
</constructor>
|
||||
<constructor name="new_id_str" c:identifier="gst_structure_new_id_str" version="1.26" introspectable="0">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">Creates a new #GstStructure with the given name as a GQuark, followed by
|
||||
fieldname quark, GType, argument(s) "triplets" in the same format as
|
||||
fieldname GstIdStr, GType, argument(s) "triplets" in the same format as
|
||||
gst_structure_id_set(). Basically a convenience wrapper around
|
||||
gst_structure_new_id_empty() and gst_structure_id_set().
|
||||
|
||||
|
@ -43066,7 +43066,7 @@ function returns %FALSE.</doc>
|
|||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">Get the name of @structure as a GstIdStr.</doc>
|
||||
<source-position filename="../subprojects/gstreamer/gst/gststructure.h"/>
|
||||
<return-value transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">the quark representing the name of the structure.</doc>
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">the name of the structure.</doc>
|
||||
<type name="IdStr" c:type="const GstIdStr*"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
|
@ -43565,11 +43565,91 @@ name.</doc>
|
|||
</parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
<method name="id_str_nth_field_name" c:identifier="gst_structure_id_str_nth_field_name" version="1.26">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">Get the name (as a GstIdStr) of the given field number,
|
||||
counting from 0 onwards.</doc>
|
||||
<source-position filename="../subprojects/gstreamer/gst/gststructure.h"/>
|
||||
<return-value transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">the name of the given field number</doc>
|
||||
<type name="IdStr" c:type="const GstIdStr*"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<instance-parameter name="structure" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">a #GstStructure</doc>
|
||||
<type name="Structure" c:type="const GstStructure*"/>
|
||||
</instance-parameter>
|
||||
<parameter name="index" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">the index to get the name of</doc>
|
||||
<type name="guint" c:type="guint"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
<method name="id_str_remove_field" c:identifier="gst_structure_id_str_remove_field" version="1.26">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">Removes the field with the given name. If the field with the given
|
||||
name does not exist, the structure is unchanged.</doc>
|
||||
<source-position filename="../subprojects/gstreamer/gst/gststructure.h"/>
|
||||
<return-value transfer-ownership="none">
|
||||
<type name="none" c:type="void"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<instance-parameter name="structure" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">a #GstStructure</doc>
|
||||
<type name="Structure" c:type="GstStructure*"/>
|
||||
</instance-parameter>
|
||||
<parameter name="fieldname" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">the name of the field to remove</doc>
|
||||
<type name="IdStr" c:type="const GstIdStr*"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
<method name="id_str_remove_fields" c:identifier="gst_structure_id_str_remove_fields" version="1.26" introspectable="0">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">Removes the fields with the given names. If a field does not exist, the
|
||||
argument is ignored.</doc>
|
||||
<source-position filename="../subprojects/gstreamer/gst/gststructure.h"/>
|
||||
<return-value transfer-ownership="none">
|
||||
<type name="none" c:type="void"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<instance-parameter name="structure" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">a #GstStructure</doc>
|
||||
<type name="Structure" c:type="GstStructure*"/>
|
||||
</instance-parameter>
|
||||
<parameter name="fieldname" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">the name of the field to remove</doc>
|
||||
<type name="IdStr" c:type="const GstIdStr*"/>
|
||||
</parameter>
|
||||
<parameter name="..." transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">%NULL-terminated list of more fieldnames to remove</doc>
|
||||
<varargs/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
<method name="id_str_remove_fields_valist" c:identifier="gst_structure_id_str_remove_fields_valist" version="1.26" introspectable="0">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">va_list form of gst_structure_id_str_remove_fields().</doc>
|
||||
<source-position filename="../subprojects/gstreamer/gst/gststructure.h"/>
|
||||
<return-value transfer-ownership="none">
|
||||
<type name="none" c:type="void"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<instance-parameter name="structure" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">a #GstStructure</doc>
|
||||
<type name="Structure" c:type="GstStructure*"/>
|
||||
</instance-parameter>
|
||||
<parameter name="fieldname" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">the name of the field to remove</doc>
|
||||
<type name="IdStr" c:type="const GstIdStr*"/>
|
||||
</parameter>
|
||||
<parameter name="varargs" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">%NULL-terminated list of more fieldnames to remove</doc>
|
||||
<type name="va_list" c:type="va_list"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
<method name="id_str_set" c:identifier="gst_structure_id_str_set" version="1.26" introspectable="0">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gststructure.c">Identical to gst_structure_set, except that field names are
|
||||
passed using a GstIdStr for the field name. This allows more efficient
|
||||
setting of the structure if the caller already knows the associated
|
||||
quark values.
|
||||
setting of the structure if the caller already owns the associated
|
||||
GstIdStr values or if they can be built from static literals.
|
||||
The last variable argument must be %NULL.</doc>
|
||||
<source-position filename="../subprojects/gstreamer/gst/gststructure.h"/>
|
||||
<return-value transfer-ownership="none">
|
||||
|
|
|
@ -1827,6 +1827,94 @@ gst_structure_remove_fields_valist (GstStructure * structure,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_structure_id_str_remove_field:
|
||||
* @structure: a #GstStructure
|
||||
* @fieldname: the name of the field to remove
|
||||
*
|
||||
* Removes the field with the given name. If the field with the given
|
||||
* name does not exist, the structure is unchanged.
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
void
|
||||
gst_structure_id_str_remove_field (GstStructure * structure,
|
||||
const GstIdStr * fieldname)
|
||||
{
|
||||
GstStructureField *field;
|
||||
guint i, len;
|
||||
|
||||
g_return_if_fail (structure != NULL);
|
||||
g_return_if_fail (fieldname != NULL);
|
||||
g_return_if_fail (IS_MUTABLE (structure));
|
||||
|
||||
len = GST_STRUCTURE_LEN (structure);
|
||||
for (i = 0; i < len; i++) {
|
||||
field = GST_STRUCTURE_FIELD (structure, i);
|
||||
|
||||
if (gst_id_str_is_equal (&field->name, fieldname)) {
|
||||
if (G_IS_VALUE (&field->value)) {
|
||||
g_value_unset (&field->value);
|
||||
}
|
||||
gst_id_str_clear (&field->name);
|
||||
_structure_remove_index (structure, i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_structure_id_str_remove_fields:
|
||||
* @structure: a #GstStructure
|
||||
* @fieldname: the name of the field to remove
|
||||
* @...: %NULL-terminated list of more fieldnames to remove
|
||||
*
|
||||
* Removes the fields with the given names. If a field does not exist, the
|
||||
* argument is ignored.
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
void
|
||||
gst_structure_id_str_remove_fields (GstStructure * structure,
|
||||
const GstIdStr * fieldname, ...)
|
||||
{
|
||||
va_list varargs;
|
||||
|
||||
g_return_if_fail (structure != NULL);
|
||||
g_return_if_fail (fieldname != NULL);
|
||||
/* mutability checked in remove_field */
|
||||
|
||||
va_start (varargs, fieldname);
|
||||
gst_structure_id_str_remove_fields_valist (structure, fieldname, varargs);
|
||||
va_end (varargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_structure_id_str_remove_fields_valist:
|
||||
* @structure: a #GstStructure
|
||||
* @fieldname: the name of the field to remove
|
||||
* @varargs: %NULL-terminated list of more fieldnames to remove
|
||||
*
|
||||
* va_list form of gst_structure_id_str_remove_fields().
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
void
|
||||
gst_structure_id_str_remove_fields_valist (GstStructure * structure,
|
||||
const GstIdStr * fieldname, va_list varargs)
|
||||
{
|
||||
const GstIdStr *field = fieldname;
|
||||
|
||||
g_return_if_fail (structure != NULL);
|
||||
g_return_if_fail (fieldname != NULL);
|
||||
/* mutability checked in remove_field */
|
||||
|
||||
while (field) {
|
||||
gst_structure_id_str_remove_field (structure, field);
|
||||
field = va_arg (varargs, const GstIdStr *);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_structure_remove_all_fields:
|
||||
* @structure: a #GstStructure
|
||||
|
@ -1918,6 +2006,32 @@ gst_structure_nth_field_name (const GstStructure * structure, guint index)
|
|||
return gst_id_str_as_str (&field->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_structure_id_str_nth_field_name:
|
||||
* @structure: a #GstStructure
|
||||
* @index: the index to get the name of
|
||||
*
|
||||
* Get the name (as a GstIdStr) of the given field number,
|
||||
* counting from 0 onwards.
|
||||
*
|
||||
* Returns: the name of the given field number
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
const GstIdStr *
|
||||
gst_structure_id_str_nth_field_name (const GstStructure * structure,
|
||||
guint index)
|
||||
{
|
||||
GstStructureField *field;
|
||||
|
||||
g_return_val_if_fail (structure != NULL, NULL);
|
||||
g_return_val_if_fail (index < GST_STRUCTURE_LEN (structure), NULL);
|
||||
|
||||
field = GST_STRUCTURE_FIELD (structure, index);
|
||||
|
||||
return &field->name;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GstStructureForeachFunc func;
|
||||
|
|
|
@ -377,6 +377,17 @@ void gst_structure_remove_fields_valist (GstStructure *
|
|||
const gchar * fieldname,
|
||||
va_list varargs);
|
||||
GST_API
|
||||
void gst_structure_id_str_remove_field (GstStructure * structure,
|
||||
const GstIdStr * fieldname);
|
||||
GST_API
|
||||
void gst_structure_id_str_remove_fields (GstStructure * structure,
|
||||
const GstIdStr * fieldname,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
GST_API
|
||||
void gst_structure_id_str_remove_fields_valist(GstStructure * structure,
|
||||
const GstIdStr * fieldname,
|
||||
va_list varargs);
|
||||
GST_API
|
||||
void gst_structure_remove_all_fields (GstStructure * structure);
|
||||
|
||||
GST_API
|
||||
|
@ -412,6 +423,9 @@ gint gst_structure_n_fields (const GstStructure *
|
|||
GST_API
|
||||
const gchar * gst_structure_nth_field_name (const GstStructure * structure,
|
||||
guint index);
|
||||
GST_API
|
||||
const GstIdStr * gst_structure_id_str_nth_field_name(const GstStructure * structure,
|
||||
guint index);
|
||||
GST_DEPRECATED_FOR(gst_structure_id_str_has_field)
|
||||
gboolean gst_structure_id_has_field (const GstStructure * structure,
|
||||
GQuark field);
|
||||
|
|
Loading…
Reference in a new issue