Message ID | 20200809155748.30092-4-andreas.rheinhardt@gmail.com |
---|---|
State | Accepted |
Commit | 27f35fd121e38b28daafb4f1ad47cf55b5e5ab71 |
Headers | show |
Series | [FFmpeg-devel,1/6] avfilter/formats: Remove ff_make_formatu64_list() | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
LGTM On 8/9/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote: > Replace using ff_add_format() repeatedly by a single call to > ff_make_format_list(). (Right now this also fixes a memleak: If the > first ff_add_format() succeeds and a subsequent call fails, the list > leaks.) > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> > --- > libavfilter/af_amix.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c > index 0826fc118c..6a4ef8d944 100644 > --- a/libavfilter/af_amix.c > +++ b/libavfilter/af_amix.c > @@ -588,7 +588,11 @@ static av_cold void uninit(AVFilterContext *ctx) > > static int query_formats(AVFilterContext *ctx) > { > - AVFilterFormats *formats = NULL; > + static const enum AVSampleFormat sample_fmts[] = { > + AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, > + AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, > + AV_SAMPLE_FMT_NONE > + }; > AVFilterChannelLayouts *layouts; > int ret; > > @@ -598,11 +602,7 @@ static int query_formats(AVFilterContext *ctx) > goto fail; > } > > - if ((ret = ff_add_format(&formats, AV_SAMPLE_FMT_FLT )) < 0 || > - (ret = ff_add_format(&formats, AV_SAMPLE_FMT_FLTP)) < 0 || > - (ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBL )) < 0 || > - (ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBLP)) < 0 || > - (ret = ff_set_common_formats (ctx, formats)) < 0 || > + if ((ret = ff_set_common_formats(ctx, > ff_make_format_list(sample_fmts))) < 0 || > (ret = ff_set_common_channel_layouts(ctx, layouts)) < 0 || > (ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0) > goto fail; > -- > 2.20.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c index 0826fc118c..6a4ef8d944 100644 --- a/libavfilter/af_amix.c +++ b/libavfilter/af_amix.c @@ -588,7 +588,11 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; + static const enum AVSampleFormat sample_fmts[] = { + AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, + AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, + AV_SAMPLE_FMT_NONE + }; AVFilterChannelLayouts *layouts; int ret; @@ -598,11 +602,7 @@ static int query_formats(AVFilterContext *ctx) goto fail; } - if ((ret = ff_add_format(&formats, AV_SAMPLE_FMT_FLT )) < 0 || - (ret = ff_add_format(&formats, AV_SAMPLE_FMT_FLTP)) < 0 || - (ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBL )) < 0 || - (ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBLP)) < 0 || - (ret = ff_set_common_formats (ctx, formats)) < 0 || + if ((ret = ff_set_common_formats(ctx, ff_make_format_list(sample_fmts))) < 0 || (ret = ff_set_common_channel_layouts(ctx, layouts)) < 0 || (ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0) goto fail;
Replace using ff_add_format() repeatedly by a single call to ff_make_format_list(). (Right now this also fixes a memleak: If the first ff_add_format() succeeds and a subsequent call fails, the list leaks.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- libavfilter/af_amix.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)