mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 15:18:21 +00:00
Added another test case, a bin in a thread, to test EOS. still hangs because gtk_main hangs in a __poll somewhere.
Original commit message from CVS: Added another test case, a bin in a thread, to test EOS. still hangs because gtk_main hangs in a __poll somewhere.
This commit is contained in:
parent
044c4611af
commit
bc9054e18e
2 changed files with 69 additions and 0 deletions
1
tests/eos/.gitignore
vendored
1
tests/eos/.gitignore
vendored
|
@ -12,3 +12,4 @@ case3
|
|||
case4
|
||||
case5
|
||||
case6
|
||||
case7
|
||||
|
|
68
tests/eos/case7.c
Normal file
68
tests/eos/case7.c
Normal file
|
@ -0,0 +1,68 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
static void
|
||||
eos_signal_element (GstElement *element)
|
||||
{
|
||||
g_print ("element eos received from \"%s\"\n", gst_element_get_name (element));
|
||||
}
|
||||
|
||||
static void
|
||||
eos_signal (GstElement *element)
|
||||
{
|
||||
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
|
||||
|
||||
gst_element_set_state (GST_ELEMENT (element), GST_STATE_NULL);
|
||||
|
||||
g_print ("quiting main loop\n");
|
||||
gdk_threads_enter ();
|
||||
gtk_main_quit();
|
||||
gdk_threads_leave ();
|
||||
g_print ("quited main loop\n");
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
GstBin *bin, *thread;
|
||||
GstElement *src,*identity,*sink;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
thread = GST_BIN (gst_thread_new ("thread"));
|
||||
g_return_val_if_fail (thread != NULL, 1);
|
||||
|
||||
bin = GST_BIN (gst_bin_new ("bin"));
|
||||
g_return_val_if_fail(bin != NULL, 1);
|
||||
|
||||
src = gst_elementfactory_make ("fakesrc", "src");
|
||||
gtk_object_set (GTK_OBJECT (src), "num_buffers", 1, NULL);
|
||||
g_return_val_if_fail (src != NULL, 2);
|
||||
|
||||
identity = gst_elementfactory_make ("identity", "identity");
|
||||
g_return_val_if_fail (identity != NULL, 3);
|
||||
sink = gst_elementfactory_make ("fakesink", "sink");
|
||||
g_return_val_if_fail (sink != NULL, 4);
|
||||
|
||||
gst_bin_add(bin, GST_ELEMENT (src));
|
||||
gst_bin_add(bin, GST_ELEMENT (identity));
|
||||
gst_bin_add(bin, GST_ELEMENT (sink));
|
||||
|
||||
gst_bin_add(thread, GST_ELEMENT (bin));
|
||||
|
||||
gst_element_connect(src, "src", identity, "sink");
|
||||
gst_element_connect(identity, "src", sink, "sink");
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (src), "eos", eos_signal_element, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (bin), "eos", eos_signal_element, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (thread), "eos", eos_signal, NULL);
|
||||
|
||||
gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PLAYING);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_main();
|
||||
gdk_threads_leave ();
|
||||
|
||||
g_print ("quiting\n");
|
||||
|
||||
exit (0);
|
||||
}
|
Loading…
Reference in a new issue