From c72824786a0e8c68921ebb9b72f02a2e80aaee17 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Tue, 3 Jul 2007 09:25:36 +0000 Subject: Initial, work-in-progress, version of a WMA codec using Michael Giacomelli's fixed-point and malloc-less WMA decoder (based on the ffmpeg WMA decoder from early 2006, and also building on the work started by Paul Jones). The codec itself and the ASF parsing code were written by me, inspired by the ASF parser in libasf. Current performance is around 400% realtime on gigabeat, 100% realtime on PP and 20% realtime on Coldfire. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13769 a1c6a512-1295-4272-9138-f99709370657 --- apps/metadata/metadata_common.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'apps/metadata/metadata_common.c') diff --git a/apps/metadata/metadata_common.c b/apps/metadata/metadata_common.c index 685b32a25e..d81d9f71d3 100644 --- a/apps/metadata/metadata_common.c +++ b/apps/metadata/metadata_common.c @@ -94,8 +94,8 @@ long read_string(int fd, char* buf, long buf_size, int eos, long size) return read_bytes; } -/* Read an unsigned 32-bit integer from a big-endian file. */ #ifdef ROCKBOX_LITTLE_ENDIAN +/* Read an unsigned 32-bit integer from a big-endian file. */ int read_uint32be(int fd, unsigned int* buf) { size_t n; @@ -104,6 +104,39 @@ int read_uint32be(int fd, unsigned int* buf) *buf = betoh32(*buf); return n; } +#else +/* Read unsigned integers from a little-endian file. */ +int read_uint16le(int fd, uint16_t* buf) +{ + size_t n; + + n = read(fd, (char*) buf, 2); + *buf = letoh16(*buf); + return n; +} +int read_uint32le(int fd, uint32_t* buf) +{ + size_t n; + + n = read(fd, (char*) buf, 4); + *buf = letoh32(*buf); + return n; +} +int read_uint64le(int fd, uint64_t* buf) +{ + size_t n; + uint8_t data[8]; + int i; + + n = read(fd, data, 8); + + for (i=7, *buf=0; i>=0; i--) { + *buf <<= 8; + *buf |= data[i]; + } + + return n; +} #endif /* Read an unaligned 32-bit little endian long from buffer. */ -- cgit v1.2.3