gstreamer/testsuite/clock/clock1.c
Wim Taymans 007cff6d75 Doc updates.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-clocks.txt:
* docs/design/part-gstelement.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove):
* gst/gstbin.h:
* gst/gstbuffer.c:
* gst/gstcaps.h:
* testsuite/clock/clock1.c: (main):
* testsuite/clock/clock2.c: (gst_clock_debug), (element_wait),
(main):
* testsuite/dlopen/loadgst.c: (do_test):
* testsuite/refcounting/bin.c: (add_remove_test1),
(add_remove_test2), (main):
* testsuite/refcounting/element.c: (main):
* testsuite/refcounting/element_pad.c: (main):
* testsuite/refcounting/pad.c: (main):
* tools/gst-launch.c: (sigint_handler_sighandler):
* tools/gst-typefind.c: (main):
Doc updates.
Added doc about clock.
removed gst_bin_iterate_recurse_up(), marked methods
for removal.
Fix more testsuites.
2005-03-10 12:51:45 +00:00

58 lines
1.5 KiB
C

/*
* 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
gst_clock_debug (GstClock * clock)
{
g_print ("Clock info: time %" G_GUINT64_FORMAT "\n",
gst_clock_get_time (clock));
}
int
main (int argc, char *argv[])
{
GstElement *src, *id, *sink, *pipeline;
GstClock *clock = NULL;
gst_init (&argc, &argv);
if ((src = gst_element_factory_make ("fakesrc", "source")) == NULL) {
g_print ("Could not create a fakesrc element !\n");
return 1;
}
if ((id = gst_element_factory_make ("identity", "filter")) == NULL) {
g_print ("Could not create a identity element !\n");
return 1;
}
if ((sink = gst_element_factory_make ("fakesink", "sink")) == NULL) {
g_print ("Could not create a fakesink element !\n");
return 1;
}
if ((pipeline = gst_pipeline_new ("pipeline")) == NULL) {
g_print ("Could not create a pipeline element !\n");
return 1;
}
gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL);
gst_element_link_many (src, id, sink, NULL);
clock = gst_pipeline_get_clock (GST_PIPELINE (pipeline));
g_assert (clock != NULL);
gst_clock_debug (clock);
gst_clock_debug (clock);
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
gst_clock_debug (clock);
gst_clock_debug (clock);
gst_clock_debug (clock);
/* success */
return 0;
}