In this case it also allows to avoid a runtime check to which filter an AVFilterContext belongs to.
Unified · Split
| @@ -301,9 +301,7 @@ static av_cold int config_output(AVFilterLink *outlink) · 300 unmodified lines | ||
| 301 | 301 | return 0; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | −static av_cold int query_formats(AVFilterContext *avctx) | |
| 305 | −{ | |
| 306 | − static const enum AVPixelFormat pixel_fmts[] = { | |
| 304 | +static const enum AVPixelFormat chromakey_fmts[] = { | |
| 307 | 305 | AV_PIX_FMT_YUVA420P, |
| 308 | 306 | AV_PIX_FMT_YUVA422P, |
| 309 | 307 | AV_PIX_FMT_YUVA444P, |
| @@ -332,12 +330,6 @@ static av_cold int query_formats(AVFilterContext *avctx) · 22 unmodified lines | ||
| 332 | 330 | AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, |
| 333 | 331 | AV_PIX_FMT_NONE |
| 334 | 332 | }; |
| 335 | − const enum AVPixelFormat *pix_fmts; | |
| 336 | − | |
| 337 | − pix_fmts = !strcmp(avctx->filter->name, "chromahold") ? hold_pixel_fmts : pixel_fmts; | |
| 338 | − | |
| 339 | − return ff_set_common_formats_from_list(avctx, pix_fmts); | |
| 340 | −} | |
| 341 | 333 | |
| 342 | 334 | static av_cold int config_input(AVFilterLink *inlink) |
| 343 | 335 | { |
| @@ -401,7 +393,7 @@ const AVFilter ff_vf_chromakey = { · 57 unmodified lines | ||
| 401 | 393 | .priv_class = &chromakey_class, |
| 402 | 394 | FILTER_INPUTS(chromakey_inputs), |
| 403 | 395 | FILTER_OUTPUTS(chromakey_outputs), |
| 404 | − FILTER_QUERY_FUNC(query_formats), | |
| 396 | + FILTER_PIXFMTS_ARRAY(chromakey_fmts), | |
| 405 | 397 | .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, |
| 406 | 398 | .process_command = process_command, |
| 407 | 399 | }; |
| @@ -441,7 +433,7 @@ const AVFilter ff_vf_chromahold = { · 33 unmodified lines | ||
| 441 | 433 | .priv_class = &chromahold_class, |
| 442 | 434 | FILTER_INPUTS(chromahold_inputs), |
| 443 | 435 | FILTER_OUTPUTS(chromahold_outputs), |
| 444 | − FILTER_QUERY_FUNC(query_formats), | |
| 436 | + FILTER_PIXFMTS_ARRAY(hold_pixel_fmts), | |
| 445 | 437 | .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, |
| 446 | 438 | .process_command = process_command, |
| 447 | 439 | }; |