diff mbox series

[FFmpeg-devel,05/27] fftools/ffmpeg_filter: do not pass the entire AVCodecContext to choose_pixel_fmt()

Message ID 20220723140952.31814-5-anton@khirnov.net
State Accepted
Commit a04d83181acf67c408f93092da27278be1d2c4a3
Headers show
Series [FFmpeg-devel,01/27] fftools/ffmpeg: replace AVFrame.pkt_duration with duration | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov July 23, 2022, 2:09 p.m. UTC
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 mbox series

Patch

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;