Class Structure
- All Implemented Interfaces:
Proxy
GstStructure
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 GstStructure
also has a name. The name
starts with a letter and can be filled by letters, numbers and any of
"/-_.:".
GstStructure
is used by various GStreamer subsystems to store information in
a flexible and extensible way. A GstStructure
does not have a refcount
because it usually is part of a higher level object such as GstCaps
,
GstMessage
, GstEvent
, GstQuery
. It provides a means to enforce mutability
using the refcount of the parent with the gst_structure_set_parent_refcount()
method.
A GstStructure
can be created with gst_structure_new_empty() or
gst_structure_new(), 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 gst_structure_set_value() or gst_structure_set().
Field values can be retrieved with gst_structure_get_value() or the more convenient gst_structure_get_*() functions.
Fields can be removed with gst_structure_remove_field() or gst_structure_remove_fields().
Strings in structures must be ASCII or UTF-8 encoded. Other encodings are not
allowed. Strings may be null
however.
The serialization format
GstStructure serialization format serialize the GstStructure name,
keys/GType/values in a comma separated list with the structure name as first
field without value followed by separated key/value pairs in the form
key=value
, for example:
a-structure, key=value
The values type will be inferred if not explicitly specified with the
(GTypeName)value syntax, for example the following struct will have one
field called 'is-string' which has the string 'true' as a value:
{@code
a-struct, field-is-string=(string)true, field-is-boolean=true
}
*Note*: without specifying
(string), field-is-string
type would have been
inferred as boolean.
*Note*: we specified (string)
as a type even if gchararray
is the actual
GType name as for convenience some well known types have been aliased or
abbreviated.
To avoid specifying the type, you can give some hints to the "type system".
For example to specify a value as a double, you should add a decimal (ie. 1
is an int
while 1.0
is a double
).
*Note*: when a structure is serialized with gst_structure_to_string
, all
values are explicitly typed.
Some types have special delimiters:
- GstValueArray are inside curly brackets (
{} and {@code }
). For examplea-structure, array={1, 2, 3}
- Ranges are inside brackets (
[
and]
). For examplea-structure, range=[1, 6, 2]
1 being the min value, 6 the maximum and 2 the step. To specify aGST_TYPE_INT64_RANGE
you need to explicitly specify it like:a-structure, a-int64-range=(gint64) [1, 5]
- GstValueList are inside "less and greater than" (
<
and>
). For examplea-structure, list=<1, 2, 3> Structures are delimited either by a null character
\\0or a semicolon
;the latter allowing to store multiple structures in the same string (see #GstCaps). Quotes are used as "default" delimiters and can be used around any types that don't use other delimiters (for example
a-struct, i=(int)"1"). They are use to allow adding spaces or special characters (such as delimiters, semicolumns, etc..) inside strings and you can use backslashes
\\to escape characters inside them, for example:
{@code a-struct, special="\\"{[(;)]}\\" can be used inside quotes" }
They also allow for nested structure, such as:
{@code a-struct, nested=(GstStructure)"nested-struct, nested=true" }
Since 1.20, nested structures and caps can be specified using brackets (
[and
]), for example:
{@code a-struct, nested=[nested-struct, nested=true] }
`
*note*: gst_structure_to_string() won't use that syntax for backward compatibility reason, gst_structure_serialize_full() has been added for that purpose.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canIntersect
(Structure struct2) Tries intersecting this Structure andstruct2
and reports whether the result would not be empty.copy()
Duplicates aGstStructure
and all its fields and values.static Structure
Creates a new, emptyGstStructure
with the givenname
.void
Calls the provided function once for each field in theGstStructure
.void
fixate()
Fixate all values in this Structure using gst_value_fixate().boolean
fixateField
(String fieldName) Fixates aGstStructure
by changing the given field with its fixated value.boolean
fixateFieldBoolean
(String fieldName, boolean target) Fixates aGstStructure
by changing the givenfieldName
field to the giventarget
boolean if that field is not fixed yet.boolean
fixateFieldNearestDouble
(String fieldName, double target) Fixates aGstStructure
by changing the given field to the nearest double totarget
that is a subset of the existing field.boolean
fixateFieldNearestFraction
(String fieldName, int targetNumerator, int targetDenominator) Fixates aGstStructure
by changing the given field to the nearest fraction totargetNumerator
/targetDenominator
that is a subset of the existing field.boolean
fixateFieldNearestInt
(String fieldName, int target) Fixates aGstStructure
by changing the given field to the nearest integer totarget
that is a subset of the existing field.boolean
fixateFieldString
(String fieldName, String target) Fixates aGstStructure
by changing the givenfieldName
field to the giventarget
string if that field is not fixed yet.boolean
foreach
(StructureForeachFunc func) Calls the provided function once for each field in theGstStructure
.void
free()
Frees aGstStructure
and all its fields and values.static Structure
fromString
(String string) Creates aGstStructure
from a string representation.static Structure
fromString
(String string, @Nullable Out<String> end) Creates aGstStructure
from a string representation.boolean
Parses the variable arguments and reads fields from this Structure accordingly.boolean
getArray
(String fieldname, Out<ValueArray> array) This is useful in language bindings where unknownGValue
types are not supported.boolean
getBoolean
(String fieldname, Out<Boolean> value) Sets the boolean pointed to byvalue
corresponding to the value of the given field.boolean
getClockTime
(String fieldname, ClockTime value) Sets the clock time pointed to byvalue
corresponding to the clock time of the given field.boolean
Sets the date pointed to byvalue
corresponding to the date of the given field.boolean
getDateTime
(String fieldname, Out<DateTime> value) Sets the datetime pointed to byvalue
corresponding to the datetime of the given field.boolean
Sets the double pointed to byvalue
corresponding to the value of the given field.boolean
Sets the int pointed to byvalue
corresponding to the value of the given field.getFieldType
(String fieldname) Finds the field with the given name, and returns the type of the value it contains.boolean
Sets the unsigned int pointed to byvalue
corresponding to the value of the given field.boolean
Read the GstFlagSet flags and mask out of the structure into the provided pointers.boolean
Sets the integers pointed to byvalueNumerator
andvalueDenominator
corresponding to the value of the given field.boolean
Sets the int pointed to byvalue
corresponding to the value of the given field.boolean
Sets thegint64
pointed to byvalue
corresponding to the value of the given field.boolean
getList
(String fieldname, Out<ValueArray> array) This is useful in language bindings where unknownGValue
types are not supported.static MemoryLayout
The memory layout of the native struct.getName()
Get the name of this Structure as a string.Get the name of this Structure as a GQuark.Finds the field corresponding tofieldname
, and returns the string contained in the field's value.static Type
getType()
Get the GType of the Structure classboolean
Sets the uint pointed to byvalue
corresponding to the value of the given field.boolean
Sets theguint64
pointed to byvalue
corresponding to the value of the given field.Get the value of the field with namefieldname
.boolean
Check if this Structure contains a field namedfieldname
.boolean
hasFieldTyped
(String fieldname, Type type) Check if this Structure contains a field namedfieldname
and with GTypetype
.boolean
Checks if the structure has the given namestatic Structure
Creates a newGstStructure
with the given name as a GQuark, followed by fieldname quark, GType, argument(s) "triplets" in the same format as gst_structure_id_set().static Structure
Creates a new, emptyGstStructure
with the given name as a GQuark.boolean
Parses the variable arguments and reads fields from this Structure accordingly.idGetValue
(Quark field) Get the value of the field with GQuarkfield
.boolean
idHasField
(Quark field) Check if this Structure contains a field namedfield
.boolean
idHasFieldTyped
(Quark field, Type type) Check if this Structure contains a field namedfield
and with GTypetype
.void
Identical to gst_structure_set, except that field names are passed using the GQuark for the field name.void
idSetValue
(Quark field, Value value) Sets the field with the given GQuarkfield
tovalue
.void
idTakeValue
(Quark field, Value value) Sets the field with the given GQuarkfield
tovalue
.Intersects this Structure andstruct2
and returns the intersection.boolean
Tests if the twoGstStructure
are equal.boolean
Checks if this Structure is a subset ofsuperset
, i.e.boolean
mapInPlace
(StructureMapFunc func) Calls the provided function once for each field in theGstStructure
.int
nFields()
Get the number of fields in the structure.nthFieldName
(int index) Get the name of the given field number, counting from 0 onwards.readName()
Read the value of the fieldname
.readType()
Read the value of the fieldtype
.void
Removes all fields in a GstStructure.void
removeField
(String fieldname) Removes the field with the given name.void
removeFields
(String fieldname, Object... varargs) Removes the fields with the given names.serialize
(Set<SerializeFlags> flags) Deprecated.Use gst_structure_serialize_full() instead.serialize
(SerializeFlags... flags) Deprecated.Use gst_structure_serialize_full() instead.serializeFull
(Set<SerializeFlags> flags) Alias for gst_structure_serialize() but with nullable annotation because it can returnnull
whenSerializeFlags.STRICT
flag is set.serializeFull
(SerializeFlags... flags) Alias for gst_structure_serialize() but with nullable annotation because it can returnnull
whenSerializeFlags.STRICT
flag is set.void
Parses the variable arguments and sets fields accordingly.void
setArray
(String fieldname, ValueArray array) This is useful in language bindings where unknown GValue types are not supported.void
setList
(String fieldname, ValueArray array) This is useful in language bindings where unknown GValue types are not supported.void
Sets the name of the structure to the givenname
.boolean
setParentRefcount
(MemorySegment refcount) Sets the parent_refcount field ofGstStructure
.void
Sets the field with the given namefield
tovalue
.static boolean
Atomically modifies a pointer to point to a new structure.void
Sets the field with the given namefield
tovalue
.toString()
Converts this Structure to a human-readable string representation.void
Write a value in the fieldname
.void
Write a value in the fieldtype
.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Structure
Create a Structure proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
Structure
Creates a newGstStructure
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 benull
.Free-function: gst_structure_free
- Parameters:
name
- name of new structurefirstfield
- name of first field to setvarargs
- additional arguments
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readType
-
writeType
Write a value in the fieldtype
.- Parameters:
type
- The new value for the fieldtype
-
readName
-
writeName
Write a value in the fieldname
.- Parameters:
name
- The new value for the fieldname
-
fromString
Creates aGstStructure
from a string representation. If end is notnull
, a pointer to the place inside the given string where parsing ended will be returned.Free-function: gst_structure_free
- Parameters:
string
- a string representation of aGstStructure
.end
- pointer to store the end of the string in.- Returns:
- a new
GstStructure
ornull
when the string could not be parsed. Free with gst_structure_free() after use.
-
empty
-
fromString
Creates aGstStructure
from a string representation. If end is notnull
, a pointer to the place inside the given string where parsing ended will be returned.The current implementation of serialization will lead to unexpected results when there are nested
GstCaps
/GstStructure
deeper than one level unless the gst_structure_serialize() function is used (withoutGST_SERIALIZE_FLAG_BACKWARD_COMPAT
)Free-function: gst_structure_free
- Parameters:
string
- a string representation of aGstStructure
- Returns:
- a new
GstStructure
ornull
when the string could not be parsed. Free with gst_structure_free() after use.
-
id
Creates a newGstStructure
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_new_id_empty() and gst_structure_id_set().The last variable argument must be
null
(or 0).Free-function: gst_structure_free
- Parameters:
nameQuark
- name of new structurefieldQuark
- the GQuark for the name of the field to setvarargs
- variable arguments- Returns:
- a new
GstStructure
-
idEmpty
-
take
public static boolean take(@Nullable @Nullable Out<Structure> oldstrPtr, @Nullable @Nullable Structure newstr) Atomically modifies a pointer to point to a new structure. TheGstStructure
oldstrPtr
is pointing to is freed andnewstr
is taken ownership over.Either
newstr
and the value pointed to byoldstrPtr
may benull
.It is a programming error if both
newstr
and the value pointed to byoldstrPtr
refer to the same, non-null
structure.- Parameters:
oldstrPtr
- pointer to a place of aGstStructure
to takenewstr
- a newGstStructure
- Returns:
true
ifnewstr
was different fromoldstrPtr
-
canIntersect
Tries intersecting this Structure andstruct2
and reports whether the result would not be empty.- Parameters:
struct2
- aGstStructure
- Returns:
true
if intersection would not be empty
-
copy
Duplicates aGstStructure
and all its fields and values.Free-function: gst_structure_free
- Returns:
- a new
GstStructure
.
-
filterAndMapInPlace
Calls the provided function once for each field in theGstStructure
. In contrast to gst_structure_foreach(), the function may modify the fields. In contrast to gst_structure_map_in_place(), the field is removed from the structure iffalse
is returned from the function. The structure must be mutable.- Parameters:
func
- a function to call for each field
-
fixate
public void fixate()Fixate all values in this Structure using gst_value_fixate(). this Structure will be modified in-place and should be writable. -
fixateField
Fixates aGstStructure
by changing the given field with its fixated value.- Parameters:
fieldName
- a field in this Structure- Returns:
true
if the structure field could be fixated
-
fixateFieldBoolean
Fixates aGstStructure
by changing the givenfieldName
field to the giventarget
boolean if that field is not fixed yet.- Parameters:
fieldName
- a field in this Structuretarget
- the target value of the fixation- Returns:
true
if the structure could be fixated
-
fixateFieldNearestDouble
Fixates aGstStructure
by changing the given field to the nearest double totarget
that is a subset of the existing field.- Parameters:
fieldName
- a field in this Structuretarget
- the target value of the fixation- Returns:
true
if the structure could be fixated
-
fixateFieldNearestFraction
public boolean fixateFieldNearestFraction(String fieldName, int targetNumerator, int targetDenominator) Fixates aGstStructure
by changing the given field to the nearest fraction totargetNumerator
/targetDenominator
that is a subset of the existing field.- Parameters:
fieldName
- a field in this StructuretargetNumerator
- The numerator of the target value of the fixationtargetDenominator
- The denominator of the target value of the fixation- Returns:
true
if the structure could be fixated
-
fixateFieldNearestInt
Fixates aGstStructure
by changing the given field to the nearest integer totarget
that is a subset of the existing field.- Parameters:
fieldName
- a field in this Structuretarget
- the target value of the fixation- Returns:
true
if the structure could be fixated
-
fixateFieldString
Fixates aGstStructure
by changing the givenfieldName
field to the giventarget
string if that field is not fixed yet.- Parameters:
fieldName
- a field in this Structuretarget
- the target value of the fixation- Returns:
true
if the structure could be fixated
-
foreach
Calls the provided function once for each field in theGstStructure
. The function must not modify the fields. Also see gst_structure_map_in_place() and gst_structure_filter_and_map_in_place().- Parameters:
func
- a function to call for each field- Returns:
true
if the supplied function returnstrue
For each of the fields,false
otherwise.
-
free
public void free()Frees aGstStructure
and all its fields and values. The structure must not have a parent when this function is called. -
get
Parses the variable arguments and reads fields from this Structure accordingly. Variable arguments should be in the form field name, field type (as a GType), pointer(s) to a variable(s) to hold the return value(s). The last variable argument should benull
.For refcounted (mini)objects you will receive a new reference which you must release with a suitable _unref\\() when no longer needed. For strings and boxed types you will receive a copy which you will need to release with either g_free() or the suitable function for the boxed type.
- Parameters:
firstFieldname
- the name of the first field to readvarargs
- variable arguments- Returns:
false
if there was a problem reading any of the fields (e.g. because the field requested did not exist, or was of a type other than the type specified), otherwisetrue
.
-
getArray
This is useful in language bindings where unknownGValue
types are not supported. This function will convert theGST_TYPE_ARRAY
into a newly allocatedGValueArray
and return it througharray
. Be aware that this is slower then getting theGValue
directly.- Parameters:
fieldname
- the name of a fieldarray
- a pointer to aGValueArray
- Returns:
true
if the value could be set correctly. If there was no field withfieldname
or the existing field did not contain aGST_TYPE_ARRAY
, this function returnsfalse
.
-
getBoolean
Sets the boolean pointed to byvalue
corresponding to the value of the given field. Caller is responsible for making sure the field exists and has the correct type.- Parameters:
fieldname
- the name of a fieldvalue
- a pointer to agboolean
to set- Returns:
true
if the value could be set correctly. If there was no field withfieldname
or the existing field did not contain a boolean, this function returnsfalse
.
-
getClockTime
Sets the clock time pointed to byvalue
corresponding to the clock time of the given field. Caller is responsible for making sure the field exists and has the correct type.- Parameters:
fieldname
- the name of a fieldvalue
- a pointer to aGstClockTime
to set- Returns:
true
if the value could be set correctly. If there was no field withfieldname
or the existing field did not contain aGstClockTime
, this function returnsfalse
.
-
getDate
Sets the date pointed to byvalue
corresponding to the date of the given field. Caller is responsible for making sure the field exists and has the correct type.On success
value
will point to a newly-allocated copy of the date which should be freed with g_date_free() when no longer needed (note: this is inconsistent with e.g. gst_structure_get_string() which doesn't return a copy of the string).- Parameters:
fieldname
- the name of a fieldvalue
- a pointer to aGDate
to set- Returns:
true
if the value could be set correctly. If there was no field withfieldname
or the existing field did not contain a data, this function returnsfalse
.
-
getDateTime
Sets the datetime pointed to byvalue
corresponding to the datetime of the given field. Caller is responsible for making sure the field exists and has the correct type.On success
value
will point to a reference of the datetime which should be unreffed with gst_date_time_unref() when no longer needed (note: this is inconsistent with e.g. gst_structure_get_string() which doesn't return a copy of the string).- Parameters:
fieldname
- the name of a fieldvalue
- a pointer to aGstDateTime
to set- Returns:
true
if the value could be set correctly. If there was no field withfieldname
or the existing field did not contain a data, this function returnsfalse
.
-
getDouble
Sets the double pointed to byvalue
corresponding to the value of the given field. Caller is responsible for making sure the field exists and has the correct type.- Parameters:
fieldname
- the name of a fieldvalue
- a pointer to a gdouble to set- Returns:
true
if the value could be set correctly. If there was no field withfieldname
or the existing field did not contain a double, this function returnsfalse
.
-
getEnum
Sets the int pointed to byvalue
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.- Parameters:
fieldname
- the name of a fieldenumtype
- the enum type of a fieldvalue
- a pointer to an int to set- Returns:
true
if the value could be set correctly. If there was no field withfieldname
or the existing field did not contain an enum of the given type, this function returnsfalse
.
-
getFieldType
-
getFlags
Sets the unsigned int pointed to byvalue
corresponding to the value of the given field. Caller is responsible for making sure the field exists, has the correct type and that the flagstype is correct.- Parameters:
fieldname
- the name of a fieldflagsType
- the flags type of a fieldvalue
- a pointer to an unsigned int to set- Returns:
true
if the value could be set correctly. If there was no field withfieldname
or the existing field did not contain flags or did not contain flags of the given type, this function returnsfalse
.
-
getFlagset
public boolean getFlagset(String fieldname, @Nullable @Nullable Out<Integer> valueFlags, @Nullable @Nullable Out<Integer> valueMask) Read the GstFlagSet flags and mask out of the structure into the provided pointers.- Parameters:
fieldname
- the name of a fieldvalueFlags
- a pointer to a guint for the flags fieldvalueMask
- a pointer to a guint for the mask field- Returns:
true
if the values could be set correctly. If there was no field withfieldname
or the existing field did not contain a GstFlagSet, this function returnsfalse
.
-
getFraction
public boolean getFraction(String fieldname, Out<Integer> valueNumerator, Out<Integer> valueDenominator) Sets the integers pointed to byvalueNumerator
andvalueDenominator
corresponding to the value of the given field. Caller is responsible for making sure the field exists and has the correct type.- Parameters:
fieldname
- the name of a fieldvalueNumerator
- a pointer to an int to setvalueDenominator
- a pointer to an int to set- Returns:
true
if the values could be set correctly. If there was no field withfieldname
or the existing field did not contain a GstFraction, this function returnsfalse
.
-
getInt
Sets the int pointed to byvalue
corresponding to the value of the given field. Caller is responsible for making sure the field exists and has the correct type.- Parameters:
fieldname
- the name of a fieldvalue
- a pointer to an int to set- Returns:
true
if the value could be set correctly. If there was no field withfieldname
or the existing field did not contain an int, this function returnsfalse
.
-
getInt64
Sets thegint64
pointed to byvalue
corresponding to the value of the given field. Caller is responsible for making sure the field exists and has the correct type.- Parameters:
fieldname
- the name of a fieldvalue
- a pointer to agint64
to set- Returns:
true
if the value could be set correctly. If there was no field withfieldname
or the existing field did not contain agint64
, this function returnsfalse
.
-
getList
This is useful in language bindings where unknownGValue
types are not supported. This function will convert theGST_TYPE_LIST
into a newly allocated GValueArray and return it througharray
. Be aware that this is slower then getting theGValue
directly.- Parameters:
fieldname
- the name of a fieldarray
- a pointer to aGValueArray
- Returns:
true
if the value could be set correctly. If there was no field withfieldname
or the existing field did not contain aGST_TYPE_LIST
, this function returnsfalse
.
-
getName
Get the name of this Structure as a string.- Returns:
- the name of the structure.
-
getNameId
Get the name of this Structure as a GQuark.- Returns:
- the quark representing the name of the structure.
-
getString
Finds the field corresponding tofieldname
, 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.
- Parameters:
fieldname
- the name of a field- Returns:
- a pointer to the string or
null
when the field did not exist or did not contain a string.
-
getUint
Sets the uint pointed to byvalue
corresponding to the value of the given field. Caller is responsible for making sure the field exists and has the correct type.- Parameters:
fieldname
- the name of a fieldvalue
- a pointer to a uint to set- Returns:
true
if the value could be set correctly. If there was no field withfieldname
or the existing field did not contain a uint, this function returnsfalse
.
-
getUint64
Sets theguint64
pointed to byvalue
corresponding to the value of the given field. Caller is responsible for making sure the field exists and has the correct type.- Parameters:
fieldname
- the name of a fieldvalue
- a pointer to aguint64
to set- Returns:
true
if the value could be set correctly. If there was no field withfieldname
or the existing field did not contain aguint64
, this function returnsfalse
.
-
getValue
-
hasField
Check if this Structure contains a field namedfieldname
.- Parameters:
fieldname
- the name of a field- Returns:
true
if the structure contains a field with the given name
-
hasFieldTyped
-
hasName
Checks if the structure has the given name- Parameters:
name
- structure name to check for- Returns:
true
ifname
matches the name of the structure.
-
idGet
Parses the variable arguments and reads fields from this Structure accordingly. Variable arguments should be in the form field id quark, field type (as a GType), pointer(s) to a variable(s) to hold the return value(s). The last variable argument should benull
(technically it should be a 0 quark, but we requirenull
so compilers that support it can check for thenull
terminator and warn if it's not there).This function is just like gst_structure_get() only that it is slightly more efficient since it saves the string-to-quark lookup in the global quark hashtable.
For refcounted (mini)objects you will receive a new reference which you must release with a suitable _unref\\() when no longer needed. For strings and boxed types you will receive a copy which you will need to release with either g_free() or the suitable function for the boxed type.
- Parameters:
firstFieldId
- the quark of the first field to readvarargs
- variable arguments- Returns:
false
if there was a problem reading any of the fields (e.g. because the field requested did not exist, or was of a type other than the type specified), otherwisetrue
.
-
idGetValue
-
idHasField
Check if this Structure contains a field namedfield
.- Parameters:
field
-GQuark
of the field name- Returns:
true
if the structure contains a field with the given name
-
idHasFieldTyped
-
idSet
Identical to gst_structure_set, except that field names are passed using the GQuark for the field name. This allows more efficient setting of the structure if the caller already knows the associated quark values. The last variable argument must benull
.- Parameters:
fieldname
- the GQuark for the name of the field to setvarargs
- variable arguments
-
idSetValue
-
idTakeValue
-
intersect
-
isEqual
Tests if the twoGstStructure
are equal.- Parameters:
structure2
- aGstStructure
.- Returns:
true
if the two structures have the same name and field.
-
isSubset
Checks if this Structure is a subset ofsuperset
, i.e. has the same structure name and for all fields that are existing insuperset
, this Structure has a value that is a subset of the value insuperset
.- Parameters:
superset
- a potentially greaterGstStructure
- Returns:
true
if this Structure is a subset ofsuperset
-
mapInPlace
Calls the provided function once for each field in theGstStructure
. In contrast to gst_structure_foreach(), the function may modify but not delete the fields. The structure must be mutable.- Parameters:
func
- a function to call for each field- Returns:
true
if the supplied function returnstrue
For each of the fields,false
otherwise.
-
nFields
public int nFields()Get the number of fields in the structure.- Returns:
- the number of fields in the structure
-
nthFieldName
Get the name of the given field number, counting from 0 onwards.- Parameters:
index
- the index to get the name of- Returns:
- the name of the given field number
-
removeAllFields
public void removeAllFields()Removes all fields in a GstStructure. -
removeField
Removes the field with the given name. If the field with the given name does not exist, the structure is unchanged.- Parameters:
fieldname
- the name of the field to remove
-
removeFields
-
serialize
Deprecated.Use gst_structure_serialize_full() instead.Converts this Structure to a human-readable string representation.This version of the caps serialization function introduces support for nested structures and caps but the resulting strings won't be parsable with GStreamer prior to 1.20 unless
GST_SERIALIZE_FLAG_BACKWARD_COMPAT
is passed asflag
.SerializeFlags.STRICT
flags is not allowed because it would make this function nullable which is an API break for bindings. Use gst_structure_serialize_full() instead.Free-function: g_free
- Parameters:
flags
- The flags to use to serialize structure- Returns:
- a pointer to string allocated by g_malloc(). g_free() after usage.
-
serialize
Deprecated.Use gst_structure_serialize_full() instead.Converts this Structure to a human-readable string representation.This version of the caps serialization function introduces support for nested structures and caps but the resulting strings won't be parsable with GStreamer prior to 1.20 unless
GST_SERIALIZE_FLAG_BACKWARD_COMPAT
is passed asflag
.SerializeFlags.STRICT
flags is not allowed because it would make this function nullable which is an API break for bindings. Use gst_structure_serialize_full() instead.Free-function: g_free
- Parameters:
flags
- The flags to use to serialize structure- Returns:
- a pointer to string allocated by g_malloc(). g_free() after usage.
-
serializeFull
Alias for gst_structure_serialize() but with nullable annotation because it can returnnull
whenSerializeFlags.STRICT
flag is set.- Parameters:
flags
- The flags to use to serialize structure- Returns:
- a pointer to string allocated by g_malloc(). g_free() after usage.
-
serializeFull
Alias for gst_structure_serialize() but with nullable annotation because it can returnnull
whenSerializeFlags.STRICT
flag is set.- Parameters:
flags
- The flags to use to serialize structure- Returns:
- a pointer to string allocated by g_malloc(). g_free() after usage.
-
set
Parses the variable arguments and sets fields accordingly. Fields that weren't already part of the structure are added as needed. Variable arguments should be in the form field name, field type (as a GType), value(s). The last variable argument should benull
.- Parameters:
fieldname
- the name of the field to setvarargs
- variable arguments
-
setArray
This is useful in language bindings where unknown GValue types are not supported. This function will convert aarray
toGST_TYPE_ARRAY
and set the field specified byfieldname
. Be aware that this is slower then usingGST_TYPE_ARRAY
in aGValue
directly.- Parameters:
fieldname
- the name of a fieldarray
- a pointer to aGValueArray
-
setList
This is useful in language bindings where unknown GValue types are not supported. This function will convert aarray
toGST_TYPE_LIST
and set the field specified byfieldname
. Be aware that this is slower then usingGST_TYPE_LIST
in aGValue
directly.- Parameters:
fieldname
- the name of a fieldarray
- a pointer to aGValueArray
-
setName
Sets the name of the structure to the givenname
. The string provided is copied before being used. It must not be empty, start with a letter and can be followed by letters, numbers and any of "/-_.:".- Parameters:
name
- the new name of the structure
-
setParentRefcount
Sets the parent_refcount field ofGstStructure
. This field is used to determine whether a structure is mutable or not. This function should only be called by code implementing parent objects ofGstStructure
, as described in the MT Refcounting section of the design documents.- Parameters:
refcount
- a pointer to the parent's refcount- Returns:
true
if the parent refcount could be set.
-
setValue
-
takeValue
Sets the field with the given namefield
tovalue
. If the field does not exist, it is created. If the field exists, the previous value is replaced and freed. The function will take ownership ofvalue
.- Parameters:
fieldname
- the name of the field to setvalue
- the new value of the field
-
toString
Converts this Structure to a human-readable string representation.For debugging purposes its easier to do something like this:
This prints the structure in human readable form.language="C" --> GST_LOG ("structure is %" GST_PTR_FORMAT, structure);
This function will lead to unexpected results when there are nested
GstCaps
/GstStructure
deeper than one level, you should user gst_structure_serialize_full() instead for those cases.Free-function: g_free
-