[FFmpeg-devel] [PATCH 05/27] fftools/ffmpeg_filter: do not pass the entire AVCodecContext to choose_pixel_fmt()
Anton Khirnov
anton at khirnov.net
Sat Jul 23 17:09:30 EEST 2022
It only uses strict_std_compliance, so pass just that value. Makes it
more clear what fields are accessed.
---
fftools/ffmpeg_filter.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index f16f4b13b1..f715ecb6b6 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -52,8 +52,9 @@ static const enum AVPixelFormat *get_compliance_normal_pix_fmts(const AVCodec *c
}
}
-static enum AVPixelFormat choose_pixel_fmt(AVCodecContext *enc_ctx,
- const AVCodec *codec, enum AVPixelFormat target)
+static enum AVPixelFormat
+choose_pixel_fmt(const AVCodec *codec, enum AVPixelFormat target,
+ int strict_std_compliance)
{
if (codec && codec->pix_fmts) {
const enum AVPixelFormat *p = codec->pix_fmts;
@@ -62,7 +63,7 @@ static enum AVPixelFormat choose_pixel_fmt(AVCodecContext *enc_ctx,
int has_alpha = desc ? desc->nb_components % 2 == 0 : 0;
enum AVPixelFormat best= AV_PIX_FMT_NONE;
- if (enc_ctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
+ if (strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
p = get_compliance_normal_pix_fmts(codec, p);
}
for (; *p != AV_PIX_FMT_NONE; p++) {
@@ -102,7 +103,8 @@ static const char *choose_pix_fmts(OutputFilter *ofilter, AVBPrint *bprint)
return av_get_pix_fmt_name(ost->enc_ctx->pix_fmt);
}
if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
- return av_get_pix_fmt_name(choose_pixel_fmt(ost->enc_ctx, ost->enc, ost->enc_ctx->pix_fmt));
+ return av_get_pix_fmt_name(choose_pixel_fmt(ost->enc, ost->enc_ctx->pix_fmt,
+ ost->enc_ctx->strict_std_compliance));
} else if (ost->enc && ost->enc->pix_fmts) {
const enum AVPixelFormat *p;
--
2.34.1
More information about the ffmpeg-devel
mailing list