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.
- get_task_pool()[source]¶
- Returns:
Trueif a task pool was set on self- pool:
- Return type:
(
bool, pool:Gst.TaskPoolorNone)
Gets the task pool from self.
New in version 1.28.
- 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.
- is_writable()[source]¶
- Return type:
Tests if you can safely modify self. It is only safe to modify context when there is only one owner of the context - ie, the object is writable.
- make_writable()[source]¶
- Returns:
a writable context which may or may not be the same as self
- Return type:
Returns a writable copy of self.
If there is only one reference count on self, the caller must be the owner, and so this function will return the context object unchanged. If on the other hand there is more than one reference on the object, a new context object will be returned. The caller’s reference on self will be removed, and instead the caller will own a reference to the returned object.
In short, this function unrefs the context in the argument and refs the context that it returns. Don’t access the argument after calling this function. See also:
Gst.Context.ref().
- 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.
- set_task_pool(pool)[source]¶
- Parameters:
pool (
Gst.TaskPoolorNone) – aGst.TaskPoolorNoneto unset
Sets pool on self as the task pool to be shared between elements. If pool is
None, any previously set task pool will be removed from the context.New in version 1.28.
- 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.