Support new ALAC magic cookie in caf files.
This commit is contained in:
parent
988f585fcb
commit
80af00b4b2
@ -120,6 +120,15 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
|
||||
} else if (st->codec->codec_id == CODEC_ID_ALAC) {
|
||||
#define ALAC_PREAMBLE 12
|
||||
#define ALAC_HEADER 36
|
||||
#define ALAC_NEW_KUKI 24
|
||||
if (size == ALAC_NEW_KUKI) {
|
||||
st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!st->codec->extradata)
|
||||
return AVERROR(ENOMEM);
|
||||
strcpy(st->codec->extradata, "\0\0\0\24alac");
|
||||
avio_read(pb, st->codec->extradata + ALAC_HEADER - ALAC_NEW_KUKI, ALAC_NEW_KUKI);
|
||||
st->codec->extradata_size = ALAC_HEADER;
|
||||
} else {
|
||||
if (size < ALAC_PREAMBLE + ALAC_HEADER) {
|
||||
av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n");
|
||||
avio_skip(pb, size);
|
||||
@ -132,6 +141,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
|
||||
avio_read(pb, st->codec->extradata, ALAC_HEADER);
|
||||
st->codec->extradata_size = ALAC_HEADER;
|
||||
avio_skip(pb, size - ALAC_PREAMBLE - ALAC_HEADER);
|
||||
}
|
||||
} else {
|
||||
st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!st->codec->extradata)
|
||||
|
Loading…
x
Reference in New Issue
Block a user