/**
* SECTION:gstcontext
+ * @title: GstContext
* @short_description: Lightweight objects to represent element contexts
* @see_also: #GstMiniObject, #GstElement
*
*
* 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()
+ * 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
- * 2) Query upstream with GST_QUERY_CONTEXT for the context
- * 3) Post a GST_MESSAGE_NEED_CONTEXT message on the bus with the required
+ * 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
- * 4) Create a context by itself and post a GST_MESSAGE_HAVE_CONTEXT message
+ * 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<!-- -->s 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.
+ *
* Since: 1.2
*/
#define GST_CONTEXT_STRUCTURE(c) (((GstContext *)(c))->structure)
-static GType _gst_context_type = 0;
+GType _gst_context_type = 0;
GST_DEFINE_MINI_OBJECT_TYPE (GstContext, gst_context);
void
}
g_free (context->context_type);
+#ifdef USE_POISONING
+ memset (context, 0xff, sizeof (GstContext));
+#endif
+
g_slice_free1 (sizeof (GstContext), context);
}
/**
* gst_context_new:
+ * @context_type: Context type
* @persistent: Persistent context
*
* Create a new context.
* Get a writable version of the structure.
*
* Returns: The structure of the context. The structure is still
- * owned by the event, which means that you should not free it and
- * that the pointer becomes invalid when you free the event.
+ * 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
gboolean
gst_context_is_persistent (const GstContext * context)
{
- g_return_val_if_fail (GST_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (GST_IS_CONTEXT (context), FALSE);
return context->persistent;
}