diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/SOURCES | 2 | ||||
-rw-r--r-- | apps/metadata/metadata_common.c | 2 | ||||
-rw-r--r-- | apps/mp3data.c | 16 |
3 files changed, 16 insertions, 4 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index b5f7a1d9f1..c122427900 100644 --- a/apps/SOURCES +++ b/apps/SOURCES | |||
@@ -198,8 +198,8 @@ gui/usb_screen.c | |||
198 | metadata.c | 198 | metadata.c |
199 | metadata/id3tags.c | 199 | metadata/id3tags.c |
200 | metadata/mp3.c | 200 | metadata/mp3.c |
201 | metadata/metadata_common.c | ||
202 | #if CONFIG_CODEC == SWCODEC | 201 | #if CONFIG_CODEC == SWCODEC |
202 | metadata/metadata_common.c | ||
203 | metadata/aiff.c | 203 | metadata/aiff.c |
204 | metadata/ape.c | 204 | metadata/ape.c |
205 | metadata/asf.c | 205 | metadata/asf.c |
diff --git a/apps/metadata/metadata_common.c b/apps/metadata/metadata_common.c index bde48d423b..6c420d921f 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) | |||
213 | return r; | 213 | return r; |
214 | } | 214 | } |
215 | 215 | ||
216 | #if CONFIG_CODEC == SWCODEC | ||
217 | /* Skip an ID3v2 tag if it can be found. We assume the tag is located at the | 216 | /* Skip an ID3v2 tag if it can be found. We assume the tag is located at the |
218 | * start of the file, which should be true in all cases where we need to skip it. | 217 | * start of the file, which should be true in all cases where we need to skip it. |
219 | * Returns true if successfully skipped or not skipped, and false if | 218 | * 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, | |||
360 | 359 | ||
361 | return len; | 360 | return len; |
362 | } | 361 | } |
363 | #endif | ||
diff --git a/apps/mp3data.c b/apps/mp3data.c index 89af49849f..31ed492679 100644 --- a/apps/mp3data.c +++ b/apps/mp3data.c | |||
@@ -213,6 +213,19 @@ static bool headers_have_same_type(unsigned long header1, | |||
213 | return header1 ? (header1 == header2) : true; | 213 | return header1 ? (header1 == header2) : true; |
214 | } | 214 | } |
215 | 215 | ||
216 | /* Helper function to read 4-byte in big endian format. */ | ||
217 | static void read_uint32be_mp3data(int fd, unsigned long *data, long *pos) | ||
218 | { | ||
219 | #ifdef ROCKBOX_BIG_ENDIAN | ||
220 | (void)read(fd, (char*)data, 4); | ||
221 | #else | ||
222 | char tmp[4]; | ||
223 | (void)read(fd, tmp, 4); | ||
224 | *data = (tmp[0]<<24) | (tmp[1]<<16) | (tmp[2]<<8) | tmp[3]; | ||
225 | #endif | ||
226 | *pos += 4; | ||
227 | } | ||
228 | |||
216 | static unsigned long __find_next_frame(int fd, long *offset, long max_offset, | 229 | static unsigned long __find_next_frame(int fd, long *offset, long max_offset, |
217 | unsigned long reference_header, | 230 | unsigned long reference_header, |
218 | int(*getfunc)(int fd, unsigned char *c), | 231 | int(*getfunc)(int fd, unsigned char *c), |
@@ -259,7 +272,8 @@ static unsigned long __find_next_frame(int fd, long *offset, long max_offset, | |||
259 | /* Read possible next frame header and seek back to last frame | 272 | /* Read possible next frame header and seek back to last frame |
260 | * headers byte position. */ | 273 | * headers byte position. */ |
261 | reference_header = 0; | 274 | reference_header = 0; |
262 | read_uint32be(fd, (uint32_t*)&reference_header); | 275 | read_uint32be_mp3data(fd, &reference_header, &pos); |
276 | // | ||
263 | lseek(fd, -info.frame_size, SEEK_CUR); | 277 | lseek(fd, -info.frame_size, SEEK_CUR); |
264 | 278 | ||
265 | /* If the current header is of the same type as the previous | 279 | /* If the current header is of the same type as the previous |