blob: 525e39942b5a4c8916d24e1a52c2c22215b9d924 [file] [log] [blame]
{{+bindTo:partials.standard_nacl_api}}
<h1>pp::AudioEncoder Class Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
<div>
<!-- Generated by Doxygen 1.7.6.1 -->
</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="pp::AudioEncoder" --><!-- doxytag: inherits="pp::Resource" --><div class="dynheader">
Inheritance diagram for pp::AudioEncoder:</div>
<div class="dyncontent">
<div class="center"><img src="classpp_1_1_audio_encoder__inherit__graph.png" border="0" usemap="#pp_1_1_audio_encoder_inherit__map" alt="Inheritance graph" /></div>
<map name="pp_1_1_audio_encoder_inherit__map" id="pp_1_1_audio_encoder_inherit__map">
<area shape="rect" id="node2" href="classpp_1_1_resource.html" title="A reference counted module resource." alt="" coords="20,5,124,32"></area></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<p><a href="classpp_1_1_audio_encoder-members.html">List of all members.</a></p>
<h2>
Public Member Functions</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio_encoder.html#afaf804d519fc0f2370c2d011b4e68378">AudioEncoder</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio_encoder.html#a1b5126d5112082bfa782bf5423715030">AudioEncoder</a> (const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;instance)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio_encoder.html#ac4a116ff790ce5dc1cc4847118aabc9d">AudioEncoder</a> (const <a class="el" href="classpp_1_1_audio_encoder.html">AudioEncoder</a> &amp;other)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio_encoder.html#a34b94c7bb1f509f4b56bfe7349560669">GetSupportedProfiles</a> (const <a class="el" href="classpp_1_1_completion_callback_with_output.html">CompletionCallbackWithOutput</a>&lt; std::vector&lt; PP_AudioProfileDescription &gt; &gt; &amp;cc)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio_encoder.html#a28aa43f8c92b387b81e7cf63219c2933">Initialize</a> (uint32_t channels, PP_AudioBuffer_SampleRate input_sample_rate, PP_AudioBuffer_SampleSize input_sample_size, PP_AudioProfile output_profile, uint32_t initial_bitrate, PP_HardwareAcceleration acceleration, const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;cc)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio_encoder.html#a706b305dae8bc5f5e0bca4491c991d59">GetNumberOfSamples</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio_encoder.html#a113d4a018e987f2f5227c6e0dc8a7687">GetBuffer</a> (const <a class="el" href="classpp_1_1_completion_callback_with_output.html">CompletionCallbackWithOutput</a>&lt; <a class="el" href="classpp_1_1_audio_buffer.html">AudioBuffer</a> &gt; &amp;cc)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio_encoder.html#a75278dc12dfcc3d000e47e17f014be19">Encode</a> (const <a class="el" href="classpp_1_1_audio_buffer.html">AudioBuffer</a> &amp;buffer, const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;cc)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio_encoder.html#ad1a2c96562e2baa7a61d63fbb8a49999">GetBitstreamBuffer</a> (const <a class="el" href="classpp_1_1_completion_callback_with_output.html">CompletionCallbackWithOutput</a>&lt; PP_AudioBitstreamBuffer &gt; &amp;cc)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio_encoder.html#a9c5b90b6dbfd81154b28f402197184bc">RecycleBitstreamBuffer</a> (const PP_AudioBitstreamBuffer &amp;bitstream_buffer)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio_encoder.html#aa64ea3b0313335817833a72ceed96114">RequestBitrateChange</a> (uint32_t bitrate)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_audio_encoder.html#a5f5f533624660ca8561fea403da85f5b">Close</a> ()</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classpp_1_1_audio.html" title="An audio resource.">Audio</a> encoder interface. </p>
<p>Typical usage:</p>
<ul>
<li>Call Create() to create a new audio encoder resource.</li>
<li>Call GetSupportedFormats() to determine which codecs and profiles are available.</li>
<li>Call <a class="el" href="classpp_1_1_audio_encoder.html#a28aa43f8c92b387b81e7cf63219c2933" title="Initializes a audio encoder resource.">Initialize()</a> to initialize the encoder for a supported profile.</li>
<li>Call <a class="el" href="classpp_1_1_audio_encoder.html#a113d4a018e987f2f5227c6e0dc8a7687" title="Gets a blank audio frame which can be filled with audio data and passed to the encoder.">GetBuffer()</a> to get a blank frame and fill it in, or get an audio frame from another resource, e.g. <code>PPB_MediaStreamAudioTrack</code>.</li>
<li>Call <a class="el" href="classpp_1_1_audio_encoder.html#a75278dc12dfcc3d000e47e17f014be19" title="Encodes an audio buffer.">Encode()</a> to push the audio buffer to the encoder. If an external buffer is pushed, wait for completion to recycle the frame.</li>
<li>Call <a class="el" href="classpp_1_1_audio_encoder.html#ad1a2c96562e2baa7a61d63fbb8a49999" title="Gets the next encoded bitstream buffer from the encoder.">GetBitstreamBuffer()</a> continuously (waiting for each previous call to complete) to pull encoded buffers from the encoder.</li>
<li>Call <a class="el" href="classpp_1_1_audio_encoder.html#a9c5b90b6dbfd81154b28f402197184bc" title="Recycles a bitstream buffer back to the encoder.">RecycleBitstreamBuffer()</a> after consuming the data in the bitstream buffer.</li>
<li>To destroy the encoder, the plugin should release all of its references to it. Any pending callbacks will abort before the encoder is destroyed.</li>
</ul>
<p>Available audio codecs vary by platform. All: opus. </p>
</div><hr /><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="afaf804d519fc0f2370c2d011b4e68378"></a><!-- doxytag: member="pp::AudioEncoder::AudioEncoder" ref="afaf804d519fc0f2370c2d011b4e68378" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_audio_encoder.html#afaf804d519fc0f2370c2d011b4e68378">pp::AudioEncoder::AudioEncoder</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Default constructor for creating an <a class="el" href="classpp_1_1_resource.html#a859068e34cdc2dc0b78754c255323aa9" title="This functions determines if this resource is invalid or uninitialized.">is_null()</a> <code><a class="el" href="classpp_1_1_audio_encoder.html" title="Audio encoder interface.">AudioEncoder</a></code> object. </p>
</div>
</div>
<a class="anchor" id="a1b5126d5112082bfa782bf5423715030"></a><!-- doxytag: member="pp::AudioEncoder::AudioEncoder" ref="a1b5126d5112082bfa782bf5423715030" args="(const InstanceHandle &amp;instance)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_audio_encoder.html#afaf804d519fc0f2370c2d011b4e68378">pp::AudioEncoder::AudioEncoder</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;&#160;</td>
<td class="paramname"><em>instance</em></td><td>)</td>
<td><code> [explicit]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A constructor used to create a <code><a class="el" href="classpp_1_1_audio_encoder.html" title="Audio encoder interface.">AudioEncoder</a></code> and associate it with the provided <code><a class="el" href="classpp_1_1_instance.html">Instance</a></code>. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>The instance with which this resource will be associated. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ac4a116ff790ce5dc1cc4847118aabc9d"></a><!-- doxytag: member="pp::AudioEncoder::AudioEncoder" ref="ac4a116ff790ce5dc1cc4847118aabc9d" args="(const AudioEncoder &amp;other)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_audio_encoder.html#afaf804d519fc0f2370c2d011b4e68378">pp::AudioEncoder::AudioEncoder</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_audio_encoder.html">AudioEncoder</a> &amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The copy constructor for <code><a class="el" href="classpp_1_1_audio_encoder.html" title="Audio encoder interface.">AudioEncoder</a></code>. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">other</td><td>A reference to a <code><a class="el" href="classpp_1_1_audio_encoder.html" title="Audio encoder interface.">AudioEncoder</a></code>. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr /><h2>Member Function Documentation</h2>
<a class="anchor" id="a5f5f533624660ca8561fea403da85f5b"></a><!-- doxytag: member="pp::AudioEncoder::Close" ref="a5f5f533624660ca8561fea403da85f5b" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classpp_1_1_audio_encoder.html#a5f5f533624660ca8561fea403da85f5b">pp::AudioEncoder::Close</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Closes the audio encoder, and cancels any pending encodes. </p>
<p>Any pending callbacks will still run, reporting <code>PP_ERROR_ABORTED</code> . It is not valid to call any encoder functions after a call to this method. <b>Note:</b> Destroying the audio encoder closes it implicitly, so you are not required to call <a class="el" href="classpp_1_1_audio_encoder.html#a5f5f533624660ca8561fea403da85f5b" title="Closes the audio encoder, and cancels any pending encodes.">Close()</a>. </p>
</div>
</div>
<a class="anchor" id="a75278dc12dfcc3d000e47e17f014be19"></a><!-- doxytag: member="pp::AudioEncoder::Encode" ref="a75278dc12dfcc3d000e47e17f014be19" args="(const AudioBuffer &amp;buffer, const CompletionCallback &amp;cc)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t <a class="el" href="classpp_1_1_audio_encoder.html#a75278dc12dfcc3d000e47e17f014be19">pp::AudioEncoder::Encode</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_audio_buffer.html">AudioBuffer</a> &amp;&#160;</td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;&#160;</td>
<td class="paramname"><em>cc</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Encodes an audio buffer. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">audio_buffer</td><td>The <code><a class="el" href="classpp_1_1_audio_buffer.html">AudioBuffer</a></code> to be encoded. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="classpp_1_1_completion_callback.html" title="This API enables you to implement and receive callbacks when Pepper operations complete asynchronousl...">CompletionCallback</a></code> to be called upon completion. Plugins that pass <code><a class="el" href="classpp_1_1_audio_buffer.html">AudioBuffer</a></code> resources owned by other resources should wait for completion before reusing them.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code>pp_errors.h</code>. Returns PP_ERROR_FAILED if <a class="el" href="classpp_1_1_audio_encoder.html#a28aa43f8c92b387b81e7cf63219c2933" title="Initializes a audio encoder resource.">Initialize()</a> has not successfully completed. </dd></dl>
</div>
</div>
<a class="anchor" id="ad1a2c96562e2baa7a61d63fbb8a49999"></a><!-- doxytag: member="pp::AudioEncoder::GetBitstreamBuffer" ref="ad1a2c96562e2baa7a61d63fbb8a49999" args="(const CompletionCallbackWithOutput&lt; PP_AudioBitstreamBuffer &gt; &amp;cc)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t <a class="el" href="classpp_1_1_audio_encoder.html#ad1a2c96562e2baa7a61d63fbb8a49999">pp::AudioEncoder::GetBitstreamBuffer</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback_with_output.html">CompletionCallbackWithOutput</a>&lt; PP_AudioBitstreamBuffer &gt; &amp;&#160;</td>
<td class="paramname"><em>cc</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Gets the next encoded bitstream buffer from the encoder. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="classpp_1_1_completion_callback_with_output.html" title="A CompletionCallbackWithOutput defines a completion callback that additionally stores a pointer to so...">CompletionCallbackWithOutput</a></code> to be called upon completion with the next bitstream buffer. The plugin can call GetBitstreamBuffer from the callback in order to continuously "pull" bitstream buffers from the encoder.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code>pp_errors.h</code>. Returns PP_ERROR_FAILED if <a class="el" href="classpp_1_1_audio_encoder.html#a28aa43f8c92b387b81e7cf63219c2933" title="Initializes a audio encoder resource.">Initialize()</a> has not successfully completed. Returns PP_ERROR_INPROGRESS if a prior call to <a class="el" href="classpp_1_1_audio_encoder.html#ad1a2c96562e2baa7a61d63fbb8a49999" title="Gets the next encoded bitstream buffer from the encoder.">GetBitstreamBuffer()</a> has not completed. </dd></dl>
</div>
</div>
<a class="anchor" id="a113d4a018e987f2f5227c6e0dc8a7687"></a><!-- doxytag: member="pp::AudioEncoder::GetBuffer" ref="a113d4a018e987f2f5227c6e0dc8a7687" args="(const CompletionCallbackWithOutput&lt; AudioBuffer &gt; &amp;cc)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t <a class="el" href="classpp_1_1_audio_encoder.html#a113d4a018e987f2f5227c6e0dc8a7687">pp::AudioEncoder::GetBuffer</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback_with_output.html">CompletionCallbackWithOutput</a>&lt; <a class="el" href="classpp_1_1_audio_buffer.html">AudioBuffer</a> &gt; &amp;&#160;</td>
<td class="paramname"><em>cc</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Gets a blank audio frame which can be filled with audio data and passed to the encoder. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="classpp_1_1_completion_callback_with_output.html" title="A CompletionCallbackWithOutput defines a completion callback that additionally stores a pointer to so...">CompletionCallbackWithOutput</a></code> to be called upon completion with the blank <code><a class="el" href="classpp_1_1_audio_buffer.html">AudioBuffer</a></code> resource.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code>pp_errors.h</code>. </dd></dl>
</div>
</div>
<a class="anchor" id="a706b305dae8bc5f5e0bca4491c991d59"></a><!-- doxytag: member="pp::AudioEncoder::GetNumberOfSamples" ref="a706b305dae8bc5f5e0bca4491c991d59" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t <a class="el" href="classpp_1_1_audio_encoder.html#a706b305dae8bc5f5e0bca4491c991d59">pp::AudioEncoder::GetNumberOfSamples</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Gets the number of audio samples per channel that audio buffers must contain in order to be processed by the encoder. </p>
<p>This will be the number of samples per channels contained in buffers returned by <a class="el" href="classpp_1_1_audio_encoder.html#a113d4a018e987f2f5227c6e0dc8a7687" title="Gets a blank audio frame which can be filled with audio data and passed to the encoder.">GetBuffer()</a>.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing the number of samples required, or an error code from <code>pp_errors.h</code>. Returns PP_ERROR_FAILED if <a class="el" href="classpp_1_1_audio_encoder.html#a28aa43f8c92b387b81e7cf63219c2933" title="Initializes a audio encoder resource.">Initialize()</a> has not successfully completed. </dd></dl>
</div>
</div>
<a class="anchor" id="a34b94c7bb1f509f4b56bfe7349560669"></a><!-- doxytag: member="pp::AudioEncoder::GetSupportedProfiles" ref="a34b94c7bb1f509f4b56bfe7349560669" args="(const CompletionCallbackWithOutput&lt; std::vector&lt; PP_AudioProfileDescription &gt; &gt; &amp;cc)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t <a class="el" href="classpp_1_1_audio_encoder.html#a34b94c7bb1f509f4b56bfe7349560669">pp::AudioEncoder::GetSupportedProfiles</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback_with_output.html">CompletionCallbackWithOutput</a>&lt; std::vector&lt; PP_AudioProfileDescription &gt; &gt; &amp;&#160;</td>
<td class="paramname"><em>cc</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Gets an array of supported audio encoder profiles. </p>
<p>These can be used to choose a profile before calling <a class="el" href="classpp_1_1_audio_encoder.html#a28aa43f8c92b387b81e7cf63219c2933" title="Initializes a audio encoder resource.">Initialize()</a>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="classpp_1_1_completion_callback_with_output.html" title="A CompletionCallbackWithOutput defines a completion callback that additionally stores a pointer to so...">CompletionCallbackWithOutput</a></code> to be called upon completion with the PP_AudioProfileDescription structs.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>If &gt;= 0, the number of supported profiles returned, otherwise an error code from <code>pp_errors.h</code>. </dd></dl>
</div>
</div>
<a class="anchor" id="a28aa43f8c92b387b81e7cf63219c2933"></a><!-- doxytag: member="pp::AudioEncoder::Initialize" ref="a28aa43f8c92b387b81e7cf63219c2933" args="(uint32_t channels, PP_AudioBuffer_SampleRate input_sample_rate, PP_AudioBuffer_SampleSize input_sample_size, PP_AudioProfile output_profile, uint32_t initial_bitrate, PP_HardwareAcceleration acceleration, const CompletionCallback &amp;cc)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t <a class="el" href="classpp_1_1_audio_encoder.html#a28aa43f8c92b387b81e7cf63219c2933">pp::AudioEncoder::Initialize</a> </td>
<td>(</td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>channels</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PP_AudioBuffer_SampleRate&#160;</td>
<td class="paramname"><em>input_sample_rate</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PP_AudioBuffer_SampleSize&#160;</td>
<td class="paramname"><em>input_sample_size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PP_AudioProfile&#160;</td>
<td class="paramname"><em>output_profile</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>initial_bitrate</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PP_HardwareAcceleration&#160;</td>
<td class="paramname"><em>acceleration</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &amp;&#160;</td>
<td class="paramname"><em>cc</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initializes a audio encoder resource. </p>
<p>This should be called after <a class="el" href="classpp_1_1_audio_encoder.html#a34b94c7bb1f509f4b56bfe7349560669" title="Gets an array of supported audio encoder profiles.">GetSupportedProfiles()</a> and before any functions below.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">channels</td><td>The number of audio channels to encode. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">input_sampling_rate</td><td>The sampling rate of the input audio buffer. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">input_sample_size</td><td>The sample size of the input audio buffer. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">output_profile</td><td>A <code>PP_AudioProfile</code> specifying the codec profile of the encoded output stream. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">initial_bitrate</td><td>The initial bitrate for the encoder. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">acceleration</td><td>A <code>PP_HardwareAcceleration</code> specifying whether to use a hardware accelerated or a software implementation. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="classpp_1_1_completion_callback.html" title="This API enables you to implement and receive callbacks when Pepper operations complete asynchronousl...">CompletionCallback</a></code> to be called upon completion.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code>pp_errors.h</code>. Returns PP_ERROR_NOTSUPPORTED if audio encoding is not available, or the requested codec profile is not supported. Returns PP_ERROR_NOMEMORY if bitstream buffers can't be created. </dd></dl>
</div>
</div>
<a class="anchor" id="a9c5b90b6dbfd81154b28f402197184bc"></a><!-- doxytag: member="pp::AudioEncoder::RecycleBitstreamBuffer" ref="a9c5b90b6dbfd81154b28f402197184bc" args="(const PP_AudioBitstreamBuffer &amp;bitstream_buffer)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classpp_1_1_audio_encoder.html#a9c5b90b6dbfd81154b28f402197184bc">pp::AudioEncoder::RecycleBitstreamBuffer</a> </td>
<td>(</td>
<td class="paramtype">const PP_AudioBitstreamBuffer &amp;&#160;</td>
<td class="paramname"><em>bitstream_buffer</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Recycles a bitstream buffer back to the encoder. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">bitstream_buffer</td><td>A<code>PP_AudioBitstreamBuffer</code> that is no longer needed by the plugin. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="aa64ea3b0313335817833a72ceed96114"></a><!-- doxytag: member="pp::AudioEncoder::RequestBitrateChange" ref="aa64ea3b0313335817833a72ceed96114" args="(uint32_t bitrate)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classpp_1_1_audio_encoder.html#aa64ea3b0313335817833a72ceed96114">pp::AudioEncoder::RequestBitrateChange</a> </td>
<td>(</td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>bitrate</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Requests a change to the encoding bitrate. </p>
<p>This is only a request, fulfilled on a best-effort basis.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">audio_encoder</td><td>A <code>PP_Resource</code> identifying the audio encoder. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr />The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="audio__encoder_8h.html">audio_encoder.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}