This allows the decoder context to be initialized with all stream parameters
before a packet is parsed.

Signed-off-by: James Almer <jamr...@gmail.com>
---
 libavcodec/libdav1d.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 1b9289824f..13673ae2dc 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -191,6 +191,17 @@ static av_cold int libdav1d_init(AVCodecContext *c)
     if (res < 0)
         return AVERROR(ENOMEM);
 
+    if (c->extradata && c->extradata_size) {
+        res = dav1d_parse_sequence_header(&seq, c->extradata, 
c->extradata_size);
+        if (res < 0)
+            return AVERROR_INVALIDDATA;
+
+        libdav1d_init_params(c, &seq);
+        res = ff_set_dimensions(c, seq.max_width, seq.max_height);
+        if (res < 0)
+            return res;
+    }
+
     return 0;
 }
 
-- 
2.27.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to