summaryrefslogtreecommitdiff
path: root/libavfilter/formats.h
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2020-08-13 13:18:15 +0200
committerNicolas George <george@nsup.org>2020-09-08 14:10:31 +0200
commit69f5f6ea375950b4845b241ee27054bfc8f00343 (patch)
tree703d6382d4b1c297ffa885cca861e4351891ddba /libavfilter/formats.h
parent6479f40afa3c706ada2e2c0b05de473285d6a926 (diff)
lavfi: check the validity of formats lists.
Part of the code expects valid lists, in particular no duplicates. These tests allow to catch bugs in filters (unlikely but possible) and to give a clear message when the error comes from the user ((a)formats) or the application (buffersink). If we decide to switch to a more efficient merging algorithm, possibly sorting the lists, these functions will be the preferred place for pre-processing, and can be renamed accordingly.
Diffstat (limited to 'libavfilter/formats.h')
-rw-r--r--libavfilter/formats.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/libavfilter/formats.h b/libavfilter/formats.h
index a06e88722e..8378be4b9b 100644
--- a/libavfilter/formats.h
+++ b/libavfilter/formats.h
@@ -291,4 +291,32 @@ void ff_formats_unref(AVFilterFormats **ref);
*/
void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref);
+/**
+ * Check that fmts is a valid pixel formats list.
+ *
+ * In particular, check for duplicates.
+ */
+int ff_formats_check_pixel_formats(void *log, const AVFilterFormats *fmts);
+
+/**
+ * Check that fmts is a valid sample formats list.
+ *
+ * In particular, check for duplicates.
+ */
+int ff_formats_check_sample_formats(void *log, const AVFilterFormats *fmts);
+
+/**
+ * Check that fmts is a valid sample rates list.
+ *
+ * In particular, check for duplicates.
+ */
+int ff_formats_check_sample_rates(void *log, const AVFilterFormats *fmts);
+
+/**
+ * Check that fmts is a valid channel layouts list.
+ *
+ * In particular, check for duplicates.
+ */
+int ff_formats_check_channel_layouts(void *log, const AVFilterChannelLayouts *fmts);
+
#endif /* AVFILTER_FORMATS_H */