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