Debian Codegraph @

libs/gst/check/gsttestclock.h

raw
1 /* GstTestClock - A deterministic clock for GStreamer unit tests
2 *
3 * Copyright (C) 2008 Ole André Vadla Ravnås <[email protected]>
4 * Copyright (C) 2012 Sebastian Rasmussen <[email protected]>
5 * Copyright (C) 2012 Havard Graff <[email protected]>
6 * Copyright (C) 2013 Haakon Sporsheim <[email protected]>
7 *
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.
12 *
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.
17 *
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.
22 */
23
24 #ifndef __GST_TEST_CLOCK_H__
25 #define __GST_TEST_CLOCK_H__
26
27 #include <gst/gst.h>
28 #include <gst/check/check-prelude.h>
29
30 G_BEGIN_DECLS
31
32 #define GST_TYPE_TEST_CLOCK (gst_test_clock_get_type ())
33 #define GST_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
34 GST_TYPE_TEST_CLOCK, GstTestClock))
35 #define GST_IS_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
36 GST_TYPE_TEST_CLOCK))
37 #define GST_TEST_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
38 GST_TYPE_TEST_CLOCK, GstTestClockClass))
39 #define GST_IS_TEST_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (\
40 (klass), GST_TYPE_TEST_CLOCK))
41 #define GST_TEST_CLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (\
42 (obj), GST_TYPE_TEST_CLOCK, GstTestClockClass))
43 #define GST_TEST_CLOCK_CAST(obj) ((GstTestClock*)(obj))
44
45 typedef struct _GstTestClock GstTestClock;
46 typedef struct _GstTestClockClass GstTestClockClass;
47 typedef struct _GstTestClockPrivate GstTestClockPrivate;
48
49 /**
50 * GstTestClock:
51 *
52 * A #GstTestClock structure which is based on a #GstClock along with some
53 * private data.
54 *
55 * Since: 1.2
56 */
57 struct _GstTestClock
58 {
59 GstClock parent;
60
61 /*< private >*/
62 GstTestClockPrivate *priv;
63 };
64
65 /**
66 * GstTestClockClass:
67 * @parent_class: the parent class structure
68 *
69 * The class of a #GstTestClock, which has no virtual methods to override.
70 *
71 * Since: 1.2
72 */
73 struct _GstTestClockClass
74 {
75 GstClockClass parent_class;
76 };
77
78 GST_CHECK_API
79 GType gst_test_clock_get_type (void);
80
81 GST_CHECK_API
82 GstClock * gst_test_clock_new (void) G_GNUC_WARN_UNUSED_RESULT;
83
84 GST_CHECK_API
85 GstClock * gst_test_clock_new_with_start_time (GstClockTime start_time) G_GNUC_WARN_UNUSED_RESULT;
86
87 GST_CHECK_API
88 void gst_test_clock_set_time (GstTestClock * test_clock,
89 GstClockTime new_time);
90
91 GST_CHECK_API
92 void gst_test_clock_advance_time (GstTestClock * test_clock,
93 GstClockTimeDiff delta);
94
95 GST_CHECK_API
96 guint gst_test_clock_peek_id_count (GstTestClock * test_clock);
97
98 GST_CHECK_API
99 gboolean gst_test_clock_has_id (GstTestClock * test_clock, GstClockID id);
100
101 GST_CHECK_API
102 gboolean gst_test_clock_peek_next_pending_id (GstTestClock * test_clock,
103 GstClockID * pending_id);
104
105 GST_CHECK_API
106 void gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock,
107 GstClockID * pending_id);
108
109 GST_CHECK_DEPRECATED_FOR(gst_test_clock_wait_for_multiple_pending_ids)
110 void gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock,
111 guint count);
112
113 GST_CHECK_API
114 GstClockID gst_test_clock_process_next_clock_id (GstTestClock * test_clock) G_GNUC_WARN_UNUSED_RESULT;
115
116 GST_CHECK_API
117 GstClockTime gst_test_clock_get_next_entry_time (GstTestClock * test_clock);
118
119 GST_CHECK_API
120 void gst_test_clock_wait_for_multiple_pending_ids (GstTestClock * test_clock,
121 guint count,
122 GList ** pending_list);
123
124 GST_CHECK_API
125 gboolean gst_test_clock_timed_wait_for_multiple_pending_ids (GstTestClock * test_clock,
126 guint count,
127 guint timeout_ms,
128 GList ** pending_list);
129
130 GST_CHECK_API
131 gboolean gst_test_clock_process_id (GstTestClock * test_clock,
132 GstClockID pending_id);
133
134 GST_CHECK_API
135 guint gst_test_clock_process_id_list (GstTestClock * test_clock,
136 const GList * pending_list);
137
138 GST_CHECK_API
139 GstClockTime gst_test_clock_id_list_get_latest_time (const GList * pending_list);
140
141 GST_CHECK_API
142 gboolean gst_test_clock_crank (GstTestClock * test_clock);
143
144 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTestClock, gst_object_unref)
145
146 G_END_DECLS
147
148 #endif /* __GST_TEST_CLOCK_H__ */