examples: avoid sprinkle running endlessly

Quit sprinkle when there are no more frequencies to remove.
Also rename for readability the check for linking elements.
This commit is contained in:
Luis de Bethencourt 2015-04-08 15:31:39 +01:00
parent fe0a9ec618
commit 2145586ab6

View file

@ -164,7 +164,12 @@ do_sprinkle (SprinkleState * state)
state->count++;
} else {
state->infos[0] = NULL;
/* if no more sources left, quit */
if (!state->infos[2])
g_main_loop_quit (loop);
}
return TRUE;
}
@ -202,7 +207,7 @@ main (int argc, char *argv[])
GstBus *bus;
GstElement *filter, *convert, *sink;
GstCaps *caps;
gboolean res;
gboolean linked;
SprinkleState *state;
gst_init (&argc, &argv);
@ -227,8 +232,8 @@ main (int argc, char *argv[])
gst_bin_add_many (GST_BIN (pipeline), adder, filter, convert, sink, NULL);
res = gst_element_link_many (adder, filter, convert, sink, NULL);
g_assert (res);
linked = gst_element_link_many (adder, filter, convert, sink, NULL);
g_assert (linked);
/* setup message handling */
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));