Mulberry/Native/ffdecode.h
2026-10-27 20:22:19 -05:00

15 lines
586 B
C

// Minimal FFmpeg audio decoder for Mulberry: any input -> 48 kHz stereo float (planar).
#pragma once
#include <stdint.h>
typedef struct ff_dec ff_dec;
/// Opens a file; returns NULL if FFmpeg can't decode it.
ff_dec *ff_open(const char *path);
/// Total length in 48 kHz frames (0 when unknown).
int64_t ff_frames(ff_dec *d);
/// Reads up to `max` frames into left/right; returns frames written, 0 at end, <0 on error.
int ff_read(ff_dec *d, float *left, float *right, int max);
/// Seeks to a 48 kHz frame position.
void ff_seek(ff_dec *d, int64_t frame);
void ff_close(ff_dec *d);