Login
1 branch 0 tags
Ben (Desktop/Arch) Improved submodule handling 1ddd17d 1 month ago 49 Commits
moon / esp32 / main / ogg_opus_decoder.h
#pragma once

#include <stdbool.h>
#include <stdint.h>

// PCM output callback: receives decoded PCM data, returns bytes written
typedef int (*ogg_opus_pcm_cb_t)(uint8_t *data, int size, void *ctx);

// Start decoding an OGG Opus file in a background task.
// filepath: absolute path (e.g. "/sdcard/music/file.opus")
// pcm_cb: callback to write decoded PCM (called from decode task)
// ctx: user context passed to pcm_cb
bool ogg_opus_start(const char *filepath, ogg_opus_pcm_cb_t pcm_cb, void *ctx);

// Stop decoding and wait for the task to finish.
void ogg_opus_stop(void);

// Pause decoding (blocks the decode task).
void ogg_opus_pause(void);

// Resume decoding after pause.
void ogg_opus_resume(void);