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_sub.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'audio/filter/af_sub.c') diff --git a/audio/filter/af_sub.c b/audio/filter/af_sub.c index 92abd2f0ea..561ae94be6 100644 --- a/audio/filter/af_sub.c +++ b/audio/filter/af_sub.c @@ -123,7 +123,6 @@ static int control(struct af_instance* af, int cmd, void* arg) // Deallocate memory static void uninit(struct af_instance* af) { - free(af->data); free(af->setup); } @@ -167,9 +166,8 @@ static int af_open(struct af_instance* af){ af->uninit=uninit; af->play=play; af->mul=1; - af->data=calloc(1,sizeof(struct mp_audio)); af->setup=s=calloc(1,sizeof(af_sub_t)); - if(af->data == NULL || af->setup == NULL) + if(af->setup == NULL) return AF_ERROR; // Set default values s->ch = 5; // Channel nr 6 -- cgit v1.2.3