2002-03-31 21:09:17 +00:00
|
|
|
%{
|
2010-01-20 01:09:55 +00:00
|
|
|
#include "../gst_private.h"
|
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
#include <glib-object.h>
|
2002-03-31 21:09:17 +00:00
|
|
|
#include <glib.h>
|
|
|
|
#include <stdio.h>
|
2002-04-10 16:50:00 +00:00
|
|
|
#include <string.h>
|
2003-02-10 07:53:58 +00:00
|
|
|
#include <stdlib.h>
|
2003-06-29 14:05:49 +00:00
|
|
|
|
2004-01-13 14:23:44 +00:00
|
|
|
#include "../gst-i18n-lib.h"
|
2003-06-29 14:05:49 +00:00
|
|
|
|
2003-11-24 03:21:54 +00:00
|
|
|
#include "../gstconfig.h"
|
2002-04-07 23:32:16 +00:00
|
|
|
#include "../gstparse.h"
|
2003-04-08 21:59:44 +00:00
|
|
|
#include "../gstinfo.h"
|
2004-03-05 13:07:48 +00:00
|
|
|
#include "../gsterror.h"
|
API: gst_parse_launch_full()
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gst.c: (init_post):
* gst/gst_private.h: (_GstParseContext):
* gst/gstparse.c: (gst_parse_error_quark), (gst_parse_context_new),
(gst_parse_context_free), (gst_parse_context_get_missing_elements),
(gst_parse_launchv), (gst_parse_launchv_full), (gst_parse_launch),
(gst_parse_launch_full):
* gst/gstparse.h: (GST_PARSE_FLAG_NONE), (GST_PARSE_FLAG_FATAL_ERRORS),
(GstParseFlags), (GstParseContext):
* gst/gstutils.c: (gst_parse_bin_from_description),
(gst_parse_bin_from_description_full):
* gst/gstutils.h:
* gst/parse/grammar.y:
* gst/parse/types.h:
* win32/common/libgstreamer.def:
Add new gst_parse_*_full API (#528178):
API: gst_parse_launch_full()
API: gst_parse_launchv_full()
API: gst_parse_bin_from_description_full()
API: gst_parse_context_new()
API: gst_parse_context_free()
API: gst_parse_context_get_missing_elements()
2008-05-24 15:33:53 +00:00
|
|
|
#include "../gststructure.h"
|
2003-11-24 03:21:54 +00:00
|
|
|
#include "../gsturi.h"
|
2005-03-07 18:27:42 +00:00
|
|
|
#include "../gstutils.h"
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
#include "../gstvalue.h"
|
ported gstchildproxy over from 0.8 ported gst-inspect fixes and enhancements over from 0.8
Original commit message from CVS:
* docs/gst/gstreamer-docs.sgml:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstbin.c: (gst_bin_get_type),
(gst_bin_child_proxy_get_child_by_index),
(gst_bin_child_proxy_get_children_count),
(gst_bin_child_proxy_init):
* gst/gstchildproxy.c: (gst_child_proxy_get_child_by_name),
(gst_child_proxy_get_child_by_index),
(gst_child_proxy_get_children_count), (gst_child_proxy_lookup),
(gst_child_proxy_get_property), (gst_child_proxy_get_valist),
(gst_child_proxy_get), (gst_child_proxy_set_property),
(gst_child_proxy_set_valist), (gst_child_proxy_set),
(gst_child_proxy_child_added), (gst_child_proxy_child_removed),
(gst_child_proxy_base_init), (gst_child_proxy_get_type):
* gst/gstchildproxy.h:
* gst/parse/grammar.y:
* tools/gst-inspect.c: (print_interfaces),
(print_element_properties_info), (print_element_info):
ported gstchildproxy over from 0.8
ported gst-inspect fixes and enhancements over from 0.8
2005-08-22 21:03:33 +00:00
|
|
|
#include "../gstchildproxy.h"
|
2002-04-01 06:30:39 +00:00
|
|
|
#include "types.h"
|
2002-04-07 23:32:16 +00:00
|
|
|
|
2004-01-13 14:23:44 +00:00
|
|
|
/* All error messages in this file are user-visible and need to be translated.
|
|
|
|
* Don't start the message with a capital, and don't end them with a period,
|
|
|
|
* as they will be presented inside a sentence/error.
|
|
|
|
*/
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2002-04-01 04:36:56 +00:00
|
|
|
#define YYERROR_VERBOSE 1
|
gst/parse/: Make the parser reentrant and recursively callable. This requires flex >= 2.5.31, for older versions preg...
Original commit message from CVS:
Patch by: Marc-Andre Lureau <marcandre dot lureau at gmail dot com>
* gst/parse/Makefile.am:
* gst/parse/grammar.y:
* gst/parse/parse.l:
Make the parser reentrant and recursively callable. This requires flex
>= 2.5.31, for older versions pregenerated sources are used as we
can't bump the build dependency. Finally fixes #349180.
* gst/gstparse.c: (gst_parse_launch):
Drop the HAVE_MT_SAVE_FLEX #ifdefs as we always use a new enough flex
now anyway.
* docs/gst/Makefile.am:
* docs/gst/Makefile.am:
* gst/parse/grammar.tab.pre.c: (__gst_parse_strdup),
(__gst_parse_strfree), (__gst_parse_link_new),
(__gst_parse_link_free), (__gst_parse_chain_new),
(__gst_parse_chain_free), (SET_ERROR), (YYPRINTF),
(gst_parse_element_set), (gst_parse_free_link),
(gst_parse_found_pad), (gst_parse_perform_delayed_link),
(gst_parse_perform_link), (yytnamerr), (yysyntax_error), (yyerror),
(_gst_parse_launch):
* gst/parse/grammar.tab.pre.h:
* gst/parse/lex._gst_parse_yy.pre.c: (PRINT), (yy_get_next_buffer),
(yy_get_previous_state), (yy_try_NUL_trans), (input),
(_gst_parse_yyrestart), (_gst_parse_yy_switch_to_buffer),
(_gst_parse_yy_load_buffer_state), (_gst_parse_yy_create_buffer),
(_gst_parse_yy_delete_buffer), (_gst_parse_yy_init_buffer),
(_gst_parse_yy_flush_buffer), (_gst_parse_yypush_buffer_state),
(_gst_parse_yypop_buffer_state),
(_gst_parse_yyensure_buffer_stack), (_gst_parse_yy_scan_buffer),
(_gst_parse_yy_scan_string), (_gst_parse_yy_scan_bytes),
(yy_fatal_error), (_gst_parse_yyget_extra),
(_gst_parse_yyget_lineno), (_gst_parse_yyget_column),
(_gst_parse_yyget_in), (_gst_parse_yyget_out),
(_gst_parse_yyget_leng), (_gst_parse_yyget_text),
(_gst_parse_yyset_extra), (_gst_parse_yyset_lineno),
(_gst_parse_yyset_column), (_gst_parse_yyset_in),
(_gst_parse_yyset_out), (_gst_parse_yyget_debug),
(_gst_parse_yyset_debug), (_gst_parse_yyget_lval),
(_gst_parse_yyset_lval), (_gst_parse_yylex_init),
(yy_init_globals), (_gst_parse_yylex_destroy), (yy_flex_strncpy),
(yy_flex_strlen), (_gst_parse_yyalloc), (_gst_parse_yyrealloc),
(_gst_parse_yyfree):
If the installed flex version is too old use pre-generated parser
sources. These pre-generated parser sources are always updated when
the actual flex/bison sources change but require everybody who wants
to change something in the parser to have flex >= 2.5.31 installed.
2007-04-18 12:34:51 +00:00
|
|
|
|
2010-04-07 11:29:52 +00:00
|
|
|
#define YYENABLE_NLS 0
|
|
|
|
|
|
|
|
#ifndef YYLTYPE_IS_TRIVIAL
|
|
|
|
#define YYLTYPE_IS_TRIVIAL 0
|
|
|
|
#endif
|
|
|
|
|
gst/parse/: Make the parser reentrant and recursively callable. This requires flex >= 2.5.31, for older versions preg...
Original commit message from CVS:
Patch by: Marc-Andre Lureau <marcandre dot lureau at gmail dot com>
* gst/parse/Makefile.am:
* gst/parse/grammar.y:
* gst/parse/parse.l:
Make the parser reentrant and recursively callable. This requires flex
>= 2.5.31, for older versions pregenerated sources are used as we
can't bump the build dependency. Finally fixes #349180.
* gst/gstparse.c: (gst_parse_launch):
Drop the HAVE_MT_SAVE_FLEX #ifdefs as we always use a new enough flex
now anyway.
* docs/gst/Makefile.am:
* docs/gst/Makefile.am:
* gst/parse/grammar.tab.pre.c: (__gst_parse_strdup),
(__gst_parse_strfree), (__gst_parse_link_new),
(__gst_parse_link_free), (__gst_parse_chain_new),
(__gst_parse_chain_free), (SET_ERROR), (YYPRINTF),
(gst_parse_element_set), (gst_parse_free_link),
(gst_parse_found_pad), (gst_parse_perform_delayed_link),
(gst_parse_perform_link), (yytnamerr), (yysyntax_error), (yyerror),
(_gst_parse_launch):
* gst/parse/grammar.tab.pre.h:
* gst/parse/lex._gst_parse_yy.pre.c: (PRINT), (yy_get_next_buffer),
(yy_get_previous_state), (yy_try_NUL_trans), (input),
(_gst_parse_yyrestart), (_gst_parse_yy_switch_to_buffer),
(_gst_parse_yy_load_buffer_state), (_gst_parse_yy_create_buffer),
(_gst_parse_yy_delete_buffer), (_gst_parse_yy_init_buffer),
(_gst_parse_yy_flush_buffer), (_gst_parse_yypush_buffer_state),
(_gst_parse_yypop_buffer_state),
(_gst_parse_yyensure_buffer_stack), (_gst_parse_yy_scan_buffer),
(_gst_parse_yy_scan_string), (_gst_parse_yy_scan_bytes),
(yy_fatal_error), (_gst_parse_yyget_extra),
(_gst_parse_yyget_lineno), (_gst_parse_yyget_column),
(_gst_parse_yyget_in), (_gst_parse_yyget_out),
(_gst_parse_yyget_leng), (_gst_parse_yyget_text),
(_gst_parse_yyset_extra), (_gst_parse_yyset_lineno),
(_gst_parse_yyset_column), (_gst_parse_yyset_in),
(_gst_parse_yyset_out), (_gst_parse_yyget_debug),
(_gst_parse_yyset_debug), (_gst_parse_yyget_lval),
(_gst_parse_yyset_lval), (_gst_parse_yylex_init),
(yy_init_globals), (_gst_parse_yylex_destroy), (yy_flex_strncpy),
(yy_flex_strlen), (_gst_parse_yyalloc), (_gst_parse_yyrealloc),
(_gst_parse_yyfree):
If the installed flex version is too old use pre-generated parser
sources. These pre-generated parser sources are always updated when
the actual flex/bison sources change but require everybody who wants
to change something in the parser to have flex >= 2.5.31 installed.
2007-04-18 12:34:51 +00:00
|
|
|
typedef void* yyscan_t;
|
|
|
|
|
2011-10-08 13:17:25 +00:00
|
|
|
int priv_gst_parse_yylex (void * yylval_param , yyscan_t yyscanner);
|
|
|
|
int priv_gst_parse_yylex_init (yyscan_t scanner);
|
|
|
|
int priv_gst_parse_yylex_destroy (yyscan_t scanner);
|
|
|
|
struct yy_buffer_state * priv_gst_parse_yy_scan_string (char* , yyscan_t);
|
gst/parse/: Make the parser reentrant and recursively callable. This requires flex >= 2.5.31, for older versions preg...
Original commit message from CVS:
Patch by: Marc-Andre Lureau <marcandre dot lureau at gmail dot com>
* gst/parse/Makefile.am:
* gst/parse/grammar.y:
* gst/parse/parse.l:
Make the parser reentrant and recursively callable. This requires flex
>= 2.5.31, for older versions pregenerated sources are used as we
can't bump the build dependency. Finally fixes #349180.
* gst/gstparse.c: (gst_parse_launch):
Drop the HAVE_MT_SAVE_FLEX #ifdefs as we always use a new enough flex
now anyway.
* docs/gst/Makefile.am:
* docs/gst/Makefile.am:
* gst/parse/grammar.tab.pre.c: (__gst_parse_strdup),
(__gst_parse_strfree), (__gst_parse_link_new),
(__gst_parse_link_free), (__gst_parse_chain_new),
(__gst_parse_chain_free), (SET_ERROR), (YYPRINTF),
(gst_parse_element_set), (gst_parse_free_link),
(gst_parse_found_pad), (gst_parse_perform_delayed_link),
(gst_parse_perform_link), (yytnamerr), (yysyntax_error), (yyerror),
(_gst_parse_launch):
* gst/parse/grammar.tab.pre.h:
* gst/parse/lex._gst_parse_yy.pre.c: (PRINT), (yy_get_next_buffer),
(yy_get_previous_state), (yy_try_NUL_trans), (input),
(_gst_parse_yyrestart), (_gst_parse_yy_switch_to_buffer),
(_gst_parse_yy_load_buffer_state), (_gst_parse_yy_create_buffer),
(_gst_parse_yy_delete_buffer), (_gst_parse_yy_init_buffer),
(_gst_parse_yy_flush_buffer), (_gst_parse_yypush_buffer_state),
(_gst_parse_yypop_buffer_state),
(_gst_parse_yyensure_buffer_stack), (_gst_parse_yy_scan_buffer),
(_gst_parse_yy_scan_string), (_gst_parse_yy_scan_bytes),
(yy_fatal_error), (_gst_parse_yyget_extra),
(_gst_parse_yyget_lineno), (_gst_parse_yyget_column),
(_gst_parse_yyget_in), (_gst_parse_yyget_out),
(_gst_parse_yyget_leng), (_gst_parse_yyget_text),
(_gst_parse_yyset_extra), (_gst_parse_yyset_lineno),
(_gst_parse_yyset_column), (_gst_parse_yyset_in),
(_gst_parse_yyset_out), (_gst_parse_yyget_debug),
(_gst_parse_yyset_debug), (_gst_parse_yyget_lval),
(_gst_parse_yyset_lval), (_gst_parse_yylex_init),
(yy_init_globals), (_gst_parse_yylex_destroy), (yy_flex_strncpy),
(yy_flex_strlen), (_gst_parse_yyalloc), (_gst_parse_yyrealloc),
(_gst_parse_yyfree):
If the installed flex version is too old use pre-generated parser
sources. These pre-generated parser sources are always updated when
the actual flex/bison sources change but require everybody who wants
to change something in the parser to have flex >= 2.5.31 installed.
2007-04-18 12:34:51 +00:00
|
|
|
void _gst_parse_yypush_buffer_state (void * new_buffer ,yyscan_t yyscanner );
|
|
|
|
void _gst_parse_yypop_buffer_state (yyscan_t yyscanner );
|
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
#ifdef __GST_PARSE_TRACE
|
2003-05-18 22:45:27 +00:00
|
|
|
static guint __strings;
|
|
|
|
static guint __links;
|
|
|
|
static guint __chains;
|
2003-04-08 21:59:44 +00:00
|
|
|
gchar *
|
|
|
|
__gst_parse_strdup (gchar *org)
|
|
|
|
{
|
2011-02-14 13:39:21 +00:00
|
|
|
gchar *ret;
|
2003-04-08 21:59:44 +00:00
|
|
|
__strings++;
|
2003-04-16 21:37:35 +00:00
|
|
|
ret = g_strdup (org);
|
|
|
|
/* g_print ("ALLOCATED STR (%3u): %p %s\n", __strings, ret, ret); */
|
|
|
|
return ret;
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
|
|
|
void
|
|
|
|
__gst_parse_strfree (gchar *str)
|
|
|
|
{
|
|
|
|
if (str) {
|
2003-04-16 21:37:35 +00:00
|
|
|
/* g_print ("FREEING STR (%3u): %p %s\n", __strings - 1, str, str); */
|
2003-04-08 21:59:44 +00:00
|
|
|
g_free (str);
|
|
|
|
g_return_if_fail (__strings > 0);
|
|
|
|
__strings--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
link_t *__gst_parse_link_new ()
|
|
|
|
{
|
2003-04-16 21:37:35 +00:00
|
|
|
link_t *ret;
|
2003-04-08 21:59:44 +00:00
|
|
|
__links++;
|
2009-10-31 15:49:03 +00:00
|
|
|
ret = g_slice_new0 (link_t);
|
2003-04-16 21:37:35 +00:00
|
|
|
/* g_print ("ALLOCATED LINK (%3u): %p\n", __links, ret); */
|
|
|
|
return ret;
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
|
|
|
void
|
|
|
|
__gst_parse_link_free (link_t *data)
|
|
|
|
{
|
|
|
|
if (data) {
|
2003-04-16 21:37:35 +00:00
|
|
|
/* g_print ("FREEING LINK (%3u): %p\n", __links - 1, data); */
|
2009-10-31 15:49:03 +00:00
|
|
|
g_slice_free (link_t, data);
|
2003-04-08 21:59:44 +00:00
|
|
|
g_return_if_fail (__links > 0);
|
|
|
|
__links--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
chain_t *
|
|
|
|
__gst_parse_chain_new ()
|
|
|
|
{
|
2003-04-16 21:37:35 +00:00
|
|
|
chain_t *ret;
|
2003-04-08 21:59:44 +00:00
|
|
|
__chains++;
|
2009-10-31 15:49:03 +00:00
|
|
|
ret = g_slice_new0 (chain_t);
|
2003-04-16 21:37:35 +00:00
|
|
|
/* g_print ("ALLOCATED CHAIN (%3u): %p\n", __chains, ret); */
|
|
|
|
return ret;
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
|
|
|
void
|
|
|
|
__gst_parse_chain_free (chain_t *data)
|
|
|
|
{
|
2004-04-19 17:40:24 +00:00
|
|
|
/* g_print ("FREEING CHAIN (%3u): %p\n", __chains - 1, data); */
|
2009-10-31 15:49:03 +00:00
|
|
|
g_slice_free (chain_t, data);
|
2004-04-19 17:40:24 +00:00
|
|
|
g_return_if_fail (__chains > 0);
|
|
|
|
__chains--;
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __GST_PARSE_TRACE */
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
gchar *src_pad;
|
|
|
|
gchar *sink_pad;
|
|
|
|
GstElement *sink;
|
|
|
|
GstCaps *caps;
|
|
|
|
gulong signal_id;
|
|
|
|
} DelayedLink;
|
|
|
|
|
2008-02-01 12:10:17 +00:00
|
|
|
typedef struct {
|
|
|
|
gchar *name;
|
|
|
|
gchar *value_str;
|
|
|
|
gulong signal_id;
|
|
|
|
} DelayedSet;
|
|
|
|
|
2009-11-19 12:59:28 +00:00
|
|
|
/*** define SET_ERROR macro/function */
|
2005-10-10 22:59:22 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
#ifdef G_HAVE_ISO_VARARGS
|
2005-10-10 22:59:22 +00:00
|
|
|
|
2005-10-10 22:49:42 +00:00
|
|
|
# define SET_ERROR(error, type, ...) \
|
|
|
|
G_STMT_START { \
|
2004-05-04 20:07:38 +00:00
|
|
|
GST_CAT_ERROR (GST_CAT_PIPELINE, __VA_ARGS__); \
|
|
|
|
if ((error) && !*(error)) { \
|
|
|
|
g_set_error ((error), GST_PARSE_ERROR, (type), __VA_ARGS__); \
|
2003-04-08 21:59:44 +00:00
|
|
|
} \
|
2005-10-10 22:49:42 +00:00
|
|
|
} G_STMT_END
|
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
#elif defined(G_HAVE_GNUC_VARARGS)
|
|
|
|
|
2005-10-10 22:49:42 +00:00
|
|
|
# define SET_ERROR(error, type, args...) \
|
|
|
|
G_STMT_START { \
|
2004-05-04 20:07:38 +00:00
|
|
|
GST_CAT_ERROR (GST_CAT_PIPELINE, args ); \
|
|
|
|
if ((error) && !*(error)) { \
|
|
|
|
g_set_error ((error), GST_PARSE_ERROR, (type), args ); \
|
2003-04-08 21:59:44 +00:00
|
|
|
} \
|
2005-10-10 22:49:42 +00:00
|
|
|
} G_STMT_END
|
|
|
|
|
2004-05-07 02:36:28 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
SET_ERROR (GError **error, gint type, const char *format, ...)
|
|
|
|
{
|
|
|
|
if (error) {
|
|
|
|
if (*error) {
|
|
|
|
g_warning ("error while parsing");
|
|
|
|
} else {
|
|
|
|
va_list varargs;
|
|
|
|
char *string;
|
|
|
|
|
|
|
|
va_start (varargs, format);
|
|
|
|
string = g_strdup_vprintf (format, varargs);
|
|
|
|
va_end (varargs);
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2004-05-07 02:36:28 +00:00
|
|
|
g_set_error (error, GST_PARSE_ERROR, type, string);
|
|
|
|
|
|
|
|
g_free (string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-10 22:59:22 +00:00
|
|
|
#endif /* G_HAVE_ISO_VARARGS */
|
|
|
|
|
|
|
|
/*** define YYPRINTF macro/function if we're debugging */
|
|
|
|
|
|
|
|
/* bison 1.35 calls this macro with side effects, we need to make sure the
|
|
|
|
side effects work - crappy bison */
|
|
|
|
|
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
|
|
|
# define YYDEBUG 1
|
|
|
|
|
|
|
|
# ifdef G_HAVE_ISO_VARARGS
|
|
|
|
|
|
|
|
/* # define YYFPRINTF(a, ...) GST_CAT_DEBUG (GST_CAT_PIPELINE, __VA_ARGS__) */
|
|
|
|
# define YYFPRINTF(a, ...) \
|
|
|
|
G_STMT_START { \
|
2009-10-07 20:23:08 +00:00
|
|
|
GST_CAT_LOG (GST_CAT_PIPELINE, __VA_ARGS__); \
|
2005-10-10 22:59:22 +00:00
|
|
|
} G_STMT_END
|
|
|
|
|
|
|
|
# elif defined(G_HAVE_GNUC_VARARGS)
|
|
|
|
|
|
|
|
# define YYFPRINTF(a, args...) \
|
|
|
|
G_STMT_START { \
|
2009-10-07 20:23:08 +00:00
|
|
|
GST_CAT_LOG (GST_CAT_PIPELINE, args); \
|
2005-10-10 22:59:22 +00:00
|
|
|
} G_STMT_END
|
|
|
|
|
|
|
|
# else
|
|
|
|
|
2004-05-07 02:36:28 +00:00
|
|
|
static inline void
|
|
|
|
YYPRINTF(const char *format, ...)
|
|
|
|
{
|
|
|
|
va_list varargs;
|
|
|
|
gchar *temp;
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2004-05-07 02:36:28 +00:00
|
|
|
va_start (varargs, format);
|
2005-10-10 23:11:33 +00:00
|
|
|
temp = g_strdup_vprintf (format, varargs);
|
2004-05-07 02:36:28 +00:00
|
|
|
GST_CAT_LOG (GST_CAT_PIPELINE, "%s", temp);
|
|
|
|
g_free (temp);
|
|
|
|
va_end (varargs);
|
|
|
|
}
|
|
|
|
|
2005-10-10 22:59:22 +00:00
|
|
|
# endif /* G_HAVE_ISO_VARARGS */
|
|
|
|
|
|
|
|
#endif /* GST_DISABLE_GST_DEBUG */
|
2003-04-08 21:59:44 +00:00
|
|
|
|
API: gst_parse_launch_full()
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gst.c: (init_post):
* gst/gst_private.h: (_GstParseContext):
* gst/gstparse.c: (gst_parse_error_quark), (gst_parse_context_new),
(gst_parse_context_free), (gst_parse_context_get_missing_elements),
(gst_parse_launchv), (gst_parse_launchv_full), (gst_parse_launch),
(gst_parse_launch_full):
* gst/gstparse.h: (GST_PARSE_FLAG_NONE), (GST_PARSE_FLAG_FATAL_ERRORS),
(GstParseFlags), (GstParseContext):
* gst/gstutils.c: (gst_parse_bin_from_description),
(gst_parse_bin_from_description_full):
* gst/gstutils.h:
* gst/parse/grammar.y:
* gst/parse/types.h:
* win32/common/libgstreamer.def:
Add new gst_parse_*_full API (#528178):
API: gst_parse_launch_full()
API: gst_parse_launchv_full()
API: gst_parse_bin_from_description_full()
API: gst_parse_context_new()
API: gst_parse_context_free()
API: gst_parse_context_get_missing_elements()
2008-05-24 15:33:53 +00:00
|
|
|
#define ADD_MISSING_ELEMENT(graph,name) G_STMT_START { \
|
|
|
|
if ((graph)->ctx) { \
|
|
|
|
(graph)->ctx->missing_elements = \
|
|
|
|
g_list_append ((graph)->ctx->missing_elements, g_strdup (name)); \
|
|
|
|
} } G_STMT_END
|
|
|
|
|
2010-04-07 11:24:14 +00:00
|
|
|
static void
|
|
|
|
no_free (gconstpointer foo)
|
|
|
|
{
|
|
|
|
/* do nothing */
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GST_BIN_MAKE(res, type, chainval, assign, type_string_free_func) \
|
2005-10-10 22:49:42 +00:00
|
|
|
G_STMT_START { \
|
2003-04-14 18:33:58 +00:00
|
|
|
chain_t *chain = chainval; \
|
2003-04-08 21:59:44 +00:00
|
|
|
GSList *walk; \
|
|
|
|
GstBin *bin = (GstBin *) gst_element_factory_make (type, NULL); \
|
2003-04-14 18:33:58 +00:00
|
|
|
if (!chain) { \
|
2008-05-25 14:13:22 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_EMPTY_BIN, \
|
2005-10-10 22:49:42 +00:00
|
|
|
_("specified empty bin \"%s\", not allowed"), type); \
|
2003-04-14 18:33:58 +00:00
|
|
|
g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
|
|
|
|
g_slist_free (assign); \
|
2007-04-13 11:53:00 +00:00
|
|
|
gst_object_unref (bin); \
|
2010-04-07 11:24:14 +00:00
|
|
|
type_string_free_func (type); /* Need to clean up the string */ \
|
2003-04-14 18:33:58 +00:00
|
|
|
YYERROR; \
|
|
|
|
} else if (!bin) { \
|
2008-05-25 14:13:22 +00:00
|
|
|
ADD_MISSING_ELEMENT(graph, type); \
|
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, \
|
2005-10-10 22:49:42 +00:00
|
|
|
_("no bin \"%s\", skipping"), type); \
|
2003-04-14 18:33:58 +00:00
|
|
|
g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
|
|
|
|
g_slist_free (assign); \
|
|
|
|
res = chain; \
|
2003-04-08 21:59:44 +00:00
|
|
|
} else { \
|
2004-04-19 17:40:24 +00:00
|
|
|
for (walk = chain->elements; walk; walk = walk->next ) \
|
2003-04-08 21:59:44 +00:00
|
|
|
gst_bin_add (bin, GST_ELEMENT (walk->data)); \
|
|
|
|
g_slist_free (chain->elements); \
|
|
|
|
chain->elements = g_slist_prepend (NULL, bin); \
|
|
|
|
res = chain; \
|
|
|
|
/* set the properties now */ \
|
2004-04-19 17:40:24 +00:00
|
|
|
for (walk = assign; walk; walk = walk->next) \
|
2003-04-08 21:59:44 +00:00
|
|
|
gst_parse_element_set ((gchar *) walk->data, GST_ELEMENT (bin), graph); \
|
|
|
|
g_slist_free (assign); \
|
|
|
|
} \
|
2005-10-10 22:49:42 +00:00
|
|
|
} G_STMT_END
|
2003-04-08 21:59:44 +00:00
|
|
|
|
2005-10-10 22:49:42 +00:00
|
|
|
#define MAKE_LINK(link, _src, _src_name, _src_pads, _sink, _sink_name, _sink_pads) \
|
|
|
|
G_STMT_START { \
|
2003-04-08 21:59:44 +00:00
|
|
|
link = gst_parse_link_new (); \
|
|
|
|
link->src = _src; \
|
|
|
|
link->sink = _sink; \
|
|
|
|
link->src_name = _src_name; \
|
|
|
|
link->sink_name = _sink_name; \
|
|
|
|
link->src_pads = _src_pads; \
|
|
|
|
link->sink_pads = _sink_pads; \
|
|
|
|
link->caps = NULL; \
|
2005-10-10 22:49:42 +00:00
|
|
|
} G_STMT_END
|
2003-04-08 21:59:44 +00:00
|
|
|
|
2005-10-10 22:49:42 +00:00
|
|
|
#define MAKE_REF(link, _src, _pads) \
|
|
|
|
G_STMT_START { \
|
2003-04-08 21:59:44 +00:00
|
|
|
gchar *padname = _src; \
|
|
|
|
GSList *pads = _pads; \
|
|
|
|
if (padname) { \
|
|
|
|
while (*padname != '.') padname++; \
|
|
|
|
*padname = '\0'; \
|
|
|
|
padname++; \
|
|
|
|
if (*padname != '\0') \
|
|
|
|
pads = g_slist_prepend (pads, gst_parse_strdup (padname)); \
|
|
|
|
} \
|
|
|
|
MAKE_LINK (link, NULL, _src, pads, NULL, NULL, NULL); \
|
2005-10-10 22:49:42 +00:00
|
|
|
} G_STMT_END
|
2003-04-08 21:59:44 +00:00
|
|
|
|
2010-03-18 08:22:09 +00:00
|
|
|
static void
|
|
|
|
gst_parse_free_delayed_set (DelayedSet *set)
|
|
|
|
{
|
|
|
|
g_free(set->name);
|
|
|
|
g_free(set->value_str);
|
|
|
|
g_slice_free(DelayedSet, set);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gst_parse_new_child(GstChildProxy *child_proxy, GObject *object,
|
2012-08-07 23:54:49 +00:00
|
|
|
const gchar * name, gpointer data);
|
2010-03-18 08:22:09 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_parse_add_delayed_set (GstElement *element, gchar *name, gchar *value_str)
|
|
|
|
{
|
|
|
|
DelayedSet *data = g_slice_new0 (DelayedSet);
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2010-03-18 08:22:09 +00:00
|
|
|
GST_CAT_LOG_OBJECT (GST_CAT_PIPELINE, element, "delaying property set %s to %s",
|
|
|
|
name, value_str);
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2010-03-18 08:22:09 +00:00
|
|
|
data->name = g_strdup(name);
|
|
|
|
data->value_str = g_strdup(value_str);
|
|
|
|
data->signal_id = g_signal_connect_data(element, "child-added",
|
|
|
|
G_CALLBACK (gst_parse_new_child), data, (GClosureNotify)
|
|
|
|
gst_parse_free_delayed_set, (GConnectFlags) 0);
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2010-03-18 08:22:09 +00:00
|
|
|
/* FIXME: we would need to listen on all intermediate bins too */
|
|
|
|
if (GST_IS_BIN (element)) {
|
|
|
|
gchar **names, **current;
|
|
|
|
GstElement *parent, *child;
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2010-03-18 08:22:09 +00:00
|
|
|
current = names = g_strsplit (name, "::", -1);
|
|
|
|
parent = gst_bin_get_by_name (GST_BIN_CAST (element), current[0]);
|
|
|
|
current++;
|
|
|
|
while (parent && current[0]) {
|
|
|
|
child = gst_bin_get_by_name (GST_BIN (parent), current[0]);
|
|
|
|
if (!child && current[1]) {
|
|
|
|
char *sub_name = g_strjoinv ("::", ¤t[0]);
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2010-03-18 08:22:09 +00:00
|
|
|
gst_parse_add_delayed_set(parent, sub_name, value_str);
|
|
|
|
g_free (sub_name);
|
|
|
|
}
|
2014-07-24 20:02:58 +00:00
|
|
|
gst_object_unref (parent);
|
2010-03-18 08:22:09 +00:00
|
|
|
parent = child;
|
|
|
|
current++;
|
|
|
|
}
|
2014-07-24 20:02:58 +00:00
|
|
|
if (parent)
|
|
|
|
gst_object_unref (parent);
|
2010-03-18 08:22:09 +00:00
|
|
|
g_strfreev (names);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-07 23:54:49 +00:00
|
|
|
static void
|
|
|
|
gst_parse_new_child(GstChildProxy *child_proxy, GObject *object,
|
|
|
|
const gchar * name, gpointer data)
|
2008-02-01 12:10:17 +00:00
|
|
|
{
|
|
|
|
DelayedSet *set = (DelayedSet *) data;
|
|
|
|
GParamSpec *pspec;
|
2011-02-14 13:39:21 +00:00
|
|
|
GValue v = { 0, };
|
2012-03-31 10:00:56 +00:00
|
|
|
GObject *target = NULL;
|
2008-02-01 12:10:17 +00:00
|
|
|
GType value_type;
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2010-03-18 08:22:09 +00:00
|
|
|
GST_CAT_LOG_OBJECT (GST_CAT_PIPELINE, child_proxy, "new child %s, checking property %s",
|
2012-08-07 23:54:49 +00:00
|
|
|
name, set->name);
|
2008-02-01 12:10:17 +00:00
|
|
|
|
2012-08-12 12:27:06 +00:00
|
|
|
if (gst_child_proxy_lookup (child_proxy, set->name, &target, &pspec)) {
|
2009-04-21 08:33:43 +00:00
|
|
|
gboolean got_value = FALSE;
|
|
|
|
|
2009-12-28 16:25:20 +00:00
|
|
|
value_type = pspec->value_type;
|
2008-02-01 12:10:17 +00:00
|
|
|
|
2010-03-18 08:22:09 +00:00
|
|
|
GST_CAT_LOG_OBJECT (GST_CAT_PIPELINE, child_proxy, "parsing delayed property %s as a %s from %s",
|
|
|
|
pspec->name, g_type_name (value_type), set->value_str);
|
2008-02-01 12:10:17 +00:00
|
|
|
g_value_init (&v, value_type);
|
2009-04-21 08:33:43 +00:00
|
|
|
if (gst_value_deserialize (&v, set->value_str))
|
|
|
|
got_value = TRUE;
|
|
|
|
else if (g_type_is_a (value_type, GST_TYPE_ELEMENT)) {
|
|
|
|
GstElement *bin;
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2013-07-01 20:04:46 +00:00
|
|
|
bin = gst_parse_bin_from_description_full (set->value_str, TRUE, NULL,
|
|
|
|
GST_PARSE_FLAG_NO_SINGLE_ELEMENT_BINS, NULL);
|
2009-04-21 08:33:43 +00:00
|
|
|
if (bin) {
|
|
|
|
g_value_set_object (&v, bin);
|
|
|
|
got_value = TRUE;
|
|
|
|
}
|
2008-02-01 12:10:17 +00:00
|
|
|
}
|
|
|
|
g_signal_handler_disconnect (child_proxy, set->signal_id);
|
2009-04-21 08:33:43 +00:00
|
|
|
if (!got_value)
|
|
|
|
goto error;
|
2012-03-31 10:00:56 +00:00
|
|
|
g_object_set_property (target, pspec->name, &v);
|
2010-03-18 08:22:09 +00:00
|
|
|
} else {
|
|
|
|
const gchar *obj_name = GST_OBJECT_NAME(object);
|
|
|
|
gint len = strlen (obj_name);
|
|
|
|
|
|
|
|
/* do a delayed set */
|
|
|
|
if ((strlen (set->name) > (len + 2)) && !strncmp (set->name, obj_name, len) && !strncmp (&set->name[len], "::", 2)) {
|
|
|
|
gst_parse_add_delayed_set (GST_ELEMENT(child_proxy), set->name, set->value_str);
|
|
|
|
}
|
2008-02-01 12:10:17 +00:00
|
|
|
}
|
|
|
|
|
2009-04-21 08:33:43 +00:00
|
|
|
out:
|
2008-02-01 12:10:17 +00:00
|
|
|
if (G_IS_VALUE (&v))
|
|
|
|
g_value_unset (&v);
|
|
|
|
if (target)
|
2012-03-31 10:00:56 +00:00
|
|
|
g_object_unref (target);
|
2008-02-01 12:10:17 +00:00
|
|
|
return;
|
2009-04-21 08:33:43 +00:00
|
|
|
|
|
|
|
error:
|
2012-04-18 13:37:25 +00:00
|
|
|
GST_CAT_ERROR (GST_CAT_PIPELINE, "could not set property \"%s\" in %"
|
2012-03-31 10:00:56 +00:00
|
|
|
GST_PTR_FORMAT, pspec->name, target);
|
2009-04-21 08:33:43 +00:00
|
|
|
goto out;
|
2008-02-01 12:10:17 +00:00
|
|
|
}
|
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
static void
|
|
|
|
gst_parse_element_set (gchar *value, GstElement *element, graph_t *graph)
|
|
|
|
{
|
2012-08-12 12:27:06 +00:00
|
|
|
GParamSpec *pspec = NULL;
|
2003-04-08 21:59:44 +00:00
|
|
|
gchar *pos = value;
|
2011-02-14 13:39:21 +00:00
|
|
|
GValue v = { 0, };
|
2012-03-31 10:00:56 +00:00
|
|
|
GObject *target = NULL;
|
2005-06-22 11:02:57 +00:00
|
|
|
GType value_type;
|
|
|
|
|
2008-05-25 13:56:38 +00:00
|
|
|
/* do nothing if assignment is for missing element */
|
|
|
|
if (element == NULL)
|
|
|
|
goto out;
|
|
|
|
|
2012-07-17 07:57:47 +00:00
|
|
|
/* parse the string, so the property name is null-terminated and pos points
|
2003-04-08 21:59:44 +00:00
|
|
|
to the beginning of the value */
|
2011-02-14 13:39:21 +00:00
|
|
|
while (!g_ascii_isspace (*pos) && (*pos != '=')) pos++;
|
|
|
|
if (*pos == '=') {
|
|
|
|
*pos = '\0';
|
|
|
|
} else {
|
|
|
|
*pos = '\0';
|
2003-04-08 21:59:44 +00:00
|
|
|
pos++;
|
2011-02-14 13:39:21 +00:00
|
|
|
while (g_ascii_isspace (*pos)) pos++;
|
|
|
|
}
|
|
|
|
pos++;
|
|
|
|
while (g_ascii_isspace (*pos)) pos++;
|
2003-04-08 21:59:44 +00:00
|
|
|
if (*pos == '"') {
|
|
|
|
pos++;
|
|
|
|
pos[strlen (pos) - 1] = '\0';
|
|
|
|
}
|
ported gstchildproxy over from 0.8 ported gst-inspect fixes and enhancements over from 0.8
Original commit message from CVS:
* docs/gst/gstreamer-docs.sgml:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstbin.c: (gst_bin_get_type),
(gst_bin_child_proxy_get_child_by_index),
(gst_bin_child_proxy_get_children_count),
(gst_bin_child_proxy_init):
* gst/gstchildproxy.c: (gst_child_proxy_get_child_by_name),
(gst_child_proxy_get_child_by_index),
(gst_child_proxy_get_children_count), (gst_child_proxy_lookup),
(gst_child_proxy_get_property), (gst_child_proxy_get_valist),
(gst_child_proxy_get), (gst_child_proxy_set_property),
(gst_child_proxy_set_valist), (gst_child_proxy_set),
(gst_child_proxy_child_added), (gst_child_proxy_child_removed),
(gst_child_proxy_base_init), (gst_child_proxy_get_type):
* gst/gstchildproxy.h:
* gst/parse/grammar.y:
* tools/gst-inspect.c: (print_interfaces),
(print_element_properties_info), (print_element_info):
ported gstchildproxy over from 0.8
ported gst-inspect fixes and enhancements over from 0.8
2005-08-22 21:03:33 +00:00
|
|
|
gst_parse_unescape (pos);
|
|
|
|
|
2012-08-12 12:27:06 +00:00
|
|
|
if (GST_IS_CHILD_PROXY (element)) {
|
|
|
|
if (!gst_child_proxy_lookup (GST_CHILD_PROXY (element), value, &target, &pspec)) {
|
|
|
|
/* do a delayed set */
|
|
|
|
gst_parse_add_delayed_set (element, value, pos);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (element), value);
|
|
|
|
if (pspec != NULL) {
|
|
|
|
target = g_object_ref (element);
|
|
|
|
GST_CAT_LOG_OBJECT (GST_CAT_PIPELINE, target, "found %s property", value);
|
|
|
|
} else {
|
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_NO_SUCH_PROPERTY, \
|
|
|
|
_("no property \"%s\" in element \"%s\""), value, \
|
|
|
|
GST_ELEMENT_NAME (element));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pspec != NULL && target != NULL) {
|
2009-04-21 08:33:43 +00:00
|
|
|
gboolean got_value = FALSE;
|
|
|
|
|
2009-12-28 16:25:20 +00:00
|
|
|
value_type = pspec->value_type;
|
2009-04-21 08:33:43 +00:00
|
|
|
|
2012-08-12 12:27:06 +00:00
|
|
|
GST_CAT_LOG_OBJECT (GST_CAT_PIPELINE, element, "parsing property %s as a %s",
|
|
|
|
pspec->name, g_type_name (value_type));
|
|
|
|
|
2005-06-22 11:02:57 +00:00
|
|
|
g_value_init (&v, value_type);
|
2009-04-21 08:33:43 +00:00
|
|
|
if (gst_value_deserialize (&v, pos))
|
|
|
|
got_value = TRUE;
|
|
|
|
else if (g_type_is_a (value_type, GST_TYPE_ELEMENT)) {
|
|
|
|
GstElement *bin;
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2013-07-01 20:04:46 +00:00
|
|
|
bin = gst_parse_bin_from_description_full (pos, TRUE, NULL,
|
|
|
|
GST_PARSE_FLAG_NO_SINGLE_ELEMENT_BINS, NULL);
|
2009-04-21 08:33:43 +00:00
|
|
|
if (bin) {
|
|
|
|
g_value_set_object (&v, bin);
|
|
|
|
got_value = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!got_value)
|
2003-04-08 21:59:44 +00:00
|
|
|
goto error;
|
2012-03-31 10:00:56 +00:00
|
|
|
g_object_set_property (target, pspec->name, &v);
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
gst_parse_strfree (value);
|
2004-02-04 17:24:23 +00:00
|
|
|
if (G_IS_VALUE (&v))
|
|
|
|
g_value_unset (&v);
|
2008-02-01 12:10:17 +00:00
|
|
|
if (target)
|
2012-03-31 10:00:56 +00:00
|
|
|
g_object_unref (target);
|
2003-04-08 21:59:44 +00:00
|
|
|
return;
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
error:
|
2008-05-25 14:13:22 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
|
2011-02-14 13:39:21 +00:00
|
|
|
_("could not set property \"%s\" in element \"%s\" to \"%s\""),
|
|
|
|
value, GST_ELEMENT_NAME (element), pos);
|
2003-05-06 22:58:04 +00:00
|
|
|
goto out;
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
2010-03-18 08:22:09 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
static inline void
|
|
|
|
gst_parse_free_link (link_t *link)
|
|
|
|
{
|
|
|
|
gst_parse_strfree (link->src_name);
|
|
|
|
gst_parse_strfree (link->sink_name);
|
|
|
|
g_slist_foreach (link->src_pads, (GFunc) gst_parse_strfree, NULL);
|
|
|
|
g_slist_foreach (link->sink_pads, (GFunc) gst_parse_strfree, NULL);
|
|
|
|
g_slist_free (link->src_pads);
|
|
|
|
g_slist_free (link->sink_pads);
|
2005-03-07 18:27:42 +00:00
|
|
|
if (link->caps) gst_caps_unref (link->caps);
|
2011-02-14 13:39:21 +00:00
|
|
|
gst_parse_link_free (link);
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
2005-03-07 18:27:42 +00:00
|
|
|
|
2009-10-29 05:03:44 +00:00
|
|
|
static void
|
|
|
|
gst_parse_free_delayed_link (DelayedLink *link)
|
|
|
|
{
|
|
|
|
g_free (link->src_pad);
|
|
|
|
g_free (link->sink_pad);
|
|
|
|
if (link->caps) gst_caps_unref (link->caps);
|
2009-10-31 15:49:03 +00:00
|
|
|
g_slice_free (DelayedLink, link);
|
2009-10-29 05:03:44 +00:00
|
|
|
}
|
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
static void
|
|
|
|
gst_parse_found_pad (GstElement *src, GstPad *pad, gpointer data)
|
|
|
|
{
|
2009-10-31 15:56:17 +00:00
|
|
|
DelayedLink *link = data;
|
2009-10-31 15:43:26 +00:00
|
|
|
|
2011-02-14 13:39:21 +00:00
|
|
|
GST_CAT_INFO (GST_CAT_PIPELINE, "trying delayed linking %s:%s to %s:%s",
|
2006-02-19 12:00:38 +00:00
|
|
|
GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (link->src_pad),
|
|
|
|
GST_STR_NULL (GST_ELEMENT_NAME (link->sink)), GST_STR_NULL (link->sink_pad));
|
2003-04-11 00:00:46 +00:00
|
|
|
|
2005-10-10 22:49:42 +00:00
|
|
|
if (gst_element_link_pads_filtered (src, link->src_pad, link->sink,
|
|
|
|
link->sink_pad, link->caps)) {
|
|
|
|
/* do this here, we don't want to get any problems later on when
|
|
|
|
* unlocking states */
|
2011-02-14 13:39:21 +00:00
|
|
|
GST_CAT_DEBUG (GST_CAT_PIPELINE, "delayed linking %s:%s to %s:%s worked",
|
2006-02-19 12:00:38 +00:00
|
|
|
GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (link->src_pad),
|
|
|
|
GST_STR_NULL (GST_ELEMENT_NAME (link->sink)), GST_STR_NULL (link->sink_pad));
|
2003-04-08 21:59:44 +00:00
|
|
|
g_signal_handler_disconnect (src, link->signal_id);
|
|
|
|
}
|
|
|
|
}
|
2010-03-18 08:22:09 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
/* both padnames and the caps may be NULL */
|
|
|
|
static gboolean
|
2011-02-14 13:39:21 +00:00
|
|
|
gst_parse_perform_delayed_link (GstElement *src, const gchar *src_pad,
|
2005-10-10 22:49:42 +00:00
|
|
|
GstElement *sink, const gchar *sink_pad,
|
|
|
|
GstCaps *caps)
|
2003-04-08 21:59:44 +00:00
|
|
|
{
|
2005-10-10 22:49:42 +00:00
|
|
|
GList *templs = gst_element_class_get_pad_template_list (
|
|
|
|
GST_ELEMENT_GET_CLASS (src));
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2004-04-19 17:40:24 +00:00
|
|
|
for (; templs; templs = templs->next) {
|
2003-04-08 21:59:44 +00:00
|
|
|
GstPadTemplate *templ = (GstPadTemplate *) templs->data;
|
2005-10-10 22:49:42 +00:00
|
|
|
if ((GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC) &&
|
|
|
|
(GST_PAD_TEMPLATE_PRESENCE(templ) == GST_PAD_SOMETIMES))
|
2003-04-08 21:59:44 +00:00
|
|
|
{
|
2011-02-14 13:39:21 +00:00
|
|
|
DelayedLink *data = g_slice_new (DelayedLink);
|
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
/* TODO: maybe we should check if src_pad matches this template's names */
|
|
|
|
|
2011-02-14 13:39:21 +00:00
|
|
|
GST_CAT_DEBUG (GST_CAT_PIPELINE, "trying delayed link %s:%s to %s:%s",
|
2006-02-19 12:00:38 +00:00
|
|
|
GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (src_pad),
|
|
|
|
GST_STR_NULL (GST_ELEMENT_NAME (sink)), GST_STR_NULL (sink_pad));
|
2003-04-08 21:59:44 +00:00
|
|
|
|
|
|
|
data->src_pad = g_strdup (src_pad);
|
|
|
|
data->sink = sink;
|
|
|
|
data->sink_pad = g_strdup (sink_pad);
|
2003-12-24 00:26:45 +00:00
|
|
|
if (caps) {
|
|
|
|
data->caps = gst_caps_copy (caps);
|
|
|
|
} else {
|
|
|
|
data->caps = NULL;
|
|
|
|
}
|
2009-10-31 15:56:17 +00:00
|
|
|
data->signal_id = g_signal_connect_data (src, "pad-added",
|
|
|
|
G_CALLBACK (gst_parse_found_pad), data,
|
|
|
|
(GClosureNotify) gst_parse_free_delayed_link, (GConnectFlags) 0);
|
2003-04-08 21:59:44 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
2010-03-18 08:22:09 +00:00
|
|
|
|
2003-12-24 14:39:46 +00:00
|
|
|
/*
|
2003-04-08 21:59:44 +00:00
|
|
|
* performs a link and frees the struct. src and sink elements must be given
|
2003-05-18 15:03:34 +00:00
|
|
|
* return values 0 - link performed
|
2003-04-08 21:59:44 +00:00
|
|
|
* 1 - link delayed
|
|
|
|
* <0 - error
|
|
|
|
*/
|
|
|
|
static gint
|
|
|
|
gst_parse_perform_link (link_t *link, graph_t *graph)
|
|
|
|
{
|
|
|
|
GstElement *src = link->src;
|
|
|
|
GstElement *sink = link->sink;
|
|
|
|
GSList *srcs = link->src_pads;
|
|
|
|
GSList *sinks = link->sink_pads;
|
|
|
|
g_assert (GST_IS_ELEMENT (src));
|
|
|
|
g_assert (GST_IS_ELEMENT (sink));
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2005-10-10 22:49:42 +00:00
|
|
|
GST_CAT_INFO (GST_CAT_PIPELINE,
|
2011-02-14 13:39:21 +00:00
|
|
|
"linking %s:%s to %s:%s (%u/%u) with caps \"%" GST_PTR_FORMAT "\"",
|
2005-10-10 22:49:42 +00:00
|
|
|
GST_ELEMENT_NAME (src), link->src_name ? link->src_name : "(any)",
|
|
|
|
GST_ELEMENT_NAME (sink), link->sink_name ? link->sink_name : "(any)",
|
|
|
|
g_slist_length (srcs), g_slist_length (sinks), link->caps);
|
2003-04-16 21:37:35 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
if (!srcs || !sinks) {
|
2005-10-10 22:49:42 +00:00
|
|
|
if (gst_element_link_pads_filtered (src,
|
|
|
|
srcs ? (const gchar *) srcs->data : NULL, sink,
|
|
|
|
sinks ? (const gchar *) sinks->data : NULL, link->caps)) {
|
2003-04-08 21:59:44 +00:00
|
|
|
goto success;
|
|
|
|
} else {
|
2005-10-10 22:49:42 +00:00
|
|
|
if (gst_parse_perform_delayed_link (src,
|
|
|
|
srcs ? (const gchar *) srcs->data : NULL,
|
|
|
|
sink, sinks ? (const gchar *) sinks->data : NULL, link->caps)) {
|
2003-04-08 21:59:44 +00:00
|
|
|
goto success;
|
|
|
|
} else {
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-02-14 13:37:23 +00:00
|
|
|
if (g_slist_length (link->src_pads) != g_slist_length (link->sink_pads)) {
|
2003-04-08 21:59:44 +00:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
while (srcs && sinks) {
|
|
|
|
const gchar *src_pad = (const gchar *) srcs->data;
|
|
|
|
const gchar *sink_pad = (const gchar *) sinks->data;
|
|
|
|
srcs = g_slist_next (srcs);
|
|
|
|
sinks = g_slist_next (sinks);
|
2005-10-10 22:49:42 +00:00
|
|
|
if (gst_element_link_pads_filtered (src, src_pad, sink, sink_pad,
|
|
|
|
link->caps)) {
|
2003-04-08 21:59:44 +00:00
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
if (gst_parse_perform_delayed_link (src, src_pad,
|
|
|
|
sink, sink_pad,
|
|
|
|
link->caps)) {
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
success:
|
|
|
|
gst_parse_free_link (link);
|
|
|
|
return 0;
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
error:
|
2008-05-25 14:13:22 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_LINK,
|
2005-10-10 22:49:42 +00:00
|
|
|
_("could not link %s to %s"), GST_ELEMENT_NAME (src),
|
|
|
|
GST_ELEMENT_NAME (sink));
|
2003-04-08 21:59:44 +00:00
|
|
|
gst_parse_free_link (link);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2002-04-07 23:32:16 +00:00
|
|
|
|
gst/parse/: Make the parser reentrant and recursively callable. This requires flex >= 2.5.31, for older versions preg...
Original commit message from CVS:
Patch by: Marc-Andre Lureau <marcandre dot lureau at gmail dot com>
* gst/parse/Makefile.am:
* gst/parse/grammar.y:
* gst/parse/parse.l:
Make the parser reentrant and recursively callable. This requires flex
>= 2.5.31, for older versions pregenerated sources are used as we
can't bump the build dependency. Finally fixes #349180.
* gst/gstparse.c: (gst_parse_launch):
Drop the HAVE_MT_SAVE_FLEX #ifdefs as we always use a new enough flex
now anyway.
* docs/gst/Makefile.am:
* docs/gst/Makefile.am:
* gst/parse/grammar.tab.pre.c: (__gst_parse_strdup),
(__gst_parse_strfree), (__gst_parse_link_new),
(__gst_parse_link_free), (__gst_parse_chain_new),
(__gst_parse_chain_free), (SET_ERROR), (YYPRINTF),
(gst_parse_element_set), (gst_parse_free_link),
(gst_parse_found_pad), (gst_parse_perform_delayed_link),
(gst_parse_perform_link), (yytnamerr), (yysyntax_error), (yyerror),
(_gst_parse_launch):
* gst/parse/grammar.tab.pre.h:
* gst/parse/lex._gst_parse_yy.pre.c: (PRINT), (yy_get_next_buffer),
(yy_get_previous_state), (yy_try_NUL_trans), (input),
(_gst_parse_yyrestart), (_gst_parse_yy_switch_to_buffer),
(_gst_parse_yy_load_buffer_state), (_gst_parse_yy_create_buffer),
(_gst_parse_yy_delete_buffer), (_gst_parse_yy_init_buffer),
(_gst_parse_yy_flush_buffer), (_gst_parse_yypush_buffer_state),
(_gst_parse_yypop_buffer_state),
(_gst_parse_yyensure_buffer_stack), (_gst_parse_yy_scan_buffer),
(_gst_parse_yy_scan_string), (_gst_parse_yy_scan_bytes),
(yy_fatal_error), (_gst_parse_yyget_extra),
(_gst_parse_yyget_lineno), (_gst_parse_yyget_column),
(_gst_parse_yyget_in), (_gst_parse_yyget_out),
(_gst_parse_yyget_leng), (_gst_parse_yyget_text),
(_gst_parse_yyset_extra), (_gst_parse_yyset_lineno),
(_gst_parse_yyset_column), (_gst_parse_yyset_in),
(_gst_parse_yyset_out), (_gst_parse_yyget_debug),
(_gst_parse_yyset_debug), (_gst_parse_yyget_lval),
(_gst_parse_yyset_lval), (_gst_parse_yylex_init),
(yy_init_globals), (_gst_parse_yylex_destroy), (yy_flex_strncpy),
(yy_flex_strlen), (_gst_parse_yyalloc), (_gst_parse_yyrealloc),
(_gst_parse_yyfree):
If the installed flex version is too old use pre-generated parser
sources. These pre-generated parser sources are always updated when
the actual flex/bison sources change but require everybody who wants
to change something in the parser to have flex >= 2.5.31 installed.
2007-04-18 12:34:51 +00:00
|
|
|
static int yyerror (void *scanner, graph_t *graph, const char *s);
|
2002-03-31 21:09:17 +00:00
|
|
|
%}
|
|
|
|
|
|
|
|
%union {
|
|
|
|
gchar *s;
|
2003-04-08 21:59:44 +00:00
|
|
|
chain_t *c;
|
|
|
|
link_t *l;
|
|
|
|
GstElement *e;
|
|
|
|
GSList *p;
|
2002-04-01 06:30:39 +00:00
|
|
|
graph_t *g;
|
2002-03-31 21:09:17 +00:00
|
|
|
}
|
|
|
|
|
2003-11-24 03:21:54 +00:00
|
|
|
%token <s> PARSE_URL
|
2002-04-07 23:32:16 +00:00
|
|
|
%token <s> IDENTIFIER
|
2003-04-08 21:59:44 +00:00
|
|
|
%left <s> REF PADREF BINREF
|
|
|
|
%token <s> ASSIGNMENT
|
2003-05-17 20:45:06 +00:00
|
|
|
%token <s> LINK
|
2002-03-31 21:09:17 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
%type <g> graph
|
|
|
|
%type <c> chain bin
|
|
|
|
%type <l> reference
|
|
|
|
%type <l> linkpart link
|
|
|
|
%type <p> linklist
|
2011-02-14 13:39:21 +00:00
|
|
|
%type <e> element
|
2003-04-08 21:59:44 +00:00
|
|
|
%type <p> padlist pads assignments
|
|
|
|
|
2005-12-07 11:52:05 +00:00
|
|
|
%left '(' ')'
|
2002-04-07 23:32:16 +00:00
|
|
|
%left ','
|
2003-04-08 21:59:44 +00:00
|
|
|
%right '.'
|
|
|
|
%left '!' '='
|
2002-04-01 04:36:56 +00:00
|
|
|
|
2013-08-21 06:59:29 +00:00
|
|
|
%lex-param { void *scanner }
|
gst/parse/: Make the parser reentrant and recursively callable. This requires flex >= 2.5.31, for older versions preg...
Original commit message from CVS:
Patch by: Marc-Andre Lureau <marcandre dot lureau at gmail dot com>
* gst/parse/Makefile.am:
* gst/parse/grammar.y:
* gst/parse/parse.l:
Make the parser reentrant and recursively callable. This requires flex
>= 2.5.31, for older versions pregenerated sources are used as we
can't bump the build dependency. Finally fixes #349180.
* gst/gstparse.c: (gst_parse_launch):
Drop the HAVE_MT_SAVE_FLEX #ifdefs as we always use a new enough flex
now anyway.
* docs/gst/Makefile.am:
* docs/gst/Makefile.am:
* gst/parse/grammar.tab.pre.c: (__gst_parse_strdup),
(__gst_parse_strfree), (__gst_parse_link_new),
(__gst_parse_link_free), (__gst_parse_chain_new),
(__gst_parse_chain_free), (SET_ERROR), (YYPRINTF),
(gst_parse_element_set), (gst_parse_free_link),
(gst_parse_found_pad), (gst_parse_perform_delayed_link),
(gst_parse_perform_link), (yytnamerr), (yysyntax_error), (yyerror),
(_gst_parse_launch):
* gst/parse/grammar.tab.pre.h:
* gst/parse/lex._gst_parse_yy.pre.c: (PRINT), (yy_get_next_buffer),
(yy_get_previous_state), (yy_try_NUL_trans), (input),
(_gst_parse_yyrestart), (_gst_parse_yy_switch_to_buffer),
(_gst_parse_yy_load_buffer_state), (_gst_parse_yy_create_buffer),
(_gst_parse_yy_delete_buffer), (_gst_parse_yy_init_buffer),
(_gst_parse_yy_flush_buffer), (_gst_parse_yypush_buffer_state),
(_gst_parse_yypop_buffer_state),
(_gst_parse_yyensure_buffer_stack), (_gst_parse_yy_scan_buffer),
(_gst_parse_yy_scan_string), (_gst_parse_yy_scan_bytes),
(yy_fatal_error), (_gst_parse_yyget_extra),
(_gst_parse_yyget_lineno), (_gst_parse_yyget_column),
(_gst_parse_yyget_in), (_gst_parse_yyget_out),
(_gst_parse_yyget_leng), (_gst_parse_yyget_text),
(_gst_parse_yyset_extra), (_gst_parse_yyset_lineno),
(_gst_parse_yyset_column), (_gst_parse_yyset_in),
(_gst_parse_yyset_out), (_gst_parse_yyget_debug),
(_gst_parse_yyset_debug), (_gst_parse_yyget_lval),
(_gst_parse_yyset_lval), (_gst_parse_yylex_init),
(yy_init_globals), (_gst_parse_yylex_destroy), (yy_flex_strncpy),
(yy_flex_strlen), (_gst_parse_yyalloc), (_gst_parse_yyrealloc),
(_gst_parse_yyfree):
If the installed flex version is too old use pre-generated parser
sources. These pre-generated parser sources are always updated when
the actual flex/bison sources change but require everybody who wants
to change something in the parser to have flex >= 2.5.31 installed.
2007-04-18 12:34:51 +00:00
|
|
|
%parse-param { void *scanner }
|
|
|
|
%parse-param { graph_t *graph }
|
|
|
|
%pure-parser
|
2002-04-07 23:32:16 +00:00
|
|
|
|
2002-04-01 04:36:56 +00:00
|
|
|
%start graph
|
2002-03-31 21:09:17 +00:00
|
|
|
%%
|
|
|
|
|
2011-02-14 13:39:21 +00:00
|
|
|
element: IDENTIFIER { $$ = gst_element_factory_make ($1, NULL);
|
2006-07-27 13:26:27 +00:00
|
|
|
if ($$ == NULL) {
|
2008-05-25 14:13:22 +00:00
|
|
|
ADD_MISSING_ELEMENT (graph, $1);
|
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, _("no element \"%s\""), $1);
|
2008-05-25 13:56:38 +00:00
|
|
|
/* if FATAL_ERRORS flag is set, we don't have to worry about backwards
|
|
|
|
* compatibility and can continue parsing and check for other missing
|
|
|
|
* elements */
|
2008-05-25 14:13:22 +00:00
|
|
|
if ((graph->flags & GST_PARSE_FLAG_FATAL_ERRORS) == 0) {
|
2008-05-25 13:56:38 +00:00
|
|
|
gst_parse_strfree ($1);
|
|
|
|
YYERROR;
|
|
|
|
}
|
2006-07-27 13:26:27 +00:00
|
|
|
}
|
|
|
|
gst_parse_strfree ($1);
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
|
|
|
| element ASSIGNMENT { gst_parse_element_set ($2, $1, graph);
|
|
|
|
$$ = $1;
|
|
|
|
}
|
|
|
|
;
|
|
|
|
assignments: /* NOP */ { $$ = NULL; }
|
|
|
|
| assignments ASSIGNMENT { $$ = g_slist_prepend ($1, $2); }
|
2011-02-14 13:39:21 +00:00
|
|
|
;
|
2010-04-07 11:24:14 +00:00
|
|
|
bin: '(' assignments chain ')' { GST_BIN_MAKE ($$, "bin", $3, $2, no_free); }
|
|
|
|
| BINREF assignments chain ')' { GST_BIN_MAKE ($$, $1, $3, $2, gst_parse_strfree);
|
2003-04-08 21:59:44 +00:00
|
|
|
gst_parse_strfree ($1);
|
|
|
|
}
|
2010-04-07 11:24:14 +00:00
|
|
|
| BINREF assignments ')' { GST_BIN_MAKE ($$, $1, NULL, $2, gst_parse_strfree);
|
2003-04-14 18:33:58 +00:00
|
|
|
gst_parse_strfree ($1);
|
|
|
|
}
|
2010-04-07 11:24:14 +00:00
|
|
|
| BINREF assignments error ')' { GST_BIN_MAKE ($$, $1, NULL, $2, gst_parse_strfree);
|
2003-04-14 18:33:58 +00:00
|
|
|
gst_parse_strfree ($1);
|
|
|
|
}
|
2003-04-08 21:59:44 +00:00
|
|
|
;
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
pads: PADREF { $$ = g_slist_prepend (NULL, $1); }
|
|
|
|
| PADREF padlist { $$ = $2;
|
|
|
|
$$ = g_slist_prepend ($$, $1);
|
2011-02-14 13:39:21 +00:00
|
|
|
}
|
2003-04-23 20:06:54 +00:00
|
|
|
;
|
2003-04-08 21:59:44 +00:00
|
|
|
padlist: ',' IDENTIFIER { $$ = g_slist_prepend (NULL, $2); }
|
|
|
|
| ',' IDENTIFIER padlist { $$ = g_slist_prepend ($3, $2); }
|
|
|
|
;
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
reference: REF { MAKE_REF ($$, $1, NULL); }
|
|
|
|
| REF padlist { MAKE_REF ($$, $1, $2); }
|
|
|
|
;
|
|
|
|
|
|
|
|
linkpart: reference { $$ = $1; }
|
|
|
|
| pads { MAKE_REF ($$, NULL, $1); }
|
|
|
|
| /* NOP */ { MAKE_REF ($$, NULL, NULL); }
|
|
|
|
;
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-05-17 20:45:06 +00:00
|
|
|
link: linkpart LINK linkpart { $$ = $1;
|
|
|
|
if ($2) {
|
|
|
|
$$->caps = gst_caps_from_string ($2);
|
2006-07-27 13:26:27 +00:00
|
|
|
if ($$->caps == NULL)
|
2008-05-25 14:13:22 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("could not parse caps \"%s\""), $2);
|
2003-05-17 20:45:06 +00:00
|
|
|
gst_parse_strfree ($2);
|
|
|
|
}
|
2003-04-08 21:59:44 +00:00
|
|
|
$$->sink_name = $3->src_name;
|
|
|
|
$$->sink_pads = $3->src_pads;
|
|
|
|
gst_parse_link_free ($3);
|
|
|
|
}
|
|
|
|
;
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
linklist: link { $$ = g_slist_prepend (NULL, $1); }
|
|
|
|
| link linklist { $$ = g_slist_prepend ($2, $1); }
|
2003-04-14 18:33:58 +00:00
|
|
|
| linklist error { $$ = $1; }
|
2011-02-14 13:39:21 +00:00
|
|
|
;
|
2003-04-27 23:56:31 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
chain: element { $$ = gst_parse_chain_new ();
|
|
|
|
$$->first = $$->last = $1;
|
|
|
|
$$->front = $$->back = NULL;
|
|
|
|
$$->elements = g_slist_prepend (NULL, $1);
|
|
|
|
}
|
|
|
|
| bin { $$ = $1; }
|
|
|
|
| chain chain { if ($1->back && $2->front) {
|
|
|
|
if (!$1->back->sink_name) {
|
2008-05-25 14:13:22 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("link without source element"));
|
2003-04-08 21:59:44 +00:00
|
|
|
gst_parse_free_link ($1->back);
|
|
|
|
} else {
|
2008-05-25 14:13:22 +00:00
|
|
|
graph->links = g_slist_prepend (graph->links, $1->back);
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
|
|
|
if (!$2->front->src_name) {
|
2008-05-25 14:13:22 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("link without sink element"));
|
2003-04-08 21:59:44 +00:00
|
|
|
gst_parse_free_link ($2->front);
|
|
|
|
} else {
|
2008-05-25 14:13:22 +00:00
|
|
|
graph->links = g_slist_prepend (graph->links, $2->front);
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
|
|
|
$1->back = NULL;
|
|
|
|
} else if ($1->back) {
|
|
|
|
if (!$1->back->sink_name) {
|
|
|
|
$1->back->sink = $2->first;
|
|
|
|
}
|
|
|
|
} else if ($2->front) {
|
|
|
|
if (!$2->front->src_name) {
|
|
|
|
$2->front->src = $1->last;
|
|
|
|
}
|
2003-04-16 21:37:35 +00:00
|
|
|
$1->back = $2->front;
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-04-16 21:37:35 +00:00
|
|
|
if ($1->back) {
|
2008-05-25 14:13:22 +00:00
|
|
|
graph->links = g_slist_prepend (graph->links, $1->back);
|
2003-04-16 21:37:35 +00:00
|
|
|
}
|
2003-04-08 21:59:44 +00:00
|
|
|
$1->last = $2->last;
|
|
|
|
$1->back = $2->back;
|
|
|
|
$1->elements = g_slist_concat ($1->elements, $2->elements);
|
2004-04-19 17:40:24 +00:00
|
|
|
if ($2)
|
|
|
|
gst_parse_chain_free ($2);
|
2003-04-08 21:59:44 +00:00
|
|
|
$$ = $1;
|
|
|
|
}
|
|
|
|
| chain linklist { GSList *walk;
|
|
|
|
if ($1->back) {
|
2003-04-17 14:52:38 +00:00
|
|
|
$2 = g_slist_prepend ($2, $1->back);
|
2003-04-08 21:59:44 +00:00
|
|
|
$1->back = NULL;
|
|
|
|
} else {
|
|
|
|
if (!((link_t *) $2->data)->src_name) {
|
|
|
|
((link_t *) $2->data)->src = $1->last;
|
2011-02-14 13:39:21 +00:00
|
|
|
}
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
2004-04-19 17:40:24 +00:00
|
|
|
for (walk = $2; walk; walk = walk->next) {
|
2003-04-08 21:59:44 +00:00
|
|
|
link_t *link = (link_t *) walk->data;
|
2004-04-19 17:40:24 +00:00
|
|
|
if (!link->sink_name && walk->next) {
|
2008-05-25 14:13:22 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("link without sink element"));
|
2003-04-08 21:59:44 +00:00
|
|
|
gst_parse_free_link (link);
|
|
|
|
} else if (!link->src_name && !link->src) {
|
2008-05-25 14:13:22 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("link without source element"));
|
2003-04-08 21:59:44 +00:00
|
|
|
gst_parse_free_link (link);
|
|
|
|
} else {
|
2004-04-19 17:40:24 +00:00
|
|
|
if (walk->next) {
|
2008-05-25 14:13:22 +00:00
|
|
|
graph->links = g_slist_prepend (graph->links, link);
|
2003-04-08 21:59:44 +00:00
|
|
|
} else {
|
|
|
|
$1->back = link;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_slist_free ($2);
|
|
|
|
$$ = $1;
|
|
|
|
}
|
2003-04-14 18:33:58 +00:00
|
|
|
| chain error { $$ = $1; }
|
2003-11-24 03:21:54 +00:00
|
|
|
| link chain { if ($2->front) {
|
|
|
|
if (!$2->front->src_name) {
|
2008-05-25 14:13:22 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("link without source element"));
|
2003-11-24 03:21:54 +00:00
|
|
|
gst_parse_free_link ($2->front);
|
|
|
|
} else {
|
2008-05-25 14:13:22 +00:00
|
|
|
graph->links = g_slist_prepend (graph->links, $2->front);
|
2003-11-24 03:21:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!$1->sink_name) {
|
|
|
|
$1->sink = $2->first;
|
|
|
|
}
|
|
|
|
$2->front = $1;
|
|
|
|
$$ = $2;
|
|
|
|
}
|
|
|
|
| PARSE_URL chain { $$ = $2;
|
|
|
|
if ($$->front) {
|
2011-02-14 13:39:21 +00:00
|
|
|
GstElement *element =
|
2012-06-23 13:41:17 +00:00
|
|
|
gst_element_make_from_uri (GST_URI_SRC, $1, NULL, NULL);
|
|
|
|
/* FIXME: get and parse error properly */
|
2003-11-24 03:21:54 +00:00
|
|
|
if (!element) {
|
2011-02-14 13:39:21 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
|
2004-01-13 14:23:44 +00:00
|
|
|
_("no source element for URI \"%s\""), $1);
|
2003-11-24 03:21:54 +00:00
|
|
|
} else {
|
|
|
|
$$->front->src = element;
|
2008-05-25 14:13:22 +00:00
|
|
|
graph->links = g_slist_prepend (
|
|
|
|
graph->links, $$->front);
|
2003-11-24 03:21:54 +00:00
|
|
|
$$->front = NULL;
|
|
|
|
$$->elements = g_slist_prepend ($$->elements, element);
|
|
|
|
}
|
|
|
|
} else {
|
2011-02-14 13:39:21 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_LINK,
|
2004-01-13 14:23:44 +00:00
|
|
|
_("no element to link URI \"%s\" to"), $1);
|
2003-11-24 03:21:54 +00:00
|
|
|
}
|
|
|
|
g_free ($1);
|
|
|
|
}
|
|
|
|
| link PARSE_URL { GstElement *element =
|
2012-06-23 13:41:17 +00:00
|
|
|
gst_element_make_from_uri (GST_URI_SINK, $2, NULL, NULL);
|
|
|
|
/* FIXME: get and parse error properly */
|
2003-11-24 03:21:54 +00:00
|
|
|
if (!element) {
|
2011-02-14 13:39:21 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
|
2004-01-13 14:23:44 +00:00
|
|
|
_("no sink element for URI \"%s\""), $2);
|
2006-07-27 13:26:27 +00:00
|
|
|
gst_parse_link_free ($1);
|
|
|
|
g_free ($2);
|
2003-11-24 03:21:54 +00:00
|
|
|
YYERROR;
|
|
|
|
} else if ($1->sink_name || $1->sink_pads) {
|
2006-07-27 13:26:27 +00:00
|
|
|
gst_object_unref (element);
|
2011-02-14 13:39:21 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_LINK,
|
2004-01-13 14:23:44 +00:00
|
|
|
_("could not link sink element for URI \"%s\""), $2);
|
2006-07-27 13:26:27 +00:00
|
|
|
gst_parse_link_free ($1);
|
|
|
|
g_free ($2);
|
2003-11-24 03:21:54 +00:00
|
|
|
YYERROR;
|
|
|
|
} else {
|
|
|
|
$$ = gst_parse_chain_new ();
|
|
|
|
$$->first = $$->last = element;
|
|
|
|
$$->front = $1;
|
|
|
|
$$->front->sink = element;
|
|
|
|
$$->elements = g_slist_prepend (NULL, element);
|
|
|
|
}
|
|
|
|
g_free ($2);
|
|
|
|
}
|
2003-04-08 21:59:44 +00:00
|
|
|
;
|
2008-05-25 14:13:22 +00:00
|
|
|
graph: /* NOP */ { SET_ERROR (graph->error, GST_PARSE_ERROR_EMPTY, _("empty pipeline not allowed"));
|
|
|
|
$$ = graph;
|
2003-04-27 23:56:31 +00:00
|
|
|
}
|
2008-05-25 14:13:22 +00:00
|
|
|
| chain { $$ = graph;
|
2003-04-08 21:59:44 +00:00
|
|
|
if ($1->front) {
|
|
|
|
if (!$1->front->src_name) {
|
2008-05-25 14:13:22 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("link without source element"));
|
2003-04-08 21:59:44 +00:00
|
|
|
gst_parse_free_link ($1->front);
|
|
|
|
} else {
|
|
|
|
$$->links = g_slist_prepend ($$->links, $1->front);
|
|
|
|
}
|
|
|
|
$1->front = NULL;
|
|
|
|
}
|
|
|
|
if ($1->back) {
|
|
|
|
if (!$1->back->sink_name) {
|
2008-05-25 14:13:22 +00:00
|
|
|
SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("link without sink element"));
|
2003-04-08 21:59:44 +00:00
|
|
|
gst_parse_free_link ($1->back);
|
|
|
|
} else {
|
|
|
|
$$->links = g_slist_prepend ($$->links, $1->back);
|
|
|
|
}
|
|
|
|
$1->back = NULL;
|
|
|
|
}
|
|
|
|
$$->chain = $1;
|
|
|
|
}
|
|
|
|
;
|
2002-03-31 21:09:17 +00:00
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
|
2002-04-07 23:32:16 +00:00
|
|
|
static int
|
gst/parse/: Make the parser reentrant and recursively callable. This requires flex >= 2.5.31, for older versions preg...
Original commit message from CVS:
Patch by: Marc-Andre Lureau <marcandre dot lureau at gmail dot com>
* gst/parse/Makefile.am:
* gst/parse/grammar.y:
* gst/parse/parse.l:
Make the parser reentrant and recursively callable. This requires flex
>= 2.5.31, for older versions pregenerated sources are used as we
can't bump the build dependency. Finally fixes #349180.
* gst/gstparse.c: (gst_parse_launch):
Drop the HAVE_MT_SAVE_FLEX #ifdefs as we always use a new enough flex
now anyway.
* docs/gst/Makefile.am:
* docs/gst/Makefile.am:
* gst/parse/grammar.tab.pre.c: (__gst_parse_strdup),
(__gst_parse_strfree), (__gst_parse_link_new),
(__gst_parse_link_free), (__gst_parse_chain_new),
(__gst_parse_chain_free), (SET_ERROR), (YYPRINTF),
(gst_parse_element_set), (gst_parse_free_link),
(gst_parse_found_pad), (gst_parse_perform_delayed_link),
(gst_parse_perform_link), (yytnamerr), (yysyntax_error), (yyerror),
(_gst_parse_launch):
* gst/parse/grammar.tab.pre.h:
* gst/parse/lex._gst_parse_yy.pre.c: (PRINT), (yy_get_next_buffer),
(yy_get_previous_state), (yy_try_NUL_trans), (input),
(_gst_parse_yyrestart), (_gst_parse_yy_switch_to_buffer),
(_gst_parse_yy_load_buffer_state), (_gst_parse_yy_create_buffer),
(_gst_parse_yy_delete_buffer), (_gst_parse_yy_init_buffer),
(_gst_parse_yy_flush_buffer), (_gst_parse_yypush_buffer_state),
(_gst_parse_yypop_buffer_state),
(_gst_parse_yyensure_buffer_stack), (_gst_parse_yy_scan_buffer),
(_gst_parse_yy_scan_string), (_gst_parse_yy_scan_bytes),
(yy_fatal_error), (_gst_parse_yyget_extra),
(_gst_parse_yyget_lineno), (_gst_parse_yyget_column),
(_gst_parse_yyget_in), (_gst_parse_yyget_out),
(_gst_parse_yyget_leng), (_gst_parse_yyget_text),
(_gst_parse_yyset_extra), (_gst_parse_yyset_lineno),
(_gst_parse_yyset_column), (_gst_parse_yyset_in),
(_gst_parse_yyset_out), (_gst_parse_yyget_debug),
(_gst_parse_yyset_debug), (_gst_parse_yyget_lval),
(_gst_parse_yyset_lval), (_gst_parse_yylex_init),
(yy_init_globals), (_gst_parse_yylex_destroy), (yy_flex_strncpy),
(yy_flex_strlen), (_gst_parse_yyalloc), (_gst_parse_yyrealloc),
(_gst_parse_yyfree):
If the installed flex version is too old use pre-generated parser
sources. These pre-generated parser sources are always updated when
the actual flex/bison sources change but require everybody who wants
to change something in the parser to have flex >= 2.5.31 installed.
2007-04-18 12:34:51 +00:00
|
|
|
yyerror (void *scanner, graph_t *graph, const char *s)
|
2002-03-31 21:09:17 +00:00
|
|
|
{
|
2003-04-08 21:59:44 +00:00
|
|
|
/* FIXME: This should go into the GError somehow, but how? */
|
gst/gststructure.*: Add API for setting values into structures without performing a quark lookup, if the appropriate ...
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_id_set),
(gst_structure_id_set_valist):
* gst/gststructure.h:
Add API for setting values into structures without performing
a quark lookup, if the appropriate quark is already known.
API: gst_structure_id_set
API: gst_structure_id_set_valist
* gst/parse/grammar.y:
* gst/parse/parse.l:
Remove some dead code shown by the coverage information.
Don't throw a critical g_warning when encountering a syntax error,
just warn and let the normal error path handle it.
* plugins/elements/gstelements.c:
Bump the rank of filesink up to PRIMARY so that it is preferred over
gnomevfssink for file:// sink uri's
* tests/check/pipelines/parse-launch.c: (expected_fail_pipe),
(GST_START_TEST), (run_delayed_test),
(gst_parse_test_element_base_init),
(gst_parse_test_element_class_init), (gst_parse_test_element_init),
(gst_parse_test_element_change_state),
(gst_register_parse_element), (parse_suite):
Beef up the tests for parse syntax to check that more error cases
fail as they are supposed to. Increases the test coverage a bit.
2006-07-26 17:04:45 +00:00
|
|
|
GST_WARNING ("Error during parsing: %s", s);
|
2002-03-31 21:09:17 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
gst/parse/: Make the parser reentrant and recursively callable. This requires flex >= 2.5.31, for older versions preg...
Original commit message from CVS:
Patch by: Marc-Andre Lureau <marcandre dot lureau at gmail dot com>
* gst/parse/Makefile.am:
* gst/parse/grammar.y:
* gst/parse/parse.l:
Make the parser reentrant and recursively callable. This requires flex
>= 2.5.31, for older versions pregenerated sources are used as we
can't bump the build dependency. Finally fixes #349180.
* gst/gstparse.c: (gst_parse_launch):
Drop the HAVE_MT_SAVE_FLEX #ifdefs as we always use a new enough flex
now anyway.
* docs/gst/Makefile.am:
* docs/gst/Makefile.am:
* gst/parse/grammar.tab.pre.c: (__gst_parse_strdup),
(__gst_parse_strfree), (__gst_parse_link_new),
(__gst_parse_link_free), (__gst_parse_chain_new),
(__gst_parse_chain_free), (SET_ERROR), (YYPRINTF),
(gst_parse_element_set), (gst_parse_free_link),
(gst_parse_found_pad), (gst_parse_perform_delayed_link),
(gst_parse_perform_link), (yytnamerr), (yysyntax_error), (yyerror),
(_gst_parse_launch):
* gst/parse/grammar.tab.pre.h:
* gst/parse/lex._gst_parse_yy.pre.c: (PRINT), (yy_get_next_buffer),
(yy_get_previous_state), (yy_try_NUL_trans), (input),
(_gst_parse_yyrestart), (_gst_parse_yy_switch_to_buffer),
(_gst_parse_yy_load_buffer_state), (_gst_parse_yy_create_buffer),
(_gst_parse_yy_delete_buffer), (_gst_parse_yy_init_buffer),
(_gst_parse_yy_flush_buffer), (_gst_parse_yypush_buffer_state),
(_gst_parse_yypop_buffer_state),
(_gst_parse_yyensure_buffer_stack), (_gst_parse_yy_scan_buffer),
(_gst_parse_yy_scan_string), (_gst_parse_yy_scan_bytes),
(yy_fatal_error), (_gst_parse_yyget_extra),
(_gst_parse_yyget_lineno), (_gst_parse_yyget_column),
(_gst_parse_yyget_in), (_gst_parse_yyget_out),
(_gst_parse_yyget_leng), (_gst_parse_yyget_text),
(_gst_parse_yyset_extra), (_gst_parse_yyset_lineno),
(_gst_parse_yyset_column), (_gst_parse_yyset_in),
(_gst_parse_yyset_out), (_gst_parse_yyget_debug),
(_gst_parse_yyset_debug), (_gst_parse_yyget_lval),
(_gst_parse_yyset_lval), (_gst_parse_yylex_init),
(yy_init_globals), (_gst_parse_yylex_destroy), (yy_flex_strncpy),
(yy_flex_strlen), (_gst_parse_yyalloc), (_gst_parse_yyrealloc),
(_gst_parse_yyfree):
If the installed flex version is too old use pre-generated parser
sources. These pre-generated parser sources are always updated when
the actual flex/bison sources change but require everybody who wants
to change something in the parser to have flex >= 2.5.31 installed.
2007-04-18 12:34:51 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
GstElement *
|
2011-10-08 13:17:25 +00:00
|
|
|
priv_gst_parse_launch (const gchar *str, GError **error, GstParseContext *ctx,
|
API: gst_parse_launch_full()
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gst.c: (init_post):
* gst/gst_private.h: (_GstParseContext):
* gst/gstparse.c: (gst_parse_error_quark), (gst_parse_context_new),
(gst_parse_context_free), (gst_parse_context_get_missing_elements),
(gst_parse_launchv), (gst_parse_launchv_full), (gst_parse_launch),
(gst_parse_launch_full):
* gst/gstparse.h: (GST_PARSE_FLAG_NONE), (GST_PARSE_FLAG_FATAL_ERRORS),
(GstParseFlags), (GstParseContext):
* gst/gstutils.c: (gst_parse_bin_from_description),
(gst_parse_bin_from_description_full):
* gst/gstutils.h:
* gst/parse/grammar.y:
* gst/parse/types.h:
* win32/common/libgstreamer.def:
Add new gst_parse_*_full API (#528178):
API: gst_parse_launch_full()
API: gst_parse_launchv_full()
API: gst_parse_bin_from_description_full()
API: gst_parse_context_new()
API: gst_parse_context_free()
API: gst_parse_context_get_missing_elements()
2008-05-24 15:33:53 +00:00
|
|
|
GstParseFlags flags)
|
2002-03-31 21:09:17 +00:00
|
|
|
{
|
2003-04-08 21:59:44 +00:00
|
|
|
graph_t g;
|
|
|
|
gchar *dstr;
|
|
|
|
GSList *walk;
|
|
|
|
GstBin *bin = NULL;
|
|
|
|
GstElement *ret;
|
gst/parse/: Make the parser reentrant and recursively callable. This requires flex >= 2.5.31, for older versions preg...
Original commit message from CVS:
Patch by: Marc-Andre Lureau <marcandre dot lureau at gmail dot com>
* gst/parse/Makefile.am:
* gst/parse/grammar.y:
* gst/parse/parse.l:
Make the parser reentrant and recursively callable. This requires flex
>= 2.5.31, for older versions pregenerated sources are used as we
can't bump the build dependency. Finally fixes #349180.
* gst/gstparse.c: (gst_parse_launch):
Drop the HAVE_MT_SAVE_FLEX #ifdefs as we always use a new enough flex
now anyway.
* docs/gst/Makefile.am:
* docs/gst/Makefile.am:
* gst/parse/grammar.tab.pre.c: (__gst_parse_strdup),
(__gst_parse_strfree), (__gst_parse_link_new),
(__gst_parse_link_free), (__gst_parse_chain_new),
(__gst_parse_chain_free), (SET_ERROR), (YYPRINTF),
(gst_parse_element_set), (gst_parse_free_link),
(gst_parse_found_pad), (gst_parse_perform_delayed_link),
(gst_parse_perform_link), (yytnamerr), (yysyntax_error), (yyerror),
(_gst_parse_launch):
* gst/parse/grammar.tab.pre.h:
* gst/parse/lex._gst_parse_yy.pre.c: (PRINT), (yy_get_next_buffer),
(yy_get_previous_state), (yy_try_NUL_trans), (input),
(_gst_parse_yyrestart), (_gst_parse_yy_switch_to_buffer),
(_gst_parse_yy_load_buffer_state), (_gst_parse_yy_create_buffer),
(_gst_parse_yy_delete_buffer), (_gst_parse_yy_init_buffer),
(_gst_parse_yy_flush_buffer), (_gst_parse_yypush_buffer_state),
(_gst_parse_yypop_buffer_state),
(_gst_parse_yyensure_buffer_stack), (_gst_parse_yy_scan_buffer),
(_gst_parse_yy_scan_string), (_gst_parse_yy_scan_bytes),
(yy_fatal_error), (_gst_parse_yyget_extra),
(_gst_parse_yyget_lineno), (_gst_parse_yyget_column),
(_gst_parse_yyget_in), (_gst_parse_yyget_out),
(_gst_parse_yyget_leng), (_gst_parse_yyget_text),
(_gst_parse_yyset_extra), (_gst_parse_yyset_lineno),
(_gst_parse_yyset_column), (_gst_parse_yyset_in),
(_gst_parse_yyset_out), (_gst_parse_yyget_debug),
(_gst_parse_yyset_debug), (_gst_parse_yyget_lval),
(_gst_parse_yyset_lval), (_gst_parse_yylex_init),
(yy_init_globals), (_gst_parse_yylex_destroy), (yy_flex_strncpy),
(yy_flex_strlen), (_gst_parse_yyalloc), (_gst_parse_yyrealloc),
(_gst_parse_yyfree):
If the installed flex version is too old use pre-generated parser
sources. These pre-generated parser sources are always updated when
the actual flex/bison sources change but require everybody who wants
to change something in the parser to have flex >= 2.5.31 installed.
2007-04-18 12:34:51 +00:00
|
|
|
yyscan_t scanner;
|
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
g_return_val_if_fail (str != NULL, NULL);
|
2008-05-22 15:38:54 +00:00
|
|
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
2002-04-07 23:32:16 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
g.chain = NULL;
|
|
|
|
g.links = NULL;
|
|
|
|
g.error = error;
|
API: gst_parse_launch_full()
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gst.c: (init_post):
* gst/gst_private.h: (_GstParseContext):
* gst/gstparse.c: (gst_parse_error_quark), (gst_parse_context_new),
(gst_parse_context_free), (gst_parse_context_get_missing_elements),
(gst_parse_launchv), (gst_parse_launchv_full), (gst_parse_launch),
(gst_parse_launch_full):
* gst/gstparse.h: (GST_PARSE_FLAG_NONE), (GST_PARSE_FLAG_FATAL_ERRORS),
(GstParseFlags), (GstParseContext):
* gst/gstutils.c: (gst_parse_bin_from_description),
(gst_parse_bin_from_description_full):
* gst/gstutils.h:
* gst/parse/grammar.y:
* gst/parse/types.h:
* win32/common/libgstreamer.def:
Add new gst_parse_*_full API (#528178):
API: gst_parse_launch_full()
API: gst_parse_launchv_full()
API: gst_parse_bin_from_description_full()
API: gst_parse_context_new()
API: gst_parse_context_free()
API: gst_parse_context_get_missing_elements()
2008-05-24 15:33:53 +00:00
|
|
|
g.ctx = ctx;
|
|
|
|
g.flags = flags;
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
#ifdef __GST_PARSE_TRACE
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_CAT_DEBUG (GST_CAT_PIPELINE, "TRACE: tracing enabled");
|
2003-04-08 21:59:44 +00:00
|
|
|
__strings = __chains = __links = 0;
|
|
|
|
#endif /* __GST_PARSE_TRACE */
|
|
|
|
|
|
|
|
dstr = g_strdup (str);
|
2011-10-08 13:17:25 +00:00
|
|
|
priv_gst_parse_yylex_init (&scanner);
|
|
|
|
priv_gst_parse_yy_scan_string (dstr, scanner);
|
2002-04-01 06:30:39 +00:00
|
|
|
|
2005-10-10 23:11:33 +00:00
|
|
|
#ifndef YYDEBUG
|
2003-04-08 21:59:44 +00:00
|
|
|
yydebug = 1;
|
2002-04-01 06:30:39 +00:00
|
|
|
#endif
|
|
|
|
|
gst/parse/: Make the parser reentrant and recursively callable. This requires flex >= 2.5.31, for older versions preg...
Original commit message from CVS:
Patch by: Marc-Andre Lureau <marcandre dot lureau at gmail dot com>
* gst/parse/Makefile.am:
* gst/parse/grammar.y:
* gst/parse/parse.l:
Make the parser reentrant and recursively callable. This requires flex
>= 2.5.31, for older versions pregenerated sources are used as we
can't bump the build dependency. Finally fixes #349180.
* gst/gstparse.c: (gst_parse_launch):
Drop the HAVE_MT_SAVE_FLEX #ifdefs as we always use a new enough flex
now anyway.
* docs/gst/Makefile.am:
* docs/gst/Makefile.am:
* gst/parse/grammar.tab.pre.c: (__gst_parse_strdup),
(__gst_parse_strfree), (__gst_parse_link_new),
(__gst_parse_link_free), (__gst_parse_chain_new),
(__gst_parse_chain_free), (SET_ERROR), (YYPRINTF),
(gst_parse_element_set), (gst_parse_free_link),
(gst_parse_found_pad), (gst_parse_perform_delayed_link),
(gst_parse_perform_link), (yytnamerr), (yysyntax_error), (yyerror),
(_gst_parse_launch):
* gst/parse/grammar.tab.pre.h:
* gst/parse/lex._gst_parse_yy.pre.c: (PRINT), (yy_get_next_buffer),
(yy_get_previous_state), (yy_try_NUL_trans), (input),
(_gst_parse_yyrestart), (_gst_parse_yy_switch_to_buffer),
(_gst_parse_yy_load_buffer_state), (_gst_parse_yy_create_buffer),
(_gst_parse_yy_delete_buffer), (_gst_parse_yy_init_buffer),
(_gst_parse_yy_flush_buffer), (_gst_parse_yypush_buffer_state),
(_gst_parse_yypop_buffer_state),
(_gst_parse_yyensure_buffer_stack), (_gst_parse_yy_scan_buffer),
(_gst_parse_yy_scan_string), (_gst_parse_yy_scan_bytes),
(yy_fatal_error), (_gst_parse_yyget_extra),
(_gst_parse_yyget_lineno), (_gst_parse_yyget_column),
(_gst_parse_yyget_in), (_gst_parse_yyget_out),
(_gst_parse_yyget_leng), (_gst_parse_yyget_text),
(_gst_parse_yyset_extra), (_gst_parse_yyset_lineno),
(_gst_parse_yyset_column), (_gst_parse_yyset_in),
(_gst_parse_yyset_out), (_gst_parse_yyget_debug),
(_gst_parse_yyset_debug), (_gst_parse_yyget_lval),
(_gst_parse_yyset_lval), (_gst_parse_yylex_init),
(yy_init_globals), (_gst_parse_yylex_destroy), (yy_flex_strncpy),
(yy_flex_strlen), (_gst_parse_yyalloc), (_gst_parse_yyrealloc),
(_gst_parse_yyfree):
If the installed flex version is too old use pre-generated parser
sources. These pre-generated parser sources are always updated when
the actual flex/bison sources change but require everybody who wants
to change something in the parser to have flex >= 2.5.31 installed.
2007-04-18 12:34:51 +00:00
|
|
|
if (yyparse (scanner, &g) != 0) {
|
2005-10-10 22:49:42 +00:00
|
|
|
SET_ERROR (error, GST_PARSE_ERROR_SYNTAX,
|
|
|
|
"Unrecoverable syntax error while parsing pipeline %s", str);
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2011-10-08 13:17:25 +00:00
|
|
|
priv_gst_parse_yylex_destroy (scanner);
|
2006-07-31 15:07:30 +00:00
|
|
|
g_free (dstr);
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
goto error1;
|
|
|
|
}
|
2011-10-08 13:17:25 +00:00
|
|
|
priv_gst_parse_yylex_destroy (scanner);
|
2003-04-08 21:59:44 +00:00
|
|
|
g_free (dstr);
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2005-10-10 22:49:42 +00:00
|
|
|
GST_CAT_DEBUG (GST_CAT_PIPELINE, "got %u elements and %u links",
|
|
|
|
g.chain ? g_slist_length (g.chain->elements) : 0,
|
|
|
|
g_slist_length (g.links));
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
if (!g.chain) {
|
|
|
|
ret = NULL;
|
2008-05-25 14:13:22 +00:00
|
|
|
} else if (!g.chain->elements->next) {
|
2011-02-14 13:39:21 +00:00
|
|
|
/* only one toplevel element */
|
2008-05-25 14:13:22 +00:00
|
|
|
ret = (GstElement *) g.chain->elements->data;
|
|
|
|
g_slist_free (g.chain->elements);
|
2003-04-08 21:59:44 +00:00
|
|
|
if (GST_IS_BIN (ret))
|
|
|
|
bin = GST_BIN (ret);
|
2004-04-19 17:40:24 +00:00
|
|
|
gst_parse_chain_free (g.chain);
|
2011-02-14 13:39:21 +00:00
|
|
|
} else {
|
2003-04-08 21:59:44 +00:00
|
|
|
/* put all elements in our bin */
|
|
|
|
bin = GST_BIN (gst_element_factory_make ("pipeline", NULL));
|
|
|
|
g_assert (bin);
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2006-07-27 13:26:27 +00:00
|
|
|
for (walk = g.chain->elements; walk; walk = walk->next) {
|
|
|
|
if (walk->data != NULL)
|
|
|
|
gst_bin_add (bin, GST_ELEMENT (walk->data));
|
|
|
|
}
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
g_slist_free (g.chain->elements);
|
|
|
|
ret = GST_ELEMENT (bin);
|
2004-04-19 17:40:24 +00:00
|
|
|
gst_parse_chain_free (g.chain);
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
/* remove links */
|
2004-04-19 17:40:24 +00:00
|
|
|
for (walk = g.links; walk; walk = walk->next) {
|
2003-04-08 21:59:44 +00:00
|
|
|
link_t *l = (link_t *) walk->data;
|
|
|
|
if (!l->src) {
|
|
|
|
if (l->src_name) {
|
|
|
|
if (bin) {
|
|
|
|
l->src = gst_bin_get_by_name_recurse_up (bin, l->src_name);
|
2006-04-06 10:38:54 +00:00
|
|
|
if (l->src)
|
|
|
|
gst_object_unref (l->src);
|
2003-04-08 21:59:44 +00:00
|
|
|
} else {
|
|
|
|
l->src = strcmp (GST_ELEMENT_NAME (ret), l->src_name) == 0 ? ret : NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!l->src) {
|
2008-05-25 13:56:38 +00:00
|
|
|
if (l->src_name) {
|
|
|
|
SET_ERROR (error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
|
|
|
|
"No element named \"%s\" - omitting link", l->src_name);
|
|
|
|
} else {
|
|
|
|
/* probably a missing element which we've handled already */
|
|
|
|
}
|
2003-04-08 21:59:44 +00:00
|
|
|
gst_parse_free_link (l);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!l->sink) {
|
|
|
|
if (l->sink_name) {
|
|
|
|
if (bin) {
|
|
|
|
l->sink = gst_bin_get_by_name_recurse_up (bin, l->sink_name);
|
2006-04-06 10:38:54 +00:00
|
|
|
if (l->sink)
|
|
|
|
gst_object_unref (l->sink);
|
2003-04-08 21:59:44 +00:00
|
|
|
} else {
|
|
|
|
l->sink = strcmp (GST_ELEMENT_NAME (ret), l->sink_name) == 0 ? ret : NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!l->sink) {
|
2008-05-25 13:56:38 +00:00
|
|
|
if (l->sink_name) {
|
|
|
|
SET_ERROR (error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
|
|
|
|
"No element named \"%s\" - omitting link", l->sink_name);
|
|
|
|
} else {
|
|
|
|
/* probably a missing element which we've handled already */
|
|
|
|
}
|
2003-04-08 21:59:44 +00:00
|
|
|
gst_parse_free_link (l);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gst_parse_perform_link (l, &g);
|
|
|
|
}
|
|
|
|
g_slist_free (g.links);
|
2002-04-07 23:32:16 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
out:
|
|
|
|
#ifdef __GST_PARSE_TRACE
|
2005-10-10 22:49:42 +00:00
|
|
|
GST_CAT_DEBUG (GST_CAT_PIPELINE,
|
|
|
|
"TRACE: %u strings, %u chains and %u links left", __strings, __chains,
|
|
|
|
__links);
|
2003-04-08 21:59:44 +00:00
|
|
|
if (__strings || __chains || __links) {
|
2005-10-10 22:49:42 +00:00
|
|
|
g_warning ("TRACE: %u strings, %u chains and %u links left", __strings,
|
|
|
|
__chains, __links);
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
|
|
|
#endif /* __GST_PARSE_TRACE */
|
2002-04-07 23:32:16 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
return ret;
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
error1:
|
|
|
|
if (g.chain) {
|
2004-04-19 17:40:24 +00:00
|
|
|
g_slist_foreach (g.chain->elements, (GFunc)gst_object_unref, NULL);
|
2003-04-08 21:59:44 +00:00
|
|
|
g_slist_free (g.chain->elements);
|
2004-04-19 17:40:24 +00:00
|
|
|
gst_parse_chain_free (g.chain);
|
2003-04-08 21:59:44 +00:00
|
|
|
}
|
2004-04-19 17:40:24 +00:00
|
|
|
|
|
|
|
g_slist_foreach (g.links, (GFunc)gst_parse_free_link, NULL);
|
2003-04-08 21:59:44 +00:00
|
|
|
g_slist_free (g.links);
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2004-05-04 17:00:11 +00:00
|
|
|
if (error)
|
|
|
|
g_assert (*error);
|
2003-04-08 21:59:44 +00:00
|
|
|
ret = NULL;
|
2011-02-14 13:39:21 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
goto out;
|
2002-03-31 21:09:17 +00:00
|
|
|
}
|