From d115fb3b0eed9145817a20bc0070590f7428bddd Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 10 Nov 2013 23:20:06 +0100 Subject: af: don't require filters to allocate af_instance->data, redo buffers Allocate af_instance->data in generic code before filter initialization. Every filter needs af->data (since it contains the output configuration), so there's no reason why every filter should allocate and free it. Remove RESIZE_LOCAL_BUFFER(), and replace it with mp_audio_realloc_min(). Interestingly, most code becomes simpler, because the new function takes the size in samples, and not in bytes. There are larger change in af_scaletempo.c and af_lavcac3enc.c, because these had copied and modified versions of the RESIZE_LOCAL_BUFFER macro/function. --- audio/filter/af.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'audio/filter/af.h') diff --git a/audio/filter/af.h b/audio/filter/af.h index 3cfdee85dd..36c2cf33fd 100644 --- a/audio/filter/af.h +++ b/audio/filter/af.h @@ -61,7 +61,7 @@ struct af_instance { struct mp_audio * (*play)(struct af_instance *af, struct mp_audio *data); void *setup; // old field for priv structs void *priv; - struct mp_audio *data; // configuration for outgoing data stream + struct mp_audio *data; // configuration and buffer for outgoing data stream struct af_instance *next; struct af_instance *prev; double delay; /* Delay caused by the filter, in units of bytes read without @@ -182,10 +182,6 @@ double af_calc_delay(struct af_stream *s); * \{ */ -int af_resize_local_buffer(struct af_instance *af, struct mp_audio *data); - -#define RESIZE_LOCAL_BUFFER af_resize_local_buffer - /** * \brief convert dB to gain value * \param n number of values to convert -- cgit v1.2.3