Context
Object Hierarchy:
Description:
[ CCode ( ref_function = "gst_context_ref" , type_id = "gst_context_get_type ()" , unref_function = "gst_context_unref" ) ]
[ Compact ]
[ Version ( since = "1.2" ) ]
public class Context
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 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:
- Check if the element already has a context
- Query downstream with gst_query_context for the context
- Query upstream with gst_query_context for the context
- 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
- 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.
Context can be persistent. A persistent 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.
Content:
Static methods:
- public static bool replace (ref Context old_context, Context? new_context)
Creation methods:
Methods:
- public unowned Context @ref ()
Convenience macro to increase the reference count of the context.
- public Context copy ()
Creates a copy of the context.
- public unowned string get_context_type ()
Gets the type of this.
- public unowned Structure get_structure ()
Accesses the structure of the context.
- public bool has_context_type (string context_type)
Checks if this has
context_type.
- public bool is_persistent ()
Checks if this is persistent.
- public void unref ()
Convenience macro to decrease the reference count of the context,
possibly freeing it.
- public unowned Structure writable_structure ()
Gets a writable version of the structure.