upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/opus_decoder/leonida_opus_decoder.h
diff options
context:
space:
mode:
authorDadaCap <167002618+DadaCap@users.noreply.github.com>2026-11-26 16:27:35 +0100
committerDadaCap <167002618+DadaCap@users.noreply.github.com>2026-11-26 16:27:35 +0100
commitd6b97a97b5c0f3edf916cb60fb81a158a1274852 (patch)
tree1f693450373261b775033a082d6eb746a4f3f882 /runtime/opus_decoder/leonida_opus_decoder.h
parent4d811fcee90f9a4b4c2988117bb78be96360342d (diff)
parentfbf100b1b10e391625585fe6a8bf4e653662ca9a (diff)
Merge main into shadow-keep-gpu-writes: shadow_keep and console_heap_copy tests side by side in CMakeLists
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gt9hwNPurxyJ9LAfUbNiYr
Diffstat (limited to 'runtime/opus_decoder/leonida_opus_decoder.h')
-rw-r--r--runtime/opus_decoder/leonida_opus_decoder.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/runtime/opus_decoder/leonida_opus_decoder.h b/runtime/opus_decoder/leonida_opus_decoder.h
new file mode 100644
index 000000000..d5473510d
--- /dev/null
+++ b/runtime/opus_decoder/leonida_opus_decoder.h
@@ -0,0 +1,44 @@
1#ifndef LEONIDA_OPUS_DECODER_H
2#define LEONIDA_OPUS_DECODER_H
3
4#include <stddef.h>
5#include <stdint.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11/* 120 ms at 48 kHz: the longest Opus packet, in samples per channel. */
12#define LEONIDA_OPUS_MAX_FRAMES 5760u
13
14typedef struct LeonidaOpusDecoder LeonidaOpusDecoder;
15
16enum LeonidaOpusStatus {
17 LEONIDA_OPUS_OK = 0,
18 LEONIDA_OPUS_INVALID_ARGUMENT = 1,
19 LEONIDA_OPUS_INVALID_FORMAT = 2,
20 LEONIDA_OPUS_DECODER_FAILURE = 3,
21 LEONIDA_OPUS_OUT_OF_MEMORY = 4,
22 LEONIDA_OPUS_PANIC = 5,
23 LEONIDA_OPUS_BUFFER_TOO_SMALL = 6,
24};
25
26int32_t leonida_opus_decoder_create(uint32_t sample_rate, uint32_t channels,
27 LeonidaOpusDecoder **out_decoder);
28uint32_t leonida_opus_decoder_channels(const LeonidaOpusDecoder *decoder);
29int32_t leonida_opus_decode_packet(LeonidaOpusDecoder *decoder,
30 const uint8_t *input, size_t input_len,
31 float *out, size_t out_capacity_frames,
32 uint32_t *out_frames);
33int32_t leonida_opus_decoder_reset(LeonidaOpusDecoder *decoder);
34void leonida_opus_decoder_destroy(LeonidaOpusDecoder *decoder);
35/* Test helper: encodes frame_count interleaved f32 frames to one packet at 48 kHz. */
36int32_t leonida_opus_encode_test(const float *input, uint32_t frame_count,
37 uint32_t channels, uint8_t *out,
38 size_t out_capacity, size_t *out_len);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif