diff --git a/gst/debugutils/gstclockselect.c b/gst/debugutils/gstclockselect.c index ebead0ff0d..e0ccef9143 100644 --- a/gst/debugutils/gstclockselect.c +++ b/gst/debugutils/gstclockselect.c @@ -56,6 +56,7 @@ gst_clock_select_clock_id_get_type (void) "monotonic"}, {GST_CLOCK_SELECT_CLOCK_ID_REALTIME, "System realtime clock", "realtime"}, {GST_CLOCK_SELECT_CLOCK_ID_PTP, "PTP clock", "ptp"}, + {GST_CLOCK_SELECT_CLOCK_ID_TAI, "System TAI clock", "tai"}, {0, NULL, NULL}, }; @@ -195,6 +196,13 @@ gst_clock_select_provide_clock (GstElement * element) "Failed to get PTP clock, falling back to pipeline default clock"); } break; + case GST_CLOCK_SELECT_CLOCK_ID_TAI: + clock = + g_object_new (GST_TYPE_SYSTEM_CLOCK, "name", "DebugGstSystemClock", + NULL); + gst_object_ref_sink (clock); + gst_util_set_object_arg (G_OBJECT (clock), "clock-type", "tai"); + break; case GST_CLOCK_SELECT_CLOCK_ID_DEFAULT: default: clock = NULL; diff --git a/gst/debugutils/gstclockselect.h b/gst/debugutils/gstclockselect.h index a9a56c64a0..6060428c5e 100644 --- a/gst/debugutils/gstclockselect.h +++ b/gst/debugutils/gstclockselect.h @@ -39,6 +39,7 @@ enum _GstClockSelectClockId { GST_CLOCK_SELECT_CLOCK_ID_MONOTONIC, GST_CLOCK_SELECT_CLOCK_ID_REALTIME, GST_CLOCK_SELECT_CLOCK_ID_PTP, + GST_CLOCK_SELECT_CLOCK_ID_TAI, }; struct _GstClockSelect diff --git a/tests/check/elements/clockselect.c b/tests/check/elements/clockselect.c index 485f50fd73..f1dcda0e54 100644 --- a/tests/check/elements/clockselect.c +++ b/tests/check/elements/clockselect.c @@ -22,6 +22,30 @@ #include #include +GST_START_TEST (test_clock_select_tai_clock) +{ + GstHarness *h; + GstElement *element; + GstClock *clock; + guint clock_type; + + h = gst_harness_new_parse ("clockselect clock-id=tai"); + + /* Check if element provides right clock */ + element = gst_harness_find_element (h, "clockselect"); + clock = gst_element_provide_clock (element); + + fail_unless (GST_IS_SYSTEM_CLOCK (clock)); + g_object_get (G_OBJECT (clock), "clock-type", &clock_type, NULL); + fail_unless_equals_uint64 (clock_type, GST_CLOCK_TYPE_TAI); + + gst_object_unref (element); + gst_object_unref (clock); + gst_harness_teardown (h); +} + +GST_END_TEST; + GST_START_TEST (test_clock_select_realtime_clock) { GstHarness *h; @@ -102,6 +126,7 @@ clock_select_suite (void) tcase_add_test (tc_chain, test_clock_select_properties); tcase_add_test (tc_chain, test_clock_select_monotonic_clock); tcase_add_test (tc_chain, test_clock_select_realtime_clock); + tcase_add_test (tc_chain, test_clock_select_tai_clock); return s; }