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:
authorNotRexed <therealnothingfn@gmail.com>2026-11-27 17:50:37 -0500
committerNotRexed <therealnothingfn@gmail.com>2026-11-27 17:50:37 -0500
commitb87abdef5735adc68a614b2025ffcf9869a47cc5 (patch)
tree0d8b473e8e753883a01e00153175994d6b7949c2 /runtime/opus_decoder/leonida_opus_decoder.h
parent84e728faffb36cd96a08934e5632ba9b194801f3 (diff)
parent34e33d3ddc4dd95ad14a074db886df3d25588201 (diff)
Merge mandy's main into port/d3d12-nvidia
Brings the D3D12 runtime branch (d3d12/, its launcher scripts and notes, and the pull requests reviewed and applied on it) together with mandy's main. Conflicts (67 files, none under d3d12/): docs/, make_game.py, runtime/, scripts/build_runtime.ps1, tests/ and tools/. Every one takes main's side: main is where that code is maintained, and this branch's copies were older states of the same files or the same pull requests in another form. tests/test_fspx_unpack.py is main's too, as it tests main's tools/fspx_unpack.py. Nothing under d3d12/ is changed by the merge. Checked before pushing: python -m compileall over make_game.py, tools and tests; make_game.py --help; scripts/check_no_game_data.py over the files this adds to main; tests/test_text_write_line_endings.py. The translator suite, the C++ runtime build and CI have not run on the result. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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