Implement audio probing to reduce audio false positive.

This commit is contained in:
Miku AuahDark
2022-05-01 17:01:50 +08:00
parent ee336e5393
commit 5f386cfa87
15 changed files with 185 additions and 3 deletions
@@ -95,6 +95,19 @@ ModPlugDecoder::~ModPlugDecoder()
ModPlug_Unload(plug);
}
int ModPlugDecoder::probe(Stream* stream)
{
// Ideally we want to probe every single format that ModPlug supports.
Data *data = stream->read(1024 * 1024 * 4);
ModPlugFile *plug = ModPlug_Load(data->getData(), (int)data->getSize());
if (plug)
ModPlug_Unload(plug);
data->release();
return plug ? 80 : 0;
}
love::sound::Decoder *ModPlugDecoder::clone()
{
StrongRef<Stream> s(stream->clone(), Acquire::NORETAIN);