summaryrefslogtreecommitdiff
path: root/apps/metadata/metadata_common.c
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-07-03 09:25:36 +0000
committerDave Chapman <dave@dchapman.com>2007-07-03 09:25:36 +0000
commitc72824786a0e8c68921ebb9b72f02a2e80aaee17 (patch)
treeadf8dac26d074ee3620df4ab482ff108561ead01 /apps/metadata/metadata_common.c
parent2ca895bae7a25ea8ef7f295b4e8ab01ff75a4914 (diff)
downloadrockbox-c72824786a0e8c68921ebb9b72f02a2e80aaee17.tar.gz
rockbox-c72824786a0e8c68921ebb9b72f02a2e80aaee17.zip
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
Diffstat (limited to 'apps/metadata/metadata_common.c')
-rw-r--r--apps/metadata/metadata_common.c35
1 files changed, 34 insertions, 1 deletions
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)
94 return read_bytes; 94 return read_bytes;
95} 95}
96 96
97/* Read an unsigned 32-bit integer from a big-endian file. */
98#ifdef ROCKBOX_LITTLE_ENDIAN 97#ifdef ROCKBOX_LITTLE_ENDIAN
98/* Read an unsigned 32-bit integer from a big-endian file. */
99int read_uint32be(int fd, unsigned int* buf) 99int read_uint32be(int fd, unsigned int* buf)
100{ 100{
101 size_t n; 101 size_t n;
@@ -104,6 +104,39 @@ int read_uint32be(int fd, unsigned int* buf)
104 *buf = betoh32(*buf); 104 *buf = betoh32(*buf);
105 return n; 105 return n;
106} 106}
107#else
108/* Read unsigned integers from a little-endian file. */
109int read_uint16le(int fd, uint16_t* buf)
110{
111 size_t n;
112
113 n = read(fd, (char*) buf, 2);
114 *buf = letoh16(*buf);
115 return n;
116}
117int read_uint32le(int fd, uint32_t* buf)
118{
119 size_t n;
120
121 n = read(fd, (char*) buf, 4);
122 *buf = letoh32(*buf);
123 return n;
124}
125int read_uint64le(int fd, uint64_t* buf)
126{
127 size_t n;
128 uint8_t data[8];
129 int i;
130
131 n = read(fd, data, 8);
132
133 for (i=7, *buf=0; i>=0; i--) {
134 *buf <<= 8;
135 *buf |= data[i];
136 }
137
138 return n;
139}
107#endif 140#endif
108 141
109/* Read an unaligned 32-bit little endian long from buffer. */ 142/* Read an unaligned 32-bit little endian long from buffer. */