Skip to main content

odin_decoder_create

enum OdinError odin_decoder_create(uint16_t media_id,
uint32_t sample_rate,
bool stereo,
struct OdinDecoder **out_decoder);

Overview

Creates a new instance of an ODIN decoder with default settings used to process the remote media stream specified with the media_id parameter. The resulting decoder encapsulates an egress resampler using the given sample rate and channel layout.

Parameters

NameTypeDescription
media_iduint16_tThe media ID to decode.
sample_rateuint32_tThe desired output sample rate (e.g. 48000).
stereoboolTrue for stereo output, false for mono.
out_decoderstruct OdinDecoder **Pointer to receive the new decoder handle.

Return Value

TypeDescription
OdinErrorODIN_ERROR_SUCCESS on success.

Example

OdinDecoder *decoder;
// Create a decoder for a specific media stream (e.g. ID 1)
// Output configured for 48kHz stereo
OdinError err = odin_decoder_create(1, 48000, true, &decoder);
if (err == ODIN_ERROR_SUCCESS) {
// ... use decoder ...

odin_decoder_free(decoder);
}