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 "less and greater than" (
<and>). 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 a #GST_TYPE_INT64_RANGE you need to explicitly specify it like:a-structure, a-int64-range=(gint64) [1, 5]- [GstValueList](GST_TYPE_LIST) are inside curly brackets ({and}). For examplea-structure, list={1, 2, 3}- [GStrv](G_TYPE_STRV) are inside "less and greater than" (<and>) and each string is double-quoted. For examplea-structure, strv=(GStrv)<"foo", "bar">. Since 1.26.0. 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 examplea-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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanIntersect(Structure struct2) Tries intersecting this Structure andstruct2and reports whether the result would not be empty.copy()Duplicates aGstStructureand all its fields and values.static StructureCreates a new, emptyGstStructurewith the givenname.voidfilterAndMapInPlace(@Nullable StructureFilterMapFunc func) Deprecated.Use gst_structure_filter_and_map_in_place_id_str().voidfilterAndMapInPlaceIdStr(@Nullable StructureFilterMapIdStrFunc func) Calls the provided function once for each field in theGstStructure.voidfixate()Fixate all values in this Structure using gst_value_fixate().booleanfixateField(String fieldName) Fixates aGstStructureby changing the given field with its fixated value.booleanfixateFieldBoolean(String fieldName, boolean target) Fixates aGstStructureby changing the givenfieldNamefield to the giventargetboolean if that field is not fixed yet.booleanfixateFieldNearestDouble(String fieldName, double target) Fixates aGstStructureby changing the given field to the nearest double totargetthat is a subset of the existing field.booleanfixateFieldNearestFraction(String fieldName, int targetNumerator, int targetDenominator) Fixates aGstStructureby changing the given field to the nearest fraction totargetDenominatorthat is a subset of the existing field.booleanfixateFieldNearestInt(String fieldName, int target) Fixates aGstStructureby changing the given field to the nearest integer totargetthat is a subset of the existing field.booleanfixateFieldString(String fieldName, String target) Fixates aGstStructureby changing the givenfieldNamefield to the giventargetstring if that field is not fixed yet.booleanforeach(@Nullable StructureForeachFunc func) Deprecated.Use gst_structure_foreach_id_str().booleanforeachIdStr(@Nullable StructureForeachIdStrFunc func) Calls the provided function once for each field in theGstStructure.voidfree()Frees aGstStructureand all its fields and values.static StructurefromString(String string) Creates aGstStructurefrom a string representation.static StructurefromString(String string, @Nullable Out<String> end) Creates aGstStructurefrom a string representation.booleanParses the variable arguments and reads fields from this Structure accordingly.booleangetArray(String fieldname, Out<ValueArray> array) This is useful in language bindings where unknownGValuetypes are not supported.booleangetBoolean(String fieldname, Out<Boolean> value) Sets the boolean pointed to byvaluecorresponding to the value of the given field.booleangetClockTime(String fieldname, ClockTime value) Sets the clock time pointed to byvaluecorresponding to the clock time of the given field.booleanSets the date pointed to byvaluecorresponding to the date of the given field.booleangetDateTime(String fieldname, Out<DateTime> value) Sets the datetime pointed to byvaluecorresponding to the datetime of the given field.booleanSets the double pointed to byvaluecorresponding to the value of the given field.booleanSets the int pointed to byvaluecorresponding 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.booleanSets the unsigned int pointed to byvaluecorresponding to the value of the given field.booleanRead the GstFlagSet flags and mask out of the structure into the provided pointers.booleanSets the integers pointed to byvalueNumeratorandvalueDenominatorcorresponding to the value of the given field.booleanSets the int pointed to byvaluecorresponding to the value of the given field.booleanSets thegint64pointed to byvaluecorresponding to the value of the given field.booleangetList(String fieldname, Out<ValueArray> array) This is useful in language bindings where unknownGValuetypes are not supported.static MemoryLayoutThe memory layout of the native struct.getName()Get the name of this Structure as a string.Deprecated.Use gst_structure_get_name_id_str().Get the name of this Structure as a GstIdStr.@Nullable StringFinds the field corresponding tofieldname,and returns the string contained in the field's value.static @Nullable TypegetType()Get the GType of the Structure classbooleanSets the uint pointed to byvaluecorresponding to the value of the given field.booleanSets theguint64pointed to byvaluecorresponding to the value of the given field.@Nullable ValueGet the value of the field with namefieldname.booleanCheck if this Structure contains a field namedfieldname.booleanhasFieldTyped(String fieldname, Type type) Check if this Structure contains a field namedfieldnameand with GTypetype.booleanChecks if the structure has the given namestatic StructureDeprecated.Use gst_structure_new_id_str().static StructureDeprecated.Use gst_structure_new_id_str_empty().booleanDeprecated.Use gst_structure_id_str_get().@Nullable ValueidGetValue(Quark field) Get the value of the field with GQuarkfield.booleanidHasField(Quark field) Deprecated.Use gst_structure_id_str_has_field().booleanidHasFieldTyped(Quark field, Type type) Deprecated.Use gst_structure_id_str_has_field_typed().voidDeprecated.Use gst_structure_id_str_set().voididSetValue(Quark field, Value value) Deprecated.Use gst_structure_id_str_set_value().static StructureCreates a newGstStructurewith the given name as a GQuark, followed by fieldname GstIdStr, GType, argument(s) "triplets" in the same format as gst_structure_id_str_set().static StructureidStrEmpty(IdStr name) Creates a new, emptyGstStructurewith the given name.booleanParses the variable arguments and reads fields from this Structure accordingly.idStrGetFieldType(IdStr fieldname) Finds the field with the given name, and returns the type of the value it contains.@Nullable ValueidStrGetValue(IdStr fieldname) Get the value of the field with namefieldname.booleanidStrHasField(IdStr fieldname) Check if this Structure contains a field namedfieldname.booleanidStrHasFieldTyped(IdStr fieldname, Type type) Check if this Structure contains a field namedfieldnameand with GTypetype.idStrNthFieldName(int index) Get the name (as a GstIdStr) of the given field number, counting from 0 onwards.voididStrRemoveField(IdStr fieldname) Removes the field with the given name.voididStrRemoveFields(IdStr fieldname, Object... varargs) Removes the fields with the given names.voidIdentical to gst_structure_set, except that field names are passed using a GstIdStr for the field name.voididStrSetValue(IdStr fieldname, Value value) Sets the field with the given namefieldtovalue.If the field does not exist, it is created.voididStrTakeValue(IdStr fieldname, Value value) Sets the field with the given GstIdStrfieldtovalue.If the field does not exist, it is created.voididTakeValue(Quark field, Value value) Deprecated.Use gst_structure_id_str_take_value().@Nullable StructureIntersects this Structure andstruct2and returns the intersection.booleanTests if the twoGstStructureare equal.booleanChecks if this Structure is a subset ofsuperset,i.e.booleanChecks if the structure is writable.booleanmapInPlace(@Nullable StructureMapFunc func) Deprecated.Use gst_structure_map_in_place_id_str().booleanmapInPlaceIdStr(@Nullable StructureMapIdStrFunc func) Calls the provided function once for each field in theGstStructure.intnFields()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.voidRemoves all fields in a GstStructure.voidremoveField(String fieldname) Removes the field with the given name.voidremoveFields(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.@Nullable StringserializeFull(Set<SerializeFlags> flags) Alias for gst_structure_serialize() but with nullable annotation because it can returnnullwhenSerializeFlags.STRICTflag is set.@Nullable StringserializeFull(SerializeFlags... flags) Alias for gst_structure_serialize() but with nullable annotation because it can returnnullwhenSerializeFlags.STRICTflag is set.voidParses the variable arguments and sets fields accordingly.voidsetArray(String fieldname, ValueArray array) This is useful in language bindings where unknown GValue types are not supported.voidsetList(String fieldname, ValueArray array) This is useful in language bindings where unknown GValue types are not supported.voidSets the name of the structure to the givenname.The string provided is copied before being used.voidsetNameIdStr(IdStr name) Sets the name of the structure to the givenname.The string provided is copied before being used.voidsetNameStaticStr(String name) Sets the name of the structure to the givenname.The string provided is copied before being used.booleansetParentRefcount(MemorySegment refcount) Sets the parent_refcount field ofGstStructure.voidsetStaticStr(String fieldname, Object... varargs) Parses the variable arguments and sets fields accordingly.voidSets the field with the given namefieldtovalue.If the field does not exist, it is created.voidsetValueStaticStr(String fieldname, Value value) Sets the field with the given namefieldtovalue.If the field does not exist, it is created.static StructureCreates a newGstStructurewith the given name.static StructurestaticStrEmpty(String name) Creates a new, emptyGstStructurewith the givenname.static booleanAtomically modifies a pointer to point to a new structure.voidSets the field with the given namefieldtovalue.If the field does not exist, it is created.voidtakeValueStaticStr(String fieldname, Value value) Sets the field with the given namefieldtovalue.If the field does not exist, it is created.toString()Converts this Structure to a human-readable string representation.voidWrite a value in the fieldname.voidWrite a value in the fieldtype.Methods inherited from class org.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 newGstStructurewith 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 aGstStructurefrom 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
GstStructureornullwhen the string could not be parsed. Free with gst_structure_free() after use.
-
empty
-
fromString
Creates aGstStructurefrom 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/GstStructuredeeper 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
GstStructureornullwhen the string could not be parsed. Free with gst_structure_free() after use. - Since:
- 1.2
-
id
Deprecated.Use gst_structure_new_id_str().Creates a newGstStructurewith 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
Deprecated.Use gst_structure_new_id_str_empty().Creates a new, emptyGstStructurewith the given name as a GQuark.Free-function: gst_structure_free
- Parameters:
quark- name of new structure- Returns:
- a new, empty
GstStructure
-
idStr
Creates a newGstStructurewith the given name as a GQuark, followed by fieldname GstIdStr, GType, argument(s) "triplets" in the same format as gst_structure_id_str_set(). Basically a convenience wrapper around gst_structure_new_id_str_empty() and gst_structure_id_str_set().The last variable argument must be
null(or 0).Free-function: gst_structure_free
- Parameters:
name- name of new structurefieldname- the GstIdStr for the name of the field to setvarargs- variable arguments- Returns:
- a new
GstStructure - Since:
- 1.26
-
idStrEmpty
-
staticStr
Creates a newGstStructurewith 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.name,firstfieldand all field names need to be valid for the remaining lifetime of the process, e.g. have to be a static string.Free-function: gst_structure_free
- Parameters:
name- name of new structurefirstfield- name of first field to setvarargs- additional arguments- Returns:
- a new
GstStructure - Since:
- 1.26
-
staticStrEmpty
Creates a new, emptyGstStructurewith the givenname.See gst_structure_set_name() for constraints on the
nameparameter.nameneeds to be valid for the remaining lifetime of the process, e.g. has to be a static string.Free-function: gst_structure_free
- Parameters:
name- name of new structure- Returns:
- a new, empty
GstStructure - Since:
- 1.26
-
take
Atomically modifies a pointer to point to a new structure. TheGstStructureoldstrPtris pointing to is freed andnewstris taken ownership over.Either
newstrand the value pointed to byoldstrPtrmay benull.It is a programming error if both
newstrand the value pointed to byoldstrPtrrefer to the same, non-nullstructure.- Parameters:
oldstrPtr- pointer to a place of aGstStructureto takenewstr- a newGstStructure- Returns:
trueifnewstrwas different fromoldstrPtr- Since:
- 1.18
-
canIntersect
Tries intersecting this Structure andstruct2and reports whether the result would not be empty.- Parameters:
struct2- aGstStructure- Returns:
trueif intersection would not be empty
-
copy
Duplicates aGstStructureand all its fields and values.Free-function: gst_structure_free
- Returns:
- a new
GstStructure.
-
filterAndMapInPlace
Deprecated.Use gst_structure_filter_and_map_in_place_id_str().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 iffalseis returned from the function. The structure must be mutable.- Parameters:
func- a function to call for each field- Since:
- 1.6
-
filterAndMapInPlaceIdStr
Calls the provided function once for each field in theGstStructure. In contrast to gst_structure_foreach_id_str(), the function may modify the fields. In contrast to gst_structure_map_in_place_id_str(), the field is removed from the structure iffalseis returned from the function. The structure must be mutable.- Parameters:
func- a function to call for each field- Since:
- 1.26
-
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 aGstStructureby changing the given field with its fixated value.- Parameters:
fieldName- a field in this Structure- Returns:
trueif the structure field could be fixated
-
fixateFieldBoolean
Fixates aGstStructureby changing the givenfieldNamefield to the giventargetboolean if that field is not fixed yet.- Parameters:
fieldName- a field in this Structuretarget- the target value of the fixation- Returns:
trueif the structure could be fixated
-
fixateFieldNearestDouble
Fixates aGstStructureby changing the given field to the nearest double totargetthat is a subset of the existing field.- Parameters:
fieldName- a field in this Structuretarget- the target value of the fixation- Returns:
trueif the structure could be fixated
-
fixateFieldNearestFraction
public boolean fixateFieldNearestFraction(String fieldName, int targetNumerator, int targetDenominator) Fixates aGstStructureby changing the given field to the nearest fraction totargetDenominatorthat 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:
trueif the structure could be fixated
-
fixateFieldNearestInt
Fixates aGstStructureby changing the given field to the nearest integer totargetthat is a subset of the existing field.- Parameters:
fieldName- a field in this Structuretarget- the target value of the fixation- Returns:
trueif the structure could be fixated
-
fixateFieldString
Fixates aGstStructureby changing the givenfieldNamefield to the giventargetstring if that field is not fixed yet.- Parameters:
fieldName- a field in this Structuretarget- the target value of the fixation- Returns:
trueif the structure could be fixated
-
foreach
Deprecated.Use gst_structure_foreach_id_str().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:
trueif the supplied function returnstrueFor each of the fields,falseotherwise.
-
foreachIdStr
Calls the provided function once for each field in theGstStructure. The function must not modify the fields. Also see gst_structure_map_in_place_id_str() and gst_structure_filter_and_map_in_place_id_str().- Parameters:
func- a function to call for each field- Returns:
trueif the supplied function returnstrueFor each of the fields,falseotherwise.- Since:
- 1.26
-
free
public void free()Frees aGstStructureand 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:
falseif 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 unknownGValuetypes are not supported. This function will convert theGST_TYPE_ARRAYinto a newly allocatedGValueArrayand return it througharray.Be aware that this is slower then getting theGValuedirectly.- Parameters:
fieldname- the name of a fieldarray- a pointer to aGValueArray- Returns:
trueif the value could be set correctly. If there was no field withfieldnameor the existing field did not contain aGST_TYPE_ARRAY, this function returnsfalse.- Since:
- 1.12
-
getBoolean
Sets the boolean pointed to byvaluecorresponding 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 agbooleanto set- Returns:
trueif the value could be set correctly. If there was no field withfieldnameor the existing field did not contain a boolean, this function returnsfalse.
-
getClockTime
Sets the clock time pointed to byvaluecorresponding 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 aGstClockTimeto set- Returns:
trueif the value could be set correctly. If there was no field withfieldnameor the existing field did not contain aGstClockTime, this function returnsfalse.
-
getDate
Sets the date pointed to byvaluecorresponding to the date of the given field. Caller is responsible for making sure the field exists and has the correct type.On success
valuewill 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 aGDateto set- Returns:
trueif the value could be set correctly. If there was no field withfieldnameor the existing field did not contain a data, this function returnsfalse.
-
getDateTime
Sets the datetime pointed to byvaluecorresponding to the datetime of the given field. Caller is responsible for making sure the field exists and has the correct type.On success
valuewill 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 aGstDateTimeto set- Returns:
trueif the value could be set correctly. If there was no field withfieldnameor the existing field did not contain a data, this function returnsfalse.
-
getDouble
Sets the double pointed to byvaluecorresponding 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:
trueif the value could be set correctly. If there was no field withfieldnameor the existing field did not contain a double, this function returnsfalse.
-
getEnum
Sets the int pointed to byvaluecorresponding 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:
trueif the value could be set correctly. If there was no field withfieldnameor the existing field did not contain an enum of the given type, this function returnsfalse.
-
getFieldType
-
getFlags
Sets the unsigned int pointed to byvaluecorresponding 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:
trueif the value could be set correctly. If there was no field withfieldnameor the existing field did not contain flags or did not contain flags of the given type, this function returnsfalse.- Since:
- 1.22
-
getFlagset
public boolean getFlagset(String fieldname, @Nullable Out<Integer> valueFlags, @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:
trueif the values could be set correctly. If there was no field withfieldnameor the existing field did not contain a GstFlagSet, this function returnsfalse.- Since:
- 1.6
-
getFraction
public boolean getFraction(String fieldname, Out<Integer> valueNumerator, Out<Integer> valueDenominator) Sets the integers pointed to byvalueNumeratorandvalueDenominatorcorresponding 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:
trueif the values could be set correctly. If there was no field withfieldnameor the existing field did not contain a GstFraction, this function returnsfalse.
-
getInt
Sets the int pointed to byvaluecorresponding 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:
trueif the value could be set correctly. If there was no field withfieldnameor the existing field did not contain an int, this function returnsfalse.
-
getInt64
Sets thegint64pointed to byvaluecorresponding 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 agint64to set- Returns:
trueif the value could be set correctly. If there was no field withfieldnameor the existing field did not contain agint64, this function returnsfalse.- Since:
- 1.4
-
getList
This is useful in language bindings where unknownGValuetypes are not supported. This function will convert theGST_TYPE_LISTinto a newly allocated GValueArray and return it througharray.Be aware that this is slower then getting theGValuedirectly.- Parameters:
fieldname- the name of a fieldarray- a pointer to aGValueArray- Returns:
trueif the value could be set correctly. If there was no field withfieldnameor the existing field did not contain aGST_TYPE_LIST, this function returnsfalse.- Since:
- 1.12
-
getName
Get the name of this Structure as a string.- Returns:
- the name of the structure.
-
getNameId
Deprecated.Use gst_structure_get_name_id_str().Get the name of this Structure as a GQuark.- Returns:
- the quark representing the name of the structure.
-
getNameIdStr
Get the name of this Structure as a GstIdStr.- Returns:
- the name of the structure.
- Since:
- 1.26
-
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
nullwhen the field did not exist or did not contain a string.
-
getUint
Sets the uint pointed to byvaluecorresponding 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:
trueif the value could be set correctly. If there was no field withfieldnameor the existing field did not contain a uint, this function returnsfalse.
-
getUint64
Sets theguint64pointed to byvaluecorresponding 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 aguint64to set- Returns:
trueif the value could be set correctly. If there was no field withfieldnameor the existing field did not contain aguint64, this function returnsfalse.- Since:
- 1.4
-
getValue
-
hasField
Check if this Structure contains a field namedfieldname.- Parameters:
fieldname- the name of a field- Returns:
trueif 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:
trueifnamematches the name of the structure.
-
idGet
Deprecated.Use gst_structure_id_str_get().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 requirenullso compilers that support it can check for thenullterminator 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:
falseif 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
Deprecated.Use gst_structure_id_str_has_field().Check if this Structure contains a field namedfield.- Parameters:
field-GQuarkof the field name- Returns:
trueif the structure contains a field with the given name
-
idHasFieldTyped
Deprecated.Use gst_structure_id_str_has_field_typed().Check if this Structure contains a field namedfieldand with GTypetype.- Parameters:
field-GQuarkof the field nametype- the type of a value- Returns:
trueif the structure contains a field with the given name and type
-
idSet
Deprecated.Use gst_structure_id_str_set().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
Deprecated.Use gst_structure_id_str_set_value().Sets the field with the given GQuarkfieldtovalue.If the field does not exist, it is created. If the field exists, the previous value is replaced and freed.- Parameters:
field- aGQuarkrepresenting a fieldvalue- the new value of the field
-
idStrGet
Parses the variable arguments and reads fields from this Structure accordingly. Variable arguments should be in the form field name (as GstIdStr), 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:
falseif 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.- Since:
- 1.26
-
idStrGetFieldType
-
idStrGetValue
-
idStrHasField
Check if this Structure contains a field namedfieldname.- Parameters:
fieldname- the name of a field- Returns:
trueif the structure contains a field with the given name- Since:
- 1.26
-
idStrHasFieldTyped
-
idStrNthFieldName
Get the name (as a GstIdStr) 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
- Since:
- 1.26
-
idStrRemoveField
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- Since:
- 1.26
-
idStrRemoveFields
-
idStrSet
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 owns the associated GstIdStr values or if they can be built from static literals. The last variable argument must benull.- Parameters:
fieldname- the the name of the field to setvarargs- variable arguments- Since:
- 1.26
-
idStrSetValue
Sets the field with the given namefieldtovalue.If the field does not exist, it is created. If the field exists, the previous value is replaced and freed.- Parameters:
fieldname- the name of the field to setvalue- the new value of the field- Since:
- 1.26
-
idStrTakeValue
Sets the field with the given GstIdStrfieldtovalue.If the field does not exist, it is created. If the field exists, the previous value is replaced and freed.- Parameters:
fieldname- the name of the field to setvalue- the new value of the field- Since:
- 1.26
-
idTakeValue
Deprecated.Use gst_structure_id_str_take_value().Sets the field with the given GQuarkfieldtovalue.If the field does not exist, it is created. If the field exists, the previous value is replaced and freed.- Parameters:
field- aGQuarkrepresenting a fieldvalue- the new value of the field
-
intersect
-
isEqual
Tests if the twoGstStructureare equal.- Parameters:
structure2- aGstStructure.- Returns:
trueif 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:
trueif this Structure is a subset ofsuperset
-
isWritable
public boolean isWritable()Checks if the structure is writable.trueif parent is not set or its refcount is 1,falseotherwise.- Returns:
trueif the structure is writable.- Since:
- 1.26.2
-
mapInPlace
Deprecated.Use gst_structure_map_in_place_id_str().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:
trueif the supplied function returnstrueFor each of the fields,falseotherwise.
-
mapInPlaceIdStr
Calls the provided function once for each field in theGstStructure. In contrast to gst_structure_foreach_id_str(), the function may modify but not delete the fields. The structure must be mutable.- Parameters:
func- a function to call for each field- Returns:
trueif the supplied function returnstrueFor each of the fields,falseotherwise.- Since:
- 1.26
-
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_COMPATis passed asflag.SerializeFlags.STRICTflags 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.
- Since:
- 1.20
-
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_COMPATis passed asflag.SerializeFlags.STRICTflags 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.
- Since:
- 1.20
-
serializeFull
Alias for gst_structure_serialize() but with nullable annotation because it can returnnullwhenSerializeFlags.STRICTflag is set.- Parameters:
flags- The flags to use to serialize structure- Returns:
- a pointer to string allocated by g_malloc(). g_free() after usage.
- Since:
- 1.24
-
serializeFull
Alias for gst_structure_serialize() but with nullable annotation because it can returnnullwhenSerializeFlags.STRICTflag is set.- Parameters:
flags- The flags to use to serialize structure- Returns:
- a pointer to string allocated by g_malloc(). g_free() after usage.
- Since:
- 1.24
-
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 aarraytoGST_TYPE_ARRAYand set the field specified byfieldname.Be aware that this is slower then usingGST_TYPE_ARRAYin aGValuedirectly.- Parameters:
fieldname- the name of a fieldarray- a pointer to aGValueArray- Since:
- 1.12
-
setList
This is useful in language bindings where unknown GValue types are not supported. This function will convert aarraytoGST_TYPE_LISTand set the field specified byfieldname.Be aware that this is slower then usingGST_TYPE_LISTin aGValuedirectly.- Parameters:
fieldname- the name of a fieldarray- a pointer to aGValueArray- Since:
- 1.12
-
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
-
setNameIdStr
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- Since:
- 1.26
-
setNameStaticStr
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 "/-_.:".nameneeds to be valid for the remaining lifetime of the process, e.g. has to be a static string.- Parameters:
name- the new name of the structure- Since:
- 1.26
-
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:
trueif the parent refcount could be set.
-
setStaticStr
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.fieldnameand all other field names needs to be valid for the remaining lifetime of the process, e.g. has to be a static string.- Parameters:
fieldname- the name of the field to setvarargs- variable arguments- Since:
- 1.26
-
setValue
-
setValueStaticStr
Sets the field with the given namefieldtovalue.If the field does not exist, it is created. If the field exists, the previous value is replaced and freed.fieldnameneeds to be valid for the remaining lifetime of the process, e.g. has to be a static string.- Parameters:
fieldname- the name of the field to setvalue- the new value of the field- Since:
- 1.26
-
takeValue
Sets the field with the given namefieldtovalue.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
-
takeValueStaticStr
Sets the field with the given namefieldtovalue.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.fieldnameneeds to be valid for the remaining lifetime of the process, e.g. has to be a static string.- Parameters:
fieldname- the name of the field to setvalue- the new value of the field- Since:
- 1.26
-
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/GstStructuredeeper than one level, you should user gst_structure_serialize_full() instead for those cases.Free-function: g_free
-