decoder/ogg_codec: return UNKNOWN on error

This commit is contained in:
Max Kellermann 2012-09-04 13:46:12 +02:00
parent ebf481e1a1
commit 7102ed8026
2 changed files with 2 additions and 1 deletions

View File

@ -33,7 +33,7 @@ ogg_codec_detect(struct decoder *decoder, struct input_stream *is)
unsigned char buf[41];
size_t r = decoder_read(decoder, is, buf, sizeof(buf));
if (r < sizeof(buf) || memcmp(buf, "OggS", 4) != 0)
return OGG_CODEC_VORBIS;
return OGG_CODEC_UNKNOWN;
if ((memcmp(buf + 29, "FLAC", 4) == 0 &&
memcmp(buf + 37, "fLaC", 4) == 0) ||

View File

@ -27,6 +27,7 @@
#include "decoder_api.h"
enum ogg_codec {
OGG_CODEC_UNKNOWN,
OGG_CODEC_VORBIS,
OGG_CODEC_FLAC,
};