libopusenc
0.2.1-13-gdc6ab59
Stand-alone encoder library for .opus files.
|
Functions for encoding Ogg Opus files | |
OPE_EXPORT OggOpusEnc * | ope_encoder_create_file (const char *path, OggOpusComments *comments, opus_int32 rate, int channels, int family, int *error) |
Create a new OggOpus file. More... | |
OPE_EXPORT OggOpusEnc * | ope_encoder_create_callbacks (const OpusEncCallbacks *callbacks, void *user_data, OggOpusComments *comments, opus_int32 rate, int channels, int family, int *error) |
Create a new OggOpus stream to be handled using callbacks. More... | |
OPE_EXPORT OggOpusEnc * | ope_encoder_create_pull (OggOpusComments *comments, opus_int32 rate, int channels, int family, int *error) |
Create a new OggOpus stream to be used along with.ope_encoder_get_page(). More... | |
OPE_EXPORT int | ope_encoder_deferred_init_with_mapping (OggOpusEnc *enc, int family, int streams, int coupled_streams, const unsigned char *mapping) |
Deferred initialization of the encoder to force an explicit channel mapping. More... | |
OPE_EXPORT int | ope_encoder_write_float (OggOpusEnc *enc, const float *pcm, int samples_per_channel) |
Add/encode any number of float samples to the stream. More... | |
OPE_EXPORT int | ope_encoder_write (OggOpusEnc *enc, const opus_int16 *pcm, int samples_per_channel) |
Add/encode any number of 16-bit linear samples to the stream. More... | |
OPE_EXPORT int | ope_encoder_get_page (OggOpusEnc *enc, unsigned char **page, opus_int32 *len, int flush) |
Get the next page from the stream (only if using ope_encoder_create_pull()). More... | |
OPE_EXPORT int | ope_encoder_drain (OggOpusEnc *enc) |
Finalizes the stream, but does not deallocate the object. More... | |
OPE_EXPORT void | ope_encoder_destroy (OggOpusEnc *enc) |
Deallocates the obect. More... | |
OPE_EXPORT int | ope_encoder_chain_current (OggOpusEnc *enc, OggOpusComments *comments) |
Ends the stream and create a new stream within the same file. More... | |
OPE_EXPORT int | ope_encoder_continue_new_file (OggOpusEnc *enc, const char *path, OggOpusComments *comments) |
Ends the stream and create a new file. More... | |
OPE_EXPORT int | ope_encoder_continue_new_callbacks (OggOpusEnc *enc, void *user_data, OggOpusComments *comments) |
Ends the stream and create a new file (callback-based). More... | |
OPE_EXPORT int | ope_encoder_flush_header (OggOpusEnc *enc) |
Write out the header now rather than wait for audio to begin. More... | |
OPE_EXPORT int | ope_encoder_ctl (OggOpusEnc *enc, int request,...) |
Sets encoder options. More... | |
OPE_EXPORT const char * | ope_strerror (int error) |
Converts a libopusenc error code into a human readable string. More... | |
OPE_EXPORT const char * | ope_get_version_string (void) |
Returns a string representing the version of libopusenc being used at run time. More... | |
OPE_EXPORT int | ope_get_abi_version (void) |
ABI version for this header. More... | |
OPE_EXPORT OggOpusEnc* ope_encoder_create_file | ( | const char * | path, |
OggOpusComments * | comments, | ||
opus_int32 | rate, | ||
int | channels, | ||
int | family, | ||
int * | error | ||
) |
Create a new OggOpus file.
path | Path where to create the file | |
comments | Comments associated with the stream | |
rate | Input sampling rate (48 kHz is faster) | |
channels | Number of channels | |
family | Mapping family (0 for mono/stereo, 1 for surround) | |
[out] | error | Error code (NULL if no error is to be returned) |
OPE_EXPORT OggOpusEnc* ope_encoder_create_callbacks | ( | const OpusEncCallbacks * | callbacks, |
void * | user_data, | ||
OggOpusComments * | comments, | ||
opus_int32 | rate, | ||
int | channels, | ||
int | family, | ||
int * | error | ||
) |
Create a new OggOpus stream to be handled using callbacks.
callbacks | Callback functions | |
user_data | Pointer to be associated with the stream and passed to the callbacks | |
comments | Comments associated with the stream | |
rate | Input sampling rate (48 kHz is faster) | |
channels | Number of channels | |
family | Mapping family (0 for mono/stereo, 1 for surround) | |
[out] | error | Error code (NULL if no error is to be returned) |
OPE_EXPORT OggOpusEnc* ope_encoder_create_pull | ( | OggOpusComments * | comments, |
opus_int32 | rate, | ||
int | channels, | ||
int | family, | ||
int * | error | ||
) |
Create a new OggOpus stream to be used along with.ope_encoder_get_page().
This is mostly useful for muxing with other streams.
comments | Comments associated with the stream | |
rate | Input sampling rate (48 kHz is faster) | |
channels | Number of channels | |
family | Mapping family (0 for mono/stereo, 1 for surround) | |
[out] | error | Error code (NULL if no error is to be returned) |
OPE_EXPORT int ope_encoder_deferred_init_with_mapping | ( | OggOpusEnc * | enc, |
int | family, | ||
int | streams, | ||
int | coupled_streams, | ||
const unsigned char * | mapping | ||
) |
Deferred initialization of the encoder to force an explicit channel mapping.
This can be used to override the default channel coupling, but using it for regular surround will almost certainly lead to worse quality.
[in,out] | enc | Encoder |
family | Mapping family (0 for mono/stereo, 1 for surround) | |
streams | Total number of streams | |
coupled_streams | Number of coupled streams | |
mapping | Channel mapping |
OPE_EXPORT int ope_encoder_write_float | ( | OggOpusEnc * | enc, |
const float * | pcm, | ||
int | samples_per_channel | ||
) |
Add/encode any number of float samples to the stream.
[in,out] | enc | Encoder |
pcm | Floating-point PCM values in the +/-1 range (interleaved if multiple channels) | |
samples_per_channel | Number of samples for each channel |
OPE_EXPORT int ope_encoder_write | ( | OggOpusEnc * | enc, |
const opus_int16 * | pcm, | ||
int | samples_per_channel | ||
) |
Add/encode any number of 16-bit linear samples to the stream.
[in,out] | enc | Encoder |
pcm | Linear 16-bit PCM values in the [-32768,32767] range (interleaved if multiple channels) | |
samples_per_channel | Number of samples for each channel |
OPE_EXPORT int ope_encoder_get_page | ( | OggOpusEnc * | enc, |
unsigned char ** | page, | ||
opus_int32 * | len, | ||
int | flush | ||
) |
Get the next page from the stream (only if using ope_encoder_create_pull()).
[in,out] | enc | Encoder |
[out] | page | Next available encoded page |
[out] | len | Size (in bytes) of the page returned |
flush | If non-zero, forces a flush of the page (if any data avaiable) |
OPE_EXPORT int ope_encoder_drain | ( | OggOpusEnc * | enc | ) |
Finalizes the stream, but does not deallocate the object.
[in,out] | enc | Encoder |
OPE_EXPORT void ope_encoder_destroy | ( | OggOpusEnc * | enc | ) |
Deallocates the obect.
Make sure to ope_drain() first.
[in,out] | enc | Encoder |
OPE_EXPORT int ope_encoder_chain_current | ( | OggOpusEnc * | enc, |
OggOpusComments * | comments | ||
) |
Ends the stream and create a new stream within the same file.
[in,out] | enc | Encoder |
comments | Comments associated with the stream |
OPE_EXPORT int ope_encoder_continue_new_file | ( | OggOpusEnc * | enc, |
const char * | path, | ||
OggOpusComments * | comments | ||
) |
Ends the stream and create a new file.
[in,out] | enc | Encoder |
path | Path where to write the new file | |
comments | Comments associated with the stream |
OPE_EXPORT int ope_encoder_continue_new_callbacks | ( | OggOpusEnc * | enc, |
void * | user_data, | ||
OggOpusComments * | comments | ||
) |
Ends the stream and create a new file (callback-based).
[in,out] | enc | Encoder |
user_data | Pointer to be associated with the new stream and passed to the callbacks | |
comments | Comments associated with the stream |
OPE_EXPORT int ope_encoder_flush_header | ( | OggOpusEnc * | enc | ) |
Write out the header now rather than wait for audio to begin.
[in,out] | enc | Encoder |
OPE_EXPORT int ope_encoder_ctl | ( | OggOpusEnc * | enc, |
int | request, | ||
... | |||
) |
Sets encoder options.
[in,out] | enc | Encoder |
request | Use a request macro |
OPE_EXPORT const char* ope_strerror | ( | int | error | ) |
Converts a libopusenc error code into a human readable string.
error | Error number |
OPE_EXPORT const char* ope_get_version_string | ( | void | ) |
Returns a string representing the version of libopusenc being used at run time.
OPE_EXPORT int ope_get_abi_version | ( | void | ) |
ABI version for this header.
Can be used to check for features at run time.