public class Structure extends NativeObject
See upstream documentation at https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstStructure.html
A Structure is a collection of key/value pairs. The keys are expressed as GQuarks and the values can be of any GType.
In addition to the key/value pairs, a Structure also has a name. The name starts with a letter and can be followed by letters, numbers and any of "/-_.:".
Structure is used by various GStreamer subsystems to store information in a flexible and extensible way.
A Structure can be created with new Structure(String) or
Structure(String, String, Object...), which both take a name and an
optional set of key/value pairs along with the types of the values.
Field values can be changed with set{Integer,String}() etc functions.
Field values can be retrieved with get{Integer,String}() etc functions.
Fields can be removed with removeField(java.lang.String) or removeFields(java.lang.String...)
Caps,
Event| Modifier and Type | Class and Description |
|---|---|
class |
Structure.InvalidFieldException |
NativeObject.Initializer, NativeObject.TypeProvider, NativeObject.TypeRegistration<T extends NativeObject>| Modifier and Type | Field and Description |
|---|---|
static String |
GTYPE_NAME |
| Constructor and Description |
|---|
Structure(String name)
Creates a new, empty #GstStructure with the given name.
|
Structure(String name,
String firstFieldName,
Object... data)
Creates a new Structure with the given name.
|
| Modifier and Type | Method and Description |
|---|---|
Structure |
copy() |
boolean |
fixateNearestInteger(String field,
Integer value) |
static Structure |
fromString(String data)
Creates a Structure from a string representation.
|
boolean |
getBoolean(String fieldName)
Get the value of the named field as a boolean.
|
double |
getDouble(String fieldName)
Get the value of the named field as a double.
|
double[] |
getDoubles(String fieldName)
Extract the values of the named field as an array of doubles.
|
double[] |
getDoubles(String fieldName,
double[] array)
Extract the values of the named field as an array of doubles.
|
int |
getFields()
Get the number of fields in the
Structure. |
int |
getFourcc(String fieldName)
Gets FOURCC field int representation
|
String |
getFourccString(String fieldName)
Gets FOURCC field String representation
|
Fraction |
getFraction(String fieldName)
Get the value of the named field as a Fraction.
|
int |
getInteger(String fieldName)
Get the value of the named field as an int.
|
int[] |
getIntegers(String fieldName)
Extract the values of the named field as an array of integers.
|
int[] |
getIntegers(String fieldName,
int[] array)
Extract the values of the named field as an array of integers.
|
String |
getName()
Get the name of @structure as a string.
|
String |
getName(int i)
Get the @structure's ith field name as a string.
|
Range |
getRange(String fieldName)
Get the value of the named field as a Range.
|
String |
getString(String fieldName)
Get the value of the named field as a String.
|
Object |
getValue(String fieldName)
Get the value of the named field.
|
<T> List<T> |
getValues(Class<T> type,
String fieldName)
Extract the values of the named field as a List of the provided type.
|
boolean |
hasDoubleField(String fieldName)
Check if the
Structure contains a double field named fieldName. |
boolean |
hasField(String fieldName)
Check if the
Structure contains a field named fieldName. |
boolean |
hasField(String fieldName,
Class<?> fieldType)
Check if the
Structure contains a field named fieldName. |
boolean |
hasIntField(String fieldName)
Check if the
Structure contains an integer field named fieldName. |
boolean |
hasName(String name)
Checks if the structure has the given name.
|
boolean |
isEqual(Structure structure)
Checks that two structures are equal
|
void |
removeField(String fieldName)
Removes the field with the given name from the structure.
|
void |
removeFields(String... fieldNames)
Removes the fields with the given names.
|
void |
setDouble(String field,
Double value) |
void |
setDoubleRange(String field,
Double min,
Double max) |
void |
setFraction(String field,
Integer numerator,
Integer denominator) |
void |
setInteger(String field,
Integer value)
Sets an integer field in the structure.
|
void |
setIntegerRange(String field,
Integer min,
Integer max) |
void |
setName(String name)
Sets the name of the structure to the given name.
|
void |
setObject(String field,
String typeName,
GObject object)
Set an object field in the structure.
|
String |
toString() |
close, disown, dispose, equals, getPointer, getRawPointer, hashCode, invalidatepublic static final String GTYPE_NAME
public Structure(String name)
name - The name of new structure.public Structure(String name, String firstFieldName, Object... data)
name - The name of new structure.firstFieldName - The name of first field to setdata - Additional arguments.public Structure copy()
public boolean getBoolean(String fieldName)
Structure.InvalidFieldException if the Structure does not contain the named
field or the named field is not a boolean.fieldName - name of fieldpublic double getDouble(String fieldName)
Structure.InvalidFieldException if the Structure does not contain the named
field or the named field is not a double.fieldName - name of fieldpublic double[] getDoubles(String fieldName)
This method will create a new array each time. If you are repeatedly
calling this method consider using
getDoubles(java.lang.String, double[]).
Throws Structure.InvalidFieldException if the field does not exist, or the
field values contained are not of type G_TYPE_DOUBLE.
This method only currently supports lists of values inside a GValueArray - other native list types will be supported in future.
fieldName - name of fieldpublic double[] getDoubles(String fieldName, double[] array)
An array may be passed into this method to contain the result. A new array will be created if the array is null or not of the correct length.
Throws Structure.InvalidFieldException if the field does not exist, or the
field values contained are not of type G_TYPE_DOUBLE.
This method only currently supports lists of values inside a GValueArray - other native list types will be supported in future.
fieldName - name of fieldarray - an array to hold values, or nullpublic int getFields()
Structure.public int getFourcc(String fieldName)
fieldName - The name of the field.public String getFourccString(String fieldName)
fieldName - The name of the field.public Fraction getFraction(String fieldName)
Structure.InvalidFieldException if the Structure does not contain the named
field or the named field is not a Fraction.fieldName - name of fieldpublic int getInteger(String fieldName)
Structure.InvalidFieldException if the Structure does not contain the named
field or the named field is not an integer.fieldName - name of fieldpublic int[] getIntegers(String fieldName)
This method will create a new array each time. If you are repeatedly
calling this method consider using
getIntegers(java.lang.String, int[]).
Throws Structure.InvalidFieldException if the field does not exist, or the
field values contained are not of type G_TYPE_INT.
This method only currently supports lists of values inside a GValueArray - other native list types will be supported in future.
fieldName - name of fieldpublic int[] getIntegers(String fieldName, int[] array)
An array may be passed into this method to contain the result. A new array will be created if the array is null or not of the correct length.
Throws Structure.InvalidFieldException if the field does not exist, or the
field values contained are not of type G_TYPE_INT.
This method only currently supports lists of values inside a GValueArray - other native list types will be supported in future.
fieldName - name of fieldarray - an array to hold values, or nullpublic void setName(String name)
name - The new name of the structure.public String getName()
public String getName(int i)
i - the requested filed numberpublic Range getRange(String fieldName)
Structure.InvalidFieldException if the Structure does not contain the named
field.fieldName - name of fieldpublic String getString(String fieldName)
fieldName - name of fieldpublic Object getValue(String fieldName)
Structure.InvalidFieldException if
the Structure does not contain the named field.fieldName - name of fieldpublic <T> List<T> getValues(Class<T> type, String fieldName)
Throws Structure.InvalidFieldException if the field does not exist, or the
field values cannot be converted to type T.
This method currently supports lists of values inside a GValueArray or GstValueList.
T - type - type of valuesfieldName - name of fieldpublic boolean hasDoubleField(String fieldName)
Structure contains a double field named fieldName.fieldName - The name of the field to check.public boolean hasField(String fieldName)
Structure contains a field named fieldName.fieldName - The name of the field to check.public boolean hasField(String fieldName, Class<?> fieldType)
Structure contains a field named fieldName.fieldName - The name of the field to check.fieldType - The type of the field.public boolean hasIntField(String fieldName)
Structure contains an integer field named fieldName.fieldName - The name of the field to check.public boolean hasName(String name)
name - structure name to check forpublic boolean isEqual(Structure structure)
structure - the structure to check if it's equal to this structurepublic void removeField(String fieldName)
fieldName - The name of the field to remove.public void removeFields(String... fieldNames)
fieldNames - A list of field names to remove.public void setInteger(String field, Integer value)
field - the name of the field to set.value - the value to set for the field.public void setObject(String field, String typeName, GObject object)
field - the name of the field to set.typeName - a type into which the provided object could be coerced into.object - the value to set for the field (must not be null).public String toString()
toString in class NativeObjectCopyright © 2021 gstreamer-java. All rights reserved.