1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

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.
This commit is contained in:
Anton Khirnov 2022-06-19 14:26:47 +02:00
parent 7650d34367
commit a04d83181a

View File

@ -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;