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_lavfi.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'audio/filter/af_lavfi.c') diff --git a/audio/filter/af_lavfi.c b/audio/filter/af_lavfi.c index 381e2d0583..e77110c067 100644 --- a/audio/filter/af_lavfi.c +++ b/audio/filter/af_lavfi.c @@ -58,11 +58,6 @@ struct priv { AVFilterContext *in; AVFilterContext *out; - // Guarantee that the data stays valid until next filter call - char *out_buffer; - - struct mp_audio temp; - int64_t samples_in; AVRational timebase_out; @@ -278,8 +273,8 @@ static struct mp_audio *play(struct af_instance *af, struct mp_audio *data) af->delay = (in_time - out_time) * r->rate * r->sstride; } - p->temp = *r; - return &p->temp; + *data = *r; + return data; } static void uninit(struct af_instance *af) -- cgit v1.2.3