Gst.Context

Fields

None

Methods

class new (context_type, persistent)
  get_context_type ()
  get_structure ()
  has_context_type (context_type)
  is_persistent ()
  writable_structure ()

Details

class Gst.Context

Gst.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 Gst.Element.set_context(), which will then be propagated to all child elements. Elements can handle these in Gst.Element.do_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.CONTEXT for the context

Query upstream with Gst.QueryType.CONTEXT for the context

Post a Gst.MessageType.NEED_CONTEXT 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 Gst.MessageType.HAVE_CONTEXT message on the bus.

Bins will catch Gst.MessageType.NEED_CONTEXT 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.

Gst.Context s can be persistent. A persistent Gst.Context is kept in elements when they reach Gst.State.NULL, non-persistent ones will be removed. Also, a non-persistent context won’t override a previous persistent context set to an element.

classmethod new(context_type, persistent)[source]
Parameters:
  • context_type (str) – Context type
  • persistent (bool) – Persistent context
Returns:

The new context.

Return type:

Gst.Context

Create a new context.

New in version 1.2.

get_context_type()[source]
Returns:The type of the context.
Return type:str

Get 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:Gst.Structure

Access 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:True if self has context_type.
Return type:bool

Checks if self has context_type.

New in version 1.2.

is_persistent()[source]
Returns:True if the context is persistent.
Return type:bool

Check if self is persistent.

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:Gst.Structure

Get a writable version of the structure.

New in version 1.2.