*
* Please note that these functions take several measures to create
* somewhat dynamic pipelines. Due to that such pipelines are not always
- * reuseable (set the state to NULL and back to PLAYING).
+ * reusable (set the state to NULL and back to PLAYING).
*/
#include "gst_private.h"
#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);
+
/**
* gst_parse_error_quark:
*
* Allocates a parse context for use with gst_parse_launch_full() or
* gst_parse_launchv_full().
*
- * Returns: a newly-allocated parse context. Free with gst_parse_context_free()
- * when no longer needed.
+ * Free-function: gst_parse_context_free
+ *
+ * Returns: (transfer full): a newly-allocated parse context. Free with
+ * gst_parse_context_free() when no longer needed.
*
* Since: 0.10.20
*/
/**
* gst_parse_context_free:
- * @context: a #GstParseContext
+ * @context: (transfer full): a #GstParseContext
*
* Frees a parse context previously allocated with gst_parse_context_new().
*
* or gst_parse_launchv_full(). Will only return results if an error code
* of %GST_PARSE_ERROR_NO_SUCH_ELEMENT was returned.
*
- * Returns: a NULL-terminated array of element factory name strings of
- * missing elements. Free with g_strfreev() when no longer needed.
+ * Returns: (transfer full) (array zero-terminated=1) (element-type gchar*): a
+ * NULL-terminated array of element factory name strings of missing
+ * elements. Free with g_strfreev() when no longer needed.
*
* Since: 0.10.20
*/
/**
* gst_parse_launchv:
- * @argv: null-terminated array of arguments
+ * @argv: (in) (array zero-terminated=1): null-terminated array of arguments
* @error: pointer to a #GError
*
* Create a new element based on command line syntax.
* @error will contain an error message if an erroneuos pipeline is specified.
* An error does not mean that the pipeline could not be constructed.
*
- * Returns: a new element on success and %NULL on failure.
+ * Returns: (transfer full): a new element on success and %NULL on failure.
*/
GstElement *
gst_parse_launchv (const gchar ** argv, GError ** error)
{
- return gst_parse_launchv_full (argv, NULL, 0, error);
+ return gst_parse_launchv_full (argv, NULL, GST_PARSE_FLAG_NONE, error);
}
/**
* gst_parse_launchv_full:
- * @argv: null-terminated array of arguments
- * @context: a parse context allocated with gst_parse_context_new(), or %NULL
+ * @argv: (in) (array zero-terminated=1): null-terminated array of arguments
+ * @context: (allow-none): a parse context allocated with
+ * gst_parse_context_new(), or %NULL
* @flags: parsing options, or #GST_PARSE_FLAG_NONE
* @error: pointer to a #GError (which must be initialised to %NULL)
*
* @error will contain an error message if an erroneous pipeline is specified.
* An error does not mean that the pipeline could not be constructed.
*
- * Returns: a new element on success; on failure, either %NULL or a
- * partially-constructed bin or element will be returned and @error will be set
- * (unless you passed #GST_PARSE_FLAG_FATAL_ERRORS in @flags, then %NULL will
- * always be returned on failure)
+ * Returns: (transfer full): a new element on success; on failure, either %NULL
+ * or a partially-constructed bin or element will be returned and @error will
+ * be set (unless you passed #GST_PARSE_FLAG_FATAL_ERRORS in @flags, then
+ * %NULL will always be returned on failure)
*
* Since: 0.10.20
*/
* the @error is set. In this case there was a recoverable parsing error and you
* can try to play the pipeline.
*
- * Returns: a new element on success, %NULL on failure. If more than one toplevel
- * element is specified by the @pipeline_description, all elements are put into
- * a #GstPipeline, which than is returned.
+ * Returns: (transfer floating): a new element on success, %NULL on failure. If
+ * more than one toplevel element is specified by the @pipeline_description,
+ * all elements are put into a #GstPipeline, which than is returned.
*/
GstElement *
gst_parse_launch (const gchar * pipeline_description, GError ** error)
{
- return gst_parse_launch_full (pipeline_description, NULL, 0, error);
+ return gst_parse_launch_full (pipeline_description, NULL, GST_PARSE_FLAG_NONE,
+ error);
}
/**
* gst_parse_launch_full:
* @pipeline_description: the command line describing the pipeline
- * @context: a parse context allocated with gst_parse_context_new(), or %NULL
+ * @context: (allow-none): a parse context allocated with
+ * gst_parse_context_new(), or %NULL
* @flags: parsing options, or #GST_PARSE_FLAG_NONE
* @error: the error message in case of an erroneous pipeline.
*
* the @error is set. In this case there was a recoverable parsing error and you
* can try to play the pipeline.
*
- * Returns: a new element on success, %NULL on failure. If more than one toplevel
- * element is specified by the @pipeline_description, all elements are put into
- * a #GstPipeline, which then is returned.
+ * Returns: (transfer full): a new element on success, %NULL on failure. If
+ * more than one toplevel element is specified by the @pipeline_description,
+ * all elements are put into a #GstPipeline, which then is returned.
*
* Since: 0.10.20
*/
GST_CAT_INFO (GST_CAT_PIPELINE, "parsing pipeline description '%s'",
pipeline_description);
- element = _gst_parse_launch (pipeline_description, error, context, flags);
+ element = priv_gst_parse_launch (pipeline_description, error, context, flags);
/* don't return partially constructed pipeline if FATAL_ERRORS was given */
if (G_UNLIKELY (error != NULL && *error != NULL && element != NULL)) {