Context

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 GstElement::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 2) Query upstream with GST_QUERY_CONTEXT for the context 3) 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 4) 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.

Constructors

this
this(GstContext* gstContext)

Sets our main struct and passes it to the parent class

this
this(string contextType, int persistent)

Create a new context. Since 1.2

Members

Functions

copy
Context copy()

Creates a copy of the context. Returns a copy of the context.

doref
Context doref()

Convenience macro to increase the reference count of the context.

getContextStruct
GstContext* getContextStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getContextType
string getContextType()

Get the type of context. Since 1.2

getStruct
void* getStruct()

the main Gtk struct as a void*

getStructure
Structure getStructure()

Access the structure of the context. Since 1.2

hasContextType
int hasContextType(string contextType)

Checks if context has context_type. Since 1.2

isPersistent
int isPersistent()

Check if context is persistent. Since 1.2

unref
void unref()

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

writableStructure
Structure writableStructure()

Get a writable version of the structure. Since 1.2

Static functions

replace
int replace(Context oldContext, Context newContext)

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.

Variables

gstContext
GstContext* gstContext;

the main Gtk struct

Meta