added a test which shows a problem with state changes when the toplevel bin is a...
[platform/upstream/gstreamer.git] / tests / threadstate / threadstate1.c
1 #include <gst/gst.h>
2
3 int main(int argc,char *argv[]) 
4 {
5   GstElement *fakesrc, *fakesink;
6   GstElement *thread;
7   gint x;
8
9   gst_init(&argc,&argv);
10
11   thread = gst_thread_new("thread");
12   g_assert(thread != NULL);
13
14   fakesrc = gst_element_factory_make("fakesrc", "fake_source");
15   g_assert(fakesrc != NULL);
16
17   fakesink = gst_element_factory_make("fakesink", "fake_sink");
18   g_assert(fakesink != NULL);
19
20   gst_bin_add_many (GST_BIN(thread), fakesrc, fakesink, NULL);
21   gst_element_connect (fakesrc, fakesink);
22
23   for (x = 0 ; x < 10 ; x++){
24     g_print("playing %d\n", x);
25     gst_element_set_state(GST_ELEMENT(thread), GST_STATE_PLAYING);
26     sleep(1);
27
28     g_print("pausing %d\n", x);
29     gst_element_set_state(GST_ELEMENT(thread), GST_STATE_PAUSED);
30     sleep(1);
31   }
32
33   exit(0);
34 }
35