gst-indent run on core
[platform/upstream/gstreamer.git] / tests / threadstate / threadstate1.c
1 #include <stdlib.h>
2 #include <gst/gst.h>
3
4 /* this pipeline is:
5  * { fakesrc ! fakesink }
6  */
7
8
9 int
10 main (int argc, char *argv[])
11 {
12   GstElement *fakesrc, *fakesink;
13   GstElement *thread;
14   gint x;
15
16   gst_init (&argc, &argv);
17
18   thread = gst_thread_new ("thread");
19   g_assert (thread != NULL);
20
21   fakesrc = gst_element_factory_make ("fakesrc", "fake_source");
22   g_assert (fakesrc != NULL);
23
24   fakesink = gst_element_factory_make ("fakesink", "fake_sink");
25   g_assert (fakesink != NULL);
26
27   gst_bin_add_many (GST_BIN (thread), fakesrc, fakesink, NULL);
28   gst_element_link (fakesrc, fakesink);
29
30   for (x = 0; x < 10; x++) {
31     g_print ("playing %d\n", x);
32     gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PLAYING);
33     g_usleep (G_USEC_PER_SEC);
34
35     g_print ("pausing %d\n", x);
36     gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PAUSED);
37     g_usleep (G_USEC_PER_SEC);
38   }
39
40   exit (0);
41 }