2 #include <glib-object.h>
8 #include "../gst_private.h"
10 #include "../gstparse.h"
11 #include "../gstinfo.h"
14 #define YYERROR_VERBOSE 1
15 #define YYPARSE_PARAM graph
17 #ifdef __GST_PARSE_TRACE
18 static guint __strings;
20 static guint __chains;
22 __gst_parse_strdup (gchar *org)
27 /* g_print ("ALLOCATED STR (%3u): %p %s\n", __strings, ret, ret); */
31 __gst_parse_strfree (gchar *str)
34 /* g_print ("FREEING STR (%3u): %p %s\n", __strings - 1, str, str); */
36 g_return_if_fail (__strings > 0);
40 link_t *__gst_parse_link_new ()
44 ret = g_new0 (link_t, 1);
45 /* g_print ("ALLOCATED LINK (%3u): %p\n", __links, ret); */
49 __gst_parse_link_free (link_t *data)
52 /* g_print ("FREEING LINK (%3u): %p\n", __links - 1, data); */
54 g_return_if_fail (__links > 0);
59 __gst_parse_chain_new ()
63 ret = g_new0 (chain_t, 1);
64 /* g_print ("ALLOCATED CHAIN (%3u): %p\n", __chains, ret); */
68 __gst_parse_chain_free (chain_t *data)
71 /* g_print ("FREEING CHAIN (%3u): %p\n", __chains - 1, data); */
73 g_return_if_fail (__chains > 0);
78 #endif /* __GST_PARSE_TRACE */
86 /* FIXME: need to connect to "disposed" signal to clean up, but there is no such signal */
89 #ifdef G_HAVE_ISO_VARARGS
90 #define SET_ERROR(error, type, ...) G_STMT_START{ \
93 g_warning (__VA_ARGS__); \
95 g_set_error ((error), GST_PARSE_ERROR, (type), __VA_ARGS__); \
99 #define ERROR(type, ...) SET_ERROR (((graph_t *) graph)->error, (type), __VA_ARGS__ )
100 #ifdef GST_DEBUG_ENABLED
102 /* bison 1.35 calls this macro with side effects, we need to make sure the
103 side effects work - crappy bison
104 # define YYFPRINTF(a, ...) GST_CAT_DEBUG (GST_CAT_PIPELINE, __VA_ARGS__)
106 # define YYFPRINTF(a, ...) G_STMT_START{ \
107 gchar *temp = g_strdup_printf (__VA_ARGS__); \
108 GST_CAT_DEBUG (GST_CAT_PIPELINE, temp); \
113 #elif defined(G_HAVE_GNUC_VARARGS)
115 #define SET_ERROR(error, type, args...) G_STMT_START{ \
118 g_warning ( ## args ); \
120 g_set_error ((error), GST_PARSE_ERROR, (type), ## args ); \
124 #define ERROR(type, args...) SET_ERROR (((graph_t *) graph)->error, (type), ## args )
125 #ifdef GST_DEBUG_ENABLED
127 /* bison 1.35 calls this macro with side effects, we need to make sure the
128 side effects work - crappy bison
129 # define YYFPRINTF(a, args...) GST_CAT_DEBUG (GST_CAT_PIPELINE, ## args )
131 # define YYFPRINTF(a, args...) G_STMT_START{ \
132 gchar *temp = g_strdup_printf ( ## args ); \
133 GST_CAT_DEBUG (GST_CAT_PIPELINE, temp); \
140 #define SET_ERROR(error, type, ...) G_STMT_START{ \
143 g_warning ("error while parsing"); \
145 g_set_error ((error), GST_PARSE_ERROR, (type), "error while parsing"); \
149 #define ERROR(type, ...) SET_ERROR (((graph_t *) graph)->error, (type), "error while parsing")
150 #ifdef GST_DEBUG_ENABLED
154 #endif /* G_HAVE_ISO_VARARGS */
156 #define GST_BIN_MAKE(res, type, chainval, assign) G_STMT_START{ \
157 chain_t *chain = chainval; \
159 GstBin *bin = (GstBin *) gst_element_factory_make (type, NULL); \
161 ERROR (GST_PARSE_ERROR_EMPTY_BIN, "Specified empty bin \"%s\", not allowed", type); \
162 g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
163 g_slist_free (assign); \
166 ERROR (GST_PARSE_ERROR_NO_SUCH_ELEMENT, "No bin \"%s\", omitting...", type); \
167 g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
168 g_slist_free (assign); \
171 walk = chain->elements; \
173 gst_bin_add (bin, GST_ELEMENT (walk->data)); \
176 g_slist_free (chain->elements); \
177 chain->elements = g_slist_prepend (NULL, bin); \
179 /* set the properties now */ \
182 gst_parse_element_set ((gchar *) walk->data, GST_ELEMENT (bin), graph); \
183 walk = g_slist_next (walk); \
185 g_slist_free (assign); \
189 #define MAKE_LINK(link, _src, _src_name, _src_pads, _sink, _sink_name, _sink_pads) G_STMT_START{ \
190 link = gst_parse_link_new (); \
192 link->sink = _sink; \
193 link->src_name = _src_name; \
194 link->sink_name = _sink_name; \
195 link->src_pads = _src_pads; \
196 link->sink_pads = _sink_pads; \
200 #define MAKE_REF(link, _src, _pads) G_STMT_START{ \
201 gchar *padname = _src; \
202 GSList *pads = _pads; \
204 while (*padname != '.') padname++; \
207 if (*padname != '\0') \
208 pads = g_slist_prepend (pads, gst_parse_strdup (padname)); \
210 MAKE_LINK (link, NULL, _src, pads, NULL, NULL, NULL); \
213 static inline void gst_parse_unescape (gchar *str)
217 g_return_if_fail (str != NULL);
231 gst_parse_element_set (gchar *value, GstElement *element, graph_t *graph)
235 /* parse the string, so the property name is null-terminated an pos points
236 to the beginning of the value */
237 while (!g_ascii_isspace (*pos) && (*pos != '=')) pos++;
243 while (g_ascii_isspace (*pos)) pos++;
246 while (g_ascii_isspace (*pos)) pos++;
249 pos[strlen (pos) - 1] = '\0';
251 gst_parse_unescape (pos);
252 if ((pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (element), value))) {
255 g_value_init (&v, G_PARAM_SPEC_VALUE_TYPE(pspec));
256 switch (G_TYPE_FUNDAMENTAL (G_PARAM_SPEC_VALUE_TYPE (pspec))) {
258 g_value_set_string (&v, pos);
261 if (g_ascii_strcasecmp (pos, "true") && g_ascii_strcasecmp (pos, "yes") && g_ascii_strcasecmp (pos, "1")) {
262 g_value_set_boolean (&v, FALSE);
264 g_value_set_boolean (&v, TRUE);
269 gchar *endptr = NULL;
270 GEnumClass *klass = (GEnumClass *) g_type_class_peek (G_PARAM_SPEC_VALUE_TYPE (pspec));
271 if (klass == NULL) goto error;
272 if (!(en = g_enum_get_value_by_name (klass, pos))) {
273 if (!(en = g_enum_get_value_by_nick (klass, pos))) {
274 gint i = strtol (pos, &endptr, 0);
275 if (endptr && *endptr == '\0') {
276 en = g_enum_get_value (klass, i);
282 g_value_set_enum (&v, en->value);
290 g_value_init (&v2, G_TYPE_LONG);
291 l = strtol (pos, &endptr, 0);
292 if (*endptr != '\0') goto error_conversion;
293 g_value_set_long (&v2, l);
294 if (!g_value_transform (&v2, &v)) goto error_conversion;
299 case G_TYPE_UINT64: {
302 g_value_init (&v2, G_TYPE_ULONG);
303 ul = strtoul (pos, &endptr, 0);
304 if (*endptr != '\0') goto error_conversion;
305 g_value_set_ulong (&v2, ul);
306 if (!g_value_transform (&v2, &v)) goto error_conversion;
310 case G_TYPE_DOUBLE: {
313 g_value_init (&v2, G_TYPE_DOUBLE);
314 d = strtod (pos, &endptr);
315 if (*endptr != '\0') goto error_conversion;
316 g_value_set_double (&v2, d);
317 if (!g_value_transform (&v2, &v)) goto error_conversion;
322 g_warning ("property \"%s\" in element %s cannot be set", value, GST_ELEMENT_NAME (element));
325 g_object_set_property (G_OBJECT (element), value, &v);
327 ERROR (GST_PARSE_ERROR_NO_SUCH_PROPERTY, "No property \"%s\" in element \"%s\"", value, GST_ELEMENT_NAME (element));
331 gst_parse_strfree (value);
335 ERROR (GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
336 "Could not set property \"%s\" in element \"%s\" to \"%s\"",
337 value, GST_ELEMENT_NAME (element), pos);
340 ERROR (GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
341 "Could not convert \"%s\" so that it fits property \"%s\" in element \"%s\"",
342 pos, value, GST_ELEMENT_NAME (element));
346 gst_parse_free_link (link_t *link)
348 gst_parse_strfree (link->src_name);
349 gst_parse_strfree (link->sink_name);
350 g_slist_foreach (link->src_pads, (GFunc) gst_parse_strfree, NULL);
351 g_slist_foreach (link->sink_pads, (GFunc) gst_parse_strfree, NULL);
352 g_slist_free (link->src_pads);
353 g_slist_free (link->sink_pads);
354 gst_caps_unref (link->caps);
355 gst_parse_link_free (link);
358 gst_parse_element_lock (GstElement *element, gboolean lock)
361 GList *walk = (GList *) gst_element_get_pad_list (element);
362 gboolean unlocked_peer = FALSE;
364 if (gst_element_is_locked_state (element) == lock)
366 /* check if we have an unlocked peer */
368 pad = (GstPad *) GST_PAD_REALIZE (walk->data);
370 if (GST_PAD_IS_SINK (pad) && GST_PAD_PEER (pad) &&
371 !gst_element_is_locked_state (GST_PAD_PARENT (GST_PAD_PEER (pad)))) {
372 unlocked_peer = TRUE;
377 if (!(lock && unlocked_peer)) {
378 gst_element_set_locked_state (element, lock);
380 gst_element_sync_state_with_parent (element);
385 /* check if there are other pads to (un)lock */
386 walk = (GList *) gst_element_get_pad_list (element);
388 pad = (GstPad *) GST_PAD_REALIZE (walk->data);
390 if (GST_PAD_IS_SRC (pad) && GST_PAD_PEER (pad)) {
391 GstElement *next = GST_ELEMENT (GST_OBJECT_PARENT (GST_PAD_PEER (pad)));
392 if (gst_element_is_locked_state (next) != lock)
393 gst_parse_element_lock (next, lock);
398 gst_parse_found_pad (GstElement *src, GstPad *pad, gpointer data)
400 DelayedLink *link = (DelayedLink *) data;
402 GST_CAT_INFO (GST_CAT_PIPELINE, "trying delayed linking %s:%s to %s:%s",
403 GST_ELEMENT_NAME (src), link->src_pad,
404 GST_ELEMENT_NAME (link->sink), link->sink_pad);
406 if (gst_element_link_pads_filtered (src, link->src_pad, link->sink, link->sink_pad, link->caps)) {
407 /* do this here, we don't want to get any problems later on when unlocking states */
408 GST_CAT_DEBUG (GST_CAT_PIPELINE, "delayed linking %s:%s to %s:%s worked",
409 GST_ELEMENT_NAME (src), link->src_pad,
410 GST_ELEMENT_NAME (link->sink), link->sink_pad);
411 g_signal_handler_disconnect (src, link->signal_id);
412 g_free (link->src_pad);
413 g_free (link->sink_pad);
414 gst_caps_unref (link->caps);
415 if (!gst_element_is_locked_state (src))
416 gst_parse_element_lock (link->sink, FALSE);
420 /* both padnames and the caps may be NULL */
422 gst_parse_perform_delayed_link (GstElement *src, const gchar *src_pad,
423 GstElement *sink, const gchar *sink_pad, GstCaps *caps)
425 GList *templs = gst_element_get_pad_template_list (src);
428 GstPadTemplate *templ = (GstPadTemplate *) templs->data;
429 if ((GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC) && (GST_PAD_TEMPLATE_PRESENCE(templ) == GST_PAD_SOMETIMES))
431 DelayedLink *data = g_new (DelayedLink, 1);
433 /* TODO: maybe we should check if src_pad matches this template's names */
435 GST_CAT_DEBUG (GST_CAT_PIPELINE, "trying delayed link %s:%s to %s:%s",
436 GST_ELEMENT_NAME (src), src_pad, GST_ELEMENT_NAME (sink), sink_pad);
438 data->src_pad = g_strdup (src_pad);
440 data->sink_pad = g_strdup (sink_pad);
441 data->caps = gst_caps_ref (caps);
442 data->signal_id = g_signal_connect (G_OBJECT (src), "new_pad",
443 G_CALLBACK (gst_parse_found_pad), data);
446 templs = g_list_next (templs);
451 * performs a link and frees the struct. src and sink elements must be given
452 * return values 0 - link performed
457 gst_parse_perform_link (link_t *link, graph_t *graph)
459 GstElement *src = link->src;
460 GstElement *sink = link->sink;
461 GSList *srcs = link->src_pads;
462 GSList *sinks = link->sink_pads;
463 g_assert (GST_IS_ELEMENT (src));
464 g_assert (GST_IS_ELEMENT (sink));
466 GST_CAT_INFO (GST_CAT_PIPELINE, "linking %s(%s):%u to %s(%s):%u with caps \"%s\"",
467 GST_ELEMENT_NAME (src), link->src_name ? link->src_name : "---", g_slist_length (srcs),
468 GST_ELEMENT_NAME (sink), link->sink_name ? link->sink_name : "---", g_slist_length (sinks),
469 link->caps ? gst_caps_to_string (link->caps) : "-");
471 if (!srcs || !sinks) {
472 if (gst_element_link_pads_filtered (src, srcs ? (const gchar *) srcs->data : NULL,
473 sink, sinks ? (const gchar *) sinks->data : NULL,
475 gst_parse_element_lock (sink, gst_element_is_locked_state (src));
478 if (gst_parse_perform_delayed_link (src, srcs ? (const gchar *) srcs->data : NULL,
479 sink, sinks ? (const gchar *) sinks->data : NULL,
481 gst_parse_element_lock (sink, TRUE);
488 if (g_slist_length (link->src_pads) != g_slist_length (link->src_pads)) {
491 while (srcs && sinks) {
492 const gchar *src_pad = (const gchar *) srcs->data;
493 const gchar *sink_pad = (const gchar *) sinks->data;
494 srcs = g_slist_next (srcs);
495 sinks = g_slist_next (sinks);
496 if (gst_element_link_pads_filtered (src, src_pad, sink, sink_pad, link->caps)) {
497 gst_parse_element_lock (sink, gst_element_is_locked_state (src));
500 if (gst_parse_perform_delayed_link (src, src_pad,
503 gst_parse_element_lock (sink, TRUE);
512 gst_parse_free_link (link);
516 ERROR (GST_PARSE_ERROR_LINK, "could not link %s to %s", GST_ELEMENT_NAME (src), GST_ELEMENT_NAME (sink));
517 gst_parse_free_link (link);
522 static int yylex (void *lvalp);
523 static int yyerror (const char *s);
535 %token <s> IDENTIFIER
536 %left <s> REF PADREF BINREF
537 %token <s> ASSIGNMENT
543 %type <l> linkpart link
546 %type <p> padlist pads assignments
548 %left '{' '}' '(' ')'
558 element: IDENTIFIER { $$ = gst_element_factory_make ($1, NULL);
560 ERROR (GST_PARSE_ERROR_NO_SUCH_ELEMENT, "No element \"%s\"", $1);
561 gst_parse_strfree ($1);
565 | element ASSIGNMENT { gst_parse_element_set ($2, $1, graph);
570 assignments: /* NOP */ { $$ = NULL; }
571 | assignments ASSIGNMENT { $$ = g_slist_prepend ($1, $2); }
573 bin: '{' assignments chain '}' { GST_BIN_MAKE ($$, "thread", $3, $2); }
574 | '(' assignments chain ')' { GST_BIN_MAKE ($$, "bin", $3, $2); }
575 | BINREF assignments chain ')' { GST_BIN_MAKE ($$, $1, $3, $2);
576 gst_parse_strfree ($1);
578 | '{' assignments '}' { GST_BIN_MAKE ($$, "thread", NULL, $2); }
579 | '(' assignments '}' { GST_BIN_MAKE ($$, "thread", NULL, $2); }
580 | BINREF assignments ')' { GST_BIN_MAKE ($$, $1, NULL, $2);
581 gst_parse_strfree ($1);
583 | '{' assignments error '}' { GST_BIN_MAKE ($$, "thread", NULL, $2); }
584 | '(' assignments error '}' { GST_BIN_MAKE ($$, "thread", NULL, $2); }
585 | BINREF assignments error ')' { GST_BIN_MAKE ($$, $1, NULL, $2);
586 gst_parse_strfree ($1);
590 pads: PADREF { $$ = g_slist_prepend (NULL, $1); }
591 | PADREF padlist { $$ = $2;
592 $$ = g_slist_prepend ($$, $1);
595 padlist: ',' IDENTIFIER { $$ = g_slist_prepend (NULL, $2); }
596 | ',' IDENTIFIER padlist { $$ = g_slist_prepend ($3, $2); }
599 reference: REF { MAKE_REF ($$, $1, NULL); }
600 | REF padlist { MAKE_REF ($$, $1, $2); }
603 linkpart: reference { $$ = $1; }
604 | pads { MAKE_REF ($$, NULL, $1); }
605 | /* NOP */ { MAKE_REF ($$, NULL, NULL); }
608 link: linkpart LINK linkpart { $$ = $1;
610 $$->caps = gst_caps_from_string ($2);
612 ERROR (GST_PARSE_ERROR_LINK, "could not parse caps \"%s\"", $2);
613 gst_parse_strfree ($2);
614 gst_caps_ref($$->caps);
615 gst_caps_sink($$->caps);
617 $$->sink_name = $3->src_name;
618 $$->sink_pads = $3->src_pads;
619 gst_parse_link_free ($3);
623 linklist: link { $$ = g_slist_prepend (NULL, $1); }
624 | link linklist { $$ = g_slist_prepend ($2, $1); }
625 | linklist error { $$ = $1; }
628 chain: element { $$ = gst_parse_chain_new ();
629 $$->first = $$->last = $1;
630 $$->front = $$->back = NULL;
631 $$->elements = g_slist_prepend (NULL, $1);
634 | chain chain { if ($1->back && $2->front) {
635 if (!$1->back->sink_name) {
636 ERROR (GST_PARSE_ERROR_LINK, "link without source element");
637 gst_parse_free_link ($1->back);
639 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $1->back);
641 if (!$2->front->src_name) {
642 ERROR (GST_PARSE_ERROR_LINK, "link without sink element");
643 gst_parse_free_link ($2->front);
645 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $2->front);
648 } else if ($1->back) {
649 if (!$1->back->sink_name) {
650 $1->back->sink = $2->first;
652 } else if ($2->front) {
653 if (!$2->front->src_name) {
654 $2->front->src = $1->last;
656 $1->back = $2->front;
660 if (!$1->back->sink || !$1->back->src) {
661 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $1->back);
664 gst_parse_perform_link ($1->back, (graph_t *) graph);
669 $1->elements = g_slist_concat ($1->elements, $2->elements);
670 gst_parse_chain_free ($2);
673 | link chain { if ($2->front) {
674 if (!$2->front->src_name) {
675 ERROR (GST_PARSE_ERROR_LINK, "link without source element");
676 gst_parse_free_link ($2->front);
678 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $2->front);
681 if (!$1->sink_name) {
682 $1->sink = $2->first;
688 | chain linklist { GSList *walk;
690 $2 = g_slist_prepend ($2, $1->back);
693 if (!((link_t *) $2->data)->src_name) {
694 ((link_t *) $2->data)->src = $1->last;
699 link_t *link = (link_t *) walk->data;
701 if (!link->sink_name && walk) {
702 ERROR (GST_PARSE_ERROR_LINK, "link without sink element");
703 gst_parse_free_link (link);
704 } else if (!link->src_name && !link->src) {
705 ERROR (GST_PARSE_ERROR_LINK, "link without source element");
706 gst_parse_free_link (link);
709 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, link);
718 | chain error { $$ = $1; }
721 graph: /* NOP */ { ERROR (GST_PARSE_ERROR_EMPTY, "Empty pipeline not allowed");
722 $$ = (graph_t *) graph;
724 | chain { $$ = (graph_t *) graph;
726 if (!$1->front->src_name) {
727 ERROR (GST_PARSE_ERROR_LINK, "link without source element");
728 gst_parse_free_link ($1->front);
730 $$->links = g_slist_prepend ($$->links, $1->front);
735 if (!$1->back->sink_name) {
736 ERROR (GST_PARSE_ERROR_LINK, "link without sink element");
737 gst_parse_free_link ($1->back);
739 $$->links = g_slist_prepend ($$->links, $1->back);
749 extern FILE *_gst_parse_yyin;
750 int _gst_parse_yylex (YYSTYPE *lvalp);
752 static int yylex (void *lvalp) {
753 return _gst_parse_yylex ((YYSTYPE*) lvalp);
757 yyerror (const char *s)
759 /* FIXME: This should go into the GError somehow, but how? */
760 g_warning ("error: %s\n", s);
764 int _gst_parse_yy_scan_string (char*);
766 _gst_parse_launch (const gchar *str, GError **error)
774 g_return_val_if_fail (str != NULL, NULL);
780 #ifdef __GST_PARSE_TRACE
781 GST_CAT_DEBUG (GST_CAT_PIPELINE, "TRACE: tracing enabled");
782 __strings = __chains = __links = 0;
783 #endif /* __GST_PARSE_TRACE */
785 dstr = g_strdup (str);
786 _gst_parse_yy_scan_string (dstr);
788 #ifdef GST_DEBUG_ENABLED
792 if (yyparse (&g) != 0) {
793 SET_ERROR (error, GST_PARSE_ERROR_SYNTAX, "Unrecoverable syntax error while parsing pipeline");
799 GST_CAT_INFO (GST_CAT_PIPELINE, "got %u elements and %u links", g.chain ? g_slist_length (g.chain->elements) : 0, g_slist_length (g.links));
803 } else if (!(((chain_t *) g.chain)->elements->next)) {
804 /* only one toplevel element */
805 ret = (GstElement *) ((chain_t *) g.chain)->elements->data;
806 g_slist_free (((chain_t *) g.chain)->elements);
807 if (GST_IS_BIN (ret))
810 /* put all elements in our bin */
811 bin = GST_BIN (gst_element_factory_make ("pipeline", NULL));
813 walk = g.chain->elements;
815 gst_bin_add (bin, GST_ELEMENT (walk->data));
816 walk = g_slist_next (walk);
818 g_slist_free (g.chain->elements);
819 ret = GST_ELEMENT (bin);
821 gst_parse_chain_free (g.chain);
826 link_t *l = (link_t *) walk->data;
828 walk = g_slist_next (walk);
832 l->src = gst_bin_get_by_name_recurse_up (bin, l->src_name);
834 l->src = strcmp (GST_ELEMENT_NAME (ret), l->src_name) == 0 ? ret : NULL;
838 SET_ERROR (error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, "No element named \"%s\" - omitting link", l->src_name);
839 gst_parse_free_link (l);
846 l->sink = gst_bin_get_by_name_recurse_up (bin, l->sink_name);
848 l->sink = strcmp (GST_ELEMENT_NAME (ret), l->sink_name) == 0 ? ret : NULL;
852 SET_ERROR (error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, "No element named \"%s\" - omitting link", l->sink_name);
853 gst_parse_free_link (l);
858 gst_parse_perform_link (l, &g);
860 g_slist_free (g.links);
863 #ifdef __GST_PARSE_TRACE
864 GST_CAT_DEBUG (GST_CAT_PIPELINE, "TRACE: %u strings, %u chains and %u links left", __strings, __chains, __links);
865 if (__strings || __chains || __links) {
866 g_warning ("TRACE: %u strings, %u chains and %u links left", __strings, __chains, __links);
868 #endif /* __GST_PARSE_TRACE */
876 walk = g.chain->elements;
878 gst_object_unref (GST_OBJECT (walk->data));
881 g_slist_free (g.chain->elements);
883 gst_parse_chain_free (g.chain);
887 gst_parse_free_link ((link_t *) walk->data);
890 g_slist_free (g.links);