[FFmpeg-cvslog] Support new ALAC magic cookie in caf files.

Carl Eugen Hoyos git at videolan.org
Thu Nov 3 14:43:49 CET 2011


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Thu Nov  3 14:27:54 2011 +0100| [80af00b4b23a38dd8c63b892cd103af0d9407452] | committer: Carl Eugen Hoyos

Support new ALAC magic cookie in caf files.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=80af00b4b23a38dd8c63b892cd103af0d9407452
---

 libavformat/cafdec.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 2b747ce..4078f11 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -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)



More information about the ffmpeg-cvslog mailing list