diff options
author | Paul B Mahol <onemda@gmail.com> | 2015-04-03 20:55:18 +0300 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2015-04-08 16:05:06 +0300 |
commit | a0854c084ea1541591c54aaab1f993ebaf92ffaf (patch) | |
tree | 1ebc69023a4f7eb471ce60ff4784b146a8b9973f /libavfilter/asrc_sine.c | |
parent | 21e034a47a2b407f0896114a995fd507f0f5230f (diff) |
avfilter: handle error in query_formats() in bunch of filters
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/asrc_sine.c')
-rw-r--r-- | libavfilter/asrc_sine.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/libavfilter/asrc_sine.c b/libavfilter/asrc_sine.c index 68e13980b3..6aa01d5ec5 100644 --- a/libavfilter/asrc_sine.c +++ b/libavfilter/asrc_sine.c @@ -153,11 +153,28 @@ static av_cold int query_formats(AVFilterContext *ctx) int sample_rates[] = { sine->sample_rate, -1 }; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }; + AVFilterFormats *formats; + AVFilterChannelLayouts *layouts; + int ret; - 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)); - return 0; + formats = ff_make_format_list(sample_fmts); + if (!formats) + return AVERROR(ENOMEM); + ret = ff_set_common_formats (ctx, formats); + if (ret < 0) + return ret; + + layouts = avfilter_make_format64_list(chlayouts); + if (!layouts) + return AVERROR(ENOMEM); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; + + formats = ff_make_format_list(sample_rates); + if (!formats) + return AVERROR(ENOMEM); + return ff_set_common_samplerates(ctx, formats); } static av_cold int config_props(AVFilterLink *outlink) |