summaryrefslogtreecommitdiff
path: root/junklib.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-09-26 16:43:17 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-09-26 16:43:17 +0200
commit859a5adb43a05c84e5c6bec2e18f9946391f7c62 (patch)
tree455713123cad238a4bb1ba1e5b50c13e9c9f95fb /junklib.c
parentbab6c3996fbe77709a09693d3c53dca356f4e8b2 (diff)
changed mp3 tag priority to ape->id3v2->id3v1
Diffstat (limited to 'junklib.c')
-rw-r--r--junklib.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/junklib.c b/junklib.c
index 3eb633ab..0169e1a8 100644
--- a/junklib.c
+++ b/junklib.c
@@ -501,7 +501,7 @@ junk_read_ape (playItem_t *it, FILE *fp) {
// try to read footer, position must be already at the EOF right before
// id3v1 (if present)
uint8_t header[32];
- if (fseek (fp, -32, SEEK_CUR) == -1) {
+ if (fseek (fp, -32, SEEK_END) == -1) {
return -1; // something bad happened
}
@@ -509,7 +509,16 @@ junk_read_ape (playItem_t *it, FILE *fp) {
return -1; // something bad happened
}
if (strncmp (header, "APETAGEX", 8)) {
- return -1; // no ape tag here
+ // try to skip 128 bytes backwards (id3v1)
+ if (fseek (fp, -128-32, SEEK_END) == -1) {
+ return -1; // something bad happened
+ }
+ if (fread (header, 1, 32, fp) != 32) {
+ return -1; // something bad happened
+ }
+ if (strncmp (header, "APETAGEX", 8)) {
+ return -1; // no ape tag here
+ }
}
// end of footer must be 0