GstContext

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 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.

GstContexts 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.

GstContext


Gst.Context


Gst.Context


Constructors

gst_context_new

GstContext *
gst_context_new (const gchar * context_type,
                 gboolean persistent)

Create a new context.

Parameters:

context_type

Context type

persistent

Persistent context

Returns ( [transfer: full] ) –

The new context.

Since : 1.2


Gst.Context.new

def Gst.Context.new (context_type, persistent):
    #python wrapper for 'gst_context_new'

Create a new context.

Parameters:

context_type ( str ) –

Context type

persistent ( bool ) –

Persistent context

Returns ( Gst.Context ) –

The new context.

Since : 1.2


Gst.Context.prototype.new

function Gst.Context.prototype.new(context_type: String, persistent: Number): {
    // javascript wrapper for 'gst_context_new'
}

Create a new context.

Parameters:

context_type ( String ) –

Context type

persistent ( Number ) –

Persistent context

Returns ( Gst.Context ) –

The new context.

Since : 1.2


Methods

gst_context_get_context_type

const gchar *
gst_context_get_context_type (const GstContext * context)

Get the type of context.

Parameters:

context

The GstContext.

Returns

The type of the context.

Since : 1.2


Gst.Context.get_context_type

def Gst.Context.get_context_type (self):
    #python wrapper for 'gst_context_get_context_type'

Get the type of context.

Parameters:

context ( Gst.Context ) –

The Gst.Context.

Returns ( str ) –

The type of the context.

Since : 1.2


Gst.Context.prototype.get_context_type

function Gst.Context.prototype.get_context_type(): {
    // javascript wrapper for 'gst_context_get_context_type'
}

Get the type of context.

Parameters:

context ( Gst.Context ) –

The Gst.Context.

Returns ( String ) –

The type of the context.

Since : 1.2


gst_context_get_structure

const GstStructure *
gst_context_get_structure (const GstContext * context)

Access the structure of the context.

Parameters:

context

The GstContext.

Returns ( [transfer: none] ) –

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.

Since : 1.2


Gst.Context.get_structure

def Gst.Context.get_structure (self):
    #python wrapper for 'gst_context_get_structure'

Access the structure of the context.

Parameters:

context ( Gst.Context ) –

The Gst.Context.

Returns ( Gst.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.

Since : 1.2


Gst.Context.prototype.get_structure

function Gst.Context.prototype.get_structure(): {
    // javascript wrapper for 'gst_context_get_structure'
}

Access the structure of the context.

Parameters:

context ( Gst.Context ) –

The Gst.Context.

Returns ( Gst.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.

Since : 1.2


gst_context_has_context_type

gboolean
gst_context_has_context_type (const GstContext * context,
                              const gchar * context_type)

Checks if context has context_type.

Parameters:

context

The GstContext.

context_type

Context type to check.

Returns

TRUE if context has context_type.

Since : 1.2


Gst.Context.has_context_type

def Gst.Context.has_context_type (self, context_type):
    #python wrapper for 'gst_context_has_context_type'

Checks if context has context_type.

Parameters:

context ( Gst.Context ) –

The Gst.Context.

context_type ( str ) –

Context type to check.

Returns ( bool ) –

True if context has context_type.

Since : 1.2


Gst.Context.prototype.has_context_type

function Gst.Context.prototype.has_context_type(context_type: String): {
    // javascript wrapper for 'gst_context_has_context_type'
}

Checks if context has context_type.

Parameters:

context ( Gst.Context ) –

The Gst.Context.

context_type ( String ) –

Context type to check.

Returns ( Number ) –

true if context has context_type.

Since : 1.2


gst_context_is_persistent

gboolean
gst_context_is_persistent (const GstContext * context)

Check if context is persistent.

Parameters:

context

The GstContext.

Returns

TRUE if the context is persistent.

Since : 1.2


Gst.Context.is_persistent

def Gst.Context.is_persistent (self):
    #python wrapper for 'gst_context_is_persistent'

Check if context is persistent.

Parameters:

context ( Gst.Context ) –

The Gst.Context.

Returns ( bool ) –

True if the context is persistent.

Since : 1.2


Gst.Context.prototype.is_persistent

function Gst.Context.prototype.is_persistent(): {
    // javascript wrapper for 'gst_context_is_persistent'
}

Check if context is persistent.

Parameters:

context ( Gst.Context ) –

The Gst.Context.

Returns ( Number ) –

true if the context is persistent.

Since : 1.2


gst_context_writable_structure

GstStructure *
gst_context_writable_structure (GstContext * context)

Get a writable version of the structure.

Parameters:

context

The GstContext.

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

Since : 1.2


Gst.Context.writable_structure

def Gst.Context.writable_structure (self):
    #python wrapper for 'gst_context_writable_structure'

Get a writable version of the structure.

Parameters:

context ( Gst.Context ) –

The Gst.Context.

Returns ( Gst.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.

Since : 1.2


Gst.Context.prototype.writable_structure

function Gst.Context.prototype.writable_structure(): {
    // javascript wrapper for 'gst_context_writable_structure'
}

Get a writable version of the structure.

Parameters:

context ( Gst.Context ) –

The Gst.Context.

Returns ( Gst.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.

Since : 1.2


Function Macros

GST_CONTEXT

#define GST_CONTEXT(obj)                         (GST_CONTEXT_CAST(obj))

GST_CONTEXT_CAST

#define GST_CONTEXT_CAST(obj)                    ((GstContext*)(obj))

GST_IS_CONTEXT

#define GST_IS_CONTEXT(obj)                      (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_CONTEXT))

gst_context_is_writable

#define gst_context_is_writable(context)     gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (context))

Tests if you can safely write into a context's structure or validly modify the seqnum and timestamp fields.

Parameters:

context

a GstContext


gst_context_make_writable

#define gst_context_make_writable(context)  GST_CONTEXT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (context)))

Checks if a context is writable. If not, a writable copy is made and returned.

Parameters:

context ( [transfer: full] ) –

the context to make writable

Returns ( [transfer: full] ) –

a context (possibly a duplicate) that is writable.

MT safe


Constants

GST_TYPE_CONTEXT

#define GST_TYPE_CONTEXT                         (_gst_context_type)

The results of the search are