VGMStream: Add a bodge for PSF files

For some incredibly dumb reason, PSF files get into FFmpeg 5.0, then
just sit there and lock up, reading them forever and ever, doing nothing
useful. Add a bodge to detect PSF files by signature and ignore them in
the VGMStream container parser, and all other parts of VGMStream in Cog.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
CQTexperiment
Christopher Snowhill 2022-01-26 15:40:44 -08:00
parent 600c447531
commit ee7b7dad5f
1 changed files with 8 additions and 0 deletions

View File

@ -303,6 +303,14 @@ static STREAMFILE* open_cog_streamfile_buffer_from_url(NSURL* url, const char* c
if (![infile seekable])
return NULL;
// XXX Goddammit, FFmpeg
uint8_t sig[3];
if ([infile read:sig amount:3] == 3) {
[infile seek:0 whence:SEEK_SET];
if (memcmp(sig, "PSF", 3) == 0)
return NULL;
}
return open_cog_streamfile_buffer_by_file(infile, filename, bufsize);
}