mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
This is filtered caps in 20 lines. Implemented full featured parsing of pipelines with filtered caps. To get a grip o...
Original commit message from CVS: This is filtered caps in 20 lines. Implemented full featured parsing of pipelines with filtered caps. To get a grip of the syntax you might want to look at testsuite/caps/string-conversions.c or run that test
This commit is contained in:
parent
4471a7e84d
commit
a960c7a7a3
2 changed files with 38 additions and 6 deletions
|
@ -464,9 +464,10 @@ gst_parse_perform_link (link_t *link, graph_t *graph)
|
|||
g_assert (GST_IS_ELEMENT (src));
|
||||
g_assert (GST_IS_ELEMENT (sink));
|
||||
|
||||
GST_INFO (GST_CAT_PIPELINE, "linking %s(%s):%u to %s(%s):%u",
|
||||
GST_INFO (GST_CAT_PIPELINE, "linking %s(%s):%u to %s(%s):%u with caps \"%s\"",
|
||||
GST_ELEMENT_NAME (src), link->src_name ? link->src_name : "---", g_slist_length (srcs),
|
||||
GST_ELEMENT_NAME (sink), link->sink_name ? link->sink_name : "---", g_slist_length (sinks));
|
||||
GST_ELEMENT_NAME (sink), link->sink_name ? link->sink_name : "---", g_slist_length (sinks),
|
||||
link->caps ? gst_caps_to_string (link->caps) : "-");
|
||||
|
||||
if (!srcs || !sinks) {
|
||||
if (gst_element_link_pads_filtered (src, srcs ? (const gchar *) srcs->data : NULL,
|
||||
|
@ -535,6 +536,7 @@ static int yyerror (const char *s);
|
|||
%token <s> IDENTIFIER
|
||||
%left <s> REF PADREF BINREF
|
||||
%token <s> ASSIGNMENT
|
||||
%token <s> LINK
|
||||
|
||||
%type <g> graph
|
||||
%type <c> chain bin
|
||||
|
@ -604,7 +606,13 @@ linkpart: reference { $$ = $1; }
|
|||
| /* NOP */ { MAKE_REF ($$, NULL, NULL); }
|
||||
;
|
||||
|
||||
link: linkpart '!' linkpart { $$ = $1;
|
||||
link: linkpart LINK linkpart { $$ = $1;
|
||||
if ($2) {
|
||||
$$->caps = gst_caps_from_string ($2);
|
||||
if (!$$->caps)
|
||||
ERROR (GST_PARSE_ERROR_LINK, "could not parse caps \"%s\"", $2);
|
||||
gst_parse_strfree ($2);
|
||||
}
|
||||
$$->sink_name = $3->src_name;
|
||||
$$->sink_pads = $3->src_pads;
|
||||
gst_parse_link_free ($3);
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
#define YY_DECL int _gst_parse_yylex (YYSTYPE *lvalp)
|
||||
%}
|
||||
|
||||
_operators [(){}.:!,=]
|
||||
_operator [(){}.:!,;=]
|
||||
_identifier [[:alpha:]][[:alnum:]\-_%]*
|
||||
|
||||
_char ("\\".)|([^[:space:]])
|
||||
_string {_char}+|("\""([^\"]|"\\\"")*"\"")
|
||||
_string {_char}+|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
|
||||
|
||||
_comma [[:space:]]*","[[:space:]]*
|
||||
_assign [[:space:]]*"="[[:space:]]*
|
||||
|
@ -38,6 +38,12 @@ _padref "."{_identifier}
|
|||
_ref {_identifier}"."{_identifier}?
|
||||
_binref {_identifier}[[:space:]]*"."[[:space:]]*"("
|
||||
|
||||
/* links */
|
||||
_capschar ("\\".)|([^[:space:]!.,;()\]\[])
|
||||
_capsstring {_capschar}+|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
|
||||
_mimetype ({_capschar}+"/"{_capschar}+)|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
|
||||
_link ("!"[[:space:]]*{_mimetype}(","([^!]|{_capsstring})+)?[[:space:]]*"!")|("!")
|
||||
|
||||
%x value
|
||||
%option noyywrap
|
||||
%option nounput
|
||||
|
@ -83,7 +89,25 @@ _binref {_identifier}[[:space:]]*"."[[:space:]]*"("
|
|||
return IDENTIFIER;
|
||||
}
|
||||
|
||||
{_operators} { PRINT ("OPERATOR: [%s]\n", yytext); return *yytext; }
|
||||
{_link} {
|
||||
gchar *c = yytext;
|
||||
PRINT ("LINK: %s\n", yytext);
|
||||
c++;
|
||||
if (*c) {
|
||||
while (g_ascii_isspace (*c)) c++;
|
||||
c = lvalp->s = gst_parse_strdup (c);
|
||||
while (*c) c++;
|
||||
g_assert (*--c == '!');
|
||||
while (g_ascii_isspace (*--c));
|
||||
*++c = '\0';
|
||||
} else {
|
||||
lvalp->s = NULL;
|
||||
}
|
||||
BEGIN (INITIAL);
|
||||
return LINK;
|
||||
}
|
||||
|
||||
{_operator} { PRINT ("OPERATOR: [%s]\n", yytext); return *yytext; }
|
||||
|
||||
[[:space:]]+ { PRINT ("SPACE: [%s]\n", yytext); }
|
||||
|
||||
|
|
Loading…
Reference in a new issue