]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
aacdec: Combine aac_open() and aacdec_open().
authorAndre Noll <maan@systemlinux.org>
Fri, 18 Apr 2014 00:12:40 +0000 (00:12 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 25 Mar 2017 10:54:36 +0000 (11:54 +0100)
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

index c886f9d82b177012761b757c0f73c55db44e001e..7e3ed80a700a13319b3790eeb4093a7db8f51a7e 100644 (file)
@@ -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)