blob: f4605eefdc0c70eeee19adb02e47559ed2de9928 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GStreamer 1.0 Library Reference Manual: GstTestClock</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="GStreamer 1.0 Library Reference Manual">
<link rel="up" href="gstreamer-check.html" title="GStreamer Check Unit Testing">
<link rel="prev" href="gstreamer-libs-GstStreamConsistency.html" title="GstStreamConsistency">
<link rel="next" href="gstreamer-hierarchy.html" title="Object Hierarchy">
<meta name="generator" content="GTK-Doc V1.20 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="10"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> 
<a href="#GstTestClock.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> 
<a href="#GstTestClock.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties"> <span class="dim">|</span> 
<a href="#GstTestClock.properties" class="shortcut">Properties</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="gstreamer-check.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gstreamer-libs-GstStreamConsistency.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gstreamer-hierarchy.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="GstTestClock"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GstTestClock.top_of_page"></a>GstTestClock</span></h2>
<p>GstTestClock — Controllable, deterministic clock for GStreamer unit tests</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="GstTestClock.functions"></a><h2>Functions</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html"><span class="returnvalue">GstClock</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstTestClock.html#gst-test-clock-new" title="gst_test_clock_new ()">gst_test_clock_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html"><span class="returnvalue">GstClock</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstTestClock.html#gst-test-clock-new-with-start-time" title="gst_test_clock_new_with_start_time ()">gst_test_clock_new_with_start_time</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GstTestClock.html#gst-test-clock-set-time" title="gst_test_clock_set_time ()">gst_test_clock_set_time</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GstTestClock.html#gst-test-clock-advance-time" title="gst_test_clock_advance_time ()">gst_test_clock_advance_time</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>
</td>
<td class="function_name">
<a class="link" href="GstTestClock.html#gst-test-clock-peek-id-count" title="gst_test_clock_peek_id_count ()">gst_test_clock_peek_id_count</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GstTestClock.html#gst-test-clock-has-id" title="gst_test_clock_has_id ()">gst_test_clock_has_id</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GstTestClock.html#gst-test-clock-peek-next-pending-id" title="gst_test_clock_peek_next_pending_id ()">gst_test_clock_peek_next_pending_id</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GstTestClock.html#gst-test-clock-wait-for-next-pending-id" title="gst_test_clock_wait_for_next_pending_id ()">gst_test_clock_wait_for_next_pending_id</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GstTestClock.html#gst-test-clock-wait-for-pending-id-count" title="gst_test_clock_wait_for_pending_id_count ()">gst_test_clock_wait_for_pending_id_count</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockID"><span class="returnvalue">GstClockID</span></a>
</td>
<td class="function_name">
<a class="link" href="GstTestClock.html#gst-test-clock-process-next-clock-id" title="gst_test_clock_process_next_clock_id ()">gst_test_clock_process_next_clock_id</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a>
</td>
<td class="function_name">
<a class="link" href="GstTestClock.html#gst-test-clock-get-next-entry-time" title="gst_test_clock_get_next_entry_time ()">gst_test_clock_get_next_entry_time</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GstTestClock.properties"></a><h2>Properties</h2>
<div class="informaltable"><table border="0">
<colgroup>
<col width="150px" class="properties_type">
<col width="300px" class="properties_name">
<col width="200px" class="properties_flags">
</colgroup>
<tbody><tr>
<td class="property_type"><span class="type">guint64</span></td>
<td class="property_name"><a class="link" href="GstTestClock.html#GstTestClock--start-time" title="The “start-time” property">start-time</a></td>
<td class="property_flags">Read / Write / Construct Only</td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GstTestClock.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="GstTestClock.html#GstTestClock-struct" title="struct GstTestClock">GstTestClock</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="GstTestClock.html#GstTestClockClass" title="struct GstTestClockClass">GstTestClockClass</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GstTestClock.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen"> <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
<span class="lineart">╰──</span> <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
<span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
<span class="lineart">╰──</span> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html">GstClock</a>
<span class="lineart">╰──</span> GstTestClock
</pre>
</div>
<div class="refsect1">
<a name="GstTestClock.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gst/check/gsttestclock.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="GstTestClock.description"></a><h2>Description</h2>
<p>GstTestClock is an implementation of <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html"><span class="type">GstClock</span></a> which has different
behaviour compared to <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstSystemClock.html"><span class="type">GstSystemClock</span></a>. Time for <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstSystemClock.html"><span class="type">GstSystemClock</span></a> advances
according to the system time, while time for <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> changes only
when <a class="link" href="GstTestClock.html#gst-test-clock-set-time" title="gst_test_clock_set_time ()"><code class="function">gst_test_clock_set_time()</code></a> or <a class="link" href="GstTestClock.html#gst-test-clock-advance-time" title="gst_test_clock_advance_time ()"><code class="function">gst_test_clock_advance_time()</code></a> are
called. <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> provides unit tests with the possibility to
precisely advance the time in a deterministic manner, independent of the
system time or any other external factors.</p>
<div class="example">
<a name="id-1.2.7.6.8.3"></a><p class="title"><b>Example 1. Advancing the time of a <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a></b></p>
<div class="example-contents">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#include &lt;gst/gst.h&gt;</span>
<span class="gtkdoc ppc">#include &lt;gst/check/gsttestclock.h&gt;</span>
GstClock <span class="gtkdoc opt">*</span>clock<span class="gtkdoc opt">;</span>
GstTestClock <span class="gtkdoc opt">*</span>test_clock<span class="gtkdoc opt">;</span>
clock <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstTestClock.html#gst-test-clock-new">gst_test_clock_new</a></span> <span class="gtkdoc opt">();</span>
test_clock <span class="gtkdoc opt">=</span> <span class="function">GST_TEST_CLOCK</span> <span class="gtkdoc opt">(</span>clock<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Time: %&quot;</span> GST_TIME_FORMAT<span class="gtkdoc opt">,</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-TIME-ARGS:CAPS">GST_TIME_ARGS</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-get-time">gst_clock_get_time</a></span> <span class="gtkdoc opt">(</span>clock<span class="gtkdoc opt">)));</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstTestClock.html#gst-test-clock-advance-time">gst_test_clock_advance_time</a></span> <span class="gtkdoc opt">(</span> test_clock<span class="gtkdoc opt">,</span> <span class="number">1</span> <span class="gtkdoc opt">*</span> GST_SECOND<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Time: %&quot;</span> GST_TIME_FORMAT<span class="gtkdoc opt">,</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-TIME-ARGS:CAPS">GST_TIME_ARGS</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-get-time">gst_clock_get_time</a></span> <span class="gtkdoc opt">(</span>clock<span class="gtkdoc opt">)));</span>
<span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Date-and-Time-Functions.html#g-usleep">g_usleep</a></span> <span class="gtkdoc opt">(</span><span class="number">10</span> <span class="gtkdoc opt">*</span> G_USEC_PER_SEC<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Time: %&quot;</span> GST_TIME_FORMAT<span class="gtkdoc opt">,</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-TIME-ARGS:CAPS">GST_TIME_ARGS</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-get-time">gst_clock_get_time</a></span> <span class="gtkdoc opt">(</span>clock<span class="gtkdoc opt">)));</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstTestClock.html#gst-test-clock-set-time">gst_test_clock_set_time</a></span> <span class="gtkdoc opt">(</span>test_clock<span class="gtkdoc opt">,</span> <span class="number">42</span> <span class="gtkdoc opt">*</span> GST_SECOND<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Time: %&quot;</span> GST_TIME_FORMAT<span class="gtkdoc opt">,</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-TIME-ARGS:CAPS">GST_TIME_ARGS</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-get-time">gst_clock_get_time</a></span> <span class="gtkdoc opt">(</span>clock<span class="gtkdoc opt">)));</span>
<span class="gtkdoc opt">...</span></pre></td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="example-break"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html"><span class="type">GstClock</span></a> allows for setting up single shot or periodic clock notifications
as well as waiting for these notifications synchronously (using
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-id-wait"><code class="function">gst_clock_id_wait()</code></a>) or asynchronously (using <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-id-wait-async"><code class="function">gst_clock_id_wait_async()</code></a> or
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-id-wait-async"><code class="function">gst_clock_id_wait_async()</code></a>). This is used by many GStreamer elements,
among them <a class="link" href="GstBaseSrc.html" title="GstBaseSrc"><span class="type">GstBaseSrc</span></a> and <a class="link" href="GstBaseSink.html" title="GstBaseSink"><span class="type">GstBaseSink</span></a>.</p>
<p><a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> keeps track of these clock notifications. By calling
<a class="link" href="GstTestClock.html#gst-test-clock-wait-for-next-pending-id" title="gst_test_clock_wait_for_next_pending_id ()"><code class="function">gst_test_clock_wait_for_next_pending_id()</code></a> or
<code class="function">gst_test_clock_wait_for_multiple_pending_ids()</code> a unit tests may wait for the
next one or several clock notifications to be requested. Additionally unit
tests may release blocked waits in a controlled fashion by calling
<a class="link" href="GstTestClock.html#gst-test-clock-process-next-clock-id" title="gst_test_clock_process_next_clock_id ()"><code class="function">gst_test_clock_process_next_clock_id()</code></a>. This way a unit test can control the
inaccuracy (jitter) of clock notifications, since the test can decide to
release blocked waits when the clock time has advanced exactly to, or past,
the requested clock notification time.</p>
<p>There are also interfaces for determining if a notification belongs to a
<a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> or not, as well as getting the number of requested clock
notifications so far.</p>
<p>N.B.: When a unit test waits for a certain amount of clock notifications to
be requested in <a class="link" href="GstTestClock.html#gst-test-clock-wait-for-next-pending-id" title="gst_test_clock_wait_for_next_pending_id ()"><code class="function">gst_test_clock_wait_for_next_pending_id()</code></a> or
<code class="function">gst_test_clock_wait_for_multiple_pending_ids()</code> then these functions may block
for a long time. If they block forever then the expected clock notifications
were never requested from <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a>, and so the assumptions in the code
of the unit test are wrong. The unit test case runner in gstcheck is
expected to catch these cases either by the default test case timeout or the
one set for the unit test by calling <code class="function">tcase_set_timeout()</code>.</p>
<p>The sample code below assumes that the element under test will delay a
buffer pushed on the source pad by some latency until it arrives on the sink
pad. Moreover it is assumed that the element will at some point call
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-id-wait"><code class="function">gst_clock_id_wait()</code></a> to synchronously wait for a specific time. The first
buffer sent will arrive exactly on time only delayed by the latency. The
second buffer will arrive a little late (7ms) due to simulated jitter in the
clock notification.</p>
<div class="example">
<a name="id-1.2.7.6.8.9"></a><p class="title"><b>Example 2. Demonstration of how to work with clock notifications and <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a></b></p>
<div class="example-contents">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc">#include &lt;gst/gst.h&gt;</span>
<span class="gtkdoc ppc">#include &lt;gst/check/gstcheck.h&gt;</span>
<span class="gtkdoc ppc">#include &lt;gst/check/gsttestclock.h&gt;</span>
GstClockTime latency<span class="gtkdoc opt">;</span>
GstElement <span class="gtkdoc opt">*</span>element<span class="gtkdoc opt">;</span>
GstPad <span class="gtkdoc opt">*</span>srcpad<span class="gtkdoc opt">;</span>
GstClock <span class="gtkdoc opt">*</span>clock<span class="gtkdoc opt">;</span>
GstTestClock <span class="gtkdoc opt">*</span>test_clock<span class="gtkdoc opt">;</span>
GstBuffer buf<span class="gtkdoc opt">;</span>
GstClockID pending_id<span class="gtkdoc opt">;</span>
GstClockID processed_id<span class="gtkdoc opt">;</span>
latency <span class="gtkdoc opt">=</span> <span class="number">42</span> <span class="gtkdoc opt">*</span> GST_MSECOND<span class="gtkdoc opt">;</span>
element <span class="gtkdoc opt">=</span> <span class="function">create_element</span> <span class="gtkdoc opt">(</span>latency<span class="gtkdoc opt">, ...);</span>
srcpad <span class="gtkdoc opt">=</span> <span class="function">get_source_pad</span> <span class="gtkdoc opt">(</span>element<span class="gtkdoc opt">);</span>
clock <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstTestClock.html#gst-test-clock-new">gst_test_clock_new</a></span> <span class="gtkdoc opt">();</span>
test_clock <span class="gtkdoc opt">=</span> <span class="function">GST_TEST_CLOCK</span> <span class="gtkdoc opt">(</span>clock<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-set-clock">gst_element_set_clock</a></span> <span class="gtkdoc opt">(</span>element<span class="gtkdoc opt">,</span> clock<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Set time, create and push the first buffer</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstTestClock.html#gst-test-clock-set-time">gst_test_clock_set_time</a></span> <span class="gtkdoc opt">(</span>test_clock<span class="gtkdoc opt">,</span> <span class="number">0</span><span class="gtkdoc opt">);</span>
buf <span class="gtkdoc opt">=</span> <span class="function">create_test_buffer</span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-get-time">gst_clock_get_time</a></span> <span class="gtkdoc opt">(</span>clock<span class="gtkdoc opt">), ...);</span>
<span class="function">gst_assert_cmpint</span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html#gst-pad-push">gst_pad_push</a></span> <span class="gtkdoc opt">(</span>srcpad<span class="gtkdoc opt">,</span> buf<span class="gtkdoc opt">), ==,</span> GST_FLOW_OK<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Block until element is waiting for a clock notification</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstTestClock.html#gst-test-clock-wait-for-next-pending-id">gst_test_clock_wait_for_next_pending_id</a></span> <span class="gtkdoc opt">(</span>test_clock<span class="gtkdoc opt">, &amp;</span>pending_id<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Advance to the requested time of the clock notification</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstTestClock.html#gst-test-clock-advance-time">gst_test_clock_advance_time</a></span> <span class="gtkdoc opt">(</span>test_clock<span class="gtkdoc opt">,</span> latency<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Release the next blocking wait and make sure it is the one from element</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
processed_id <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstTestClock.html#gst-test-clock-process-next-clock-id">gst_test_clock_process_next_clock_id</a></span> <span class="gtkdoc opt">(</span>test_clock<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span> <span class="gtkdoc opt">(</span>processed_id <span class="gtkdoc opt">==</span> pending_id<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-cmpint">g_assert_cmpint</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GST-CLOCK-ENTRY-STATUS:CAPS">GST_CLOCK_ENTRY_STATUS</a></span> <span class="gtkdoc opt">(</span>processed_id<span class="gtkdoc opt">), ==,</span> GST_CLOCK_OK<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-id-unref">gst_clock_id_unref</a></span> <span class="gtkdoc opt">(</span>pending_id<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-id-unref">gst_clock_id_unref</a></span> <span class="gtkdoc opt">(</span>processed_id<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Validate that element produced an output buffer and check its timestamp</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-cmpint">g_assert_cmpint</a></span> <span class="gtkdoc opt">(</span><span class="function">get_number_of_output_buffer</span> <span class="gtkdoc opt">(...), ==,</span> <span class="number">1</span><span class="gtkdoc opt">);</span>
buf <span class="gtkdoc opt">=</span> <span class="function">get_buffer_pushed_by_element</span> <span class="gtkdoc opt">(</span>element<span class="gtkdoc opt">, ...);</span>
<span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-cmpint">g_assert_cmpint</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#GST-BUFFER-TIMESTAMP:CAPS">GST_BUFFER_TIMESTAMP</a></span> <span class="gtkdoc opt">(</span>buf<span class="gtkdoc opt">), ==,</span> latency<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html#gst-buffer-unref">gst_buffer_unref</a></span> <span class="gtkdoc opt">(</span>buf<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Check that element does not wait for any clock notification</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstTestClock.html#gst-test-clock-peek-next-pending-id">gst_test_clock_peek_next_pending_id</a></span> <span class="gtkdoc opt">(</span>test_clock<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">) ==</span> FALSE<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Set time, create and push the second buffer</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstTestClock.html#gst-test-clock-advance-time">gst_test_clock_advance_time</a></span> <span class="gtkdoc opt">(</span>test_clock<span class="gtkdoc opt">,</span> <span class="number">10</span> <span class="gtkdoc opt">*</span> GST_SECOND<span class="gtkdoc opt">);</span>
buf <span class="gtkdoc opt">=</span> <span class="function">create_test_buffer</span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-get-time">gst_clock_get_time</a></span> <span class="gtkdoc opt">(</span>clock<span class="gtkdoc opt">), ...);</span>
<span class="function">gst_assert_cmpint</span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html#gst-pad-push">gst_pad_push</a></span> <span class="gtkdoc opt">(</span>srcpad<span class="gtkdoc opt">,</span> buf<span class="gtkdoc opt">), ==,</span> GST_FLOW_OK<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Block until element is waiting for a new clock notification</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstTestClock.html#gst-test-clock-wait-for-next-pending-id">gst_test_clock_wait_for_next_pending_id</a></span> <span class="gtkdoc opt">(</span>test_clock<span class="gtkdoc opt">, &amp;</span>pending_id<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Advance past 7ms beyond the requested time of the clock notification</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstTestClock.html#gst-test-clock-advance-time">gst_test_clock_advance_time</a></span> <span class="gtkdoc opt">(</span>test_clock<span class="gtkdoc opt">,</span> latency <span class="gtkdoc opt">+</span> <span class="number">7</span> <span class="gtkdoc opt">*</span> GST_MSECOND<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Release the next blocking wait and make sure it is the one from element</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
processed_id <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstTestClock.html#gst-test-clock-process-next-clock-id">gst_test_clock_process_next_clock_id</a></span> <span class="gtkdoc opt">(</span>test_clock<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span> <span class="gtkdoc opt">(</span>processed_id <span class="gtkdoc opt">==</span> pending_id<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-cmpint">g_assert_cmpint</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GST-CLOCK-ENTRY-STATUS:CAPS">GST_CLOCK_ENTRY_STATUS</a></span> <span class="gtkdoc opt">(</span>processed_id<span class="gtkdoc opt">), ==,</span> GST_CLOCK_OK<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-id-unref">gst_clock_id_unref</a></span> <span class="gtkdoc opt">(</span>pending_id<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-id-unref">gst_clock_id_unref</a></span> <span class="gtkdoc opt">(</span>processed_id<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Validate that element produced an output buffer and check its timestamp</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-cmpint">g_assert_cmpint</a></span> <span class="gtkdoc opt">(</span><span class="function">get_number_of_output_buffer</span> <span class="gtkdoc opt">(...), ==,</span> <span class="number">1</span><span class="gtkdoc opt">);</span>
buf <span class="gtkdoc opt">=</span> <span class="function">get_buffer_pushed_by_element</span> <span class="gtkdoc opt">(</span>element<span class="gtkdoc opt">, ...);</span>
<span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-cmpint">g_assert_cmpint</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#GST-BUFFER-TIMESTAMP:CAPS">GST_BUFFER_TIMESTAMP</a></span> <span class="gtkdoc opt">(</span>buf<span class="gtkdoc opt">), ==,</span>
<span class="number">10</span> <span class="gtkdoc opt">*</span> GST_SECOND <span class="gtkdoc opt">+</span> latency <span class="gtkdoc opt">+</span> <span class="number">7</span> <span class="gtkdoc opt">*</span> GST_MSECOND<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html#gst-buffer-unref">gst_buffer_unref</a></span> <span class="gtkdoc opt">(</span>buf<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-INFO:CAPS">GST_INFO</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Check that element does not wait for any clock notification</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
<span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstTestClock.html#gst-test-clock-peek-next-pending-id">gst_test_clock_peek_next_pending_id</a></span> <span class="gtkdoc opt">(</span>test_clock<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">) ==</span> FALSE<span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">...</span></pre></td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="example-break"><p>Since <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> is only supposed to be used in unit tests it calls
<a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert"><code class="function">g_assert()</code></a>, <a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-cmpint"><code class="function">g_assert_cmpint()</code></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-cmpuint"><code class="function">g_assert_cmpuint()</code></a> to validate all function
arguments. This will highlight any issues with the unit test code itself.</p>
</div>
<div class="refsect1">
<a name="GstTestClock.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gst-test-clock-new"></a><h3>gst_test_clock_new ()</h3>
<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html"><span class="returnvalue">GstClock</span></a> *
gst_test_clock_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Creates a new test clock with its time set to zero.</p>
<p>MT safe.</p>
<div class="refsect3">
<a name="id-1.2.7.6.9.2.6"></a><h4>Returns</h4>
<p> a <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> cast to <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html"><span class="type">GstClock</span></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gst-test-clock-new-with-start-time"></a><h3>gst_test_clock_new_with_start_time ()</h3>
<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html"><span class="returnvalue">GstClock</span></a> *
gst_test_clock_new_with_start_time (<em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a> start_time</code></em>);</pre>
<p>Creates a new test clock with its time set to the specified time.</p>
<p>MT safe.</p>
<div class="refsect3">
<a name="id-1.2.7.6.9.3.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>start_time</p></td>
<td class="parameter_description"><p>a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a> set to the desired start time of the clock.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.7.6.9.3.7"></a><h4>Returns</h4>
<p> a <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> cast to <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html"><span class="type">GstClock</span></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gst-test-clock-set-time"></a><h3>gst_test_clock_set_time ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_test_clock_set_time (<em class="parameter"><code><a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> *test_clock</code></em>,
<em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a> new_time</code></em>);</pre>
<p>Sets the time of <em class="parameter"><code>test_clock</code></em>
to the time given by <em class="parameter"><code>new_time</code></em>
. The time of
<em class="parameter"><code>test_clock</code></em>
is monotonically increasing, therefore providing a <em class="parameter"><code>new_time</code></em>
which is earlier or equal to the time of the clock as given by
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-get-time"><code class="function">gst_clock_get_time()</code></a> is a programming error.</p>
<p>MT safe.</p>
<div class="refsect3">
<a name="id-1.2.7.6.9.4.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>test_clock</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> of which to set the time</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>new_time</p></td>
<td class="parameter_description"><p>a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a> later than that returned by <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#gst-clock-get-time"><code class="function">gst_clock_get_time()</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gst-test-clock-advance-time"></a><h3>gst_test_clock_advance_time ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_test_clock_advance_time (<em class="parameter"><code><a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> *test_clock</code></em>,
<em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTimeDiff"><span class="type">GstClockTimeDiff</span></a> delta</code></em>);</pre>
<p>Advances the time of the <em class="parameter"><code>test_clock</code></em>
by the amount given by <em class="parameter"><code>delta</code></em>
. The
time of <em class="parameter"><code>test_clock</code></em>
is monotonically increasing, therefore providing a
<em class="parameter"><code>delta</code></em>
which is negative or zero is a programming error.</p>
<p>MT safe.</p>
<div class="refsect3">
<a name="id-1.2.7.6.9.5.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>test_clock</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> for which to increase the time</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>delta</p></td>
<td class="parameter_description"><p>a positive <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTimeDiff"><span class="type">GstClockTimeDiff</span></a> to be added to the time of the clock</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gst-test-clock-peek-id-count"></a><h3>gst_test_clock_peek_id_count ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>
gst_test_clock_peek_id_count (<em class="parameter"><code><a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> *test_clock</code></em>);</pre>
<p>Determine the number of pending clock notifications that have been
requested from the <em class="parameter"><code>test_clock</code></em>
.</p>
<p>MT safe.</p>
<div class="refsect3">
<a name="id-1.2.7.6.9.6.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>test_clock</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> for which to count notifications</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.7.6.9.6.7"></a><h4>Returns</h4>
<p> the number of pending clock notifications.</p>
<p></p>
</div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gst-test-clock-has-id"></a><h3>gst_test_clock_has_id ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
gst_test_clock_has_id (<em class="parameter"><code><a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> *test_clock</code></em>,
<em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockID"><span class="type">GstClockID</span></a> id</code></em>);</pre>
<p>Checks whether <em class="parameter"><code>test_clock</code></em>
was requested to provide the clock notification
given by <em class="parameter"><code>id</code></em>
.</p>
<p>MT safe.</p>
<div class="refsect3">
<a name="id-1.2.7.6.9.7.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>test_clock</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> to ask if it provided the notification</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>id</p></td>
<td class="parameter_description"><p> a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockID"><span class="type">GstClockID</span></a> clock notification. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.7.6.9.7.7"></a><h4>Returns</h4>
<p> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the clock has been asked to provide the given clock
notification, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</p>
<p></p>
</div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gst-test-clock-peek-next-pending-id"></a><h3>gst_test_clock_peek_next_pending_id ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
gst_test_clock_peek_next_pending_id (<em class="parameter"><code><a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> *test_clock</code></em>,
<em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockID"><span class="type">GstClockID</span></a> *pending_id</code></em>);</pre>
<p>Determines if the <em class="parameter"><code>pending_id</code></em>
is the next clock notification scheduled to
be triggered given the current time of the <em class="parameter"><code>test_clock</code></em>
.</p>
<p>MT safe.</p>
<p>Return: <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>pending_id</code></em>
is the next clock notification to be
triggered, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</p>
<div class="refsect3">
<a name="id-1.2.7.6.9.8.7"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>test_clock</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> to check the clock notifications for</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>pending_id</p></td>
<td class="parameter_description"><p> a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockID"><span class="type">GstClockID</span></a> clock
notification to look for. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gst-test-clock-wait-for-next-pending-id"></a><h3>gst_test_clock_wait_for_next_pending_id ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_test_clock_wait_for_next_pending_id
(<em class="parameter"><code><a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> *test_clock</code></em>,
<em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockID"><span class="type">GstClockID</span></a> *pending_id</code></em>);</pre>
<p>Waits until a clock notification is requested from <em class="parameter"><code>test_clock</code></em>
. There is no
timeout for this wait, see the main description of <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a>. A reference
to the pending clock notification is stored in <em class="parameter"><code>pending_id</code></em>
.</p>
<p>MT safe.</p>
<div class="refsect3">
<a name="id-1.2.7.6.9.9.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>test_clock</p></td>
<td class="parameter_description"><p><a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> for which to get the pending clock notification</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>pending_id</p></td>
<td class="parameter_description"><p> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockID"><span class="type">GstClockID</span></a>
with information about the pending clock notification. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gst-test-clock-wait-for-pending-id-count"></a><h3>gst_test_clock_wait_for_pending_id_count ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_test_clock_wait_for_pending_id_count
(<em class="parameter"><code><a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> *test_clock</code></em>,
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> count</code></em>);</pre>
<div class="warning">
<p><code class="literal">gst_test_clock_wait_for_pending_id_count</code> is deprecated and should not be used in newly-written code.</p>
<p>use <code class="function">gst_test_clock_wait_for_multiple_pending_ids()</code> instead.</p>
</div>
<p>Blocks until at least <em class="parameter"><code>count</code></em>
clock notifications have been requested from
<em class="parameter"><code>test_clock</code></em>
. There is no timeout for this wait, see the main description of
<a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a>.</p>
<div class="refsect3">
<a name="id-1.2.7.6.9.10.7"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>test_clock</p></td>
<td class="parameter_description"><p><a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> for which to await having enough pending clock</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>count</p></td>
<td class="parameter_description"><p>the number of pending clock notifications to wait for</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gst-test-clock-process-next-clock-id"></a><h3>gst_test_clock_process_next_clock_id ()</h3>
<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockID"><span class="returnvalue">GstClockID</span></a>
gst_test_clock_process_next_clock_id (<em class="parameter"><code><a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> *test_clock</code></em>);</pre>
<p>MT safe.</p>
<div class="refsect3">
<a name="id-1.2.7.6.9.11.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>test_clock</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> for which to retrieve the next pending clock
notification</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.7.6.9.11.6"></a><h4>Returns</h4>
<p> a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockID"><span class="type">GstClockID</span></a> containing the next pending clock
notification. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gst-test-clock-get-next-entry-time"></a><h3>gst_test_clock_get_next_entry_time ()</h3>
<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a>
gst_test_clock_get_next_entry_time (<em class="parameter"><code><a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> *test_clock</code></em>);</pre>
<p>Retrieve the requested time for the next pending clock notification.</p>
<p>MT safe.</p>
<div class="refsect3">
<a name="id-1.2.7.6.9.12.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>test_clock</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> to fetch the next clock notification time for</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.7.6.9.12.7"></a><h4>Returns</h4>
<p> a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a> set to the time of the next pending clock
notification. If no clock notifications have been requested
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GST-CLOCK-TIME-NONE:CAPS"><code class="literal">GST_CLOCK_TIME_NONE</code></a> will be returned.</p>
<p></p>
</div>
<p class="since">Since 1.2</p>
</div>
</div>
<div class="refsect1">
<a name="GstTestClock.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GstTestClock-struct"></a><h3>struct GstTestClock</h3>
<pre class="programlisting">struct GstTestClock;</pre>
<p>A <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> structure which is based on a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html"><span class="type">GstClock</span></a> along with some
private data.</p>
<p class="since">Since 1.2</p>
</div>
<hr>
<div class="refsect2">
<a name="GstTestClockClass"></a><h3>struct GstTestClockClass</h3>
<pre class="programlisting">struct GstTestClockClass {
GstClockClass parent_class;
};
</pre>
<p>The class of a <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a>, which has no virtual methods to override.</p>
<div class="refsect3">
<a name="id-1.2.7.6.10.3.5"></a><h4>Members</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody><tr>
<td class="struct_member_name"><p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockClass"><span class="type">GstClockClass</span></a> <em class="structfield"><code><a name="GstTestClockClass.parent-class"></a>parent_class</code></em>;</p></td>
<td class="struct_member_description"><p>the parent class structure</p></td>
<td class="struct_member_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since 1.2</p>
</div>
</div>
<div class="refsect1">
<a name="GstTestClock.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GstTestClock--start-time"></a><h3>The <code class="literal">“start-time”</code> property</h3>
<pre class="programlisting"> “start-time” <span class="type">guint64</span></pre>
<p>When a <a class="link" href="GstTestClock.html" title="GstTestClock"><span class="type">GstTestClock</span></a> is constructed it will have a certain start time set.
If the clock was created using <a class="link" href="GstTestClock.html#gst-test-clock-new-with-start-time" title="gst_test_clock_new_with_start_time ()"><code class="function">gst_test_clock_new_with_start_time()</code></a> then
this property contains the value of the <em class="parameter"><code>start_time</code></em>
argument. If
<a class="link" href="GstTestClock.html#gst-test-clock-new" title="gst_test_clock_new ()"><code class="function">gst_test_clock_new()</code></a> was called the clock started at time zero, and thus
this property contains the value 0.</p>
<p>Flags: Read / Write / Construct Only</p>
<p>Default value: 0</p>
</div>
</div>
<div class="refsect1">
<a name="GstTestClock.see-also"></a><h2>See Also</h2>
<p><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstSystemClock.html"><span class="type">GstSystemClock</span></a>, <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html"><span class="type">GstClock</span></a></p>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.20</div>
</body>
</html>