Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ffmpeg-doc / usr / share / doc / ffmpeg-doc / api / group__lavu__bufferpool.html
Size: Mime:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>FFmpeg: AVBufferPool</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">FFmpeg
   &#160;<span id="projectnumber">2.7.1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">AVBufferPool</div>  </div>
<div class="ingroups"><a class="el" href="group__lavu__data.html">Data Structures</a></div></div><!--header-->
<div class="contents">

<p>AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="group__lavu__bufferpool.html#ga13bc8038952b61bae4d591f30c7421f6">AVBufferPool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavu__bufferpool.html#ga13bc8038952b61bae4d591f30c7421f6">AVBufferPool</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The buffer pool.  <a href="#ga13bc8038952b61bae4d591f30c7421f6"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__lavu__bufferpool.html#ga13bc8038952b61bae4d591f30c7421f6">AVBufferPool</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavu__bufferpool.html#ga26af9b07c08bc7fd2cfc62767e490b93">av_buffer_pool_init</a> (int size, <a class="el" href="structAVBufferRef.html">AVBufferRef</a> *(*alloc)(int size))</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate and initialize a buffer pool.  <a href="#ga26af9b07c08bc7fd2cfc62767e490b93"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavu__bufferpool.html#ga7b76781c5944b3bb59b2e3b1a8994e4a">av_buffer_pool_uninit</a> (<a class="el" href="group__lavu__bufferpool.html#ga13bc8038952b61bae4d591f30c7421f6">AVBufferPool</a> **pool)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Mark the pool as being available for freeing.  <a href="#ga7b76781c5944b3bb59b2e3b1a8994e4a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structAVBufferRef.html">AVBufferRef</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavu__bufferpool.html#ga2c745ecb4001452423e775b06b20fb7c">av_buffer_pool_get</a> (<a class="el" href="group__lavu__bufferpool.html#ga13bc8038952b61bae4d591f30c7421f6">AVBufferPool</a> *pool)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate a new AVBuffer, reusing an old buffer from the pool when available.  <a href="#ga2c745ecb4001452423e775b06b20fb7c"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers. </p>
<p>Frequently allocating and freeing large buffers may be slow. AVBufferPool is meant to solve this in cases when the caller needs a set of buffers of the same size (the most obvious use case being buffers for raw video or audio frames).</p>
<p>At the beginning, the user must call <a class="el" href="group__lavu__bufferpool.html#ga26af9b07c08bc7fd2cfc62767e490b93" title="Allocate and initialize a buffer pool.">av_buffer_pool_init()</a> to create the buffer pool. Then whenever a buffer is needed, call <a class="el" href="group__lavu__bufferpool.html#ga2c745ecb4001452423e775b06b20fb7c" title="Allocate a new AVBuffer, reusing an old buffer from the pool when available.">av_buffer_pool_get()</a> to get a reference to a new buffer, similar to <a class="el" href="group__lavu__buffer.html#ga5ae84ac902283dea1a660ede06c1cdac" title="Allocate an AVBuffer of the given size using av_malloc().">av_buffer_alloc()</a>. This new reference works in all aspects the same way as the one created by <a class="el" href="group__lavu__buffer.html#ga5ae84ac902283dea1a660ede06c1cdac" title="Allocate an AVBuffer of the given size using av_malloc().">av_buffer_alloc()</a>. However, when the last reference to this buffer is unreferenced, it is returned to the pool instead of being freed and will be reused for subsequent <a class="el" href="group__lavu__bufferpool.html#ga2c745ecb4001452423e775b06b20fb7c" title="Allocate a new AVBuffer, reusing an old buffer from the pool when available.">av_buffer_pool_get()</a> calls.</p>
<p>When the caller is done with the pool and no longer needs to allocate any new buffers, <a class="el" href="group__lavu__bufferpool.html#ga7b76781c5944b3bb59b2e3b1a8994e4a" title="Mark the pool as being available for freeing.">av_buffer_pool_uninit()</a> must be called to mark the pool as freeable. Once all the buffers are released, it will automatically be freed.</p>
<p>Allocating and releasing buffers with this API is thread-safe as long as either the default alloc callback is used, or the user-supplied one is thread-safe. </p>
<hr/><h2>Typedef Documentation</h2>
<a class="anchor" id="ga13bc8038952b61bae4d591f30c7421f6"></a><!-- doxytag: member="buffer.h::AVBufferPool" ref="ga13bc8038952b61bae4d591f30c7421f6" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="group__lavu__bufferpool.html#ga13bc8038952b61bae4d591f30c7421f6">AVBufferPool</a> <a class="el" href="group__lavu__bufferpool.html#ga13bc8038952b61bae4d591f30c7421f6">AVBufferPool</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The buffer pool. </p>
<p>This structure is opaque and not meant to be accessed directly. It is allocated with <a class="el" href="group__lavu__bufferpool.html#ga26af9b07c08bc7fd2cfc62767e490b93" title="Allocate and initialize a buffer pool.">av_buffer_pool_init()</a> and freed with <a class="el" href="group__lavu__bufferpool.html#ga7b76781c5944b3bb59b2e3b1a8994e4a" title="Mark the pool as being available for freeing.">av_buffer_pool_uninit()</a>. </p>

