]> git.sesse.net Git - ffmpeg/commitdiff
avformat/av1: add support for passing through MP4/Matroska av1c
authorJan Ekström <jeebjp@gmail.com>
Mon, 23 Nov 2020 16:00:44 +0000 (18:00 +0200)
committerJan Ekström <jeebjp@gmail.com>
Tue, 24 Nov 2020 08:13:55 +0000 (10:13 +0200)
libavformat/av1.c

index 0cbffb1fd8bea5c1a1a5efebe8dada34ae9b8647..5512c4e0f7748a53b9957ca435879a26966bf995 100644 (file)
@@ -375,6 +375,20 @@ int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size)
     if (size <= 0)
         return AVERROR_INVALIDDATA;
 
+    if (buf[0] & 0x80) {
+        // first bit is nonzero, the passed data does not consist purely of
+        // OBUs. Expect that the data is already in AV1CodecConfigurationRecord
+        // format.
+        int config_record_version = buf[0] & 0x7f;
+        if (config_record_version != 1 || size < 4) {
+            return AVERROR_INVALIDDATA;
+        }
+
+        avio_write(pb, buf, size);
+
+        return 0;
+    }
+
     ret = avio_open_dyn_buf(&meta_pb);
     if (ret < 0)
         return ret;