]> git.sesse.net Git - ffmpeg/commitdiff
caf: add an Opus tag
authorAnton Khirnov <anton@khirnov.net>
Sat, 1 Jul 2017 08:49:58 +0000 (10:49 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sat, 22 Jul 2017 07:30:56 +0000 (09:30 +0200)
CC: libav-stable@libav.org
libavformat/caf.c
libavformat/cafdec.c

index cf128d56242e1c4585a705afe887e4afc53ee67c..c299cad01ba896be076e5b18369324fe1b31f3f1 100644 (file)
@@ -49,6 +49,7 @@ const AVCodecTag ff_codec_caf_tags[] = {
     { AV_CODEC_ID_QCELP,           MKBETAG('Q','c','l','p') },
     { AV_CODEC_ID_QDM2,            MKBETAG('Q','D','M','2') },
     { AV_CODEC_ID_QDM2,            MKBETAG('Q','D','M','C') },
+    { AV_CODEC_ID_OPUS,            MKBETAG('o','p','u','s') },
   /* currently unsupported codecs */
   /*{ AC-3 over S/PDIF          MKBETAG('c','a','c','3') },*/
   /*{ MPEG4CELP                 MKBETAG('c','e','l','p') },*/
index efc8c49c4a877fa126844ae7d08b6f57e0918357..d6b6007a1dcda6c0270f1071e9c539c0551a304a 100644 (file)
@@ -156,6 +156,14 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
             avio_skip(pb, size - ALAC_NEW_KUKI);
         }
         st->codecpar->extradata_size = ALAC_HEADER;
+    } else if (st->codecpar->codec_id == AV_CODEC_ID_OPUS) {
+        // The data layout for Opus is currently unknown, so we do not export
+        // extradata at all. Multichannel streams are not supported.
+        if (st->codecpar->channels > 2) {
+            avpriv_request_sample(s, "multichannel Opus in CAF");
+            return AVERROR_PATCHWELCOME;
+        }
+        avio_skip(pb, size);
     } else {
         st->codecpar->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
         if (!st->codecpar->extradata)