Commit 0e66dcd7 authored by Michael Niedermayer's avatar Michael Niedermayer

avfilter/af_volumedetect: Remove dependency on channel layout

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 6d50dff8
...@@ -41,9 +41,19 @@ static int query_formats(AVFilterContext *ctx) ...@@ -41,9 +41,19 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_NONE AV_SAMPLE_FMT_NONE
}; };
AVFilterFormats *formats; AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
if (!(formats = ff_make_format_list(sample_fmts))) if (!(formats = ff_make_format_list(sample_fmts)))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
if (ret < 0)
return ret;
return ff_set_common_formats(ctx, formats); return ff_set_common_formats(ctx, formats);
} }
...@@ -51,9 +61,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *samples) ...@@ -51,9 +61,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *samples)
{ {
AVFilterContext *ctx = inlink->dst; AVFilterContext *ctx = inlink->dst;
VolDetectContext *vd = ctx->priv; VolDetectContext *vd = ctx->priv;
int64_t layout = samples->channel_layout;
int nb_samples = samples->nb_samples; int nb_samples = samples->nb_samples;
int nb_channels = av_get_channel_layout_nb_channels(layout); int nb_channels = av_frame_get_channels(samples);
int nb_planes = nb_channels; int nb_planes = nb_channels;
int plane, i; int plane, i;
int16_t *pcm; int16_t *pcm;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment