From 8714c3503bc49b72f79909338684c41cb1282e84 Mon Sep 17 00:00:00 2001 From: edupode <30982306+edupode@users.noreply.github.com> Date: Mon, 23 Nov 2026 15:54:45 +0000 Subject: [RT-197] Add the XMA2 decoder C ABI boundary (#3441) Squash-merged after diff review of PR #3441 --- runtime/xma_decoder/leonida_xma2_decoder.h | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 runtime/xma_decoder/leonida_xma2_decoder.h (limited to 'runtime/xma_decoder/leonida_xma2_decoder.h') diff --git a/runtime/xma_decoder/leonida_xma2_decoder.h b/runtime/xma_decoder/leonida_xma2_decoder.h new file mode 100644 index 000000000..98dd5c49c --- /dev/null +++ b/runtime/xma_decoder/leonida_xma2_decoder.h @@ -0,0 +1,40 @@ +#ifndef LEONIDA_XMA2_DECODER_H +#define LEONIDA_XMA2_DECODER_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define LEONIDA_XMA2_PACKET_BYTES 2048u + +typedef struct LeonidaXma2Decoder LeonidaXma2Decoder; +typedef struct LeonidaXma2PcmBlock LeonidaXma2PcmBlock; + +enum LeonidaXma2Status { + LEONIDA_XMA2_OK = 0, + LEONIDA_XMA2_INVALID_ARGUMENT = 1, + LEONIDA_XMA2_INVALID_FORMAT = 2, + LEONIDA_XMA2_BAD_PACKET_SIZE = 3, + LEONIDA_XMA2_OUT_OF_MEMORY = 4, + LEONIDA_XMA2_DECODER_FAILURE = 5, + LEONIDA_XMA2_PANIC = 6, +}; + +int32_t leonida_xma2_decoder_create(uint32_t sample_rate, uint32_t channels, + LeonidaXma2Decoder **out_decoder); +int32_t leonida_xma2_decode_buffer(LeonidaXma2Decoder *decoder, + const uint8_t *input, size_t input_len, + LeonidaXma2PcmBlock **out_block); +void leonida_xma2_decoder_destroy(LeonidaXma2Decoder *decoder); +const int16_t *leonida_xma2_pcm_data(const LeonidaXma2PcmBlock *block); +size_t leonida_xma2_pcm_sample_count(const LeonidaXma2PcmBlock *block); +void leonida_xma2_pcm_destroy(LeonidaXma2PcmBlock *block); + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.2.3