[FFmpeg-devel] [PATCH] lavfi: issue error if maximum number of filters is reached
Stefano Sabatini
stefasab at gmail.com
Wed Nov 2 22:11:31 CET 2011
Issue an error and return a more meaningful error code in case the
maximum number of registered filters has been reached.
This is better than silently ignore the error, improve feedback.
---
libavfilter/avfilter.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 63085dc..6fa2465 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -706,8 +706,13 @@ AVFilter *avfilter_get_by_name(const char *name)
int avfilter_register(AVFilter *filter)
{
- if (next_registered_avfilter_idx == MAX_REGISTERED_AVFILTERS_NB)
- return -1;
+ if (next_registered_avfilter_idx == MAX_REGISTERED_AVFILTERS_NB) {
+ av_log(NULL, AV_LOG_ERROR,
+ "Maximum number of registered filters %d reached, "
+ "impossible to register filter with name '%s'\n",
+ MAX_REGISTERED_AVFILTERS_NB, filter->name);
+ return AVERROR(ENOMEM);
+ }
registered_avfilters[next_registered_avfilter_idx++] = filter;
return 0;
--
1.7.4.1
More information about the ffmpeg-devel
mailing list