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_export.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'audio/filter/af_export.c') diff --git a/audio/filter/af_export.c b/audio/filter/af_export.c index a6ebdc322e..0139b17d4f 100644 --- a/audio/filter/af_export.c +++ b/audio/filter/af_export.c @@ -183,9 +183,6 @@ static int control(struct af_instance* af, int cmd, void* arg) */ static void uninit( struct af_instance* af ) { - free(af->data); - af->data = NULL; - if(af->setup){ af_export_t* s = af->setup; if (s->buf) @@ -260,9 +257,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 = calloc(1, sizeof(af_export_t)); - if((af->data == NULL) || (af->setup == NULL)) + if(af->setup == NULL) return AF_ERROR; ((af_export_t *)af->setup)->filename = mp_find_user_config_file(SHARED_FILE); -- cgit v1.2.3