[FFmpeg-devel] [PATCH] vf_mp: do not add duplicated pixel formats
Clément Bœsch
ubitux at gmail.com
Wed Jun 22 10:43:17 CEST 2011
Attached patch fix a crash with:
ffmpeg -i input -vf mp=framestep=120 -y output
Regards,
--
Clément B.
-------------- next part --------------
From 4b0e6b576a9c33a8675817c1b611eaa7d2c03581 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <clement.boesch at smartjog.com>
Date: Wed, 22 Jun 2011 10:33:01 +0200
Subject: [PATCH] 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.
---
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 36616b9..9e413b4 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;
+ }
}
}
--
1.7.5.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110622/0f8ed36d/attachment.asc>
More information about the ffmpeg-devel
mailing list