diff options
Diffstat (limited to 'libavfilter/af_bs2b.c')
-rw-r--r-- | libavfilter/af_bs2b.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/libavfilter/af_bs2b.c b/libavfilter/af_bs2b.c index 25e786761f..b7cfd3815b 100644 --- a/libavfilter/af_bs2b.c +++ b/libavfilter/af_bs2b.c @@ -1,18 +1,18 @@ /* - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -45,9 +45,9 @@ typedef struct Bs2bContext { } Bs2bContext; #define OFFSET(x) offsetof(Bs2bContext, x) -#define A AV_OPT_FLAG_AUDIO_PARAM +#define A AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM -static const AVOption options[] = { +static const AVOption bs2b_options[] = { { "profile", "Apply a pre-defined crossfeed level", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = BS2B_DEFAULT_CLEVEL }, 0, INT_MAX, A, "profile" }, { "default", "default profile", 0, AV_OPT_TYPE_CONST, { .i64 = BS2B_DEFAULT_CLEVEL }, 0, 0, A, "profile" }, @@ -60,12 +60,7 @@ static const AVOption options[] = { { NULL }, }; -static const AVClass bs2b_class = { - .class_name = "bs2b filter", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; +AVFILTER_DEFINE_CLASS(bs2b); static av_cold int init(AVFilterContext *ctx) { @@ -106,22 +101,25 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE, }; + int ret; if (ff_add_channel_layout(&layouts, AV_CH_LAYOUT_STEREO) != 0) return AVERROR(ENOMEM); - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } static int filter_frame(AVFilterLink *inlink, AVFrame *frame) @@ -136,8 +134,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) out_frame = frame; } else { out_frame = ff_get_audio_buffer(inlink, frame->nb_samples); - if (!out_frame) + if (!out_frame) { + av_frame_free(&frame); return AVERROR(ENOMEM); + } av_frame_copy(out_frame, frame); ret = av_frame_copy_props(out_frame, frame); if (ret < 0) { @@ -168,16 +168,16 @@ static int config_output(AVFilterLink *outlink) bs2b->filter = bs2b_cross_feed_u8; break; case AV_SAMPLE_FMT_S16: - bs2b->filter = bs2b_cross_feed_s16; + bs2b->filter = (void*)bs2b_cross_feed_s16; break; case AV_SAMPLE_FMT_S32: - bs2b->filter = bs2b_cross_feed_s32; + bs2b->filter = (void*)bs2b_cross_feed_s32; break; case AV_SAMPLE_FMT_FLT: - bs2b->filter = bs2b_cross_feed_f; + bs2b->filter = (void*)bs2b_cross_feed_f; break; case AV_SAMPLE_FMT_DBL: - bs2b->filter = bs2b_cross_feed_d; + bs2b->filter = (void*)bs2b_cross_feed_d; break; default: return AVERROR_BUG; |