--- On Tue, 10/6/09, Shayne Wissler <wissler at gmail.com>
wrote:> Hello,
>
> 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?
hmm, you should be getting a call to your error callback with
FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC on the first sync error.
then right away you can abort.