Gjsify LogoGjsify Logo

#GstContext 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 #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:

  1. Check if the element already has a context
  2. Query downstream with %GST_QUERY_CONTEXT for the context
  3. Query upstream with %GST_QUERY_CONTEXT for the context
  4. Post a %GST_MESSAGE_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_MESSAGE_HAVE_CONTEXT message on the bus.

Bins will catch %GST_MESSAGE_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.

#GstContext can be persistent. A persistent #GstContext 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.

record

Hierarchy

  • Context

Index

Constructors

  • new Context(context_type: string, persistent: boolean): Gst.Context

Properties

name: string

Methods

  • get_context_type(): string
  • has_context_type(context_type: string): boolean
  • Checks if context has context_type.

    Parameters

    • context_type: string

      Context type to check.

    Returns boolean

  • is_persistent(): boolean
  • unref(): void
  • new(context_type: string, persistent: boolean): Gst.Context
  • Modifies a pointer to a #GstContext to point to a different #GstContext. 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 #GstContext pointed to by old_context may be %NULL.

    Parameters

    • old_context: Gst.Context

      pointer to a pointer to a #GstContext to be replaced.

    • new_context: Gst.Context

      pointer to a #GstContext that will replace the context pointed to by old_context.

    Returns [boolean, Gst.Context]

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method