summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-03-16 21:57:16 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-03-16 21:57:16 +0000
commit3706d6d0b5e672637dcc831aeb844dce4667ea65 (patch)
tree2d2a69f2ca09391ed067b5ceab78832f5670ab4a
parentea61fb8023c13af4d882e750d38d23e5efb93169 (diff)
downloadrockbox-3706d6d0b5e672637dcc831aeb844dce4667ea65.zip
rockbox-3706d6d0b5e672637dcc831aeb844dce4667ea65.tar.gz
rockbox-3706d6d0b5e672637dcc831aeb844dce4667ea65.tar.bz2
rockbox-3706d6d0b5e672637dcc831aeb844dce4667ea65.tar.xz
Hopefully fix red now and reduce binsize for HWCODEC targets. This change implements a local read_uint32be() function within the mp3data parser.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29606 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/SOURCES2
-rw-r--r--apps/metadata/metadata_common.c2
-rw-r--r--apps/mp3data.c16
3 files changed, 16 insertions, 4 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index b5f7a1d..c122427 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -198,8 +198,8 @@ gui/usb_screen.c
metadata.c
metadata/id3tags.c
metadata/mp3.c
-metadata/metadata_common.c
#if CONFIG_CODEC == SWCODEC
+metadata/metadata_common.c
metadata/aiff.c
metadata/ape.c
metadata/asf.c
diff --git a/apps/metadata/metadata_common.c b/apps/metadata/metadata_common.c
index bde48d4..6c420d9 100644
--- a/apps/metadata/metadata_common.c
+++ b/apps/metadata/metadata_common.c
@@ -213,7 +213,6 @@ unsigned long get_itunes_int32(char* value, int count)
return r;
}
-#if CONFIG_CODEC == SWCODEC
/* Skip an ID3v2 tag if it can be found. We assume the tag is located at the
* start of the file, which should be true in all cases where we need to skip it.
* Returns true if successfully skipped or not skipped, and false if
@@ -360,4 +359,3 @@ long parse_tag(const char* name, char* value, struct mp3entry* id3,
return len;
}
-#endif
diff --git a/apps/mp3data.c b/apps/mp3data.c
index 89af498..31ed492 100644
--- a/apps/mp3data.c
+++ b/apps/mp3data.c
@@ -213,6 +213,19 @@ static bool headers_have_same_type(unsigned long header1,
return header1 ? (header1 == header2) : true;
}
+/* Helper function to read 4-byte in big endian format. */
+static void read_uint32be_mp3data(int fd, unsigned long *data, long *pos)
+{
+#ifdef ROCKBOX_BIG_ENDIAN
+ (void)read(fd, (char*)data, 4);
+#else
+ char tmp[4];
+ (void)read(fd, tmp, 4);
+ *data = (tmp[0]<<24) | (tmp[1]<<16) | (tmp[2]<<8) | tmp[3];
+#endif
+ *pos += 4;
+}
+
static unsigned long __find_next_frame(int fd, long *offset, long max_offset,
unsigned long reference_header,
int(*getfunc)(int fd, unsigned char *c),
@@ -259,7 +272,8 @@ static unsigned long __find_next_frame(int fd, long *offset, long max_offset,
/* Read possible next frame header and seek back to last frame
* headers byte position. */
reference_header = 0;
- read_uint32be(fd, (uint32_t*)&reference_header);
+ read_uint32be_mp3data(fd, &reference_header, &pos);
+ //
lseek(fd, -info.frame_size, SEEK_CUR);
/* If the current header is of the same type as the previous