[flac-dev] C API: How to get a seektable for very long files?

Martijn van Beurden mvanb1 at gmail.com
Wed Oct 16 17:46:37 UTC 2024


Op wo 16 okt 2024 om 16:25 schreef Stefan Oltmanns <stefan-oltmanns at gmx.net>:
>
> Yes, overwriting the streaminfo total_samples number is a bit of a hack,
> but it would only affect those files with more than 2^36 samples that
> contains the special seek point, so no difference for the average flac user.
>
> Not sure how the applications actually read flac files, if they start
> using the total_samples number before the seektable is parsed or if
> libflac can indicate that the streaminfo is not yet complete.
>

libFLAC reads a file from start to back, and returns data to the
client as soon as it is done parsing. So, it first encounters a
streaminfo metadata block, sends that to the application, then starts
on the seektable etc. In fact, for a lot of applications, the seek
table is simply ignored because libFLAC uses it internally.

I don't know how libFLAC should indicate that streaminfo isn't
complete yet, but I'd say getting applications to understand that is
more work than them just supporting a new function that returns the
total number of samples.

>
> The main reason is not listening to those files (but that's not only for
> debugging, but very helpful just to quick check if there is a signal or
> just silence/noise), but that you can use audio tools for inspecting
> (waveform or spectrum/fft), cutting, low/high/band pass etc.
>

Fair enough.


More information about the flac-dev mailing list