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 |
Context
is a container object used to store contexts like a device
context, a display server connection and similar concepts that should
be shared between multiple elements.
Applications can set a context on a complete pipeline by using
elementSetContext
, which will then be propagated to all
child elements. Elements can handle these in ElementClass
::set_context
and merge them with the context information they already have.
When an element needs a context it will do the following actions in this order until one step succeeds:
- Check if the element already has a context
- Query downstream with
QueryTypeContext
for the context - Query upstream with
QueryTypeContext
for the context - Post a
MessageTypeNeedContext
message on the bus with the required context types and afterwards check if a usable context was set now - Create a context by itself and post a
MessageTypeHaveContext
message on the bus.
Bins will catch MessageTypeNeedContext
messages and will set any previously
known context on the element that asks for it if possible. Otherwise the
application should provide one if it can.
Context
can be persistent.
A persistent Context
is kept in elements when they reach
StateNull
, non-persistent ones will be removed.
Also, a non-persistent context won't override a previous persistent
context set to an element.
Since: 1.2
Synopsis
- newtype Context = Context (ManagedPtr Context)
- contextGetContextType :: (HasCallStack, MonadIO m) => Context -> m Text
- contextGetStructure :: (HasCallStack, MonadIO m) => Context -> m Structure
- contextHasContextType :: (HasCallStack, MonadIO m) => Context -> Text -> m Bool
- contextIsPersistent :: (HasCallStack, MonadIO m) => Context -> m Bool
- contextNew :: (HasCallStack, MonadIO m) => Text -> Bool -> m Context
- contextWritableStructure :: (HasCallStack, MonadIO m) => Context -> m Structure
Exported types
Memory-managed wrapper type.
Instances
Eq Context Source # | |
GBoxed Context Source # | |
Defined in GI.Gst.Structs.Context | |
ManagedPtrNewtype Context Source # | |
Defined in GI.Gst.Structs.Context toManagedPtr :: Context -> ManagedPtr Context | |
TypedObject Context Source # | |
Defined in GI.Gst.Structs.Context | |
HasParentTypes Context Source # | |
Defined in GI.Gst.Structs.Context | |
IsGValue (Maybe Context) Source # | Convert |
Defined in GI.Gst.Structs.Context gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Context -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Context) | |
type ParentTypes Context Source # | |
Defined in GI.Gst.Structs.Context |
Methods
Click to display all available methods, including inherited ones
getContextType
contextGetContextType Source #
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> m Text | Returns: The type of the context. |
Gets the type of context
.
Since: 1.2
getStructure
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> m Structure | Returns: The structure of the context. The structure is still owned by the context, which means that you should not modify it, free it and that the pointer becomes invalid when you free the context. |
Accesses the structure of the context.
Since: 1.2
hasContextType
contextHasContextType Source #
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> Text |
|
-> m Bool | Returns: |
Checks if context
has contextType
.
Since: 1.2
isPersistent
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> m Bool | Returns: |
Checks if context
is persistent.
Since: 1.2
new
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Bool |
|
-> m Context | Returns: The new context. |
Creates a new context.
Since: 1.2
writableStructure
contextWritableStructure Source #
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> m Structure | Returns: The structure of the context. The structure is still
owned by the context, which means that you should not free it and
that the pointer becomes invalid when you free the context.
This function checks if |
Gets a writable version of the structure.
Since: 1.2