You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When implementing a custom decoder backend (e.g., using FFmpeg or other I/O systems), the current ma_decoder_init() function forces onTell to be NULL. This prevents custom backends from using the onTell callback to retrieve critical information like the actual file size, which is necessary to calculate total frames or duration.
Use Case
For example, in an FFmpeg-based backend:
The onTell callback is needed to determine the file size via avio_size().
Without knowing the file size, the decoder cannot accurately calculate PCM frame counts or durations.
This limitation forces developers to use workarounds (e.g., pre-reading the entire file), which is inefficient.
It's funny you mention this because coincidentally I've been doing a maintenance pass on dr_mp3 which is what provides MP3 support for miniaudio, and it was just the other day I needed to add an onTell callback to it. I'm going to need to add support for it to miniaudio anyway for dr_mp3, so this is definitely on the table. Not sure exactly in what form it'll take just yet. I might just add a separate function like you suggested for the 0.11.x cycle, but just break the API in the dev-0.12 branch. Will report back on what I decide.
Problem Description
When implementing a custom decoder backend (e.g., using FFmpeg or other I/O systems), the current ma_decoder_init() function forces onTell to be NULL. This prevents custom backends from using the onTell callback to retrieve critical information like the actual file size, which is necessary to calculate total frames or duration.
Use Case
For example, in an FFmpeg-based backend:
Proposed Solution
Add a new initialization function:
This function would allow passing a custom onTell callback, mirroring the flexibility of onRead and onSeek.
Impact
The text was updated successfully, but these errors were encountered: