Gst.Context¶
Fields¶
None
Methods¶
class |
|
class |
|
|
|
|
|
|
|
|
|
Details¶
- class Gst.Context¶
Gst.Contextis 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
Gst.Element.set_context(), which will then be propagated to all child elements. Elements can handle these in #GstElementClass::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
Gst.QueryType.CONTEXTfor the contextQuery upstream with
Gst.QueryType.CONTEXTfor the contextPost a
Gst.MessageType.NEED_CONTEXTmessage on the bus with the required context types and afterwards check if a usable context was set nowCreate a context by itself and post a
Gst.MessageType.HAVE_CONTEXTmessage on the bus.Bins will catch
Gst.MessageType.NEED_CONTEXTmessages 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.Gst.Contextcan be persistent. A persistentGst.Contextis kept in elements when they reachGst.State.NULL, non-persistent ones will be removed. Also, a non-persistent context won’t override a previous persistent context set to an element.New in version 1.2.
- classmethod new(context_type, persistent)[source]¶
- Parameters:
- Returns:
The new context.
- Return type:
Creates a new context.
New in version 1.2.
- classmethod replace(old_context, new_context)[source]¶
- Parameters:
old_context (
Gst.Context) – pointer to a pointer to aGst.Contextto be replaced.new_context (
Gst.ContextorNone) – pointer to aGst.Contextthat will replace the context pointed to by old_context.
- Returns:
Trueif new_context was different from old_context- old_context:
pointer to a pointer to a
Gst.Contextto be replaced.
- Return type:
(
bool, old_context:Gst.Context)
Modifies a pointer to a
Gst.Contextto point to a differentGst.Context. The modification is done atomically (so this is useful for ensuring thread safety in some cases), and the reference counts are updated appropriately (the old context is unreffed, the new one is reffed).Either new_context or the
Gst.Contextpointed to by old_context may beNone.New in version 1.2.
- copy()[source]¶
- Returns:
a new copy of self.
MT safe
- Return type:
Creates a copy of the context. Returns a copy of the context.
New in version 1.2.
- get_context_type()[source]¶
- Returns:
The type of the context.
- Return type:
Gets the type of self.
New in version 1.2.
- get_structure()[source]¶
- 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.
- Return type:
Accesses the structure of the context.
New in version 1.2.
- has_context_type(context_type)[source]¶
- Parameters:
context_type (
str) – Context type to check.- Returns:
Trueif self has context_type.- Return type:
Checks if self has context_type.
New in version 1.2.
- ref()[source]¶
- Returns:
self (for convenience when doing assignments)
- Return type:
Convenience macro to increase the reference count of the context.
New in version 1.2.
- unref()[source]¶
Convenience macro to decrease the reference count of the context, possibly freeing it.
New in version 1.2.
- writable_structure()[source]¶
- 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 self is writable.
- Return type:
Gets a writable version of the structure.
New in version 1.2.