[Flac-dev] Detecting FLAC file type

Shayne Wissler wissler at gmail.com
Tue Oct 6 11:29:55 PDT 2009


I have a program that is given a random file and needs to determine
whether it is Vorbis or FLAC. For Vorbis, there are various places
where I can infer that I have a bad stream. But for FLAC, when I call
either FLAC__stream_decoder_process_until_end_of_metadata or
FLAC__stream_decoder_process_single, it searches the entire file
before giving up. I'd like it to stop searching as soon as it loses
sync, or find some better way to detect the file type without scanning
the whole file. Any tips on the best way to do that?

 Shayne Wissler

More information about the Flac-dev mailing list