]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/blob - testsuite/clock/clock1.c
gst-indent run on core
[glsdk/gstreamer0-10.git] / testsuite / clock / clock1.c
1 /*
2  * testsuite program to test clock behaviour
3  *
4  * creates a fakesrc ! identity ! fakesink pipeline
5  * registers a callback on fakesrc and one on fakesink
6  * also register a normal GLib timeout which should not be reached
7  */
9 #include <gst/gst.h>
10 void
11 gst_clock_debug (GstClock * clock)
12 {
13   g_print ("Clock info: time %" G_GUINT64_FORMAT "\n",
14       gst_clock_get_time (clock));
15 }
17 int
18 main (int argc, char *argv[])
19 {
20   GstElement *src, *id, *sink, *pipeline;
21   GstClock *clock = NULL;
23   gst_init (&argc, &argv);
25   if ((src = gst_element_factory_make ("fakesrc", "source")) == NULL) {
26     g_print ("Could not create a fakesrc element !\n");
27     return 1;
28   }
29   if ((id = gst_element_factory_make ("identity", "filter")) == NULL) {
30     g_print ("Could not create a identity element !\n");
31     return 1;
32   }
33   if ((sink = gst_element_factory_make ("fakesink", "sink")) == NULL) {
34     g_print ("Could not create a fakesink element !\n");
35     return 1;
36   }
38   if ((pipeline = gst_pipeline_new ("pipeline")) == NULL) {
39     g_print ("Could not create a pipeline element !\n");
40     return 1;
41   }
43   gst_element_link_many (src, id, sink, NULL);
44   gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL);
46   clock = gst_bin_get_clock (GST_BIN (pipeline));
47   g_assert (clock != NULL);
48   gst_clock_debug (clock);
49   gst_clock_debug (clock);
51   gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
52   gst_bin_iterate (GST_BIN (pipeline));
53   gst_clock_debug (clock);
54   gst_clock_debug (clock);
55   gst_clock_debug (clock);
57   /* success */
58   return 0;
59 }