Merge branch 'refs/heads/t/tarball-build-fix'
[paraslash.git] / wma_afh.c
index d9a834836a5a9bc79458e1fc32619b13980bb538..3df9b5fb818bf3e9a406eb175f7090a796502337 100644 (file)
--- a/wma_afh.c
+++ b/wma_afh.c
@@ -1,19 +1,12 @@
 /*
- * Copyright (C) 2009-2010 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2009 Andre Noll <maan@tuebingen.mpg.de>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
 
 /** \file wma_afh.c The audio format handler for WMA files. */
 
-#include <stdlib.h>
-#include <inttypes.h>
 #include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
 #include <regex.h>
 
 #include "para.h"
@@ -132,7 +125,7 @@ static const char album_tag_header[] = { /* WM/AlbumTitle */
 static void read_asf_tags(const char *buf, int buf_size, struct taginfo *ti)
 {
        const char *p, *end = buf + buf_size, *q;
-       uint16_t len1, len2, len3, len4, len5;
+       uint16_t len1, len2, len3, len4;
 
        p = search_pattern(comment_header, sizeof(comment_header),
                buf, buf_size);
@@ -149,7 +142,7 @@ static void read_asf_tags(const char *buf, int buf_size, struct taginfo *ti)
        p += 2;
        len4 = read_u16(p);
        p += 2;
-       len5 = read_u16(p);
+       /* ignore length of the rating information */
        p += 2;
        if (p + len1 >= end)
                goto next;
@@ -158,10 +151,10 @@ static void read_asf_tags(const char *buf, int buf_size, struct taginfo *ti)
        if (p + len2 >= end)
                goto next;
        ti->artist = get_str16(p, len2);
-       p += len2 + len3 + len4;
-       if (p + len5 >= end)
+       p += len2 + len3;
+       if (p + len4 >= end)
                goto next;
-       ti->comment = get_str16(p, len5);
+       ti->comment = get_str16(p, len4);
 next:
        p = search_pattern(extended_content_header, sizeof(extended_content_header),
                buf, buf_size);
@@ -257,7 +250,15 @@ 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;
+
+       afhi->techinfo = make_message("%s%s%s%s%s",
+               ahi.use_exp_vlc? "exp vlc" : "",
+               (ahi.use_bit_reservoir && ahi.use_exp_vlc)? ", " : "",
+               ahi.use_bit_reservoir? "bit reservoir" : "",
+               (ahi.use_variable_block_len &&
+                       (ahi.use_exp_vlc || ahi.use_bit_reservoir)? ", " : ""),
+               ahi.use_variable_block_len? "vbl" : ""
+       );
        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);