Repository URL to install this package:
Version:
7:2.7.1-1ubuntu3 ▾
|
<!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: doc/examples/transcode_aac.c File Reference</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 class="current"><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 id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#define-members">Defines</a> |
<a href="#func-members">Functions</a> |
<a href="#var-members">Variables</a> </div>
<div class="headertitle">
<div class="title">doc/examples/transcode_aac.c File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>simple audio converter
<a href="#details">More...</a></p>
<div class="textblock"><code>#include <stdio.h></code><br/>
<code>#include "<a class="el" href="avformat_8h_source.html">libavformat/avformat.h</a>"</code><br/>
<code>#include "<a class="el" href="avio_8h_source.html">libavformat/avio.h</a>"</code><br/>
<code>#include "<a class="el" href="libavcodec_2avcodec_8h_source.html">libavcodec/avcodec.h</a>"</code><br/>
<code>#include "<a class="el" href="audio__fifo_8h_source.html">libavutil/audio_fifo.h</a>"</code><br/>
<code>#include "<a class="el" href="avassert_8h_source.html">libavutil/avassert.h</a>"</code><br/>
<code>#include "<a class="el" href="avstring_8h_source.html">libavutil/avstring.h</a>"</code><br/>
<code>#include "<a class="el" href="frame_8h_source.html">libavutil/frame.h</a>"</code><br/>
<code>#include "<a class="el" href="opt_8h_source.html">libavutil/opt.h</a>"</code><br/>
<code>#include "<a class="el" href="swresample_8h_source.html">libswresample/swresample.h</a>"</code><br/>
</div>
<p><a href="transcode__aac_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<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="transcode__aac_8c.html#a40d898a8dbfccabcbbff15a29924e97f">OUTPUT_BIT_RATE</a>   96000</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">The output bit rate in kbit/s. <a href="#a40d898a8dbfccabcbbff15a29924e97f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a4d4855d9b709af9628540e41e5ebb925">OUTPUT_CHANNELS</a>   2</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">The number of output channels. <a href="#a4d4855d9b709af9628540e41e5ebb925"></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">static const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#adc7cf4c70d2850aecf8c9997a350147c">get_error_text</a> (const int error)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Convert an error code into a text message. <a href="#adc7cf4c70d2850aecf8c9997a350147c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a8103e36bb4cb4141ee5e25acc350bc0b">open_input_file</a> (const char *filename, <a class="el" href="structAVFormatContext.html">AVFormatContext</a> **input_format_context, <a class="el" href="structAVCodecContext.html">AVCodecContext</a> **input_codec_context)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Open an input file and the required decoder. <a href="#a8103e36bb4cb4141ee5e25acc350bc0b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a617f4760254c119fc7caa222f3fcbd21">open_output_file</a> (const char *filename, <a class="el" href="structAVCodecContext.html">AVCodecContext</a> *input_codec_context, <a class="el" href="structAVFormatContext.html">AVFormatContext</a> **output_format_context, <a class="el" href="structAVCodecContext.html">AVCodecContext</a> **output_codec_context)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Open an output file and the required encoder. <a href="#a617f4760254c119fc7caa222f3fcbd21"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a0b457785184f97c7169f9c1c05736990">init_packet</a> (<a class="el" href="structAVPacket.html">AVPacket</a> *packet)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Initialize one data packet for reading or writing. <a href="#a0b457785184f97c7169f9c1c05736990"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a399b9ea45bcc6b114a3e0bef1c743a60">init_input_frame</a> (<a class="el" href="structAVFrame.html">AVFrame</a> **<a class="el" href="extract__mvs_8c.html#ad7d33d579a8d4241a5e643e39287a209">frame</a>)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Initialize one audio frame for reading from the input file. <a href="#a399b9ea45bcc6b114a3e0bef1c743a60"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a68b32c4f40838cc56a7f45d33286d039">init_resampler</a> (<a class="el" href="structAVCodecContext.html">AVCodecContext</a> *input_codec_context, <a class="el" href="structAVCodecContext.html">AVCodecContext</a> *output_codec_context, <a class="el" href="group__lswr.html#ga4aa775b7fba31d2c8dc14c7b7e282863">SwrContext</a> **resample_context)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Initialize the audio resampler based on the input and output codec settings. <a href="#a68b32c4f40838cc56a7f45d33286d039"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a96cd24fde0bde66e80f3141a1def94c6">init_fifo</a> (<a class="el" href="group__lavu__audiofifo.html#ga328abb21e9abb2c455d2d9c212d5230f">AVAudioFifo</a> **fifo, <a class="el" href="structAVCodecContext.html">AVCodecContext</a> *output_codec_context)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Initialize a FIFO buffer for the audio samples to be encoded. <a href="#a96cd24fde0bde66e80f3141a1def94c6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a717f7868fc24543151cb94b307e87420">write_output_file_header</a> (<a class="el" href="structAVFormatContext.html">AVFormatContext</a> *output_format_context)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Write the header of the output file container. <a href="#a717f7868fc24543151cb94b307e87420"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a5c320cc89448244f68daee53092da98c">decode_audio_frame</a> (<a class="el" href="structAVFrame.html">AVFrame</a> *<a class="el" href="extract__mvs_8c.html#ad7d33d579a8d4241a5e643e39287a209">frame</a>, <a class="el" href="structAVFormatContext.html">AVFormatContext</a> *input_format_context, <a class="el" href="structAVCodecContext.html">AVCodecContext</a> *input_codec_context, int *data_present, int *finished)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Decode one audio frame from the input file. <a href="#a5c320cc89448244f68daee53092da98c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#af79f075aaf578455b0d2d435e395f1ff">init_converted_samples</a> (uint8_t ***converted_input_samples, <a class="el" href="structAVCodecContext.html">AVCodecContext</a> *output_codec_context, int frame_size)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Initialize a temporary storage for the specified number of audio samples. <a href="#af79f075aaf578455b0d2d435e395f1ff"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#af01916898adcdf3776690407bd1e2b82">convert_samples</a> (const uint8_t **input_data, uint8_t **converted_data, const int frame_size, <a class="el" href="group__lswr.html#ga4aa775b7fba31d2c8dc14c7b7e282863">SwrContext</a> *resample_context)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Convert the input audio samples into the output sample format. <a href="#af01916898adcdf3776690407bd1e2b82"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a1509aea4299c0261c6c3f2a7bc8971d2">add_samples_to_fifo</a> (<a class="el" href="group__lavu__audiofifo.html#ga328abb21e9abb2c455d2d9c212d5230f">AVAudioFifo</a> *fifo, uint8_t **converted_input_samples, const int frame_size)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Add converted input audio samples to the FIFO buffer for later processing. <a href="#a1509aea4299c0261c6c3f2a7bc8971d2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a7f6cf47c64ae78cbdad6115e57aa2c2f">read_decode_convert_and_store</a> (<a class="el" href="group__lavu__audiofifo.html#ga328abb21e9abb2c455d2d9c212d5230f">AVAudioFifo</a> *fifo, <a class="el" href="structAVFormatContext.html">AVFormatContext</a> *input_format_context, <a class="el" href="structAVCodecContext.html">AVCodecContext</a> *input_codec_context, <a class="el" href="structAVCodecContext.html">AVCodecContext</a> *output_codec_context, <a class="el" href="group__lswr.html#ga4aa775b7fba31d2c8dc14c7b7e282863">SwrContext</a> *resampler_context, int *finished)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Read one audio frame from the input file, decodes, converts and stores it in the FIFO buffer. <a href="#a7f6cf47c64ae78cbdad6115e57aa2c2f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a72741423006b4ab38bf924fa567e7081">init_output_frame</a> (<a class="el" href="structAVFrame.html">AVFrame</a> **<a class="el" href="extract__mvs_8c.html#ad7d33d579a8d4241a5e643e39287a209">frame</a>, <a class="el" href="structAVCodecContext.html">AVCodecContext</a> *output_codec_context, int frame_size)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Initialize one input frame for writing to the output file. <a href="#a72741423006b4ab38bf924fa567e7081"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a3d408f21612691f8c93a7aa24ea554ef">encode_audio_frame</a> (<a class="el" href="structAVFrame.html">AVFrame</a> *<a class="el" href="extract__mvs_8c.html#ad7d33d579a8d4241a5e643e39287a209">frame</a>, <a class="el" href="structAVFormatContext.html">AVFormatContext</a> *output_format_context, <a class="el" href="structAVCodecContext.html">AVCodecContext</a> *output_codec_context, int *data_present)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Encode one frame worth of audio to the output file. <a href="#a3d408f21612691f8c93a7aa24ea554ef"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#ab4367e0049c0bbd56eec8c525cdbd6e5">load_encode_and_write</a> (<a class="el" href="group__lavu__audiofifo.html#ga328abb21e9abb2c455d2d9c212d5230f">AVAudioFifo</a> *fifo, <a class="el" href="structAVFormatContext.html">AVFormatContext</a> *output_format_context, <a class="el" href="structAVCodecContext.html">AVCodecContext</a> *output_codec_context)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Load one audio frame from the FIFO buffer, encode and write it to the output file. <a href="#ab4367e0049c0bbd56eec8c525cdbd6e5"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#aea497107d8d2a7a1e5bf92422ccc6715">write_output_file_trailer</a> (<a class="el" href="structAVFormatContext.html">AVFormatContext</a> *output_format_context)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Write the trailer of the output file container. <a href="#aea497107d8d2a7a1e5bf92422ccc6715"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a> (int argc, char **argv)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Convert an audio file to an AAC file in an MP4 container. <a href="#a3c04138a5bfe5d72780bb7e82a18e627"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="var-members"></a>
Variables</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static int64_t </td><td class="memItemRight" valign="bottom"><a class="el" href="transcode__aac_8c.html#a4fbb704fb96c36a78a36eee010306ce7">pts</a> = 0</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Global timestamp for the audio frames. <a href="#a4fbb704fb96c36a78a36eee010306ce7"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>simple audio converter </p>
<p>Definition in file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
</div><hr/><h2>Define Documentation</h2>
<a class="anchor" id="a40d898a8dbfccabcbbff15a29924e97f"></a><!-- doxytag: member="transcode_aac.c::OUTPUT_BIT_RATE" ref="a40d898a8dbfccabcbbff15a29924e97f" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="transcode__aac_8c.html#a40d898a8dbfccabcbbff15a29924e97f">OUTPUT_BIT_RATE</a>   96000</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The output bit rate in kbit/s. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a30">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00044">44</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00120">open_output_file()</a>.</p>
</div>
</div>
<a class="anchor" id="a4d4855d9b709af9628540e41e5ebb925"></a><!-- doxytag: member="transcode_aac.c::OUTPUT_CHANNELS" ref="a4d4855d9b709af9628540e41e5ebb925" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="transcode__aac_8c.html#a4d4855d9b709af9628540e41e5ebb925">OUTPUT_CHANNELS</a>   2</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The number of output channels. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a26">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00046">46</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00120">open_output_file()</a>.</p>
</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="adc7cf4c70d2850aecf8c9997a350147c"></a><!-- doxytag: member="transcode_aac.c::get_error_text" ref="adc7cf4c70d2850aecf8c9997a350147c" args="(const int error)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static const char* <a class="el" href="transcode__aac_8c.html#adc7cf4c70d2850aecf8c9997a350147c">get_error_text</a> </td>
<td>(</td>
<td class="paramtype">const int </td>
<td class="paramname"><em>error</em></td><td>)</td>
<td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Convert an error code into a text message. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">error</td><td>Error code to be converted </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Corresponding error text (not thread-safe) </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a0">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00053">53</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00394">convert_samples()</a>, <a class="el" href="transcode__aac_8c_source.html#l00303">decode_audio_frame()</a>, <a class="el" href="transcode__aac_8c_source.html#l00550">encode_audio_frame()</a>, <a class="el" href="transcode__aac_8c_source.html#l00354">init_converted_samples()</a>, <a class="el" href="transcode__aac_8c_source.html#l00508">init_output_frame()</a>, <a class="el" href="transcode__aac_8c_source.html#l00061">open_input_file()</a>, <a class="el" href="transcode__aac_8c_source.html#l00120">open_output_file()</a>, <a class="el" href="transcode__aac_8c_source.html#l00291">write_output_file_header()</a>, and <a class="el" href="transcode__aac_8c_source.html#l00637">write_output_file_trailer()</a>.</p>
</div>
</div>
<a class="anchor" id="a8103e36bb4cb4141ee5e25acc350bc0b"></a><!-- doxytag: member="transcode_aac.c::open_input_file" ref="a8103e36bb4cb4141ee5e25acc350bc0b" args="(const char *filename, AVFormatContext **input_format_context, AVCodecContext **input_codec_context)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcoding_8c.html#abd04bf1a933d4d2698482f4949c61fed">open_input_file</a> </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>filename</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> ** </td>
<td class="paramname"><em>input_format_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVCodecContext.html">AVCodecContext</a> ** </td>
<td class="paramname"><em>input_codec_context</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Open an input file and the required decoder. </p>
<p>Open the input file to read from it.</p>
<p>Get information on the input file (number of streams etc.).</p>
<p>Make sure that there is only one stream in the input file.</p>
<p>Find a decoder for the audio stream.</p>
<p>Open the decoder for the audio stream to use it later.</p>
<p>Save the decoder context for easier access later. </p>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00061">61</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00649">main()</a>.</p>
</div>
</div>
<a class="anchor" id="a617f4760254c119fc7caa222f3fcbd21"></a><!-- doxytag: member="transcode_aac.c::open_output_file" ref="a617f4760254c119fc7caa222f3fcbd21" args="(const char *filename, AVCodecContext *input_codec_context, AVFormatContext **output_format_context, AVCodecContext **output_codec_context)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcoding_8c.html#ab6c33edf9a42e2f71594a7cdc6276407">open_output_file</a> </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>filename</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVCodecContext.html">AVCodecContext</a> * </td>
<td class="paramname"><em>input_codec_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> ** </td>
<td class="paramname"><em>output_format_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVCodecContext.html">AVCodecContext</a> ** </td>
<td class="paramname"><em>output_codec_context</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Open an output file and the required encoder. </p>
<p>Also set some basic encoder parameters. Some of these parameters are based on the input file's parameters. </p>
<p>Open the output file to write to it.</p>
<p>Create a new format context for the output container format.</p>
<p>Associate the output file (pointer) with the container format context.</p>
<p>Guess the desired container format based on the file extension.</p>
<p>Find the encoder to be used by its name.</p>
<p>Create a new audio stream in the output file container.</p>
<p>Save the encoder context for easier access later.</p>
<p>Set the basic encoder parameters. The input file's sample rate is used to avoid a sample rate conversion.</p>
<p>Allow the use of the experimental AAC encoder</p>
<p>Set the sample rate for the container.</p>
<p>Some container formats (like MP4) require global headers to be present Mark the encoder so that it behaves accordingly.</p>
<p>Open the encoder for the audio stream to use it later. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a13">transcode_aac.c</a>, and <a class="el" href="transcoding_8c-example.html#a27">transcoding.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00120">120</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00649">main()</a>.</p>
</div>
</div>
<a class="anchor" id="a0b457785184f97c7169f9c1c05736990"></a><!-- doxytag: member="transcode_aac.c::init_packet" ref="a0b457785184f97c7169f9c1c05736990" args="(AVPacket *packet)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static void <a class="el" href="transcode__aac_8c.html#a0b457785184f97c7169f9c1c05736990">init_packet</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structAVPacket.html">AVPacket</a> * </td>
<td class="paramname"><em>packet</em></td><td>)</td>
<td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initialize one data packet for reading or writing. </p>
<p>Set the packet data and size so that it is recognized as being empty. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a39">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00214">214</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00303">decode_audio_frame()</a>, and <a class="el" href="transcode__aac_8c_source.html#l00550">encode_audio_frame()</a>.</p>
</div>
</div>
<a class="anchor" id="a399b9ea45bcc6b114a3e0bef1c743a60"></a><!-- doxytag: member="transcode_aac.c::init_input_frame" ref="a399b9ea45bcc6b114a3e0bef1c743a60" args="(AVFrame **frame)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcode__aac_8c.html#a399b9ea45bcc6b114a3e0bef1c743a60">init_input_frame</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structAVFrame.html">AVFrame</a> ** </td>
<td class="paramname"><em>frame</em></td><td>)</td>
<td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initialize one audio frame for reading from the input file. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a44">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00223">223</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00441">read_decode_convert_and_store()</a>.</p>
</div>
</div>
<a class="anchor" id="a68b32c4f40838cc56a7f45d33286d039"></a><!-- doxytag: member="transcode_aac.c::init_resampler" ref="a68b32c4f40838cc56a7f45d33286d039" args="(AVCodecContext *input_codec_context, AVCodecContext *output_codec_context, SwrContext **resample_context)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcode__aac_8c.html#a68b32c4f40838cc56a7f45d33286d039">init_resampler</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structAVCodecContext.html">AVCodecContext</a> * </td>
<td class="paramname"><em>input_codec_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVCodecContext.html">AVCodecContext</a> * </td>
<td class="paramname"><em>output_codec_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__lswr.html#ga4aa775b7fba31d2c8dc14c7b7e282863">SwrContext</a> ** </td>
<td class="paramname"><em>resample_context</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initialize the audio resampler based on the input and output codec settings. </p>
<p>If the input and output sample formats differ, a conversion is required libswresample takes care of this, but requires initialization. </p>
<p>Create a resampler context for the conversion. Set the conversion parameters. Default channel layouts based on the number of channels are assumed for simplicity (they are sometimes not detected properly by the demuxer and/or decoder).</p>
<p>Perform a sanity check so that the number of converted samples is not greater than the number of samples to be converted. If the sample rates differ, this case has to be handled differently</p>
<p>Open the resampler with the specified parameters. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a48">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00237">237</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00649">main()</a>.</p>
</div>
</div>
<a class="anchor" id="a96cd24fde0bde66e80f3141a1def94c6"></a><!-- doxytag: member="transcode_aac.c::init_fifo" ref="a96cd24fde0bde66e80f3141a1def94c6" args="(AVAudioFifo **fifo, AVCodecContext *output_codec_context)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcode__aac_8c.html#a96cd24fde0bde66e80f3141a1def94c6">init_fifo</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavu__audiofifo.html#ga328abb21e9abb2c455d2d9c212d5230f">AVAudioFifo</a> ** </td>
<td class="paramname"><em>fifo</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVCodecContext.html">AVCodecContext</a> * </td>
<td class="paramname"><em>output_codec_context</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initialize a FIFO buffer for the audio samples to be encoded. </p>
<p>Create the FIFO buffer based on the specified output sample format. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a54">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00279">279</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00649">main()</a>.</p>
</div>
</div>
<a class="anchor" id="a717f7868fc24543151cb94b307e87420"></a><!-- doxytag: member="transcode_aac.c::write_output_file_header" ref="a717f7868fc24543151cb94b307e87420" args="(AVFormatContext *output_format_context)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcode__aac_8c.html#a717f7868fc24543151cb94b307e87420">write_output_file_header</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> * </td>
<td class="paramname"><em>output_format_context</em></td><td>)</td>
<td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Write the header of the output file container. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a56">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00291">291</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00649">main()</a>.</p>
</div>
</div>
<a class="anchor" id="a5c320cc89448244f68daee53092da98c"></a><!-- doxytag: member="transcode_aac.c::decode_audio_frame" ref="a5c320cc89448244f68daee53092da98c" args="(AVFrame *frame, AVFormatContext *input_format_context, AVCodecContext *input_codec_context, int *data_present, int *finished)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcode__aac_8c.html#a5c320cc89448244f68daee53092da98c">decode_audio_frame</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structAVFrame.html">AVFrame</a> * </td>
<td class="paramname"><em>frame</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> * </td>
<td class="paramname"><em>input_format_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVCodecContext.html">AVCodecContext</a> * </td>
<td class="paramname"><em>input_codec_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>data_present</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>finished</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Decode one audio frame from the input file. </p>
<p>Packet used for temporary storage.</p>
<p>Read one audio frame from the input file into a temporary packet.</p>
<p>If we are at the end of the file, flush the decoder below.</p>
<p>Decode the audio frame stored in the temporary packet. The input audio stream decoder is used to do this. If we are at the end of the file, pass an empty packet to the decoder to flush it.</p>
<p>If the decoder has not been flushed completely, we are not finished, so that this function has to be called again.</p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a58">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00303">303</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00441">read_decode_convert_and_store()</a>.</p>
</div>
</div>
<a class="anchor" id="af79f075aaf578455b0d2d435e395f1ff"></a><!-- doxytag: member="transcode_aac.c::init_converted_samples" ref="af79f075aaf578455b0d2d435e395f1ff" args="(uint8_t ***converted_input_samples, AVCodecContext *output_codec_context, int frame_size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcode__aac_8c.html#af79f075aaf578455b0d2d435e395f1ff">init_converted_samples</a> </td>
<td>(</td>
<td class="paramtype">uint8_t *** </td>
<td class="paramname"><em>converted_input_samples</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVCodecContext.html">AVCodecContext</a> * </td>
<td class="paramname"><em>output_codec_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>frame_size</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initialize a temporary storage for the specified number of audio samples. </p>
<p>The conversion requires temporary storage due to the different format. The number of audio samples to be allocated is specified in frame_size. </p>
<p>Allocate as many pointers as there are audio channels. Each pointer will later point to the audio samples of the corresponding channels (although it may be NULL for interleaved formats).</p>
<p>Allocate memory for the samples of all channels in one consecutive block for convenience.</p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a63">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00354">354</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00441">read_decode_convert_and_store()</a>.</p>
</div>
</div>
<a class="anchor" id="af01916898adcdf3776690407bd1e2b82"></a><!-- doxytag: member="transcode_aac.c::convert_samples" ref="af01916898adcdf3776690407bd1e2b82" args="(const uint8_t **input_data, uint8_t **converted_data, const int frame_size, SwrContext *resample_context)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcode__aac_8c.html#af01916898adcdf3776690407bd1e2b82">convert_samples</a> </td>
<td>(</td>
<td class="paramtype">const uint8_t ** </td>
<td class="paramname"><em>input_data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t ** </td>
<td class="paramname"><em>converted_data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int </td>
<td class="paramname"><em>frame_size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__lswr.html#ga4aa775b7fba31d2c8dc14c7b7e282863">SwrContext</a> * </td>
<td class="paramname"><em>resample_context</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Convert the input audio samples into the output sample format. </p>
<p>The conversion happens on a per-frame basis, the size of which is specified by frame_size. </p>
<p>Convert the samples using the resampler. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a66">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00394">394</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00441">read_decode_convert_and_store()</a>.</p>
</div>
</div>
<a class="anchor" id="a1509aea4299c0261c6c3f2a7bc8971d2"></a><!-- doxytag: member="transcode_aac.c::add_samples_to_fifo" ref="a1509aea4299c0261c6c3f2a7bc8971d2" args="(AVAudioFifo *fifo, uint8_t **converted_input_samples, const int frame_size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcode__aac_8c.html#a1509aea4299c0261c6c3f2a7bc8971d2">add_samples_to_fifo</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavu__audiofifo.html#ga328abb21e9abb2c455d2d9c212d5230f">AVAudioFifo</a> * </td>
<td class="paramname"><em>fifo</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t ** </td>
<td class="paramname"><em>converted_input_samples</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int </td>
<td class="paramname"><em>frame_size</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Add converted input audio samples to the FIFO buffer for later processing. </p>
<p>Make the FIFO as large as it needs to be to hold both, the old and the new samples.</p>
<p>Store the new samples in the FIFO buffer. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a68">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00413">413</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00441">read_decode_convert_and_store()</a>.</p>
</div>
</div>
<a class="anchor" id="a7f6cf47c64ae78cbdad6115e57aa2c2f"></a><!-- doxytag: member="transcode_aac.c::read_decode_convert_and_store" ref="a7f6cf47c64ae78cbdad6115e57aa2c2f" args="(AVAudioFifo *fifo, AVFormatContext *input_format_context, AVCodecContext *input_codec_context, AVCodecContext *output_codec_context, SwrContext *resampler_context, int *finished)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcode__aac_8c.html#a7f6cf47c64ae78cbdad6115e57aa2c2f">read_decode_convert_and_store</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavu__audiofifo.html#ga328abb21e9abb2c455d2d9c212d5230f">AVAudioFifo</a> * </td>
<td class="paramname"><em>fifo</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> * </td>
<td class="paramname"><em>input_format_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVCodecContext.html">AVCodecContext</a> * </td>
<td class="paramname"><em>input_codec_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVCodecContext.html">AVCodecContext</a> * </td>
<td class="paramname"><em>output_codec_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__lswr.html#ga4aa775b7fba31d2c8dc14c7b7e282863">SwrContext</a> * </td>
<td class="paramname"><em>resampler_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>finished</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Read one audio frame from the input file, decodes, converts and stores it in the FIFO buffer. </p>
<p>Temporary storage of the input samples of the frame read from the file.</p>
<p>Temporary storage for the converted input samples.</p>
<p>Initialize temporary storage for one input frame.</p>
<p>Decode one frame worth of audio samples.</p>
<p>If we are at the end of the file and there are no more samples in the decoder which are delayed, we are actually finished. This must not be treated as an error.</p>
<p>If there is decoded data, convert and store it</p>
<p>Initialize the temporary storage for the converted input samples.</p>
<p>Convert the input samples to the desired output sample format. This requires a temporary storage provided by converted_input_samples.</p>
<p>Add the converted input samples to the FIFO buffer for later processing. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a72">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00441">441</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00649">main()</a>.</p>
</div>
</div>
<a class="anchor" id="a72741423006b4ab38bf924fa567e7081"></a><!-- doxytag: member="transcode_aac.c::init_output_frame" ref="a72741423006b4ab38bf924fa567e7081" args="(AVFrame **frame, AVCodecContext *output_codec_context, int frame_size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcode__aac_8c.html#a72741423006b4ab38bf924fa567e7081">init_output_frame</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structAVFrame.html">AVFrame</a> ** </td>
<td class="paramname"><em>frame</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVCodecContext.html">AVCodecContext</a> * </td>
<td class="paramname"><em>output_codec_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>frame_size</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initialize one input frame for writing to the output file. </p>
<p>The frame will be exactly frame_size samples large. </p>
<p>Create a new frame to store the audio samples.</p>
<p>Set the frame's parameters, especially its size and format. av_frame_get_buffer needs this to allocate memory for the audio samples of the frame. Default channel layouts based on the number of channels are assumed for simplicity.</p>
<p>Allocate the samples of the created frame. This call will make sure that the audio frame can hold as many samples as specified.</p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a76">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00508">508</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00597">load_encode_and_write()</a>.</p>
</div>
</div>
<a class="anchor" id="a3d408f21612691f8c93a7aa24ea554ef"></a><!-- doxytag: member="transcode_aac.c::encode_audio_frame" ref="a3d408f21612691f8c93a7aa24ea554ef" args="(AVFrame *frame, AVFormatContext *output_format_context, AVCodecContext *output_codec_context, int *data_present)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcode__aac_8c.html#a3d408f21612691f8c93a7aa24ea554ef">encode_audio_frame</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structAVFrame.html">AVFrame</a> * </td>
<td class="paramname"><em>frame</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> * </td>
<td class="paramname"><em>output_format_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVCodecContext.html">AVCodecContext</a> * </td>
<td class="paramname"><em>output_codec_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>data_present</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Encode one frame worth of audio to the output file. </p>
<p>Packet used for temporary storage.</p>
<p>Set a timestamp based on the sample rate for the container.</p>
<p>Encode the audio frame and store it in the temporary packet. The output audio stream encoder is used to do this.</p>
<p>Write one audio frame from the temporary packet to the output file. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a80">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00550">550</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00597">load_encode_and_write()</a>, and <a class="el" href="transcode__aac_8c_source.html#l00649">main()</a>.</p>
</div>
</div>
<a class="anchor" id="ab4367e0049c0bbd56eec8c525cdbd6e5"></a><!-- doxytag: member="transcode_aac.c::load_encode_and_write" ref="ab4367e0049c0bbd56eec8c525cdbd6e5" args="(AVAudioFifo *fifo, AVFormatContext *output_format_context, AVCodecContext *output_codec_context)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcode__aac_8c.html#ab4367e0049c0bbd56eec8c525cdbd6e5">load_encode_and_write</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__lavu__audiofifo.html#ga328abb21e9abb2c455d2d9c212d5230f">AVAudioFifo</a> * </td>
<td class="paramname"><em>fifo</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> * </td>
<td class="paramname"><em>output_format_context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structAVCodecContext.html">AVCodecContext</a> * </td>
<td class="paramname"><em>output_codec_context</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Load one audio frame from the FIFO buffer, encode and write it to the output file. </p>
<p>Temporary storage of the output samples of the frame written to the file.</p>
<p>Use the maximum number of possible samples per frame. If there is less than the maximum possible frame size in the FIFO buffer use this number. Otherwise, use the maximum possible frame size</p>
<p>Initialize temporary storage for one output frame.</p>
<p>Read as many samples from the FIFO buffer as required to fill the frame. The samples are stored in the frame temporarily.</p>
<p>Encode one frame worth of audio samples. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a84">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00597">597</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00649">main()</a>.</p>
</div>
</div>
<a class="anchor" id="aea497107d8d2a7a1e5bf92422ccc6715"></a><!-- doxytag: member="transcode_aac.c::write_output_file_trailer" ref="aea497107d8d2a7a1e5bf92422ccc6715" args="(AVFormatContext *output_format_context)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static int <a class="el" href="transcode__aac_8c.html#aea497107d8d2a7a1e5bf92422ccc6715">write_output_file_trailer</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> * </td>
<td class="paramname"><em>output_format_context</em></td><td>)</td>
<td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Write the trailer of the output file container. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a89">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00637">637</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00649">main()</a>.</p>
</div>
</div>
<a class="anchor" id="a3c04138a5bfe5d72780bb7e82a18e627"></a><!-- doxytag: member="transcode_aac.c::main" ref="a3c04138a5bfe5d72780bb7e82a18e627" args="(int argc, char **argv)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="transcoding_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a> </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>argc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char ** </td>
<td class="paramname"><em>argv</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Convert an audio file to an AAC file in an MP4 container. </p>
<p>Register all codecs and formats so that they can be used.</p>
<p>Open the input file for reading.</p>
<p>Open the output file for writing.</p>
<p>Initialize the resampler to be able to convert audio sample formats.</p>
<p>Initialize the FIFO buffer to store audio samples to be encoded.</p>
<p>Write the header of the output file container.</p>
<p>Loop as long as we have input samples to read or output samples to write; abort as soon as we have neither.</p>
<p>Use the encoder's desired frame size for processing.</p>
<p>Make sure that there is one frame worth of samples in the FIFO buffer so that the encoder can do its work. Since the decoder's and the encoder's frame size may differ, we need to FIFO buffer to store as many frames worth of input samples that they make up at least one frame worth of output samples.</p>
<p>Decode one frame worth of audio samples, convert it to the output sample format and put it into the FIFO buffer.</p>
<p>If we are at the end of the input file, we continue encoding the remaining audio samples to the output file.</p>
<p>If we have enough samples for the encoder, we encode them. At the end of the file, we pass the remaining samples to the encoder.</p>
<p>Take one frame worth of audio samples from the FIFO buffer, encode it and write it to the output file.</p>
<p>If we are at the end of the input file and have encoded all remaining samples, we can exit this loop and finish.</p>
<p>Flush the encoder as it may have delayed frames.</p>
<p>Write the trailer of the output file container. </p>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00649">649</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
</div>
</div>
<hr/><h2>Variable Documentation</h2>
<a class="anchor" id="a4fbb704fb96c36a78a36eee010306ce7"></a><!-- doxytag: member="transcode_aac.c::pts" ref="a4fbb704fb96c36a78a36eee010306ce7" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int64_t <a class="el" href="transcode__aac_8c.html#a4fbb704fb96c36a78a36eee010306ce7">pts</a> = 0<code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Global timestamp for the audio frames. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a79">transcode_aac.c</a>.</dd>
</dl>
<p>Definition at line <a class="el" href="transcode__aac_8c_source.html#l00547">547</a> of file <a class="el" href="transcode__aac_8c_source.html">transcode_aac.c</a>.</p>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00550">encode_audio_frame()</a>.</p>
</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>