From f322740ef9fd2839ce0e6a2248d48c618a5bf0cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 20 May 2017 19:42:51 +0300 Subject: [PATCH] parse: Make gst_parse_context_copy() public for bindings --- docs/gst/gstreamer-sections.txt | 1 + gst/gstparse.c | 48 +++++++++++++++++++-------------- gst/gstparse.h | 3 +++ win32/common/libgstreamer.def | 1 + 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 2efe9d216f..190570b06a 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -2247,6 +2247,7 @@ gst_parse_bin_from_description gst_parse_bin_from_description_full gst_parse_context_new +gst_parse_context_copy gst_parse_context_free gst_parse_context_get_missing_elements diff --git a/gst/gstparse.c b/gst/gstparse.c index 4838d5c9a5..f1f0c22679 100644 --- a/gst/gstparse.c +++ b/gst/gstparse.c @@ -45,26 +45,6 @@ #include "parse/types.h" #endif -static GstParseContext * -gst_parse_context_copy (const GstParseContext * context) -{ - GstParseContext *ret = NULL; -#ifndef GST_DISABLE_PARSE - - ret = gst_parse_context_new (); - if (context) { - GQueue missing_copy = G_QUEUE_INIT; - GList *l; - - for (l = context->missing_elements; l != NULL; l = l->next) - g_queue_push_tail (&missing_copy, g_strdup ((const gchar *) l->data)); - - ret->missing_elements = missing_copy.head; - } -#endif - return ret; -} - G_DEFINE_BOXED_TYPE (GstParseContext, gst_parse_context, (GBoxedCopyFunc) gst_parse_context_copy, (GBoxedFreeFunc) gst_parse_context_free); @@ -113,6 +93,34 @@ gst_parse_context_new (void) #endif } +/** + * gst_parse_context_copy: + * @context: a #GstParseContext + * + * Copies the @context. + * + * Returns: (transfer full): A copied #GstParseContext + */ +GstParseContext * +gst_parse_context_copy (const GstParseContext * context) +{ + GstParseContext *ret = NULL; +#ifndef GST_DISABLE_PARSE + + ret = gst_parse_context_new (); + if (context) { + GQueue missing_copy = G_QUEUE_INIT; + GList *l; + + for (l = context->missing_elements; l != NULL; l = l->next) + g_queue_push_tail (&missing_copy, g_strdup ((const gchar *) l->data)); + + ret->missing_elements = missing_copy.head; + } +#endif + return ret; +} + /** * gst_parse_context_free: * @context: (transfer full): a #GstParseContext diff --git a/gst/gstparse.h b/gst/gstparse.h index 2d80f86d2a..3b14da7e71 100644 --- a/gst/gstparse.h +++ b/gst/gstparse.h @@ -108,6 +108,9 @@ gchar ** gst_parse_context_get_missing_elements (GstParseContext * cont GST_EXPORT void gst_parse_context_free (GstParseContext * context); +GST_EXPORT +GstParseContext * gst_parse_context_copy (const GstParseContext * context); + /* parse functions */ diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def index 3fe1b4619d..76d05a747f 100644 --- a/win32/common/libgstreamer.def +++ b/win32/common/libgstreamer.def @@ -978,6 +978,7 @@ EXPORTS gst_parent_buffer_meta_get_info gst_parse_bin_from_description gst_parse_bin_from_description_full + gst_parse_context_copy gst_parse_context_free gst_parse_context_get_missing_elements gst_parse_context_get_type