Commit 33626688c2 for ffmpeg
commit 33626688c2f5b645233775131d15c590ee38c968
Author: Romain Beauxis <romain.beauxis@gmail.com>
Date: Sat Oct 31 09:55:32 2026 -0500
avcodec/vp3: factor out setting Theora up from headers
Move parsing the Theora headers out of initialization, so that headers
arriving later can be parsed the same way.
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 0bf14d155e..71e28184d2 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -3053,7 +3053,9 @@ static int theora_decode_tables(AVCodecContext *avctx, GetBitContext *gb)
return 0;
}
-static av_cold int theora_decode_init(AVCodecContext *avctx)
+static av_cold int theora_init_from_headers(AVCodecContext *avctx,
+ const uint8_t *headers,
+ int headers_size)
{
Vp3DecodeContext *s = avctx->priv_data;
GetBitContext gb;
@@ -3066,12 +3068,12 @@ static av_cold int theora_decode_init(AVCodecContext *avctx)
s->theora = 1;
- if (!avctx->extradata_size) {
+ if (!headers_size) {
av_log(avctx, AV_LOG_ERROR, "Missing extradata!\n");
return -1;
}
- if (avpriv_split_xiph_headers(avctx->extradata, avctx->extradata_size,
+ if (avpriv_split_xiph_headers(headers, headers_size,
42, header_start, header_len) < 0) {
av_log(avctx, AV_LOG_ERROR, "Corrupt extradata\n");
return -1;
@@ -3123,6 +3125,12 @@ static av_cold int theora_decode_init(AVCodecContext *avctx)
return vp3_decode_init(avctx);
}
+static av_cold int theora_decode_init(AVCodecContext *avctx)
+{
+ return theora_init_from_headers(avctx, avctx->extradata,
+ avctx->extradata_size);
+}
+
const FFCodec ff_theora_decoder = {
.p.name = "theora",
CODEC_LONG_NAME("Theora"),