diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-08-15 07:32:05 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-08-20 13:19:59 +0200 |
commit | 7c5f998196d101a661d802aa48dd62dd93d1fb3d (patch) | |
tree | 21ce867a770061faab5cfb9ea82321611e813676 | |
parent | 8be701d9f7f77ff2282cc7fe6e0791ca5419de70 (diff) | |
download | ffmpeg-7c5f998196d101a661d802aa48dd62dd93d1fb3d.tar.gz |
avfilter/avfilter: Add avfilter_filter_pad_count()
It is intended as replacement for avfilter_pad_count(). In contrast to
the latter, it avoids a loop.
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | doc/APIchanges | 3 | ||||
-rw-r--r-- | libavfilter/avfilter.c | 5 | ||||
-rw-r--r-- | libavfilter/avfilter.h | 5 | ||||
-rw-r--r-- | libavfilter/version.h | 2 |
4 files changed, 14 insertions, 1 deletions
diff --git a/doc/APIchanges b/doc/APIchanges index 393ae68fa7..72c5fae125 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-08-20 - xxxxxxxxxx - lavfi 8.3.100 - avfilter.H + Add avfilter_filter_pad_count() as a replacement for avfilter_pad_count(). + 2021-08-17 - xxxxxxxxxx - lavu 57.4.101 - opt.h av_opt_copy() now guarantees that allocated src and dst options don't alias each other even on error. diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index a869a76b71..b5f5616fde 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -556,6 +556,11 @@ int avfilter_pad_count(const AVFilterPad *pads) av_assert0(!"AVFilterPad list not from a filter"); } +unsigned avfilter_filter_pad_count(const AVFilter *filter, int is_output) +{ + return is_output ? filter->nb_outputs : filter->nb_inputs; +} + static const char *default_filter_name(void *filter_ctx) { AVFilterContext *ctx = filter_ctx; diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 5025fafdc5..3a0f0b7926 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -326,6 +326,11 @@ typedef struct AVFilter { } AVFilter; /** + * Get the number of elements in an AVFilter's inputs or outputs array. + */ +unsigned avfilter_filter_pad_count(const AVFilter *filter, int is_output); + +/** * Process multiple parts of the frame concurrently. */ #define AVFILTER_THREAD_SLICE (1 << 0) diff --git a/libavfilter/version.h b/libavfilter/version.h index 67f2a5883c..cb4c19cf05 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,7 +30,7 @@ #include "libavutil/version.h" #define LIBAVFILTER_VERSION_MAJOR 8 -#define LIBAVFILTER_VERSION_MINOR 2 +#define LIBAVFILTER_VERSION_MINOR 3 #define LIBAVFILTER_VERSION_MICRO 100 |