<p>Definition at line <a class="el" href="buffer_8h_source.html#l00238">238</a> of file <a class="el" href="buffer_8h_source.html">buffer.h</a>.</p>

</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga26af9b07c08bc7fd2cfc62767e490b93"></a><!-- doxytag: member="buffer.h::av_buffer_pool_init" ref="ga26af9b07c08bc7fd2cfc62767e490b93" args="(int size, AVBufferRef *(*alloc)(int size))" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__lavu__bufferpool.html#ga13bc8038952b61bae4d591f30c7421f6">AVBufferPool</a>* <a class="el" href="group__lavu__bufferpool.html#ga26af9b07c08bc7fd2cfc62767e490b93">av_buffer_pool_init</a> </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structAVBufferRef.html">AVBufferRef</a> *(*)(int size)&#160;</td>
          <td class="paramname"><em>alloc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Allocate and initialize a buffer pool. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">size</td><td>size of each buffer in this pool </td></tr>
    <tr><td class="paramname">alloc</td><td>a function that will be used to allocate new buffers when the pool is empty. May be NULL, then the default allocator will be used (<a class="el" href="group__lavu__buffer.html#ga5ae84ac902283dea1a660ede06c1cdac" title="Allocate an AVBuffer of the given size using av_malloc().">av_buffer_alloc()</a>). </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>newly created buffer pool on success, NULL on error. </dd></dl>

</div>
</div>
<a class="anchor" id="ga7b76781c5944b3bb59b2e3b1a8994e4a"></a><!-- doxytag: member="buffer.h::av_buffer_pool_uninit" ref="ga7b76781c5944b3bb59b2e3b1a8994e4a" args="(AVBufferPool **pool)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="group__lavu__bufferpool.html#ga7b76781c5944b3bb59b2e3b1a8994e4a">av_buffer_pool_uninit</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__lavu__bufferpool.html#ga13bc8038952b61bae4d591f30c7421f6">AVBufferPool</a> **&#160;</td>
          <td class="paramname"><em>pool</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Mark the pool as being available for freeing. </p>
<p>It will actually be freed only once all the allocated buffers associated with the pool are released. Thus it is safe to call this function while some of the allocated buffers are still in use.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">pool</td><td>pointer to the pool to be freed. It will be set to NULL. </td></tr>
  </table>
  </dd>
</dl>
<dl class="see"><dt><b>See also:</b></dt><dd>av_buffer_pool_can_uninit() </dd></dl>

</div>
</div>
<a class="anchor" id="ga2c745ecb4001452423e775b06b20fb7c"></a><!-- doxytag: member="buffer.h::av_buffer_pool_get" ref="ga2c745ecb4001452423e775b06b20fb7c" args="(AVBufferPool *pool)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structAVBufferRef.html">AVBufferRef</a>* <a class="el" href="group__lavu__bufferpool.html#ga2c745ecb4001452423e775b06b20fb7c">av_buffer_pool_get</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__lavu__bufferpool.html#ga13bc8038952b61bae4d591f30c7421f6">AVBufferPool</a> *&#160;</td>
          <td class="paramname"><em>pool</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Allocate a new AVBuffer, reusing an old buffer from the pool when available. </p>
<p>This function may be called simultaneously from multiple threads.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>a reference to the new buffer on success, NULL on error. </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>