summaryrefslogtreecommitdiff
path: root/libavfilter/af_volumedetect.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-09-05 21:42:31 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-11-06 16:59:20 +0100
commit0e66dcd733d08f32af5184e2da3b81d338a88325 (patch)
treeeb9853e866b522c7e0dd25b0379c275d57d3f27a /libavfilter/af_volumedetect.c
parent6d50dff816ec30e589ac71e44824f7fb6c34fd2e (diff)
downloadffmpeg-0e66dcd733d08f32af5184e2da3b81d338a88325.tar.gz
avfilter/af_volumedetect: Remove dependency on channel layout
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavfilter/af_volumedetect.c')
-rw-r--r--libavfilter/af_volumedetect.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c
index 4815bccf6b..0143940ef3 100644
--- a/libavfilter/af_volumedetect.c
+++ b/libavfilter/af_volumedetect.c
@@ -41,9 +41,19 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_NONE
};
AVFilterFormats *formats;
+ AVFilterChannelLayouts *layouts;
+ int ret;
if (!(formats = ff_make_format_list(sample_fmts)))
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);
}
@@ -51,9 +61,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *samples)
{
AVFilterContext *ctx = inlink->dst;
VolDetectContext *vd = ctx->priv;
- int64_t layout = samples->channel_layout;
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 plane, i;
int16_t *pcm;