From 0d90aa75852c4e76d8d00659d48ba4baf32deae2 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 18 Apr 2014 00:12:40 +0000 Subject: [PATCH] aacdec: Combine aac_open() and aacdec_open(). Both functions are short, and they are only called once at startup. Thus, there is no reason to spread out the initialization over two functions, so let's combine them. --- aacdec_filter.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/aacdec_filter.c b/aacdec_filter.c index c886f9d8..7e3ed80a 100644 --- a/aacdec_filter.c +++ b/aacdec_filter.c @@ -46,23 +46,6 @@ struct private_aacdec_data { unsigned int sample_rate; }; -/* - * Get a new libfaad decoder handle. - * - * \return The handle returned by NeAACDecOpen(). - */ -static NeAACDecHandle aac_open(void) -{ - NeAACDecHandle h = NeAACDecOpen(); - NeAACDecConfigurationPtr c = NeAACDecGetCurrentConfiguration(h); - - c->defObjectType = LC; - c->outputFormat = FAAD_FMT_16BIT; - c->downMatrix = 0; - NeAACDecSetConfiguration(h, c); - return h; -} - static int aacdec_execute(struct btr_node *btrn, const char *cmd, char **result) { struct filter_node *fn = btr_context(btrn); @@ -73,11 +56,18 @@ static int aacdec_execute(struct btr_node *btrn, const char *cmd, char **result) static void aacdec_open(struct filter_node *fn) { + NeAACDecConfigurationPtr c; struct private_aacdec_data *padd = para_calloc(sizeof(*padd)); + padd->handle = NeAACDecOpen(); + c = NeAACDecGetCurrentConfiguration(padd->handle); + c->defObjectType = LC; + c->outputFormat = FAAD_FMT_16BIT; + c->downMatrix = 0; + NeAACDecSetConfiguration(padd->handle, c); + fn->private_data = padd; fn->min_iqs = 2048; - padd->handle = aac_open(); } static void aacdec_close(struct filter_node *fn) -- 2.39.2