1 /* GstTestClock - A deterministic clock for GStreamer unit tests
3 * Copyright (C) 2008 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
4 * Copyright (C) 2012 Sebastian Rasmussen <sebastian.rasmussen@axis.com>
5 * Copyright (C) 2012 Havard Graff <havard@pexip.com>
6 * Copyright (C) 2013 Haakon Sporsheim <haakon@pexip.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 #ifndef __GST_TEST_CLOCK_H__
25 #define __GST_TEST_CLOCK_H__
31 #define GST_TYPE_TEST_CLOCK (gst_test_clock_get_type ())
32 #define GST_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
33 GST_TYPE_TEST_CLOCK, GstTestClock))
34 #define GST_IS_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
36 #define GST_TEST_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
37 GST_TYPE_TEST_CLOCK, GstTestClockClass))
38 #define GST_IS_TEST_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (\
39 (klass), GST_TYPE_TEST_CLOCK))
40 #define GST_TEST_CLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (\
41 (obj), GST_TYPE_TEST_CLOCK, GstTestClockClass))
42 #define GST_TEST_CLOCK_CAST(obj) ((GstTestClock*)(obj))
44 typedef struct _GstTestClock GstTestClock;
45 typedef struct _GstTestClockClass GstTestClockClass;
46 typedef struct _GstTestClockPrivate GstTestClockPrivate;
51 * A #GstTestClock structure which is based on a #GstClock along with some
61 GstTestClockPrivate *priv;
66 * @parent_class: the parent class structure
68 * The class of a #GstTestClock, which has no virtual methods to override.
72 struct _GstTestClockClass
74 GstClockClass parent_class;
77 GType gst_test_clock_get_type (void);
79 GstClock * gst_test_clock_new (void);
81 GstClock * gst_test_clock_new_with_start_time (GstClockTime start_time);
83 void gst_test_clock_set_time (GstTestClock * test_clock,
84 GstClockTime new_time);
86 void gst_test_clock_advance_time (GstTestClock * test_clock,
87 GstClockTimeDiff delta);
89 guint gst_test_clock_peek_id_count (GstTestClock * test_clock);
91 gboolean gst_test_clock_has_id (GstTestClock * test_clock, GstClockID id);
93 gboolean gst_test_clock_peek_next_pending_id (GstTestClock * test_clock,
94 GstClockID * pending_id);
96 void gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock,
97 GstClockID * pending_id);
99 #ifndef GST_DISABLE_DEPRECATED
100 void gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock,
104 GstClockID gst_test_clock_process_next_clock_id (GstTestClock * test_clock);
106 GstClockTime gst_test_clock_get_next_entry_time (GstTestClock * test_clock);
108 void gst_test_clock_wait_for_multiple_pending_ids (GstTestClock * test_clock,
110 GList ** pending_list);
112 guint gst_test_clock_process_id_list (GstTestClock * test_clock,
113 const GList * pending_list);
115 GstClockTime gst_test_clock_id_list_get_latest_time (const GList * pending_list);
117 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
118 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTestClock, gst_object_unref)
123 #endif /* __GST_TEST_CLOCK_H__ */