Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
- Exported types
- Methods
- canIntersect
- copy
- filterAndMapInPlace
- fixate
- fixateField
- fixateFieldBoolean
- fixateFieldNearestDouble
- fixateFieldNearestFraction
- fixateFieldNearestInt
- fixateFieldString
- foreach
- free
- fromString
- getArray
- getBoolean
- getClockTime
- getDate
- getDateTime
- getDouble
- getEnum
- getFieldType
- getFlagset
- getFraction
- getInt
- getInt64
- getList
- getName
- getNameId
- getString
- getUint
- getUint64
- getValue
- hasField
- hasFieldTyped
- hasName
- idGetValue
- idHasField
- idHasFieldTyped
- idSetValue
- idTakeValue
- intersect
- isEqual
- isSubset
- mapInPlace
- nFields
- newEmpty
- newFromString
- newIdEmpty
- nthFieldName
- removeAllFields
- removeField
- serialize
- setArray
- setList
- setName
- setParentRefcount
- setValue
- takeValue
- toString
- Properties
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 filled by letters, numbers and any of
"/-_.:".
Structure
is used by various GStreamer subsystems to store information in
a flexible and extensible way. A Structure
does not have a refcount
because it usually is part of a higher level object such as Caps
,
Message
, Event
, Query
. It provides a means to enforce mutability
using the refcount of the parent with the structureSetParentRefcount
method.
A Structure
can be created with structureNewEmpty
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 structureSetValue
or
gst_structure_set()
.
Field values can be retrieved with structureGetValue
or the more
convenient gst_structure_get_*() functions.
Fields can be removed with structureRemoveField
or
gst_structure_remove_fields()
.
Strings in structures must be ASCII or UTF-8 encoded. Other encodings are not
allowed. Strings may be Nothing
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:
`
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 ifgchararray
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}
). For examplea-structure, array={1, 2, 3}
- Ranges are inside brackets (
[
and]
). For example `a-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 example `a-structure, list=<1, 2, 3>
Structures are delimited either by a null character \0
or a semicolon ;
the latter allowing to store multiple structures in the same string (see
Caps
).
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:
a-struct, special="\"{[(;)]}\" can be used inside quotes"
They also allow for nested structure, such as:
a-struct, nested=(GstStructure)"nested-struct, nested=true"
Since 1.20, nested structures and caps can be specified using brackets ([
and ]
), for example:
a-struct, nested=[nested-struct, nested=true]
*note*: 'GI.Gst.Structs.Structure.structureToString' won\'t use that syntax for backward compatibility reason, 'GI.Gst.Structs.Structure.structureSerialize' has been added for that purpose.
Synopsis
- newtype Structure = Structure (ManagedPtr Structure)
- newZeroStructure :: MonadIO m => m Structure
- structureCanIntersect :: (HasCallStack, MonadIO m) => Structure -> Structure -> m Bool
- structureCopy :: (HasCallStack, MonadIO m) => Structure -> m Structure
- structureFilterAndMapInPlace :: (HasCallStack, MonadIO m) => Structure -> StructureFilterMapFunc -> m ()
- structureFixate :: (HasCallStack, MonadIO m) => Structure -> m ()
- structureFixateField :: (HasCallStack, MonadIO m) => Structure -> Text -> m Bool
- structureFixateFieldBoolean :: (HasCallStack, MonadIO m) => Structure -> Text -> Bool -> m Bool
- structureFixateFieldNearestDouble :: (HasCallStack, MonadIO m) => Structure -> Text -> Double -> m Bool
- structureFixateFieldNearestFraction :: (HasCallStack, MonadIO m) => Structure -> Text -> Int32 -> Int32 -> m Bool
- structureFixateFieldNearestInt :: (HasCallStack, MonadIO m) => Structure -> Text -> Int32 -> m Bool
- structureFixateFieldString :: (HasCallStack, MonadIO m) => Structure -> Text -> Text -> m Bool
- structureForeach :: (HasCallStack, MonadIO m) => Structure -> StructureForeachFunc -> m Bool
- structureFree :: (HasCallStack, MonadIO m) => Structure -> m ()
- structureFromString :: (HasCallStack, MonadIO m) => Text -> m (Maybe Structure, Text)
- structureGetArray :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Bool, ValueArray)
- structureGetBoolean :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Bool, Bool)
- structureGetClockTime :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Bool, Word64)
- structureGetDate :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Bool, Date)
- structureGetDateTime :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Bool, DateTime)
- structureGetDouble :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Bool, Double)
- structureGetEnum :: (HasCallStack, MonadIO m) => Structure -> Text -> GType -> m (Bool, Int32)
- structureGetFieldType :: (HasCallStack, MonadIO m) => Structure -> Text -> m GType
- structureGetFlagset :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Bool, Word32, Word32)
- structureGetFraction :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Bool, Int32, Int32)
- structureGetInt :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Bool, Int32)
- structureGetInt64 :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Bool, Int64)
- structureGetList :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Bool, ValueArray)
- structureGetName :: (HasCallStack, MonadIO m) => Structure -> m Text
- structureGetNameId :: (HasCallStack, MonadIO m) => Structure -> m Word32
- structureGetString :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Maybe Text)
- structureGetUint :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Bool, Word32)
- structureGetUint64 :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Bool, Word64)
- structureGetValue :: (HasCallStack, MonadIO m) => Structure -> Text -> m (Maybe GValue)
- structureHasField :: (HasCallStack, MonadIO m) => Structure -> Text -> m Bool
- structureHasFieldTyped :: (HasCallStack, MonadIO m) => Structure -> Text -> GType -> m Bool
- structureHasName :: (HasCallStack, MonadIO m) => Structure -> Text -> m Bool
- structureIdGetValue :: (HasCallStack, MonadIO m) => Structure -> Word32 -> m (Maybe GValue)
- structureIdHasField :: (HasCallStack, MonadIO m) => Structure -> Word32 -> m Bool
- structureIdHasFieldTyped :: (HasCallStack, MonadIO m) => Structure -> Word32 -> GType -> m Bool
- structureIdSetValue :: (HasCallStack, MonadIO m) => Structure -> Word32 -> GValue -> m ()
- structureIdTakeValue :: (HasCallStack, MonadIO m) => Structure -> Word32 -> GValue -> m ()
- structureIntersect :: (HasCallStack, MonadIO m) => Structure -> Structure -> m (Maybe Structure)
- structureIsEqual :: (HasCallStack, MonadIO m) => Structure -> Structure -> m Bool
- structureIsSubset :: (HasCallStack, MonadIO m) => Structure -> Structure -> m Bool
- structureMapInPlace :: (HasCallStack, MonadIO m) => Structure -> StructureMapFunc -> m Bool
- structureNFields :: (HasCallStack, MonadIO m) => Structure -> m Int32
- structureNewEmpty :: (HasCallStack, MonadIO m) => Text -> m Structure
- structureNewFromString :: (HasCallStack, MonadIO m) => Text -> m (Maybe Structure)
- structureNewIdEmpty :: (HasCallStack, MonadIO m) => Word32 -> m Structure
- structureNthFieldName :: (HasCallStack, MonadIO m) => Structure -> Word32 -> m Text
- structureRemoveAllFields :: (HasCallStack, MonadIO m) => Structure -> m ()
- structureRemoveField :: (HasCallStack, MonadIO m) => Structure -> Text -> m ()
- structureSerialize :: (HasCallStack, MonadIO m) => Structure -> [SerializeFlags] -> m Text
- structureSetArray :: (HasCallStack, MonadIO m) => Structure -> Text -> ValueArray -> m ()
- structureSetList :: (HasCallStack, MonadIO m) => Structure -> Text -> ValueArray -> m ()
- structureSetName :: (HasCallStack, MonadIO m) => Structure -> Text -> m ()
- structureSetParentRefcount :: (HasCallStack, MonadIO m) => Structure -> Int32 -> m Bool
- structureSetValue :: (HasCallStack, MonadIO m) => Structure -> Text -> GValue -> m ()
- structureTakeValue :: (HasCallStack, MonadIO m) => Structure -> Text -> GValue -> m ()
- structureToString :: (HasCallStack, MonadIO m) => Structure -> m Text
- getStructureType :: MonadIO m => Structure -> m GType
- setStructureType :: MonadIO m => Structure -> GType -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq Structure Source # | |
GBoxed Structure Source # | |
Defined in GI.Gst.Structs.Structure | |
ManagedPtrNewtype Structure Source # | |
Defined in GI.Gst.Structs.Structure toManagedPtr :: Structure -> ManagedPtr Structure | |
TypedObject Structure Source # | |
Defined in GI.Gst.Structs.Structure | |
HasParentTypes Structure Source # | |
Defined in GI.Gst.Structs.Structure | |
tag ~ 'AttrSet => Constructible Structure tag Source # | |
IsGValue (Maybe Structure) Source # | Convert |
Defined in GI.Gst.Structs.Structure gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Structure -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Structure) | |
type ParentTypes Structure Source # | |
Defined in GI.Gst.Structs.Structure |
newZeroStructure :: MonadIO m => m Structure Source #
Construct a Structure
struct initialized to zero.
Methods
Click to display all available methods, including inherited ones
Methods
canIntersect, copy, filterAndMapInPlace, fixate, fixateField, fixateFieldBoolean, fixateFieldNearestDouble, fixateFieldNearestFraction, fixateFieldNearestInt, fixateFieldString, foreach, free, hasField, hasFieldTyped, hasName, idGetValue, idHasField, idHasFieldTyped, idSetValue, idTakeValue, intersect, isEqual, isSubset, mapInPlace, nFields, nthFieldName, removeAllFields, removeField, serialize, takeValue, toString.
Getters
getArray, getBoolean, getClockTime, getDate, getDateTime, getDouble, getEnum, getFieldType, getFlagset, getFraction, getInt, getInt64, getList, getName, getNameId, getString, getUint, getUint64, getValue.
Setters
canIntersect
structureCanIntersect Source #
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Structure |
|
-> m Bool | Returns: |
Tries intersecting struct1
and struct2
and reports whether the result
would not be empty.
copy
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> m Structure | Returns: a new |
Duplicates a Structure
and all its fields and values.
Free-function: gst_structure_free
filterAndMapInPlace
structureFilterAndMapInPlace Source #
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> StructureFilterMapFunc |
|
-> m () |
Calls the provided function once for each field in the Structure
. In
contrast to structureForeach
, the function may modify the fields.
In contrast to structureMapInPlace
, the field is removed from
the structure if False
is returned from the function.
The structure must be mutable.
Since: 1.6
fixate
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> m () |
Fixate all values in structure
using valueFixate
.
structure
will be modified in-place and should be writable.
fixateField
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m Bool | Returns: |
Fixates a Structure
by changing the given field with its fixated value.
fixateFieldBoolean
structureFixateFieldBoolean Source #
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> Bool |
|
-> m Bool | Returns: |
Fixates a Structure
by changing the given fieldName
field to the given
target
boolean if that field is not fixed yet.
fixateFieldNearestDouble
structureFixateFieldNearestDouble Source #
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> Double |
|
-> m Bool | Returns: |
Fixates a Structure
by changing the given field to the nearest
double to target
that is a subset of the existing field.
fixateFieldNearestFraction
structureFixateFieldNearestFraction Source #
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> Int32 |
|
-> Int32 |
|
-> m Bool | Returns: |
Fixates a Structure
by changing the given field to the nearest
fraction to targetNumerator
/targetDenominator
that is a subset
of the existing field.
fixateFieldNearestInt
structureFixateFieldNearestInt Source #
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> Int32 |
|
-> m Bool | Returns: |
Fixates a Structure
by changing the given field to the nearest
integer to target
that is a subset of the existing field.
fixateFieldString
structureFixateFieldString Source #
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> Text |
|
-> m Bool | Returns: |
Fixates a Structure
by changing the given fieldName
field to the given
target
string if that field is not fixed yet.
foreach
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> StructureForeachFunc |
|
-> m Bool | Returns: |
Calls the provided function once for each field in the Structure
. The
function must not modify the fields. Also see structureMapInPlace
and structureFilterAndMapInPlace
.
free
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> m () |
Frees a Structure
and all its fields and values. The structure must not
have a parent when this function is called.
fromString
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Structure, Text) | Returns: a new |
getArray
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m (Bool, ValueArray) | Returns: |
This is useful in language bindings where unknown Value
types are not
supported. This function will convert the GST_TYPE_ARRAY
into a newly
allocated ValueArray
and return it through array
. Be aware that this is
slower then getting the Value
directly.
Since: 1.12
getBoolean
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m (Bool, Bool) | Returns: |
Sets the boolean pointed to by value
corresponding to the value of the
given field. Caller is responsible for making sure the field exists
and has the correct type.
getClockTime
structureGetClockTime Source #
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m (Bool, Word64) | Returns: |
Sets the clock time pointed to by value
corresponding to the clock time
of the given field. Caller is responsible for making sure the field exists
and has the correct type.
getDate
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m (Bool, Date) | Returns: |
Sets the date pointed to by value
corresponding to the date of the
given field. Caller is responsible for making sure the field exists
and has the correct type.
On success value
will point to a newly-allocated copy of the date which
should be freed with dateFree
when no longer needed (note: this is
inconsistent with e.g. structureGetString
which doesn't return a
copy of the string).
getDateTime
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m (Bool, DateTime) | Returns: |
Sets the datetime pointed to by value
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 dateTimeUnref
when no longer needed
(note: this is inconsistent with e.g. structureGetString
which doesn't return a copy of the string).
getDouble
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m (Bool, Double) | Returns: |
Sets the double pointed to by value
corresponding to the value of the
given field. Caller is responsible for making sure the field exists
and has the correct type.
getEnum
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> GType |
|
-> m (Bool, Int32) | Returns: |
Sets the int pointed to by value
corresponding to the value of the
given field. Caller is responsible for making sure the field exists,
has the correct type and that the enumtype is correct.
getFieldType
structureGetFieldType Source #
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m GType | Returns: the |
Finds the field with the given name, and returns the type of the value it contains. If the field is not found, G_TYPE_INVALID is returned.
getFlagset
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m (Bool, Word32, Word32) | Returns: |
Read the GstFlagSet flags and mask out of the structure into the provided pointers.
Since: 1.6
getFraction
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m (Bool, Int32, Int32) | Returns: |
Sets the integers pointed to by valueNumerator
and valueDenominator
corresponding to the value of the given field. Caller is responsible
for making sure the field exists and has the correct type.
getInt
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m (Bool, Int32) | Returns: |
Sets the int pointed to by value
corresponding to the value of the
given field. Caller is responsible for making sure the field exists
and has the correct type.
getInt64
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m (Bool, Int64) | Returns: |
Sets the gint64
pointed to by value
corresponding to the value of the
given field. Caller is responsible for making sure the field exists
and has the correct type.
Since: 1.4
getList
getName
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> m Text | Returns: the name of the structure. |
Get the name of structure
as a string.
getNameId
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> m Word32 | Returns: the quark representing the name of the structure. |
Get the name of structure
as a GQuark.
getString
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m (Maybe Text) | Returns: a pointer to the string or |
Finds the field corresponding to fieldname
, and returns the string
contained in the field's value. Caller is responsible for making
sure the field exists and has the correct type.
The string should not be modified, and remains valid until the next call to a gst_structure_*() function with the given structure.
getUint
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m (Bool, Word32) | Returns: |
Sets the uint pointed to by value
corresponding to the value of the
given field. Caller is responsible for making sure the field exists
and has the correct type.
getUint64
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m (Bool, Word64) | Returns: |
Sets the guint64
pointed to by value
corresponding to the value of the
given field. Caller is responsible for making sure the field exists
and has the correct type.
Since: 1.4
getValue
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m (Maybe GValue) | Returns: the |
Get the value of the field with name fieldname
.
hasField
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m Bool | Returns: |
Check if structure
contains a field named fieldname
.
hasFieldTyped
structureHasFieldTyped Source #
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> GType |
|
-> m Bool | Returns: |
Check if structure
contains a field named fieldname
and with GType type
.
hasName
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m Bool | Returns: |
Checks if the structure has the given name
idGetValue
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Word32 |
|
-> m (Maybe GValue) | Returns: the |
Get the value of the field with GQuark field
.
idHasField
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Word32 |
|
-> m Bool | Returns: |
Check if structure
contains a field named field
.
idHasFieldTyped
structureIdHasFieldTyped Source #
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Word32 |
|
-> GType |
|
-> m Bool | Returns: |
Check if structure
contains a field named field
and with GType type
.
idSetValue
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Word32 |
|
-> GValue |
|
-> m () |
Sets the field with the given GQuark field
to value
. If the field
does not exist, it is created. If the field exists, the previous
value is replaced and freed.
idTakeValue
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Word32 |
|
-> GValue |
|
-> m () |
Sets the field with the given GQuark field
to value
. If the field
does not exist, it is created. If the field exists, the previous
value is replaced and freed.
intersect
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Structure |
|
-> m (Maybe Structure) | Returns: Intersection of |
Intersects struct1
and struct2
and returns the intersection.
isEqual
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Structure |
|
-> m Bool | Returns: |
Tests if the two Structure
are equal.
isSubset
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Structure |
|
-> m Bool | Returns: |
Checks if subset
is a subset of superset
, i.e. has the same
structure name and for all fields that are existing in superset
,
subset
has a value that is a subset of the value in superset
.
mapInPlace
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> StructureMapFunc |
|
-> m Bool | Returns: |
Calls the provided function once for each field in the Structure
. In
contrast to structureForeach
, the function may modify but not delete the
fields. The structure must be mutable.
nFields
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> m Int32 | Returns: the number of fields in the structure |
Get the number of fields in the structure.
newEmpty
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Structure | Returns: a new, empty |
Creates a new, empty Structure
with the given name
.
See structureSetName
for constraints on the name
parameter.
Free-function: gst_structure_free
newFromString
structureNewFromString Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Structure) | Returns: a new |
Creates a Structure
from a string representation.
If end is not Nothing
, 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 Caps
/ Structure
deeper than one level unless
the structureSerialize
function is used (without
GST_SERIALIZE_FLAG_BACKWARD_COMPAT
)
Free-function: gst_structure_free
Since: 1.2
newIdEmpty
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> m Structure | Returns: a new, empty |
Creates a new, empty Structure
with the given name as a GQuark.
Free-function: gst_structure_free
nthFieldName
structureNthFieldName Source #
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Word32 |
|
-> m Text | Returns: the name of the given field number |
Get the name of the given field number, counting from 0 onwards.
removeAllFields
structureRemoveAllFields Source #
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> m () |
Removes all fields in a GstStructure.
removeField
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m () |
Removes the field with the given name. If the field with the given name does not exist, the structure is unchanged.
serialize
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> [SerializeFlags] |
|
-> m Text | Returns: a pointer to string allocated by |
Converts 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
as flag
.
Free-function: g_free
Since: 1.20
setArray
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> ValueArray |
|
-> m () |
This is useful in language bindings where unknown GValue types are not
supported. This function will convert a array
to GST_TYPE_ARRAY
and set
the field specified by fieldname
. Be aware that this is slower then using
GST_TYPE_ARRAY
in a Value
directly.
Since: 1.12
setList
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> ValueArray |
|
-> m () |
This is useful in language bindings where unknown GValue types are not
supported. This function will convert a array
to GST_TYPE_LIST
and set
the field specified by fieldname
. Be aware that this is slower then using
GST_TYPE_LIST
in a Value
directly.
Since: 1.12
setName
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> m () |
Sets the name of the structure to the given name
. 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 "/-_.:".
setParentRefcount
setValue
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> GValue |
|
-> m () |
Sets the field with the given name field
to value
. If the field
does not exist, it is created. If the field exists, the previous
value is replaced and freed.
takeValue
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> Text |
|
-> GValue |
|
-> m () |
Sets the field with the given name field
to value
. 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 of value
.
toString
:: (HasCallStack, MonadIO m) | |
=> Structure |
|
-> m Text | Returns: a pointer to string allocated by |
Converts structure
to a human-readable string representation.
For debugging purposes its easier to do something like this: === C code > GST_LOG ("structure is %" GST_PTR_FORMAT, structure);
This prints the structure in human readable form.
This function will lead to unexpected results when there are nested Caps
/ Structure
deeper than one level, you should user
structureSerialize
instead for those cases.
Free-function: g_free
Properties
type
the GType of a structure
getStructureType :: MonadIO m => Structure -> m GType Source #
Get the value of the “type
” field.
When overloading is enabled, this is equivalent to
get
structure #type
setStructureType :: MonadIO m => Structure -> GType -> m () Source #
Set the value of the “type
” field.
When overloading is enabled, this is equivalent to
set
structure [ #type:=
value ]