Branch data Line data Source code
1 : : #ifdef HAVE_CONFIG_H
2 : : #include <config.h>
3 : : #endif
4 : :
5 : : /* A Bison parser, made by GNU Bison 2.4.1. */
6 : :
7 : : /* Skeleton implementation for Bison's Yacc-like parsers in C
8 : :
9 : : Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
10 : : Free Software Foundation, Inc.
11 : :
12 : : This program is free software: you can redistribute it and/or modify
13 : : it under the terms of the GNU General Public License as published by
14 : : the Free Software Foundation, either version 3 of the License, or
15 : : (at your option) any later version.
16 : :
17 : : This program is distributed in the hope that it will be useful,
18 : : but WITHOUT ANY WARRANTY; without even the implied warranty of
19 : : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 : : GNU General Public License for more details.
21 : :
22 : : You should have received a copy of the GNU General Public License
23 : : along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 : :
25 : : /* As a special exception, you may create a larger work that contains
26 : : part or all of the Bison parser skeleton and distribute that work
27 : : under terms of your choice, so long as that work isn't itself a
28 : : parser generator using the skeleton or a modified version thereof
29 : : as a parser skeleton. Alternatively, if you modify or redistribute
30 : : the parser skeleton itself, you may (at your option) remove this
31 : : special exception, which will cause the skeleton and the resulting
32 : : Bison output files to be licensed under the GNU General Public
33 : : License without this special exception.
34 : :
35 : : This special exception was added by the Free Software Foundation in
36 : : version 2.2 of Bison. */
37 : :
38 : : /* C LALR(1) parser skeleton written by Richard Stallman, by
39 : : simplifying the original so-called "semantic" parser. */
40 : :
41 : : /* All symbols defined below should begin with yy or YY, to avoid
42 : : infringing on user name space. This should be done even for local
43 : : variables, as they might otherwise be expanded by user macros.
44 : : There are some unavoidable exceptions within include files to
45 : : define necessary library symbols; they are noted "INFRINGES ON
46 : : USER NAME SPACE" below. */
47 : :
48 : : /* Identify Bison output. */
49 : : #define YYBISON 1
50 : :
51 : : /* Bison version. */
52 : : #define YYBISON_VERSION "2.4.1"
53 : :
54 : : /* Skeleton name. */
55 : : #define YYSKELETON_NAME "yacc.c"
56 : :
57 : : /* Pure parsers. */
58 : : #define YYPURE 1
59 : :
60 : : /* Push parsers. */
61 : : #define YYPUSH 0
62 : :
63 : : /* Pull parsers. */
64 : : #define YYPULL 1
65 : :
66 : : /* Using locations. */
67 : : #define YYLSP_NEEDED 0
68 : :
69 : : /* Substitute the variable and function names. */
70 : : #define yyparse _gst_parse_yyparse
71 : : #define yylex _gst_parse_yylex
72 : : #define yyerror _gst_parse_yyerror
73 : : #define yylval _gst_parse_yylval
74 : : #define yychar _gst_parse_yychar
75 : : #define yydebug _gst_parse_yydebug
76 : : #define yynerrs _gst_parse_yynerrs
77 : :
78 : :
79 : : /* Copy the first part of user declarations. */
80 : :
81 : : /* Line 189 of yacc.c */
82 : : #line 1 "./grammar.y"
83 : :
84 : : #include "../gst_private.h"
85 : :
86 : : #include <glib-object.h>
87 : : #include <glib.h>
88 : : #include <stdio.h>
89 : : #include <string.h>
90 : : #include <stdlib.h>
91 : :
92 : : #include "../gst-i18n-lib.h"
93 : :
94 : : #include "../gstconfig.h"
95 : : #include "../gstparse.h"
96 : : #include "../gstinfo.h"
97 : : #include "../gsterror.h"
98 : : #include "../gststructure.h"
99 : : #include "../gsturi.h"
100 : : #include "../gstutils.h"
101 : : #include "../gstvalue.h"
102 : : #include "../gstchildproxy.h"
103 : : #include "types.h"
104 : :
105 : : /* All error messages in this file are user-visible and need to be translated.
106 : : * Don't start the message with a capital, and don't end them with a period,
107 : : * as they will be presented inside a sentence/error.
108 : : */
109 : :
110 : : #define YYERROR_VERBOSE 1
111 : : #define YYLEX_PARAM scanner
112 : :
113 : : #define YYENABLE_NLS 0
114 : :
115 : : #ifndef YYLTYPE_IS_TRIVIAL
116 : : #define YYLTYPE_IS_TRIVIAL 0
117 : : #endif
118 : :
119 : : typedef void* yyscan_t;
120 : :
121 : : int _gst_parse_yylex (void * yylval_param , yyscan_t yyscanner);
122 : : int _gst_parse_yylex_init (yyscan_t scanner);
123 : : int _gst_parse_yylex_destroy (yyscan_t scanner);
124 : : struct yy_buffer_state * _gst_parse_yy_scan_string (char* , yyscan_t);
125 : : void _gst_parse_yypush_buffer_state (void * new_buffer ,yyscan_t yyscanner );
126 : : void _gst_parse_yypop_buffer_state (yyscan_t yyscanner );
127 : :
128 : : #ifdef __GST_PARSE_TRACE
129 : : static guint __strings;
130 : : static guint __links;
131 : : static guint __chains;
132 : : gchar *
133 : : __gst_parse_strdup (gchar *org)
134 : : {
135 : : gchar *ret;
136 : : __strings++;
137 : : ret = g_strdup (org);
138 : : /* g_print ("ALLOCATED STR (%3u): %p %s\n", __strings, ret, ret); */
139 : : return ret;
140 : : }
141 : : void
142 : : __gst_parse_strfree (gchar *str)
143 : : {
144 : : if (str) {
145 : : /* g_print ("FREEING STR (%3u): %p %s\n", __strings - 1, str, str); */
146 : : g_free (str);
147 : : g_return_if_fail (__strings > 0);
148 : : __strings--;
149 : : }
150 : : }
151 : : link_t *__gst_parse_link_new ()
152 : : {
153 : : link_t *ret;
154 : : __links++;
155 : : ret = g_slice_new0 (link_t);
156 : : /* g_print ("ALLOCATED LINK (%3u): %p\n", __links, ret); */
157 : : return ret;
158 : : }
159 : : void
160 : : __gst_parse_link_free (link_t *data)
161 : : {
162 : : if (data) {
163 : : /* g_print ("FREEING LINK (%3u): %p\n", __links - 1, data); */
164 : : g_slice_free (link_t, data);
165 : : g_return_if_fail (__links > 0);
166 : : __links--;
167 : : }
168 : : }
169 : : chain_t *
170 : : __gst_parse_chain_new ()
171 : : {
172 : : chain_t *ret;
173 : : __chains++;
174 : : ret = g_slice_new0 (chain_t);
175 : : /* g_print ("ALLOCATED CHAIN (%3u): %p\n", __chains, ret); */
176 : : return ret;
177 : : }
178 : : void
179 : : __gst_parse_chain_free (chain_t *data)
180 : : {
181 : : /* g_print ("FREEING CHAIN (%3u): %p\n", __chains - 1, data); */
182 : : g_slice_free (chain_t, data);
183 : : g_return_if_fail (__chains > 0);
184 : : __chains--;
185 : : }
186 : :
187 : : #endif /* __GST_PARSE_TRACE */
188 : :
189 : : typedef struct {
190 : : gchar *src_pad;
191 : : gchar *sink_pad;
192 : : GstElement *sink;
193 : : GstCaps *caps;
194 : : gulong signal_id;
195 : : } DelayedLink;
196 : :
197 : : typedef struct {
198 : : gchar *name;
199 : : gchar *value_str;
200 : : gulong signal_id;
201 : : } DelayedSet;
202 : :
203 : : /*** define SET_ERROR macro/function */
204 : :
205 : : #ifdef G_HAVE_ISO_VARARGS
206 : :
207 : : # define SET_ERROR(error, type, ...) \
208 : : G_STMT_START { \
209 : : GST_CAT_ERROR (GST_CAT_PIPELINE, __VA_ARGS__); \
210 : : if ((error) && !*(error)) { \
211 : : g_set_error ((error), GST_PARSE_ERROR, (type), __VA_ARGS__); \
212 : : } \
213 : : } G_STMT_END
214 : :
215 : : #elif defined(G_HAVE_GNUC_VARARGS)
216 : :
217 : : # define SET_ERROR(error, type, args...) \
218 : : G_STMT_START { \
219 : : GST_CAT_ERROR (GST_CAT_PIPELINE, args ); \
220 : : if ((error) && !*(error)) { \
221 : : g_set_error ((error), GST_PARSE_ERROR, (type), args ); \
222 : : } \
223 : : } G_STMT_END
224 : :
225 : : #else
226 : :
227 : : static inline void
228 : : SET_ERROR (GError **error, gint type, const char *format, ...)
229 : : {
230 : : if (error) {
231 : : if (*error) {
232 : : g_warning ("error while parsing");
233 : : } else {
234 : : va_list varargs;
235 : : char *string;
236 : :
237 : : va_start (varargs, format);
238 : : string = g_strdup_vprintf (format, varargs);
239 : : va_end (varargs);
240 : :
241 : : g_set_error (error, GST_PARSE_ERROR, type, string);
242 : :
243 : : g_free (string);
244 : : }
245 : : }
246 : : }
247 : :
248 : : #endif /* G_HAVE_ISO_VARARGS */
249 : :
250 : : /*** define YYPRINTF macro/function if we're debugging */
251 : :
252 : : /* bison 1.35 calls this macro with side effects, we need to make sure the
253 : : side effects work - crappy bison */
254 : :
255 : : #ifndef GST_DISABLE_GST_DEBUG
256 : : # define YYDEBUG 1
257 : :
258 : : # ifdef G_HAVE_ISO_VARARGS
259 : :
260 : : /* # define YYFPRINTF(a, ...) GST_CAT_DEBUG (GST_CAT_PIPELINE, __VA_ARGS__) */
261 : : # define YYFPRINTF(a, ...) \
262 : : G_STMT_START { \
263 : : GST_CAT_LOG (GST_CAT_PIPELINE, __VA_ARGS__); \
264 : : } G_STMT_END
265 : :
266 : : # elif defined(G_HAVE_GNUC_VARARGS)
267 : :
268 : : # define YYFPRINTF(a, args...) \
269 : : G_STMT_START { \
270 : : GST_CAT_LOG (GST_CAT_PIPELINE, args); \
271 : : } G_STMT_END
272 : :
273 : : # else
274 : :
275 : : static inline void
276 : : YYPRINTF(const char *format, ...)
277 : : {
278 : : va_list varargs;
279 : : gchar *temp;
280 : :
281 : : va_start (varargs, format);
282 : : temp = g_strdup_vprintf (format, varargs);
283 : : GST_CAT_LOG (GST_CAT_PIPELINE, "%s", temp);
284 : : g_free (temp);
285 : : va_end (varargs);
286 : : }
287 : :
288 : : # endif /* G_HAVE_ISO_VARARGS */
289 : :
290 : : #endif /* GST_DISABLE_GST_DEBUG */
291 : :
292 : : #define ADD_MISSING_ELEMENT(graph,name) G_STMT_START { \
293 : : if ((graph)->ctx) { \
294 : : (graph)->ctx->missing_elements = \
295 : : g_list_append ((graph)->ctx->missing_elements, g_strdup (name)); \
296 : : } } G_STMT_END
297 : :
298 : : static void
299 : : no_free (gconstpointer foo)
300 : : {
301 : : /* do nothing */
302 : : }
303 : :
304 : : #define GST_BIN_MAKE(res, type, chainval, assign, type_string_free_func) \
305 : : G_STMT_START { \
306 : : chain_t *chain = chainval; \
307 : : GSList *walk; \
308 : : GstBin *bin = (GstBin *) gst_element_factory_make (type, NULL); \
309 : : if (!chain) { \
310 : : SET_ERROR (graph->error, GST_PARSE_ERROR_EMPTY_BIN, \
311 : : _("specified empty bin \"%s\", not allowed"), type); \
312 : : g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
313 : : g_slist_free (assign); \
314 : : gst_object_unref (bin); \
315 : : type_string_free_func (type); /* Need to clean up the string */ \
316 : : YYERROR; \
317 : : } else if (!bin) { \
318 : : ADD_MISSING_ELEMENT(graph, type); \
319 : : SET_ERROR (graph->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, \
320 : : _("no bin \"%s\", skipping"), type); \
321 : : g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
322 : : g_slist_free (assign); \
323 : : res = chain; \
324 : : } else { \
325 : : for (walk = chain->elements; walk; walk = walk->next ) \
326 : : gst_bin_add (bin, GST_ELEMENT (walk->data)); \
327 : : g_slist_free (chain->elements); \
328 : : chain->elements = g_slist_prepend (NULL, bin); \
329 : : res = chain; \
330 : : /* set the properties now */ \
331 : : for (walk = assign; walk; walk = walk->next) \
332 : : gst_parse_element_set ((gchar *) walk->data, GST_ELEMENT (bin), graph); \
333 : : g_slist_free (assign); \
334 : : } \
335 : : } G_STMT_END
336 : :
337 : : #define MAKE_LINK(link, _src, _src_name, _src_pads, _sink, _sink_name, _sink_pads) \
338 : : G_STMT_START { \
339 : : link = gst_parse_link_new (); \
340 : : link->src = _src; \
341 : : link->sink = _sink; \
342 : : link->src_name = _src_name; \
343 : : link->sink_name = _sink_name; \
344 : : link->src_pads = _src_pads; \
345 : : link->sink_pads = _sink_pads; \
346 : : link->caps = NULL; \
347 : : } G_STMT_END
348 : :
349 : : #define MAKE_REF(link, _src, _pads) \
350 : : G_STMT_START { \
351 : : gchar *padname = _src; \
352 : : GSList *pads = _pads; \
353 : : if (padname) { \
354 : : while (*padname != '.') padname++; \
355 : : *padname = '\0'; \
356 : : padname++; \
357 : : if (*padname != '\0') \
358 : : pads = g_slist_prepend (pads, gst_parse_strdup (padname)); \
359 : : } \
360 : : MAKE_LINK (link, NULL, _src, pads, NULL, NULL, NULL); \
361 : : } G_STMT_END
362 : :
363 : : static void
364 : : gst_parse_free_delayed_set (DelayedSet *set)
365 : : {
366 : : g_free(set->name);
367 : : g_free(set->value_str);
368 : : g_slice_free(DelayedSet, set);
369 : : }
370 : :
371 : : static void gst_parse_new_child(GstChildProxy *child_proxy, GObject *object,
372 : : gpointer data);
373 : :
374 : : static void
375 : : gst_parse_add_delayed_set (GstElement *element, gchar *name, gchar *value_str)
376 : : {
377 : : DelayedSet *data = g_slice_new0 (DelayedSet);
378 : :
379 : : GST_CAT_LOG_OBJECT (GST_CAT_PIPELINE, element, "delaying property set %s to %s",
380 : : name, value_str);
381 : :
382 : : data->name = g_strdup(name);
383 : : data->value_str = g_strdup(value_str);
384 : : data->signal_id = g_signal_connect_data(element, "child-added",
385 : : G_CALLBACK (gst_parse_new_child), data, (GClosureNotify)
386 : : gst_parse_free_delayed_set, (GConnectFlags) 0);
387 : :
388 : : /* FIXME: we would need to listen on all intermediate bins too */
389 : : if (GST_IS_BIN (element)) {
390 : : gchar **names, **current;
391 : : GstElement *parent, *child;
392 : :
393 : : current = names = g_strsplit (name, "::", -1);
394 : : parent = gst_bin_get_by_name (GST_BIN_CAST (element), current[0]);
395 : : current++;
396 : : while (parent && current[0]) {
397 : : child = gst_bin_get_by_name (GST_BIN (parent), current[0]);
398 : : if (!child && current[1]) {
399 : : char *sub_name = g_strjoinv ("::", ¤t[0]);
400 : :
401 : : gst_parse_add_delayed_set(parent, sub_name, value_str);
402 : : g_free (sub_name);
403 : : }
404 : : parent = child;
405 : : current++;
406 : : }
407 : : g_strfreev (names);
408 : : }
409 : : }
410 : :
411 : : static void gst_parse_new_child(GstChildProxy *child_proxy, GObject *object,
412 : : gpointer data)
413 : : {
414 : : DelayedSet *set = (DelayedSet *) data;
415 : : GParamSpec *pspec;
416 : : GValue v = { 0, };
417 : : GstObject *target = NULL;
418 : : GType value_type;
419 : :
420 : : GST_CAT_LOG_OBJECT (GST_CAT_PIPELINE, child_proxy, "new child %s, checking property %s",
421 : : GST_OBJECT_NAME(object), set->name);
422 : :
423 : : if (gst_child_proxy_lookup (GST_OBJECT (child_proxy), set->name, &target, &pspec)) {
424 : : gboolean got_value = FALSE;
425 : :
426 : : value_type = pspec->value_type;
427 : :
428 : : GST_CAT_LOG_OBJECT (GST_CAT_PIPELINE, child_proxy, "parsing delayed property %s as a %s from %s",
429 : : pspec->name, g_type_name (value_type), set->value_str);
430 : : g_value_init (&v, value_type);
431 : : if (gst_value_deserialize (&v, set->value_str))
432 : : got_value = TRUE;
433 : : else if (g_type_is_a (value_type, GST_TYPE_ELEMENT)) {
434 : : GstElement *bin;
435 : :
436 : : bin = gst_parse_bin_from_description (set->value_str, TRUE, NULL);
437 : : if (bin) {
438 : : g_value_set_object (&v, bin);
439 : : got_value = TRUE;
440 : : }
441 : : }
442 : : g_signal_handler_disconnect (child_proxy, set->signal_id);
443 : : if (!got_value)
444 : : goto error;
445 : : g_object_set_property (G_OBJECT (target), pspec->name, &v);
446 : : } else {
447 : : const gchar *obj_name = GST_OBJECT_NAME(object);
448 : : gint len = strlen (obj_name);
449 : :
450 : : /* do a delayed set */
451 : : if ((strlen (set->name) > (len + 2)) && !strncmp (set->name, obj_name, len) && !strncmp (&set->name[len], "::", 2)) {
452 : : gst_parse_add_delayed_set (GST_ELEMENT(child_proxy), set->name, set->value_str);
453 : : }
454 : : }
455 : :
456 : : out:
457 : : if (G_IS_VALUE (&v))
458 : : g_value_unset (&v);
459 : : if (target)
460 : : gst_object_unref (target);
461 : : return;
462 : :
463 : : error:
464 : : GST_CAT_ERROR (GST_CAT_PIPELINE, "could not set property \"%s\" in element \"%s\"",
465 : : pspec->name, GST_ELEMENT_NAME (target));
466 : : goto out;
467 : : }
468 : :
469 : : static void
470 : : gst_parse_element_set (gchar *value, GstElement *element, graph_t *graph)
471 : : {
472 : : GParamSpec *pspec;
473 : : gchar *pos = value;
474 : : GValue v = { 0, };
475 : : GstObject *target = NULL;
476 : : GType value_type;
477 : :
478 : : /* do nothing if assignment is for missing element */
479 : : if (element == NULL)
480 : : goto out;
481 : :
482 : : /* parse the string, so the property name is null-terminated an pos points
483 : : to the beginning of the value */
484 : : while (!g_ascii_isspace (*pos) && (*pos != '=')) pos++;
485 : : if (*pos == '=') {
486 : : *pos = '\0';
487 : : } else {
488 : : *pos = '\0';
489 : : pos++;
490 : : while (g_ascii_isspace (*pos)) pos++;
491 : : }
492 : : pos++;
493 : : while (g_ascii_isspace (*pos)) pos++;
494 : : if (*pos == '"') {
495 : : pos++;
496 : : pos[strlen (pos) - 1] = '\0';
497 : : }
498 : : gst_parse_unescape (pos);
499 : :
500 : : if (gst_child_proxy_lookup (GST_OBJECT (element), value, &target, &pspec)) {
501 : : gboolean got_value = FALSE;
502 : :
503 : : value_type = pspec->value_type;
504 : :
505 : : GST_CAT_LOG_OBJECT (GST_CAT_PIPELINE, element, "parsing property %s as a %s", pspec->name,
506 : : g_type_name (value_type));
507 : : g_value_init (&v, value_type);
508 : : if (gst_value_deserialize (&v, pos))
509 : : got_value = TRUE;
510 : : else if (g_type_is_a (value_type, GST_TYPE_ELEMENT)) {
511 : : GstElement *bin;
512 : :
513 : : bin = gst_parse_bin_from_description (pos, TRUE, NULL);
514 : : if (bin) {
515 : : g_value_set_object (&v, bin);
516 : : got_value = TRUE;
517 : : }
518 : : }
519 : : if (!got_value)
520 : : goto error;
521 : : g_object_set_property (G_OBJECT (target), pspec->name, &v);
522 : : } else {
523 : : /* do a delayed set */
524 : : if (GST_IS_CHILD_PROXY (element)) {
525 : : gst_parse_add_delayed_set (element, value, pos);
526 : : }
527 : : else {
528 : : SET_ERROR (graph->error, GST_PARSE_ERROR_NO_SUCH_PROPERTY, \
529 : : _("no property \"%s\" in element \"%s\""), value, \
530 : : GST_ELEMENT_NAME (element));
531 : : }
532 : : }
533 : :
534 : : out:
535 : : gst_parse_strfree (value);
536 : : if (G_IS_VALUE (&v))
537 : : g_value_unset (&v);
538 : : if (target)
539 : : gst_object_unref (target);
540 : : return;
541 : :
542 : : error:
543 : : SET_ERROR (graph->error, GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
544 : : _("could not set property \"%s\" in element \"%s\" to \"%s\""),
545 : : value, GST_ELEMENT_NAME (element), pos);
546 : : goto out;
547 : : }
548 : :
549 : : static inline void
550 : : gst_parse_free_link (link_t *link)
551 : : {
552 : : gst_parse_strfree (link->src_name);
553 : : gst_parse_strfree (link->sink_name);
554 : : g_slist_foreach (link->src_pads, (GFunc) gst_parse_strfree, NULL);
555 : : g_slist_foreach (link->sink_pads, (GFunc) gst_parse_strfree, NULL);
556 : : g_slist_free (link->src_pads);
557 : : g_slist_free (link->sink_pads);
558 : : if (link->caps) gst_caps_unref (link->caps);
559 : : gst_parse_link_free (link);
560 : : }
561 : :
562 : : static void
563 : : gst_parse_free_delayed_link (DelayedLink *link)
564 : : {
565 : : g_free (link->src_pad);
566 : : g_free (link->sink_pad);
567 : : if (link->caps) gst_caps_unref (link->caps);
568 : : g_slice_free (DelayedLink, link);
569 : : }
570 : :
571 : : static void
572 : : gst_parse_found_pad (GstElement *src, GstPad *pad, gpointer data)
573 : : {
574 : : DelayedLink *link = data;
575 : :
576 : : GST_CAT_INFO (GST_CAT_PIPELINE, "trying delayed linking %s:%s to %s:%s",
577 : : GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (link->src_pad),
578 : : GST_STR_NULL (GST_ELEMENT_NAME (link->sink)), GST_STR_NULL (link->sink_pad));
579 : :
580 : : if (gst_element_link_pads_filtered (src, link->src_pad, link->sink,
581 : : link->sink_pad, link->caps)) {
582 : : /* do this here, we don't want to get any problems later on when
583 : : * unlocking states */
584 : : GST_CAT_DEBUG (GST_CAT_PIPELINE, "delayed linking %s:%s to %s:%s worked",
585 : : GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (link->src_pad),
586 : : GST_STR_NULL (GST_ELEMENT_NAME (link->sink)), GST_STR_NULL (link->sink_pad));
587 : : g_signal_handler_disconnect (src, link->signal_id);
588 : : }
589 : : }
590 : :
591 : : /* both padnames and the caps may be NULL */
592 : : static gboolean
593 : : gst_parse_perform_delayed_link (GstElement *src, const gchar *src_pad,
594 : : GstElement *sink, const gchar *sink_pad,
595 : : GstCaps *caps)
596 : : {
597 : : GList *templs = gst_element_class_get_pad_template_list (
598 : : GST_ELEMENT_GET_CLASS (src));
599 : :
600 : : for (; templs; templs = templs->next) {
601 : : GstPadTemplate *templ = (GstPadTemplate *) templs->data;
602 : : if ((GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC) &&
603 : : (GST_PAD_TEMPLATE_PRESENCE(templ) == GST_PAD_SOMETIMES))
604 : : {
605 : : DelayedLink *data = g_slice_new (DelayedLink);
606 : :
607 : : /* TODO: maybe we should check if src_pad matches this template's names */
608 : :
609 : : GST_CAT_DEBUG (GST_CAT_PIPELINE, "trying delayed link %s:%s to %s:%s",
610 : : GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (src_pad),
611 : : GST_STR_NULL (GST_ELEMENT_NAME (sink)), GST_STR_NULL (sink_pad));
612 : :
613 : : data->src_pad = g_strdup (src_pad);
614 : : data->sink = sink;
615 : : data->sink_pad = g_strdup (sink_pad);
616 : : if (caps) {
617 : : data->caps = gst_caps_copy (caps);
618 : : } else {
619 : : data->caps = NULL;
620 : : }
621 : : data->signal_id = g_signal_connect_data (src, "pad-added",
622 : : G_CALLBACK (gst_parse_found_pad), data,
623 : : (GClosureNotify) gst_parse_free_delayed_link, (GConnectFlags) 0);
624 : : return TRUE;
625 : : }
626 : : }
627 : : return FALSE;
628 : : }
629 : :
630 : : /*
631 : : * performs a link and frees the struct. src and sink elements must be given
632 : : * return values 0 - link performed
633 : : * 1 - link delayed
634 : : * <0 - error
635 : : */
636 : : static gint
637 : : gst_parse_perform_link (link_t *link, graph_t *graph)
638 : : {
639 : : GstElement *src = link->src;
640 : : GstElement *sink = link->sink;
641 : : GSList *srcs = link->src_pads;
642 : : GSList *sinks = link->sink_pads;
643 : : g_assert (GST_IS_ELEMENT (src));
644 : : g_assert (GST_IS_ELEMENT (sink));
645 : :
646 : : GST_CAT_INFO (GST_CAT_PIPELINE,
647 : : "linking %s:%s to %s:%s (%u/%u) with caps \"%" GST_PTR_FORMAT "\"",
648 : : GST_ELEMENT_NAME (src), link->src_name ? link->src_name : "(any)",
649 : : GST_ELEMENT_NAME (sink), link->sink_name ? link->sink_name : "(any)",
650 : : g_slist_length (srcs), g_slist_length (sinks), link->caps);
651 : :
652 : : if (!srcs || !sinks) {
653 : : if (gst_element_link_pads_filtered (src,
654 : : srcs ? (const gchar *) srcs->data : NULL, sink,
655 : : sinks ? (const gchar *) sinks->data : NULL, link->caps)) {
656 : : goto success;
657 : : } else {
658 : : if (gst_parse_perform_delayed_link (src,
659 : : srcs ? (const gchar *) srcs->data : NULL,
660 : : sink, sinks ? (const gchar *) sinks->data : NULL, link->caps)) {
661 : : goto success;
662 : : } else {
663 : : goto error;
664 : : }
665 : : }
666 : : }
667 : : if (g_slist_length (link->src_pads) != g_slist_length (link->sink_pads)) {
668 : : goto error;
669 : : }
670 : : while (srcs && sinks) {
671 : : const gchar *src_pad = (const gchar *) srcs->data;
672 : : const gchar *sink_pad = (const gchar *) sinks->data;
673 : : srcs = g_slist_next (srcs);
674 : : sinks = g_slist_next (sinks);
675 : : if (gst_element_link_pads_filtered (src, src_pad, sink, sink_pad,
676 : : link->caps)) {
677 : : continue;
678 : : } else {
679 : : if (gst_parse_perform_delayed_link (src, src_pad,
680 : : sink, sink_pad,
681 : : link->caps)) {
682 : : continue;
683 : : } else {
684 : : goto error;
685 : : }
686 : : }
687 : : }
688 : :
689 : : success:
690 : : gst_parse_free_link (link);
691 : : return 0;
692 : :
693 : : error:
694 : : SET_ERROR (graph->error, GST_PARSE_ERROR_LINK,
695 : : _("could not link %s to %s"), GST_ELEMENT_NAME (src),
696 : : GST_ELEMENT_NAME (sink));
697 : : gst_parse_free_link (link);
698 : : return -1;
699 : : }
700 : :
701 : :
702 : : static int yyerror (void *scanner, graph_t *graph, const char *s);
703 : :
704 : :
705 : : /* Line 189 of yacc.c */
706 : : #line 704 "grammar.tab.c"
707 : :
708 : : /* Enabling traces. */
709 : : #ifndef YYDEBUG
710 : : # define YYDEBUG 0
711 : : #endif
712 : :
713 : : /* Enabling verbose error messages. */
714 : : #ifdef YYERROR_VERBOSE
715 : : # undef YYERROR_VERBOSE
716 : : # define YYERROR_VERBOSE 1
717 : : #else
718 : : # define YYERROR_VERBOSE 0
719 : : #endif
720 : :
721 : : /* Enabling the token table. */
722 : : #ifndef YYTOKEN_TABLE
723 : : # define YYTOKEN_TABLE 0
724 : : #endif
725 : :
726 : :
727 : : /* Tokens. */
728 : : #ifndef YYTOKENTYPE
729 : : # define YYTOKENTYPE
730 : : /* Put the tokens into the symbol table, so that GDB and other debuggers
731 : : know about them. */
732 : : enum yytokentype {
733 : : PARSE_URL = 258,
734 : : IDENTIFIER = 259,
735 : : BINREF = 260,
736 : : PADREF = 261,
737 : : REF = 262,
738 : : ASSIGNMENT = 263,
739 : : LINK = 264
740 : : };
741 : : #endif
742 : :
743 : :
744 : :
745 : : #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
746 : : typedef union YYSTYPE
747 : : {
748 : :
749 : : /* Line 214 of yacc.c */
750 : : #line 623 "./grammar.y"
751 : :
752 : : gchar *s;
753 : : chain_t *c;
754 : : link_t *l;
755 : : GstElement *e;
756 : : GSList *p;
757 : : graph_t *g;
758 : :
759 : :
760 : :
761 : : /* Line 214 of yacc.c */
762 : : #line 760 "grammar.tab.c"
763 : : } YYSTYPE;
764 : : # define YYSTYPE_IS_TRIVIAL 1
765 : : # define yystype YYSTYPE /* obsolescent; will be withdrawn */
766 : : # define YYSTYPE_IS_DECLARED 1
767 : : #endif
768 : :
769 : :
770 : : /* Copy the second part of user declarations. */
771 : :
772 : :
773 : : /* Line 264 of yacc.c */
774 : : #line 772 "grammar.tab.c"
775 : :
776 : : #ifdef short
777 : : # undef short
778 : : #endif
779 : :
780 : : #ifdef YYTYPE_UINT8
781 : : typedef YYTYPE_UINT8 yytype_uint8;
782 : : #else
783 : : typedef unsigned char yytype_uint8;
784 : : #endif
785 : :
786 : : #ifdef YYTYPE_INT8
787 : : typedef YYTYPE_INT8 yytype_int8;
788 : : #elif (defined __STDC__ || defined __C99__FUNC__ \
789 : : || defined __cplusplus || defined _MSC_VER)
790 : : typedef signed char yytype_int8;
791 : : #else
792 : : typedef short int yytype_int8;
793 : : #endif
794 : :
795 : : #ifdef YYTYPE_UINT16
796 : : typedef YYTYPE_UINT16 yytype_uint16;
797 : : #else
798 : : typedef unsigned short int yytype_uint16;
799 : : #endif
800 : :
801 : : #ifdef YYTYPE_INT16
802 : : typedef YYTYPE_INT16 yytype_int16;
803 : : #else
804 : : typedef short int yytype_int16;
805 : : #endif
806 : :
807 : : #ifndef YYSIZE_T
808 : : # ifdef __SIZE_TYPE__
809 : : # define YYSIZE_T __SIZE_TYPE__
810 : : # elif defined size_t
811 : : # define YYSIZE_T size_t
812 : : # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
813 : : || defined __cplusplus || defined _MSC_VER)
814 : : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
815 : : # define YYSIZE_T size_t
816 : : # else
817 : : # define YYSIZE_T unsigned int
818 : : # endif
819 : : #endif
820 : :
821 : : #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
822 : :
823 : : #ifndef YY_
824 : : # if YYENABLE_NLS
825 : : # if ENABLE_NLS
826 : : # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
827 : : # define YY_(msgid) dgettext ("bison-runtime", msgid)
828 : : # endif
829 : : # endif
830 : : # ifndef YY_
831 : : # define YY_(msgid) msgid
832 : : # endif
833 : : #endif
834 : :
835 : : /* Suppress unused-variable warnings by "using" E. */
836 : : #if ! defined lint || defined __GNUC__
837 : : # define YYUSE(e) ((void) (e))
838 : : #else
839 : : # define YYUSE(e) /* empty */
840 : : #endif
841 : :
842 : : /* Identity function, used to suppress warnings about constant conditions. */
843 : : #ifndef lint
844 : : # define YYID(n) (n)
845 : : #else
846 : : #if (defined __STDC__ || defined __C99__FUNC__ \
847 : : || defined __cplusplus || defined _MSC_VER)
848 : : static int
849 : : YYID (int yyi)
850 : : #else
851 : : static int
852 : : YYID (yyi)
853 : : int yyi;
854 : : #endif
855 : : {
856 : : return yyi;
857 : : }
858 : : #endif
859 : :
860 : : #if ! defined yyoverflow || YYERROR_VERBOSE
861 : :
862 : : /* The parser invokes alloca or malloc; define the necessary symbols. */
863 : :
864 : : # ifdef YYSTACK_USE_ALLOCA
865 : : # if YYSTACK_USE_ALLOCA
866 : : # ifdef __GNUC__
867 : : # define YYSTACK_ALLOC __builtin_alloca
868 : : # elif defined __BUILTIN_VA_ARG_INCR
869 : : # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
870 : : # elif defined _AIX
871 : : # define YYSTACK_ALLOC __alloca
872 : : # elif defined _MSC_VER
873 : : # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
874 : : # define alloca _alloca
875 : : # else
876 : : # define YYSTACK_ALLOC alloca
877 : : # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
878 : : || defined __cplusplus || defined _MSC_VER)
879 : : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
880 : : # ifndef _STDLIB_H
881 : : # define _STDLIB_H 1
882 : : # endif
883 : : # endif
884 : : # endif
885 : : # endif
886 : : # endif
887 : :
888 : : # ifdef YYSTACK_ALLOC
889 : : /* Pacify GCC's `empty if-body' warning. */
890 : : # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
891 : : # ifndef YYSTACK_ALLOC_MAXIMUM
892 : : /* The OS might guarantee only one guard page at the bottom of the stack,
893 : : and a page size can be as small as 4096 bytes. So we cannot safely
894 : : invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
895 : : to allow for a few compiler-allocated temporary stack slots. */
896 : : # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
897 : : # endif
898 : : # else
899 : : # define YYSTACK_ALLOC YYMALLOC
900 : : # define YYSTACK_FREE YYFREE
901 : : # ifndef YYSTACK_ALLOC_MAXIMUM
902 : : # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
903 : : # endif
904 : : # if (defined __cplusplus && ! defined _STDLIB_H \
905 : : && ! ((defined YYMALLOC || defined malloc) \
906 : : && (defined YYFREE || defined free)))
907 : : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
908 : : # ifndef _STDLIB_H
909 : : # define _STDLIB_H 1
910 : : # endif
911 : : # endif
912 : : # ifndef YYMALLOC
913 : : # define YYMALLOC malloc
914 : : # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
915 : : || defined __cplusplus || defined _MSC_VER)
916 : : void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
917 : : # endif
918 : : # endif
919 : : # ifndef YYFREE
920 : : # define YYFREE free
921 : : # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
922 : : || defined __cplusplus || defined _MSC_VER)
923 : : void free (void *); /* INFRINGES ON USER NAME SPACE */
924 : : # endif
925 : : # endif
926 : : # endif
927 : : #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
928 : :
929 : :
930 : : #if (! defined yyoverflow \
931 : : && (! defined __cplusplus \
932 : : || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
933 : :
934 : : /* A type that is properly aligned for any stack member. */
935 : : union yyalloc
936 : : {
937 : : yytype_int16 yyss_alloc;
938 : : YYSTYPE yyvs_alloc;
939 : : };
940 : :
941 : : /* The size of the maximum gap between one aligned stack and the next. */
942 : : # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
943 : :
944 : : /* The size of an array large to enough to hold all stacks, each with
945 : : N elements. */
946 : : # define YYSTACK_BYTES(N) \
947 : : ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
948 : : + YYSTACK_GAP_MAXIMUM)
949 : :
950 : : /* Copy COUNT objects from FROM to TO. The source and destination do
951 : : not overlap. */
952 : : # ifndef YYCOPY
953 : : # if defined __GNUC__ && 1 < __GNUC__
954 : : # define YYCOPY(To, From, Count) \
955 : : __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
956 : : # else
957 : : # define YYCOPY(To, From, Count) \
958 : : do \
959 : : { \
960 : : YYSIZE_T yyi; \
961 : : for (yyi = 0; yyi < (Count); yyi++) \
962 : : (To)[yyi] = (From)[yyi]; \
963 : : } \
964 : : while (YYID (0))
965 : : # endif
966 : : # endif
967 : :
968 : : /* Relocate STACK from its old location to the new one. The
969 : : local variables YYSIZE and YYSTACKSIZE give the old and new number of
970 : : elements in the stack, and YYPTR gives the new location of the
971 : : stack. Advance YYPTR to a properly aligned location for the next
972 : : stack. */
973 : : # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
974 : : do \
975 : : { \
976 : : YYSIZE_T yynewbytes; \
977 : : YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
978 : : Stack = &yyptr->Stack_alloc; \
979 : : yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
980 : : yyptr += yynewbytes / sizeof (*yyptr); \
981 : : } \
982 : : while (YYID (0))
983 : :
984 : : #endif
985 : :
986 : : /* YYFINAL -- State number of the termination state. */
987 : : #define YYFINAL 29
988 : : /* YYLAST -- Last index in YYTABLE. */
989 : : #define YYLAST 176
990 : :
991 : : /* YYNTOKENS -- Number of terminals. */
992 : : #define YYNTOKENS 16
993 : : /* YYNNTS -- Number of nonterminals. */
994 : : #define YYNNTS 12
995 : : /* YYNRULES -- Number of rules. */
996 : : #define YYNRULES 32
997 : : /* YYNRULES -- Number of states. */
998 : : #define YYNSTATES 43
999 : :
1000 : : /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1001 : : #define YYUNDEFTOK 2
1002 : : #define YYMAXUTOK 264
1003 : :
1004 : : #define YYTRANSLATE(YYX) \
1005 : : ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1006 : :
1007 : : /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1008 : : static const yytype_uint8 yytranslate[] =
1009 : : {
1010 : : 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1011 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1012 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1013 : : 2, 2, 2, 14, 2, 2, 2, 2, 2, 2,
1014 : : 10, 11, 2, 2, 12, 2, 13, 2, 2, 2,
1015 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1016 : : 2, 15, 2, 2, 2, 2, 2, 2, 2, 2,
1017 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1018 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1019 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1020 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1021 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1022 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1023 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1024 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1025 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1026 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1027 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1028 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1029 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1030 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1031 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1032 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1033 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1034 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1035 : : 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1036 : : 5, 6, 7, 8, 9
1037 : : };
1038 : :
1039 : : #if YYDEBUG
1040 : : /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1041 : : YYRHS. */
1042 : : static const yytype_uint8 yyprhs[] =
1043 : : {
1044 : : 0, 0, 3, 5, 8, 9, 12, 17, 22, 26,
1045 : : 31, 33, 36, 39, 43, 45, 48, 50, 52, 53,
1046 : : 57, 59, 62, 65, 67, 69, 72, 75, 78, 81,
1047 : : 84, 87, 88
1048 : : };
1049 : :
1050 : : /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1051 : : static const yytype_int8 yyrhs[] =
1052 : : {
1053 : : 27, 0, -1, 4, -1, 17, 8, -1, -1, 18,
1054 : : 8, -1, 10, 18, 26, 11, -1, 5, 18, 26,
1055 : : 11, -1, 5, 18, 11, -1, 5, 18, 1, 11,
1056 : : -1, 6, -1, 6, 21, -1, 12, 4, -1, 12,
1057 : : 4, 21, -1, 7, -1, 7, 21, -1, 22, -1,
1058 : : 20, -1, -1, 23, 9, 23, -1, 24, -1, 24,
1059 : : 25, -1, 25, 1, -1, 17, -1, 19, -1, 26,
1060 : : 26, -1, 26, 25, -1, 26, 1, -1, 24, 26,
1061 : : -1, 3, 26, -1, 24, 3, -1, -1, 26, -1
1062 : : };
1063 : :
1064 : : /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1065 : : static const yytype_uint16 yyrline[] =
1066 : : {
1067 : : 0, 658, 658, 672, 676, 677, 679, 680, 683, 686,
1068 : : 691, 692, 696, 697, 700, 701, 704, 705, 706, 709,
1069 : : 722, 723, 724, 727, 732, 733, 768, 796, 797, 811,
1070 : : 831, 856, 859
1071 : : };
1072 : : #endif
1073 : :
1074 : : #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1075 : : /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1076 : : First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1077 : : static const char *const yytname[] =
1078 : : {
1079 : : "$end", "error", "$undefined", "PARSE_URL", "IDENTIFIER", "BINREF",
1080 : : "PADREF", "REF", "ASSIGNMENT", "LINK", "'('", "')'", "','", "'.'", "'!'",
1081 : : "'='", "$accept", "element", "assignments", "bin", "pads", "padlist",
1082 : : "reference", "linkpart", "link", "linklist", "chain", "graph", 0
1083 : : };
1084 : : #endif
1085 : :
1086 : : # ifdef YYPRINT
1087 : : /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1088 : : token YYLEX-NUM. */
1089 : : static const yytype_uint16 yytoknum[] =
1090 : : {
1091 : : 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1092 : : 40, 41, 44, 46, 33, 61
1093 : : };
1094 : : # endif
1095 : :
1096 : : /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1097 : : static const yytype_uint8 yyr1[] =
1098 : : {
1099 : : 0, 16, 17, 17, 18, 18, 19, 19, 19, 19,
1100 : : 20, 20, 21, 21, 22, 22, 23, 23, 23, 24,
1101 : : 25, 25, 25, 26, 26, 26, 26, 26, 26, 26,
1102 : : 26, 27, 27
1103 : : };
1104 : :
1105 : : /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1106 : : static const yytype_uint8 yyr2[] =
1107 : : {
1108 : : 0, 2, 1, 2, 0, 2, 4, 4, 3, 4,
1109 : : 1, 2, 2, 3, 1, 2, 1, 1, 0, 3,
1110 : : 1, 2, 2, 1, 1, 2, 2, 2, 2, 2,
1111 : : 2, 0, 1
1112 : : };
1113 : :
1114 : : /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1115 : : STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1116 : : means the default is an error. */
1117 : : static const yytype_uint8 yydefact[] =
1118 : : {
1119 : : 18, 18, 2, 4, 10, 14, 4, 23, 24, 17,
1120 : : 16, 0, 18, 0, 0, 0, 0, 0, 11, 15,
1121 : : 18, 3, 18, 30, 0, 27, 20, 0, 0, 1,
1122 : : 0, 5, 8, 0, 12, 0, 19, 0, 22, 9,
1123 : : 7, 13, 6
1124 : : };
1125 : :
1126 : : /* YYDEFGOTO[NTERM-NUM]. */
1127 : : static const yytype_int8 yydefgoto[] =
1128 : : {
1129 : : -1, 7, 16, 8, 9, 18, 10, 11, 26, 27,
1130 : : 28, 14
1131 : : };
1132 : :
1133 : : /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1134 : : STATE-NUM. */
1135 : : #define YYPACT_NINF -6
1136 : : static const yytype_int16 yypact[] =
1137 : : {
1138 : : 134, 158, -6, -6, -1, -1, -6, 6, -6, -6,
1139 : : -6, 7, 166, 101, 18, 30, 89, 16, -6, -6,
1140 : : 2, -6, 129, 142, 42, -6, 150, 54, 66, -6,
1141 : : 11, -6, -6, 111, -1, 122, -6, 78, -6, -6,
1142 : : -6, -6, -6
1143 : : };
1144 : :
1145 : : /* YYPGOTO[NTERM-NUM]. */
1146 : : static const yytype_int8 yypgoto[] =
1147 : : {
1148 : : -6, -6, 19, -6, -6, -5, -6, 10, 3, 12,
1149 : : 1, -6
1150 : : };
1151 : :
1152 : : /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1153 : : positive, shift that token. If negative, reduce the rule which
1154 : : number is the opposite. If zero, do what YYDEFACT says.
1155 : : If YYTABLE_NINF, syntax error. */
1156 : : #define YYTABLE_NINF -33
1157 : : static const yytype_int8 yytable[] =
1158 : : {
1159 : : 19, 13, 15, 12, 12, 1, 2, 3, 4, 5,
1160 : : 31, 17, 6, 24, 21, 12, 22, 33, 29, 12,
1161 : : 34, 35, 39, 12, 15, 20, 12, 24, 0, 41,
1162 : : -29, 25, 36, 1, 2, 3, 4, 5, 37, -18,
1163 : : 6, -29, -28, 25, 0, 1, 2, 3, 4, 5,
1164 : : 0, -18, 6, -28, -26, 38, 0, -26, -26, -26,
1165 : : -26, -26, 0, -26, -26, -26, -25, 25, 0, 1,
1166 : : 2, 3, 4, 5, 0, -18, 6, -25, -21, 38,
1167 : : 0, -21, -21, -21, -21, -21, 0, -21, -21, -21,
1168 : : 30, 0, 1, 2, 3, 4, 5, 31, -18, 6,
1169 : : 32, -32, 25, 0, 1, 2, 3, 4, 5, 0,
1170 : : -18, 6, 25, 0, 1, 2, 3, 4, 5, 0,
1171 : : -18, 6, 40, 25, 0, 1, 2, 3, 4, 5,
1172 : : 0, -18, 6, 42, -31, 4, 5, 1, 2, 3,
1173 : : 4, 5, 0, 0, 6, 1, 2, 3, 4, 5,
1174 : : 0, -18, 6, 23, 2, 3, 4, 5, 0, -18,
1175 : : 6, 1, 2, 3, 4, 5, 0, 0, 6, 23,
1176 : : 2, 3, 4, 5, 0, 0, 6
1177 : : };
1178 : :
1179 : : static const yytype_int8 yycheck[] =
1180 : : {
1181 : : 5, 0, 1, 0, 1, 3, 4, 5, 6, 7,
1182 : : 8, 12, 10, 12, 8, 12, 9, 16, 0, 16,
1183 : : 4, 20, 11, 20, 23, 6, 23, 26, -1, 34,
1184 : : 0, 1, 22, 3, 4, 5, 6, 7, 26, 9,
1185 : : 10, 11, 0, 1, -1, 3, 4, 5, 6, 7,
1186 : : -1, 9, 10, 11, 0, 1, -1, 3, 4, 5,
1187 : : 6, 7, -1, 9, 10, 11, 0, 1, -1, 3,
1188 : : 4, 5, 6, 7, -1, 9, 10, 11, 0, 1,
1189 : : -1, 3, 4, 5, 6, 7, -1, 9, 10, 11,
1190 : : 1, -1, 3, 4, 5, 6, 7, 8, 9, 10,
1191 : : 11, 0, 1, -1, 3, 4, 5, 6, 7, -1,
1192 : : 9, 10, 1, -1, 3, 4, 5, 6, 7, -1,
1193 : : 9, 10, 11, 1, -1, 3, 4, 5, 6, 7,
1194 : : -1, 9, 10, 11, 0, 6, 7, 3, 4, 5,
1195 : : 6, 7, -1, -1, 10, 3, 4, 5, 6, 7,
1196 : : -1, 9, 10, 3, 4, 5, 6, 7, -1, 9,
1197 : : 10, 3, 4, 5, 6, 7, -1, -1, 10, 3,
1198 : : 4, 5, 6, 7, -1, -1, 10
1199 : : };
1200 : :
1201 : : /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1202 : : symbol of state STATE-NUM. */
1203 : : static const yytype_uint8 yystos[] =
1204 : : {
1205 : : 0, 3, 4, 5, 6, 7, 10, 17, 19, 20,
1206 : : 22, 23, 24, 26, 27, 26, 18, 12, 21, 21,
1207 : : 18, 8, 9, 3, 26, 1, 24, 25, 26, 0,
1208 : : 1, 8, 11, 26, 4, 26, 23, 25, 1, 11,
1209 : : 11, 21, 11
1210 : : };
1211 : :
1212 : : #define yyerrok (yyerrstatus = 0)
1213 : : #define yyclearin (yychar = YYEMPTY)
1214 : : #define YYEMPTY (-2)
1215 : : #define YYEOF 0
1216 : :
1217 : : #define YYACCEPT goto yyacceptlab
1218 : : #define YYABORT goto yyabortlab
1219 : : #define YYERROR goto yyerrorlab
1220 : :
1221 : :
1222 : : /* Like YYERROR except do call yyerror. This remains here temporarily
1223 : : to ease the transition to the new meaning of YYERROR, for GCC.
1224 : : Once GCC version 2 has supplanted version 1, this can go. */
1225 : :
1226 : : #define YYFAIL goto yyerrlab
1227 : :
1228 : : #define YYRECOVERING() (!!yyerrstatus)
1229 : :
1230 : : #define YYBACKUP(Token, Value) \
1231 : : do \
1232 : : if (yychar == YYEMPTY && yylen == 1) \
1233 : : { \
1234 : : yychar = (Token); \
1235 : : yylval = (Value); \
1236 : : yytoken = YYTRANSLATE (yychar); \
1237 : : YYPOPSTACK (1); \
1238 : : goto yybackup; \
1239 : : } \
1240 : : else \
1241 : : { \
1242 : : yyerror (scanner, graph, YY_("syntax error: cannot back up")); \
1243 : : YYERROR; \
1244 : : } \
1245 : : while (YYID (0))
1246 : :
1247 : :
1248 : : #define YYTERROR 1
1249 : : #define YYERRCODE 256
1250 : :
1251 : :
1252 : : /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1253 : : If N is 0, then set CURRENT to the empty location which ends
1254 : : the previous symbol: RHS[0] (always defined). */
1255 : :
1256 : : #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1257 : : #ifndef YYLLOC_DEFAULT
1258 : : # define YYLLOC_DEFAULT(Current, Rhs, N) \
1259 : : do \
1260 : : if (YYID (N)) \
1261 : : { \
1262 : : (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1263 : : (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1264 : : (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1265 : : (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1266 : : } \
1267 : : else \
1268 : : { \
1269 : : (Current).first_line = (Current).last_line = \
1270 : : YYRHSLOC (Rhs, 0).last_line; \
1271 : : (Current).first_column = (Current).last_column = \
1272 : : YYRHSLOC (Rhs, 0).last_column; \
1273 : : } \
1274 : : while (YYID (0))
1275 : : #endif
1276 : :
1277 : :
1278 : : /* YY_LOCATION_PRINT -- Print the location on the stream.
1279 : : This macro was not mandated originally: define only if we know
1280 : : we won't break user code: when these are the locations we know. */
1281 : :
1282 : : #ifndef YY_LOCATION_PRINT
1283 : : # if YYLTYPE_IS_TRIVIAL
1284 : : # define YY_LOCATION_PRINT(File, Loc) \
1285 : : fprintf (File, "%d.%d-%d.%d", \
1286 : : (Loc).first_line, (Loc).first_column, \
1287 : : (Loc).last_line, (Loc).last_column)
1288 : : # else
1289 : : # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1290 : : # endif
1291 : : #endif
1292 : :
1293 : :
1294 : : /* YYLEX -- calling `yylex' with the right arguments. */
1295 : :
1296 : : #ifdef YYLEX_PARAM
1297 : : # define YYLEX yylex (&yylval, YYLEX_PARAM)
1298 : : #else
1299 : : # define YYLEX yylex (&yylval)
1300 : : #endif
1301 : :
1302 : : /* Enable debugging if requested. */
1303 : : #if YYDEBUG
1304 : :
1305 : : # ifndef YYFPRINTF
1306 : : # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1307 : : # define YYFPRINTF fprintf
1308 : : # endif
1309 : :
1310 : : # define YYDPRINTF(Args) \
1311 : : do { \
1312 : : if (yydebug) \
1313 : : YYFPRINTF Args; \
1314 : : } while (YYID (0))
1315 : :
1316 : : # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1317 : : do { \
1318 : : if (yydebug) \
1319 : : { \
1320 : : YYFPRINTF (stderr, "%s ", Title); \
1321 : : yy_symbol_print (stderr, \
1322 : : Type, Value, scanner, graph); \
1323 : : YYFPRINTF (stderr, "\n"); \
1324 : : } \
1325 : : } while (YYID (0))
1326 : :
1327 : :
1328 : : /*--------------------------------.
1329 : : | Print this symbol on YYOUTPUT. |
1330 : : `--------------------------------*/
1331 : :
1332 : : /*ARGSUSED*/
1333 : 0 : #if (defined __STDC__ || defined __C99__FUNC__ \
1334 : : || defined __cplusplus || defined _MSC_VER)
1335 : : static void
1336 : : yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *scanner, graph_t *graph)
1337 : : #else
1338 : : static void
1339 : : yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner, graph)
1340 : : FILE *yyoutput;
1341 : : int yytype;
1342 : : YYSTYPE const * const yyvaluep;
1343 : : void *scanner;
1344 [ # # ]: 0 : graph_t *graph;
1345 : 0 : #endif
1346 : : {
1347 : : if (!yyvaluep)
1348 : : return;
1349 : : YYUSE (scanner);
1350 : : YYUSE (graph);
1351 : : # ifdef YYPRINT
1352 : : if (yytype < YYNTOKENS)
1353 : : YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1354 : : # else
1355 : : YYUSE (yyoutput);
1356 : : # endif
1357 : 0 : switch (yytype)
1358 : : {
1359 : : default:
1360 : : break;
1361 : : }
1362 : : }
1363 : :
1364 : :
1365 : : /*--------------------------------.
1366 : : | Print this symbol on YYOUTPUT. |
1367 : : `--------------------------------*/
1368 : :
1369 : 0 : #if (defined __STDC__ || defined __C99__FUNC__ \
1370 : : || defined __cplusplus || defined _MSC_VER)
1371 : : static void
1372 : : yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *scanner, graph_t *graph)
1373 : : #else
1374 : : static void
1375 : : yy_symbol_print (yyoutput, yytype, yyvaluep, scanner, graph)
1376 : : FILE *yyoutput;
1377 : : int yytype;
1378 : : YYSTYPE const * const yyvaluep;
1379 : : void *scanner;
1380 [ # # ]: 0 : graph_t *graph;
1381 [ # # ]: 0 : #endif
1382 : : {
1383 [ # # ]: 0 : if (yytype < YYNTOKENS)
1384 : : YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1385 : 0 : else
1386 [ # # ]: 0 : YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1387 : 0 :
1388 : : yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner, graph);
1389 : : YYFPRINTF (yyoutput, ")");
1390 : : }
1391 : :
1392 : : /*------------------------------------------------------------------.
1393 : : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1394 : : | TOP (included). |
1395 : : `------------------------------------------------------------------*/
1396 : :
1397 : 0 : #if (defined __STDC__ || defined __C99__FUNC__ \
1398 : : || defined __cplusplus || defined _MSC_VER)
1399 : : static void
1400 : : yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1401 : : #else
1402 : : static void
1403 : : yy_stack_print (yybottom, yytop)
1404 : : yytype_int16 *yybottom;
1405 [ # # ]: 0 : yytype_int16 *yytop;
1406 [ # # ]: 0 : #endif
1407 : : {
1408 : 0 : YYFPRINTF (stderr, "Stack now");
1409 [ # # ]: 0 : for (; yybottom <= yytop; yybottom++)
1410 : : {
1411 [ # # ]: 0 : int yybot = *yybottom;
1412 : 0 : YYFPRINTF (stderr, " %d", yybot);
1413 : : }
1414 : : YYFPRINTF (stderr, "\n");
1415 : : }
1416 : :
1417 : : # define YY_STACK_PRINT(Bottom, Top) \
1418 : : do { \
1419 : : if (yydebug) \
1420 : : yy_stack_print ((Bottom), (Top)); \
1421 : : } while (YYID (0))
1422 : :
1423 : :
1424 : : /*------------------------------------------------.
1425 : : | Report that the YYRULE is going to be reduced. |
1426 : : `------------------------------------------------*/
1427 : :
1428 : 0 : #if (defined __STDC__ || defined __C99__FUNC__ \
1429 : : || defined __cplusplus || defined _MSC_VER)
1430 : : static void
1431 : : yy_reduce_print (YYSTYPE *yyvsp, int yyrule, void *scanner, graph_t *graph)
1432 : : #else
1433 : : static void
1434 : : yy_reduce_print (yyvsp, yyrule, scanner, graph)
1435 : : YYSTYPE *yyvsp;
1436 : : int yyrule;
1437 : : void *scanner;
1438 : 0 : graph_t *graph;
1439 : : #endif
1440 : 0 : {
1441 [ # # ]: 0 : int yynrhs = yyr2[yyrule];
1442 : : int yyi;
1443 : : unsigned long int yylno = yyrline[yyrule];
1444 [ # # ]: 0 : YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1445 : : yyrule - 1, yylno);
1446 [ # # ]: 0 : /* The symbols being reduced. */
1447 : 0 : for (yyi = 0; yyi < yynrhs; yyi++)
1448 : 0 : {
1449 : : YYFPRINTF (stderr, " $%d = ", yyi + 1);
1450 [ # # ]: 0 : yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1451 : : &(yyvsp[(yyi + 1) - (yynrhs)])
1452 : 0 : , scanner, graph);
1453 : : YYFPRINTF (stderr, "\n");
1454 : : }
1455 : : }
1456 : :
1457 : : # define YY_REDUCE_PRINT(Rule) \
1458 : : do { \
1459 : : if (yydebug) \
1460 : : yy_reduce_print (yyvsp, Rule, scanner, graph); \
1461 : : } while (YYID (0))
1462 : :
1463 : : /* Nonzero means print parse trace. It is left uninitialized so that
1464 : : multiple parsers can coexist. */
1465 : : int yydebug;
1466 : : #else /* !YYDEBUG */
1467 : : # define YYDPRINTF(Args)
1468 : : # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1469 : : # define YY_STACK_PRINT(Bottom, Top)
1470 : : # define YY_REDUCE_PRINT(Rule)
1471 : : #endif /* !YYDEBUG */
1472 : :
1473 : :
1474 : : /* YYINITDEPTH -- initial size of the parser's stacks. */
1475 : : #ifndef YYINITDEPTH
1476 : : # define YYINITDEPTH 200
1477 : : #endif
1478 : :
1479 : : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1480 : : if the built-in stack extension method is used).
1481 : :
1482 : : Do not make this value too large; the results are undefined if
1483 : : YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1484 : : evaluated with infinite-precision integer arithmetic. */
1485 : :
1486 : : #ifndef YYMAXDEPTH
1487 : : # define YYMAXDEPTH 10000
1488 : : #endif
1489 : :
1490 : :
1491 : :
1492 : : #if YYERROR_VERBOSE
1493 : :
1494 : : # ifndef yystrlen
1495 : : # if defined __GLIBC__ && defined _STRING_H
1496 : : # define yystrlen strlen
1497 : : # else
1498 : : /* Return the length of YYSTR. */
1499 : : #if (defined __STDC__ || defined __C99__FUNC__ \
1500 : : || defined __cplusplus || defined _MSC_VER)
1501 : : static YYSIZE_T
1502 : : yystrlen (const char *yystr)
1503 : : #else
1504 : : static YYSIZE_T
1505 : : yystrlen (yystr)
1506 : : const char *yystr;
1507 : : #endif
1508 : : {
1509 : : YYSIZE_T yylen;
1510 : : for (yylen = 0; yystr[yylen]; yylen++)
1511 : : continue;
1512 : : return yylen;
1513 : : }
1514 : : # endif
1515 : : # endif
1516 : :
1517 : : # ifndef yystpcpy
1518 : : # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1519 : : # define yystpcpy stpcpy
1520 : : # else
1521 : : /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1522 : : YYDEST. */
1523 : 11 : #if (defined __STDC__ || defined __C99__FUNC__ \
1524 : : || defined __cplusplus || defined _MSC_VER)
1525 : : static char *
1526 : : yystpcpy (char *yydest, const char *yysrc)
1527 : : #else
1528 : : static char *
1529 : : yystpcpy (yydest, yysrc)
1530 : : char *yydest;
1531 : 11 : const char *yysrc;
1532 : 11 : #endif
1533 : : {
1534 [ + + ]: 139 : char *yyd = yydest;
1535 : 128 : const char *yys = yysrc;
1536 : :
1537 : 11 : while ((*yyd++ = *yys++) != '\0')
1538 : : continue;
1539 : :
1540 : : return yyd - 1;
1541 : : }
1542 : : # endif
1543 : : # endif
1544 : :
1545 : : # ifndef yytnamerr
1546 : : /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1547 : : quotes and backslashes, so that it's suitable for yyerror. The
1548 : : heuristic is that double-quoting is unnecessary unless the string
1549 : : contains an apostrophe, a comma, or backslash (other than
1550 : : backslash-backslash). YYSTR is taken from yytname. If YYRES is
1551 : 11 : null, do not copy; instead, return the length of what the result
1552 : : would have been. */
1553 [ - + ]: 11 : static YYSIZE_T
1554 : : yytnamerr (char *yyres, const char *yystr)
1555 : 0 : {
1556 : 0 : if (*yystr == '"')
1557 : : {
1558 : : YYSIZE_T yyn = 0;
1559 [ # # # # ]: 0 : char const *yyp = yystr;
1560 : :
1561 : : for (;;)
1562 : : switch (*++yyp)
1563 : 0 : {
1564 : : case '\'':
1565 : : case ',':
1566 [ # # ]: 0 : goto do_not_strip_quotes;
1567 : 0 :
1568 : : case '\\':
1569 : : if (*++yyp != '\\')
1570 [ # # ]: 0 : goto do_not_strip_quotes;
1571 : 0 : /* Fall through. */
1572 : 0 : default:
1573 : 0 : if (yyres)
1574 : : yyres[yyn] = *yyp;
1575 : : yyn++;
1576 [ # # ]: 0 : break;
1577 : 0 :
1578 : 0 : case '"':
1579 : : if (yyres)
1580 : 0 : yyres[yyn] = '\0';
1581 : : return yyn;
1582 : : }
1583 [ + + ]: 11 : do_not_strip_quotes: ;
1584 : 10 : }
1585 : :
1586 : 11 : if (! yyres)
1587 : : return yystrlen (yystr);
1588 : :
1589 : : return yystpcpy (yyres, yystr) - yyres;
1590 : : }
1591 : : # endif
1592 : :
1593 : : /* Copy into YYRESULT an error message about the unexpected token
1594 : : YYCHAR while in state YYSTATE. Return the number of bytes copied,
1595 : : including the terminating null byte. If YYRESULT is null, do not
1596 : : copy anything; just return the number of bytes that would be
1597 : : copied. As a special case, return 0 if an ordinary "syntax error"
1598 : 2 : message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1599 : : size calculation. */
1600 : 2 : static YYSIZE_T
1601 : : yysyntax_error (char *yyresult, int yystate, int yychar)
1602 [ + - ][ - + ]: 2 : {
1603 : 0 : int yyn = yypact[yystate];
1604 : :
1605 : : if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1606 [ + - ]: 2 : return 0;
1607 : 2 : else
1608 : 2 : {
1609 : : int yytype = YYTRANSLATE (yychar);
1610 : 2 : YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1611 : : YYSIZE_T yysize = yysize0;
1612 : : YYSIZE_T yysize1;
1613 : : int yysize_overflow = 0;
1614 : : enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1615 : : char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1616 : : int yyx;
1617 : :
1618 : : # if 0
1619 : : /* This is so xgettext sees the translatable formats that are
1620 : : constructed on the fly. */
1621 : : YY_("syntax error, unexpected %s");
1622 : : YY_("syntax error, unexpected %s, expecting %s");
1623 : : YY_("syntax error, unexpected %s, expecting %s or %s");
1624 : : YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1625 : : YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1626 : : # endif
1627 : : char *yyfmt;
1628 : : char const *yyf;
1629 : : static char const yyunexpected[] = "syntax error, unexpected %s";
1630 : : static char const yyexpecting[] = ", expecting %s";
1631 : : static char const yyor[] = " or %s";
1632 : : char yyformat[sizeof yyunexpected
1633 : 2 : + sizeof yyexpecting - 1
1634 : : + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1635 : : * (sizeof yyor - 1))];
1636 : : char const *yyprefix = yyexpecting;
1637 [ - + ]: 2 :
1638 : : /* Start YYX at -YYN if negative to avoid negative indexes in
1639 : : YYCHECK. */
1640 : 2 : int yyxbegin = yyn < 0 ? -yyn : 0;
1641 : 2 :
1642 : 2 : /* Stay within bounds of both yycheck and yytname. */
1643 : : int yychecklim = YYLAST - yyn + 1;
1644 : 2 : int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1645 : 2 : int yycount = 1;
1646 : :
1647 [ + - ]: 16 : yyarg[0] = yytname[yytype];
1648 [ + + ][ + + ]: 16 : yyfmt = yystpcpy (yyformat, yyunexpected);
1649 : :
1650 [ + + ]: 10 : for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1651 : : if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1652 : 2 : {
1653 : 2 : if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1654 : 2 : {
1655 : 2 : yycount = 1;
1656 : : yysize = yysize0;
1657 : 8 : yyformat[sizeof yyunexpected - 1] = '\0';
1658 : 8 : break;
1659 : 8 : }
1660 : 8 : yyarg[yycount++] = yytname[yyx];
1661 : 8 : yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1662 : 8 : yysize_overflow |= (yysize1 < yysize);
1663 : : yysize = yysize1;
1664 : : yyfmt = yystpcpy (yyfmt, yyprefix);
1665 : 2 : yyprefix = yyor;
1666 : 2 : }
1667 : 2 :
1668 : 2 : yyf = YY_(yyformat);
1669 : : yysize1 = yysize + yystrlen (yyf);
1670 [ - + ]: 2 : yysize_overflow |= (yysize1 < yysize);
1671 : 0 : yysize = yysize1;
1672 : :
1673 [ + + ]: 2 : if (yysize_overflow)
1674 : : return YYSIZE_MAXIMUM;
1675 : :
1676 : : if (yyresult)
1677 : : {
1678 : 1 : /* Avoid sprintf, as that infringes on the user's name space.
1679 : 1 : Don't have undefined behavior even if the translation
1680 [ + + ]: 27 : produced a string with the wrong number of "%s"s. */
1681 : : char *yyp = yyresult;
1682 [ + + ][ + - ]: 26 : int yyi = 0;
[ + - ]
1683 : : while ((*yyp = *yyf) != '\0')
1684 : 1 : {
1685 : 1 : if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1686 : : {
1687 : : yyp += yytnamerr (yyp, yyarg[yyi++]);
1688 : : yyf += 2;
1689 : 25 : }
1690 : 25 : else
1691 : : {
1692 : : yyp++;
1693 : : yyf++;
1694 : 2 : }
1695 : : }
1696 : : }
1697 : : return yysize;
1698 : : }
1699 : : }
1700 : : #endif /* YYERROR_VERBOSE */
1701 : :
1702 : :
1703 : : /*-----------------------------------------------.
1704 : : | Release the memory associated to this symbol. |
1705 : : `-----------------------------------------------*/
1706 : :
1707 : : /*ARGSUSED*/
1708 : 120 : #if (defined __STDC__ || defined __C99__FUNC__ \
1709 : : || defined __cplusplus || defined _MSC_VER)
1710 : : static void
1711 : : yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *scanner, graph_t *graph)
1712 : : #else
1713 : : static void
1714 : : yydestruct (yymsg, yytype, yyvaluep, scanner, graph)
1715 : : const char *yymsg;
1716 : : int yytype;
1717 : : YYSTYPE *yyvaluep;
1718 : : void *scanner;
1719 : : graph_t *graph;
1720 : : #endif
1721 : : {
1722 : : YYUSE (yyvaluep);
1723 [ - + ]: 120 : YYUSE (scanner);
1724 : 0 : YYUSE (graph);
1725 [ - + ][ # # ]: 120 :
[ # # ]
1726 : : if (!yymsg)
1727 : : yymsg = "Deleting";
1728 : : YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1729 : :
1730 : : switch (yytype)
1731 : 120 : {
1732 : :
1733 : 120 : default:
1734 : : break;
1735 : : }
1736 : : }
1737 : :
1738 : : /* Prevent warnings from -Wmissing-prototypes. */
1739 : : #ifdef YYPARSE_PARAM
1740 : : #if defined __STDC__ || defined __cplusplus
1741 : : int yyparse (void *YYPARSE_PARAM);
1742 : : #else
1743 : : int yyparse ();
1744 : : #endif
1745 : : #else /* ! YYPARSE_PARAM */
1746 : : #if defined __STDC__ || defined __cplusplus
1747 : : int yyparse (void *scanner, graph_t *graph);
1748 : : #else
1749 : : int yyparse ();
1750 : : #endif
1751 : : #endif /* ! YYPARSE_PARAM */
1752 : :
1753 : :
1754 : :
1755 : :
1756 : :
1757 : : /*-------------------------.
1758 : : | yyparse or yypush_parse. |
1759 : : `-------------------------*/
1760 : :
1761 : : #ifdef YYPARSE_PARAM
1762 : : #if (defined __STDC__ || defined __C99__FUNC__ \
1763 : : || defined __cplusplus || defined _MSC_VER)
1764 : : int
1765 : : yyparse (void *YYPARSE_PARAM)
1766 : : #else
1767 : : int
1768 : : yyparse (YYPARSE_PARAM)
1769 : : void *YYPARSE_PARAM;
1770 : : #endif
1771 : : #else /* ! YYPARSE_PARAM */
1772 : 61 : #if (defined __STDC__ || defined __C99__FUNC__ \
1773 : : || defined __cplusplus || defined _MSC_VER)
1774 : : int
1775 : : yyparse (void *scanner, graph_t *graph)
1776 : : #else
1777 : : int
1778 : : yyparse (scanner, graph)
1779 : : void *scanner;
1780 : : graph_t *graph;
1781 : : #endif
1782 : : #endif
1783 : : {
1784 : : /* The lookahead symbol. */
1785 : : int yychar;
1786 : :
1787 : : /* The semantic value of the lookahead symbol. */
1788 : : YYSTYPE yylval;
1789 : :
1790 : : /* Number of syntax errors so far. */
1791 : : int yynerrs;
1792 : :
1793 : : int yystate;
1794 : : /* Number of tokens to shift before error messages enabled. */
1795 : : int yyerrstatus;
1796 : :
1797 : : /* The stacks and their tools:
1798 : : `yyss': related to states.
1799 : : `yyvs': related to semantic values.
1800 : :
1801 : : Refer to the stacks thru separate pointers, to allow yyoverflow
1802 : : to reallocate them elsewhere. */
1803 : :
1804 : : /* The state stack. */
1805 : : yytype_int16 yyssa[YYINITDEPTH];
1806 : : yytype_int16 *yyss;
1807 : : yytype_int16 *yyssp;
1808 : :
1809 : : /* The semantic value stack. */
1810 : : YYSTYPE yyvsa[YYINITDEPTH];
1811 : : YYSTYPE *yyvs;
1812 : : YYSTYPE *yyvsp;
1813 : :
1814 : : YYSIZE_T yystacksize;
1815 : :
1816 : : int yyn;
1817 : : int yyresult;
1818 : : /* Lookahead token as an internal (translated) token number. */
1819 : : int yytoken;
1820 : : /* The variables used to return semantic value and location from the
1821 : : action routines. */
1822 : : YYSTYPE yyval;
1823 : :
1824 : 61 : #if YYERROR_VERBOSE
1825 : 61 : /* Buffer for error messages, and its allocated size. */
1826 : : char yymsgbuf[128];
1827 : : char *yymsg = yymsgbuf;
1828 : : YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1829 : : #endif
1830 : :
1831 : : #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1832 : 61 :
1833 : : /* The number of symbols on the RHS of the reduced rule.
1834 : 61 : Keep to zero when no symbol should be popped. */
1835 : 61 : int yylen = 0;
1836 : 61 :
1837 : 61 : yytoken = 0;
1838 : : yyss = yyssa;
1839 [ - + ][ # # ]: 61 : yyvs = yyvsa;
1840 : : yystacksize = YYINITDEPTH;
1841 : 61 :
1842 : 61 : YYDPRINTF ((stderr, "Starting parse\n"));
1843 : 61 :
1844 : 61 : yystate = 0;
1845 : : yyerrstatus = 0;
1846 : : yynerrs = 0;
1847 : : yychar = YYEMPTY; /* Cause a token to be read. */
1848 : :
1849 : : /* Initialize stack pointers.
1850 : 61 : Waste one element of value and location stack
1851 : 61 : so that they stay on the same level as the state stack.
1852 : : The wasted elements are never initialized. */
1853 : 61 : yyssp = yyss;
1854 : : yyvsp = yyvs;
1855 : :
1856 : : goto yysetstate;
1857 : :
1858 : : /*------------------------------------------------------------.
1859 : : | yynewstate -- Push a new state, which is found in yystate. |
1860 : : `------------------------------------------------------------*/
1861 : 1543 : yynewstate:
1862 : : /* In all cases, when you get here, the value and location stacks
1863 : : have just been pushed. So pushing a state here evens the stacks. */
1864 : 1604 : yyssp++;
1865 : :
1866 [ - + ]: 1604 : yysetstate:
1867 : : *yyssp = yystate;
1868 : :
1869 : 0 : if (yyss + yystacksize - 1 <= yyssp)
1870 : : {
1871 : : /* Get the current used size of the three stacks, in elements. */
1872 : : YYSIZE_T yysize = yyssp - yyss + 1;
1873 : :
1874 : : #ifdef yyoverflow
1875 : : {
1876 : : /* Give user a chance to reallocate the stack. Use copies of
1877 : : these so that the &'s don't force the real ones into
1878 : : memory. */
1879 : : YYSTYPE *yyvs1 = yyvs;
1880 : : yytype_int16 *yyss1 = yyss;
1881 : :
1882 : : /* Each stack pointer address is followed by the size of the
1883 : : data in use in that stack, in bytes. This used to be a
1884 : : conditional around just the two extra args, but that might
1885 : : be undefined if yyoverflow is a macro. */
1886 : : yyoverflow (YY_("memory exhausted"),
1887 : : &yyss1, yysize * sizeof (*yyssp),
1888 : : &yyvs1, yysize * sizeof (*yyvsp),
1889 : : &yystacksize);
1890 : :
1891 : : yyss = yyss1;
1892 : : yyvs = yyvs1;
1893 : : }
1894 : : #else /* no yyoverflow */
1895 : : # ifndef YYSTACK_RELOCATE
1896 [ # # ]: 0 : goto yyexhaustedlab;
1897 : 0 : # else
1898 : 0 : /* Extend the stack our own way. */
1899 [ # # ]: 0 : if (YYMAXDEPTH <= yystacksize)
1900 : 0 : goto yyexhaustedlab;
1901 : : yystacksize *= 2;
1902 : : if (YYMAXDEPTH < yystacksize)
1903 : 0 : yystacksize = YYMAXDEPTH;
1904 : 0 :
1905 : 0 : {
1906 [ # # ]: 0 : yytype_int16 *yyss1 = yyss;
1907 : 0 : union yyalloc *yyptr =
1908 : 0 : (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1909 : 0 : if (! yyptr)
1910 : : goto yyexhaustedlab;
1911 [ # # ]: 0 : YYSTACK_RELOCATE (yyss_alloc, yyss);
1912 : 0 : YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1913 : : # undef YYSTACK_RELOCATE
1914 : : if (yyss1 != yyssa)
1915 : : YYSTACK_FREE (yyss1);
1916 : : }
1917 : 0 : # endif
1918 : 0 : #endif /* no yyoverflow */
1919 : :
1920 [ # # ][ # # ]: 0 : yyssp = yyss + yysize - 1;
1921 : : yyvsp = yyvs + yysize - 1;
1922 : :
1923 [ # # ]: 0 : YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1924 : 0 : (unsigned long int) yystacksize));
1925 : :
1926 : : if (yyss + yystacksize - 1 <= yyssp)
1927 [ - + ][ # # ]: 1604 : YYABORT;
1928 : : }
1929 [ + + ]: 1604 :
1930 : 59 : YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1931 : :
1932 : 1545 : if (yystate == YYFINAL)
1933 : : YYACCEPT;
1934 : :
1935 : : goto yybackup;
1936 : :
1937 : : /*-----------.
1938 : : | yybackup. |
1939 : : `-----------*/
1940 : : yybackup:
1941 : :
1942 : : /* Do appropriate processing given the current state. Read a
1943 : 1545 : lookahead token if we need one and don't already have one. */
1944 [ + + ]: 1545 :
1945 : 453 : /* First try to decide what to do without reference to lookahead token. */
1946 : : yyn = yypact[yystate];
1947 : : if (yyn == YYPACT_NINF)
1948 : : goto yydefault;
1949 : :
1950 [ + + ]: 1092 : /* Not known => get a lookahead token if don't already have one. */
1951 : :
1952 [ - + ][ # # ]: 499 : /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1953 : 499 : if (yychar == YYEMPTY)
1954 : : {
1955 : : YYDPRINTF ((stderr, "Reading a token: "));
1956 [ + + ]: 1092 : yychar = YYLEX;
1957 : : }
1958 : 329 :
1959 [ - + ][ # # ]: 329 : if (yychar <= YYEOF)
1960 : : {
1961 : : yychar = yytoken = YYEOF;
1962 : : YYDPRINTF ((stderr, "Now at end of input.\n"));
1963 [ + - ]: 763 : }
1964 [ - + ][ # # ]: 763 : else
[ # # ]
1965 : : {
1966 : : yytoken = YYTRANSLATE (yychar);
1967 : : YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1968 : : }
1969 : 1092 :
1970 [ + + ][ + - ]: 1092 : /* If the proper action on seeing token YYTOKEN is to reduce or to
[ + + ]
1971 : : detect an error, take that action. */
1972 : 820 : yyn += yytoken;
1973 [ + + ]: 820 : if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1974 : : goto yydefault;
1975 [ + - ][ + - ]: 322 : yyn = yytable[yyn];
1976 : : if (yyn <= 0)
1977 : 322 : {
1978 : 322 : if (yyn == 0 || yyn == YYTABLE_NINF)
1979 : : goto yyerrlab;
1980 : : yyn = -yyn;
1981 : : goto yyreduce;
1982 : : }
1983 [ + + ]: 498 :
1984 : 5 : /* Count tokens shifted since error; after three, turn off error
1985 : : status. */
1986 : : if (yyerrstatus)
1987 [ - + ][ # # ]: 498 : yyerrstatus--;
[ # # ]
1988 : :
1989 : : /* Shift the lookahead token. */
1990 : 498 : YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1991 : :
1992 : 498 : /* Discard the shifted token. */
1993 : 498 : yychar = YYEMPTY;
1994 : :
1995 : 498 : yystate = yyn;
1996 : : *++yyvsp = yylval;
1997 : :
1998 : : goto yynewstate;
1999 : :
2000 : :
2001 : : /*-----------------------------------------------------------.
2002 : 725 : | yydefault -- do the default action for the current state. |
2003 [ + + ]: 725 : `-----------------------------------------------------------*/
2004 : 2 : yydefault:
2005 : 723 : yyn = yydefact[yystate];
2006 : : if (yyn == 0)
2007 : : goto yyerrlab;
2008 : : goto yyreduce;
2009 : :
2010 : :
2011 : : /*-----------------------------.
2012 : : | yyreduce -- Do a reduction. |
2013 : 1045 : `-----------------------------*/
2014 : : yyreduce:
2015 : : /* yyn is the number of a rule to reduce with. */
2016 : : yylen = yyr2[yyn];
2017 : :
2018 : : /* If YYLEN is nonzero, implement the default value of the action:
2019 : : `$$ = $1'.
2020 : :
2021 : : Otherwise, the following line sets YYVAL to garbage.
2022 : : This behavior is undocumented and Bison
2023 : 1045 : users should not rely upon it. Assigning to YYVAL
2024 : : unconditionally makes the parser a bit smaller, and it avoids a
2025 : : GCC warning that YYVAL may be used uninitialized. */
2026 [ - + ]: 1045 : yyval = yyvsp[1-yylen];
2027 [ + + + + : 1045 :
+ + + + +
- - - + -
+ + + + +
+ - + + +
+ + + + +
+ + - ]
2028 : :
2029 : : YY_REDUCE_PRINT (yyn);
2030 : : switch (yyn)
2031 : : {
2032 : : case 2:
2033 : :
2034 : : /* Line 1455 of yacc.c */
2035 : : #line 658 "./grammar.y"
2036 : : { (yyval.e) = gst_element_factory_make ((yyvsp[(1) - (1)].s), NULL);
2037 : : if ((yyval.e) == NULL) {
2038 : : ADD_MISSING_ELEMENT (graph, (yyvsp[(1) - (1)].s));
2039 : : SET_ERROR (graph->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, _("no element \"%s\""), (yyvsp[(1) - (1)].s));
2040 : : /* if FATAL_ERRORS flag is set, we don't have to worry about backwards
2041 : : * compatibility and can continue parsing and check for other missing
2042 : : * elements */
2043 : : if ((graph->flags & GST_PARSE_FLAG_FATAL_ERRORS) == 0) {
2044 : : gst_parse_strfree ((yyvsp[(1) - (1)].s));
2045 : : YYERROR;
2046 : : }
2047 : : }
2048 : : gst_parse_strfree ((yyvsp[(1) - (1)].s));
2049 : : ;}
2050 : : break;
2051 : :
2052 : : case 3:
2053 : :
2054 : : /* Line 1455 of yacc.c */
2055 : : #line 672 "./grammar.y"
2056 : : { gst_parse_element_set ((yyvsp[(2) - (2)].s), (yyvsp[(1) - (2)].e), graph);
2057 : : (yyval.e) = (yyvsp[(1) - (2)].e);
2058 : : ;}
2059 : : break;
2060 : :
2061 : : case 4:
2062 : :
2063 : : /* Line 1455 of yacc.c */
2064 : : #line 676 "./grammar.y"
2065 : : { (yyval.p) = NULL; ;}
2066 : : break;
2067 : :
2068 : : case 5:
2069 : :
2070 : : /* Line 1455 of yacc.c */
2071 : : #line 677 "./grammar.y"
2072 : : { (yyval.p) = g_slist_prepend ((yyvsp[(1) - (2)].p), (yyvsp[(2) - (2)].s)); ;}
2073 : : break;
2074 : :
2075 : : case 6:
2076 : :
2077 : : /* Line 1455 of yacc.c */
2078 : : #line 679 "./grammar.y"
2079 : : { GST_BIN_MAKE ((yyval.c), "bin", (yyvsp[(3) - (4)].c), (yyvsp[(2) - (4)].p), no_free); ;}
2080 : : break;
2081 : :
2082 : : case 7:
2083 : :
2084 : : /* Line 1455 of yacc.c */
2085 : : #line 680 "./grammar.y"
2086 : : { GST_BIN_MAKE ((yyval.c), (yyvsp[(1) - (4)].s), (yyvsp[(3) - (4)].c), (yyvsp[(2) - (4)].p), gst_parse_strfree);
2087 : : gst_parse_strfree ((yyvsp[(1) - (4)].s));
2088 : : ;}
2089 : : break;
2090 : :
2091 : : case 8:
2092 : :
2093 : : /* Line 1455 of yacc.c */
2094 : : #line 683 "./grammar.y"
2095 : : { GST_BIN_MAKE ((yyval.c), (yyvsp[(1) - (3)].s), NULL, (yyvsp[(2) - (3)].p), gst_parse_strfree);
2096 : : gst_parse_strfree ((yyvsp[(1) - (3)].s));
2097 : : ;}
2098 : : break;
2099 : :
2100 : : case 9:
2101 : :
2102 : : /* Line 1455 of yacc.c */
2103 : : #line 686 "./grammar.y"
2104 : : { GST_BIN_MAKE ((yyval.c), (yyvsp[(1) - (4)].s), NULL, (yyvsp[(2) - (4)].p), gst_parse_strfree);
2105 : : gst_parse_strfree ((yyvsp[(1) - (4)].s));
2106 : : ;}
2107 : : break;
2108 : :
2109 : : case 10:
2110 : :
2111 : : /* Line 1455 of yacc.c */
2112 : : #line 691 "./grammar.y"
2113 : : { (yyval.p) = g_slist_prepend (NULL, (yyvsp[(1) - (1)].s)); ;}
2114 : : break;
2115 : :
2116 : : case 11:
2117 : :
2118 : : /* Line 1455 of yacc.c */
2119 : : #line 692 "./grammar.y"
2120 : : { (yyval.p) = (yyvsp[(2) - (2)].p);
2121 : : (yyval.p) = g_slist_prepend ((yyval.p), (yyvsp[(1) - (2)].s));
2122 : : ;}
2123 : : break;
2124 : :
2125 : : case 12:
2126 : :
2127 : : /* Line 1455 of yacc.c */
2128 : : #line 696 "./grammar.y"
2129 : : { (yyval.p) = g_slist_prepend (NULL, (yyvsp[(2) - (2)].s)); ;}
2130 : : break;
2131 : :
2132 : : case 13:
2133 : :
2134 : : /* Line 1455 of yacc.c */
2135 : : #line 697 "./grammar.y"
2136 : : { (yyval.p) = g_slist_prepend ((yyvsp[(3) - (3)].p), (yyvsp[(2) - (3)].s)); ;}
2137 : : break;
2138 : :
2139 : : case 14:
2140 : :
2141 : : /* Line 1455 of yacc.c */
2142 : : #line 700 "./grammar.y"
2143 : : { MAKE_REF ((yyval.l), (yyvsp[(1) - (1)].s), NULL); ;}
2144 : : break;
2145 : :
2146 : : case 15:
2147 : :
2148 : : /* Line 1455 of yacc.c */
2149 : : #line 701 "./grammar.y"
2150 : : { MAKE_REF ((yyval.l), (yyvsp[(1) - (2)].s), (yyvsp[(2) - (2)].p)); ;}
2151 : : break;
2152 : :
2153 : : case 16:
2154 : :
2155 : : /* Line 1455 of yacc.c */
2156 : : #line 704 "./grammar.y"
2157 : : { (yyval.l) = (yyvsp[(1) - (1)].l); ;}
2158 : : break;
2159 : :
2160 : : case 17:
2161 : :
2162 : : /* Line 1455 of yacc.c */
2163 : : #line 705 "./grammar.y"
2164 : : { MAKE_REF ((yyval.l), NULL, (yyvsp[(1) - (1)].p)); ;}
2165 : : break;
2166 : :
2167 : : case 18:
2168 : :
2169 : : /* Line 1455 of yacc.c */
2170 : : #line 706 "./grammar.y"
2171 : : { MAKE_REF ((yyval.l), NULL, NULL); ;}
2172 : : break;
2173 : :
2174 : : case 19:
2175 : :
2176 : : /* Line 1455 of yacc.c */
2177 : : #line 709 "./grammar.y"
2178 : : { (yyval.l) = (yyvsp[(1) - (3)].l);
2179 : : if ((yyvsp[(2) - (3)].s)) {
2180 : : (yyval.l)->caps = gst_caps_from_string ((yyvsp[(2) - (3)].s));
2181 : : if ((yyval.l)->caps == NULL)
2182 : : SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("could not parse caps \"%s\""), (yyvsp[(2) - (3)].s));
2183 : : gst_parse_strfree ((yyvsp[(2) - (3)].s));
2184 : : }
2185 : : (yyval.l)->sink_name = (yyvsp[(3) - (3)].l)->src_name;
2186 : : (yyval.l)->sink_pads = (yyvsp[(3) - (3)].l)->src_pads;
2187 : : gst_parse_link_free ((yyvsp[(3) - (3)].l));
2188 : : ;}
2189 : : break;
2190 : :
2191 : : case 20:
2192 : :
2193 : : /* Line 1455 of yacc.c */
2194 : : #line 722 "./grammar.y"
2195 : : { (yyval.p) = g_slist_prepend (NULL, (yyvsp[(1) - (1)].l)); ;}
2196 : : break;
2197 : :
2198 : : case 21:
2199 : :
2200 : : /* Line 1455 of yacc.c */
2201 : : #line 723 "./grammar.y"
2202 : : { (yyval.p) = g_slist_prepend ((yyvsp[(2) - (2)].p), (yyvsp[(1) - (2)].l)); ;}
2203 : : break;
2204 : :
2205 : : case 22:
2206 : :
2207 : : /* Line 1455 of yacc.c */
2208 : : #line 724 "./grammar.y"
2209 : : { (yyval.p) = (yyvsp[(1) - (2)].p); ;}
2210 : : break;
2211 : :
2212 : : case 23:
2213 : :
2214 : : /* Line 1455 of yacc.c */
2215 : : #line 727 "./grammar.y"
2216 : : { (yyval.c) = gst_parse_chain_new ();
2217 : : (yyval.c)->first = (yyval.c)->last = (yyvsp[(1) - (1)].e);
2218 : : (yyval.c)->front = (yyval.c)->back = NULL;
2219 : : (yyval.c)->elements = g_slist_prepend (NULL, (yyvsp[(1) - (1)].e));
2220 : : ;}
2221 : : break;
2222 : :
2223 : : case 24:
2224 : :
2225 : : /* Line 1455 of yacc.c */
2226 : : #line 732 "./grammar.y"
2227 : : { (yyval.c) = (yyvsp[(1) - (1)].c); ;}
2228 : : break;
2229 : :
2230 : : case 25:
2231 : :
2232 : : /* Line 1455 of yacc.c */
2233 : : #line 733 "./grammar.y"
2234 : : { if ((yyvsp[(1) - (2)].c)->back && (yyvsp[(2) - (2)].c)->front) {
2235 : : if (!(yyvsp[(1) - (2)].c)->back->sink_name) {
2236 : : SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("link without source element"));
2237 : : gst_parse_free_link ((yyvsp[(1) - (2)].c)->back);
2238 : : } else {
2239 : : graph->links = g_slist_prepend (graph->links, (yyvsp[(1) - (2)].c)->back);
2240 : : }
2241 : : if (!(yyvsp[(2) - (2)].c)->front->src_name) {
2242 : : SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("link without sink element"));
2243 : : gst_parse_free_link ((yyvsp[(2) - (2)].c)->front);
2244 : : } else {
2245 : : graph->links = g_slist_prepend (graph->links, (yyvsp[(2) - (2)].c)->front);
2246 : : }
2247 : : (yyvsp[(1) - (2)].c)->back = NULL;
2248 : : } else if ((yyvsp[(1) - (2)].c)->back) {
2249 : : if (!(yyvsp[(1) - (2)].c)->back->sink_name) {
2250 : : (yyvsp[(1) - (2)].c)->back->sink = (yyvsp[(2) - (2)].c)->first;
2251 : : }
2252 : : } else if ((yyvsp[(2) - (2)].c)->front) {
2253 : : if (!(yyvsp[(2) - (2)].c)->front->src_name) {
2254 : : (yyvsp[(2) - (2)].c)->front->src = (yyvsp[(1) - (2)].c)->last;
2255 : : }
2256 : : (yyvsp[(1) - (2)].c)->back = (yyvsp[(2) - (2)].c)->front;
2257 : : }
2258 : :
2259 : : if ((yyvsp[(1) - (2)].c)->back) {
2260 : : graph->links = g_slist_prepend (graph->links, (yyvsp[(1) - (2)].c)->back);
2261 : : }
2262 : : (yyvsp[(1) - (2)].c)->last = (yyvsp[(2) - (2)].c)->last;
2263 : : (yyvsp[(1) - (2)].c)->back = (yyvsp[(2) - (2)].c)->back;
2264 : : (yyvsp[(1) - (2)].c)->elements = g_slist_concat ((yyvsp[(1) - (2)].c)->elements, (yyvsp[(2) - (2)].c)->elements);
2265 : : if ((yyvsp[(2) - (2)].c))
2266 : : gst_parse_chain_free ((yyvsp[(2) - (2)].c));
2267 : : (yyval.c) = (yyvsp[(1) - (2)].c);
2268 : : ;}
2269 : : break;
2270 : :
2271 : : case 26:
2272 : :
2273 : : /* Line 1455 of yacc.c */
2274 : : #line 768 "./grammar.y"
2275 : : { GSList *walk;
2276 : : if ((yyvsp[(1) - (2)].c)->back) {
2277 : : (yyvsp[(2) - (2)].p) = g_slist_prepend ((yyvsp[(2) - (2)].p), (yyvsp[(1) - (2)].c)->back);
2278 : : (yyvsp[(1) - (2)].c)->back = NULL;
2279 : : } else {
2280 : : if (!((link_t *) (yyvsp[(2) - (2)].p)->data)->src_name) {
2281 : : ((link_t *) (yyvsp[(2) - (2)].p)->data)->src = (yyvsp[(1) - (2)].c)->last;
2282 : : }
2283 : : }
2284 : : for (walk = (yyvsp[(2) - (2)].p); walk; walk = walk->next) {
2285 : : link_t *link = (link_t *) walk->data;
2286 : : if (!link->sink_name && walk->next) {
2287 : : SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("link without sink element"));
2288 : : gst_parse_free_link (link);
2289 : : } else if (!link->src_name && !link->src) {
2290 : : SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("link without source element"));
2291 : : gst_parse_free_link (link);
2292 : : } else {
2293 : : if (walk->next) {
2294 : : graph->links = g_slist_prepend (graph->links, link);
2295 : : } else {
2296 : : (yyvsp[(1) - (2)].c)->back = link;
2297 : : }
2298 : : }
2299 : : }
2300 : : g_slist_free ((yyvsp[(2) - (2)].p));
2301 : : (yyval.c) = (yyvsp[(1) - (2)].c);
2302 : : ;}
2303 : : break;
2304 : :
2305 : : case 27:
2306 : :
2307 : : /* Line 1455 of yacc.c */
2308 : : #line 796 "./grammar.y"
2309 : : { (yyval.c) = (yyvsp[(1) - (2)].c); ;}
2310 : : break;
2311 : :
2312 : : case 28:
2313 : :
2314 : : /* Line 1455 of yacc.c */
2315 : : #line 797 "./grammar.y"
2316 : : { if ((yyvsp[(2) - (2)].c)->front) {
2317 : : if (!(yyvsp[(2) - (2)].c)->front->src_name) {
2318 : : SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("link without source element"));
2319 : : gst_parse_free_link ((yyvsp[(2) - (2)].c)->front);
2320 : : } else {
2321 : : graph->links = g_slist_prepend (graph->links, (yyvsp[(2) - (2)].c)->front);
2322 : : }
2323 : : }
2324 : : if (!(yyvsp[(1) - (2)].l)->sink_name) {
2325 : : (yyvsp[(1) - (2)].l)->sink = (yyvsp[(2) - (2)].c)->first;
2326 : : }
2327 : : (yyvsp[(2) - (2)].c)->front = (yyvsp[(1) - (2)].l);
2328 : : (yyval.c) = (yyvsp[(2) - (2)].c);
2329 : : ;}
2330 : : break;
2331 : :
2332 : : case 29:
2333 : :
2334 : : /* Line 1455 of yacc.c */
2335 : : #line 811 "./grammar.y"
2336 : : { (yyval.c) = (yyvsp[(2) - (2)].c);
2337 : : if ((yyval.c)->front) {
2338 : : GstElement *element =
2339 : : gst_element_make_from_uri (GST_URI_SRC, (yyvsp[(1) - (2)].s), NULL);
2340 : : if (!element) {
2341 : : SET_ERROR (graph->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
2342 : : _("no source element for URI \"%s\""), (yyvsp[(1) - (2)].s));
2343 : : } else {
2344 : : (yyval.c)->front->src = element;
2345 : : graph->links = g_slist_prepend (
2346 : : graph->links, (yyval.c)->front);
2347 : : (yyval.c)->front = NULL;
2348 : : (yyval.c)->elements = g_slist_prepend ((yyval.c)->elements, element);
2349 : : }
2350 : : } else {
2351 : : SET_ERROR (graph->error, GST_PARSE_ERROR_LINK,
2352 : : _("no element to link URI \"%s\" to"), (yyvsp[(1) - (2)].s));
2353 : : }
2354 : : g_free ((yyvsp[(1) - (2)].s));
2355 : : ;}
2356 : : break;
2357 : :
2358 : : case 30:
2359 : :
2360 : : /* Line 1455 of yacc.c */
2361 : : #line 831 "./grammar.y"
2362 : : { GstElement *element =
2363 : : gst_element_make_from_uri (GST_URI_SINK, (yyvsp[(2) - (2)].s), NULL);
2364 : : if (!element) {
2365 : : SET_ERROR (graph->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
2366 : : _("no sink element for URI \"%s\""), (yyvsp[(2) - (2)].s));
2367 : : gst_parse_link_free ((yyvsp[(1) - (2)].l));
2368 : : g_free ((yyvsp[(2) - (2)].s));
2369 : : YYERROR;
2370 : : } else if ((yyvsp[(1) - (2)].l)->sink_name || (yyvsp[(1) - (2)].l)->sink_pads) {
2371 : : gst_object_unref (element);
2372 : : SET_ERROR (graph->error, GST_PARSE_ERROR_LINK,
2373 : : _("could not link sink element for URI \"%s\""), (yyvsp[(2) - (2)].s));
2374 : : gst_parse_link_free ((yyvsp[(1) - (2)].l));
2375 : : g_free ((yyvsp[(2) - (2)].s));
2376 : : YYERROR;
2377 : : } else {
2378 : : (yyval.c) = gst_parse_chain_new ();
2379 : : (yyval.c)->first = (yyval.c)->last = element;
2380 : : (yyval.c)->front = (yyvsp[(1) - (2)].l);
2381 : : (yyval.c)->front->sink = element;
2382 : : (yyval.c)->elements = g_slist_prepend (NULL, element);
2383 : : }
2384 : : g_free ((yyvsp[(2) - (2)].s));
2385 : : ;}
2386 : : break;
2387 : :
2388 : : case 31:
2389 : :
2390 : : /* Line 1455 of yacc.c */
2391 : : #line 856 "./grammar.y"
2392 : : { SET_ERROR (graph->error, GST_PARSE_ERROR_EMPTY, _("empty pipeline not allowed"));
2393 : : (yyval.g) = graph;
2394 : : ;}
2395 : : break;
2396 : :
2397 : : case 32:
2398 : :
2399 : : /* Line 1455 of yacc.c */
2400 : : #line 859 "./grammar.y"
2401 : : { (yyval.g) = graph;
2402 : : if ((yyvsp[(1) - (1)].c)->front) {
2403 : : if (!(yyvsp[(1) - (1)].c)->front->src_name) {
2404 : : SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("link without source element"));
2405 : : gst_parse_free_link ((yyvsp[(1) - (1)].c)->front);
2406 : : } else {
2407 : : (yyval.g)->links = g_slist_prepend ((yyval.g)->links, (yyvsp[(1) - (1)].c)->front);
2408 : : }
2409 : : (yyvsp[(1) - (1)].c)->front = NULL;
2410 : : }
2411 : : if ((yyvsp[(1) - (1)].c)->back) {
2412 : : if (!(yyvsp[(1) - (1)].c)->back->sink_name) {
2413 : : SET_ERROR (graph->error, GST_PARSE_ERROR_LINK, _("link without sink element"));
2414 : : gst_parse_free_link ((yyvsp[(1) - (1)].c)->back);
2415 : : } else {
2416 : : (yyval.g)->links = g_slist_prepend ((yyval.g)->links, (yyvsp[(1) - (1)].c)->back);
2417 : : }
2418 : : (yyvsp[(1) - (1)].c)->back = NULL;
2419 : : }
2420 : : (yyval.g)->chain = (yyvsp[(1) - (1)].c);
2421 : : ;}
2422 : : break;
2423 : :
2424 : :
2425 : 0 :
2426 : : /* Line 1455 of yacc.c */
2427 [ - + ][ # # ]: 1040 : #line 2425 "grammar.tab.c"
[ # # ]
2428 : : default: break;
2429 : 1040 : }
2430 : 1040 : YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2431 [ - + ]: 1040 :
2432 : : YYPOPSTACK (yylen);
2433 : 1040 : yylen = 0;
2434 : : YY_STACK_PRINT (yyss, yyssp);
2435 : :
2436 : : *++yyvsp = yyval;
2437 : :
2438 : : /* Now `shift' the result of the reduction. Determine what state
2439 : 1040 : that goes to, based on the state we popped back to and the rule
2440 : : number reduced by. */
2441 : 1040 :
2442 [ + + ][ + - ]: 1040 : yyn = yyr1[yyn];
[ + + ]
2443 : 358 :
2444 : : yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2445 : 682 : if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2446 : : yystate = yytable[yystate];
2447 : 1040 : else
2448 : : yystate = yydefgoto[yyn - YYNTOKENS];
2449 : :
2450 : : goto yynewstate;
2451 : :
2452 : :
2453 : : /*------------------------------------.
2454 : : | yyerrlab -- here on detecting error |
2455 [ + + ]: 2 : `------------------------------------*/
2456 : : yyerrlab:
2457 : 1 : /* If not already recovering from an error, report this error. */
2458 : : if (!yyerrstatus)
2459 : : {
2460 : : ++yynerrs;
2461 : : #if ! YYERROR_VERBOSE
2462 : 1 : yyerror (scanner, graph, YY_("syntax error"));
2463 [ - + ][ # # ]: 1 : #else
2464 : : {
2465 : 0 : YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2466 [ # # ]: 0 : if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2467 : 0 : {
2468 [ # # ]: 0 : YYSIZE_T yyalloc = 2 * yysize;
2469 : 0 : if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2470 : 0 : yyalloc = YYSTACK_ALLOC_MAXIMUM;
2471 [ # # ]: 0 : if (yymsg != yymsgbuf)
2472 : 0 : YYSTACK_FREE (yymsg);
2473 : : yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2474 : : if (yymsg)
2475 : 0 : yymsg_alloc = yyalloc;
2476 : 0 : else
2477 : : {
2478 : : yymsg = yymsgbuf;
2479 : : yymsg_alloc = sizeof yymsgbuf;
2480 [ + - ][ + - ]: 1 : }
2481 : : }
2482 : 1 :
2483 : 1 : if (0 < yysize && yysize <= yymsg_alloc)
2484 : : {
2485 : : (void) yysyntax_error (yymsg, yystate, yychar);
2486 : : yyerror (scanner, graph, yymsg);
2487 : 0 : }
2488 [ # # ]: 0 : else
2489 : 0 : {
2490 : : yyerror (scanner, graph, YY_("syntax error"));
2491 : : if (yysize != 0)
2492 : : goto yyexhaustedlab;
2493 : : }
2494 : : }
2495 : : #endif
2496 : : }
2497 [ + + ]: 2 :
2498 : :
2499 : :
2500 : : if (yyerrstatus == 3)
2501 : : {
2502 [ - + ]: 1 : /* If just tried and failed to reuse lookahead token after an
2503 : : error, discard it. */
2504 : :
2505 [ # # ]: 0 : if (yychar <= YYEOF)
2506 : 0 : {
2507 : : /* Return failure if at end of input. */
2508 : : if (yychar == YYEOF)
2509 : : YYABORT;
2510 : 1 : }
2511 : : else
2512 : 1 : {
2513 : : yydestruct ("Error: discarding",
2514 : : yytoken, &yylval, scanner, graph);
2515 : : yychar = YYEMPTY;
2516 : : }
2517 : : }
2518 : 2 :
2519 : : /* Else will try to reuse lookahead token after shifting the error
2520 : : token. */
2521 : : goto yyerrlab1;
2522 : :
2523 : :
2524 : : /*---------------------------------------------------.
2525 : : | yyerrorlab -- error raised explicitly by YYERROR. |
2526 : : `---------------------------------------------------*/
2527 : : yyerrorlab:
2528 : :
2529 : : /* Pacify compilers like GCC when the user code never invokes
2530 : : YYERROR and the label yyerrorlab therefore never appears in user
2531 : : code. */
2532 : : if (/*CONSTCOND*/ 0)
2533 : : goto yyerrorlab;
2534 : 5 :
2535 : 5 : /* Do not reclaim the symbols of the rule which action triggered
2536 [ - + ]: 5 : this YYERROR. */
2537 : 5 : YYPOPSTACK (yylen);
2538 : 5 : yylen = 0;
2539 : : YY_STACK_PRINT (yyss, yyssp);
2540 : : yystate = *yyssp;
2541 : : goto yyerrlab1;
2542 : :
2543 : :
2544 : : /*-------------------------------------------------------------.
2545 : 7 : | yyerrlab1 -- common code for both syntax error and YYERROR. |
2546 : : `-------------------------------------------------------------*/
2547 : : yyerrlab1:
2548 : : yyerrstatus = 3; /* Each real token shifted decrements this. */
2549 : 8 :
2550 [ + - ]: 8 : for (;;)
2551 : : {
2552 : 8 : yyn = yypact[yystate];
2553 [ + - ][ + - ]: 8 : if (yyn != YYPACT_NINF)
[ + + ]
2554 : : {
2555 : 5 : yyn += YYTERROR;
2556 [ + - ]: 5 : if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2557 : 5 : {
2558 : : yyn = yytable[yyn];
2559 : : if (0 < yyn)
2560 : : break;
2561 : : }
2562 [ + + ]: 3 : }
2563 : 2 :
2564 : : /* Pop the current state because it cannot handle the error token. */
2565 : : if (yyssp == yyss)
2566 : 1 : YYABORT;
2567 : 1 :
2568 : 1 :
2569 : 1 : yydestruct ("Error: popping",
2570 [ - + ]: 1 : yystos[yystate], yyvsp, scanner, graph);
2571 : 1 : YYPOPSTACK (1);
2572 : : yystate = *yyssp;
2573 : 5 : YY_STACK_PRINT (yyss, yyssp);
2574 : : }
2575 : :
2576 : : *++yyvsp = yylval;
2577 [ - + ][ # # ]: 5 :
[ # # ]
2578 : :
2579 : 5 : /* Shift the error token. */
2580 : 5 : YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2581 : :
2582 : : yystate = yyn;
2583 : : goto yynewstate;
2584 : :
2585 : :
2586 : : /*-------------------------------------.
2587 : 59 : | yyacceptlab -- YYACCEPT comes here. |
2588 : 59 : `-------------------------------------*/
2589 : : yyacceptlab:
2590 : : yyresult = 0;
2591 : : goto yyreturn;
2592 : :
2593 : : /*-----------------------------------.
2594 : 2 : | yyabortlab -- YYABORT comes here. |
2595 : 2 : `-----------------------------------*/
2596 : : yyabortlab:
2597 : : yyresult = 1;
2598 : : goto yyreturn;
2599 : :
2600 : : #if !defined(yyoverflow) || YYERROR_VERBOSE
2601 : : /*-------------------------------------------------.
2602 : 0 : | yyexhaustedlab -- memory exhaustion comes here. |
2603 : 0 : `-------------------------------------------------*/
2604 : : yyexhaustedlab:
2605 : : yyerror (scanner, graph, YY_("memory exhausted"));
2606 : : yyresult = 2;
2607 : : /* Fall through. */
2608 [ - + ]: 61 : #endif
2609 : 0 :
2610 : : yyreturn:
2611 : : if (yychar != YYEMPTY)
2612 : : yydestruct ("Cleanup: discarding lookahead",
2613 : 61 : yytoken, &yylval, scanner, graph);
2614 [ - + ]: 61 : /* Do not reclaim the symbols of the rule which action triggered
2615 [ + + ]: 179 : this YYABORT or YYACCEPT. */
2616 : : YYPOPSTACK (yylen);
2617 : 118 : YY_STACK_PRINT (yyss, yyssp);
2618 : 118 : while (yyssp != yyss)
2619 : 118 : {
2620 : : yydestruct ("Cleanup: popping",
2621 : : yystos[*yyssp], yyvsp, scanner, graph);
2622 [ - + ]: 61 : YYPOPSTACK (1);
2623 : 0 : }
2624 : : #ifndef yyoverflow
2625 : : if (yyss != yyssa)
2626 [ - + ]: 61 : YYSTACK_FREE (yyss);
2627 : 0 : #endif
2628 : : #if YYERROR_VERBOSE
2629 : : if (yymsg != yymsgbuf)
2630 : 61 : YYSTACK_FREE (yymsg);
2631 : : #endif
2632 : : /* Make sure YYID is used. */
2633 : : return YYID (yyresult);
2634 : : }
2635 : :
2636 : :
2637 : :
2638 : : /* Line 1675 of yacc.c */
2639 : : #line 882 "./grammar.y"
2640 : :
2641 : :
2642 : :
2643 : : static int
2644 : : yyerror (void *scanner, graph_t *graph, const char *s)
2645 : : {
2646 : : /* FIXME: This should go into the GError somehow, but how? */
2647 : : GST_WARNING ("Error during parsing: %s", s);
2648 : : return -1;
2649 : : }
2650 : :
2651 : :
2652 : : GstElement *
2653 : : _gst_parse_launch (const gchar *str, GError **error, GstParseContext *ctx,
2654 : : GstParseFlags flags)
2655 : : {
2656 : : graph_t g;
2657 : : gchar *dstr;
2658 : : GSList *walk;
2659 : : GstBin *bin = NULL;
2660 : : GstElement *ret;
2661 : : yyscan_t scanner;
2662 : :
2663 : : g_return_val_if_fail (str != NULL, NULL);
2664 : : g_return_val_if_fail (error == NULL || *error == NULL, NULL);
2665 : :
2666 : : g.chain = NULL;
2667 : : g.links = NULL;
2668 : : g.error = error;
2669 : : g.ctx = ctx;
2670 : : g.flags = flags;
2671 : :
2672 : : #ifdef __GST_PARSE_TRACE
2673 : : GST_CAT_DEBUG (GST_CAT_PIPELINE, "TRACE: tracing enabled");
2674 : : __strings = __chains = __links = 0;
2675 : : #endif /* __GST_PARSE_TRACE */
2676 : :
2677 : : dstr = g_strdup (str);
2678 : : _gst_parse_yylex_init (&scanner);
2679 : : _gst_parse_yy_scan_string (dstr, scanner);
2680 : :
2681 : : #ifndef YYDEBUG
2682 : : yydebug = 1;
2683 : : #endif
2684 : :
2685 : : if (yyparse (scanner, &g) != 0) {
2686 : : SET_ERROR (error, GST_PARSE_ERROR_SYNTAX,
2687 : : "Unrecoverable syntax error while parsing pipeline %s", str);
2688 : :
2689 : : _gst_parse_yylex_destroy (scanner);
2690 : : g_free (dstr);
2691 : :
2692 : : goto error1;
2693 : : }
2694 : : _gst_parse_yylex_destroy (scanner);
2695 : : g_free (dstr);
2696 : :
2697 : : GST_CAT_DEBUG (GST_CAT_PIPELINE, "got %u elements and %u links",
2698 : : g.chain ? g_slist_length (g.chain->elements) : 0,
2699 : : g_slist_length (g.links));
2700 : :
2701 : : if (!g.chain) {
2702 : : ret = NULL;
2703 : : } else if (!g.chain->elements->next) {
2704 : : /* only one toplevel element */
2705 : : ret = (GstElement *) g.chain->elements->data;
2706 : : g_slist_free (g.chain->elements);
2707 : : if (GST_IS_BIN (ret))
2708 : : bin = GST_BIN (ret);
2709 : : gst_parse_chain_free (g.chain);
2710 : : } else {
2711 : : /* put all elements in our bin */
2712 : : bin = GST_BIN (gst_element_factory_make ("pipeline", NULL));
2713 : : g_assert (bin);
2714 : :
2715 : : for (walk = g.chain->elements; walk; walk = walk->next) {
2716 : : if (walk->data != NULL)
2717 : : gst_bin_add (bin, GST_ELEMENT (walk->data));
2718 : : }
2719 : :
2720 : : g_slist_free (g.chain->elements);
2721 : : ret = GST_ELEMENT (bin);
2722 : : gst_parse_chain_free (g.chain);
2723 : : }
2724 : :
2725 : : /* remove links */
2726 : : for (walk = g.links; walk; walk = walk->next) {
2727 : : link_t *l = (link_t *) walk->data;
2728 : : if (!l->src) {
2729 : : if (l->src_name) {
2730 : : if (bin) {
2731 : : l->src = gst_bin_get_by_name_recurse_up (bin, l->src_name);
2732 : : if (l->src)
2733 : : gst_object_unref (l->src);
2734 : : } else {
2735 : : l->src = strcmp (GST_ELEMENT_NAME (ret), l->src_name) == 0 ? ret : NULL;
2736 : : }
2737 : : }
2738 : : if (!l->src) {
2739 : : if (l->src_name) {
2740 : : SET_ERROR (error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
2741 : : "No element named \"%s\" - omitting link", l->src_name);
2742 : : } else {
2743 : : /* probably a missing element which we've handled already */
2744 : : }
2745 : : gst_parse_free_link (l);
2746 : : continue;
2747 : : }
2748 : : }
2749 : : if (!l->sink) {
2750 : : if (l->sink_name) {
2751 : : if (bin) {
2752 : : l->sink = gst_bin_get_by_name_recurse_up (bin, l->sink_name);
2753 : : if (l->sink)
2754 : : gst_object_unref (l->sink);
2755 : : } else {
2756 : : l->sink = strcmp (GST_ELEMENT_NAME (ret), l->sink_name) == 0 ? ret : NULL;
2757 : : }
2758 : : }
2759 : : if (!l->sink) {
2760 : : if (l->sink_name) {
2761 : : SET_ERROR (error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
2762 : : "No element named \"%s\" - omitting link", l->sink_name);
2763 : : } else {
2764 : : /* probably a missing element which we've handled already */
2765 : : }
2766 : : gst_parse_free_link (l);
2767 : : continue;
2768 : : }
2769 : : }
2770 : : gst_parse_perform_link (l, &g);
2771 : : }
2772 : : g_slist_free (g.links);
2773 : :
2774 : : out:
2775 : : #ifdef __GST_PARSE_TRACE
2776 : : GST_CAT_DEBUG (GST_CAT_PIPELINE,
2777 : : "TRACE: %u strings, %u chains and %u links left", __strings, __chains,
2778 : : __links);
2779 : : if (__strings || __chains || __links) {
2780 : : g_warning ("TRACE: %u strings, %u chains and %u links left", __strings,
2781 : : __chains, __links);
2782 : : }
2783 : : #endif /* __GST_PARSE_TRACE */
2784 : :
2785 : : return ret;
2786 : :
2787 : : error1:
2788 : : if (g.chain) {
2789 : : g_slist_foreach (g.chain->elements, (GFunc)gst_object_unref, NULL);
2790 : : g_slist_free (g.chain->elements);
2791 : : gst_parse_chain_free (g.chain);
2792 : : }
2793 : :
2794 : : g_slist_foreach (g.links, (GFunc)gst_parse_free_link, NULL);
2795 : : g_slist_free (g.links);
2796 : :
2797 : : if (error)
2798 : : g_assert (*error);
2799 : : ret = NULL;
2800 : :
2801 : : goto out;
2802 : : }
2803 : :
|