diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-30 18:59:19 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-30 19:26:07 +0100 |
commit | 5cac0656a3cb8d04fc8d43b729c493f3e0e98d54 (patch) | |
tree | 5966e5d5e624202b4b7512a1d56e1130e02b8ee2 /libavfilter/af_ashowinfo.c | |
parent | 674c4a11cbcc18714e3393d568b3751151f815c5 (diff) |
af_ashowinfo: integrate config_input() in filter_samples.
This is simpler and also should allow the code to function when the
channel number changes.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/af_ashowinfo.c')
-rw-r--r-- | libavfilter/af_ashowinfo.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c index 1a70deee28..82ce261064 100644 --- a/libavfilter/af_ashowinfo.c +++ b/libavfilter/af_ashowinfo.c @@ -48,17 +48,6 @@ typedef struct AShowInfoContext { uint64_t frame; } AShowInfoContext; -static int config_input(AVFilterLink *inlink) -{ - AShowInfoContext *s = inlink->dst->priv; - int channels = av_get_channel_layout_nb_channels(inlink->channel_layout); - s->plane_checksums = av_malloc(channels * sizeof(*s->plane_checksums)); - if (!s->plane_checksums) - return AVERROR(ENOMEM); - - return 0; -} - static void uninit(AVFilterContext *ctx) { AShowInfoContext *s = ctx->priv; @@ -77,6 +66,11 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf) int data_size = buf->audio->nb_samples * block_align; int planes = planar ? channels : 1; int i; + void *tmp_ptr = av_realloc(s->plane_checksums, channels * sizeof(*s->plane_checksums)); + + if (!tmp_ptr) + return AVERROR(ENOMEM); + s->plane_checksums = tmp_ptr; for (i = 0; i < planes; i++) { uint8_t *data = buf->extended_data[i]; @@ -114,7 +108,6 @@ static const AVFilterPad inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, .get_audio_buffer = ff_null_get_audio_buffer, - .config_props = config_input, .filter_samples = filter_samples, .min_perms = AV_PERM_READ, }, |