]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - wmadec_filter.c
wma: Fix chunk_table computation.
[paraslash.git] / wmadec_filter.c
index 8298296df3cc5fc3f42006a09abe5d0569725138..4d384e1ddf9c82c2768712f9a50aaf44af5284f9 100644 (file)
@@ -34,7 +34,7 @@
 #include "sched.h"
 #include "filter.h"
 #include "bitstream.h"
-#include "mdct.h"
+#include "imdct.h"
 #include "wma.h"
 #include "wmadata.h"
 
@@ -138,7 +138,7 @@ static int wmadec_cleanup(struct private_wmadec_data *s)
        int i;
 
        for (i = 0; i < s->nb_block_sizes; i++)
-               mdct_end(s->mdct_ctx[i]);
+               imdct_end(s->mdct_ctx[i]);
 
        if (s->use_exp_vlc)
                free_vlc(&s->exp_vlc);
@@ -446,14 +446,13 @@ static int wma_decode_init(char *initial_buf, int len, struct private_wmadec_dat
        struct private_wmadec_data *s;
        int ret, i;
 
-       if (len < 18)
-               return 0;
-
        PARA_NOTICE_LOG("initial buf: %d bytes\n", len);
        s = para_calloc(sizeof(*s));
        ret = read_asf_header(initial_buf, len, &s->ahi);
-       if (ret < 0)
+       if (ret <= 0) {
+               free(s);
                return ret;
+       }
 
        s->use_exp_vlc = s->ahi.flags2 & 0x0001;
        s->use_bit_reservoir = s->ahi.flags2 & 0x0002;
@@ -464,7 +463,7 @@ static int wma_decode_init(char *initial_buf, int len, struct private_wmadec_dat
                return ret;
        /* init MDCT */
        for (i = 0; i < s->nb_block_sizes; i++) {
-               ret = mdct_init(s->frame_len_bits - i + 1, 1, &s->mdct_ctx[i]);
+               ret = imdct_init(s->frame_len_bits - i + 1, 1, &s->mdct_ctx[i]);
                if (ret < 0)
                        return ret;
        }
@@ -1286,6 +1285,8 @@ static ssize_t wmadec_convert(char *inbuffer, size_t len,
                if (ret <= 0)
                        return ret;
                fn->private_data = pwd;
+               fn->fc->channels = pwd->ahi.channels;
+               fn->fc->samplerate = pwd->ahi.sample_rate;
                return pwd->ahi.header_len;
        }
        /* skip 31 bytes */