Class (GI Struct)

Gst-1.0GstContextSince 1.2

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.ElementClass.SignalSignatures.set_context | Gst.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:

  1. Check if the element already has a context
  2. Query downstream with Gst.QueryType.CONTEXT for the context
  3. Query upstream with Gst.QueryType.CONTEXT for the context
  4. 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
  5. 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 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.

1.2

Index

Constructors

Properties

$gtype: GType<Gst.Context>

Methods

  • Accesses the structure of the context.

    Returns Structure

    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.

  • Checks if context has context_type.

    Parameters

    • context_type: string

      Context type to check.

    Returns boolean

    true if context has context_type.

  • Checks if context is persistent.

    Returns boolean

    true if the context is persistent.

  • Tests if you can safely modify context. It is only safe to modify context when there is only one owner of the context - ie, the object is writable.

    Returns boolean

  • Returns a writable copy of context.

    If there is only one reference count on context, 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 context 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().

    Returns Gst.Context

    a writable context which may or may not be the same as context

  • Sets pool on context as the task pool to be shared between elements. If pool is null, any previously set task pool will be removed from the context.

    Parameters

    Returns void

  • Convenience macro to decrease the reference count of the context, possibly freeing it.

    Returns void

  • Gets a writable version of the structure.

    Returns Structure

    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 context is writable.

  • Modifies a pointer to a Gst.Context to point to a different Gst.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.Context pointed to by old_context may be null.

    Parameters

    Returns [boolean, Gst.Context]