Repository URL to install this package:
Version:
7:2.7.1-1ubuntu2 ▾
|
<!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: Libavresample</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
 <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 Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data 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="#files">Files</a> |
<a href="#define-members">Defines</a> |
<a href="#typedef-members">Typedefs</a> |
<a href="#enum-members">Enumerations</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Libavresample</div> </div>
</div><!--header-->
<div class="contents">
<p>Libavresample (lavr) is a library that handles audio resampling, sample format conversion and mixing.
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="files"></a>
Files</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="avresample_8h.html">avresample.h</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight"><p>external API header </p>
<br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="libavresample_2version_8h.html">version.h</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight"><p>Libavresample version macros. </p>
<br/></td></tr>
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#gaee1afc173c8d1eefe0e1d8a881b7df26">AVRESAMPLE_MAX_CHANNELS</a>   32</td></tr>
<tr><td colspan="2"><h2><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef struct <br class="typebreak"/>
<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a></td></tr>
<tr><td colspan="2"><h2><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#gaaaa652e3ad8554a0dca126e8571735dd">AVMixCoeffType</a> { <a class="el" href="group__lavr.html#ggaaaa652e3ad8554a0dca126e8571735ddab01d45f335057a1f930b0b677adb3a60">AV_MIX_COEFF_TYPE_Q8</a>,
<a class="el" href="group__lavr.html#ggaaaa652e3ad8554a0dca126e8571735ddaf459c8599c850abd5d0308cd8609af68">AV_MIX_COEFF_TYPE_Q15</a>,
<a class="el" href="group__lavr.html#ggaaaa652e3ad8554a0dca126e8571735dda5d6c3ee92cc045714ac2ec4c83588841">AV_MIX_COEFF_TYPE_FLT</a>,
<a class="el" href="group__lavr.html#ggaaaa652e3ad8554a0dca126e8571735dda2672ba31292b1fb0a861b035466964a9">AV_MIX_COEFF_TYPE_NB</a>
}</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Mixing Coefficient Types. <a href="group__lavr.html#gaaaa652e3ad8554a0dca126e8571735dd">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga3813087032c02f1e84f0ca2962b09400">AVResampleFilterType</a> { <a class="el" href="group__lavr.html#gga3813087032c02f1e84f0ca2962b09400ac8d3b66c4c4bd02418ce0b882fb7d4fa">AV_RESAMPLE_FILTER_TYPE_CUBIC</a>,
<a class="el" href="group__lavr.html#gga3813087032c02f1e84f0ca2962b09400ace0cbc5bda3d6fa26b054b2fa7702886">AV_RESAMPLE_FILTER_TYPE_BLACKMAN_NUTTALL</a>,
<a class="el" href="group__lavr.html#gga3813087032c02f1e84f0ca2962b09400af552d08855b8a5f4b46f6328633c8f1f">AV_RESAMPLE_FILTER_TYPE_KAISER</a>
}</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Resampling Filter Types. <a href="group__lavr.html#ga3813087032c02f1e84f0ca2962b09400">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga302491313b02acca1a822249caa8cb10">AVResampleDitherMethod</a> { <br/>
  <a class="el" href="group__lavr.html#gga302491313b02acca1a822249caa8cb10a4f892b254f02b3ebf775169f786e966b">AV_RESAMPLE_DITHER_NONE</a>,
<a class="el" href="group__lavr.html#gga302491313b02acca1a822249caa8cb10a6e6841e6042d8059db5fdebe67d783ad">AV_RESAMPLE_DITHER_RECTANGULAR</a>,
<a class="el" href="group__lavr.html#gga302491313b02acca1a822249caa8cb10a4d9b50692d2a3cdf6c3cfeb7f14ccfc6">AV_RESAMPLE_DITHER_TRIANGULAR</a>,
<a class="el" href="group__lavr.html#gga302491313b02acca1a822249caa8cb10a261d5a5101aeff5e7ff5813787481bd6">AV_RESAMPLE_DITHER_TRIANGULAR_HP</a>,
<br/>
  <a class="el" href="group__lavr.html#gga302491313b02acca1a822249caa8cb10aa1abacc1c6e8c448959bc49316b8f566">AV_RESAMPLE_DITHER_TRIANGULAR_NS</a>,
