diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/SOURCES | 2 | ||||
-rw-r--r-- | apps/metadata/metadata_common.c | 62 |
2 files changed, 32 insertions, 32 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index c122427900..b5f7a1d9f1 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 | #if CONFIG_CODEC == SWCODEC | ||
202 | metadata/metadata_common.c | 201 | metadata/metadata_common.c |
202 | #if CONFIG_CODEC == SWCODEC | ||
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 ae6b245616..bde48d423b 100644 --- a/apps/metadata/metadata_common.c +++ b/apps/metadata/metadata_common.c | |||
@@ -31,35 +31,6 @@ | |||
31 | #include "replaygain.h" | 31 | #include "replaygain.h" |
32 | #include "misc.h" | 32 | #include "misc.h" |
33 | 33 | ||
34 | /* Skip an ID3v2 tag if it can be found. We assume the tag is located at the | ||
35 | * start of the file, which should be true in all cases where we need to skip it. | ||
36 | * Returns true if successfully skipped or not skipped, and false if | ||
37 | * something went wrong while skipping. | ||
38 | */ | ||
39 | bool skip_id3v2(int fd, struct mp3entry *id3) | ||
40 | { | ||
41 | char buf[4]; | ||
42 | |||
43 | read(fd, buf, 4); | ||
44 | if (memcmp(buf, "ID3", 3) == 0) | ||
45 | { | ||
46 | /* We have found an ID3v2 tag at the start of the file - find its | ||
47 | length and then skip it. */ | ||
48 | if ((id3->first_frame_offset = getid3v2len(fd)) == 0) | ||
49 | return false; | ||
50 | |||
51 | if ((lseek(fd, id3->first_frame_offset, SEEK_SET) < 0)) | ||
52 | return false; | ||
53 | |||
54 | return true; | ||
55 | } else { | ||
56 | lseek(fd, 0, SEEK_SET); | ||
57 | id3->first_frame_offset = 0; | ||
58 | return true; | ||
59 | } | ||
60 | } | ||
61 | |||
62 | |||
63 | /* Read a string from the file. Read up to size bytes, or, if eos != -1, | 34 | /* Read a string from the file. Read up to size bytes, or, if eos != -1, |
64 | * until the eos character is found (eos is not stored in buf, unless it is | 35 | * until the eos character is found (eos is not stored in buf, unless it is |
65 | * nil). Writes up to buf_size chars to buf, always terminating with a nil. | 36 | * nil). Writes up to buf_size chars to buf, always terminating with a nil. |
@@ -241,7 +212,36 @@ unsigned long get_itunes_int32(char* value, int count) | |||
241 | 212 | ||
242 | return r; | 213 | return r; |
243 | } | 214 | } |
244 | 215 | ||
216 | #if CONFIG_CODEC == SWCODEC | ||
217 | /* 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. | ||
219 | * Returns true if successfully skipped or not skipped, and false if | ||
220 | * something went wrong while skipping. | ||
221 | */ | ||
222 | bool skip_id3v2(int fd, struct mp3entry *id3) | ||
223 | { | ||
224 | char buf[4]; | ||
225 | |||
226 | read(fd, buf, 4); | ||
227 | if (memcmp(buf, "ID3", 3) == 0) | ||
228 | { | ||
229 | /* We have found an ID3v2 tag at the start of the file - find its | ||
230 | length and then skip it. */ | ||
231 | if ((id3->first_frame_offset = getid3v2len(fd)) == 0) | ||
232 | return false; | ||
233 | |||
234 | if ((lseek(fd, id3->first_frame_offset, SEEK_SET) < 0)) | ||
235 | return false; | ||
236 | |||
237 | return true; | ||
238 | } else { | ||
239 | lseek(fd, 0, SEEK_SET); | ||
240 | id3->first_frame_offset = 0; | ||
241 | return true; | ||
242 | } | ||
243 | } | ||
244 | |||
245 | /* Parse the tag (the name-value pair) and fill id3 and buffer accordingly. | 245 | /* Parse the tag (the name-value pair) and fill id3 and buffer accordingly. |
246 | * String values to keep are written to buf. Returns number of bytes written | 246 | * String values to keep are written to buf. Returns number of bytes written |
247 | * to buf (including end nil). | 247 | * to buf (including end nil). |
@@ -360,4 +360,4 @@ long parse_tag(const char* name, char* value, struct mp3entry* id3, | |||
360 | 360 | ||
361 | return len; | 361 | return len; |
362 | } | 362 | } |
363 | 363 | #endif | |