X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=wma_afh.c;h=f1edacf07aa56b2d26e54e54641c1fd3d6bc1f11;hp=f0b73b2965bb07d0e49925bfcc776fddbaefafa8;hb=4ce5e90617837e558a35e411ae66eaf16a9e73f8;hpb=29a8e4384c08cb4e295e5b82994e62bf247a0ef7 diff --git a/wma_afh.c b/wma_afh.c index f0b73b29..f1edacf0 100644 --- a/wma_afh.c +++ b/wma_afh.c @@ -1,19 +1,12 @@ /* - * Copyright (C) 2009 Andre Noll + * Copyright (C) 2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ /** \file wma_afh.c The audio format handler for WMA files. */ -#include -#include #include -#include -#include -#include -#include -#include #include #include "para.h" @@ -107,7 +100,7 @@ static char *get_str16(const char *in, int len) return out; } -static const char comment_header[] = { +static const char content_description_header[] = { 0x33, 0x26, 0xb2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }; @@ -132,12 +125,12 @@ 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); + p = search_pattern(content_description_header, + sizeof(content_description_header), buf, buf_size); if (!p || p + 34 >= end) { - PARA_NOTICE_LOG("comment header not found\n"); + PARA_NOTICE_LOG("content description header not found\n"); goto next; } p += 24; @@ -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); @@ -216,7 +209,7 @@ 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); j = 1; FOR_EACH_FRAME(f, start, buf_size, block_align) { @@ -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);