<a class="el" href="group__lavr.html#gga302491313b02acca1a822249caa8cb10ac9e29d7f4af2590ba9a59429d88d57c0">AV_RESAMPLE_DITHER_NB</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">unsigned </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#gaedabbb0590c33b7b9ce1ce213629dd3e">avresample_version</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the LIBAVRESAMPLE_VERSION_INT constant. <a href="#gaedabbb0590c33b7b9ce1ce213629dd3e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga59d94ba578f9d7a90fd5d82ee6f361b4">avresample_configuration</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the libavresample build-time configuration. <a href="#ga59d94ba578f9d7a90fd5d82ee6f361b4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga7e3794756514c6ccf42580c2a840d16c">avresample_license</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the libavresample license. <a href="#ga7e3794756514c6ccf42580c2a840d16c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const <a class="el" href="structAVClass.html">AVClass</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga40d8eeb3181386e30e5b02289e469a73">avresample_get_class</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the <a class="el" href="structAVClass.html" title="Describe the class of an AVClass context structure.">AVClass</a> for AVAudioResampleContext. <a href="#ga40d8eeb3181386e30e5b02289e469a73"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga5b1bcb7a35446a07ce330a0ca2b38b72">avresample_alloc_context</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate AVAudioResampleContext and set options. <a href="#ga5b1bcb7a35446a07ce330a0ca2b38b72"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#gafc59c68689be880494ff24d10fd85143">avresample_open</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Initialize AVAudioResampleContext. <a href="#gafc59c68689be880494ff24d10fd85143"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga56519a7b3646ca435e64cb247c173c60">avresample_is_open</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Check whether an AVAudioResampleContext is open or closed. <a href="#ga56519a7b3646ca435e64cb247c173c60"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga30751a8c6923418a090281669362bf79">avresample_close</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Close AVAudioResampleContext. <a href="#ga30751a8c6923418a090281669362bf79"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga1d0782fe9a331b823c6d0dda5dbc63a5">avresample_free</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> **avr)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Free AVAudioResampleContext and associated <a class="el" href="structAVOption.html" title="AVOption.">AVOption</a> values. <a href="#ga1d0782fe9a331b823c6d0dda5dbc63a5"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga496a46260f4a5f5854ecc21f0f0011c8">avresample_build_matrix</a> (uint64_t in_layout, uint64_t out_layout, double center_mix_level, double surround_mix_level, double lfe_mix_level, int normalize, double *matrix, int stride, enum <a class="el" href="group__channel__mask__c.html#gabd576ea664e3ac5d31f3362064fe13e6">AVMatrixEncoding</a> matrix_encoding)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Generate a channel mixing matrix. <a href="#ga496a46260f4a5f5854ecc21f0f0011c8"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga74d920b2dd1af265d7186a33f60e08e0">avresample_get_matrix</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr, double *matrix, int stride)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the current channel mixing matrix. <a href="#ga74d920b2dd1af265d7186a33f60e08e0"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga3311c71aa573523c04882809143a9107">avresample_set_matrix</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr, const double *matrix, int stride)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set channel mixing matrix. <a href="#ga3311c71aa573523c04882809143a9107"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#gafc3b3ffa44345e07babdd69267527cfc">avresample_set_channel_mapping</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr, const int *channel_map)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set a customized input channel mapping. <a href="#gafc3b3ffa44345e07babdd69267527cfc"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga2c7722a7b56ed3c4a44174611316d6ab">avresample_set_compensation</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr, int sample_delta, int compensation_distance)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set compensation for resampling. <a href="#ga2c7722a7b56ed3c4a44174611316d6ab"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga16a346512f238e128ba567209b7ac103">avresample_get_out_samples</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr, int in_nb_samples)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Provide the upper bound on the number of samples the configured conversion would output. <a href="#ga16a346512f238e128ba567209b7ac103"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e">avresample_convert</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr, uint8_t **output, int out_plane_size, int out_samples, uint8_t **input, int in_plane_size, int in_samples)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Convert input samples and write them to the output FIFO. <a href="#ga396ac8bcc2959dcedad01f91bab8145e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga66240ec48b20c7a688ea0cd5fae6db15">avresample_get_delay</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the number of samples currently in the resampling delay buffer. <a href="#ga66240ec48b20c7a688ea0cd5fae6db15"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga1ed549e1e347ab11bb81883b9ce6bca2">avresample_available</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the number of available samples in the output FIFO. <a href="#ga1ed549e1e347ab11bb81883b9ce6bca2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#gae115c3f6edea41ae634583737bc554f9">avresample_read</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr, uint8_t **output, int nb_samples)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Read samples from the output FIFO. <a href="#gae115c3f6edea41ae634583737bc554f9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#gac3060330c9004aa7e88ba8d9d90b0689">avresample_convert_frame</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr, <a class="el" href="structAVFrame.html">AVFrame</a> *output, <a class="el" href="structAVFrame.html">AVFrame</a> *input)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Convert the samples in the input <a class="el" href="structAVFrame.html" title="This structure describes decoded (raw) audio or video data.">AVFrame</a> and write them to the output <a class="el" href="structAVFrame.html" title="This structure describes decoded (raw) audio or video data.">AVFrame</a>. <a href="#gac3060330c9004aa7e88ba8d9d90b0689"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavr.html#ga7528c331f29fc476b264b2de31f17f1e">avresample_config</a> (<a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr, <a class="el" href="structAVFrame.html">AVFrame</a> *out, <a class="el" href="structAVFrame.html">AVFrame</a> *in)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Configure or reconfigure the AVAudioResampleContext using the information provided by the AVFrames. <a href="#ga7528c331f29fc476b264b2de31f17f1e"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>Libavresample (lavr) is a library that handles audio resampling, sample format conversion and mixing. </p>
<p>Interaction with lavr is done through AVAudioResampleContext, which is allocated with <a class="el" href="group__lavr.html#ga5b1bcb7a35446a07ce330a0ca2b38b72" title="Allocate AVAudioResampleContext and set options.">avresample_alloc_context()</a>. It is opaque, so all parameters must be set with the <a class="el" href="group__avoptions.html">AVOptions</a> API.</p>
<p>For example the following code will setup conversion from planar float sample format to interleaved signed 16-bit integer, downsampling from 48kHz to 44.1kHz and downmixing from 5.1 channels to stereo (using the default mixing matrix): </p>
<div class="fragment"><pre class="fragment"> <a class="code" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> *avr = <a class="code" href="group__lavr.html#ga5b1bcb7a35446a07ce330a0ca2b38b72" title="Allocate AVAudioResampleContext and set options.">avresample_alloc_context</a>();
<a class="code" href="group__opt__set__funcs.html#ga3adf7185c21cc080890a5ec02c2e56b2">av_opt_set_int</a>(avr, <span class="stringliteral">"in_channel_layout"</span>, <a class="code" href="group__channel__mask__c.html#gac36a042dc21866f9043ce930f300d0df">AV_CH_LAYOUT_5POINT1</a>, 0);
<a class="code" href="group__opt__set__funcs.html#ga3adf7185c21cc080890a5ec02c2e56b2">av_opt_set_int</a>(avr, <span class="stringliteral">"out_channel_layout"</span>, <a class="code" href="group__channel__mask__c.html#gabc6d6651bba254cd0fa2c42a57228e65">AV_CH_LAYOUT_STEREO</a>, 0);
<a class="code" href="group__opt__set__funcs.html#ga3adf7185c21cc080890a5ec02c2e56b2">av_opt_set_int</a>(avr, <span class="stringliteral">"in_sample_rate"</span>, 48000, 0);
<a class="code" href="group__opt__set__funcs.html#ga3adf7185c21cc080890a5ec02c2e56b2">av_opt_set_int</a>(avr, <span class="stringliteral">"out_sample_rate"</span>, 44100, 0);
<a class="code" href="group__opt__set__funcs.html#ga3adf7185c21cc080890a5ec02c2e56b2">av_opt_set_int</a>(avr, <span class="stringliteral">"in_sample_fmt"</span>, <a class="code" href="group__lavu__sampfmts.html#ggaf9a51ca15301871723577c730b5865c5a2d21c520e4ab21100b6440ec2d81ba1b" title="float, planar">AV_SAMPLE_FMT_FLTP</a>, 0);
<a class="code" href="group__opt__set__funcs.html#ga3adf7185c21cc080890a5ec02c2e56b2">av_opt_set_int</a>(avr, <span class="stringliteral">"out_sample_fmt"</span>, <a class="code" href="group__lavu__sampfmts.html#ggaf9a51ca15301871723577c730b5865c5aea6132df57aebc3f76e10665395c46af" title="signed 16 bits">AV_SAMPLE_FMT_S16</a>, 0);
</pre></div><p>Once the context is initialized, it must be opened with <a class="el" href="group__lavr.html#gafc59c68689be880494ff24d10fd85143" title="Initialize AVAudioResampleContext.">avresample_open()</a>. If you need to change the conversion parameters, you must close the context with <a class="el" href="group__lavr.html#ga30751a8c6923418a090281669362bf79" title="Close AVAudioResampleContext.">avresample_close()</a>, change the parameters as described above, then reopen it again.</p>
<p>The conversion itself is done by repeatedly calling <a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert()</a>. Note that the samples may get buffered in two places in lavr. The first one is the output FIFO, where the samples end up if the output buffer is not large enough. The data stored in there may be retrieved at any time with <a class="el" href="group__lavr.html#gae115c3f6edea41ae634583737bc554f9" title="Read samples from the output FIFO.">avresample_read()</a>. The second place is the resampling delay buffer, applicable only when resampling is done. The samples in it require more input before they can be processed. Their current amount is returned by <a class="el" href="group__lavr.html#ga66240ec48b20c7a688ea0cd5fae6db15" title="Return the number of samples currently in the resampling delay buffer.">avresample_get_delay()</a>. At the end of conversion the resampling buffer can be flushed by calling <a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert()</a> with NULL input.</p>
<p>The following code demonstrates the conversion loop assuming the parameters from above and caller-defined functions <a class="el" href="filter__audio_8c.html#a4209191767f4a5779718e9f691a6de53">get_input()</a> and handle_output(): </p>
<div class="fragment"><pre class="fragment"> uint8_t **input;
<span class="keywordtype">int</span> in_linesize, in_samples;
<span class="keywordflow">while</span> (<a class="code" href="filter__audio_8c.html#a4209191767f4a5779718e9f691a6de53">get_input</a>(&input, &in_linesize, &in_samples)) {
uint8_t *output
<span class="keywordtype">int</span> out_linesize;
<span class="keywordtype">int</span> out_samples = <a class="code" href="group__lavr.html#ga16a346512f238e128ba567209b7ac103" title="Provide the upper bound on the number of samples the configured conversion would output.">avresample_get_out_samples</a>(avr, in_samples);
<a class="code" href="group__lavu__sampmanip.html#ga4db4c77f928d32c7d8854732f50b8c04" title="Allocate a samples buffer for nb_samples samples, and fill data pointers and linesize accordingly...">av_samples_alloc</a>(&output, &out_linesize, 2, out_samples,
<a class="code" href="group__lavu__sampfmts.html#ggaf9a51ca15301871723577c730b5865c5aea6132df57aebc3f76e10665395c46af" title="signed 16 bits">AV_SAMPLE_FMT_S16</a>, 0);
out_samples = <a class="code" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert</a>(avr, &output, out_linesize, out_samples,
input, in_linesize, in_samples);
handle_output(output, out_linesize, out_samples);
<a class="code" href="group__lavu__mem.html#ga0cc84043ea2167ad005c86e11d0bcdba" title="Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...">av_freep</a>(&output);
}
</pre></div><p>When the conversion is finished and the FIFOs are flushed if required, the conversion context and everything associated with it must be freed with <a class="el" href="group__lavr.html#ga1d0782fe9a331b823c6d0dda5dbc63a5" title="Free AVAudioResampleContext and associated AVOption values.">avresample_free()</a>. </p>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="gaee1afc173c8d1eefe0e1d8a881b7df26"></a><!-- doxytag: member="avresample.h::AVRESAMPLE_MAX_CHANNELS" ref="gaee1afc173c8d1eefe0e1d8a881b7df26" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="group__lavr.html#gaee1afc173c8d1eefe0e1d8a881b7df26">AVRESAMPLE_MAX_CHANNELS</a>   32</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="avresample_8h_source.html#l00104">104</a> of file <a class="el" href="avresample_8h_source.html">avresample.h</a>.</p>
</div>
</div>
<hr/><h2>Typedef Documentation</h2>
<a class="anchor" id="gabe4ee61779da95d51dff716ef5b275a3"></a><!-- doxytag: member="avresample.h::AVAudioResampleContext" ref="gabe4ee61779da95d51dff716ef5b275a3" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef struct <a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> <a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="avresample_8h_source.html#l00106">106</a> of file <a class="el" href="avresample_8h_source.html">avresample.h</a>.</p>
</div>
</div>
<hr/><h2>Enumeration Type Documentation</h2>
<a class="anchor" id="gaaaa652e3ad8554a0dca126e8571735dd"></a><!-- doxytag: member="avresample.h::AVMixCoeffType" ref="gaaaa652e3ad8554a0dca126e8571735dd" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group__lavr.html#gaaaa652e3ad8554a0dca126e8571735dd">AVMixCoeffType</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Mixing Coefficient Types. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="ggaaaa652e3ad8554a0dca126e8571735ddab01d45f335057a1f930b0b677adb3a60"></a><!-- doxytag: member="AV_MIX_COEFF_TYPE_Q8" ref="ggaaaa652e3ad8554a0dca126e8571735ddab01d45f335057a1f930b0b677adb3a60" args="" -->AV_MIX_COEFF_TYPE_Q8</em> </td><td>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="ggaaaa652e3ad8554a0dca126e8571735ddaf459c8599c850abd5d0308cd8609af68"></a><!-- doxytag: member="AV_MIX_COEFF_TYPE_Q15" ref="ggaaaa652e3ad8554a0dca126e8571735ddaf459c8599c850abd5d0308cd8609af68" args="" -->AV_MIX_COEFF_TYPE_Q15</em> </td><td>
<p>16-bit 8.8 fixed-point </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="ggaaaa652e3ad8554a0dca126e8571735dda5d6c3ee92cc045714ac2ec4c83588841"></a><!-- doxytag: member="AV_MIX_COEFF_TYPE_FLT" ref="ggaaaa652e3ad8554a0dca126e8571735dda5d6c3ee92cc045714ac2ec4c83588841" args="" -->AV_MIX_COEFF_TYPE_FLT</em> </td><td>
<p>32-bit 17.15 fixed-point </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="ggaaaa652e3ad8554a0dca126e8571735dda2672ba31292b1fb0a861b035466964a9"></a><!-- doxytag: member="AV_MIX_COEFF_TYPE_NB" ref="ggaaaa652e3ad8554a0dca126e8571735dda2672ba31292b1fb0a861b035466964a9" args="" -->AV_MIX_COEFF_TYPE_NB</em> </td><td>
<p>floating-point </p>
</td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="avresample_8h_source.html#l00109">109</a> of file <a class="el" href="avresample_8h_source.html">avresample.h</a>.</p>
</div>
</div>
<a class="anchor" id="ga3813087032c02f1e84f0ca2962b09400"></a><!-- doxytag: member="avresample.h::AVResampleFilterType" ref="ga3813087032c02f1e84f0ca2962b09400" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group__lavr.html#ga3813087032c02f1e84f0ca2962b09400">AVResampleFilterType</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Resampling Filter Types. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="gga3813087032c02f1e84f0ca2962b09400ac8d3b66c4c4bd02418ce0b882fb7d4fa"></a><!-- doxytag: member="AV_RESAMPLE_FILTER_TYPE_CUBIC" ref="gga3813087032c02f1e84f0ca2962b09400ac8d3b66c4c4bd02418ce0b882fb7d4fa" args="" -->AV_RESAMPLE_FILTER_TYPE_CUBIC</em> </td><td>
<p>Cubic. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="gga3813087032c02f1e84f0ca2962b09400ace0cbc5bda3d6fa26b054b2fa7702886"></a><!-- doxytag: member="AV_RESAMPLE_FILTER_TYPE_BLACKMAN_NUTTALL" ref="gga3813087032c02f1e84f0ca2962b09400ace0cbc5bda3d6fa26b054b2fa7702886" args="" -->AV_RESAMPLE_FILTER_TYPE_BLACKMAN_NUTTALL</em> </td><td>
<p>Blackman Nuttall Windowed Sinc. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="gga3813087032c02f1e84f0ca2962b09400af552d08855b8a5f4b46f6328633c8f1f"></a><!-- doxytag: member="AV_RESAMPLE_FILTER_TYPE_KAISER" ref="gga3813087032c02f1e84f0ca2962b09400af552d08855b8a5f4b46f6328633c8f1f" args="" -->AV_RESAMPLE_FILTER_TYPE_KAISER</em> </td><td>
<p>Kaiser Windowed Sinc. </p>
</td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="avresample_8h_source.html#l00117">117</a> of file <a class="el" href="avresample_8h_source.html">avresample.h</a>.</p>
</div>
</div>
<a class="anchor" id="ga302491313b02acca1a822249caa8cb10"></a><!-- doxytag: member="avresample.h::AVResampleDitherMethod" ref="ga302491313b02acca1a822249caa8cb10" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group__lavr.html#ga302491313b02acca1a822249caa8cb10">AVResampleDitherMethod</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="gga302491313b02acca1a822249caa8cb10a4f892b254f02b3ebf775169f786e966b"></a><!-- doxytag: member="AV_RESAMPLE_DITHER_NONE" ref="gga302491313b02acca1a822249caa8cb10a4f892b254f02b3ebf775169f786e966b" args="" -->AV_RESAMPLE_DITHER_NONE</em> </td><td>
<p>Do not use dithering. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="gga302491313b02acca1a822249caa8cb10a6e6841e6042d8059db5fdebe67d783ad"></a><!-- doxytag: member="AV_RESAMPLE_DITHER_RECTANGULAR" ref="gga302491313b02acca1a822249caa8cb10a6e6841e6042d8059db5fdebe67d783ad" args="" -->AV_RESAMPLE_DITHER_RECTANGULAR</em> </td><td>
<p>Rectangular Dither. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="gga302491313b02acca1a822249caa8cb10a4d9b50692d2a3cdf6c3cfeb7f14ccfc6"></a><!-- doxytag: member="AV_RESAMPLE_DITHER_TRIANGULAR" ref="gga302491313b02acca1a822249caa8cb10a4d9b50692d2a3cdf6c3cfeb7f14ccfc6" args="" -->AV_RESAMPLE_DITHER_TRIANGULAR</em> </td><td>
<p>Triangular Dither. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="gga302491313b02acca1a822249caa8cb10a261d5a5101aeff5e7ff5813787481bd6"></a><!-- doxytag: member="AV_RESAMPLE_DITHER_TRIANGULAR_HP" ref="gga302491313b02acca1a822249caa8cb10a261d5a5101aeff5e7ff5813787481bd6" args="" -->AV_RESAMPLE_DITHER_TRIANGULAR_HP</em> </td><td>
<p>Triangular Dither with High Pass. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="gga302491313b02acca1a822249caa8cb10aa1abacc1c6e8c448959bc49316b8f566"></a><!-- doxytag: member="AV_RESAMPLE_DITHER_TRIANGULAR_NS" ref="gga302491313b02acca1a822249caa8cb10aa1abacc1c6e8c448959bc49316b8f566" args="" -->AV_RESAMPLE_DITHER_TRIANGULAR_NS</em> </td><td>
<p>Triangular Dither with Noise Shaping. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="gga302491313b02acca1a822249caa8cb10ac9e29d7f4af2590ba9a59429d88d57c0"></a><!-- doxytag: member="AV_RESAMPLE_DITHER_NB" ref="gga302491313b02acca1a822249caa8cb10ac9e29d7f4af2590ba9a59429d88d57c0" args="" -->AV_RESAMPLE_DITHER_NB</em> </td><td>
<p>Number of dither types. </p>
<p>Not part of ABI. </p>
</td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="avresample_8h_source.html#l00123">123</a> of file <a class="el" href="avresample_8h_source.html">avresample.h</a>.</p>
</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="gaedabbb0590c33b7b9ce1ce213629dd3e"></a><!-- doxytag: member="avresample.h::avresample_version" ref="gaedabbb0590c33b7b9ce1ce213629dd3e" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned <a class="el" href="group__lavr.html#gaedabbb0590c33b7b9ce1ce213629dd3e">avresample_version</a> </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Return the LIBAVRESAMPLE_VERSION_INT constant. </p>
</div>
</div>
<a class="anchor" id="ga59d94ba578f9d7a90fd5d82ee6f361b4"></a><!-- doxytag: member="avresample.h::avresample_configuration" ref="ga59d94ba578f9d7a90fd5d82ee6f361b4" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* <a class="el" href="group__lavr.html#ga59d94ba578f9d7a90fd5d82ee6f361b4">avresample_configuration</a> </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Return the libavresample build-time configuration. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>configure string </dd></dl>
</div>
</div>
<a class="anchor" id="ga7e3794756514c6ccf42580c2a840d16c"></a><!-- doxytag: member="avresample.h::avresample_license" ref="ga7e3794756514c6ccf42580c2a840d16c" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* <a class="el" href="group__lavr.html#ga7e3794756514c6ccf42580c2a840d16c">avresample_license</a> </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Return the libavresample license. </p>
</div>
</div>
<a class="anchor" id="ga40d8eeb3181386e30e5b02289e469a73"></a><!-- doxytag: member="avresample.h::avresample_get_class" ref="ga40d8eeb3181386e30e5b02289e469a73" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const <a class="el" href="structAVClass.html">AVClass</a>* <a class="el" href="group__lavr.html#ga40d8eeb3181386e30e5b02289e469a73">avresample_get_class</a> </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Get the <a class="el" href="structAVClass.html" title="Describe the class of an AVClass context structure.">AVClass</a> for AVAudioResampleContext. </p>
<p>Can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options without allocating a context.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__avoptions.html#gae31ae7fb20113b00108d0ecf53f25664" title="Look for an option in an object.">av_opt_find()</a>.</dd></dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="structAVClass.html" title="Describe the class of an AVClass context structure.">AVClass</a> for AVAudioResampleContext </dd></dl>
</div>
</div>
<a class="anchor" id="ga5b1bcb7a35446a07ce330a0ca2b38b72"></a><!-- doxytag: member="avresample.h::avresample_alloc_context" ref="ga5b1bcb7a35446a07ce330a0ca2b38b72" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a>* <a class="el" href="group__lavr.html#ga5b1bcb7a35446a07ce330a0ca2b38b72">avresample_alloc_context</a> </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Allocate AVAudioResampleContext and set options. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>allocated audio resample context, or NULL on failure </dd></dl>
</div>
</div>
<a class="anchor" id="gafc59c68689be880494ff24d10fd85143"></a><!-- doxytag: member="avresample.h::avresample_open" ref="gafc59c68689be880494ff24d10fd85143" args="(AVAudioResampleContext *avr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__lavr.html#gafc59c68689be880494ff24d10fd85143">avresample_open</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td>
<td class="paramname"><em>avr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initialize AVAudioResampleContext. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>The context must be configured using the <a class="el" href="structAVOption.html" title="AVOption.">AVOption</a> API.</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__opt__set__funcs.html#ga3adf7185c21cc080890a5ec02c2e56b2">av_opt_set_int()</a> </dd>
<dd>
<a class="el" href="group__avoptions.html#gaf1a88e8f152d7835f111b1ef8813fb2e" title="Set all the options from a given dictionary on an object.">av_opt_set_dict()</a></dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>audio resample context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, negative AVERROR code on failure </dd></dl>
</div>
</div>
<a class="anchor" id="ga56519a7b3646ca435e64cb247c173c60"></a><!-- doxytag: member="avresample.h::avresample_is_open" ref="ga56519a7b3646ca435e64cb247c173c60" args="(AVAudioResampleContext *avr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__lavr.html#ga56519a7b3646ca435e64cb247c173c60">avresample_is_open</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td>
<td class="paramname"><em>avr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Check whether an AVAudioResampleContext is open or closed. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>AVAudioResampleContext to check </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 if avr is open, 0 if avr is closed. </dd></dl>
</div>
</div>
<a class="anchor" id="ga30751a8c6923418a090281669362bf79"></a><!-- doxytag: member="avresample.h::avresample_close" ref="ga30751a8c6923418a090281669362bf79" args="(AVAudioResampleContext *avr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="group__lavr.html#ga30751a8c6923418a090281669362bf79">avresample_close</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td>
<td class="paramname"><em>avr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Close AVAudioResampleContext. </p>
<p>This closes the context, but it does not change the parameters. The context can be reopened with <a class="el" href="group__lavr.html#gafc59c68689be880494ff24d10fd85143" title="Initialize AVAudioResampleContext.">avresample_open()</a>. It does, however, clear the output FIFO and any remaining leftover samples in the resampling delay buffer. If there was a custom matrix being used, that is also cleared.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert()</a> </dd>
<dd>
<a class="el" href="group__lavr.html#ga3311c71aa573523c04882809143a9107" title="Set channel mixing matrix.">avresample_set_matrix()</a></dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>audio resample context </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga1d0782fe9a331b823c6d0dda5dbc63a5"></a><!-- doxytag: member="avresample.h::avresample_free" ref="ga1d0782fe9a331b823c6d0dda5dbc63a5" args="(AVAudioResampleContext **avr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="group__lavr.html#ga1d0782fe9a331b823c6d0dda5dbc63a5">avresample_free</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> ** </td>
<td class="paramname"><em>avr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Free AVAudioResampleContext and associated <a class="el" href="structAVOption.html" title="AVOption.">AVOption</a> values. </p>
<p>This also calls <a class="el" href="group__lavr.html#ga30751a8c6923418a090281669362bf79" title="Close AVAudioResampleContext.">avresample_close()</a> before freeing.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>audio resample context </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga496a46260f4a5f5854ecc21f0f0011c8"></a><!-- doxytag: member="avresample.h::avresample_build_matrix" ref="ga496a46260f4a5f5854ecc21f0f0011c8" args="(uint64_t in_layout, uint64_t out_layout, double center_mix_level, double surround_mix_level, double lfe_mix_level, int normalize, double *matrix, int stride, enum AVMatrixEncoding matrix_encoding)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__lavr.html#ga496a46260f4a5f5854ecc21f0f0011c8">avresample_build_matrix</a> </td>
<td>(</td>
<td class="paramtype">uint64_t </td>
<td class="paramname"><em>in_layout</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t </td>
<td class="paramname"><em>out_layout</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>center_mix_level</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>surround_mix_level</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>lfe_mix_level</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>normalize</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double * </td>
<td class="paramname"><em>matrix</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>stride</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">enum <a class="el" href="group__channel__mask__c.html#gabd576ea664e3ac5d31f3362064fe13e6">AVMatrixEncoding</a> </td>
<td class="paramname"><em>matrix_encoding</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Generate a channel mixing matrix. </p>
<p>This function is the one used internally by libavresample for building the default mixing matrix. It is made public just as a utility function for building custom matrices.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir"></td><td class="paramname">in_layout</td><td>input channel layout </td></tr>
<tr><td class="paramdir"></td><td class="paramname">out_layout</td><td>output channel layout </td></tr>
<tr><td class="paramdir"></td><td class="paramname">center_mix_level</td><td>mix level for the center channel </td></tr>
<tr><td class="paramdir"></td><td class="paramname">surround_mix_level</td><td>mix level for the surround channel(s) </td></tr>
<tr><td class="paramdir"></td><td class="paramname">lfe_mix_level</td><td>mix level for the low-frequency effects channel </td></tr>
<tr><td class="paramdir"></td><td class="paramname">normalize</td><td>if 1, coefficients will be normalized to prevent overflow. if 0, coefficients will not be normalized. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">matrix</td><td>mixing coefficients; matrix[i + stride * o] is the weight of input channel i in output channel o. </td></tr>
<tr><td class="paramdir"></td><td class="paramname">stride</td><td>distance between adjacent input channels in the matrix array </td></tr>
<tr><td class="paramdir"></td><td class="paramname">matrix_encoding</td><td>matrixed stereo downmix mode (e.g. dplii) </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, negative AVERROR code on failure </dd></dl>
</div>
</div>
<a class="anchor" id="ga74d920b2dd1af265d7186a33f60e08e0"></a><!-- doxytag: member="avresample.h::avresample_get_matrix" ref="ga74d920b2dd1af265d7186a33f60e08e0" args="(AVAudioResampleContext *avr, double *matrix, int stride)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__lavr.html#ga74d920b2dd1af265d7186a33f60e08e0">avresample_get_matrix</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td>
<td class="paramname"><em>avr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double * </td>
<td class="paramname"><em>matrix</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>stride</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Get the current channel mixing matrix. </p>
<p>If no custom matrix has been previously set or the AVAudioResampleContext is not open, an error is returned.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>audio resample context </td></tr>
<tr><td class="paramname">matrix</td><td>mixing coefficients; matrix[i + stride * o] is the weight of input channel i in output channel o. </td></tr>
<tr><td class="paramname">stride</td><td>distance between adjacent input channels in the matrix array </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, negative AVERROR code on failure </dd></dl>
</div>
</div>
<a class="anchor" id="ga3311c71aa573523c04882809143a9107"></a><!-- doxytag: member="avresample.h::avresample_set_matrix" ref="ga3311c71aa573523c04882809143a9107" args="(AVAudioResampleContext *avr, const double *matrix, int stride)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__lavr.html#ga3311c71aa573523c04882809143a9107">avresample_set_matrix</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td>
<td class="paramname"><em>avr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const double * </td>
<td class="paramname"><em>matrix</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>stride</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Set channel mixing matrix. </p>
<p>Allows for setting a custom mixing matrix, overriding the default matrix generated internally during <a class="el" href="group__lavr.html#gafc59c68689be880494ff24d10fd85143" title="Initialize AVAudioResampleContext.">avresample_open()</a>. This function can be called anytime on an allocated context, either before or after calling <a class="el" href="group__lavr.html#gafc59c68689be880494ff24d10fd85143" title="Initialize AVAudioResampleContext.">avresample_open()</a>, as long as the channel layouts have been set. <a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert()</a> always uses the current matrix. Calling <a class="el" href="group__lavr.html#ga30751a8c6923418a090281669362bf79" title="Close AVAudioResampleContext.">avresample_close()</a> on the context will clear the current matrix.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__lavr.html#ga30751a8c6923418a090281669362bf79" title="Close AVAudioResampleContext.">avresample_close()</a></dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>audio resample context </td></tr>
<tr><td class="paramname">matrix</td><td>mixing coefficients; matrix[i + stride * o] is the weight of input channel i in output channel o. </td></tr>
<tr><td class="paramname">stride</td><td>distance between adjacent input channels in the matrix array </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, negative AVERROR code on failure </dd></dl>
</div>
</div>
<a class="anchor" id="gafc3b3ffa44345e07babdd69267527cfc"></a><!-- doxytag: member="avresample.h::avresample_set_channel_mapping" ref="gafc3b3ffa44345e07babdd69267527cfc" args="(AVAudioResampleContext *avr, const int *channel_map)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__lavr.html#gafc3b3ffa44345e07babdd69267527cfc">avresample_set_channel_mapping</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td>
<td class="paramname"><em>avr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int * </td>
<td class="paramname"><em>channel_map</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Set a customized input channel mapping. </p>
<p>This function can only be called when the allocated context is not open. Also, the input channel layout must have already been set.</p>
<p>Calling <a class="el" href="group__lavr.html#ga30751a8c6923418a090281669362bf79" title="Close AVAudioResampleContext.">avresample_close()</a> on the context will clear the channel mapping.</p>
<p>The map for each input channel specifies the channel index in the source to use for that particular channel, or -1 to mute the channel. Source channels can be duplicated by using the same index for multiple input channels.</p>
<p>Examples:</p>
<p>Reordering 5.1 AAC order (C,L,R,Ls,Rs,LFE) to FFmpeg order (L,R,C,LFE,Ls,Rs): { 1, 2, 0, 5, 3, 4 }</p>
<p>Muting the 3rd channel in 4-channel input: { 0, 1, -1, 3 }</p>
<p>Duplicating the left channel of stereo input: { 0, 0 }</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>audio resample context </td></tr>
<tr><td class="paramname">channel_map</td><td>customized input channel mapping </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, negative AVERROR code on failure </dd></dl>
</div>
</div>
<a class="anchor" id="ga2c7722a7b56ed3c4a44174611316d6ab"></a><!-- doxytag: member="avresample.h::avresample_set_compensation" ref="ga2c7722a7b56ed3c4a44174611316d6ab" args="(AVAudioResampleContext *avr, int sample_delta, int compensation_distance)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__lavr.html#ga2c7722a7b56ed3c4a44174611316d6ab">avresample_set_compensation</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td>
<td class="paramname"><em>avr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>sample_delta</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>compensation_distance</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Set compensation for resampling. </p>
<p>This can be called anytime after <a class="el" href="group__lavr.html#gafc59c68689be880494ff24d10fd85143" title="Initialize AVAudioResampleContext.">avresample_open()</a>. If resampling is not automatically enabled because of a sample rate conversion, the "force_resampling" option must have been set to 1 when opening the context in order to use resampling compensation.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>audio resample context </td></tr>
<tr><td class="paramname">sample_delta</td><td>compensation delta, in samples </td></tr>
<tr><td class="paramname">compensation_distance</td><td>compensation distance, in samples </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, negative AVERROR code on failure </dd></dl>
</div>
</div>
<a class="anchor" id="ga16a346512f238e128ba567209b7ac103"></a><!-- doxytag: member="avresample.h::avresample_get_out_samples" ref="ga16a346512f238e128ba567209b7ac103" args="(AVAudioResampleContext *avr, int in_nb_samples)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__lavr.html#ga16a346512f238e128ba567209b7ac103">avresample_get_out_samples</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td>
<td class="paramname"><em>avr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>in_nb_samples</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Provide the upper bound on the number of samples the configured conversion would output. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>audio resample context </td></tr>
<tr><td class="paramname">in_nb_samples</td><td>number of input samples</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>number of samples or <a class="el" href="group__lavu__error.html#gae4bb6f165973d09584e0ec0f335f69ca">AVERROR(EINVAL)</a> if the value would exceed INT_MAX </dd></dl>
</div>
</div>
<a class="anchor" id="ga396ac8bcc2959dcedad01f91bab8145e"></a><!-- doxytag: member="avresample.h::avresample_convert" ref="ga396ac8bcc2959dcedad01f91bab8145e" args="(AVAudioResampleContext *avr, uint8_t **output, int out_plane_size, int out_samples, uint8_t **input, int in_plane_size, int in_samples)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e">avresample_convert</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td>
<td class="paramname"><em>avr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t ** </td>
<td class="paramname"><em>output</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>out_plane_size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>out_samples</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t ** </td>
<td class="paramname"><em>input</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>in_plane_size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>in_samples</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Convert input samples and write them to the output FIFO. </p>
<p>The upper bound on the number of output samples can be obtained through <a class="el" href="group__lavr.html#ga16a346512f238e128ba567209b7ac103" title="Provide the upper bound on the number of samples the configured conversion would output.">avresample_get_out_samples()</a>.</p>
<p>The output data can be NULL or have fewer allocated samples than required. In this case, any remaining samples not written to the output will be added to an internal FIFO buffer, to be returned at the next call to this function or to <a class="el" href="group__lavr.html#gae115c3f6edea41ae634583737bc554f9" title="Read samples from the output FIFO.">avresample_read()</a>.</p>
<p>If converting sample rate, there may be data remaining in the internal resampling delay buffer. <a class="el" href="group__lavr.html#ga66240ec48b20c7a688ea0cd5fae6db15" title="Return the number of samples currently in the resampling delay buffer.">avresample_get_delay()</a> tells the number of remaining samples. To get this data as output, call <a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert()</a> with NULL input.</p>
<p>At the end of the conversion process, there may be data remaining in the internal FIFO buffer. <a class="el" href="group__lavr.html#ga1ed549e1e347ab11bb81883b9ce6bca2" title="Return the number of available samples in the output FIFO.">avresample_available()</a> tells the number of remaining samples. To get this data as output, either call <a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert()</a> with NULL input or call <a class="el" href="group__lavr.html#gae115c3f6edea41ae634583737bc554f9" title="Read samples from the output FIFO.">avresample_read()</a>.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__lavr.html#ga16a346512f238e128ba567209b7ac103" title="Provide the upper bound on the number of samples the configured conversion would output.">avresample_get_out_samples()</a> </dd>
<dd>
<a class="el" href="group__lavr.html#gae115c3f6edea41ae634583737bc554f9" title="Read samples from the output FIFO.">avresample_read()</a> </dd>
<dd>
<a class="el" href="group__lavr.html#ga66240ec48b20c7a688ea0cd5fae6db15" title="Return the number of samples currently in the resampling delay buffer.">avresample_get_delay()</a></dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>audio resample context </td></tr>
<tr><td class="paramname">output</td><td>output data pointers </td></tr>
<tr><td class="paramname">out_plane_size</td><td>output plane size, in bytes. This can be 0 if unknown, but that will lead to optimized functions not being used directly on the output, which could slow down some conversions. </td></tr>
<tr><td class="paramname">out_samples</td><td>maximum number of samples that the output buffer can hold </td></tr>
<tr><td class="paramname">input</td><td>input data pointers </td></tr>
<tr><td class="paramname">in_plane_size</td><td>input plane size, in bytes This can be 0 if unknown, but that will lead to optimized functions not being used directly on the input, which could slow down some conversions. </td></tr>
<tr><td class="paramname">in_samples</td><td>number of input samples to convert </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>number of samples written to the output buffer, not including converted samples added to the internal output FIFO </dd></dl>
</div>
</div>
<a class="anchor" id="ga66240ec48b20c7a688ea0cd5fae6db15"></a><!-- doxytag: member="avresample.h::avresample_get_delay" ref="ga66240ec48b20c7a688ea0cd5fae6db15" args="(AVAudioResampleContext *avr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__lavr.html#ga66240ec48b20c7a688ea0cd5fae6db15">avresample_get_delay</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td>
<td class="paramname"><em>avr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Return the number of samples currently in the resampling delay buffer. </p>
<p>When resampling, there may be a delay between the input and output. Any unconverted samples in each call are stored internally in a delay buffer. This function allows the user to determine the current number of samples in the delay buffer, which can be useful for synchronization.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert()</a></dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>audio resample context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>number of samples currently in the resampling delay buffer </dd></dl>
</div>
</div>
<a class="anchor" id="ga1ed549e1e347ab11bb81883b9ce6bca2"></a><!-- doxytag: member="avresample.h::avresample_available" ref="ga1ed549e1e347ab11bb81883b9ce6bca2" args="(AVAudioResampleContext *avr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__lavr.html#ga1ed549e1e347ab11bb81883b9ce6bca2">avresample_available</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td>
<td class="paramname"><em>avr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Return the number of available samples in the output FIFO. </p>
<p>During conversion, if the user does not specify an output buffer or specifies an output buffer that is smaller than what is needed, remaining samples that are not written to the output are stored to an internal FIFO buffer. The samples in the FIFO can be read with <a class="el" href="group__lavr.html#gae115c3f6edea41ae634583737bc554f9" title="Read samples from the output FIFO.">avresample_read()</a> or <a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert()</a>.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__lavr.html#gae115c3f6edea41ae634583737bc554f9" title="Read samples from the output FIFO.">avresample_read()</a> </dd>
<dd>
<a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert()</a></dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>audio resample context </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>number of samples available for reading </dd></dl>
</div>
</div>
<a class="anchor" id="gae115c3f6edea41ae634583737bc554f9"></a><!-- doxytag: member="avresample.h::avresample_read" ref="gae115c3f6edea41ae634583737bc554f9" args="(AVAudioResampleContext *avr, uint8_t **output, int nb_samples)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__lavr.html#gae115c3f6edea41ae634583737bc554f9">avresample_read</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td>
<td class="paramname"><em>avr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t ** </td>
<td class="paramname"><em>output</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>nb_samples</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Read samples from the output FIFO. </p>
<p>During conversion, if the user does not specify an output buffer or specifies an output buffer that is smaller than what is needed, remaining samples that are not written to the output are stored to an internal FIFO buffer. This function can be used to read samples from that internal FIFO.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__lavr.html#ga1ed549e1e347ab11bb81883b9ce6bca2" title="Return the number of available samples in the output FIFO.">avresample_available()</a> </dd>
<dd>
<a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert()</a></dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>audio resample context </td></tr>
<tr><td class="paramname">output</td><td>output data pointers. May be NULL, in which case nb_samples of data is discarded from output FIFO. </td></tr>
<tr><td class="paramname">nb_samples</td><td>number of samples to read from the FIFO </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the number of samples written to output </dd></dl>
</div>
</div>
<a class="anchor" id="gac3060330c9004aa7e88ba8d9d90b0689"></a><!-- doxytag: member="avresample.h::avresample_convert_frame" ref="gac3060330c9004aa7e88ba8d9d90b0689" args="(AVAudioResampleContext *avr, AVFrame *output, AVFrame *input)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__lavr.html#gac3060330c9004aa7e88ba8d9d90b0689">avresample_convert_frame</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td>
<td class="paramname"><em>avr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVFrame.html">AVFrame</a> * </td>
<td class="paramname"><em>output</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVFrame.html">AVFrame</a> * </td>
<td class="paramname"><em>input</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Convert the samples in the input <a class="el" href="structAVFrame.html" title="This structure describes decoded (raw) audio or video data.">AVFrame</a> and write them to the output <a class="el" href="structAVFrame.html" title="This structure describes decoded (raw) audio or video data.">AVFrame</a>. </p>
<p>Input and output AVFrames must have channel_layout, sample_rate and format set.</p>
<p>The upper bound on the number of output samples is obtained through <a class="el" href="group__lavr.html#ga16a346512f238e128ba567209b7ac103" title="Provide the upper bound on the number of samples the configured conversion would output.">avresample_get_out_samples()</a>.</p>
<p>If the output <a class="el" href="structAVFrame.html" title="This structure describes decoded (raw) audio or video data.">AVFrame</a> does not have the data pointers allocated the nb_samples field will be set using <a class="el" href="group__lavr.html#ga16a346512f238e128ba567209b7ac103" title="Provide the upper bound on the number of samples the configured conversion would output.">avresample_get_out_samples()</a> and <a class="el" href="group__lavu__frame.html#ga6b1acbfa82c79bf7fd78d868572f0ceb" title="Allocate new buffer(s) for audio or video data.">av_frame_get_buffer()</a> is called to allocate the frame.</p>
<p>The output <a class="el" href="structAVFrame.html" title="This structure describes decoded (raw) audio or video data.">AVFrame</a> can be NULL or have fewer allocated samples than required. In this case, any remaining samples not written to the output will be added to an internal FIFO buffer, to be returned at the next call to this function or to <a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert()</a> or to <a class="el" href="group__lavr.html#gae115c3f6edea41ae634583737bc554f9" title="Read samples from the output FIFO.">avresample_read()</a>.</p>
<p>If converting sample rate, there may be data remaining in the internal resampling delay buffer. <a class="el" href="group__lavr.html#ga66240ec48b20c7a688ea0cd5fae6db15" title="Return the number of samples currently in the resampling delay buffer.">avresample_get_delay()</a> tells the number of remaining samples. To get this data as output, call this function or <a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert()</a> with NULL input.</p>
<p>At the end of the conversion process, there may be data remaining in the internal FIFO buffer. <a class="el" href="group__lavr.html#ga1ed549e1e347ab11bb81883b9ce6bca2" title="Return the number of available samples in the output FIFO.">avresample_available()</a> tells the number of remaining samples. To get this data as output, either call this function or <a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert()</a> with NULL input or call <a class="el" href="group__lavr.html#gae115c3f6edea41ae634583737bc554f9" title="Read samples from the output FIFO.">avresample_read()</a>.</p>
<p>If the AVAudioResampleContext configuration does not match the output and input <a class="el" href="structAVFrame.html" title="This structure describes decoded (raw) audio or video data.">AVFrame</a> settings the conversion does not take place and depending on which <a class="el" href="structAVFrame.html" title="This structure describes decoded (raw) audio or video data.">AVFrame</a> is not matching AVERROR_OUTPUT_CHANGED, AVERROR_INPUT_CHANGED or AVERROR_OUTPUT_CHANGED|AVERROR_INPUT_CHANGED is returned.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__lavr.html#ga16a346512f238e128ba567209b7ac103" title="Provide the upper bound on the number of samples the configured conversion would output.">avresample_get_out_samples()</a> </dd>
<dd>
<a class="el" href="group__lavr.html#ga1ed549e1e347ab11bb81883b9ce6bca2" title="Return the number of available samples in the output FIFO.">avresample_available()</a> </dd>
<dd>
<a class="el" href="group__lavr.html#ga396ac8bcc2959dcedad01f91bab8145e" title="Convert input samples and write them to the output FIFO.">avresample_convert()</a> </dd>
<dd>
<a class="el" href="group__lavr.html#gae115c3f6edea41ae634583737bc554f9" title="Read samples from the output FIFO.">avresample_read()</a> </dd>
<dd>
<a class="el" href="group__lavr.html#ga66240ec48b20c7a688ea0cd5fae6db15" title="Return the number of samples currently in the resampling delay buffer.">avresample_get_delay()</a></dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>audio resample context </td></tr>
<tr><td class="paramname">output</td><td>output <a class="el" href="structAVFrame.html" title="This structure describes decoded (raw) audio or video data.">AVFrame</a> </td></tr>
<tr><td class="paramname">input</td><td>input <a class="el" href="structAVFrame.html" title="This structure describes decoded (raw) audio or video data.">AVFrame</a> </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, AVERROR on failure or nonmatching configuration. </dd></dl>
</div>
</div>
<a class="anchor" id="ga7528c331f29fc476b264b2de31f17f1e"></a><!-- doxytag: member="avresample.h::avresample_config" ref="ga7528c331f29fc476b264b2de31f17f1e" args="(AVAudioResampleContext *avr, AVFrame *out, AVFrame *in)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__lavr.html#ga7528c331f29fc476b264b2de31f17f1e">avresample_config</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavr.html#gabe4ee61779da95d51dff716ef5b275a3">AVAudioResampleContext</a> * </td>
<td class="paramname"><em>avr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVFrame.html">AVFrame</a> * </td>
<td class="paramname"><em>out</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVFrame.html">AVFrame</a> * </td>
<td class="paramname"><em>in</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Configure or reconfigure the AVAudioResampleContext using the information provided by the AVFrames. </p>
<p>The original resampling context is reset even on failure. The function calls <a class="el" href="group__lavr.html#ga30751a8c6923418a090281669362bf79" title="Close AVAudioResampleContext.">avresample_close()</a> internally if the context is open.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__lavr.html#gafc59c68689be880494ff24d10fd85143" title="Initialize AVAudioResampleContext.">avresample_open()</a>; </dd>
<dd>
<a class="el" href="group__lavr.html#ga30751a8c6923418a090281669362bf79" title="Close AVAudioResampleContext.">avresample_close()</a>;</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">avr</td><td>audio resample context </td></tr>
<tr><td class="paramname">output</td><td>output <a class="el" href="structAVFrame.html" title="This structure describes decoded (raw) audio or video data.">AVFrame</a> </td></tr>
<tr><td class="paramname">input</td><td>input <a class="el" href="structAVFrame.html" title="This structure describes decoded (raw) audio or video data.">AVFrame</a> </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, AVERROR on failure. </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"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </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  <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>