ffmpeg | branch: master | Anton Khirnov <an...@khirnov.net> | Sun Jun 19 
14:26:47 2022 +0200| [a04d83181acf67c408f93092da27278be1d2c4a3] | committer: 
Anton Khirnov

fftools/ffmpeg_filter: do not pass the entire AVCodecContext to 
choose_pixel_fmt()

It only uses strict_std_compliance, so pass just that value. Makes it
more clear what fields are accessed.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a04d83181acf67c408f93092da27278be1d2c4a3
---

 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;
 

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

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

Reply via email to