blob: d9ed0841879d2a6fa2eb3fb29ac157331244869b [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>GstAllocator: GStreamer 1.0 Core Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GStreamer 1.0 Core Reference Manual">
<link rel="up" href="libgstreamer.html" title="GStreamer Core Library">
<link rel="prev" href="gstreamer-Gst.html" title="Gst">
<link rel="next" href="gstreamer-GstAtomicQueue.html" title="GstAtomicQueue">
<meta name="generator" content="GTK-Doc V1.25 (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="#GstAllocator.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
<a href="#GstAllocator.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="libgstreamer.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gstreamer-Gst.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gstreamer-GstAtomicQueue.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="GstAllocator"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GstAllocator.top_of_page"></a>GstAllocator</span></h2>
<p>GstAllocator — allocate memory blocks</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="GstAllocator.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" 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="GstAllocator.html" title="GstAllocator"><span class="returnvalue">GstAllocator</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAllocator.html#gst-allocator-find" title="gst_allocator_find ()">gst_allocator_find</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="GstAllocator.html#gst-allocator-register" title="gst_allocator_register ()">gst_allocator_register</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="GstAllocator.html#gst-allocator-set-default" title="gst_allocator_set_default ()">gst_allocator_set_default</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="GstAllocator.html#gst-allocation-params-init" title="gst_allocation_params_init ()">gst_allocation_params_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GstAllocator.html#GstAllocationParams"><span class="returnvalue">GstAllocationParams</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAllocator.html#gst-allocation-params-copy" title="gst_allocation_params_copy ()">gst_allocation_params_copy</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="GstAllocator.html#gst-allocation-params-free" title="gst_allocation_params_free ()">gst_allocation_params_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GstMemory.html" title="GstMemory"><span class="returnvalue">GstMemory</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAllocator.html#gst-allocator-alloc" title="gst_allocator_alloc ()">gst_allocator_alloc</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="GstAllocator.html#gst-allocator-free" title="gst_allocator_free ()">gst_allocator_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GstMemory.html" title="GstMemory"><span class="returnvalue">GstMemory</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAllocator.html#gst-memory-new-wrapped" title="gst_memory_new_wrapped ()">gst_memory_new_wrapped</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<a name="GstAllocationParams"></a><div class="refsect1">
<a name="GstAllocator.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="variable_type">extern</td>
<td class="function_name"><a class="link" href="GstAllocator.html#gst-memory-alignment" title="gst_memory_alignment">gst_memory_alignment</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="GstAllocator.html#GstAllocator-struct" title="GstAllocator">GstAllocator</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="GstAllocator.html#GstAllocatorClass" title="struct GstAllocatorClass">GstAllocatorClass</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="GstAllocator.html#GstAllocatorFlags" title="enum GstAllocatorFlags">GstAllocatorFlags</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="GstAllocator.html#GstAllocationParams-struct" title="struct GstAllocationParams">GstAllocationParams</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="GstAllocator.html#GST-ALLOCATOR-SYSMEM:CAPS" title="GST_ALLOCATOR_SYSMEM">GST_ALLOCATOR_SYSMEM</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GstAllocator.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen"> <a href="https://developer.gnome.org/gobject/unstable/gobject-Boxed-Types.html">GBoxed</a>
<span class="lineart">╰──</span> GstAllocationParams
<a href="/usr/share/gtk-doc/html/gobjectgobject-The-Base-Object-Type.html#GObject-struct">GObject</a>
<span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gobjectgobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
<span class="lineart">╰──</span> <a class="link" href="GstObject.html" title="GstObject">GstObject</a>
<span class="lineart">╰──</span> GstAllocator
</pre>
</div>
<div class="refsect1">
<a name="GstAllocator.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gst/gst.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="GstAllocator.description"></a><h2>Description</h2>
<p>Memory is usually created by allocators with a <a class="link" href="GstAllocator.html#gst-allocator-alloc" title="gst_allocator_alloc ()"><code class="function">gst_allocator_alloc()</code></a>
method call. When <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is used as the allocator, the default allocator will
be used.</p>
<p>New allocators can be registered with <a class="link" href="GstAllocator.html#gst-allocator-register" title="gst_allocator_register ()"><code class="function">gst_allocator_register()</code></a>.
Allocators are identified by name and can be retrieved with
<a class="link" href="GstAllocator.html#gst-allocator-find" title="gst_allocator_find ()"><code class="function">gst_allocator_find()</code></a>. <a class="link" href="GstAllocator.html#gst-allocator-set-default" title="gst_allocator_set_default ()"><code class="function">gst_allocator_set_default()</code></a> can be used to change the
default allocator.</p>
<p>New memory can be created with <a class="link" href="GstAllocator.html#gst-memory-new-wrapped" title="gst_memory_new_wrapped ()"><code class="function">gst_memory_new_wrapped()</code></a> that wraps the memory
allocated elsewhere.</p>
</div>
<div class="refsect1">
<a name="GstAllocator.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gst-allocator-find"></a><h3>gst_allocator_find ()</h3>
<pre class="programlisting"><a class="link" href="GstAllocator.html" title="GstAllocator"><span class="returnvalue">GstAllocator</span></a> *
gst_allocator_find (<em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>);</pre>
<p>Find a previously registered allocator with <em class="parameter"><code>name</code></em>
. When <em class="parameter"><code>name</code></em>
is <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the
default allocator will be returned.</p>
<div class="refsect3">
<a name="gst-allocator-find.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" 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>name</p></td>
<td class="parameter_description"><p> the name of the allocator. </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>]</span></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gst-allocator-find.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="GstAllocator.html" title="GstAllocator"><span class="type">GstAllocator</span></a> or <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> when
the allocator with <em class="parameter"><code>name</code></em>
was not registered. Use <a class="link" href="GstObject.html#gst-object-unref" title="gst_object_unref ()"><code class="function">gst_object_unref()</code></a>
to release the allocator after usage. </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-allocator-register"></a><h3>gst_allocator_register ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_allocator_register (<em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>,
<em class="parameter"><code><a class="link" href="GstAllocator.html" title="GstAllocator"><span class="type">GstAllocator</span></a> *allocator</code></em>);</pre>
<p>Registers the memory <em class="parameter"><code>allocator</code></em>
with <em class="parameter"><code>name</code></em>
. This function takes ownership of
<em class="parameter"><code>allocator</code></em>
.</p>
<div class="refsect3">
<a name="gst-allocator-register.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" 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>name</p></td>
<td class="parameter_description"><p>the name of the allocator</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>allocator</p></td>
<td class="parameter_description"><p> <a class="link" href="GstAllocator.html" title="GstAllocator"><span class="type">GstAllocator</span></a>. </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-allocator-set-default"></a><h3>gst_allocator_set_default ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_allocator_set_default (<em class="parameter"><code><a class="link" href="GstAllocator.html" title="GstAllocator"><span class="type">GstAllocator</span></a> *allocator</code></em>);</pre>
<p>Set the default allocator. This function takes ownership of <em class="parameter"><code>allocator</code></em>
.</p>
<div class="refsect3">
<a name="gst-allocator-set-default.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" 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>allocator</p></td>
<td class="parameter_description"><p> a <a class="link" href="GstAllocator.html" title="GstAllocator"><span class="type">GstAllocator</span></a>. </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-allocation-params-init"></a><h3>gst_allocation_params_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_allocation_params_init (<em class="parameter"><code><a class="link" href="GstAllocator.html#GstAllocationParams"><span class="type">GstAllocationParams</span></a> *params</code></em>);</pre>
<p>Initialize <em class="parameter"><code>params</code></em>
to its default values</p>
<div class="refsect3">
<a name="gst-allocation-params-init.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" 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>params</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAllocator.html#GstAllocationParams"><span class="type">GstAllocationParams</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-allocation-params-copy"></a><h3>gst_allocation_params_copy ()</h3>
<pre class="programlisting"><a class="link" href="GstAllocator.html#GstAllocationParams"><span class="returnvalue">GstAllocationParams</span></a> *
gst_allocation_params_copy (<em class="parameter"><code>const <a class="link" href="GstAllocator.html#GstAllocationParams"><span class="type">GstAllocationParams</span></a> *params</code></em>);</pre>
<p>Create a copy of <em class="parameter"><code>params</code></em>
.</p>
<p>Free-function: gst_allocation_params_free</p>
<div class="refsect3">
<a name="gst-allocation-params-copy.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" 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>params</p></td>
<td class="parameter_description"><p> a <a class="link" href="GstAllocator.html#GstAllocationParams"><span class="type">GstAllocationParams</span></a>. </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="gst-allocation-params-copy.returns"></a><h4>Returns</h4>
<p> a new #<a class="link" href="GstAllocator.html#GstAllocationParams"><span class="type">GstAllocationParams</span></a>, free with
<a class="link" href="GstAllocator.html#gst-allocation-params-free" title="gst_allocation_params_free ()"><code class="function">gst_allocation_params_free()</code></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-allocation-params-free"></a><h3>gst_allocation_params_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_allocation_params_free (<em class="parameter"><code><a class="link" href="GstAllocator.html#GstAllocationParams"><span class="type">GstAllocationParams</span></a> *params</code></em>);</pre>
<p>Free <em class="parameter"><code>params</code></em>
</p>
<div class="refsect3">
<a name="gst-allocation-params-free.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" 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>params</p></td>
<td class="parameter_description"><p> a <a class="link" href="GstAllocator.html#GstAllocationParams"><span class="type">GstAllocationParams</span></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input. Default is transfer none."><span class="acronym">in</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>
</div>
<hr>
<div class="refsect2">
<a name="gst-allocator-alloc"></a><h3>gst_allocator_alloc ()</h3>
<pre class="programlisting"><a class="link" href="GstMemory.html" title="GstMemory"><span class="returnvalue">GstMemory</span></a> *
gst_allocator_alloc (<em class="parameter"><code><a class="link" href="GstAllocator.html" title="GstAllocator"><span class="type">GstAllocator</span></a> *allocator</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
<em class="parameter"><code><a class="link" href="GstAllocator.html#GstAllocationParams"><span class="type">GstAllocationParams</span></a> *params</code></em>);</pre>
<p>Use <em class="parameter"><code>allocator</code></em>
to allocate a new memory block with memory that is at least
<em class="parameter"><code>size</code></em>
big.</p>
<p>The optional <em class="parameter"><code>params</code></em>
can specify the prefix and padding for the memory. If
<a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is passed, no flags, no extra prefix/padding and a default alignment is
used.</p>
<p>The prefix/padding will be filled with 0 if flags contains
<a class="link" href="GstMemory.html#GST-MEMORY-FLAG-ZERO-PREFIXED:CAPS"><span class="type">GST_MEMORY_FLAG_ZERO_PREFIXED</span></a> and <a class="link" href="GstMemory.html#GST-MEMORY-FLAG-ZERO-PADDED:CAPS"><span class="type">GST_MEMORY_FLAG_ZERO_PADDED</span></a> respectively.</p>
<p>When <em class="parameter"><code>allocator</code></em>
is <a href="/usr/share/gtk-doc/html/glibglib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the default allocator will be used.</p>
<p>The alignment in <em class="parameter"><code>params</code></em>
is given as a bitmask so that <em class="parameter"><code>align</code></em>
+ 1 equals
the amount of bytes to align to. For example, to align to 8 bytes,
use an alignment of 7.</p>
<div class="refsect3">
<a name="gst-allocator-alloc.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" 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>allocator</p></td>
<td class="parameter_description"><p> a <a class="link" href="GstAllocator.html" title="GstAllocator"><span class="type">GstAllocator</span></a> to use. </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>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>size</p></td>
<td class="parameter_description"><p>size of the visible memory area</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>params</p></td>
<td class="parameter_description"><p> optional parameters. </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>][<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="gst-allocator-alloc.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="GstMemory.html" title="GstMemory"><span class="type">GstMemory</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-allocator-free"></a><h3>gst_allocator_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_allocator_free (<em class="parameter"><code><a class="link" href="GstAllocator.html" title="GstAllocator"><span class="type">GstAllocator</span></a> *allocator</code></em>,
<em class="parameter"><code><a class="link" href="GstMemory.html" title="GstMemory"><span class="type">GstMemory</span></a> *memory</code></em>);</pre>
<p>Free <em class="parameter"><code>memory</code></em>
that was previously allocated with <a class="link" href="GstAllocator.html#gst-allocator-alloc" title="gst_allocator_alloc ()"><code class="function">gst_allocator_alloc()</code></a>.</p>
<div class="refsect3">
<a name="gst-allocator-free.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" 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>allocator</p></td>
<td class="parameter_description"><p> a <a class="link" href="GstAllocator.html" title="GstAllocator"><span class="type">GstAllocator</span></a> to use. </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>
<tr>
<td class="parameter_name"><p>memory</p></td>
<td class="parameter_description"><p> the memory to free. </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-memory-new-wrapped"></a><h3>gst_memory_new_wrapped ()</h3>
<pre class="programlisting"><a class="link" href="GstMemory.html" title="GstMemory"><span class="returnvalue">GstMemory</span></a> *
gst_memory_new_wrapped (<em class="parameter"><code><a class="link" href="GstMemory.html#GstMemoryFlags" title="enum GstMemoryFlags"><span class="type">GstMemoryFlags</span></a> flags</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gsize"><span class="type">gsize</span></a> maxsize</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gsize"><span class="type">gsize</span></a> offset</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> notify</code></em>);</pre>
<p>Allocate a new memory block that wraps the given <em class="parameter"><code>data</code></em>
.</p>
<p>The prefix/padding must be filled with 0 if <em class="parameter"><code>flags</code></em>
contains
<a class="link" href="GstMemory.html#GST-MEMORY-FLAG-ZERO-PREFIXED:CAPS"><span class="type">GST_MEMORY_FLAG_ZERO_PREFIXED</span></a> and <a class="link" href="GstMemory.html#GST-MEMORY-FLAG-ZERO-PADDED:CAPS"><span class="type">GST_MEMORY_FLAG_ZERO_PADDED</span></a> respectively.</p>
<div class="refsect3">
<a name="gst-memory-new-wrapped.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" 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>flags</p></td>
<td class="parameter_description"><p><a class="link" href="GstMemory.html#GstMemoryFlags" title="enum GstMemoryFlags"><span class="type">GstMemoryFlags</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p> data to
wrap. </p></td>
<td class="parameter_annotations"><span class="annotation">[<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="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>maxsize</p></td>
<td class="parameter_description"><p>allocated size of <em class="parameter"><code>data</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>offset</p></td>
<td class="parameter_description"><p>offset in <em class="parameter"><code>data</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>size</p></td>
<td class="parameter_description"><p>size of valid data</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p> user_data. </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>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>notify</p></td>
<td class="parameter_description"><p> called with <em class="parameter"><code>user_data</code></em>
when the memory is freed. </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="The callback is valid until first called."><span class="acronym">scope async</span></acronym>][<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym> user_data]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gst-memory-new-wrapped.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="GstMemory.html" title="GstMemory"><span class="type">GstMemory</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>
</div>
<div class="refsect1">
<a name="GstAllocator.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="gst-memory-alignment"></a><h3>gst_memory_alignment</h3>
<pre class="programlisting">GST_EXPORT gsize gst_memory_alignment;
</pre>
<p>The default memory alignment in bytes - 1
an alignment of 7 would be the same as what <code class="function">malloc()</code> guarantees.</p>
</div>
<hr>
<div class="refsect2">
<a name="GstAllocator-struct"></a><h3>GstAllocator</h3>
<pre class="programlisting">typedef struct {
GstMemoryMapFunction mem_map;
GstMemoryUnmapFunction mem_unmap;
GstMemoryCopyFunction mem_copy;
GstMemoryShareFunction mem_share;
GstMemoryIsSpanFunction mem_is_span;
GstMemoryMapFullFunction mem_map_full;
GstMemoryUnmapFullFunction mem_unmap_full;
} GstAllocator;
</pre>
<p>The <a class="link" href="GstAllocator.html" title="GstAllocator"><span class="type">GstAllocator</span></a> is used to create new memory.</p>
<div class="refsect3">
<a name="GstAllocator.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" 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 class="link" href="GstMemory.html#GstMemoryMapFunction" title="GstMemoryMapFunction ()"><span class="type">GstMemoryMapFunction</span></a> <em class="structfield"><code><a name="GstAllocator-struct.mem-map"></a>mem_map</code></em>;</p></td>
<td class="struct_member_description"><p>the implementation of the GstMemoryMapFunction</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a class="link" href="GstMemory.html#GstMemoryUnmapFunction" title="GstMemoryUnmapFunction ()"><span class="type">GstMemoryUnmapFunction</span></a> <em class="structfield"><code><a name="GstAllocator-struct.mem-unmap"></a>mem_unmap</code></em>;</p></td>
<td class="struct_member_description"><p>the implementation of the GstMemoryUnmapFunction</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a class="link" href="GstMemory.html#GstMemoryCopyFunction" title="GstMemoryCopyFunction ()"><span class="type">GstMemoryCopyFunction</span></a> <em class="structfield"><code><a name="GstAllocator-struct.mem-copy"></a>mem_copy</code></em>;</p></td>
<td class="struct_member_description"><p>the implementation of the GstMemoryCopyFunction</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a class="link" href="GstMemory.html#GstMemoryShareFunction" title="GstMemoryShareFunction ()"><span class="type">GstMemoryShareFunction</span></a> <em class="structfield"><code><a name="GstAllocator-struct.mem-share"></a>mem_share</code></em>;</p></td>
<td class="struct_member_description"><p>the implementation of the GstMemoryShareFunction</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a class="link" href="GstMemory.html#GstMemoryIsSpanFunction" title="GstMemoryIsSpanFunction ()"><span class="type">GstMemoryIsSpanFunction</span></a> <em class="structfield"><code><a name="GstAllocator-struct.mem-is-span"></a>mem_is_span</code></em>;</p></td>
<td class="struct_member_description"><p>the implementation of the GstMemoryIsSpanFunction</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a class="link" href="GstMemory.html#GstMemoryMapFullFunction" title="GstMemoryMapFullFunction ()"><span class="type">GstMemoryMapFullFunction</span></a> <em class="structfield"><code><a name="GstAllocator-struct.mem-map-full"></a>mem_map_full</code></em>;</p></td>
<td class="struct_member_description"><p>the implementation of the GstMemoryMapFullFunction.
Will be used instead of <em class="parameter"><code>mem_map</code></em>
if present. (Since 1.6)</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a class="link" href="GstMemory.html#GstMemoryUnmapFullFunction" title="GstMemoryUnmapFullFunction ()"><span class="type">GstMemoryUnmapFullFunction</span></a> <em class="structfield"><code><a name="GstAllocator-struct.mem-unmap-full"></a>mem_unmap_full</code></em>;</p></td>
<td class="struct_member_description"><p>the implementation of the GstMemoryUnmapFullFunction.
Will be used instead of <em class="parameter"><code>mem_unmap</code></em>
if present. (Since 1.6)</p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="GstAllocatorClass"></a><h3>struct GstAllocatorClass</h3>
<pre class="programlisting">struct GstAllocatorClass {
GstObjectClass object_class;
GstMemory * (*alloc) (GstAllocator *allocator, gsize size,
GstAllocationParams *params);
void (*free) (GstAllocator *allocator, GstMemory *memory);
};
</pre>
<p>The <a class="link" href="GstAllocator.html" title="GstAllocator"><span class="type">GstAllocator</span></a> is used to create new memory.</p>
<div class="refsect3">
<a name="GstAllocatorClass.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" 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 class="link" href="GstObject.html#GstObjectClass" title="struct GstObjectClass"><span class="type">GstObjectClass</span></a> <em class="structfield"><code><a name="GstAllocatorClass.object-class"></a>object_class</code></em>;</p></td>
<td class="struct_member_description"><p>Object parent class</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GstAllocatorClass.alloc"></a>alloc</code></em> ()</p></td>
<td class="struct_member_description"><p>implementation that acquires memory</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GstAllocatorClass.free"></a>free</code></em> ()</p></td>
<td class="struct_member_description"><p>implementation that releases memory</p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="GstAllocatorFlags"></a><h3>enum GstAllocatorFlags</h3>
<p>Flags for allocators.</p>
<div class="refsect3">
<a name="GstAllocatorFlags.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="GST-ALLOCATOR-FLAG-CUSTOM-ALLOC:CAPS"></a>GST_ALLOCATOR_FLAG_CUSTOM_ALLOC</p></td>
<td class="enum_member_description">
<p>The allocator has a custom alloc function.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GST-ALLOCATOR-FLAG-LAST:CAPS"></a>GST_ALLOCATOR_FLAG_LAST</p></td>
<td class="enum_member_description">
<p>first flag that can be used for custom purposes</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="GstAllocationParams-struct"></a><h3>struct GstAllocationParams</h3>
<pre class="programlisting">struct GstAllocationParams {
GstMemoryFlags flags;
gsize align;
gsize prefix;
gsize padding;
};
</pre>
<p>Parameters to control the allocation of memory</p>
<div class="refsect3">
<a name="GstAllocationParams.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" 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 class="link" href="GstMemory.html#GstMemoryFlags" title="enum GstMemoryFlags"><span class="type">GstMemoryFlags</span></a> <em class="structfield"><code><a name="GstAllocationParams-struct.flags"></a>flags</code></em>;</p></td>
<td class="struct_member_description"><p>flags to control allocation</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gsize"><span class="type">gsize</span></a> <em class="structfield"><code><a name="GstAllocationParams-struct.align"></a>align</code></em>;</p></td>
<td class="struct_member_description"><p>the desired alignment of the memory</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gsize"><span class="type">gsize</span></a> <em class="structfield"><code><a name="GstAllocationParams-struct.prefix"></a>prefix</code></em>;</p></td>
<td class="struct_member_description"><p>the desired prefix</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gsize"><span class="type">gsize</span></a> <em class="structfield"><code><a name="GstAllocationParams-struct.padding"></a>padding</code></em>;</p></td>
<td class="struct_member_description"><p>the desired padding</p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="GST-ALLOCATOR-SYSMEM:CAPS"></a><h3>GST_ALLOCATOR_SYSMEM</h3>
<pre class="programlisting">#define GST_ALLOCATOR_SYSMEM "SystemMemory"
</pre>
<p>The allocator name for the default system memory allocator</p>
</div>
</div>
<div class="refsect1">
<a name="GstAllocator.see-also"></a><h2>See Also</h2>
<p><a class="link" href="GstMemory.html" title="GstMemory"><span class="type">GstMemory</span></a></p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>