diff options
author | Clément Bœsch <u@pkh.me> | 2015-03-15 14:20:34 +0100 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2015-03-16 23:43:12 +0100 |
commit | fd682b189264dc3a7fd913a21ff0c23bb08e3ef4 (patch) | |
tree | 8685464c0f7b2af6158f3f253824abe12efc8695 /libavfilter/vf_edgedetect.c | |
parent | 545b0dd6aa30f392a9693b41c8f21e28c3dde0dd (diff) |
avfilter: handle error in query_formats() of a bunch of random video filters
Diffstat (limited to 'libavfilter/vf_edgedetect.c')
-rw-r--r-- | libavfilter/vf_edgedetect.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libavfilter/vf_edgedetect.c b/libavfilter/vf_edgedetect.c index 1fb66bccfc..ac88e02a11 100644 --- a/libavfilter/vf_edgedetect.c +++ b/libavfilter/vf_edgedetect.c @@ -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) |