mood: Deduplicate score formula.
[paraslash.git] / wma_afh.c
index e78802ee6cd2e6a3d15f75da674923344214d061..207b0ba8cae25c024172023d58d3691e7c4f5e9b 100644 (file)
--- a/wma_afh.c
+++ b/wma_afh.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2009-2013 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -201,7 +201,7 @@ static int wma_make_chunk_table(char *buf, size_t buf_size, int block_align,
                struct afh_info *afhi)
 {
        const uint8_t *f, *start = (uint8_t *)buf;
-       int i, j, frames_per_chunk;
+       int j, frames_per_chunk;
        size_t ct_size = 250;
        int ret, count = 0, num_frames, num_superframes;
 
@@ -216,9 +216,8 @@ static int wma_make_chunk_table(char *buf, size_t buf_size, int block_align,
                goto fail;
        afhi->seconds_total = num_frames * 2048 /* FIXME */
                / afhi->frequency;
-       frames_per_chunk = num_frames / num_superframes;
+       frames_per_chunk = num_frames / num_superframes / 2;
        PARA_INFO_LOG("%d frames per chunk\n", frames_per_chunk);
-       i = 0;
        j = 1;
        FOR_EACH_FRAME(f, start, buf_size, block_align) {
                count += f[WMA_FRAME_SKIP] & 0x0f;
@@ -258,7 +257,6 @@ static int wma_get_file_info(char *map, size_t numbytes, __a_unused int fd,
        afhi->frequency = ahi.sample_rate;
        afhi->channels = ahi.channels;
        afhi->header_len = ahi.header_len;
-       afhi->header_offset = 0;
        wma_make_chunk_table(map + ahi.header_len, numbytes - ahi.header_len,
                ahi.block_align, afhi);
        read_asf_tags(map, ahi.header_len, &afhi->tags);