diff options
author | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-06-02 22:59:04 +0000 |
---|---|---|
committer | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-06-02 22:59:04 +0000 |
commit | 228ca70d485e2660c2e381d7112cbcca65c156a0 (patch) | |
tree | f7ab4303f2daa68c76271787a60d50cb1ada2e46 /libfaad2/bits.c | |
parent | eb1dee5cbf86fba8d5081bae6071cc4a4fd68306 (diff) | |
download | mpv-228ca70d485e2660c2e381d7112cbcca65c156a0.tar.bz2 mpv-228ca70d485e2660c2e381d7112cbcca65c156a0.tar.xz |
update to the 2.0 release of faad, patch by adland
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12528 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libfaad2/bits.c')
-rw-r--r-- | libfaad2/bits.c | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/libfaad2/bits.c b/libfaad2/bits.c index 1d8c91bed3..8c01c5657c 100644 --- a/libfaad2/bits.c +++ b/libfaad2/bits.c @@ -1,6 +1,6 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: bits.c,v 1.1 2003/08/30 22:30:21 arpi Exp $ +** $Id: bits.c,v 1.2 2003/10/03 22:22:27 alex Exp $ **/ #include "common.h" @@ -33,7 +33,7 @@ #include "bits.h" /* initialize buffer, call once before first getbits or showbits */ -void faad_initbits(bitfile *ld, void *_buffer, uint32_t buffer_size) +void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size) { uint32_t tmp; @@ -49,22 +49,16 @@ void faad_initbits(bitfile *ld, void *_buffer, uint32_t buffer_size) return; } - ld->buffer = malloc((buffer_size+12)*sizeof(uint8_t)); + ld->buffer = faad_malloc((buffer_size+12)*sizeof(uint8_t)); memset(ld->buffer, 0, (buffer_size+12)*sizeof(uint8_t)); memcpy(ld->buffer, _buffer, buffer_size*sizeof(uint8_t)); ld->buffer_size = buffer_size; tmp = getdword((uint32_t*)ld->buffer); -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif ld->bufa = tmp; tmp = getdword((uint32_t*)ld->buffer + 1); -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif ld->bufb = tmp; ld->start = (uint32_t*)ld->buffer; @@ -80,7 +74,13 @@ void faad_initbits(bitfile *ld, void *_buffer, uint32_t buffer_size) void faad_endbits(bitfile *ld) { if (ld) - if (ld->buffer) free(ld->buffer); + { + if (ld->buffer) + { + faad_free(ld->buffer); + ld->buffer = NULL; + } + } } uint32_t faad_get_processed_bits(bitfile *ld) @@ -105,11 +105,13 @@ void faad_flushbits_ex(bitfile *ld, uint32_t bits) uint32_t tmp; ld->bufa = ld->bufb; - tmp = getdword(ld->tail); - ld->tail++; -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif + if (ld->no_more_reading == 0) + { + tmp = getdword(ld->tail); + ld->tail++; + } else { + tmp = 0; + } ld->bufb = tmp; ld->bits_left += (32 - bits); ld->bytes_used += 4; @@ -149,7 +151,7 @@ uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits uint16_t bytes = (uint16_t)bits / 8; uint8_t remainder = (uint8_t)bits % 8; - uint8_t *buffer = (uint8_t*)malloc((bytes+1)*sizeof(uint8_t)); + uint8_t *buffer = (uint8_t*)faad_malloc((bytes+1)*sizeof(uint8_t)); for (i = 0; i < bytes; i++) { @@ -166,6 +168,20 @@ uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits return buffer; } +#ifdef DRM +/* return the original data buffer */ +void *faad_origbitbuffer(bitfile *ld) +{ + return (void*)ld->start; +} + +/* return the original data buffer size */ +uint32_t faad_origbitbuffer_size(bitfile *ld) +{ + return ld->buffer_size; +} +#endif + /* reversed bit reading routines, used for RVLC and HCR */ void faad_initbits_rev(bitfile *ld, void *buffer, uint32_t bits_in_buffer) @@ -180,15 +196,9 @@ void faad_initbits_rev(bitfile *ld, void *buffer, ld->start = (uint32_t*)buffer + index - 2; tmp = getdword((uint32_t*)buffer + index); -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif ld->bufa = tmp; tmp = getdword((uint32_t*)buffer + index - 1); -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif ld->bufb = tmp; ld->tail = (uint32_t*)buffer + index; |