Pepper_47_C_interfaces
Public Attributes | List of all members
PPB_AudioEncoder_0_1 Struct Reference

#include <ppb_audio_encoder.h>

Collaboration diagram for PPB_AudioEncoder_0_1:
Collaboration graph

Public Attributes

PP_Resource(* Create )(PP_Instance instance)
 
PP_Bool(* IsAudioEncoder )(PP_Resource resource)
 
int32_t(* GetSupportedProfiles )(PP_Resource audio_encoder, struct PP_ArrayOutput output, struct PP_CompletionCallback callback)
 
int32_t(* Initialize )(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)
 
int32_t(* GetNumberOfSamples )(PP_Resource audio_encoder)
 
int32_t(* GetBuffer )(PP_Resource audio_encoder, PP_Resource *audio_buffer, struct PP_CompletionCallback callback)
 
int32_t(* Encode )(PP_Resource audio_encoder, PP_Resource audio_buffer, struct PP_CompletionCallback callback)
 
int32_t(* GetBitstreamBuffer )(PP_Resource audio_encoder, struct PP_AudioBitstreamBuffer *bitstream_buffer, struct PP_CompletionCallback callback)
 
void(* RecycleBitstreamBuffer )(PP_Resource audio_encoder, const struct PP_AudioBitstreamBuffer *bitstream_buffer)
 
void(* RequestBitrateChange )(PP_Resource audio_encoder, uint32_t bitrate)
 
void(* Close )(PP_Resource audio_encoder)
 

Detailed Description

Audio encoder interface.

Typical usage:

Available audio codecs vary by platform. All: opus.

Definition at line 54 of file ppb_audio_encoder.h.

Member Data Documentation

void(* PPB_AudioEncoder_0_1::Close)(PP_Resource audio_encoder)

Closes the audio encoder, and cancels any pending encodes. Any pending callbacks will still run, reporting PP_ERROR_ABORTED . It is not valid to call any encoder functions after a call to this method. Note: Destroying the audio encoder closes it implicitly, so you are not required to call Close().

Parameters
[in]audio_encoderA PP_Resource identifying the audio encoder.

Definition at line 215 of file ppb_audio_encoder.h.

PP_Resource(* PPB_AudioEncoder_0_1::Create)(PP_Instance instance)

Creates a new audio encoder resource.

Parameters
[in]instanceA PP_Instance identifying the instance with the audio encoder.
Returns
A PP_Resource corresponding to an audio encoder if successful or 0 otherwise.

Definition at line 64 of file ppb_audio_encoder.h.

int32_t(* PPB_AudioEncoder_0_1::Encode)(PP_Resource audio_encoder, PP_Resource audio_buffer, struct PP_CompletionCallback callback)

Encodes an audio buffer.

Parameters
[in]audio_encoderA PP_Resource identifying the audio encoder.
[in]audio_bufferThe PPB_AudioBuffer to be encoded.
[in]callbackA PP_CompletionCallback to be called upon completion. Plugins that pass PPB_AudioBuffer resources owned by other resources should wait for completion before reusing them.
Returns
An int32_t containing an error code from pp_errors.h. Returns PP_ERROR_FAILED if Initialize() has not successfully completed.

Definition at line 162 of file ppb_audio_encoder.h.

int32_t(* PPB_AudioEncoder_0_1::GetBitstreamBuffer)(PP_Resource audio_encoder, struct PP_AudioBitstreamBuffer *bitstream_buffer, struct PP_CompletionCallback callback)

Gets the next encoded bitstream buffer from the encoder.

Parameters
[in]audio_encoderA PP_Resource identifying the audio encoder.
[out]bitstream_bufferA PP_BitstreamBuffer containing encoded audio data.
[in]callbackA PP_CompletionCallback to be called upon completion. The plugin can call GetBitstreamBuffer from the callback in order to continuously "pull" bitstream buffers from the encoder.
Returns
An int32_t containing an error code from pp_errors.h. Returns PP_ERROR_FAILED if Initialize() has not successfully completed. Returns PP_ERROR_INPROGRESS if a prior call to GetBitstreamBuffer() has not completed.

Definition at line 181 of file ppb_audio_encoder.h.

