Commit 5cac0656 authored by Michael Niedermayer's avatar Michael Niedermayer

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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 674c4a11
......@@ -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,
},
......
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