X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gst%2Fgstcontext.c;h=c1bbe0a8bea1698a208ec0d290f9e186ef5b48f6;hb=37edc474e3dc292d53e64f9415536da1741ecede;hp=60b99e774c0e0162254a3077c7e573360b5d3506;hpb=291991dac253505cb8b5f1b9c40939d4e831004c;p=platform%2Fupstream%2Fgstreamer.git diff --git a/gst/gstcontext.c b/gst/gstcontext.c index 60b99e7..c1bbe0a 100644 --- a/gst/gstcontext.c +++ b/gst/gstcontext.c @@ -23,6 +23,7 @@ /** * SECTION:gstcontext + * @title: GstContext * @short_description: Lightweight objects to represent element contexts * @see_also: #GstMiniObject, #GstElement * @@ -32,23 +33,29 @@ * * 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. * + * #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. + * * Since: 1.2 */ @@ -68,7 +75,7 @@ struct _GstContext #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 @@ -101,6 +108,10 @@ _gst_context_free (GstContext * context) } g_free (context->context_type); +#ifdef USE_POISONING + memset (context, 0xff, sizeof (GstContext)); +#endif + g_slice_free1 (sizeof (GstContext), context); } @@ -141,6 +152,7 @@ gst_context_init (GstContext * context) /** * gst_context_new: + * @context_type: Context type * @persistent: Persistent context * * Create a new context. @@ -238,8 +250,8 @@ gst_context_get_structure (const GstContext * 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 @@ -266,7 +278,7 @@ gst_context_writable_structure (GstContext * context) 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; }