diff options
author | Ederson de Souza <ederson.desouza@intel.com> | 2019-12-13 11:28:08 -0800 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2020-04-30 19:21:37 +0000 |
commit | 3ea0f694de60e68c4b7377530992245b6a8172f6 (patch) | |
tree | 30bb487f8671d23e9957fae02956b646c4391cec | |
parent | 443c01e119fa49455742364fc19f58d0ad8efbc5 (diff) | |
download | gstreamer-plugins-bad-3ea0f694de60e68c4b7377530992245b6a8172f6.tar.gz |
clockselect: Add TAI clock support
Via new value for property clock-id, "tai", it's possible to use
GST_CLOCK_TYPE_TAI as pipeline clock.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1009>
-rw-r--r-- | gst/debugutils/gstclockselect.c | 8 | ||||
-rw-r--r-- | gst/debugutils/gstclockselect.h | 1 | ||||
-rw-r--r-- | tests/check/elements/clockselect.c | 25 |
3 files changed, 34 insertions, 0 deletions
diff --git a/gst/debugutils/gstclockselect.c b/gst/debugutils/gstclockselect.c index ebead0ff0..e0ccef914 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 a9a56c64a..6060428c5 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 485f50fd7..f1dcda0e5 100644 --- a/tests/check/elements/clockselect.c +++ b/tests/check/elements/clockselect.c @@ -22,6 +22,30 @@ #include <gst/check/gstcheck.h> #include <gst/check/gstharness.h> +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; } |