mackron / dr_libs

Audio decoding libraries for C/C++, each in a single source file.
Other
1.24k stars 205 forks source link

No drmp3_init_* like functions for flac? #148

Closed Show-vars closed 4 years ago

Show-vars commented 4 years ago

It would be great if all awesome dr decoder libs has identical API for init, open, read and close operations. Why we can't initialize the flac from static memory without using malloc? Are there any technical limitations in this regard?

mackron commented 4 years ago

A block of memory needs to be available to store an entire FLAC frame, but a single FLAC frame can potentially be up to 2MB in size which is obviously too much to store statically in the structure. No memory allocations in any of the read functions are allowed, so that memory needs to be allocated up front at initialization time.

I have plans in place to make all dr_* libraries consistent in terms of API, but that heap allocation for FLAC will still be happening internally.

Show-vars commented 4 years ago

This is actually good news. Thank you so much!