History

avfilter/formats: Add function to create AVFilterFormats with one entry

Most instances ff_add_formats() actually only ever add one format; this function can be used to simplify those callers.

Andreas Rheinhardt committed 5 years ago

Commit aa636091 parent 628b30e2 files · +12 −0Browse files

Showing the changes to libavfilter (2 of 2 files). Show all

Unified · Split

2 files
  1. libavfilter/formats.c +6 −0
  2. libavfilter/formats.h +6 −0
libavfilter/formats.c+6−0
@@ -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
434AVFilterFormats *ff_make_formats_list_singleton(int fmt)
435{
436 int fmts[2] = { fmt, -1 };
437 return ff_make_format_list(fmts);
438}
439
434AVFilterFormats *ff_all_formats(enum AVMediaType type)440AVFilterFormats *ff_all_formats(enum AVMediaType type)
435{441{
436 AVFilterFormats *ret = NULL;442 AVFilterFormats *ret = NULL;
libavfilter/formats.h+6−0
@@ -208,6 +208,12 @@ int ff_default_query_formats(AVFilterContext *ctx); · 207 unmodified lines
208av_warn_unused_result208av_warn_unused_result
209AVFilterFormats *ff_make_format_list(const int *fmts);209AVFilterFormats *ff_make_format_list(const int *fmts);
210 210
211/**
212 * Equivalent to ff_make_format_list({const int[]}{ fmt, -1 })
213 */
214av_warn_unused_result
215AVFilterFormats *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 struct219 * If *avff is NULL the function allocates the filter formats struct

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t