mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
enable debugging output for bison parser, fix // comments, better error recovery, error out on non-instantiable eleme...
Original commit message from CVS: enable debugging output for bison parser, fix // comments, better error recovery, error out on non-instantiable elements (fixes #110758)
This commit is contained in:
parent
3639eab50e
commit
838ffca4fa
3 changed files with 33 additions and 7 deletions
|
@ -39,6 +39,7 @@ typedef enum
|
||||||
GST_PARSE_ERROR_NO_SUCH_PROPERTY,
|
GST_PARSE_ERROR_NO_SUCH_PROPERTY,
|
||||||
GST_PARSE_ERROR_LINK,
|
GST_PARSE_ERROR_LINK,
|
||||||
GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
|
GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
|
||||||
|
GST_PARSE_ERROR_EMPTY_BIN,
|
||||||
} GstParseError;
|
} GstParseError;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -126,13 +126,22 @@ typedef struct {
|
||||||
# define YYDEBUG 1
|
# define YYDEBUG 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // G_HAVE_ISO_VARARGS
|
#endif /* G_HAVE_ISO_VARARGS */
|
||||||
|
|
||||||
#define GST_BIN_MAKE(res, type, chain, assign) G_STMT_START{ \
|
#define GST_BIN_MAKE(res, type, chainval, assign) G_STMT_START{ \
|
||||||
|
chain_t *chain = chainval; \
|
||||||
GSList *walk; \
|
GSList *walk; \
|
||||||
GstBin *bin = (GstBin *) gst_element_factory_make (type, NULL); \
|
GstBin *bin = (GstBin *) gst_element_factory_make (type, NULL); \
|
||||||
if (!bin) { \
|
if (!chain) { \
|
||||||
ERROR (GST_PARSE_ERROR_NO_SUCH_ELEMENT, "No bin \"%s\"", type); \
|
ERROR (GST_PARSE_ERROR_EMPTY_BIN, "Specified empty bin \"%s\", not allowed", type); \
|
||||||
|
g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
|
||||||
|
g_slist_free (assign); \
|
||||||
|
YYERROR; \
|
||||||
|
} else if (!bin) { \
|
||||||
|
ERROR (GST_PARSE_ERROR_NO_SUCH_ELEMENT, "No bin \"%s\", omitting...", type); \
|
||||||
|
g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
|
||||||
|
g_slist_free (assign); \
|
||||||
|
res = chain; \
|
||||||
} else { \
|
} else { \
|
||||||
walk = chain->elements; \
|
walk = chain->elements; \
|
||||||
while (walk) { \
|
while (walk) { \
|
||||||
|
@ -499,8 +508,11 @@ static int yyerror (const char *s);
|
||||||
%%
|
%%
|
||||||
|
|
||||||
element: IDENTIFIER { $$ = gst_element_factory_make ($1, NULL);
|
element: IDENTIFIER { $$ = gst_element_factory_make ($1, NULL);
|
||||||
if (!$$) ERROR (GST_PARSE_ERROR_NO_SUCH_ELEMENT, "No element \"%s\"", $1);
|
if (!$$)
|
||||||
|
ERROR (GST_PARSE_ERROR_NO_SUCH_ELEMENT, "No element \"%s\"", $1);
|
||||||
gst_parse_strfree ($1);
|
gst_parse_strfree ($1);
|
||||||
|
if (!$$)
|
||||||
|
YYERROR;
|
||||||
}
|
}
|
||||||
| element ASSIGNMENT { gst_parse_element_set ($2, $1, graph);
|
| element ASSIGNMENT { gst_parse_element_set ($2, $1, graph);
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
|
@ -515,6 +527,16 @@ bin: '{' assignments chain '}' { GST_BIN_MAKE ($$, "thread", $3, $2)
|
||||||
| BINREF assignments chain ')' { GST_BIN_MAKE ($$, $1, $3, $2);
|
| BINREF assignments chain ')' { GST_BIN_MAKE ($$, $1, $3, $2);
|
||||||
gst_parse_strfree ($1);
|
gst_parse_strfree ($1);
|
||||||
}
|
}
|
||||||
|
| '{' assignments '}' { GST_BIN_MAKE ($$, "thread", NULL, $2); }
|
||||||
|
| '(' assignments '}' { GST_BIN_MAKE ($$, "thread", NULL, $2); }
|
||||||
|
| BINREF assignments ')' { GST_BIN_MAKE ($$, $1, NULL, $2);
|
||||||
|
gst_parse_strfree ($1);
|
||||||
|
}
|
||||||
|
| '{' assignments error '}' { GST_BIN_MAKE ($$, "thread", NULL, $2); }
|
||||||
|
| '(' assignments error '}' { GST_BIN_MAKE ($$, "thread", NULL, $2); }
|
||||||
|
| BINREF assignments error ')' { GST_BIN_MAKE ($$, $1, NULL, $2);
|
||||||
|
gst_parse_strfree ($1);
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
pads: PADREF { $$ = g_slist_prepend (NULL, $1); }
|
pads: PADREF { $$ = g_slist_prepend (NULL, $1); }
|
||||||
|
@ -533,6 +555,7 @@ reference: REF { MAKE_REF ($$, $1, NULL); }
|
||||||
linkpart: reference { $$ = $1; }
|
linkpart: reference { $$ = $1; }
|
||||||
| pads { MAKE_REF ($$, NULL, $1); }
|
| pads { MAKE_REF ($$, NULL, $1); }
|
||||||
| /* NOP */ { MAKE_REF ($$, NULL, NULL); }
|
| /* NOP */ { MAKE_REF ($$, NULL, NULL); }
|
||||||
|
| linkpart error { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
link: linkpart '!' linkpart { $$ = $1;
|
link: linkpart '!' linkpart { $$ = $1;
|
||||||
|
@ -544,6 +567,7 @@ link: linkpart '!' linkpart { $$ = $1;
|
||||||
|
|
||||||
linklist: link { $$ = g_slist_prepend (NULL, $1); }
|
linklist: link { $$ = g_slist_prepend (NULL, $1); }
|
||||||
| link linklist { $$ = g_slist_prepend ($2, $1); }
|
| link linklist { $$ = g_slist_prepend ($2, $1); }
|
||||||
|
| linklist error { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
chain: element { $$ = gst_parse_chain_new ();
|
chain: element { $$ = gst_parse_chain_new ();
|
||||||
|
@ -635,6 +659,7 @@ chain: element { $$ = gst_parse_chain_new ();
|
||||||
g_slist_free ($2);
|
g_slist_free ($2);
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
}
|
}
|
||||||
|
| chain error { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
graph: chain { $$ = (graph_t *) graph;
|
graph: chain { $$ = (graph_t *) graph;
|
||||||
|
@ -701,7 +726,7 @@ _gst_parse_launch (const gchar *str, GError **error)
|
||||||
dstr = g_strdup (str);
|
dstr = g_strdup (str);
|
||||||
_gst_parse_yy_scan_string (dstr);
|
_gst_parse_yy_scan_string (dstr);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef GST_DEBUG_ENABLED
|
||||||
yydebug = 1;
|
yydebug = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
# ifdef GST_DEBUG_ENABLED
|
# ifdef GST_DEBUG_ENABLED
|
||||||
# define PRINT(a...) GST_DEBUG (GST_CAT_PIPELINE, "flex: "##a)
|
# define PRINT(a...) GST_DEBUG (GST_CAT_PIPELINE, "flex: "##a)
|
||||||
# endif
|
# endif
|
||||||
#endif // G_HAVE_ISO_VARARGS
|
#endif /* G_HAVE_ISO_VARARGS */
|
||||||
|
|
||||||
#define YY_DECL int _gst_parse_yylex (YYSTYPE *lvalp)
|
#define YY_DECL int _gst_parse_yylex (YYSTYPE *lvalp)
|
||||||
%}
|
%}
|
||||||
|
|
Loading…
Reference in a new issue