2 #include <glib-object.h>
8 #include "../gst_private.h"
9 #include "../gst-i18n-lib.h"
11 #include "../gstconfig.h"
12 #include "../gstparse.h"
13 #include "../gstinfo.h"
14 #include "../gsterror.h"
15 #include "../gsturi.h"
16 #include "../gstutils.h"
17 #include "../gstvalue.h"
18 #include "../gstchildproxy.h"
21 /* All error messages in this file are user-visible and need to be translated.
22 * Don't start the message with a capital, and don't end them with a period,
23 * as they will be presented inside a sentence/error.
26 #define YYERROR_VERBOSE 1
27 #define YYLEX_PARAM scanner
29 typedef void* yyscan_t;
31 int _gst_parse_yylex (void * yylval_param , yyscan_t yyscanner);
32 int _gst_parse_yylex_init (yyscan_t scanner);
33 int _gst_parse_yylex_destroy (yyscan_t scanner);
34 struct yy_buffer_state * _gst_parse_yy_scan_string (char* , yyscan_t);
35 void _gst_parse_yypush_buffer_state (void * new_buffer ,yyscan_t yyscanner );
36 void _gst_parse_yypop_buffer_state (yyscan_t yyscanner );
39 #ifdef __GST_PARSE_TRACE
40 static guint __strings;
42 static guint __chains;
44 __gst_parse_strdup (gchar *org)
49 /* g_print ("ALLOCATED STR (%3u): %p %s\n", __strings, ret, ret); */
53 __gst_parse_strfree (gchar *str)
56 /* g_print ("FREEING STR (%3u): %p %s\n", __strings - 1, str, str); */
58 g_return_if_fail (__strings > 0);
62 link_t *__gst_parse_link_new ()
66 ret = g_new0 (link_t, 1);
67 /* g_print ("ALLOCATED LINK (%3u): %p\n", __links, ret); */
71 __gst_parse_link_free (link_t *data)
74 /* g_print ("FREEING LINK (%3u): %p\n", __links - 1, data); */
76 g_return_if_fail (__links > 0);
81 __gst_parse_chain_new ()
85 ret = g_new0 (chain_t, 1);
86 /* g_print ("ALLOCATED CHAIN (%3u): %p\n", __chains, ret); */
90 __gst_parse_chain_free (chain_t *data)
92 /* g_print ("FREEING CHAIN (%3u): %p\n", __chains - 1, data); */
94 g_return_if_fail (__chains > 0);
98 #endif /* __GST_PARSE_TRACE */
106 /* FIXME: need to connect to "disposed" signal to clean up,
107 * but there is no such signal */
110 /*** define SET_ERROR and ERROR macros/functions */
112 #ifdef G_HAVE_ISO_VARARGS
114 # define SET_ERROR(error, type, ...) \
116 GST_CAT_ERROR (GST_CAT_PIPELINE, __VA_ARGS__); \
117 if ((error) && !*(error)) { \
118 g_set_error ((error), GST_PARSE_ERROR, (type), __VA_ARGS__); \
122 # define ERROR(type, ...) \
123 SET_ERROR (((graph_t *) graph)->error, (type), __VA_ARGS__ )
125 #elif defined(G_HAVE_GNUC_VARARGS)
127 # define SET_ERROR(error, type, args...) \
129 GST_CAT_ERROR (GST_CAT_PIPELINE, args ); \
130 if ((error) && !*(error)) { \
131 g_set_error ((error), GST_PARSE_ERROR, (type), args ); \
135 # define ERROR(type, args...) \
136 SET_ERROR (((graph_t *) graph)->error,(type) , args )
141 SET_ERROR (GError **error, gint type, const char *format, ...)
145 g_warning ("error while parsing");
150 va_start (varargs, format);
151 string = g_strdup_vprintf (format, varargs);
154 g_set_error (error, GST_PARSE_ERROR, type, string);
161 #endif /* G_HAVE_ISO_VARARGS */
163 /*** define YYPRINTF macro/function if we're debugging */
165 /* bison 1.35 calls this macro with side effects, we need to make sure the
166 side effects work - crappy bison */
168 #ifndef GST_DISABLE_GST_DEBUG
171 # ifdef G_HAVE_ISO_VARARGS
173 /* # define YYFPRINTF(a, ...) GST_CAT_DEBUG (GST_CAT_PIPELINE, __VA_ARGS__) */
174 # define YYFPRINTF(a, ...) \
176 gchar *temp = g_strdup_printf (__VA_ARGS__); \
177 GST_CAT_LOG (GST_CAT_PIPELINE, temp); \
181 # elif defined(G_HAVE_GNUC_VARARGS)
183 # define YYFPRINTF(a, args...) \
185 gchar *temp = g_strdup_printf ( args ); \
186 GST_CAT_LOG (GST_CAT_PIPELINE, temp); \
193 YYPRINTF(const char *format, ...)
198 va_start (varargs, format);
199 temp = g_strdup_vprintf (format, varargs);
200 GST_CAT_LOG (GST_CAT_PIPELINE, "%s", temp);
205 # endif /* G_HAVE_ISO_VARARGS */
207 #endif /* GST_DISABLE_GST_DEBUG */
209 #define GST_BIN_MAKE(res, type, chainval, assign, free_string) \
211 chain_t *chain = chainval; \
213 GstBin *bin = (GstBin *) gst_element_factory_make (type, NULL); \
215 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_EMPTY_BIN, \
216 _("specified empty bin \"%s\", not allowed"), type); \
217 g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
218 g_slist_free (assign); \
219 gst_object_unref (bin); \
221 gst_parse_strfree (type); /* Need to clean up the string */ \
224 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, \
225 _("no bin \"%s\", skipping"), type); \
226 g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
227 g_slist_free (assign); \
230 for (walk = chain->elements; walk; walk = walk->next ) \
231 gst_bin_add (bin, GST_ELEMENT (walk->data)); \
232 g_slist_free (chain->elements); \
233 chain->elements = g_slist_prepend (NULL, bin); \
235 /* set the properties now */ \
236 for (walk = assign; walk; walk = walk->next) \
237 gst_parse_element_set ((gchar *) walk->data, GST_ELEMENT (bin), graph); \
238 g_slist_free (assign); \
242 #define MAKE_LINK(link, _src, _src_name, _src_pads, _sink, _sink_name, _sink_pads) \
244 link = gst_parse_link_new (); \
246 link->sink = _sink; \
247 link->src_name = _src_name; \
248 link->sink_name = _sink_name; \
249 link->src_pads = _src_pads; \
250 link->sink_pads = _sink_pads; \
254 #define MAKE_REF(link, _src, _pads) \
256 gchar *padname = _src; \
257 GSList *pads = _pads; \
259 while (*padname != '.') padname++; \
262 if (*padname != '\0') \
263 pads = g_slist_prepend (pads, gst_parse_strdup (padname)); \
265 MAKE_LINK (link, NULL, _src, pads, NULL, NULL, NULL); \
269 gst_parse_element_set (gchar *value, GstElement *element, graph_t *graph)
277 /* parse the string, so the property name is null-terminated an pos points
278 to the beginning of the value */
279 while (!g_ascii_isspace (*pos) && (*pos != '=')) pos++;
285 while (g_ascii_isspace (*pos)) pos++;
288 while (g_ascii_isspace (*pos)) pos++;
291 pos[strlen (pos) - 1] = '\0';
293 gst_parse_unescape (pos);
295 if (gst_child_proxy_lookup (GST_OBJECT (element), value, &target, &pspec)) {
296 value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
297 GST_CAT_LOG (GST_CAT_PIPELINE, "parsing property %s as a %s", pspec->name,
298 g_type_name (value_type));
299 g_value_init (&v, value_type);
300 if (!gst_value_deserialize (&v, pos))
302 g_object_set_property (G_OBJECT (target), pspec->name, &v);
303 gst_object_unref (target);
305 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_PROPERTY, \
306 _("no property \"%s\" in element \"%s\""), value, \
307 GST_ELEMENT_NAME (element));
311 gst_parse_strfree (value);
317 gst_object_unref (target);
318 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
319 _("could not set property \"%s\" in element \"%s\" to \"%s\""),
320 value, GST_ELEMENT_NAME (element), pos);
324 gst_parse_free_link (link_t *link)
326 gst_parse_strfree (link->src_name);
327 gst_parse_strfree (link->sink_name);
328 g_slist_foreach (link->src_pads, (GFunc) gst_parse_strfree, NULL);
329 g_slist_foreach (link->sink_pads, (GFunc) gst_parse_strfree, NULL);
330 g_slist_free (link->src_pads);
331 g_slist_free (link->sink_pads);
332 if (link->caps) gst_caps_unref (link->caps);
333 gst_parse_link_free (link);
337 gst_parse_found_pad (GstElement *src, GstPad *pad, gpointer data)
339 DelayedLink *link = (DelayedLink *) data;
341 GST_CAT_INFO (GST_CAT_PIPELINE, "trying delayed linking %s:%s to %s:%s",
342 GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (link->src_pad),
343 GST_STR_NULL (GST_ELEMENT_NAME (link->sink)), GST_STR_NULL (link->sink_pad));
345 if (gst_element_link_pads_filtered (src, link->src_pad, link->sink,
346 link->sink_pad, link->caps)) {
347 /* do this here, we don't want to get any problems later on when
348 * unlocking states */
349 GST_CAT_DEBUG (GST_CAT_PIPELINE, "delayed linking %s:%s to %s:%s worked",
350 GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (link->src_pad),
351 GST_STR_NULL (GST_ELEMENT_NAME (link->sink)), GST_STR_NULL (link->sink_pad));
352 g_signal_handler_disconnect (src, link->signal_id);
353 g_free (link->src_pad);
354 g_free (link->sink_pad);
355 if (link->caps) gst_caps_unref (link->caps);
359 /* both padnames and the caps may be NULL */
361 gst_parse_perform_delayed_link (GstElement *src, const gchar *src_pad,
362 GstElement *sink, const gchar *sink_pad,
365 GList *templs = gst_element_class_get_pad_template_list (
366 GST_ELEMENT_GET_CLASS (src));
368 for (; templs; templs = templs->next) {
369 GstPadTemplate *templ = (GstPadTemplate *) templs->data;
370 if ((GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC) &&
371 (GST_PAD_TEMPLATE_PRESENCE(templ) == GST_PAD_SOMETIMES))
373 DelayedLink *data = g_new (DelayedLink, 1);
375 /* TODO: maybe we should check if src_pad matches this template's names */
377 GST_CAT_DEBUG (GST_CAT_PIPELINE, "trying delayed link %s:%s to %s:%s",
378 GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (src_pad),
379 GST_STR_NULL (GST_ELEMENT_NAME (sink)), GST_STR_NULL (sink_pad));
381 data->src_pad = g_strdup (src_pad);
383 data->sink_pad = g_strdup (sink_pad);
385 data->caps = gst_caps_copy (caps);
389 data->signal_id = g_signal_connect (G_OBJECT (src), "pad-added",
390 G_CALLBACK (gst_parse_found_pad), data);
397 * performs a link and frees the struct. src and sink elements must be given
398 * return values 0 - link performed
403 gst_parse_perform_link (link_t *link, graph_t *graph)
405 GstElement *src = link->src;
406 GstElement *sink = link->sink;
407 GSList *srcs = link->src_pads;
408 GSList *sinks = link->sink_pads;
409 g_assert (GST_IS_ELEMENT (src));
410 g_assert (GST_IS_ELEMENT (sink));
412 GST_CAT_INFO (GST_CAT_PIPELINE,
413 "linking %s:%s to %s:%s (%u/%u) with caps \"%" GST_PTR_FORMAT "\"",
414 GST_ELEMENT_NAME (src), link->src_name ? link->src_name : "(any)",
415 GST_ELEMENT_NAME (sink), link->sink_name ? link->sink_name : "(any)",
416 g_slist_length (srcs), g_slist_length (sinks), link->caps);
418 if (!srcs || !sinks) {
419 if (gst_element_link_pads_filtered (src,
420 srcs ? (const gchar *) srcs->data : NULL, sink,
421 sinks ? (const gchar *) sinks->data : NULL, link->caps)) {
424 if (gst_parse_perform_delayed_link (src,
425 srcs ? (const gchar *) srcs->data : NULL,
426 sink, sinks ? (const gchar *) sinks->data : NULL, link->caps)) {
433 if (g_slist_length (link->src_pads) != g_slist_length (link->src_pads)) {
436 while (srcs && sinks) {
437 const gchar *src_pad = (const gchar *) srcs->data;
438 const gchar *sink_pad = (const gchar *) sinks->data;
439 srcs = g_slist_next (srcs);
440 sinks = g_slist_next (sinks);
441 if (gst_element_link_pads_filtered (src, src_pad, sink, sink_pad,
445 if (gst_parse_perform_delayed_link (src, src_pad,
456 gst_parse_free_link (link);
460 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK,
461 _("could not link %s to %s"), GST_ELEMENT_NAME (src),
462 GST_ELEMENT_NAME (sink));
463 gst_parse_free_link (link);
468 static int yyerror (void *scanner, graph_t *graph, const char *s);
481 %token <s> IDENTIFIER
482 %left <s> REF PADREF BINREF
483 %token <s> ASSIGNMENT
489 %type <l> linkpart link
492 %type <p> padlist pads assignments
499 %parse-param { void *scanner }
500 %parse-param { graph_t *graph }
506 element: IDENTIFIER { $$ = gst_element_factory_make ($1, NULL);
508 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, _("no element \"%s\""), $1);
509 gst_parse_strfree ($1);
512 gst_parse_strfree ($1);
514 | element ASSIGNMENT { gst_parse_element_set ($2, $1, graph);
518 assignments: /* NOP */ { $$ = NULL; }
519 | assignments ASSIGNMENT { $$ = g_slist_prepend ($1, $2); }
521 bin: '(' assignments chain ')' { GST_BIN_MAKE ($$, "bin", $3, $2, FALSE); }
522 | BINREF assignments chain ')' { GST_BIN_MAKE ($$, $1, $3, $2, TRUE);
523 gst_parse_strfree ($1);
525 | BINREF assignments ')' { GST_BIN_MAKE ($$, $1, NULL, $2, TRUE);
526 gst_parse_strfree ($1);
528 | BINREF assignments error ')' { GST_BIN_MAKE ($$, $1, NULL, $2, TRUE);
529 gst_parse_strfree ($1);
533 pads: PADREF { $$ = g_slist_prepend (NULL, $1); }
534 | PADREF padlist { $$ = $2;
535 $$ = g_slist_prepend ($$, $1);
538 padlist: ',' IDENTIFIER { $$ = g_slist_prepend (NULL, $2); }
539 | ',' IDENTIFIER padlist { $$ = g_slist_prepend ($3, $2); }
542 reference: REF { MAKE_REF ($$, $1, NULL); }
543 | REF padlist { MAKE_REF ($$, $1, $2); }
546 linkpart: reference { $$ = $1; }
547 | pads { MAKE_REF ($$, NULL, $1); }
548 | /* NOP */ { MAKE_REF ($$, NULL, NULL); }
551 link: linkpart LINK linkpart { $$ = $1;
553 $$->caps = gst_caps_from_string ($2);
554 if ($$->caps == NULL)
555 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("could not parse caps \"%s\""), $2);
556 gst_parse_strfree ($2);
558 $$->sink_name = $3->src_name;
559 $$->sink_pads = $3->src_pads;
560 gst_parse_link_free ($3);
564 linklist: link { $$ = g_slist_prepend (NULL, $1); }
565 | link linklist { $$ = g_slist_prepend ($2, $1); }
566 | linklist error { $$ = $1; }
569 chain: element { $$ = gst_parse_chain_new ();
570 $$->first = $$->last = $1;
571 $$->front = $$->back = NULL;
572 $$->elements = g_slist_prepend (NULL, $1);
575 | chain chain { if ($1->back && $2->front) {
576 if (!$1->back->sink_name) {
577 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without source element"));
578 gst_parse_free_link ($1->back);
580 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $1->back);
582 if (!$2->front->src_name) {
583 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without sink element"));
584 gst_parse_free_link ($2->front);
586 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $2->front);
589 } else if ($1->back) {
590 if (!$1->back->sink_name) {
591 $1->back->sink = $2->first;
593 } else if ($2->front) {
594 if (!$2->front->src_name) {
595 $2->front->src = $1->last;
597 $1->back = $2->front;
601 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $1->back);
605 $1->elements = g_slist_concat ($1->elements, $2->elements);
607 gst_parse_chain_free ($2);
610 | chain linklist { GSList *walk;
612 $2 = g_slist_prepend ($2, $1->back);
615 if (!((link_t *) $2->data)->src_name) {
616 ((link_t *) $2->data)->src = $1->last;
619 for (walk = $2; walk; walk = walk->next) {
620 link_t *link = (link_t *) walk->data;
621 if (!link->sink_name && walk->next) {
622 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without sink element"));
623 gst_parse_free_link (link);
624 } else if (!link->src_name && !link->src) {
625 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without source element"));
626 gst_parse_free_link (link);
629 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, link);
638 | chain error { $$ = $1; }
639 | link chain { if ($2->front) {
640 if (!$2->front->src_name) {
641 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without source element"));
642 gst_parse_free_link ($2->front);
644 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $2->front);
647 if (!$1->sink_name) {
648 $1->sink = $2->first;
653 | PARSE_URL chain { $$ = $2;
655 GstElement *element =
656 gst_element_make_from_uri (GST_URI_SRC, $1, NULL);
658 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
659 _("no source element for URI \"%s\""), $1);
661 $$->front->src = element;
662 ((graph_t *) graph)->links = g_slist_prepend (
663 ((graph_t *) graph)->links, $$->front);
665 $$->elements = g_slist_prepend ($$->elements, element);
668 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK,
669 _("no element to link URI \"%s\" to"), $1);
673 | link PARSE_URL { GstElement *element =
674 gst_element_make_from_uri (GST_URI_SINK, $2, NULL);
676 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
677 _("no sink element for URI \"%s\""), $2);
678 gst_parse_link_free ($1);
681 } else if ($1->sink_name || $1->sink_pads) {
682 gst_object_unref (element);
683 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK,
684 _("could not link sink element for URI \"%s\""), $2);
685 gst_parse_link_free ($1);
689 $$ = gst_parse_chain_new ();
690 $$->first = $$->last = element;
692 $$->front->sink = element;
693 $$->elements = g_slist_prepend (NULL, element);
698 graph: /* NOP */ { SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_EMPTY, _("empty pipeline not allowed"));
699 $$ = (graph_t *) graph;
701 | chain { $$ = (graph_t *) graph;
703 if (!$1->front->src_name) {
704 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without source element"));
705 gst_parse_free_link ($1->front);
707 $$->links = g_slist_prepend ($$->links, $1->front);
712 if (!$1->back->sink_name) {
713 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without sink element"));
714 gst_parse_free_link ($1->back);
716 $$->links = g_slist_prepend ($$->links, $1->back);
728 yyerror (void *scanner, graph_t *graph, const char *s)
730 /* FIXME: This should go into the GError somehow, but how? */
731 GST_WARNING ("Error during parsing: %s", s);
737 _gst_parse_launch (const gchar *str, GError **error)
746 g_return_val_if_fail (str != NULL, NULL);
752 #ifdef __GST_PARSE_TRACE
753 GST_CAT_DEBUG (GST_CAT_PIPELINE, "TRACE: tracing enabled");
754 __strings = __chains = __links = 0;
755 #endif /* __GST_PARSE_TRACE */
757 dstr = g_strdup (str);
758 _gst_parse_yylex_init (&scanner);
759 _gst_parse_yy_scan_string (dstr, scanner);
765 if (yyparse (scanner, &g) != 0) {
766 SET_ERROR (error, GST_PARSE_ERROR_SYNTAX,
767 "Unrecoverable syntax error while parsing pipeline %s", str);
769 _gst_parse_yylex_destroy (scanner);
774 _gst_parse_yylex_destroy (scanner);
777 GST_CAT_DEBUG (GST_CAT_PIPELINE, "got %u elements and %u links",
778 g.chain ? g_slist_length (g.chain->elements) : 0,
779 g_slist_length (g.links));
783 } else if (!(((chain_t *) g.chain)->elements->next)) {
784 /* only one toplevel element */
785 ret = (GstElement *) ((chain_t *) g.chain)->elements->data;
786 g_slist_free (((chain_t *) g.chain)->elements);
787 if (GST_IS_BIN (ret))
789 gst_parse_chain_free (g.chain);
791 /* put all elements in our bin */
792 bin = GST_BIN (gst_element_factory_make ("pipeline", NULL));
795 for (walk = g.chain->elements; walk; walk = walk->next) {
796 if (walk->data != NULL)
797 gst_bin_add (bin, GST_ELEMENT (walk->data));
800 g_slist_free (g.chain->elements);
801 ret = GST_ELEMENT (bin);
802 gst_parse_chain_free (g.chain);
806 for (walk = g.links; walk; walk = walk->next) {
807 link_t *l = (link_t *) walk->data;
811 l->src = gst_bin_get_by_name_recurse_up (bin, l->src_name);
813 gst_object_unref (l->src);
815 l->src = strcmp (GST_ELEMENT_NAME (ret), l->src_name) == 0 ? ret : NULL;
819 SET_ERROR (error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
820 "No element named \"%s\" - omitting link", l->src_name);
821 gst_parse_free_link (l);
828 l->sink = gst_bin_get_by_name_recurse_up (bin, l->sink_name);
830 gst_object_unref (l->sink);
832 l->sink = strcmp (GST_ELEMENT_NAME (ret), l->sink_name) == 0 ? ret : NULL;
836 SET_ERROR (error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
837 "No element named \"%s\" - omitting link", l->sink_name);
838 gst_parse_free_link (l);
842 gst_parse_perform_link (l, &g);
844 g_slist_free (g.links);
847 #ifdef __GST_PARSE_TRACE
848 GST_CAT_DEBUG (GST_CAT_PIPELINE,
849 "TRACE: %u strings, %u chains and %u links left", __strings, __chains,
851 if (__strings || __chains || __links) {
852 g_warning ("TRACE: %u strings, %u chains and %u links left", __strings,
855 #endif /* __GST_PARSE_TRACE */
861 g_slist_foreach (g.chain->elements, (GFunc)gst_object_unref, NULL);
862 g_slist_free (g.chain->elements);
863 gst_parse_chain_free (g.chain);
866 g_slist_foreach (g.links, (GFunc)gst_parse_free_link, NULL);
867 g_slist_free (g.links);