Most instances ff_add_formats() actually only ever add one format; this function can be used to simplify those callers.
Unified · Split
| @@ -431,6 +431,12 @@ int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout) · 430 unmodified lines | |||
| 431 | return 0; | 431 | return 0; |
| 432 | } | 432 | } |
| 433 | 433 | ||
| 434 | AVFilterFormats *ff_make_formats_list_singleton(int fmt) | ||
| 435 | { | ||
| 436 | int fmts[2] = { fmt, -1 }; | ||
| 437 | return ff_make_format_list(fmts); | ||
| 438 | } | ||
| 439 | |||
| 434 | AVFilterFormats *ff_all_formats(enum AVMediaType type) | 440 | AVFilterFormats *ff_all_formats(enum AVMediaType type) |
| 435 | { | 441 | { |
| 436 | AVFilterFormats *ret = NULL; | 442 | AVFilterFormats *ret = NULL; |
| @@ -208,6 +208,12 @@ int ff_default_query_formats(AVFilterContext *ctx); · 207 unmodified lines | |||
| 208 | av_warn_unused_result | 208 | av_warn_unused_result |
| 209 | AVFilterFormats *ff_make_format_list(const int *fmts); | 209 | AVFilterFormats *ff_make_format_list(const int *fmts); |
| 210 | 210 | ||
| 211 | /** | ||
| 212 | * Equivalent to ff_make_format_list({const int[]}{ fmt, -1 }) | ||
| 213 | */ | ||
| 214 | av_warn_unused_result | ||
| 215 | AVFilterFormats *ff_make_formats_list_singleton(int fmt); | ||
| 216 | |||
| 211 | /** | 217 | /** |
| 212 | * Add fmt to the list of media formats contained in *avff. | 218 | * Add fmt to the list of media formats contained in *avff. |
| 213 | * If *avff is NULL the function allocates the filter formats struct | 219 | * If *avff is NULL the function allocates the filter formats struct |