[FFmpeg-devel] [PATCH] alac: allow extra data without the ATOM header

Steve Lhomme robux4 at gmail.com
Fri Feb 12 17:05:00 CET 2016


From: Steve Lhomme <robux4 at gmail.com>

--
can be found in such sample http://streams.videolan.org/issues/16620/VLCSupportsample.mkv
---
 libavcodec/alac.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index fc8bc96..9c9df8f 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -60,6 +60,7 @@
 #include "alacdsp.h"
 
 #define ALAC_EXTRADATA_SIZE 36
+#define ALAC_EXTRADATA_SIZE_NO_ATOM 24
 
 typedef struct ALACContext {
     AVClass *class;
@@ -513,7 +514,8 @@ static int alac_set_info(ALACContext *alac)
     bytestream2_init(&gb, alac->avctx->extradata,
                      alac->avctx->extradata_size);
 
-    bytestream2_skipu(&gb, 12); // size:4, alac:4, version:4
+    if (alac->avctx->extradata_size != ALAC_EXTRADATA_SIZE_NO_ATOM)
+        bytestream2_skipu(&gb, 12); // size:4, alac:4, version:4
 
     alac->max_samples_per_frame = bytestream2_get_be32u(&gb);
     if (!alac->max_samples_per_frame ||
@@ -544,7 +546,8 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
     alac->avctx = avctx;
 
     /* initialize from the extradata */
-    if (alac->avctx->extradata_size < ALAC_EXTRADATA_SIZE) {
+    if (alac->avctx->extradata_size < ALAC_EXTRADATA_SIZE ||
+        alac->avctx->extradata_size != ALAC_EXTRADATA_SIZE_NO_ATOM) {
         av_log(avctx, AV_LOG_ERROR, "extradata is too small\n");
         return AVERROR_INVALIDDATA;
     }
-- 
2.7.0.windows.1



More information about the ffmpeg-devel mailing list