aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/af_aresample.c
diff options
context:
space:
mode:
authorGanesh Ajjanagadde <gajjanagadde@gmail.com>2015-10-04 23:39:25 -0400
committerGanesh Ajjanagadde <gajjanagadde@gmail.com>2015-10-14 10:04:01 -0400
commit6aaac24d72a7da631173209841a3944fcb4a3309 (patch)
tree4b475e1648073cd36acad767e54486722ac3c15f /libavfilter/af_aresample.c
parent8ededd583622359062622cf008144a1511d50bbd (diff)
downloadffmpeg-6aaac24d72a7da631173209841a3944fcb4a3309.tar.gz
avfilter/all: propagate errors of functions from avfilter/formats
Many of the functions from avfilter/formats can return errors, usually AVERROR(ENOMEM). This propagates the return values. All of these were found by using av_warn_unused_result, demonstrating its utility. Tested with FATE. I am least sure of the changes to avfilter/filtergraph, since I don't know what/how reduce_format is intended to behave and how it should react to errors. Fixes: CID 1325680, 1325679, 1325678. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Previous version Reviewed-by: Nicolas George <george@nsup.org> Previous version Reviewed-by: Clément Bœsch <u@pkh.me> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Diffstat (limited to 'libavfilter/af_aresample.c')
-rw-r--r--libavfilter/af_aresample.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c
index b5af70e775..028e105318 100644
--- a/libavfilter/af_aresample.c
+++ b/libavfilter/af_aresample.c
@@ -88,25 +88,23 @@ static int query_formats(AVFilterContext *ctx)
AVFilterFormats *in_formats, *out_formats;
AVFilterFormats *in_samplerates, *out_samplerates;
AVFilterChannelLayouts *in_layouts, *out_layouts;
+ int ret;
av_opt_get_sample_fmt(aresample->swr, "osf", 0, &out_format);
av_opt_get_int(aresample->swr, "osr", 0, &out_rate);
av_opt_get_int(aresample->swr, "ocl", 0, &out_layout);
in_formats = ff_all_formats(AVMEDIA_TYPE_AUDIO);
- if (!in_formats)
- return AVERROR(ENOMEM);
- ff_formats_ref (in_formats, &inlink->out_formats);
+ if ((ret = ff_formats_ref(in_formats, &inlink->out_formats)) < 0)
+ return ret;
in_samplerates = ff_all_samplerates();
- if (!in_samplerates)
- return AVERROR(ENOMEM);
- ff_formats_ref (in_samplerates, &inlink->out_samplerates);
+ if ((ret = ff_formats_ref(in_samplerates, &inlink->out_samplerates)) < 0)
+ return ret;
in_layouts = ff_all_channel_counts();
- if (!in_layouts)
- return AVERROR(ENOMEM);
- ff_channel_layouts_ref(in_layouts, &inlink->out_channel_layouts);
+ if ((ret = ff_channel_layouts_ref(in_layouts, &inlink->out_channel_layouts)) < 0)
+ return ret;
if(out_rate > 0) {
int ratelist[] = { out_rate, -1 };
@@ -114,28 +112,25 @@ static int query_formats(AVFilterContext *ctx)
} else {
out_samplerates = ff_all_samplerates();
}
- if (!out_samplerates) {
- av_log(ctx, AV_LOG_ERROR, "Cannot allocate output samplerates.\n");
- return AVERROR(ENOMEM);
- }
- ff_formats_ref(out_samplerates, &outlink->in_samplerates);
+ if ((ret = ff_formats_ref(out_samplerates, &outlink->in_samplerates)) < 0)
+ return ret;
if(out_format != AV_SAMPLE_FMT_NONE) {
int formatlist[] = { out_format, -1 };
out_formats = ff_make_format_list(formatlist);
} else
out_formats = ff_all_formats(AVMEDIA_TYPE_AUDIO);
- ff_formats_ref(out_formats, &outlink->in_formats);
+ if ((ret = ff_formats_ref(out_formats, &outlink->in_formats)) < 0)
+ return ret;
if(out_layout) {
int64_t layout_list[] = { out_layout, -1 };
out_layouts = avfilter_make_format64_list(layout_list);
} else
out_layouts = ff_all_channel_counts();
- ff_channel_layouts_ref(out_layouts, &outlink->in_channel_layouts);
- return 0;
+ return ff_channel_layouts_ref(out_layouts, &outlink->in_channel_layouts);
}