blob: 114ff4eab95a1f4acbcb1f931e042d51c10f8b33 [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>GstAdapter: GStreamer 1.0 Library Reference Manual</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-base.html" title="GStreamer Base and Utillity Classes">
<link rel="prev" href="GstPushSrc.html" title="GstPushSrc">
<link rel="next" href="gstreamer-libs-GstBitReader.html" title="GstBitReader">
<meta name="generator" content="GTK-Doc V1.24 (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="5"><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="#GstAdapter.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
<a href="#GstAdapter.object-hierarchy" class="shortcut">Object Hierarchy</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-base.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="GstPushSrc.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gstreamer-libs-GstBitReader.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="GstAdapter"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GstAdapter.top_of_page"></a>GstAdapter</span></h2>
<p>GstAdapter — adapts incoming data on a sink pad into chunks of N bytes</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="GstAdapter.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 class="link" href="GstAdapter.html" title="GstAdapter"><span class="returnvalue">GstAdapter</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-new" title="gst_adapter_new ()">gst_adapter_new</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="GstAdapter.html#gst-adapter-clear" title="gst_adapter_clear ()">gst_adapter_clear</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="GstAdapter.html#gst-adapter-push" title="gst_adapter_push ()">gst_adapter_push</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gconstpointer"><span class="returnvalue">gconstpointer</span></a>
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-map" title="gst_adapter_map ()">gst_adapter_map</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="GstAdapter.html#gst-adapter-unmap" title="gst_adapter_unmap ()">gst_adapter_unmap</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="GstAdapter.html#gst-adapter-copy" title="gst_adapter_copy ()">gst_adapter_copy</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="returnvalue">GBytes</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-copy-bytes" title="gst_adapter_copy_bytes ()">gst_adapter_copy_bytes</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="GstAdapter.html#gst-adapter-flush" title="gst_adapter_flush ()">gst_adapter_flush</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gsize</span>
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-available" title="gst_adapter_available ()">gst_adapter_available</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gsize</span>
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-available-fast" title="gst_adapter_available_fast ()">gst_adapter_available_fast</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-take" title="gst_adapter_take ()">gst_adapter_take</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/GstBuffer.html"><span class="returnvalue">GstBuffer</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-take-buffer" title="gst_adapter_take_buffer ()">gst_adapter_take_buffer</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/GstBuffer.html"><span class="returnvalue">GstBuffer</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-get-buffer" title="gst_adapter_get_buffer ()">gst_adapter_get_buffer</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/GstBuffer.html"><span class="returnvalue">GstBuffer</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-take-buffer-fast" title="gst_adapter_take_buffer_fast ()">gst_adapter_take_buffer_fast</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/GstBuffer.html"><span class="returnvalue">GstBuffer</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-get-buffer-fast" title="gst_adapter_get_buffer_fast ()">gst_adapter_get_buffer_fast</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-take-list" title="gst_adapter_take_list ()">gst_adapter_take_list</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-get-list" title="gst_adapter_get_list ()">gst_adapter_get_list</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/GstBufferList.html"><span class="returnvalue">GstBufferList</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-take-buffer-list" title="gst_adapter_take_buffer_list ()">gst_adapter_take_buffer_list</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/GstBufferList.html"><span class="returnvalue">GstBufferList</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-get-buffer-list" title="gst_adapter_get_buffer_list ()">gst_adapter_get_buffer_list</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="GstAdapter.html#gst-adapter-prev-pts" title="gst_adapter_prev_pts ()">gst_adapter_prev_pts</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="GstAdapter.html#gst-adapter-prev-dts" title="gst_adapter_prev_dts ()">gst_adapter_prev_dts</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="GstAdapter.html#gst-adapter-prev-pts-at-offset" title="gst_adapter_prev_pts_at_offset ()">gst_adapter_prev_pts_at_offset</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="GstAdapter.html#gst-adapter-prev-dts-at-offset" title="gst_adapter_prev_dts_at_offset ()">gst_adapter_prev_dts_at_offset</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gssize</span>
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-masked-scan-uint32" title="gst_adapter_masked_scan_uint32 ()">gst_adapter_masked_scan_uint32</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gssize</span>
</td>
<td class="function_name">
<a class="link" href="GstAdapter.html#gst-adapter-masked-scan-uint32-peek" title="gst_adapter_masked_scan_uint32_peek ()">gst_adapter_masked_scan_uint32_peek</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GstAdapter.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"> </td>
<td class="function_name"><a class="link" href="GstAdapter.html#GstAdapter-struct" title="GstAdapter">GstAdapter</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GstAdapter.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen"> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
<span class="lineart">╰──</span> GstAdapter
</pre>
</div>
<div class="refsect1">
<a name="GstAdapter.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gst/base/gstadapter.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="GstAdapter.description"></a><h2>Description</h2>
<p>This class is for elements that receive buffers in an undesired size.
While for example raw video contains one image per buffer, the same is not
true for a lot of other formats, especially those that come directly from
a file. So if you have undefined buffer sizes and require a specific size,
this object is for you.</p>
<p>An adapter is created with <a class="link" href="GstAdapter.html#gst-adapter-new" title="gst_adapter_new ()"><code class="function">gst_adapter_new()</code></a>. It can be freed again with
<a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.</p>
<p>The theory of operation is like this: All buffers received are put
into the adapter using <a class="link" href="GstAdapter.html#gst-adapter-push" title="gst_adapter_push ()"><code class="function">gst_adapter_push()</code></a> and the data is then read back
in chunks of the desired size using <a class="link" href="GstAdapter.html#gst-adapter-map" title="gst_adapter_map ()"><code class="function">gst_adapter_map()</code></a>/<a class="link" href="GstAdapter.html#gst-adapter-unmap" title="gst_adapter_unmap ()"><code class="function">gst_adapter_unmap()</code></a>
and/or <a class="link" href="GstAdapter.html#gst-adapter-copy" title="gst_adapter_copy ()"><code class="function">gst_adapter_copy()</code></a>. After the data has been processed, it is freed
using <a class="link" href="GstAdapter.html#gst-adapter-unmap" title="gst_adapter_unmap ()"><code class="function">gst_adapter_unmap()</code></a>.</p>
<p>Other methods such as <a class="link" href="GstAdapter.html#gst-adapter-take" title="gst_adapter_take ()"><code class="function">gst_adapter_take()</code></a> and <a class="link" href="GstAdapter.html#gst-adapter-take-buffer" title="gst_adapter_take_buffer ()"><code class="function">gst_adapter_take_buffer()</code></a>
combine <a class="link" href="GstAdapter.html#gst-adapter-map" title="gst_adapter_map ()"><code class="function">gst_adapter_map()</code></a> and <a class="link" href="GstAdapter.html#gst-adapter-unmap" title="gst_adapter_unmap ()"><code class="function">gst_adapter_unmap()</code></a> in one method and are
potentially more convenient for some use cases.</p>
<p>For example, a sink pad's chain function that needs to pass data to a library
in 512-byte chunks could be implemented like this:</p>
<div class="informalexample">
<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</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">static</span> GstFlowReturn
<span class="function">sink_pad_chain</span> <span class="gtkdoc opt">(</span>GstPad <span class="gtkdoc opt">*</span>pad<span class="gtkdoc opt">,</span> GstObject <span class="gtkdoc opt">*</span>parent<span class="gtkdoc opt">,</span> GstBuffer <span class="gtkdoc opt">*</span>buffer<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
MyElement <span class="gtkdoc opt">*</span><span class="keyword">this</span><span class="gtkdoc opt">;</span>
GstAdapter <span class="gtkdoc opt">*</span>adapter<span class="gtkdoc opt">;</span>
GstFlowReturn ret <span class="gtkdoc opt">=</span> GST_FLOW_OK<span class="gtkdoc opt">;</span>
<span class="keyword">this</span> <span class="gtkdoc opt">=</span> <span class="function">MY_ELEMENT</span> <span class="gtkdoc opt">(</span>parent<span class="gtkdoc opt">);</span>
adapter <span class="gtkdoc opt">=</span> <span class="keyword">this</span><span class="gtkdoc opt">-&gt;</span>adapter<span class="gtkdoc opt">;</span>
<span class="gtkdoc slc">// put buffer into adapter</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstAdapter.html#gst-adapter-push">gst_adapter_push</a></span> <span class="gtkdoc opt">(</span>adapter<span class="gtkdoc opt">,</span> buffer<span class="gtkdoc opt">);</span>
<span class="gtkdoc slc">// while we can read out 512 bytes, process them</span>
<span class="keyword">while</span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstAdapter.html#gst-adapter-available">gst_adapter_available</a></span> <span class="gtkdoc opt">(</span>adapter<span class="gtkdoc opt">) &gt;=</span> <span class="number">512</span> <span class="gtkdoc opt">&amp;&amp;</span> ret <span class="gtkdoc opt">==</span> GST_FLOW_OK<span class="gtkdoc opt">) {</span>
<span class="gtkdoc kwb">const</span> guint8 <span class="gtkdoc opt">*</span>data <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstAdapter.html#gst-adapter-map">gst_adapter_map</a></span> <span class="gtkdoc opt">(</span>adapter<span class="gtkdoc opt">,</span> <span class="number">512</span><span class="gtkdoc opt">);</span>
<span class="gtkdoc slc">// use flowreturn as an error value</span>
ret <span class="gtkdoc opt">=</span> <span class="function">my_library_foo</span> <span class="gtkdoc opt">(</span>data<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstAdapter.html#gst-adapter-unmap">gst_adapter_unmap</a></span> <span class="gtkdoc opt">(</span>adapter<span class="gtkdoc opt">);</span>
<span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstAdapter.html#gst-adapter-flush">gst_adapter_flush</a></span> <span class="gtkdoc opt">(</span>adapter<span class="gtkdoc opt">,</span> <span class="number">512</span><span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">}</span>
<span class="keyword">return</span> ret<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>For another example, a simple element inside GStreamer that uses <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>
is the libvisual element.</p>
<p>An element using <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> in its sink pad chain function should ensure that
when the FLUSH_STOP event is received, that any queued data is cleared using
<a class="link" href="GstAdapter.html#gst-adapter-clear" title="gst_adapter_clear ()"><code class="function">gst_adapter_clear()</code></a>. Data should also be cleared or processed on EOS and
when changing state from <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#GST-STATE-PAUSED:CAPS"><code class="literal">GST_STATE_PAUSED</code></a> to <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#GST-STATE-READY:CAPS"><code class="literal">GST_STATE_READY</code></a>.</p>
<p>Also check the GST_BUFFER_FLAG_DISCONT flag on the buffer. Some elements might
need to clear the adapter after a discontinuity.</p>
<p>The adapter will keep track of the timestamps of the buffers
that were pushed. The last seen timestamp before the current position
can be queried with <a class="link" href="GstAdapter.html#gst-adapter-prev-pts" title="gst_adapter_prev_pts ()"><code class="function">gst_adapter_prev_pts()</code></a>. This function can
optionally return the number of bytes between the start of the buffer that
carried the timestamp and the current adapter position. The distance is
useful when dealing with, for example, raw audio samples because it allows
you to calculate the timestamp of the current adapter position by using the
last seen timestamp and the amount of bytes since. Additionally, the
<a class="link" href="GstAdapter.html#gst-adapter-prev-pts-at-offset" title="gst_adapter_prev_pts_at_offset ()"><code class="function">gst_adapter_prev_pts_at_offset()</code></a> can be used to determine the last
seen timestamp at a particular offset in the adapter.</p>
<p>A last thing to note is that while <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> is pretty optimized,
merging buffers still might be an operation that requires a <code class="function">malloc()</code> and
<code class="function">memcpy()</code> operation, and these operations are not the fastest. Because of
this, some functions like <a class="link" href="GstAdapter.html#gst-adapter-available-fast" title="gst_adapter_available_fast ()"><code class="function">gst_adapter_available_fast()</code></a> are provided to help
speed up such cases should you want to. To avoid repeated memory allocations,
<a class="link" href="GstAdapter.html#gst-adapter-copy" title="gst_adapter_copy ()"><code class="function">gst_adapter_copy()</code></a> can be used to copy data into a (statically allocated)
user provided buffer.</p>
<p><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> is not MT safe. All operations on an adapter must be serialized by
the caller. This is not normally a problem, however, as the normal use case
of <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> is inside one pad's chain function, in which case access is
serialized via the pad's STREAM_LOCK.</p>
<p>Note that <a class="link" href="GstAdapter.html#gst-adapter-push" title="gst_adapter_push ()"><code class="function">gst_adapter_push()</code></a> takes ownership of the buffer passed. Use
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html#gst-buffer-ref"><code class="function">gst_buffer_ref()</code></a> before pushing it into the adapter if you still want to
access the buffer later. The adapter will never modify the data in the
buffer pushed in it.</p>
</div>
<div class="refsect1">
<a name="GstAdapter.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gst-adapter-new"></a><h3>gst_adapter_new ()</h3>
<pre class="programlisting"><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="returnvalue">GstAdapter</span></a> *
gst_adapter_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Creates a new <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a>. Free with <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.2.5"></a><h4>Returns</h4>
<p> a new <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</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>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-clear"></a><h3>gst_adapter_clear ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_adapter_clear (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>);</pre>
<p>Removes all buffers from <em class="parameter"><code>adapter</code></em>
.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.3.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-push"></a><h3>gst_adapter_push ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_adapter_push (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> *buf</code></em>);</pre>
<p>Adds the data from <em class="parameter"><code>buf</code></em>
to the data stored inside <em class="parameter"><code>adapter</code></em>
and takes
ownership of the buffer.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.4.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>buf</p></td>
<td class="parameter_description"><p> a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> to add to queue in the adapter. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-map"></a><h3>gst_adapter_map ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gconstpointer"><span class="returnvalue">gconstpointer</span></a>
gst_adapter_map (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">gsize</span> size</code></em>);</pre>
<p>Gets the first <em class="parameter"><code>size</code></em>
bytes stored in the <em class="parameter"><code>adapter</code></em>
. The returned pointer is
valid until the next function is called on the adapter.</p>
<p>Note that setting the returned pointer as the data of a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> is
incorrect for general-purpose plugins. The reason is that if a downstream
element stores the buffer so that it has access to it outside of the bounds
of its chain function, the buffer will have an invalid data pointer after
your element flushes the bytes. In that case you should use
<a class="link" href="GstAdapter.html#gst-adapter-take" title="gst_adapter_take ()"><code class="function">gst_adapter_take()</code></a>, which returns a freshly-allocated buffer that you can set
as <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> memory or the potentially more performant
<a class="link" href="GstAdapter.html#gst-adapter-take-buffer" title="gst_adapter_take_buffer ()"><code class="function">gst_adapter_take_buffer()</code></a>.</p>
<p>Returns <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>size</code></em>
bytes are not available.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.5.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>size</p></td>
<td class="parameter_description"><p>the number of bytes to map/peek</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.5.8"></a><h4>Returns</h4>
<p> a pointer to the first <em class="parameter"><code>size</code></em>
bytes of data, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=size][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-unmap"></a><h3>gst_adapter_unmap ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_adapter_unmap (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>);</pre>
<p>Releases the memory obtained with the last <a class="link" href="GstAdapter.html#gst-adapter-map" title="gst_adapter_map ()"><code class="function">gst_adapter_map()</code></a>.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.6.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-copy"></a><h3>gst_adapter_copy ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_adapter_copy (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> dest</code></em>,
<em class="parameter"><code><span class="type">gsize</span> offset</code></em>,
<em class="parameter"><code><span class="type">gsize</span> size</code></em>);</pre>
<p>Copies <em class="parameter"><code>size</code></em>
bytes of data starting at <em class="parameter"><code>offset</code></em>
out of the buffers
contained in <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> into an array <em class="parameter"><code>dest</code></em>
provided by the caller.</p>
<p>The array <em class="parameter"><code>dest</code></em>
should be large enough to contain <em class="parameter"><code>size</code></em>
bytes.
The user should check that the adapter has (<em class="parameter"><code>offset</code></em>
+ <em class="parameter"><code>size</code></em>
) bytes
available before calling this function.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="id-1.2.4.8.8.7.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dest</p></td>
<td class="parameter_description"><p> the memory to copy into. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Out parameter, where caller must allocate storage."><span class="acronym">out caller-allocates</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=size][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>offset</p></td>
<td class="parameter_description"><p>the bytes offset in the adapter to start from</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>size</p></td>
<td class="parameter_description"><p>the number of bytes to copy</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-copy-bytes"></a><h3>gst_adapter_copy_bytes ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="returnvalue">GBytes</span></a> *
gst_adapter_copy_bytes (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">gsize</span> offset</code></em>,
<em class="parameter"><code><span class="type">gsize</span> size</code></em>);</pre>
<p>Similar to gst_adapter_copy, but more suitable for language bindings. <em class="parameter"><code>size</code></em>
bytes of data starting at <em class="parameter"><code>offset</code></em>
will be copied out of the buffers contained
in <em class="parameter"><code>adapter</code></em>
and into a new <a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> structure which is returned. Depending on
the value of the <em class="parameter"><code>size</code></em>
argument an empty <a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> structure may be returned.</p>
<p><span class="annotation">[<acronym title="Rename the original symbol's name to SYMBOL."><span class="acronym">rename-to</span></acronym> gst_adapter_copy]</span></p>
<div class="refsect3">
<a name="id-1.2.4.8.8.8.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>offset</p></td>
<td class="parameter_description"><p>the bytes offset in the adapter to start from</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>size</p></td>
<td class="parameter_description"><p>the number of bytes to copy</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.8.7"></a><h4>Returns</h4>
<p> A new <a href="https://developer.gnome.org/glib/unstable/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> structure containing the copied data. </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: <a class="link" href="ix04.html#api-index-1.4">1.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-flush"></a><h3>gst_adapter_flush ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_adapter_flush (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">gsize</span> flush</code></em>);</pre>
<p>Flushes the first <em class="parameter"><code>flush</code></em>
bytes in the <em class="parameter"><code>adapter</code></em>
. The caller must ensure that
at least this many bytes are available.</p>
<p>See also: <a class="link" href="GstAdapter.html#gst-adapter-map" title="gst_adapter_map ()"><code class="function">gst_adapter_map()</code></a>, <a class="link" href="GstAdapter.html#gst-adapter-unmap" title="gst_adapter_unmap ()"><code class="function">gst_adapter_unmap()</code></a></p>
<div class="refsect3">
<a name="id-1.2.4.8.8.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>flush</p></td>
<td class="parameter_description"><p>the number of bytes to flush</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-available"></a><h3>gst_adapter_available ()</h3>
<pre class="programlisting"><span class="returnvalue">gsize</span>
gst_adapter_available (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>);</pre>
<p>Gets the maximum amount of bytes available, that is it returns the maximum
value that can be supplied to <a class="link" href="GstAdapter.html#gst-adapter-map" title="gst_adapter_map ()"><code class="function">gst_adapter_map()</code></a> without that function
returning <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.10.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.10.6"></a><h4>Returns</h4>
<p> number of bytes available in <em class="parameter"><code>adapter</code></em>
</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-available-fast"></a><h3>gst_adapter_available_fast ()</h3>
<pre class="programlisting"><span class="returnvalue">gsize</span>
gst_adapter_available_fast (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>);</pre>
<p>Gets the maximum number of bytes that are immediately available without
requiring any expensive operations (like copying the data into a
temporary buffer).</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.11.6"></a><h4>Returns</h4>
<p> number of bytes that are available in <em class="parameter"><code>adapter</code></em>
without expensive
operations</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-take"></a><h3>gst_adapter_take ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
gst_adapter_take (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);</pre>
<p>Returns a freshly allocated buffer containing the first <em class="parameter"><code>nbytes</code></em>
bytes of the
<em class="parameter"><code>adapter</code></em>
. The returned bytes will be flushed from the adapter.</p>
<p>Caller owns returned value. g_free after usage.</p>
<p>Free-function: g_free</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.12.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>nbytes</p></td>
<td class="parameter_description"><p>the number of bytes to take</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.12.8"></a><h4>Returns</h4>
<p> oven-fresh hot data, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>nbytes</code></em>
bytes are not available. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=nbytes][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-take-buffer"></a><h3>gst_adapter_take_buffer ()</h3>
<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="returnvalue">GstBuffer</span></a> *
gst_adapter_take_buffer (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);</pre>
<p>Returns a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> containing the first <em class="parameter"><code>nbytes</code></em>
bytes of the
<em class="parameter"><code>adapter</code></em>
. The returned bytes will be flushed from the adapter.
This function is potentially more performant than
<a class="link" href="GstAdapter.html#gst-adapter-take" title="gst_adapter_take ()"><code class="function">gst_adapter_take()</code></a> since it can reuse the memory in pushed buffers
by subbuffering or merging. This function will always return a
buffer with a single memory region.</p>
<p>Note that no assumptions should be made as to whether certain buffer
flags such as the DISCONT flag are set on the returned buffer, or not.
The caller needs to explicitly set or unset flags that should be set or
unset.</p>
<p>Since 1.6 this will also copy over all GstMeta of the input buffers except
for meta with the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMeta.html#GST-META-FLAG-POOLED:CAPS"><code class="literal">GST_META_FLAG_POOLED</code></a> flag or with the "memory" tag.</p>
<p>Caller owns a reference to the returned buffer. <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html#gst-buffer-unref"><code class="function">gst_buffer_unref()</code></a> after
usage.</p>
<p>Free-function: gst_buffer_unref</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.13.9"></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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>nbytes</p></td>
<td class="parameter_description"><p>the number of bytes to take</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.13.10"></a><h4>Returns</h4>
<p> a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> containing the first
<em class="parameter"><code>nbytes</code></em>
of the adapter, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>nbytes</code></em>
bytes are not available.
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html#gst-buffer-unref"><code class="function">gst_buffer_unref()</code></a> when no longer needed. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-get-buffer"></a><h3>gst_adapter_get_buffer ()</h3>
<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="returnvalue">GstBuffer</span></a> *
gst_adapter_get_buffer (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);</pre>
<p>Returns a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> containing the first <em class="parameter"><code>nbytes</code></em>
of the <em class="parameter"><code>adapter</code></em>
, but
does not flush them from the adapter. See <a class="link" href="GstAdapter.html#gst-adapter-take-buffer" title="gst_adapter_take_buffer ()"><code class="function">gst_adapter_take_buffer()</code></a>
for details.</p>
<p>Caller owns a reference to the returned buffer. <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html#gst-buffer-unref"><code class="function">gst_buffer_unref()</code></a> after
usage.</p>
<p>Free-function: gst_buffer_unref</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.14.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>nbytes</p></td>
<td class="parameter_description"><p>the number of bytes to get</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.14.8"></a><h4>Returns</h4>
<p> a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> containing the first
<em class="parameter"><code>nbytes</code></em>
of the adapter, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>nbytes</code></em>
bytes are not available.
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html#gst-buffer-unref"><code class="function">gst_buffer_unref()</code></a> when no longer needed. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="ix03.html#api-index-1.6">1.6</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-take-buffer-fast"></a><h3>gst_adapter_take_buffer_fast ()</h3>
<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="returnvalue">GstBuffer</span></a> *
gst_adapter_take_buffer_fast (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);</pre>
<p>Returns a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> containing the first <em class="parameter"><code>nbytes</code></em>
of the <em class="parameter"><code>adapter</code></em>
.
The returned bytes will be flushed from the adapter. This function
is potentially more performant than <a class="link" href="GstAdapter.html#gst-adapter-take-buffer" title="gst_adapter_take_buffer ()"><code class="function">gst_adapter_take_buffer()</code></a> since
it can reuse the memory in pushed buffers by subbuffering or
merging. Unlike <a class="link" href="GstAdapter.html#gst-adapter-take-buffer" title="gst_adapter_take_buffer ()"><code class="function">gst_adapter_take_buffer()</code></a>, the returned buffer may
be composed of multiple non-contiguous <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstMemory.html"><span class="type">GstMemory</span></a> objects, no
copies are made.</p>
<p>Note that no assumptions should be made as to whether certain buffer
flags such as the DISCONT flag are set on the returned buffer, or not.
The caller needs to explicitly set or unset flags that should be set or
unset.</p>
<p>This will also copy over all GstMeta of the input buffers except
for meta with the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMeta.html#GST-META-FLAG-POOLED:CAPS"><code class="literal">GST_META_FLAG_POOLED</code></a> flag or with the "memory" tag.</p>
<p>This function can return buffer up to the return value of
<a class="link" href="GstAdapter.html#gst-adapter-available" title="gst_adapter_available ()"><code class="function">gst_adapter_available()</code></a> without making copies if possible.</p>
<p>Caller owns a reference to the returned buffer. <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html#gst-buffer-unref"><code class="function">gst_buffer_unref()</code></a> after
usage.</p>
<p>Free-function: gst_buffer_unref</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.15.10"></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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>nbytes</p></td>
<td class="parameter_description"><p>the number of bytes to take</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.15.11"></a><h4>Returns</h4>
<p> a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> containing the first
<em class="parameter"><code>nbytes</code></em>
of the adapter, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>nbytes</code></em>
bytes are not available.
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html#gst-buffer-unref"><code class="function">gst_buffer_unref()</code></a> when no longer needed. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="ix05.html#api-index-1.2">1.2</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-get-buffer-fast"></a><h3>gst_adapter_get_buffer_fast ()</h3>
<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="returnvalue">GstBuffer</span></a> *
gst_adapter_get_buffer_fast (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);</pre>
<p>Returns a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> containing the first <em class="parameter"><code>nbytes</code></em>
of the <em class="parameter"><code>adapter</code></em>
, but
does not flush them from the adapter. See <a class="link" href="GstAdapter.html#gst-adapter-take-buffer-fast" title="gst_adapter_take_buffer_fast ()"><code class="function">gst_adapter_take_buffer_fast()</code></a>
for details.</p>
<p>Caller owns a reference to the returned buffer. <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html#gst-buffer-unref"><code class="function">gst_buffer_unref()</code></a> after
usage.</p>
<p>Free-function: gst_buffer_unref</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.16.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>nbytes</p></td>
<td class="parameter_description"><p>the number of bytes to get</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.16.8"></a><h4>Returns</h4>
<p> a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html"><span class="type">GstBuffer</span></a> containing the first
<em class="parameter"><code>nbytes</code></em>
of the adapter, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>nbytes</code></em>
bytes are not available.
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html#gst-buffer-unref"><code class="function">gst_buffer_unref()</code></a> when no longer needed. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="ix03.html#api-index-1.6">1.6</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-take-list"></a><h3>gst_adapter_take_list ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *
gst_adapter_take_list (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);</pre>
<p>Returns a <a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> of buffers containing the first <em class="parameter"><code>nbytes</code></em>
bytes of the
<em class="parameter"><code>adapter</code></em>
. The returned bytes will be flushed from the adapter.
When the caller can deal with individual buffers, this function is more
performant because no memory should be copied.</p>
<p>Caller owns returned list and contained buffers. <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html#gst-buffer-unref"><code class="function">gst_buffer_unref()</code></a> each
buffer in the list before freeing the list after usage.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.17.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>nbytes</p></td>
<td class="parameter_description"><p>the number of bytes to take</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.17.7"></a><h4>Returns</h4>
<p> a <a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> of
buffers containing the first <em class="parameter"><code>nbytes</code></em>
of the adapter, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>nbytes</code></em>
bytes are not available. </p>
<p><span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> Gst.Buffer][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-get-list"></a><h3>gst_adapter_get_list ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *
gst_adapter_get_list (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);</pre>
<p>Returns a <a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> of buffers containing the first <em class="parameter"><code>nbytes</code></em>
bytes of the
<em class="parameter"><code>adapter</code></em>
, but does not flush them from the adapter. See
<a class="link" href="GstAdapter.html#gst-adapter-take-list" title="gst_adapter_take_list ()"><code class="function">gst_adapter_take_list()</code></a> for details.</p>
<p>Caller owns returned list and contained buffers. <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html#gst-buffer-unref"><code class="function">gst_buffer_unref()</code></a> each
buffer in the list before freeing the list after usage.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.18.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>nbytes</p></td>
<td class="parameter_description"><p>the number of bytes to get</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.18.7"></a><h4>Returns</h4>
<p> a <a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> of
buffers containing the first <em class="parameter"><code>nbytes</code></em>
of the adapter, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>nbytes</code></em>
bytes are not available. </p>
<p><span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> Gst.Buffer][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="ix03.html#api-index-1.6">1.6</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-take-buffer-list"></a><h3>gst_adapter_take_buffer_list ()</h3>
<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferList.html"><span class="returnvalue">GstBufferList</span></a> *
gst_adapter_take_buffer_list (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);</pre>
<p>Returns a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferList.html"><span class="type">GstBufferList</span></a> of buffers containing the first <em class="parameter"><code>nbytes</code></em>
bytes of
the <em class="parameter"><code>adapter</code></em>
. The returned bytes will be flushed from the adapter.
When the caller can deal with individual buffers, this function is more
performant because no memory should be copied.</p>
<p>Caller owns the returned list. Call <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferList.html#gst-buffer-list-unref"><code class="function">gst_buffer_list_unref()</code></a> to free
the list after usage.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.19.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>nbytes</p></td>
<td class="parameter_description"><p>the number of bytes to take</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.19.7"></a><h4>Returns</h4>
<p> a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferList.html"><span class="type">GstBufferList</span></a> of buffers containing
the first <em class="parameter"><code>nbytes</code></em>
of the adapter, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>nbytes</code></em>
bytes are not
available. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="ix03.html#api-index-1.6">1.6</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-get-buffer-list"></a><h3>gst_adapter_get_buffer_list ()</h3>
<pre class="programlisting"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferList.html"><span class="returnvalue">GstBufferList</span></a> *
gst_adapter_get_buffer_list (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">gsize</span> nbytes</code></em>);</pre>
<p>Returns a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferList.html"><span class="type">GstBufferList</span></a> of buffers containing the first <em class="parameter"><code>nbytes</code></em>
bytes of
the <em class="parameter"><code>adapter</code></em>
but does not flush them from the adapter. See
<a class="link" href="GstAdapter.html#gst-adapter-take-buffer-list" title="gst_adapter_take_buffer_list ()"><code class="function">gst_adapter_take_buffer_list()</code></a> for details.</p>
<p>Caller owns the returned list. Call <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferList.html#gst-buffer-list-unref"><code class="function">gst_buffer_list_unref()</code></a> to free
the list after usage.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.20.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>nbytes</p></td>
<td class="parameter_description"><p>the number of bytes to get</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.20.7"></a><h4>Returns</h4>
<p> a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBufferList.html"><span class="type">GstBufferList</span></a> of buffers containing
the first <em class="parameter"><code>nbytes</code></em>
of the adapter, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>nbytes</code></em>
bytes are not
available. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="ix03.html#api-index-1.6">1.6</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-prev-pts"></a><h3>gst_adapter_prev_pts ()</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_adapter_prev_pts (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">guint64</span> *distance</code></em>);</pre>
<p>Get the pts that was before the current byte in the adapter. When
<em class="parameter"><code>distance</code></em>
is given, the amount of bytes between the pts and the current
position is returned.</p>
<p>The pts is reset to GST_CLOCK_TIME_NONE and the distance is set to 0 when
the adapter is first created or when it is cleared. This also means that before
the first byte with a pts is removed from the adapter, the pts
and distance returned are GST_CLOCK_TIME_NONE and 0 respectively.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.21.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>distance</p></td>
<td class="parameter_description"><p> pointer to location for distance, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.21.7"></a><h4>Returns</h4>
<p> The previously seen pts.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-prev-dts"></a><h3>gst_adapter_prev_dts ()</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_adapter_prev_dts (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">guint64</span> *distance</code></em>);</pre>
<p>Get the dts that was before the current byte in the adapter. When
<em class="parameter"><code>distance</code></em>
is given, the amount of bytes between the dts and the current
position is returned.</p>
<p>The dts is reset to GST_CLOCK_TIME_NONE and the distance is set to 0 when
the adapter is first created or when it is cleared. This also means that before
the first byte with a dts is removed from the adapter, the dts
and distance returned are GST_CLOCK_TIME_NONE and 0 respectively.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.22.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>distance</p></td>
<td class="parameter_description"><p> pointer to location for distance, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.22.7"></a><h4>Returns</h4>
<p> The previously seen dts.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-prev-pts-at-offset"></a><h3>gst_adapter_prev_pts_at_offset ()</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_adapter_prev_pts_at_offset (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">gsize</span> offset</code></em>,
<em class="parameter"><code><span class="type">guint64</span> *distance</code></em>);</pre>
<p>Get the pts that was before the byte at offset <em class="parameter"><code>offset</code></em>
in the adapter. When
<em class="parameter"><code>distance</code></em>
is given, the amount of bytes between the pts and the current
position is returned.</p>
<p>The pts is reset to GST_CLOCK_TIME_NONE and the distance is set to 0 when
the adapter is first created or when it is cleared. This also means that before
the first byte with a pts is removed from the adapter, the pts
and distance returned are GST_CLOCK_TIME_NONE and 0 respectively.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.23.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>offset</p></td>
<td class="parameter_description"><p>the offset in the adapter at which to get timestamp</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>distance</p></td>
<td class="parameter_description"><p> pointer to location for distance, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.23.7"></a><h4>Returns</h4>
<p> The previously seen pts at given offset.</p>
</div>
<p class="since">Since: <a class="link" href="ix05.html#api-index-1.2">1.2</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-prev-dts-at-offset"></a><h3>gst_adapter_prev_dts_at_offset ()</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_adapter_prev_dts_at_offset (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">gsize</span> offset</code></em>,
<em class="parameter"><code><span class="type">guint64</span> *distance</code></em>);</pre>
<p>Get the dts that was before the byte at offset <em class="parameter"><code>offset</code></em>
in the adapter. When
<em class="parameter"><code>distance</code></em>
is given, the amount of bytes between the dts and the current
position is returned.</p>
<p>The dts is reset to GST_CLOCK_TIME_NONE and the distance is set to 0 when
the adapter is first created or when it is cleared. This also means that before
the first byte with a dts is removed from the adapter, the dts
and distance returned are GST_CLOCK_TIME_NONE and 0 respectively.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.24.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>offset</p></td>
<td class="parameter_description"><p>the offset in the adapter at which to get timestamp</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>distance</p></td>
<td class="parameter_description"><p> pointer to location for distance, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.24.7"></a><h4>Returns</h4>
<p> The previously seen dts at given offset.</p>
</div>
<p class="since">Since: <a class="link" href="ix05.html#api-index-1.2">1.2</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-masked-scan-uint32"></a><h3>gst_adapter_masked_scan_uint32 ()</h3>
<pre class="programlisting"><span class="returnvalue">gssize</span>
gst_adapter_masked_scan_uint32 (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">guint32</span> mask</code></em>,
<em class="parameter"><code><span class="type">guint32</span> pattern</code></em>,
<em class="parameter"><code><span class="type">gsize</span> offset</code></em>,
<em class="parameter"><code><span class="type">gsize</span> size</code></em>);</pre>
<p>Scan for pattern <em class="parameter"><code>pattern</code></em>
with applied mask <em class="parameter"><code>mask</code></em>
in the adapter data,
starting from offset <em class="parameter"><code>offset</code></em>
.</p>
<p>The bytes in <em class="parameter"><code>pattern</code></em>
and <em class="parameter"><code>mask</code></em>
are interpreted left-to-right, regardless
of endianness. All four bytes of the pattern must be present in the
adapter for it to match, even if the first or last bytes are masked out.</p>
<p>It is an error to call this function without making sure that there is
enough data (offset+size bytes) in the adapter.</p>
<p>This function calls <a class="link" href="GstAdapter.html#gst-adapter-masked-scan-uint32-peek" title="gst_adapter_masked_scan_uint32_peek ()"><code class="function">gst_adapter_masked_scan_uint32_peek()</code></a> passing <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
for value.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.25.8"></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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>mask</p></td>
<td class="parameter_description"><p>mask to apply to data before matching against <em class="parameter"><code>pattern</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>pattern</p></td>
<td class="parameter_description"><p>pattern to match (after mask is applied)</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>offset</p></td>
<td class="parameter_description"><p>offset into the adapter data from which to start scanning, returns
the last scanned position.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>size</p></td>
<td class="parameter_description"><p>number of bytes to scan from offset</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.25.9"></a><h4>Returns</h4>
<p> offset of the first match, or -1 if no match was found.</p>
<p>Example:</p>
<pre class="programlisting">
// Assume the adapter contains 0x00 0x01 0x02 ... 0xfe 0xff
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x00010203, 0, 256);
// -&gt; returns 0
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x00010203, 1, 255);
// -&gt; returns -1
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x01020304, 1, 255);
// -&gt; returns 1
gst_adapter_masked_scan_uint32 (adapter, 0xffff, 0x0001, 0, 256);
// -&gt; returns -1
gst_adapter_masked_scan_uint32 (adapter, 0xffff, 0x0203, 0, 256);
// -&gt; returns 0
gst_adapter_masked_scan_uint32 (adapter, 0xffff0000, 0x02030000, 0, 256);
// -&gt; returns 2
gst_adapter_masked_scan_uint32 (adapter, 0xffff0000, 0x02030000, 0, 4);
// -&gt; returns -1
</pre>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-adapter-masked-scan-uint32-peek"></a><h3>gst_adapter_masked_scan_uint32_peek ()</h3>
<pre class="programlisting"><span class="returnvalue">gssize</span>
gst_adapter_masked_scan_uint32_peek (<em class="parameter"><code><a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> *adapter</code></em>,
<em class="parameter"><code><span class="type">guint32</span> mask</code></em>,
<em class="parameter"><code><span class="type">guint32</span> pattern</code></em>,
<em class="parameter"><code><span class="type">gsize</span> offset</code></em>,
<em class="parameter"><code><span class="type">gsize</span> size</code></em>,
<em class="parameter"><code><span class="type">guint32</span> *value</code></em>);</pre>
<p>Scan for pattern <em class="parameter"><code>pattern</code></em>
with applied mask <em class="parameter"><code>mask</code></em>
in the adapter data,
starting from offset <em class="parameter"><code>offset</code></em>
. If a match is found, the value that matched
is returned through <em class="parameter"><code>value</code></em>
, otherwise <em class="parameter"><code>value</code></em>
is left untouched.</p>
<p>The bytes in <em class="parameter"><code>pattern</code></em>
and <em class="parameter"><code>mask</code></em>
are interpreted left-to-right, regardless
of endianness. All four bytes of the pattern must be present in the
adapter for it to match, even if the first or last bytes are masked out.</p>
<p>It is an error to call this function without making sure that there is
enough data (offset+size bytes) in the adapter.</p>
<div class="refsect3">
<a name="id-1.2.4.8.8.26.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>adapter</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>mask</p></td>
<td class="parameter_description"><p>mask to apply to data before matching against <em class="parameter"><code>pattern</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>pattern</p></td>
<td class="parameter_description"><p>pattern to match (after mask is applied)</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>offset</p></td>
<td class="parameter_description"><p>offset into the adapter data from which to start scanning, returns
the last scanned position.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>size</p></td>
<td class="parameter_description"><p>number of bytes to scan from offset</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>value</p></td>
<td class="parameter_description"><p> pointer to uint32 to return matching data. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.4.8.8.26.8"></a><h4>Returns</h4>
<p> offset of the first match, or -1 if no match was found.</p>
</div>
</div>
</div>
<div class="refsect1">
<a name="GstAdapter.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GstAdapter-struct"></a><h3>GstAdapter</h3>
<pre class="programlisting">typedef struct _GstAdapter GstAdapter;</pre>
<p>The opaque <a class="link" href="GstAdapter.html" title="GstAdapter"><span class="type">GstAdapter</span></a> data structure.</p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.24</div>
</body>
</html>