decoder/ogg_codec: return UNKNOWN on error
This commit is contained in:
parent
ebf481e1a1
commit
7102ed8026
@ -33,7 +33,7 @@ ogg_codec_detect(struct decoder *decoder, struct input_stream *is)
|
|||||||
unsigned char buf[41];
|
unsigned char buf[41];
|
||||||
size_t r = decoder_read(decoder, is, buf, sizeof(buf));
|
size_t r = decoder_read(decoder, is, buf, sizeof(buf));
|
||||||
if (r < sizeof(buf) || memcmp(buf, "OggS", 4) != 0)
|
if (r < sizeof(buf) || memcmp(buf, "OggS", 4) != 0)
|
||||||
return OGG_CODEC_VORBIS;
|
return OGG_CODEC_UNKNOWN;
|
||||||
|
|
||||||
if ((memcmp(buf + 29, "FLAC", 4) == 0 &&
|
if ((memcmp(buf + 29, "FLAC", 4) == 0 &&
|
||||||
memcmp(buf + 37, "fLaC", 4) == 0) ||
|
memcmp(buf + 37, "fLaC", 4) == 0) ||
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "decoder_api.h"
|
#include "decoder_api.h"
|
||||||
|
|
||||||
enum ogg_codec {
|
enum ogg_codec {
|
||||||
|
OGG_CODEC_UNKNOWN,
|
||||||
OGG_CODEC_VORBIS,
|
OGG_CODEC_VORBIS,
|
||||||
OGG_CODEC_FLAC,
|
OGG_CODEC_FLAC,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user