Most instances ff_add_formats() actually only ever add one format; this function can be used to simplify those callers.
Showing the changes to libavfilter (2 of 2 files). Show all
Unified · Split
| @@ -431,6 +431,12 @@ int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout) · 430 unmodified lines | ||
| 431 | 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 | 440 | AVFilterFormats *ff_all_formats(enum AVMediaType type) |
| 435 | 441 | { |
| 436 | 442 | AVFilterFormats *ret = NULL; |
| @@ -208,6 +208,12 @@ int ff_default_query_formats(AVFilterContext *ctx); · 207 unmodified lines | ||
| 208 | 208 | av_warn_unused_result |
| 209 | 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 | 218 | * Add fmt to the list of media formats contained in *avff. |
| 213 | 219 | * If *avff is NULL the function allocates the filter formats struct |