org.gstreamer
public class Structure extends NativeObject
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...)
Modifier and Type | Class and Description |
---|---|
class |
Structure.InvalidFieldException |
NativeObject.Initializer
defaultInit, ownsHandle
Constructor and Description |
---|
Structure(NativeObject.Initializer init)
Creates a new instance of Structure
|
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() |
protected void |
disposeNativeHandle(com.sun.jna.Pointer ptr) |
boolean |
fixateNearestInteger(String field,
Integer value) |
static Structure |
fromString(String data)
Creates a Structure from a string representation.
|
boolean |
getBoolean(String fieldName) |
boolean |
getBoolean(String fieldName,
int i) |
double |
getDouble(String fieldName) |
double |
getDouble(String fieldName,
int i) |
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) |
int |
getInteger(String fieldName) |
int |
getInteger(String fieldName,
int i) |
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)
Gets Range field representation
|
String |
getString(String fieldName) |
String |
getString(String fieldName,
int i) |
Object |
getValue(String fieldName) |
ValueList |
getValueList(String fieldName)
Gets ValueList field representation
|
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 |
hasField(String fieldName,
GType 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.
|
static Structure |
objectFor(com.sun.jna.Pointer ptr,
boolean needRef,
boolean ownsHandle) |
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 |
setPointer(String field,
com.sun.jna.Pointer value) |
void |
setValue(String field,
GType type,
Object value) |
String |
toString() |
classFor, disown, dispose, equals, finalize, getNativeAddress, handle, hashCode, initializer, initializer, instanceFor, invalidate, isDisposed, nativeValue, objectFor, objectFor, objectFor, objectFor
public Structure(NativeObject.Initializer init)
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 static Structure fromString(String data)
data
- A string representation of a Structure.public Structure copy()
public ValueList getValueList(String fieldName)
fieldName
- The name of the field.public int getInteger(String fieldName)
public int getInteger(String fieldName, int i)
public double getDouble(String fieldName)
public double getDouble(String fieldName, int i)
public boolean getBoolean(String fieldName)
fieldName
- public boolean getBoolean(String fieldName, int i)
public int getFourcc(String fieldName)
fieldName
- The name of the field.public String getFourccString(String fieldName)
fieldName
- The name of the field.public Range getRange(String fieldName)
fieldName
- The name of the field.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 setPointer(String field, com.sun.jna.Pointer value)
public String getName()
public void setName(String name)
name
- The new name of the structure.public boolean hasName(String name)
name
- structure name to check forpublic boolean hasField(String fieldName)
Structure
contains a field named fieldName.fieldName
- The name of the field to check.public int getFields()
Structure
.public boolean hasField(String fieldName, GType fieldType)
Structure
contains a field named fieldName.fieldName
- The name of the field to check.fieldType
- The type of the field.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 hasDoubleField(String fieldName)
Structure
contains a double field named fieldName.fieldName
- The name of the field to check.public 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 String getName(int i)
i
- the requested filed numberpublic String toString()
toString
in class NativeObject
public static Structure objectFor(com.sun.jna.Pointer ptr, boolean needRef, boolean ownsHandle)
protected void disposeNativeHandle(com.sun.jna.Pointer ptr)
disposeNativeHandle
in class NativeObject
Copyright © 2014. All rights reserved.