mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 18:20:44 +00:00
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:
parent
fe0a9ec618
commit
2145586ab6
1 changed files with 8 additions and 3 deletions
|
@ -164,7 +164,12 @@ do_sprinkle (SprinkleState * state)
|
||||||
state->count++;
|
state->count++;
|
||||||
} else {
|
} else {
|
||||||
state->infos[0] = NULL;
|
state->infos[0] = NULL;
|
||||||
|
|
||||||
|
/* if no more sources left, quit */
|
||||||
|
if (!state->infos[2])
|
||||||
|
g_main_loop_quit (loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +207,7 @@ main (int argc, char *argv[])
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
GstElement *filter, *convert, *sink;
|
GstElement *filter, *convert, *sink;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gboolean res;
|
gboolean linked;
|
||||||
SprinkleState *state;
|
SprinkleState *state;
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
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);
|
gst_bin_add_many (GST_BIN (pipeline), adder, filter, convert, sink, NULL);
|
||||||
|
|
||||||
res = gst_element_link_many (adder, filter, convert, sink, NULL);
|
linked = gst_element_link_many (adder, filter, convert, sink, NULL);
|
||||||
g_assert (res);
|
g_assert (linked);
|
||||||
|
|
||||||
/* setup message handling */
|
/* setup message handling */
|
||||||
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
||||||
|
|
Loading…
Reference in a new issue