{{+bindTo:partials.standard_nacl_api}}
<h1>PPB_AudioEncoder Struct 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="PPB_AudioEncoder" --><h2>
Data Fields</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a116d0908bcdd955e33e00cbd9ae04110">Create</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a63e54ec7e63e940c59c1b365669a5002">IsAudioEncoder</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a2ad5e2334abb35ede4c413e50e92ec61">GetSupportedProfiles</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder, struct <a class="el" href="struct_p_p___array_output.html">PP_ArrayOutput</a> output, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a676b09b0a98069daea08678a8c9e5d70">Initialize</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder, uint32_t channels, <a class="el" href="group___enums.html#ga78757d4be14d14d17708071a9466afbd">PP_AudioBuffer_SampleRate</a> input_sample_rate, <a class="el" href="group___enums.html#ga2ba5c3a8eed23fa49a73b218b1bce044">PP_AudioBuffer_SampleSize</a> input_sample_size, <a class="el" href="group___enums.html#gadadb1eaddb4ea71cb8620db1f4ce301e">PP_AudioProfile</a> output_profile, uint32_t initial_bitrate, <a class="el" href="group___enums.html#ga6a3fd7e22be02521243b52481afadae5">PP_HardwareAcceleration</a> acceleration, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a49a627f22227a877391f2f569a4490ff">GetNumberOfSamples</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_encoder__0__1.html#ac154730ff2248134c73d5155c4a7095f">GetBuffer</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder, <a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> *audio_buffer, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a61e9304df6da6bbb97236805d702d0a3">Encode</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder, <a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_buffer, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a7386d14006ed634530d0ad2ecdb61529">GetBitstreamBuffer</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder, struct <a class="el" href="struct_p_p___audio_bitstream_buffer.html">PP_AudioBitstreamBuffer</a> *bitstream_buffer, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a8046882d9584418d02e017130aa55d80">RecycleBitstreamBuffer</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder, const struct <a class="el" href="struct_p_p___audio_bitstream_buffer.html">PP_AudioBitstreamBuffer</a> *bitstream_buffer)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_encoder__0__1.html#ac5a8cbc3578816a15f3418882b6b720c">RequestBitrateChange</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder, uint32_t bitrate)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___audio_encoder__0__1.html#ad472829d0944505ce8cfb2a2b6308165">Close</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder)</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Audio encoder interface. </p>
<p>Typical usage:</p>
<ul>
<li>Call <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a116d0908bcdd955e33e00cbd9ae04110" title="Creates a new audio encoder resource.">Create()</a> to create a new audio encoder resource.</li>
<li>Call <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a2ad5e2334abb35ede4c413e50e92ec61" title="Gets an array of supported audio encoder profiles.">GetSupportedProfiles()</a> to determine which codecs and profiles are available.</li>
<li>Call <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a676b09b0a98069daea08678a8c9e5d70" title="Initializes an audio encoder resource.">Initialize()</a> to initialize the encoder for a supported profile.</li>
<li>Call <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#ac154730ff2248134c73d5155c4a7095f" title="Gets a blank audio buffer (with metadata given by the Initialize() call) which can be filled with aud...">GetBuffer()</a> to get an empty buffer and fill it in, or get an audio buffer from another resource, e.g. <code>PPB_MediaStreamAudioTrack</code>.</li>
<li>Call <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a61e9304df6da6bbb97236805d702d0a3" 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 buffer.</li>
<li>Call <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a7386d14006ed634530d0ad2ecdb61529" 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="struct_p_p_b___audio_encoder__0__1.html#a8046882d9584418d02e017130aa55d80" 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>Field Documentation</h2>
<a class="anchor" id="ad472829d0944505ce8cfb2a2b6308165"></a><!-- doxytag: member="PPB_AudioEncoder::Close" ref="ad472829d0944505ce8cfb2a2b6308165" args=")(PP_Resource audio_encoder)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void(* <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#ad472829d0944505ce8cfb2a2b6308165">PPB_AudioEncoder::Close</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder)</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="struct_p_p_b___audio_encoder__0__1.html#ad472829d0944505ce8cfb2a2b6308165" title="Closes the audio encoder, and cancels any pending encodes.">Close()</a>.</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>
<a class="anchor" id="a116d0908bcdd955e33e00cbd9ae04110"></a><!-- doxytag: member="PPB_AudioEncoder::Create" ref="a116d0908bcdd955e33e00cbd9ae04110" args=")(PP_Instance instance)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(* <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a116d0908bcdd955e33e00cbd9ae04110">PPB_AudioEncoder::Create</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a new audio encoder resource. </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>A <code>PP_Instance</code> identifying the instance with the audio encoder.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Resource</code> corresponding to an audio encoder if successful or 0 otherwise. </dd></dl>
</div>
</div>
<a class="anchor" id="a61e9304df6da6bbb97236805d702d0a3"></a><!-- doxytag: member="PPB_AudioEncoder::Encode" ref="a61e9304df6da6bbb97236805d702d0a3" args=")(PP_Resource audio_encoder, PP_Resource audio_buffer, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a61e9304df6da6bbb97236805d702d0a3">PPB_AudioEncoder::Encode</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder, <a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_buffer, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</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_encoder</td><td>A <code>PP_Resource</code> identifying the audio encoder. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">audio_buffer</td><td>The <code>PPB_AudioBuffer</code> to be encoded. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to be called upon completion. Plugins that pass <code>PPB_AudioBuffer</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><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. Returns PP_ERROR_FAILED if <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a676b09b0a98069daea08678a8c9e5d70" title="Initializes an audio encoder resource.">Initialize()</a> has not successfully completed. </dd></dl>
</div>
</div>
<a class="anchor" id="a7386d14006ed634530d0ad2ecdb61529"></a><!-- doxytag: member="PPB_AudioEncoder::GetBitstreamBuffer" ref="a7386d14006ed634530d0ad2ecdb61529" args=")(PP_Resource audio_encoder, struct PP_AudioBitstreamBuffer *bitstream_buffer, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a7386d14006ed634530d0ad2ecdb61529">PPB_AudioEncoder::GetBitstreamBuffer</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder, struct <a class="el" href="struct_p_p___audio_bitstream_buffer.html">PP_AudioBitstreamBuffer</a> *bitstream_buffer, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</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">audio_encoder</td><td>A <code>PP_Resource</code> identifying the audio encoder. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">bitstream_buffer</td><td>A <code><a class="el" href="struct_p_p___bitstream_buffer.html" title="Struct describing a bitstream buffer.">PP_BitstreamBuffer</a></code> containing encoded audio data. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to be called upon completion. 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><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. Returns PP_ERROR_FAILED if <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a676b09b0a98069daea08678a8c9e5d70" title="Initializes an audio encoder resource.">Initialize()</a> has not successfully completed. Returns PP_ERROR_INPROGRESS if a prior call to <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a7386d14006ed634530d0ad2ecdb61529" title="Gets the next encoded bitstream buffer from the encoder.">GetBitstreamBuffer()</a> has not completed. </dd></dl>
</div>
</div>
<a class="anchor" id="ac154730ff2248134c73d5155c4a7095f"></a><!-- doxytag: member="PPB_AudioEncoder::GetBuffer" ref="ac154730ff2248134c73d5155c4a7095f" args=")(PP_Resource audio_encoder, PP_Resource *audio_buffer, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#ac154730ff2248134c73d5155c4a7095f">PPB_AudioEncoder::GetBuffer</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder, <a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> *audio_buffer, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Gets a blank audio buffer (with metadata given by the <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a676b09b0a98069daea08678a8c9e5d70" title="Initializes an audio encoder resource.">Initialize()</a> call) 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">audio_encoder</td><td>A <code>PP_Resource</code> identifying the audio encoder. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">audio_buffer</td><td>A blank <code>PPB_AudioBuffer</code> resource. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_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><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. Returns PP_ERROR_FAILED if <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a676b09b0a98069daea08678a8c9e5d70" title="Initializes an audio encoder resource.">Initialize()</a> has not successfully completed. </dd></dl>
</div>
</div>
<a class="anchor" id="a49a627f22227a877391f2f569a4490ff"></a><!-- doxytag: member="PPB_AudioEncoder::GetNumberOfSamples" ref="a49a627f22227a877391f2f569a4490ff" args=")(PP_Resource audio_encoder)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a49a627f22227a877391f2f569a4490ff">PPB_AudioEncoder::GetNumberOfSamples</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder)</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="struct_p_p_b___audio_encoder__0__1.html#ac154730ff2248134c73d5155c4a7095f" title="Gets a blank audio buffer (with metadata given by the Initialize() call) which can be filled with aud...">GetBuffer()</a>.</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>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing the number of samples required, or an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. Returns PP_ERROR_FAILED if <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a676b09b0a98069daea08678a8c9e5d70" title="Initializes an audio encoder resource.">Initialize()</a> has not successfully completed. </dd></dl>
</div>
</div>
<a class="anchor" id="a2ad5e2334abb35ede4c413e50e92ec61"></a><!-- doxytag: member="PPB_AudioEncoder::GetSupportedProfiles" ref="a2ad5e2334abb35ede4c413e50e92ec61" args=")(PP_Resource audio_encoder, struct PP_ArrayOutput output, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a2ad5e2334abb35ede4c413e50e92ec61">PPB_AudioEncoder::GetSupportedProfiles</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder, struct <a class="el" href="struct_p_p___array_output.html">PP_ArrayOutput</a> output, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</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="struct_p_p_b___audio_encoder__0__1.html#a676b09b0a98069daea08678a8c9e5d70" title="Initializes an 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">audio_encoder</td><td>A <code>PP_Resource</code> identifying the audio encoder. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">output</td><td>A <code><a class="el" href="struct_p_p___array_output.html" title="A structure that defines a way for the browser to return arrays of data to the plugin.">PP_ArrayOutput</a></code> to receive the supported <code><a class="el" href="struct_p_p___audio_profile_description.html" title="Supported audio profile information.">PP_AudioProfileDescription</a></code> structs. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to be called upon completion.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>If >= 0, the number of supported profiles returned, otherwise an error code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. </dd></dl>
</div>
</div>
<a class="anchor" id="a676b09b0a98069daea08678a8c9e5d70"></a><!-- doxytag: member="PPB_AudioEncoder::Initialize" ref="a676b09b0a98069daea08678a8c9e5d70" args=")(PP_Resource audio_encoder, 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, struct PP_CompletionCallback callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a676b09b0a98069daea08678a8c9e5d70">PPB_AudioEncoder::Initialize</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder, uint32_t channels, <a class="el" href="group___enums.html#ga78757d4be14d14d17708071a9466afbd">PP_AudioBuffer_SampleRate</a> input_sample_rate, <a class="el" href="group___enums.html#ga2ba5c3a8eed23fa49a73b218b1bce044">PP_AudioBuffer_SampleSize</a> input_sample_size, <a class="el" href="group___enums.html#gadadb1eaddb4ea71cb8620db1f4ce301e">PP_AudioProfile</a> output_profile, uint32_t initial_bitrate, <a class="el" href="group___enums.html#ga6a3fd7e22be02521243b52481afadae5">PP_HardwareAcceleration</a> acceleration, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> callback)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initializes an audio encoder resource. </p>
<p>The plugin should call <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a676b09b0a98069daea08678a8c9e5d70" title="Initializes an audio encoder resource.">Initialize()</a> successfully before calling any of the functions below.</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>
<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="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_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><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. Returns PP_ERROR_NOTSUPPORTED if audio encoding is not available, or the requested codec profile is not supported. </dd></dl>
</div>
</div>
<a class="anchor" id="a63e54ec7e63e940c59c1b365669a5002"></a><!-- doxytag: member="PPB_AudioEncoder::IsAudioEncoder" ref="a63e54ec7e63e940c59c1b365669a5002" args=")(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a63e54ec7e63e940c59c1b365669a5002">PPB_AudioEncoder::IsAudioEncoder</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Determines if the given resource is an audio encoder. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PP_Resource</code> identifying a resource.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>PP_TRUE</code> if the resource is a <code>PPB_AudioEncoder</code>, <code>PP_FALSE</code> if the resource is invalid or some other type. </dd></dl>
</div>
</div>
<a class="anchor" id="a8046882d9584418d02e017130aa55d80"></a><!-- doxytag: member="PPB_AudioEncoder::RecycleBitstreamBuffer" ref="a8046882d9584418d02e017130aa55d80" args=")(PP_Resource audio_encoder, const struct PP_AudioBitstreamBuffer *bitstream_buffer)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void(* <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#a8046882d9584418d02e017130aa55d80">PPB_AudioEncoder::RecycleBitstreamBuffer</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder, const struct <a class="el" href="struct_p_p___audio_bitstream_buffer.html">PP_AudioBitstreamBuffer</a> *bitstream_buffer)</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">audio_encoder</td><td>A <code>PP_Resource</code> identifying the audio encoder. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">bitstream_buffer</td><td>A <code><a class="el" href="struct_p_p___bitstream_buffer.html" title="Struct describing a bitstream buffer.">PP_BitstreamBuffer</a></code> that is no longer needed by the plugin. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ac5a8cbc3578816a15f3418882b6b720c"></a><!-- doxytag: member="PPB_AudioEncoder::RequestBitrateChange" ref="ac5a8cbc3578816a15f3418882b6b720c" args=")(PP_Resource audio_encoder, uint32_t bitrate)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void(* <a class="el" href="struct_p_p_b___audio_encoder__0__1.html#ac5a8cbc3578816a15f3418882b6b720c">PPB_AudioEncoder::RequestBitrateChange</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> audio_encoder, uint32_t bitrate)</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>
<tr><td class="paramdir">[in]</td><td class="paramname">bitrate</td><td>The requested new bitrate, in bits per second. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr />The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="ppb__audio__encoder_8h.html">ppb_audio_encoder.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}