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
@@ -97,6 +97,19 @@ VorbisDecoder::~VorbisDecoder()
ov_clear(&handle);
}
int VorbisDecoder::probe(Stream *stream)
{
char header[4];
if (stream->read(header, 4) >= 4)
{
if (memcmp(header, "OggS", 4) == 0)
return 60;
}
return 1;
}
love::sound::Decoder *VorbisDecoder::clone()
{
StrongRef<Stream> s(stream->clone(), Acquire::NORETAIN);