int32_t(* PPB_AudioEncoder_0_1::GetBuffer)(PP_Resource audio_encoder, PP_Resource *audio_buffer, struct PP_CompletionCallback callback)

Gets a blank audio buffer (with metadata given by the Initialize() call) which can be filled with audio data and passed to the encoder.

Parameters
[in]audio_encoderA PP_Resource identifying the audio encoder.
[out]audio_bufferA blank PPB_AudioBuffer resource.
[in]callbackA PP_CompletionCallback to be called upon completion.
Returns
An int32_t containing an error code from pp_errors.h. Returns PP_ERROR_FAILED if Initialize() has not successfully completed.

Definition at line 146 of file ppb_audio_encoder.h.

int32_t(* PPB_AudioEncoder_0_1::GetNumberOfSamples)(PP_Resource audio_encoder)

Gets the number of audio samples per channel that audio buffers must contain in order to be processed by the encoder. This will be the number of samples per channels contained in buffers returned by GetBuffer().

Parameters
[in]audio_encoderA PP_Resource identifying the audio encoder.
Returns
An int32_t containing the number of samples required, or an error code from pp_errors.h. Returns PP_ERROR_FAILED if Initialize() has not successfully completed.

Definition at line 132 of file ppb_audio_encoder.h.

int32_t(* PPB_AudioEncoder_0_1::GetSupportedProfiles)(PP_Resource audio_encoder, struct PP_ArrayOutput output, struct PP_CompletionCallback callback)

Gets an array of supported audio encoder profiles. These can be used to choose a profile before calling Initialize().

Parameters
[in]audio_encoderA PP_Resource identifying the audio encoder.
[in]outputA PP_ArrayOutput to receive the supported PP_AudioProfileDescription structs.
[in]callbackA PP_CompletionCallback to be called upon completion.
Returns
If >= 0, the number of supported profiles returned, otherwise an error code from pp_errors.h.

Definition at line 89 of file ppb_audio_encoder.h.

int32_t(* PPB_AudioEncoder_0_1::Initialize)(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)

Initializes an audio encoder resource. The plugin should call Initialize() successfully before calling any of the functions below.

Parameters
[in]audio_encoderA PP_Resource identifying the audio encoder.
[in]channelsThe number of audio channels to encode.
[in]input_sampling_rateThe sampling rate of the input audio buffer.
[in]input_sample_sizeThe sample size of the input audio buffer.
[in]output_profileA PP_AudioProfile specifying the codec profile of the encoded output stream.
[in]initial_bitrateThe initial bitrate for the encoder.
[in]accelerationA PP_HardwareAcceleration specifying whether to use a hardware accelerated or a software implementation.
[in]callbackA PP_CompletionCallback to be called upon completion.
Returns
An int32_t containing an error code from pp_errors.h. Returns PP_ERROR_NOTSUPPORTED if audio encoding is not available, or the requested codec profile is not supported.

Definition at line 113 of file ppb_audio_encoder.h.

PP_Bool(* PPB_AudioEncoder_0_1::IsAudioEncoder)(PP_Resource resource)

Determines if the given resource is an audio encoder.

Parameters
[in]resourceA PP_Resource identifying a resource.
Returns
PP_TRUE if the resource is a PPB_AudioEncoder, PP_FALSE if the resource is invalid or some other type.

Definition at line 74 of file ppb_audio_encoder.h.

void(* PPB_AudioEncoder_0_1::RecycleBitstreamBuffer)(PP_Resource audio_encoder, const struct PP_AudioBitstreamBuffer *bitstream_buffer)

Recycles a bitstream buffer back to the encoder.

Parameters
[in]audio_encoderA PP_Resource identifying the audio encoder.
[in]bitstream_bufferA PP_BitstreamBuffer that is no longer needed by the plugin.

Definition at line 193 of file ppb_audio_encoder.h.

void(* PPB_AudioEncoder_0_1::RequestBitrateChange)(PP_Resource audio_encoder, uint32_t bitrate)

Requests a change to the encoding bitrate. This is only a request, fulfilled on a best-effort basis.

Parameters
[in]audio_encoderA PP_Resource identifying the audio encoder.
[in]bitrateThe requested new bitrate, in bits per second.

Definition at line 204 of file ppb_audio_encoder.h.


The documentation for this struct was generated from the following file: