gstreamer/testsuite/clock/clock2.c
Wim Taymans bd9cd13058 Doc updates,
Original commit message from CVS:
* REQUIREMENTS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-clocks.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* libs/gst/control/dparam.c: (gst_dparam_attach):
* libs/gst/control/dparam.h:
* libs/gst/control/dparammanager.c:
(gst_dpman_add_required_dparam_callback),
(gst_dpman_add_required_dparam_direct),
(gst_dpman_add_required_dparam_array), (gst_dpman_attach_dparam),
(gst_dpman_get_dparam), (gst_dpman_get_dparam_type),
(gst_dpman_get_manager), (gst_dpman_bypass_dparam),
(gst_dpman_preprocess_asynchronous),
(gst_dpman_process_asynchronous), (gst_dpman_process_noop):
* libs/gst/control/dparammanager.h:
* testsuite/clock/clock2.c: (gst_clock_debug), (element_wait),
(main):
* testsuite/threads/signals.c: (run_thread), (main):
* testsuite/threads/thread.c: (main):
* tools/gst-launch.c: (fault_handler_sighandler),
(fault_handler_sigaction), (fault_spin):
Doc updates,
Head backporting.
Fix some testcases.
2005-03-10 12:53:16 +00:00

69 lines
1.7 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, GstElement * fakesink)
{
GstClockTime time;
time = gst_clock_get_time (clock);
g_print ("Clock info: time %" G_GUINT64_FORMAT " Element %" GST_TIME_FORMAT
"\n", time, GST_TIME_ARGS (time - fakesink->base_time));
}
static void
element_wait (GstElement * element, GstClockTime time)
{
GstClockID id;
id = gst_clock_new_single_shot_id (clock, time + element->base_time);
gst_clock_id_wait (id, NULL);
gst_clock_id_unref (id);
}
int
main (int argc, char *argv[])
{
GstClock *clock = NULL;
GstElement *pipeline, *fakesrc, *fakesink;
gst_init (&argc, &argv);
clock = gst_system_clock_obtain ();
g_assert (clock != NULL);
/* we check the time on an element */
fakesrc = gst_element_factory_make ("fakesrc", NULL);
g_assert (fakesrc);
fakesink = gst_element_factory_make ("fakesink", NULL);
g_assert (fakesink);
pipeline = gst_element_factory_make ("pipeline", NULL);
g_assert (pipeline);
gst_bin_add_many (GST_BIN (pipeline), fakesink, fakesrc, NULL);
gst_element_link (fakesrc, fakesink);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
gst_clock_debug (clock, fakesink);
g_usleep (G_USEC_PER_SEC);
gst_clock_debug (clock, fakesink);
element_wait (fakesink, 2 * GST_SECOND);
gst_clock_debug (clock, fakesink);
element_wait (fakesink, 5 * GST_SECOND);
gst_clock_debug (clock, fakesink);
g_usleep (G_USEC_PER_SEC);
gst_clock_debug (clock, fakesink);
/* success */
return 0;
}