2002-04-23 19:12:54 +00:00
|
|
|
/*
|
|
|
|
* testsuite program to test clock behaviour
|
|
|
|
*
|
|
|
|
* creates a fakesrc ! identity ! fakesink pipeline
|
|
|
|
* registers a callback on fakesrc and one on fakesink
|
|
|
|
* also register a normal GLib timeout which should not be reached
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_clock_debug (GstClock * clock)
|
2002-04-23 19:12:54 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("Clock info: time %" G_GUINT64_FORMAT "\n",
|
|
|
|
gst_clock_get_time (clock));
|
2002-04-23 19:12:54 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-04-23 19:12:54 +00:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
GstElement *src, *id, *sink, *pipeline;
|
|
|
|
GstClock *clock = NULL;
|
|
|
|
|
|
|
|
gst_init (&argc, &argv);
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if ((src = gst_element_factory_make ("fakesrc", "source")) == NULL) {
|
2002-04-23 19:12:54 +00:00
|
|
|
g_print ("Could not create a fakesrc element !\n");
|
|
|
|
return 1;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
if ((id = gst_element_factory_make ("identity", "filter")) == NULL) {
|
2002-04-23 19:12:54 +00:00
|
|
|
g_print ("Could not create a identity element !\n");
|
|
|
|
return 1;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
if ((sink = gst_element_factory_make ("fakesink", "sink")) == NULL) {
|
2002-04-23 19:12:54 +00:00
|
|
|
g_print ("Could not create a fakesink element !\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if ((pipeline = gst_pipeline_new ("pipeline")) == NULL) {
|
2002-04-23 19:12:54 +00:00
|
|
|
g_print ("Could not create a pipeline element !\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL);
|
2004-07-02 13:54:59 +00:00
|
|
|
gst_element_link_many (src, id, sink, NULL);
|
2002-04-23 19:12:54 +00:00
|
|
|
|
|
|
|
clock = gst_bin_get_clock (GST_BIN (pipeline));
|
|
|
|
g_assert (clock != NULL);
|
|
|
|
gst_clock_debug (clock);
|
|
|
|
gst_clock_debug (clock);
|
|
|
|
|
2002-05-09 14:26:20 +00:00
|
|
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
2002-04-23 19:12:54 +00:00
|
|
|
gst_bin_iterate (GST_BIN (pipeline));
|
|
|
|
gst_clock_debug (clock);
|
|
|
|
gst_clock_debug (clock);
|
|
|
|
gst_clock_debug (clock);
|
|
|
|
|
|
|
|
/* success */
|
|
|
|
return 0;
|
|
|
|
}
|