-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ffmpeg): revert broken commit from FFmpeg 7.1 (#365)
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
From 7d7c4fc8293044a582bed30d93370ae18ac64497 Mon Sep 17 00:00:00 2001 | ||
From: Cameron Gutman <[email protected]> | ||
Date: Fri, 11 Oct 2024 19:34:22 -0500 | ||
Subject: [PATCH] Revert "lavc: Check codec_whitelist early in avcodec_open2()" | ||
|
||
This caused a behavior change that broke setting codec-specific options | ||
that share names with AVCodecContext options. | ||
|
||
This reverts commit 7753a9d62725d5bd8313e2d249acbe1c8af79ab1. | ||
--- | ||
libavcodec/avcodec.c | 16 ++++++++-------- | ||
1 file changed, 8 insertions(+), 8 deletions(-) | ||
|
||
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c | ||
index d1daf47611..d9b0e1246f 100644 | ||
--- a/libavcodec/avcodec.c | ||
+++ b/libavcodec/avcodec.c | ||
@@ -175,14 +175,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code | ||
if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE) | ||
return AVERROR(EINVAL); | ||
|
||
- if ((ret = av_opt_set_dict(avctx, options)) < 0) | ||
- return ret; | ||
- | ||
- if (avctx->codec_whitelist && av_match_list(codec->name, avctx->codec_whitelist, ',') <= 0) { | ||
- av_log(avctx, AV_LOG_ERROR, "Codec (%s) not on whitelist \'%s\'\n", codec->name, avctx->codec_whitelist); | ||
- return AVERROR(EINVAL); | ||
- } | ||
- | ||
avci = av_codec_is_decoder(codec) ? | ||
ff_decode_internal_alloc() : | ||
ff_encode_internal_alloc(); | ||
@@ -216,6 +208,14 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code | ||
} else { | ||
avctx->priv_data = NULL; | ||
} | ||
+ if ((ret = av_opt_set_dict(avctx, options)) < 0) | ||
+ goto free_and_end; | ||
+ | ||
+ if (avctx->codec_whitelist && av_match_list(codec->name, avctx->codec_whitelist, ',') <= 0) { | ||
+ av_log(avctx, AV_LOG_ERROR, "Codec (%s) not on whitelist \'%s\'\n", codec->name, avctx->codec_whitelist); | ||
+ ret = AVERROR(EINVAL); | ||
+ goto free_and_end; | ||
+ } | ||
|
||
// only call ff_set_dimensions() for non H.264/VP6F/DXV codecs so as not to overwrite previously setup dimensions | ||
if (!(avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && | ||
-- | ||
2.43.0.windows.1 | ||
|