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.
pull/388/head
Anton Khirnov 3 years ago
parent 7650d34367
commit a04d83181a
  1. 10
      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, static enum AVPixelFormat
const AVCodec *codec, enum AVPixelFormat target) choose_pixel_fmt(const AVCodec *codec, enum AVPixelFormat target,
int strict_std_compliance)
{ {
if (codec && codec->pix_fmts) { if (codec && codec->pix_fmts) {
const enum AVPixelFormat *p = 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; int has_alpha = desc ? desc->nb_components % 2 == 0 : 0;
enum AVPixelFormat best= AV_PIX_FMT_NONE; 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); p = get_compliance_normal_pix_fmts(codec, p);
} }
for (; *p != AV_PIX_FMT_NONE; 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); return av_get_pix_fmt_name(ost->enc_ctx->pix_fmt);
} }
if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) { 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) { } else if (ost->enc && ost->enc->pix_fmts) {
const enum AVPixelFormat *p; const enum AVPixelFormat *p;

Loading…
Cancel
Save