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.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 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 and send a GST_EVENT_CONTEXT event downstream, containing the complete context information at this time.

Applications should catch the GST_MESSAGE_HAVE_CONTEXT messages and remember any content from it unless it has a custom version of a specific context. If later an element is posting a GST_MESSAGE_NEED_CONTEXT message for a specific context that was created by an element before, the application should pass it to the element or the complete pipeline.