![]() |
![]() |
![]() |
GStreamer 0.9 Core Reference Manual | ![]() |
---|
GstStructureGstStructure — Generic structure containing fields of names and values |
#include <gst/gst.h> GstStructure; gboolean (*GstStructureForeachFunc) (GQuark field_id, const GValue *value, gpointer user_data); gboolean (*GstStructureMapFunc) (GQuark field_id, GValue *value, gpointer user_data); GstStructure* gst_structure_empty_new (const gchar *name); GstStructure* gst_structure_id_empty_new (GQuark quark); GstStructure* gst_structure_new (const gchar *name, const gchar *firstfield, ...); GstStructure* gst_structure_new_valist (const gchar *name, const gchar *firstfield, va_list varargs); GstStructure* gst_structure_copy (const GstStructure *structure); void gst_structure_free (GstStructure *structure); const gchar* gst_structure_get_name (const GstStructure *structure); gboolean gst_structure_has_name (const GstStructure *structure, const gchar *name); void gst_structure_set_name (GstStructure *structure, const gchar *name); GQuark gst_structure_get_name_id (const GstStructure *structure); const GValue* gst_structure_id_get_value (const GstStructure *structure, GQuark field); void gst_structure_id_set_value (GstStructure *structure, GQuark field, const GValue *value); const GValue* gst_structure_get_value (const GstStructure *structure, const gchar *fieldname); void gst_structure_set_value (GstStructure *structure, const gchar *fieldname, const GValue *value); void gst_structure_set (GstStructure *structure, const gchar *fieldname, ...); void gst_structure_set_valist (GstStructure *structure, const gchar *fieldname, va_list varargs); void gst_structure_remove_field (GstStructure *structure, const gchar *fieldname); void gst_structure_remove_fields (GstStructure *structure, const gchar *fieldname, ...); void gst_structure_remove_fields_valist (GstStructure *structure, const gchar *fieldname, va_list varargs); void gst_structure_remove_all_fields (GstStructure *structure); GType gst_structure_get_field_type (const GstStructure *structure, const gchar *fieldname); gboolean gst_structure_foreach (const GstStructure *structure, GstStructureForeachFunc func, gpointer user_data); gint gst_structure_n_fields (const GstStructure *structure); gboolean gst_structure_has_field (const GstStructure *structure, const gchar *fieldname); gboolean gst_structure_has_field_typed (const GstStructure *structure, const gchar *fieldname, GType type); gboolean gst_structure_get_boolean (const GstStructure *structure, const gchar *fieldname, gboolean *value); gboolean gst_structure_get_int (const GstStructure *structure, const gchar *fieldname, gint *value); gboolean gst_structure_get_fourcc (const GstStructure *structure, const gchar *fieldname, guint32 *value); gboolean gst_structure_get_double (const GstStructure *structure, const gchar *fieldname, gdouble *value); const gchar* gst_structure_get_string (const GstStructure *structure, const gchar *fieldname); gboolean gst_structure_get_date (const GstStructure *structure, const gchar *fieldname, GDate **value); gboolean gst_structure_get_clock_time (const GstStructure *structure, const gchar *fieldname, GstClockTime *value); gboolean gst_structure_get_enum (const GstStructure *structure, const gchar *fieldname, GType enumtype, gint *value); gboolean gst_structure_map_in_place (GstStructure *structure, GstStructureMapFunc func, gpointer user_data); const gchar* gst_structure_nth_field_name (const GstStructure *structure, guint index); void gst_structure_set_parent_refcount (GstStructure *structure, gint *refcount); gchar* gst_structure_to_string (const GstStructure *structure); GstStructure* gst_structure_from_string (const gchar *string, gchar **end); gboolean gst_caps_structure_fixate_field_nearest_int (GstStructure *structure, const char *field_name, int target); gboolean gst_caps_structure_fixate_field_nearest_double (GstStructure *structure, const char *field_name, double target);
gboolean (*GstStructureForeachFunc) (GQuark field_id, const GValue *value, gpointer user_data);
field_id : |
|
value : |
|
user_data : |
|
Returns : |
gboolean (*GstStructureMapFunc) (GQuark field_id, GValue *value, gpointer user_data);
field_id : |
|
value : |
|
user_data : |
|
Returns : |
GstStructure* gst_structure_empty_new (const gchar *name);
Creates a new, empty GstStructure with the given name.
name : |
name of new structure |
Returns : | a new, empty GstStructure |
GstStructure* gst_structure_id_empty_new (GQuark quark);
Creates a new, empty GstStructure with the given name.
quark : |
name of new structure |
Returns : | a new, empty GstStructure |
GstStructure* gst_structure_new (const gchar *name, const gchar *firstfield, ...);
Creates a new GstStructure with the given name. Parses the list of variable arguments and sets fields to the values listed. Variable arguments should be passed as field name, field type, and value. Last variable argument should be NULL.
name : |
name of new structure |
firstfield : |
name of first field to set |
... : |
additional arguments |
Returns : | a new GstStructure |
GstStructure* gst_structure_new_valist (const gchar *name, const gchar *firstfield, va_list varargs);
Creates a new GstStructure with the given name. Structure fields
are set according to the varargs in a manner similar to
gst_structure_new
.
name : |
name of new structure |
firstfield : |
name of first field to set |
varargs : |
variable argument list |
Returns : | a new GstStructure |
GstStructure* gst_structure_copy (const GstStructure *structure);
Duplicates a GstStructure and all its fields and values.
structure : |
a GstStructure to duplicate |
Returns : | a new GstStructure. |
void gst_structure_free (GstStructure *structure);
Frees a GstStructure and all its fields and values. The structure must not have a parent when this function is called.
structure : |
the GstStructure to free |
const gchar* gst_structure_get_name (const GstStructure *structure);
Accessor fuction.
structure : |
a GstStructure |
Returns : | the name of the structure. |
gboolean gst_structure_has_name (const GstStructure *structure, const gchar *name);
Checks if the structure has the given name
structure : |
a GstStructure |
name : |
structure name to check for |
Returns : | TRUE if name matches the name of the structure.
|
void gst_structure_set_name (GstStructure *structure, const gchar *name);
Sets the name of the structure to the given name. The string provided is copied before being used.
structure : |
a GstStructure |
name : |
the new name of the structure |
GQuark gst_structure_get_name_id (const GstStructure *structure);
Accessor fuction.
structure : |
a GstStructure |
Returns : | the quark representing the name of the structure. |
const GValue* gst_structure_id_get_value (const GstStructure *structure, GQuark field);
Accessor function.
structure : |
a GstStructure |
field : |
the GQuark of the field to get |
Returns : | the GValue corresponding to the field with the given name identifier. |
void gst_structure_id_set_value (GstStructure *structure, GQuark field, const GValue *value);
Sets the field with the given ID to the provided value. If the field does not exist, it is created. If the field exists, the previous value is freed.
structure : |
a GstStructure |
field : |
a GQuark representing a field |
value : |
the new value of the field |
const GValue* gst_structure_get_value (const GstStructure *structure, const gchar *fieldname);
Accessor function.
structure : |
a GstStructure |
fieldname : |
the name of the field to get |
Returns : | the GValue corresponding to the field with the given name. |
void gst_structure_set_value (GstStructure *structure, const gchar *fieldname, const GValue *value);
Sets the field with the given name to the provided value. If the field does not exist, it is created. If the field exists, the previous value is freed.
structure : |
a GstStructure |
fieldname : |
the name of the field to set |
value : |
the new value of the field |
void gst_structure_set (GstStructure *structure, const gchar *fieldname, ...);
Parses the variable arguments and sets fields accordingly. Variable arguments should be in the form field name, field type (as a GType), value. The last variable argument should be NULL.
structure : |
a GstStructure |
fieldname : |
the name of the field to set |
... : |
variable arguments |
void gst_structure_set_valist (GstStructure *structure, const gchar *fieldname, va_list varargs);
va_list form of gst_structure_set.
structure : |
a GstStructure |
fieldname : |
the name of the field to set |
varargs : |
variable arguments |
void gst_structure_remove_field (GstStructure *structure, const gchar *fieldname);
Removes the field with the given name. If the field with the given name does not exist, the structure is unchanged.
structure : |
a GstStructure |
fieldname : |
the name of the field to remove |
void gst_structure_remove_fields (GstStructure *structure, const gchar *fieldname, ...);
Removes the field with the given names. If a field does not exist, the argument is ignored.
structure : |
a GstStructure |
fieldname : |
the name of the field to remove |
... : |
NULL-terminated list of more fieldnames to remove |
void gst_structure_remove_fields_valist (GstStructure *structure, const gchar *fieldname, va_list varargs);
Removes the field with the given names. If a field does not exist, the argument is ignored.
structure : |
a GstStructure |
fieldname : |
the name of the field to remove |
varargs : |
NULL-terminated list of more fieldnames to remove |
void gst_structure_remove_all_fields (GstStructure *structure);
Removes all fields in a GstStructure.
structure : |
a GstStructure |
GType gst_structure_get_field_type (const GstStructure *structure, const gchar *fieldname);
Finds the field with the given name, and returns the type of the value it contains. If the field is not found, G_TYPE_INVALID is returned.
structure : |
a GstStructure |
fieldname : |
the name of the field |
Returns : | the GValue of the field |
gboolean gst_structure_foreach (const GstStructure *structure, GstStructureForeachFunc func, gpointer user_data);
Calls the provided function once for each field in the GstStructure. The
function must not modify the fields. Also see gst_structure_map_in_place()
.
structure : |
a GstStructure |
func : |
a function to call for each field |
user_data : |
private data |
Returns : | TRUE if the supplied function returns TRUE For each of the fields, FALSE otherwise. |
gint gst_structure_n_fields (const GstStructure *structure);
Accessor function.
structure : |
a GstStructure |
Returns : | the number of fields in the structure |
gboolean gst_structure_has_field (const GstStructure *structure, const gchar *fieldname);
Accessor function.
structure : |
a GstStructure |
fieldname : |
the name of a field |
Returns : | TRUE if the structure contains a field with the given name |
gboolean gst_structure_has_field_typed (const GstStructure *structure, const gchar *fieldname, GType type);
Accessor function.
structure : |
a GstStructure |
fieldname : |
the name of a field |
type : |
the type of a value |
Returns : | TRUE if the structure contains a field with the given name and type |
gboolean gst_structure_get_boolean (const GstStructure *structure, const gchar *fieldname, gboolean *value);
Sets the boolean pointed to by value
corresponding to the value of the
given field. Caller is responsible for making sure the field exists
and has the correct type.
structure : |
a GstStructure |
fieldname : |
the name of a field |
value : |
a pointer to a gboolean to set |
Returns : | TRUE if the value could be set correctly |
gboolean gst_structure_get_int (const GstStructure *structure, const gchar *fieldname, gint *value);
Sets the int pointed to by value
corresponding to the value of the
given field. Caller is responsible for making sure the field exists
and has the correct type.
structure : |
a GstStructure |
fieldname : |
the name of a field |
value : |
a pointer to an int to set |
Returns : | TRUE if the value could be set correctly |
gboolean gst_structure_get_fourcc (const GstStructure *structure, const gchar *fieldname, guint32 *value);
Sets the GstFourcc pointed to by value
corresponding to the value of the
given field. Caller is responsible for making sure the field exists
and has the correct type.
structure : |
a GstStructure |
fieldname : |
the name of a field |
value : |
a pointer to a GstFourcc to set |
Returns : | TRUE if the value could be set correctly |
gboolean gst_structure_get_double (const GstStructure *structure, const gchar *fieldname, gdouble *value);
Sets the double pointed to by value
corresponding to the value of the
given field. Caller is responsible for making sure the field exists
and has the correct type.
structure : |
a GstStructure |
fieldname : |
the name of a field |
value : |
a pointer to a GstFourcc to set |
Returns : | TRUE if the value could be set correctly |
const gchar* gst_structure_get_string (const GstStructure *structure, const gchar *fieldname);
Finds the field corresponding to fieldname
, and returns the string
contained in the field's value. Caller is responsible for making
sure the field exists and has the correct type.
The string should not be modified, and remains valid until the next call to a gst_structure_*() function with the given structure.
structure : |
a GstStructure |
fieldname : |
the name of a field |
Returns : | a pointer to the string |
gboolean gst_structure_get_date (const GstStructure *structure, const gchar *fieldname, GDate **value);
Sets the date pointed to by value
corresponding to the date of the
given field. Caller is responsible for making sure the field exists
and has the correct type.
structure : |
a GstStructure |
fieldname : |
the name of a field |
value : |
a pointer to a GDate to set |
Returns : | TRUE if the value could be set correctly |
gboolean gst_structure_get_clock_time (const GstStructure *structure, const gchar *fieldname, GstClockTime *value);
Sets the clock time pointed to by value
corresponding to the clock time
of the given field. Caller is responsible for making sure the field exists
and has the correct type.
structure : |
a GstStructure |
fieldname : |
the name of a field |
value : |
a pointer to a GstClockTime to set |
Returns : | TRUE if the value could be set correctly |
gboolean gst_structure_get_enum (const GstStructure *structure, const gchar *fieldname, GType enumtype, gint *value);
Sets the int pointed to by value
corresponding to the value of the
given field. Caller is responsible for making sure the field exists,
has the correct type and that the enumtype is correct.
structure : |
a GstStructure |
fieldname : |
the name of a field |
enumtype : |
the enum type of a field |
value : |
a pointer to an int to set |
Returns : | TRUE if the value could be set correctly |
gboolean gst_structure_map_in_place (GstStructure *structure, GstStructureMapFunc func, gpointer user_data);
Calls the provided function once for each field in the GstStructure. In
contrast to gst_structure_foreach()
, the function may modify the fields. The
structure must be mutable.
structure : |
a GstStructure |
func : |
a function to call for each field |
user_data : |
private data |
Returns : | TRUE if the supplied function returns TRUE For each of the fields, FALSE otherwise. |
const gchar* gst_structure_nth_field_name (const GstStructure *structure, guint index);
Get the name of the given field number, counting from 0 onwards.
structure : |
a GstStructure |
index : |
the index to get the name of |
Returns : | the name of the given field number |
void gst_structure_set_parent_refcount (GstStructure *structure, gint *refcount);
Sets the parent_refcount field of GstStructure. This field is used to determine whether a structure is mutable or not. This function should only be called by code implementing parent objects of GstStructure, as described in the MT Refcounting section of the design documents.
structure : |
a GstStructure |
refcount : |
a pointer to the parent's refcount |
gchar* gst_structure_to_string (const GstStructure *structure);
Converts structure
to a human-readable representation.
structure : |
a GstStructure |
Returns : | a pointer to string allocated by g_malloc()
|
GstStructure* gst_structure_from_string (const gchar *string, gchar **end);
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.
string : |
a string representation of a GstStructure. |
end : |
pointer to store the end of the string in. |
Returns : | a new GstStructure |
gboolean gst_caps_structure_fixate_field_nearest_int (GstStructure *structure, const char *field_name, int target);
Fixates a GstStructure by changing the given field to the nearest
integer to target
that is a subset of the existing field.
structure : |
a GstStructure |
field_name : |
a field in structure
|
target : |
the target value of the fixation |
Returns : | TRUE if the structure could be fixated |
gboolean gst_caps_structure_fixate_field_nearest_double (GstStructure *structure, const char *field_name, double target);
Fixates a GstStructure by changing the given field to the nearest
double to target
that is a subset of the existing field.
structure : |
a GstStructure |
field_name : |
a field in structure
|
target : |
the target value of the fixation |
Returns : | TRUE if the structure could be fixated |
<< GstRegistry | GstSystemClock >> |