X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=wma_common.c;h=8886a061751caaa6c16375e244ea92a8f18a212d;hp=dab96257d09876916240817811508c31c45b29d6;hb=402bda88d8556619738ebde95cbcacac2e9f1169;hpb=29a8e4384c08cb4e295e5b82994e62bf247a0ef7 diff --git a/wma_common.c b/wma_common.c index dab96257..8886a061 100644 --- a/wma_common.c +++ b/wma_common.c @@ -1,18 +1,12 @@ /* - * Copyright (C) 2009 Andre Noll + * Copyright (C) 2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ /** \file wma_common.c Functions used by both the WMA afh and decoder. */ -#include #include -#include -#include -#include -#include -#include #include "para.h" #include "error.h" @@ -28,6 +22,8 @@ * \param pattern_len The length of the pattern in bytes. * \param buf The buffer to search for the pattern. * \param buf_size The number of bytes in \a buf. + * + * \return A pointer into \a buf or \p NULL if the pattern was not found. */ const char *search_pattern(const char *pattern, int pattern_len, const char *buf, int buf_size) @@ -38,8 +34,8 @@ const char *search_pattern(const char *pattern, int pattern_len, for (p = buf; p + pattern_len < end; p++) { if (memcmp(p, pattern, pattern_len)) continue; - PARA_DEBUG_LOG("found %d byte pattern@%zd\n", - pattern_len, p - buf); + PARA_DEBUG_LOG("found %d byte pattern@%d\n", + pattern_len, (int)(p - buf)); return p; } PARA_NOTICE_LOG("%d byte pattern not found\n", pattern_len); @@ -56,7 +52,7 @@ static int find_audio_stream_info(const char *buf, int len) if (!p) return -E_WMA_NO_GUID; - PARA_DEBUG_LOG("found audio stream guid@%0zx\n", p - buf); + PARA_DEBUG_LOG("found audio stream guid@%0x\n", (int)(p - buf)); return p - buf + 16; } @@ -113,10 +109,13 @@ int read_asf_header(const char *buf, int loaded, struct asf_header_info *ahi) ahi->flags2 = read_u16(start + 60); PARA_INFO_LOG("read_asf_header: flags1: %d, flag2: %d\n", ahi->flags1, ahi->flags2); + ahi->use_exp_vlc = ahi->flags2 & 0x0001; + ahi->use_bit_reservoir = ahi->flags2 & 0x0002; + ahi->use_variable_block_len = ahi->flags2 & 0x0004; return 1; } -const uint8_t log2_tab[256] = { +static const uint8_t log2_tab[256] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, @@ -142,7 +141,7 @@ const uint8_t log2_tab[256] = { * * \return An integer approximation of log2(v). */ -int wma_log2(unsigned int v) +__a_const int wma_log2(unsigned int v) { int n = 0; if (v & 0xffff0000) {