From: Sebastian Dröge Date: Thu, 14 Apr 2011 13:59:28 +0000 (+0200) Subject: parse: Add boxed type for GstParseContext for gobject-introspection X-Git-Tag: RELEASE-0.10.33~56 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2d7c81f1d74d6e5a109b6aef636919ab18e664e6;p=platform%2Fupstream%2Fgstreamer.git parse: Add boxed type for GstParseContext for gobject-introspection --- diff --git a/gst/gst.c b/gst/gst.c index adf2239..0e7ac8c 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -758,6 +758,7 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data, _gst_buffer_list_initialize (); _gst_message_initialize (); _gst_tag_initialize (); + gst_parse_context_get_type (); _gst_plugin_initialize (); diff --git a/gst/gstparse.c b/gst/gstparse.c index cc420ab..80a169e 100644 --- a/gst/gstparse.c +++ b/gst/gstparse.c @@ -44,6 +44,42 @@ #include "parse/types.h" #endif +static void +_prepend_missing_element (gchar * element, GList ** list) +{ + *list = g_list_prepend (*list, g_strdup (element)); +} + +static GstParseContext * +gst_parse_context_copy (const GstParseContext * context) +{ + GstParseContext *ret = NULL; +#ifndef GST_DISABLE_PARSE + + ret = gst_parse_context_new (); + if (context) { + g_list_foreach (context->missing_elements, (GFunc) _prepend_missing_element, + &ret->missing_elements); + ret->missing_elements = g_list_reverse (ret->missing_elements); + } +#endif + return ret; +} + +GType +gst_parse_context_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) { + type = g_boxed_type_register_static ("GstParseContext", + (GBoxedCopyFunc) gst_parse_context_copy, + (GBoxedFreeFunc) gst_parse_context_free); + } + + return type; +} + /** * gst_parse_error_quark: * diff --git a/gst/gstparse.h b/gst/gstparse.h index b4a9e96..a0f27b3 100644 --- a/gst/gstparse.h +++ b/gst/gstparse.h @@ -75,6 +75,8 @@ typedef enum GST_PARSE_FLAG_FATAL_ERRORS = (1 << 0) } GstParseFlags; +#define GST_TYPE_PARSE_CONTEXT (gst_parse_context_get_type()) + /** * GstParseContext: * @@ -86,6 +88,7 @@ typedef struct _GstParseContext GstParseContext; /* create, process and free a parse context */ +GType gst_parse_context_get_type (void); GstParseContext * gst_parse_context_new (void); gchar ** gst_parse_context_get_missing_elements (GstParseContext * context);