[FFmpeg-devel] [PATCH] avfilter: handle error in query_formats() in bunch of filters

Clément Bœsch u at pkh.me
Sat Apr 4 11:41:42 CEST 2015


On Fri, Apr 03, 2015 at 06:57:08PM +0000, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavfilter/aeval.c                | 19 ++++++++++++++++---
>  libavfilter/asrc_sine.c            | 20 +++++++++++++++++---
>  libavfilter/vf_bbox.c              |  5 ++++-
>  libavfilter/vf_blackdetect.c       |  5 ++++-
>  libavfilter/vf_blackframe.c        |  5 ++++-
>  libavfilter/vf_blend.c             |  5 ++++-
>  libavfilter/vf_colorchannelmixer.c |  5 ++++-
>  libavfilter/vf_colorlevels.c       |  5 ++++-
>  libavfilter/vf_cropdetect.c        |  5 ++++-
>  libavfilter/vf_fade.c              |  8 ++++++--
>  libavfilter/vf_fftfilt.c           |  6 ++++--
>  libavfilter/vf_framepack.c         |  5 ++++-
>  libavfilter/vf_fspp.c              |  6 +++++-
>  libavfilter/vf_geq.c               |  9 +++++++--
>  libavfilter/vf_histogram.c         |  6 ++++--
>  libavfilter/vf_interlace.c         |  5 ++++-
>  libavfilter/vf_kerndeint.c         |  5 ++++-
>  libavfilter/vf_perspective.c       |  5 ++++-
>  libavfilter/vf_phase.c             |  5 ++++-
>  libavfilter/vf_pp.c                |  6 +++++-
>  libavfilter/vf_pp7.c               |  6 +++++-
>  libavfilter/vf_psnr.c              |  5 ++++-
>  libavfilter/vf_pullup.c            |  6 +++++-
>  libavfilter/vf_removelogo.c        |  5 ++++-
>  libavfilter/vf_repeatfields.c      |  5 ++++-
>  libavfilter/vf_rotate.c            |  5 ++++-
>  libavfilter/vf_sab.c               |  5 ++++-
>  libavfilter/vf_signalstats.c       |  5 ++++-
>  libavfilter/vf_smartblur.c         |  6 ++++--
>  libavfilter/vf_spp.c               |  6 +++++-
>  libavfilter/vf_stereo3d.c          |  6 ++++--
>  libavfilter/vf_super2xsai.c        |  5 ++++-
>  libavfilter/vf_thumbnail.c         |  5 ++++-
>  libavfilter/vf_tinterlace.c        |  5 ++++-
>  libavfilter/vf_unsharp.c           |  6 ++++--
>  libavfilter/vf_uspp.c              |  6 +++++-
>  libavfilter/vf_vidstabdetect.c     |  5 ++++-
>  libavfilter/vf_vidstabtransform.c  |  5 ++++-
>  libavfilter/vf_vignette.c          |  5 ++++-
>  libavfilter/vf_w3fdif.c            |  6 ++++--
>  libavfilter/vf_xbr.c               |  5 ++++-
>  libavfilter/vf_yadif.c             |  5 ++++-
>  libavfilter/vf_zoompan.c           |  6 ++++--
>  libavfilter/vsrc_cellauto.c        |  5 ++++-
>  libavfilter/vsrc_life.c            |  6 +++++-
>  libavfilter/vsrc_mandelbrot.c      |  5 ++++-
>  libavfilter/vsrc_mptestsrc.c       |  5 ++++-
>  libavfilter/vsrc_testsrc.c         | 24 ++++++++++++++++++++----
>  48 files changed, 245 insertions(+), 64 deletions(-)
> 
> diff --git a/libavfilter/aeval.c b/libavfilter/aeval.c
> index 69de1f7..1bdce85 100644
> --- a/libavfilter/aeval.c
> +++ b/libavfilter/aeval.c
> @@ -247,10 +247,23 @@ static int query_formats(AVFilterContext *ctx)
>      static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE };
>      int64_t chlayouts[] = { eval->chlayout ? eval->chlayout : FF_COUNT2LAYOUT(eval->nb_channels) , -1 };
>      int sample_rates[] = { eval->sample_rate, -1 };
> +    AVFilterFormats *formats;
> +    AVFilterChannelLayouts *layouts;
> +
> +    formats = ff_make_format_list(sample_fmts);
> +    if (!formats)
> +        return AVERROR(ENOMEM);
> +    ff_set_common_formats (ctx, formats);
>  
> -    ff_set_common_formats (ctx, ff_make_format_list(sample_fmts));
> -    ff_set_common_channel_layouts(ctx, avfilter_make_format64_list(chlayouts));
> -    ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates));
> +    layouts = avfilter_make_format64_list(chlayouts);
> +    if (!layouts)
> +        return AVERROR(ENOMEM);
> +    ff_set_common_channel_layouts(ctx, layouts);
> +
> +    formats = ff_make_format_list(sample_rates);
> +    if (!formats)
> +        return AVERROR(ENOMEM);
> +    ff_set_common_samplerates(ctx, formats);
>  

This is not enough, ff_set_common* functions now return AVERROR_*
see fd682b189264dc3a7fd913a21ff0c23bb08e3ef4

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150404/e9e952ea/attachment.asc>


More information about the ffmpeg-devel mailing list