avfilter: handle error in query_formats() of a bunch of random video filters
This commit is contained in:
parent
545b0dd6aa
commit
fd682b1892
@ -416,11 +416,18 @@ static int query_formats(AVFilterContext *ctx)
|
||||
if (!select->do_scene_detect) {
|
||||
return ff_default_query_formats(ctx);
|
||||
} else {
|
||||
int ret;
|
||||
static const enum AVPixelFormat pix_fmts[] = {
|
||||
AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
ret = ff_set_common_formats(ctx, fmts_list);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -62,8 +62,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
// TODO: we can probably add way more pixel formats without any other
|
||||
// changes; anything with 8-bit luma in first plane should be working
|
||||
static const enum AVPixelFormat pix_fmts[] = {AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE};
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int clip_line(int *sx, int *sy, int *ex, int *ey, int maxx)
|
||||
|
@ -76,9 +76,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_RGB0, AV_PIX_FMT_BGR0,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_output(AVFilterLink *outlink)
|
||||
|
@ -353,10 +353,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_UYVY422,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int filter_frame(AVFilterLink *link, AVFrame *in)
|
||||
|
@ -464,8 +464,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_RGB0, AV_PIX_FMT_BGR0,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_input(AVFilterLink *inlink)
|
||||
|
@ -600,8 +600,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB24,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
typedef struct ThreadData {
|
||||
|
@ -350,8 +350,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_output(AVFilterLink *outlink)
|
||||
|
@ -177,9 +177,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_YUVA420P, AV_PIX_FMT_GRAY8,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static av_cold int init(AVFilterContext *ctx)
|
||||
|
@ -396,10 +396,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
|
||||
AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_props(AVFilterLink *link)
|
||||
|
@ -112,9 +112,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ440P,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_input(AVFilterLink *inlink)
|
||||
|
@ -78,17 +78,22 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
static int query_formats(AVFilterContext *ctx)
|
||||
{
|
||||
const EdgeDetectContext *edgedetect = ctx->priv;
|
||||
static const enum AVPixelFormat wires_pix_fmts[] = {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE};
|
||||
static const enum AVPixelFormat colormix_pix_fmts[] = {AV_PIX_FMT_GBRP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE};
|
||||
AVFilterFormats *fmts_list;
|
||||
const enum AVPixelFormat *pix_fmts = NULL;
|
||||
|
||||
if (edgedetect->mode == MODE_WIRES) {
|
||||
static const enum AVPixelFormat pix_fmts[] = {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE};
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
pix_fmts = wires_pix_fmts;
|
||||
} else if (edgedetect->mode == MODE_COLORMIX) {
|
||||
static const enum AVPixelFormat pix_fmts[] = {AV_PIX_FMT_GBRP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE};
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
pix_fmts = colormix_pix_fmts;
|
||||
} else {
|
||||
av_assert0(0);
|
||||
}
|
||||
return 0;
|
||||
fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_props(AVFilterLink *inlink)
|
||||
|
@ -80,10 +80,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
#define NB_COMPONENTS 3
|
||||
|
@ -233,10 +233,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_YUV444P,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pixel_fmts_eq));
|
||||
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_eq);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
|
@ -855,8 +855,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_input(AVFilterLink *inlink)
|
||||
|
@ -155,10 +155,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_GBRP,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_input(AVFilterLink *inlink)
|
||||
|
@ -99,9 +99,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_input(AVFilterLink *inlink)
|
||||
|
@ -253,10 +253,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_YUV444P16,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_input(AVFilterLink *inlink)
|
||||
|
@ -462,8 +462,10 @@ HQX_FUNC(4)
|
||||
static int query_formats(AVFilterContext *ctx)
|
||||
{
|
||||
static const enum AVPixelFormat pix_fmts[] = {AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE};
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_output(AVFilterLink *outlink)
|
||||
|
@ -233,10 +233,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_YUVA420P,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_props(AVFilterLink *inlink)
|
||||
|
@ -399,10 +399,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_YUVA420P,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_output(AVFilterLink *outlink)
|
||||
|
@ -107,9 +107,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static av_cold void uninit(AVFilterContext *ctx)
|
||||
|
@ -63,9 +63,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
static const enum AVPixelFormat pix_fmts[] = {
|
||||
AV_PIX_FMT_BGR24, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
typedef struct OCVContext {
|
||||
|
@ -130,9 +130,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
const enum AVPixelFormat *pix_fmts = s->is_rgb ? rgb_pix_fmts :
|
||||
s->is_yuv ? yuv_pix_fmts :
|
||||
all_pix_fmts;
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -471,8 +471,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_RGBA64, AV_PIX_FMT_BGRA64,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_input(AVFilterLink *inlink)
|
||||
|
@ -163,10 +163,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
static const enum PixelFormat pix_fmts[] = {
|
||||
AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
|
||||
|
@ -158,10 +158,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_YUVA420P,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_input(AVFilterLink *inlink)
|
||||
|
@ -267,8 +267,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AV_PIX_FMT_YUVA420P,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
||||
if (!fmts_list)
|
||||
return AVERROR(ENOMEM);
|
||||
return ff_set_common_formats(ctx, fmts_list);
|
||||
}
|
||||
|
||||
static int config_input(AVFilterLink *inlink)
|
||||
|
Loading…
Reference in New Issue
Block a user