mirror of https://git.ffmpeg.org/ffmpeg.git
vf_scale: use the pixfmt descriptor API
Avoid using AV_PIX_FMT_NB, since that hardcodes the number of pixel formats into lavfi and will break when a shared lavu is updated, adding new pixel formats.
This commit is contained in:
parent
45fc73edfe
commit
862f33c10e
|
@ -120,25 +120,31 @@ static int query_formats(AVFilterContext *ctx)
|
|||
int ret;
|
||||
|
||||
if (ctx->inputs[0]) {
|
||||
const AVPixFmtDescriptor *desc = NULL;
|
||||
formats = NULL;
|
||||
for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
|
||||
while ((desc = av_pix_fmt_desc_next(desc))) {
|
||||
pix_fmt = av_pix_fmt_desc_get_id(desc);
|
||||
if ((sws_isSupportedInput(pix_fmt) ||
|
||||
sws_isSupportedEndiannessConversion(pix_fmt))
|
||||
&& (ret = ff_add_format(&formats, pix_fmt)) < 0) {
|
||||
ff_formats_unref(&formats);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
ff_formats_ref(formats, &ctx->inputs[0]->out_formats);
|
||||
}
|
||||
if (ctx->outputs[0]) {
|
||||
const AVPixFmtDescriptor *desc = NULL;
|
||||
formats = NULL;
|
||||
for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
|
||||
while ((desc = av_pix_fmt_desc_next(desc))) {
|
||||
pix_fmt = av_pix_fmt_desc_get_id(desc);
|
||||
if ((sws_isSupportedOutput(pix_fmt) ||
|
||||
sws_isSupportedEndiannessConversion(pix_fmt))
|
||||
&& (ret = ff_add_format(&formats, pix_fmt)) < 0) {
|
||||
ff_formats_unref(&formats);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
ff_formats_ref(formats, &ctx->outputs[0]->in_formats);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue