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 YYPARSE_PARAM graph
29 #ifdef __GST_PARSE_TRACE
30 static guint __strings;
32 static guint __chains;
34 __gst_parse_strdup (gchar *org)
39 /* g_print ("ALLOCATED STR (%3u): %p %s\n", __strings, ret, ret); */
43 __gst_parse_strfree (gchar *str)
46 /* g_print ("FREEING STR (%3u): %p %s\n", __strings - 1, str, str); */
48 g_return_if_fail (__strings > 0);
52 link_t *__gst_parse_link_new ()
56 ret = g_new0 (link_t, 1);
57 /* g_print ("ALLOCATED LINK (%3u): %p\n", __links, ret); */
61 __gst_parse_link_free (link_t *data)
64 /* g_print ("FREEING LINK (%3u): %p\n", __links - 1, data); */
66 g_return_if_fail (__links > 0);
71 __gst_parse_chain_new ()
75 ret = g_new0 (chain_t, 1);
76 /* g_print ("ALLOCATED CHAIN (%3u): %p\n", __chains, ret); */
80 __gst_parse_chain_free (chain_t *data)
82 /* g_print ("FREEING CHAIN (%3u): %p\n", __chains - 1, data); */
84 g_return_if_fail (__chains > 0);
88 #endif /* __GST_PARSE_TRACE */
96 /* FIXME: need to connect to "disposed" signal to clean up,
97 * but there is no such signal */
100 /*** define SET_ERROR and ERROR macros/functions */
102 #ifdef G_HAVE_ISO_VARARGS
104 # define SET_ERROR(error, type, ...) \
106 GST_CAT_ERROR (GST_CAT_PIPELINE, __VA_ARGS__); \
107 if ((error) && !*(error)) { \
108 g_set_error ((error), GST_PARSE_ERROR, (type), __VA_ARGS__); \
112 # define ERROR(type, ...) \
113 SET_ERROR (((graph_t *) graph)->error, (type), __VA_ARGS__ )
115 #elif defined(G_HAVE_GNUC_VARARGS)
117 # define SET_ERROR(error, type, args...) \
119 GST_CAT_ERROR (GST_CAT_PIPELINE, args ); \
120 if ((error) && !*(error)) { \
121 g_set_error ((error), GST_PARSE_ERROR, (type), args ); \
125 # define ERROR(type, args...) \
126 SET_ERROR (((graph_t *) graph)->error,(type) , args )
131 SET_ERROR (GError **error, gint type, const char *format, ...)
135 g_warning ("error while parsing");
140 va_start (varargs, format);
141 string = g_strdup_vprintf (format, varargs);
144 g_set_error (error, GST_PARSE_ERROR, type, string);
151 #endif /* G_HAVE_ISO_VARARGS */
153 /*** define YYPRINTF macro/function if we're debugging */
155 /* bison 1.35 calls this macro with side effects, we need to make sure the
156 side effects work - crappy bison */
158 #ifndef GST_DISABLE_GST_DEBUG
161 # ifdef G_HAVE_ISO_VARARGS
163 /* # define YYFPRINTF(a, ...) GST_CAT_DEBUG (GST_CAT_PIPELINE, __VA_ARGS__) */
164 # define YYFPRINTF(a, ...) \
166 gchar *temp = g_strdup_printf (__VA_ARGS__); \
167 GST_CAT_LOG (GST_CAT_PIPELINE, temp); \
171 # elif defined(G_HAVE_GNUC_VARARGS)
173 # define YYFPRINTF(a, args...) \
175 gchar *temp = g_strdup_printf ( args ); \
176 GST_CAT_LOG (GST_CAT_PIPELINE, temp); \
183 YYPRINTF(const char *format, ...)
188 va_start (varargs, format);
189 temp = g_strdup_vprintf (format, varargs);
190 GST_CAT_LOG (GST_CAT_PIPELINE, "%s", temp);
195 # endif /* G_HAVE_ISO_VARARGS */
197 #endif /* GST_DISABLE_GST_DEBUG */
199 #define GST_BIN_MAKE(res, type, chainval, assign, free_string) \
201 chain_t *chain = chainval; \
203 GstBin *bin = (GstBin *) gst_element_factory_make (type, NULL); \
205 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_EMPTY_BIN, \
206 _("specified empty bin \"%s\", not allowed"), type); \
207 g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
208 g_slist_free (assign); \
209 gst_object_unref (bin); \
211 gst_parse_strfree (type); /* Need to clean up the string */ \
214 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, \
215 _("no bin \"%s\", skipping"), type); \
216 g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
217 g_slist_free (assign); \
220 for (walk = chain->elements; walk; walk = walk->next ) \
221 gst_bin_add (bin, GST_ELEMENT (walk->data)); \
222 g_slist_free (chain->elements); \
223 chain->elements = g_slist_prepend (NULL, bin); \
225 /* set the properties now */ \
226 for (walk = assign; walk; walk = walk->next) \
227 gst_parse_element_set ((gchar *) walk->data, GST_ELEMENT (bin), graph); \
228 g_slist_free (assign); \
232 #define MAKE_LINK(link, _src, _src_name, _src_pads, _sink, _sink_name, _sink_pads) \
234 link = gst_parse_link_new (); \
236 link->sink = _sink; \
237 link->src_name = _src_name; \
238 link->sink_name = _sink_name; \
239 link->src_pads = _src_pads; \
240 link->sink_pads = _sink_pads; \
244 #define MAKE_REF(link, _src, _pads) \
246 gchar *padname = _src; \
247 GSList *pads = _pads; \
249 while (*padname != '.') padname++; \
252 if (*padname != '\0') \
253 pads = g_slist_prepend (pads, gst_parse_strdup (padname)); \
255 MAKE_LINK (link, NULL, _src, pads, NULL, NULL, NULL); \
259 gst_parse_element_set (gchar *value, GstElement *element, graph_t *graph)
267 /* parse the string, so the property name is null-terminated an pos points
268 to the beginning of the value */
269 while (!g_ascii_isspace (*pos) && (*pos != '=')) pos++;
275 while (g_ascii_isspace (*pos)) pos++;
278 while (g_ascii_isspace (*pos)) pos++;
281 pos[strlen (pos) - 1] = '\0';
283 gst_parse_unescape (pos);
285 if (gst_child_proxy_lookup (GST_OBJECT (element), value, &target, &pspec)) {
286 value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
287 GST_CAT_LOG (GST_CAT_PIPELINE, "parsing property %s as a %s", pspec->name,
288 g_type_name (value_type));
289 g_value_init (&v, value_type);
290 if (!gst_value_deserialize (&v, pos))
292 g_object_set_property (G_OBJECT (target), pspec->name, &v);
293 gst_object_unref (target);
295 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_PROPERTY, \
296 _("no property \"%s\" in element \"%s\""), value, \
297 GST_ELEMENT_NAME (element));
301 gst_parse_strfree (value);
307 gst_object_unref (target);
308 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
309 _("could not set property \"%s\" in element \"%s\" to \"%s\""),
310 value, GST_ELEMENT_NAME (element), pos);
314 gst_parse_free_link (link_t *link)
316 gst_parse_strfree (link->src_name);
317 gst_parse_strfree (link->sink_name);
318 g_slist_foreach (link->src_pads, (GFunc) gst_parse_strfree, NULL);
319 g_slist_foreach (link->sink_pads, (GFunc) gst_parse_strfree, NULL);
320 g_slist_free (link->src_pads);
321 g_slist_free (link->sink_pads);
322 if (link->caps) gst_caps_unref (link->caps);
323 gst_parse_link_free (link);
327 gst_parse_found_pad (GstElement *src, GstPad *pad, gpointer data)
329 DelayedLink *link = (DelayedLink *) data;
331 GST_CAT_INFO (GST_CAT_PIPELINE, "trying delayed linking %s:%s to %s:%s",
332 GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (link->src_pad),
333 GST_STR_NULL (GST_ELEMENT_NAME (link->sink)), GST_STR_NULL (link->sink_pad));
335 if (gst_element_link_pads_filtered (src, link->src_pad, link->sink,
336 link->sink_pad, link->caps)) {
337 /* do this here, we don't want to get any problems later on when
338 * unlocking states */
339 GST_CAT_DEBUG (GST_CAT_PIPELINE, "delayed linking %s:%s to %s:%s worked",
340 GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (link->src_pad),
341 GST_STR_NULL (GST_ELEMENT_NAME (link->sink)), GST_STR_NULL (link->sink_pad));
342 g_signal_handler_disconnect (src, link->signal_id);
343 g_free (link->src_pad);
344 g_free (link->sink_pad);
345 if (link->caps) gst_caps_unref (link->caps);
349 /* both padnames and the caps may be NULL */
351 gst_parse_perform_delayed_link (GstElement *src, const gchar *src_pad,
352 GstElement *sink, const gchar *sink_pad,
355 GList *templs = gst_element_class_get_pad_template_list (
356 GST_ELEMENT_GET_CLASS (src));
358 for (; templs; templs = templs->next) {
359 GstPadTemplate *templ = (GstPadTemplate *) templs->data;
360 if ((GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC) &&
361 (GST_PAD_TEMPLATE_PRESENCE(templ) == GST_PAD_SOMETIMES))
363 DelayedLink *data = g_new (DelayedLink, 1);
365 /* TODO: maybe we should check if src_pad matches this template's names */
367 GST_CAT_DEBUG (GST_CAT_PIPELINE, "trying delayed link %s:%s to %s:%s",
368 GST_STR_NULL (GST_ELEMENT_NAME (src)), GST_STR_NULL (src_pad),
369 GST_STR_NULL (GST_ELEMENT_NAME (sink)), GST_STR_NULL (sink_pad));
371 data->src_pad = g_strdup (src_pad);
373 data->sink_pad = g_strdup (sink_pad);
375 data->caps = gst_caps_copy (caps);
379 data->signal_id = g_signal_connect (G_OBJECT (src), "pad-added",
380 G_CALLBACK (gst_parse_found_pad), data);
387 * performs a link and frees the struct. src and sink elements must be given
388 * return values 0 - link performed
393 gst_parse_perform_link (link_t *link, graph_t *graph)
395 GstElement *src = link->src;
396 GstElement *sink = link->sink;
397 GSList *srcs = link->src_pads;
398 GSList *sinks = link->sink_pads;
399 g_assert (GST_IS_ELEMENT (src));
400 g_assert (GST_IS_ELEMENT (sink));
402 GST_CAT_INFO (GST_CAT_PIPELINE,
403 "linking %s:%s to %s:%s (%u/%u) with caps \"%" GST_PTR_FORMAT "\"",
404 GST_ELEMENT_NAME (src), link->src_name ? link->src_name : "(any)",
405 GST_ELEMENT_NAME (sink), link->sink_name ? link->sink_name : "(any)",
406 g_slist_length (srcs), g_slist_length (sinks), link->caps);
408 if (!srcs || !sinks) {
409 if (gst_element_link_pads_filtered (src,
410 srcs ? (const gchar *) srcs->data : NULL, sink,
411 sinks ? (const gchar *) sinks->data : NULL, link->caps)) {
414 if (gst_parse_perform_delayed_link (src,
415 srcs ? (const gchar *) srcs->data : NULL,
416 sink, sinks ? (const gchar *) sinks->data : NULL, link->caps)) {
423 if (g_slist_length (link->src_pads) != g_slist_length (link->src_pads)) {
426 while (srcs && sinks) {
427 const gchar *src_pad = (const gchar *) srcs->data;
428 const gchar *sink_pad = (const gchar *) sinks->data;
429 srcs = g_slist_next (srcs);
430 sinks = g_slist_next (sinks);
431 if (gst_element_link_pads_filtered (src, src_pad, sink, sink_pad,
435 if (gst_parse_perform_delayed_link (src, src_pad,
446 gst_parse_free_link (link);
450 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK,
451 _("could not link %s to %s"), GST_ELEMENT_NAME (src),
452 GST_ELEMENT_NAME (sink));
453 gst_parse_free_link (link);
458 static int yylex (void *lvalp);
459 static int yyerror (const char *s);
472 %token <s> IDENTIFIER
473 %left <s> REF PADREF BINREF
474 %token <s> ASSIGNMENT
480 %type <l> linkpart link
483 %type <p> padlist pads assignments
495 element: IDENTIFIER { $$ = gst_element_factory_make ($1, NULL);
497 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, _("no element \"%s\""), $1);
498 gst_parse_strfree ($1);
501 gst_parse_strfree ($1);
503 | element ASSIGNMENT { gst_parse_element_set ($2, $1, graph);
507 assignments: /* NOP */ { $$ = NULL; }
508 | assignments ASSIGNMENT { $$ = g_slist_prepend ($1, $2); }
510 bin: '(' assignments chain ')' { GST_BIN_MAKE ($$, "bin", $3, $2, FALSE); }
511 | BINREF assignments chain ')' { GST_BIN_MAKE ($$, $1, $3, $2, TRUE);
512 gst_parse_strfree ($1);
514 | BINREF assignments ')' { GST_BIN_MAKE ($$, $1, NULL, $2, TRUE);
515 gst_parse_strfree ($1);
517 | BINREF assignments error ')' { GST_BIN_MAKE ($$, $1, NULL, $2, TRUE);
518 gst_parse_strfree ($1);
522 pads: PADREF { $$ = g_slist_prepend (NULL, $1); }
523 | PADREF padlist { $$ = $2;
524 $$ = g_slist_prepend ($$, $1);
527 padlist: ',' IDENTIFIER { $$ = g_slist_prepend (NULL, $2); }
528 | ',' IDENTIFIER padlist { $$ = g_slist_prepend ($3, $2); }
531 reference: REF { MAKE_REF ($$, $1, NULL); }
532 | REF padlist { MAKE_REF ($$, $1, $2); }
535 linkpart: reference { $$ = $1; }
536 | pads { MAKE_REF ($$, NULL, $1); }
537 | /* NOP */ { MAKE_REF ($$, NULL, NULL); }
540 link: linkpart LINK linkpart { $$ = $1;
542 $$->caps = gst_caps_from_string ($2);
543 if ($$->caps == NULL)
544 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("could not parse caps \"%s\""), $2);
545 gst_parse_strfree ($2);
547 $$->sink_name = $3->src_name;
548 $$->sink_pads = $3->src_pads;
549 gst_parse_link_free ($3);
553 linklist: link { $$ = g_slist_prepend (NULL, $1); }
554 | link linklist { $$ = g_slist_prepend ($2, $1); }
555 | linklist error { $$ = $1; }
558 chain: element { $$ = gst_parse_chain_new ();
559 $$->first = $$->last = $1;
560 $$->front = $$->back = NULL;
561 $$->elements = g_slist_prepend (NULL, $1);
564 | chain chain { if ($1->back && $2->front) {
565 if (!$1->back->sink_name) {
566 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without source element"));
567 gst_parse_free_link ($1->back);
569 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $1->back);
571 if (!$2->front->src_name) {
572 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without sink element"));
573 gst_parse_free_link ($2->front);
575 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $2->front);
578 } else if ($1->back) {
579 if (!$1->back->sink_name) {
580 $1->back->sink = $2->first;
582 } else if ($2->front) {
583 if (!$2->front->src_name) {
584 $2->front->src = $1->last;
586 $1->back = $2->front;
590 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $1->back);
594 $1->elements = g_slist_concat ($1->elements, $2->elements);
596 gst_parse_chain_free ($2);
599 | chain linklist { GSList *walk;
601 $2 = g_slist_prepend ($2, $1->back);
604 if (!((link_t *) $2->data)->src_name) {
605 ((link_t *) $2->data)->src = $1->last;
608 for (walk = $2; walk; walk = walk->next) {
609 link_t *link = (link_t *) walk->data;
610 if (!link->sink_name && walk->next) {
611 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without sink element"));
612 gst_parse_free_link (link);
613 } else if (!link->src_name && !link->src) {
614 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without source element"));
615 gst_parse_free_link (link);
618 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, link);
627 | chain error { $$ = $1; }
628 | link chain { if ($2->front) {
629 if (!$2->front->src_name) {
630 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without source element"));
631 gst_parse_free_link ($2->front);
633 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $2->front);
636 if (!$1->sink_name) {
637 $1->sink = $2->first;
642 | PARSE_URL chain { $$ = $2;
644 GstElement *element =
645 gst_element_make_from_uri (GST_URI_SRC, $1, NULL);
647 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
648 _("no source element for URI \"%s\""), $1);
650 $$->front->src = element;
651 ((graph_t *) graph)->links = g_slist_prepend (
652 ((graph_t *) graph)->links, $$->front);
654 $$->elements = g_slist_prepend ($$->elements, element);
657 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK,
658 _("no element to link URI \"%s\" to"), $1);
662 | link PARSE_URL { GstElement *element =
663 gst_element_make_from_uri (GST_URI_SINK, $2, NULL);
665 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
666 _("no sink element for URI \"%s\""), $2);
667 gst_parse_link_free ($1);
670 } else if ($1->sink_name || $1->sink_pads) {
671 gst_object_unref (element);
672 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK,
673 _("could not link sink element for URI \"%s\""), $2);
674 gst_parse_link_free ($1);
678 $$ = gst_parse_chain_new ();
679 $$->first = $$->last = element;
681 $$->front->sink = element;
682 $$->elements = g_slist_prepend (NULL, element);
687 graph: /* NOP */ { SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_EMPTY, _("empty pipeline not allowed"));
688 $$ = (graph_t *) graph;
690 | chain { $$ = (graph_t *) graph;
692 if (!$1->front->src_name) {
693 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without source element"));
694 gst_parse_free_link ($1->front);
696 $$->links = g_slist_prepend ($$->links, $1->front);
701 if (!$1->back->sink_name) {
702 SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without sink element"));
703 gst_parse_free_link ($1->back);
705 $$->links = g_slist_prepend ($$->links, $1->back);
715 extern FILE *_gst_parse_yyin;
716 int _gst_parse_yylex (YYSTYPE *lvalp);
718 static int yylex (void *lvalp) {
719 return _gst_parse_yylex ((YYSTYPE*) lvalp);
723 yyerror (const char *s)
725 /* FIXME: This should go into the GError somehow, but how? */
726 GST_WARNING ("Error during parsing: %s", s);
730 struct yy_buffer_state * _gst_parse_yy_scan_string (char*);
731 void _gst_parse_yy_delete_buffer (struct yy_buffer_state *);
733 _gst_parse_launch (const gchar *str, GError **error)
740 struct yy_buffer_state *buf;
742 g_return_val_if_fail (str != NULL, NULL);
748 #ifdef __GST_PARSE_TRACE
749 GST_CAT_DEBUG (GST_CAT_PIPELINE, "TRACE: tracing enabled");
750 __strings = __chains = __links = 0;
751 #endif /* __GST_PARSE_TRACE */
753 dstr = g_strdup (str);
754 buf = _gst_parse_yy_scan_string (dstr);
760 if (yyparse (&g) != 0) {
761 SET_ERROR (error, GST_PARSE_ERROR_SYNTAX,
762 "Unrecoverable syntax error while parsing pipeline %s", str);
764 _gst_parse_yy_delete_buffer (buf);
770 _gst_parse_yy_delete_buffer (buf);
772 GST_CAT_DEBUG (GST_CAT_PIPELINE, "got %u elements and %u links",
773 g.chain ? g_slist_length (g.chain->elements) : 0,
774 g_slist_length (g.links));
778 } else if (!(((chain_t *) g.chain)->elements->next)) {
779 /* only one toplevel element */
780 ret = (GstElement *) ((chain_t *) g.chain)->elements->data;
781 g_slist_free (((chain_t *) g.chain)->elements);
782 if (GST_IS_BIN (ret))
784 gst_parse_chain_free (g.chain);
786 /* put all elements in our bin */
787 bin = GST_BIN (gst_element_factory_make ("pipeline", NULL));
790 for (walk = g.chain->elements; walk; walk = walk->next) {
791 if (walk->data != NULL)
792 gst_bin_add (bin, GST_ELEMENT (walk->data));
795 g_slist_free (g.chain->elements);
796 ret = GST_ELEMENT (bin);
797 gst_parse_chain_free (g.chain);
801 for (walk = g.links; walk; walk = walk->next) {
802 link_t *l = (link_t *) walk->data;
806 l->src = gst_bin_get_by_name_recurse_up (bin, l->src_name);
808 gst_object_unref (l->src);
810 l->src = strcmp (GST_ELEMENT_NAME (ret), l->src_name) == 0 ? ret : NULL;
814 SET_ERROR (error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
815 "No element named \"%s\" - omitting link", l->src_name);
816 gst_parse_free_link (l);
823 l->sink = gst_bin_get_by_name_recurse_up (bin, l->sink_name);
825 gst_object_unref (l->sink);
827 l->sink = strcmp (GST_ELEMENT_NAME (ret), l->sink_name) == 0 ? ret : NULL;
831 SET_ERROR (error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
832 "No element named \"%s\" - omitting link", l->sink_name);
833 gst_parse_free_link (l);
837 gst_parse_perform_link (l, &g);
839 g_slist_free (g.links);
842 #ifdef __GST_PARSE_TRACE
843 GST_CAT_DEBUG (GST_CAT_PIPELINE,
844 "TRACE: %u strings, %u chains and %u links left", __strings, __chains,
846 if (__strings || __chains || __links) {
847 g_warning ("TRACE: %u strings, %u chains and %u links left", __strings,
850 #endif /* __GST_PARSE_TRACE */
856 g_slist_foreach (g.chain->elements, (GFunc)gst_object_unref, NULL);
857 g_slist_free (g.chain->elements);
858 gst_parse_chain_free (g.chain);
861 g_slist_foreach (g.links, (GFunc)gst_parse_free_link, NULL);
862 g_slist_free (g.links);