parse: Make gst_parse_context_copy() public for bindings

This commit is contained in:
Sebastian Dröge 2017-05-20 19:42:51 +03:00
parent 9f05e66154
commit f322740ef9
4 changed files with 33 additions and 20 deletions

View file

@ -2247,6 +2247,7 @@ gst_parse_bin_from_description
gst_parse_bin_from_description_full gst_parse_bin_from_description_full
<SUBSECTION> <SUBSECTION>
gst_parse_context_new gst_parse_context_new
gst_parse_context_copy
gst_parse_context_free gst_parse_context_free
gst_parse_context_get_missing_elements gst_parse_context_get_missing_elements
<SUBSECTION Standard> <SUBSECTION Standard>

View file

@ -45,26 +45,6 @@
#include "parse/types.h" #include "parse/types.h"
#endif #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, G_DEFINE_BOXED_TYPE (GstParseContext, gst_parse_context,
(GBoxedCopyFunc) gst_parse_context_copy, (GBoxedCopyFunc) gst_parse_context_copy,
(GBoxedFreeFunc) gst_parse_context_free); (GBoxedFreeFunc) gst_parse_context_free);
@ -113,6 +93,34 @@ gst_parse_context_new (void)
#endif #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: * gst_parse_context_free:
* @context: (transfer full): a #GstParseContext * @context: (transfer full): a #GstParseContext

View file

@ -108,6 +108,9 @@ gchar ** gst_parse_context_get_missing_elements (GstParseContext * cont
GST_EXPORT GST_EXPORT
void gst_parse_context_free (GstParseContext * context); void gst_parse_context_free (GstParseContext * context);
GST_EXPORT
GstParseContext * gst_parse_context_copy (const GstParseContext * context);
/* parse functions */ /* parse functions */

View file

@ -978,6 +978,7 @@ EXPORTS
gst_parent_buffer_meta_get_info gst_parent_buffer_meta_get_info
gst_parse_bin_from_description gst_parse_bin_from_description
gst_parse_bin_from_description_full gst_parse_bin_from_description_full
gst_parse_context_copy
gst_parse_context_free gst_parse_context_free
gst_parse_context_get_missing_elements gst_parse_context_get_missing_elements
gst_parse_context_get_type gst_parse_context_get_type