Skip to content
Snippets Groups Projects
Commit c9584f0c authored by Clément Bœsch's avatar Clément Bœsch Committed by Clément Bœsch
Browse files

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.
parent f4228097
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
//FIXME maybe link the orig in //FIXME maybe link the orig in
//XXX: identical pix_fmt must be following with each others
static const struct { static const struct {
int fmt; int fmt;
enum PixelFormat pix_fmt; enum PixelFormat pix_fmt;
...@@ -785,13 +786,17 @@ static int query_formats(AVFilterContext *ctx) ...@@ -785,13 +786,17 @@ static int query_formats(AVFilterContext *ctx)
{ {
AVFilterFormats *avfmts=NULL; AVFilterFormats *avfmts=NULL;
MPContext *m = ctx->priv; MPContext *m = ctx->priv;
enum PixelFormat lastpixfmt = PIX_FMT_NONE;
int i; int i;
for(i=0; conversion_map[i].fmt; i++){ for(i=0; conversion_map[i].fmt; i++){
av_log(ctx, AV_LOG_DEBUG, "query: %X\n", conversion_map[i].fmt); av_log(ctx, AV_LOG_DEBUG, "query: %X\n", conversion_map[i].fmt);
if(m->vf.query_format(&m->vf, conversion_map[i].fmt)){ if(m->vf.query_format(&m->vf, conversion_map[i].fmt)){
av_log(ctx, AV_LOG_DEBUG, "supported,adding\n"); 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;
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment