Do not attempt to pass files that don't look like audio to BASS

This commit is contained in:
Bartłomiej Dach 2024-04-22 10:45:09 +02:00
parent b28bf4d2ec
commit 70a5288a68
No known key found for this signature in database
1 changed files with 4 additions and 2 deletions

View File

@ -37,14 +37,16 @@ public IEnumerable<Issue> Run(BeatmapVerifierContext context)
if (data == null)
continue;
if (!AudioCheckUtils.HasAudioExtension(file.Filename) || !probablyHasAudioData(data))
continue;
var fileCallbacks = new FileCallbacks(new DataStreamFileProcedures(data));
int decodeStream = Bass.CreateStream(StreamSystem.NoBuffer, BassFlags.Decode, fileCallbacks.Callbacks, fileCallbacks.Handle);
// If the format is not supported by BASS
if (decodeStream == 0)
{
if (AudioCheckUtils.HasAudioExtension(file.Filename) && probablyHasAudioData(data))
yield return new IssueTemplateFormatUnsupported(this).Create(file.Filename);
yield return new IssueTemplateFormatUnsupported(this).Create(file.Filename);
continue;
}