]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/cllc.c
Implement shared parsing of INFO tag in Canopus family
[ffmpeg] / libavcodec / cllc.c
index f081c686125a03f4f61c87ce04382db98e9d5d22..578299fcae19dbcb34f57d7ab8a0654b576ad3b1 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "bswapdsp.h"
+#include "canopus.h"
 #include "get_bits.h"
 #include "avcodec.h"
 #include "internal.h"
@@ -362,7 +363,11 @@ static int cllc_decode_frame(AVCodecContext *avctx, void *data,
     GetBitContext gb;
     int coding_type, ret;
 
-    /* Skip the INFO header if present */
+    if (avpkt->size < 4 + 4) {
+        av_log(avctx, AV_LOG_ERROR, "Frame is too small %d.\n", avpkt->size);
+        return AVERROR_INVALIDDATA;
+    }
+
     info_offset = 0;
     info_tag    = AV_RL32(src);
     if (info_tag == MKTAG('I', 'N', 'F', 'O')) {
@@ -373,11 +378,10 @@ static int cllc_decode_frame(AVCodecContext *avctx, void *data,
                    info_offset);
             return AVERROR_INVALIDDATA;
         }
+        ff_canopus_parse_info_tag(avctx, src + 8, info_offset);
 
         info_offset += 8;
         src         += info_offset;
-
-        av_log(avctx, AV_LOG_DEBUG, "Skipping INFO chunk.\n");
     }
 
     data_size = (avpkt->size - info_offset) & ~1;