diff options
author | Clément Bœsch <clement.boesch@smartjog.com> | 2011-06-22 12:33:01 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-06-23 00:55:39 +0400 |
commit | 07f5da61289cd1bfb552ea276368b4cc7a2f010a (patch) | |
tree | 99ce060e2e6b61b69bf45fc1c9d4ca940e2548b2 /libavfilter/vf_mp.c | |
parent | e845455225110f679127f6a6aa0cac1862789197 (diff) |
vf_mp: do not add duplicated pixel formats.
This avoid a crash with in avfilter_merge_formats() in case one of the
filter formats list has multiple time the same entry.
Thanks to Mina Nagy Zaki for helping figuring out the issue.
(cherry picked from commit 680e47364386038c5039345ef2d9fe6947191a12)
Diffstat (limited to 'libavfilter/vf_mp.c')
-rw-r--r-- | libavfilter/vf_mp.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavfilter/vf_mp.c b/libavfilter/vf_mp.c index 36616b9c94..9e413b4776 100644 --- a/libavfilter/vf_mp.c +++ b/libavfilter/vf_mp.c @@ -41,6 +41,7 @@ //FIXME maybe link the orig in +//XXX: identical pix_fmt must be following with each others static const struct { int fmt; enum PixelFormat pix_fmt; @@ -785,13 +786,17 @@ static int query_formats(AVFilterContext *ctx) { AVFilterFormats *avfmts=NULL; MPContext *m = ctx->priv; + enum PixelFormat lastpixfmt = PIX_FMT_NONE; int i; for(i=0; conversion_map[i].fmt; i++){ av_log(ctx, AV_LOG_DEBUG, "query: %X\n", conversion_map[i].fmt); if(m->vf.query_format(&m->vf, conversion_map[i].fmt)){ av_log(ctx, AV_LOG_DEBUG, "supported,adding\n"); - avfilter_add_format(&avfmts, conversion_map[i].pix_fmt); + if (conversion_map[i].pix_fmt != lastpixfmt) { + avfilter_add_format(&avfmts, conversion_map[i].pix_fmt); + lastpixfmt = conversion_map[i].pix_fmt; + } } } |