From c6cc50e6de5b578e93e27c3ccd61801a96011fbf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 13 Nov 2012 22:42:05 +0000 Subject: [PATCH] testclock: minor cleanups, add since markers for gtk-doc https://bugzilla.gnome.org/show_bug.cgi?id=683012 --- libs/gst/check/gsttestclock.c | 64 +++++++++++++++++++++++------------ libs/gst/check/gsttestclock.h | 48 +++++++++++++++----------- tests/check/libs/.gitignore | 1 + 3 files changed, 73 insertions(+), 40 deletions(-) diff --git a/libs/gst/check/gsttestclock.c b/libs/gst/check/gsttestclock.c index 70e8f64145..69a2f5ad3a 100644 --- a/libs/gst/check/gsttestclock.c +++ b/libs/gst/check/gsttestclock.c @@ -1,5 +1,4 @@ -/* - * A deterministic clock for GStreamer unit tests +/* GstTestClock - A deterministic clock for GStreamer unit tests * * Copyright (C) 2008 Ole André Vadla Ravnås * Copyright (C) 2012 Sebastian Rasmussen @@ -173,12 +172,16 @@ * arguments. This will highlight any issues with the unit test code itself. */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "gsttestclock.h" enum { PROP_0, - PROP_START_TIME, + PROP_START_TIME }; typedef struct _GstClockEntryContext GstClockEntryContext; @@ -238,8 +241,8 @@ static void gst_test_clock_add_entry (GstTestClock * test_clock, GstClockEntry * entry, GstClockTimeDiff * jitter); static void gst_test_clock_remove_entry (GstTestClock * test_clock, GstClockEntry * entry); -static GstClockEntryContext *gst_test_clock_lookup_entry_context ( - GstTestClock * test_clock, GstClockEntry * clock_entry); +static GstClockEntryContext *gst_test_clock_lookup_entry_context (GstTestClock * + test_clock, GstClockEntry * clock_entry); static gint gst_clock_entry_context_compare_func (gconstpointer a, gconstpointer b); @@ -261,10 +264,10 @@ gst_test_clock_class_init (GstTestClockClass * klass) gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_test_clock_get_property); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_test_clock_set_property); - gstclock_class->get_resolution = GST_DEBUG_FUNCPTR ( - gst_test_clock_get_resolution); - gstclock_class->get_internal_time = GST_DEBUG_FUNCPTR ( - gst_test_clock_get_internal_time); + gstclock_class->get_resolution = + GST_DEBUG_FUNCPTR (gst_test_clock_get_resolution); + gstclock_class->get_internal_time = + GST_DEBUG_FUNCPTR (gst_test_clock_get_internal_time); gstclock_class->wait = GST_DEBUG_FUNCPTR (gst_test_clock_wait); gstclock_class->wait_async = GST_DEBUG_FUNCPTR (gst_test_clock_wait_async); gstclock_class->unschedule = GST_DEBUG_FUNCPTR (gst_test_clock_unschedule); @@ -357,8 +360,7 @@ gst_test_clock_get_property (GObject * object, guint property_id, g_value_set_uint64 (value, priv->start_time); break; default: - G_OBJECT_CLASS (parent_class)->set_property (object, property_id, value, - pspec); + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } @@ -378,8 +380,7 @@ gst_test_clock_set_property (GObject * object, guint property_id, GST_TIME_ARGS (priv->start_time)); break; default: - G_OBJECT_CLASS (parent_class)->set_property (object, property_id, value, - pspec); + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } @@ -428,8 +429,7 @@ gst_test_clock_wait (GstClock * clock, GST_CLOCK_ENTRY_STATUS (entry) = GST_CLOCK_BUSY; while (GST_CLOCK_ENTRY_STATUS (entry) == GST_CLOCK_BUSY) - g_cond_wait (priv->entry_processed_cond, - GST_OBJECT_GET_LOCK (test_clock)); + g_cond_wait (priv->entry_processed_cond, GST_OBJECT_GET_LOCK (test_clock)); GST_OBJECT_UNLOCK (test_clock); @@ -508,8 +508,7 @@ gst_test_clock_add_entry (GstTestClock * test_clock, GstClockTime now; GstClockEntryContext *ctx; - now = gst_clock_adjust_unlocked (GST_CLOCK (test_clock), - priv->internal_time); + now = gst_clock_adjust_unlocked (GST_CLOCK (test_clock), priv->internal_time); if (jitter != NULL) *jitter = GST_CLOCK_DIFF (GST_CLOCK_ENTRY_TIME (entry), now); @@ -577,6 +576,8 @@ gst_clock_entry_context_compare_func (gconstpointer a, gconstpointer b) * MT safe. * * Returns: (transfer full): a #GstTestClock cast to #GstClock. + * + * Since: 1.2 */ GstClock * gst_test_clock_new (void) @@ -593,6 +594,8 @@ gst_test_clock_new (void) * MT safe. * * Returns: (transfer full): a #GstTestClock cast to #GstClock. + * + * Since: 1.2 */ GstClock * gst_test_clock_new_with_start_time (GstClockTime start_time) @@ -612,6 +615,8 @@ gst_test_clock_new_with_start_time (GstClockTime start_time) * gst_clock_get_time() is a programming error. * * MT safe. + * + * Since: 1.2 */ void gst_test_clock_set_time (GstTestClock * test_clock, GstClockTime new_time) @@ -642,10 +647,11 @@ gst_test_clock_set_time (GstTestClock * test_clock, GstClockTime new_time) * @delta which is negative or zero is a programming error. * * MT safe. + * + * Since: 1.2 */ void -gst_test_clock_advance_time (GstTestClock * test_clock, - GstClockTimeDiff delta) +gst_test_clock_advance_time (GstTestClock * test_clock, GstClockTimeDiff delta) { GstTestClockPrivate *priv = GST_TEST_CLOCK_GET_PRIVATE (test_clock); @@ -673,6 +679,8 @@ gst_test_clock_advance_time (GstTestClock * test_clock, * MT safe. * * Returns: the number of pending clock notifications. + * + * Since: 1.2 */ guint gst_test_clock_peek_id_count (GstTestClock * test_clock) @@ -700,6 +708,8 @@ gst_test_clock_peek_id_count (GstTestClock * test_clock) * * Returns: %TRUE if the clock has been asked to provide the given clock * notification, %FALSE otherwise. + * + * Since: 1.2 */ gboolean gst_test_clock_has_id (GstTestClock * test_clock, GstClockID id) @@ -729,6 +739,8 @@ gst_test_clock_has_id (GstTestClock * test_clock, GstClockID id) * * Return: %TRUE if @pending_id is the next clock notification to be * triggered, %FALSE otherwise. + * + * Since: 1.2 */ gboolean gst_test_clock_peek_next_pending_id (GstTestClock * test_clock, @@ -757,6 +769,8 @@ gst_test_clock_peek_next_pending_id (GstTestClock * test_clock, * to the pending clock notification is stored in @pending_id. * * MT safe. + * + * Since: 1.2 */ void gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock, @@ -771,7 +785,8 @@ gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock, while (priv->entry_contexts == NULL) g_cond_wait (priv->entry_added_cond, GST_OBJECT_GET_LOCK (test_clock)); - g_assert (gst_test_clock_peek_next_pending_id_unlocked (test_clock, pending_id)); + g_assert (gst_test_clock_peek_next_pending_id_unlocked (test_clock, + pending_id)); GST_OBJECT_UNLOCK (test_clock); } @@ -786,9 +801,12 @@ gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock, * #GstTestClock. * * MT safe. + * + * Since: 1.2 */ void -gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock, guint count) +gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock, + guint count) { GstTestClockPrivate *priv = GST_TEST_CLOCK_GET_PRIVATE (test_clock); @@ -811,6 +829,8 @@ gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock, guint count * * Returns: (transfer full): a #GstClockID containing the next pending clock * notification. + * + * Since: 1.2 */ GstClockID gst_test_clock_process_next_clock_id (GstTestClock * test_clock) @@ -873,6 +893,8 @@ gst_test_clock_process_next_clock_id (GstTestClock * test_clock) * Returns: a #GstClockTime set to the time of the next pending clock * notification. If no clock notifications have been requested * %GST_CLOCK_TIME_NONE will be returned. + * + * Since: 1.2 */ GstClockTime gst_test_clock_get_next_entry_time (GstTestClock * test_clock) diff --git a/libs/gst/check/gsttestclock.h b/libs/gst/check/gsttestclock.h index d5ef6522d1..7d049aa61d 100644 --- a/libs/gst/check/gsttestclock.h +++ b/libs/gst/check/gsttestclock.h @@ -1,5 +1,4 @@ -/* - * A deterministic clock for GStreamer unit tests +/* GstTestClock - A deterministic clock for GStreamer unit tests * * Copyright (C) 2008 Ole André Vadla Ravnås * Copyright (C) 2012 Sebastian Rasmussen @@ -27,7 +26,6 @@ G_BEGIN_DECLS -/* --- standard type macros --- */ #define GST_TYPE_TEST_CLOCK (gst_test_clock_get_type ()) #define GST_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\ GST_TYPE_TEST_CLOCK, GstTestClock)) @@ -50,6 +48,8 @@ typedef struct _GstTestClockPrivate GstTestClockPrivate; * * A #GstTestClock structure which is based on a #GstClock along with some * private data. + * + * Since: 1.2 */ struct _GstTestClock { @@ -64,32 +64,42 @@ struct _GstTestClock * @parent_class: the parent class structure * * The class of a #GstTestClock, which has no virtual methods to override. + * + * Since: 1.2 */ struct _GstTestClockClass { GstClockClass parent_class; }; -GType gst_test_clock_get_type (void); +GType gst_test_clock_get_type (void); + +GstClock * gst_test_clock_new (void); + +GstClock * gst_test_clock_new_with_start_time (GstClockTime start_time); + +void gst_test_clock_set_time (GstTestClock * test_clock, + GstClockTime new_time); + +void gst_test_clock_advance_time (GstTestClock * test_clock, + GstClockTimeDiff delta); + +guint gst_test_clock_peek_id_count (GstTestClock * test_clock); + +gboolean gst_test_clock_has_id (GstTestClock * test_clock, GstClockID id); + +gboolean gst_test_clock_peek_next_pending_id (GstTestClock * test_clock, + GstClockID * pending_id); -GstClock *gst_test_clock_new (void); -GstClock *gst_test_clock_new_with_start_time (GstClockTime start_time); +void gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock, + GstClockID * pending_id); -void gst_test_clock_set_time (GstTestClock * test_clock, GstClockTime new_time); -void gst_test_clock_advance_time (GstTestClock * test_clock, - GstClockTimeDiff delta); +void gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock, + guint count); -guint gst_test_clock_peek_id_count (GstTestClock * test_clock); -gboolean gst_test_clock_has_id (GstTestClock * test_clock, GstClockID id); -gboolean gst_test_clock_peek_next_pending_id (GstTestClock * test_clock, - GstClockID * pending_id); -void gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock, - GstClockID * pending_id); -void gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock, - guint count); +GstClockID gst_test_clock_process_next_clock_id (GstTestClock * test_clock); -GstClockID gst_test_clock_process_next_clock_id (GstTestClock * test_clock); -GstClockTime gst_test_clock_get_next_entry_time (GstTestClock * test_clock); +GstClockTime gst_test_clock_get_next_entry_time (GstTestClock * test_clock); G_END_DECLS diff --git a/tests/check/libs/.gitignore b/tests/check/libs/.gitignore index 45c542532a..cc2b54f459 100644 --- a/tests/check/libs/.gitignore +++ b/tests/check/libs/.gitignore @@ -11,6 +11,7 @@ controller gstlibscpp gstnetclientclock gstnettimeprovider +gsttestclock libsabi transform1 typefindhelper -- 2.34.1