1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5<title>GstFdAllocator: GStreamer Base Plugins 1.0 Library Reference Manual</title> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="index.html" title="GStreamer Base Plugins 1.0 Library Reference Manual"> 8<link rel="up" href="gstreamer-allocators.html" title="Allocators Library"> 9<link rel="prev" href="gst-plugins-base-libs-dmabuf.html" title="GstDmaBufAllocator"> 10<link rel="next" href="GstPhysMemoryAllocator.html" title="GstPhysMemoryAllocator"> 11<meta name="generator" content="GTK-Doc V1.28 (XML mode)"> 12<link rel="stylesheet" href="style.css" type="text/css"> 13</head> 14<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 15<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> 16<td width="100%" align="left" class="shortcuts"> 17<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> 18 <a href="#gst-plugins-base-libs-fdmemory.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> 19 <a href="#gst-plugins-base-libs-fdmemory.object-hierarchy" class="shortcut">Object Hierarchy</a></span> 20</td> 21<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> 22<td><a accesskey="u" href="gstreamer-allocators.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> 23<td><a accesskey="p" href="gst-plugins-base-libs-dmabuf.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> 24<td><a accesskey="n" href="GstPhysMemoryAllocator.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> 25</tr></table> 26<div class="refentry"> 27<a name="gst-plugins-base-libs-fdmemory"></a><div class="titlepage"></div> 28<div class="refnamediv"><table width="100%"><tr> 29<td valign="top"> 30<h2><span class="refentrytitle"><a name="gst-plugins-base-libs-fdmemory.top_of_page"></a>GstFdAllocator</span></h2> 31<p>GstFdAllocator — Memory wrapper for fd backed memory</p> 32</td> 33<td class="gallery_image" valign="top" align="right"></td> 34</tr></table></div> 35<div class="refsect1"> 36<a name="gst-plugins-base-libs-fdmemory.functions"></a><h2>Functions</h2> 37<div class="informaltable"><table class="informaltable" width="100%" border="0"> 38<colgroup> 39<col width="150px" class="functions_return"> 40<col class="functions_name"> 41</colgroup> 42<tbody> 43<tr> 44<td class="function_type"> 45<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMemory.html#GstMemory-struct"><span class="returnvalue">GstMemory</span></a> * 46</td> 47<td class="function_name"> 48<a class="link" href="gst-plugins-base-libs-fdmemory.html#gst-fd-allocator-alloc" title="gst_fd_allocator_alloc ()">gst_fd_allocator_alloc</a> <span class="c_punctuation">()</span> 49</td> 50</tr> 51<tr> 52<td class="function_type"> 53<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstAllocator.html#GstAllocator-struct"><span class="returnvalue">GstAllocator</span></a> * 54</td> 55<td class="function_name"> 56<a class="link" href="gst-plugins-base-libs-fdmemory.html#gst-fd-allocator-new" title="gst_fd_allocator_new ()">gst_fd_allocator_new</a> <span class="c_punctuation">()</span> 57</td> 58</tr> 59<tr> 60<td class="function_type"> 61<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a> 62</td> 63<td class="function_name"> 64<a class="link" href="gst-plugins-base-libs-fdmemory.html#gst-fd-memory-get-fd" title="gst_fd_memory_get_fd ()">gst_fd_memory_get_fd</a> <span class="c_punctuation">()</span> 65</td> 66</tr> 67<tr> 68<td class="function_type"> 69<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 70</td> 71<td class="function_name"> 72<a class="link" href="gst-plugins-base-libs-fdmemory.html#gst-is-fd-memory" title="gst_is_fd_memory ()">gst_is_fd_memory</a> <span class="c_punctuation">()</span> 73</td> 74</tr> 75</tbody> 76</table></div> 77</div> 78<a name="GstFdAllocator"></a><div class="refsect1"> 79<a name="gst-plugins-base-libs-fdmemory.other"></a><h2>Types and Values</h2> 80<div class="informaltable"><table class="informaltable" width="100%" border="0"> 81<colgroup> 82<col width="150px" class="name"> 83<col class="description"> 84</colgroup> 85<tbody><tr> 86<td class="datatype_keyword">enum</td> 87<td class="function_name"><a class="link" href="gst-plugins-base-libs-fdmemory.html#GstFdMemoryFlags" title="enum GstFdMemoryFlags">GstFdMemoryFlags</a></td> 88</tr></tbody> 89</table></div> 90</div> 91<div class="refsect1"> 92<a name="gst-plugins-base-libs-fdmemory.object-hierarchy"></a><h2>Object Hierarchy</h2> 93<pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject-struct">GObject</a> 94 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a> 95 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstObject.html#GstObject-struct">GstObject</a> 96 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstAllocator.html#GstAllocator-struct">GstAllocator</a> 97 <span class="lineart">╰──</span> GstFdAllocator 98 <span class="lineart">╰──</span> <a class="link" href="gst-plugins-base-libs-dmabuf.html#GstDmaBufAllocator">GstDmaBufAllocator</a> 99</pre> 100</div> 101<div class="refsect1"> 102<a name="gst-plugins-base-libs-fdmemory.includes"></a><h2>Includes</h2> 103<pre class="synopsis">#include <gst/allocators/allocators.h> 104</pre> 105</div> 106<div class="refsect1"> 107<a name="gst-plugins-base-libs-fdmemory.description"></a><h2>Description</h2> 108</div> 109<div class="refsect1"> 110<a name="gst-plugins-base-libs-fdmemory.functions_details"></a><h2>Functions</h2> 111<div class="refsect2"> 112<a name="gst-fd-allocator-alloc"></a><h3>gst_fd_allocator_alloc ()</h3> 113<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMemory.html#GstMemory-struct"><span class="returnvalue">GstMemory</span></a> * 114gst_fd_allocator_alloc (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstAllocator.html#GstAllocator-struct"><span class="type">GstAllocator</span></a> *allocator</code></em>, 115 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> fd</code></em>, 116 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>, 117 <em class="parameter"><code><a class="link" href="gst-plugins-base-libs-fdmemory.html#GstFdMemoryFlags" title="enum GstFdMemoryFlags"><span class="type">GstFdMemoryFlags</span></a> flags</code></em>);</pre> 118<p>Return a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMemory.html#GstMemory-struct"><code class="literal">GstMemory</code></a> that wraps a generic file descriptor.</p> 119<div class="refsect3"> 120<a name="gst-fd-allocator-alloc.parameters"></a><h4>Parameters</h4> 121<div class="informaltable"><table class="informaltable" width="100%" border="0"> 122<colgroup> 123<col width="150px" class="parameters_name"> 124<col class="parameters_description"> 125<col width="200px" class="parameters_annotations"> 126</colgroup> 127<tbody> 128<tr> 129<td class="parameter_name"><p>allocator</p></td> 130<td class="parameter_description"><p>allocator to be used for this memory</p></td> 131<td class="parameter_annotations"> </td> 132</tr> 133<tr> 134<td class="parameter_name"><p>fd</p></td> 135<td class="parameter_description"><p>file descriptor</p></td> 136<td class="parameter_annotations"> </td> 137</tr> 138<tr> 139<td class="parameter_name"><p>size</p></td> 140<td class="parameter_description"><p>memory size</p></td> 141<td class="parameter_annotations"> </td> 142</tr> 143<tr> 144<td class="parameter_name"><p>flags</p></td> 145<td class="parameter_description"><p>extra <a class="link" href="gst-plugins-base-libs-fdmemory.html#GstFdMemoryFlags" title="enum GstFdMemoryFlags"><span class="type">GstFdMemoryFlags</span></a></p></td> 146<td class="parameter_annotations"> </td> 147</tr> 148</tbody> 149</table></div> 150</div> 151<div class="refsect3"> 152<a name="gst-fd-allocator-alloc.returns"></a><h4>Returns</h4> 153<p>a GstMemory based on <em class="parameter"><code>allocator</code></em> 154. 155When the buffer will be released the allocator will close the <em class="parameter"><code>fd</code></em> 156unless 157the <a class="link" href="gst-plugins-base-libs-fdmemory.html#GST-FD-MEMORY-FLAG-DONT-CLOSE:CAPS"><code class="literal">GST_FD_MEMORY_FLAG_DONT_CLOSE</code></a> flag is specified. 158The memory is only mmapped on <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstBuffer.html#gst-buffer-map"><code class="function">gst_buffer_map()</code></a> request. </p> 159<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> 160</div> 161<p class="since">Since: <a class="link" href="ix10.html#api-index-1.6">1.6</a></p> 162</div> 163<hr> 164<div class="refsect2"> 165<a name="gst-fd-allocator-new"></a><h3>gst_fd_allocator_new ()</h3> 166<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstAllocator.html#GstAllocator-struct"><span class="returnvalue">GstAllocator</span></a> * 167gst_fd_allocator_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre> 168<p>Return a new fd allocator.</p> 169<div class="refsect3"> 170<a name="gst-fd-allocator-new.returns"></a><h4>Returns</h4> 171<p>a new fd allocator, or NULL if the allocator 172isn't available. Use <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstObject.html#gst-object-unref"><code class="function">gst_object_unref()</code></a> to release the allocator after 173usage. </p> 174<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> 175</div> 176<p class="since">Since: <a class="link" href="ix10.html#api-index-1.6">1.6</a></p> 177</div> 178<hr> 179<div class="refsect2"> 180<a name="gst-fd-memory-get-fd"></a><h3>gst_fd_memory_get_fd ()</h3> 181<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a> 182gst_fd_memory_get_fd (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMemory.html#GstMemory-struct"><span class="type">GstMemory</span></a> *mem</code></em>);</pre> 183<p>Get the fd from <em class="parameter"><code>mem</code></em> 184. Call <a class="link" href="gst-plugins-base-libs-fdmemory.html#gst-is-fd-memory" title="gst_is_fd_memory ()"><code class="function">gst_is_fd_memory()</code></a> to check if <em class="parameter"><code>mem</code></em> 185 has 186an fd.</p> 187<div class="refsect3"> 188<a name="gst-fd-memory-get-fd.parameters"></a><h4>Parameters</h4> 189<div class="informaltable"><table class="informaltable" width="100%" border="0"> 190<colgroup> 191<col width="150px" class="parameters_name"> 192<col class="parameters_description"> 193<col width="200px" class="parameters_annotations"> 194</colgroup> 195<tbody><tr> 196<td class="parameter_name"><p>mem</p></td> 197<td class="parameter_description"><p><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMemory.html#GstMemory-struct"><span class="type">GstMemory</span></a></p></td> 198<td class="parameter_annotations"> </td> 199</tr></tbody> 200</table></div> 201</div> 202<div class="refsect3"> 203<a name="gst-fd-memory-get-fd.returns"></a><h4>Returns</h4> 204<p> the fd of <em class="parameter"><code>mem</code></em> 205or -1 when there is no fd on <em class="parameter"><code>mem</code></em> 206</p> 207</div> 208<p class="since">Since: <a class="link" href="ix10.html#api-index-1.6">1.6</a></p> 209</div> 210<hr> 211<div class="refsect2"> 212<a name="gst-is-fd-memory"></a><h3>gst_is_fd_memory ()</h3> 213<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> 214gst_is_fd_memory (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMemory.html#GstMemory-struct"><span class="type">GstMemory</span></a> *mem</code></em>);</pre> 215<p>Check if <em class="parameter"><code>mem</code></em> 216 is memory backed by an fd</p> 217<div class="refsect3"> 218<a name="gst-is-fd-memory.parameters"></a><h4>Parameters</h4> 219<div class="informaltable"><table class="informaltable" width="100%" border="0"> 220<colgroup> 221<col width="150px" class="parameters_name"> 222<col class="parameters_description"> 223<col width="200px" class="parameters_annotations"> 224</colgroup> 225<tbody><tr> 226<td class="parameter_name"><p>mem</p></td> 227<td class="parameter_description"><p><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMemory.html#GstMemory-struct"><span class="type">GstMemory</span></a></p></td> 228<td class="parameter_annotations"> </td> 229</tr></tbody> 230</table></div> 231</div> 232<div class="refsect3"> 233<a name="gst-is-fd-memory.returns"></a><h4>Returns</h4> 234<p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> when <em class="parameter"><code>mem</code></em> 235has an fd that can be retrieved with 236<a class="link" href="gst-plugins-base-libs-fdmemory.html#gst-fd-memory-get-fd" title="gst_fd_memory_get_fd ()"><code class="function">gst_fd_memory_get_fd()</code></a>.</p> 237</div> 238<p class="since">Since: <a class="link" href="ix10.html#api-index-1.6">1.6</a></p> 239</div> 240</div> 241<div class="refsect1"> 242<a name="gst-plugins-base-libs-fdmemory.other_details"></a><h2>Types and Values</h2> 243<div class="refsect2"> 244<a name="GstFdMemoryFlags"></a><h3>enum GstFdMemoryFlags</h3> 245<p>Various flags to control the operation of the fd backed memory.</p> 246<div class="refsect3"> 247<a name="GstFdMemoryFlags.members"></a><h4>Members</h4> 248<div class="informaltable"><table class="informaltable" width="100%" border="0"> 249<colgroup> 250<col width="300px" class="enum_members_name"> 251<col class="enum_members_description"> 252<col width="200px" class="enum_members_annotations"> 253</colgroup> 254<tbody> 255<tr> 256<td class="enum_member_name"><p><a name="GST-FD-MEMORY-FLAG-NONE:CAPS"></a>GST_FD_MEMORY_FLAG_NONE</p></td> 257<td class="enum_member_description"> 258<p>no flag</p> 259</td> 260<td class="enum_member_annotations"> </td> 261</tr> 262<tr> 263<td class="enum_member_name"><p><a name="GST-FD-MEMORY-FLAG-KEEP-MAPPED:CAPS"></a>GST_FD_MEMORY_FLAG_KEEP_MAPPED</p></td> 264<td class="enum_member_description"> 265<p>once the memory is mapped, 266 keep it mapped until the memory is destroyed.</p> 267</td> 268<td class="enum_member_annotations"> </td> 269</tr> 270<tr> 271<td class="enum_member_name"><p><a name="GST-FD-MEMORY-FLAG-MAP-PRIVATE:CAPS"></a>GST_FD_MEMORY_FLAG_MAP_PRIVATE</p></td> 272<td class="enum_member_description"> 273<p>do a private mapping instead of 274 the default shared mapping.</p> 275</td> 276<td class="enum_member_annotations"> </td> 277</tr> 278<tr> 279<td class="enum_member_name"><p><a name="GST-FD-MEMORY-FLAG-DONT-CLOSE:CAPS"></a>GST_FD_MEMORY_FLAG_DONT_CLOSE</p></td> 280<td class="enum_member_description"> 281<p>don't close the file descriptor when 282 the memory is freed. Since: 1.10</p> 283</td> 284<td class="enum_member_annotations"> </td> 285</tr> 286</tbody> 287</table></div> 288</div> 289<p class="since">Since: <a class="link" href="ix10.html#api-index-1.6">1.6</a></p> 290</div> 291</div> 292<div class="refsect1"> 293<a name="gst-plugins-base-libs-fdmemory.see-also"></a><h2>See Also</h2> 294<p><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstMemory.html#GstMemory-struct"><span class="type">GstMemory</span></a></p> 295</div> 296</div> 297<div class="footer"> 298<hr>Generated by GTK-Doc V1.28</div> 299</body> 300</html>