mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
1e82f617e4
Original commit message from CVS: 2004-01-13 Benjamin Otte <in7y118@public.uni-hamburg.de> * gst/gstclock.c: (gst_clock_class_init), (gst_clock_init), (gst_clock_set_speed), (gst_clock_set_active), (gst_clock_is_active), (gst_clock_reset), (gst_clock_handle_discont): * gst/gstclock.h: deprecate old interface and disable functions that aren't in use anymore. * gst/gstelement.h: * gst/gstelement.c: (gst_element_get_time), (gst_element_wait), (gst_element_set_time), (gst_element_adjust_time): add concept of "element time" and functions to get/set this time. * gst/gstelement.c: (gst_element_change_state): update element time correctly. * gst/gstelement.c: (gst_element_get_compatible_pad_filtered): This is a debug message, not a g_critical. * gst/gstpad.c: (gst_pad_event_default): handle discontinuous events right with element time. * gst/gstscheduler.c: (gst_scheduler_state_transition): update to clocking fixes. set clocks on elements in READY=>PAUSED. The old behaviour caused a wrong element time on the first element that started playing. * gst/schedulers/gstbasicscheduler.c: (gst_basic_scheduler_class_init): * gst/schedulers/gstoptimalscheduler.c: (gst_opt_scheduler_class_init): remove code that just implements the default behaviour. * gst/elements/gstfakesink.c: (gst_fakesink_chain): update to use new clocking functions * testsuite/clock/clock1.c: (gst_clock_debug), (main): * testsuite/clock/clock2.c: (gst_clock_debug), (main): update to test new element time. * gst/autoplug/gstspideridentity.c: (gst_spider_identity_getcaps): use _get_allowed_caps instead of _get_caps. This catches filtered caps correctly. * testsuite/debug/commandline.c: update for new GST_DEBUG syntax. * testsuite/threads/Makefile.am: disable a test that only works sometimes.
54 lines
1.5 KiB
C
54 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, GstElement *fakesink)
|
|
{
|
|
g_print ("Clock info: time %"G_GUINT64_FORMAT" - Element info: time %"G_GUINT64_FORMAT"\n",
|
|
gst_clock_get_time (clock), gst_element_get_time (fakesink));
|
|
}
|
|
|
|
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);
|
|
|
|
gst_element_wait (fakesink, 2 * GST_SECOND);
|
|
gst_clock_debug (clock, fakesink);
|
|
|
|
gst_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;
|
|
}
|