A Structure is a collection of key/value pairs.
The keys are expressed as GQuarks and the values can be of any GType.
In addition to the key/value pairs, a Structure also has a name. The name starts with a letter and can be folled by
letters, numbers and any of "/-_.:".
Structure is used by various GStreamer subsystems to store information in a flexible and extensible way. A
Structure does not have a refcount because it usually is part of a higher level object such as
Caps. It provides a means to enforce mutability using the refcount of the parent with
the set_parent_refcount method.
A Structure can be created with
Structure.empty or Structure, which both take a name
and an optional set of key/value pairs along with the types of the values.
Field values can be changed with set_value or
@set.
Field values can be retrieved with get_value or the more convenient
gst_structure_get_*() functions.
Fields can be removed with remove_field or
remove_fields.
Strings in structures must be ASCII or UTF-8 encoded. Other encodings are not allowed. Strings must not be empty either, but may be NULL.
Last reviewed on 2009-06-08 (0.10.23)
- public bool can_intersect (Structure struct2)
Tries intersecting struct1 and struct2 and reports
whether the result would not be empty.
- public Structure copy ()
Duplicates a Structure and all its fields and
values.
- public bool fixate_field_boolean (string field_name, bool target)
Fixates a Structure by changing the given
field_name field to the given target boolean if that field is not fixed yet.
- public bool fixate_field_nearest_double (string field_name, double target)
Fixates a Structure by changing the given field to
the nearest double to target that is a subset of the existing field.
- public bool fixate_field_nearest_fraction (string field_name, int target_numerator, int target_denominator)
Fixates a Structure by changing the given field to
the nearest fraction to target_numerator/target_denominator that is a subset of the existing field.
- public bool fixate_field_nearest_int (string field_name, int target)
Fixates a Structure by changing the given field to
the nearest integer to target that is a subset of the existing field.
- public bool fixate_field_string (string field_name, string target)
Fixates a Structure by changing the given
field_name field to the given target string if that field is not fixed yet.
- public bool @foreach (StructureForeachFunc func)
Calls the provided function once for each field in the
Structure.
- public bool @get (...)
Parses the variable arguments and reads fields from structure
accordingly.
- public bool get_boolean (string fieldname, out bool value)
Sets the boolean pointed to by value corresponding to the value
of the given field.
- public bool get_clock_time (string fieldname, out ClockTime value)
Sets the clock time pointed to by value corresponding to the
clock time of the given field.
- public bool get_date (string fieldname, out Date value)
Sets the date pointed to by value corresponding to the date of
the given field.
- public bool get_date_time (string fieldname, out DateTime value)
Sets the datetime pointed to by value corresponding to the
datetime of the given field.
- public bool get_double (string fieldname, out double value)
Sets the double pointed to by value corresponding to the value
of the given field.
- public bool get_enum (string fieldname, Type enumtype, out int value)
Sets the int pointed to by value corresponding to the value of
the given field.
- public Type get_field_type (string fieldname)
Finds the field with the given name, and returns the type of the value it
contains.
- public bool get_fourcc (string fieldname, out uint32 value)
Sets the Fourcc pointed to by value corresponding to the value
of the given field.
- public bool get_fraction (string fieldname, out int value_numerator, out int value_denominator)
Sets the integers pointed to by value_numerator and
value_denominator corresponding to the value of the given field.
- public bool get_int (string fieldname, out int value)
Sets the int pointed to by value corresponding to the value of
the given field.
- public unowned string get_name ()
Get the name of structure as a string.
- public Quark get_name_id ()
Get the name of structure as a GQuark.
- public unowned string? get_string (string fieldname)
Finds the field corresponding to fieldname, and returns the
string contained in the field's value.
- public bool get_uint (string fieldname, out uint value)
Sets the uint pointed to by value corresponding to the value of
the given field.
- public bool get_valist (string first_fieldname, va_list args)
Parses the variable arguments and reads fields from structure
accordingly.
- public unowned Value? get_value (string fieldname)
Get the value of the field with name fieldname.
- public bool has_field (string fieldname)
Check if structure contains a field named fieldname
.
- public bool has_field_typed (string fieldname, Type type)
Check if structure contains a field named fieldname
and with GType type.
- public bool has_name (string name)
Checks if the structure has the given name
- public bool id_get (...)
Parses the variable arguments and reads fields from structure
accordingly.
- public bool id_get_valist (Quark first_field_id, va_list args)
Parses the variable arguments and reads fields from structure
accordingly.
- public unowned Value? id_get_value (Quark field)
Get the value of the field with GQuark field.
- public bool id_has_field (Quark field)
Check if structure contains a field named field.
- public bool id_has_field_typed (Quark field, Type type)
Check if structure contains a field named field
and with GType type.
- public void id_set (Quark fieldname, ...)
Identical to gst_structure_set, except that field names are passed using the
GQuark for the field name.
- public void id_set_valist (Quark fieldname, va_list varargs)
- public void id_set_value (Quark field, Value value)
Sets the field with the given GQuark field to value
.
- public void id_take_value (Quark field, Value value)
Sets the field with the given GQuark field to value
.
- public unowned Structure intersect (Structure struct2)
Interesects struct1 and struct2 and returns the
intersection.
- public bool is_equal (Structure structure2)
Tests if the two Structure are equal.
- public bool is_subset (Structure superset)
Checks if subset is a subset of superset, i.e. has
the same structure name and for all fields that are existing in superset, subset has a value that is a subset of
the value in superset.
- public bool map_in_place (StructureMapFunc func)
Calls the provided function once for each field in the
Structure.
- public int n_fields ()
Get the number of fields in the structure.
- public unowned string nth_field_name (uint index)
Get the name of the given field number, counting from 0 onwards.
- public void remove_all_fields ()
Removes all fields in a GstStructure.
- public void remove_field (string fieldname)
Removes the field with the given name.
- public void remove_fields (string fieldname, ...)
Removes the fields with the given names.
- public void remove_fields_valist (string fieldname, va_list varargs)
- public void @set (string fieldname, ...)
Parses the variable arguments and sets fields accordingly.
- public void set_name (string name)
Sets the name of the structure to the given name.
- public void set_parent_refcount (ref int refcount)
Sets the parent_refcount field of Structure.
- public void set_valist (string fieldname, va_list varargs)
- public void set_value (string fieldname, Value value)
Sets the field with the given name field to value.
- public void take_value (string fieldname, Value value)
Sets the field with the given name field to value.
- public string to_string ()
Converts structure to a human-readable string representation.