diff options
Diffstat (limited to 'firmware/id3.c')
-rw-r--r-- | firmware/id3.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/firmware/id3.c b/firmware/id3.c index 1fad5ce8d3..fc4e1c11ac 100644 --- a/firmware/id3.c +++ b/firmware/id3.c | |||
@@ -109,7 +109,7 @@ struct tag_resolver { | |||
109 | int (*ppFunc)(struct mp3entry*, char* tag, int bufferpos); | 109 | int (*ppFunc)(struct mp3entry*, char* tag, int bufferpos); |
110 | }; | 110 | }; |
111 | 111 | ||
112 | static bool global_ff_found = false; | 112 | static bool global_ff_found; |
113 | 113 | ||
114 | static int unsynchronize(char* tag, int len, bool *ff_found) | 114 | static int unsynchronize(char* tag, int len, bool *ff_found) |
115 | { | 115 | { |
@@ -146,7 +146,7 @@ static int unsynchronize_frame(char* tag, int len) | |||
146 | return unsynchronize(tag, len, &ff_found); | 146 | return unsynchronize(tag, len, &ff_found); |
147 | } | 147 | } |
148 | 148 | ||
149 | static int read_unsynched(int fd, void *buf, int len, bool reset) | 149 | static int read_unsynched(int fd, void *buf, int len) |
150 | { | 150 | { |
151 | int i; | 151 | int i; |
152 | int rc; | 152 | int rc; |
@@ -154,9 +154,6 @@ static int read_unsynched(int fd, void *buf, int len, bool reset) | |||
154 | char *wp; | 154 | char *wp; |
155 | char *rp; | 155 | char *rp; |
156 | 156 | ||
157 | if(reset) | ||
158 | global_ff_found = false; | ||
159 | |||
160 | wp = buf; | 157 | wp = buf; |
161 | 158 | ||
162 | while(remaining) { | 159 | while(remaining) { |
@@ -173,16 +170,13 @@ static int read_unsynched(int fd, void *buf, int len, bool reset) | |||
173 | return len; | 170 | return len; |
174 | }; | 171 | }; |
175 | 172 | ||
176 | static int skip_unsynched(int fd, int len, bool reset) | 173 | static int skip_unsynched(int fd, int len) |
177 | { | 174 | { |
178 | int rc; | 175 | int rc; |
179 | int remaining = len; | 176 | int remaining = len; |
180 | int rlen; | 177 | int rlen; |
181 | char buf[32]; | 178 | char buf[32]; |
182 | 179 | ||
183 | if(reset) | ||
184 | global_ff_found = false; | ||
185 | |||
186 | while(remaining) { | 180 | while(remaining) { |
187 | rlen = MIN(sizeof(buf), (unsigned int)remaining); | 181 | rlen = MIN(sizeof(buf), (unsigned int)remaining); |
188 | rc = read(fd, buf, rlen); | 182 | rc = read(fd, buf, rlen); |
@@ -425,6 +419,8 @@ static void setid3v2title(int fd, struct mp3entry *entry) | |||
425 | int i; | 419 | int i; |
426 | int rc; | 420 | int rc; |
427 | 421 | ||
422 | global_ff_found = false; | ||
423 | |||
428 | /* Bail out if the tag is shorter than 10 bytes */ | 424 | /* Bail out if the tag is shorter than 10 bytes */ |
429 | if(entry->id3v2len < 10) | 425 | if(entry->id3v2len < 10) |
430 | return; | 426 | return; |
@@ -493,7 +489,7 @@ static void setid3v2title(int fd, struct mp3entry *entry) | |||
493 | /* Read frame header and check length */ | 489 | /* Read frame header and check length */ |
494 | if(version >= ID3_VER_2_3) { | 490 | if(version >= ID3_VER_2_3) { |
495 | if(global_unsynch && version <= ID3_VER_2_3) | 491 | if(global_unsynch && version <= ID3_VER_2_3) |
496 | rc = read_unsynched(fd, header, 10, false); | 492 | rc = read_unsynched(fd, header, 10); |
497 | else | 493 | else |
498 | rc = read(fd, header, 10); | 494 | rc = read(fd, header, 10); |
499 | if(rc != 10) | 495 | if(rc != 10) |
@@ -596,7 +592,7 @@ static void setid3v2title(int fd, struct mp3entry *entry) | |||
596 | /* found a tag matching one in tagList, and not yet filled */ | 592 | /* found a tag matching one in tagList, and not yet filled */ |
597 | if(global_unsynch && version <= ID3_VER_2_3) | 593 | if(global_unsynch && version <= ID3_VER_2_3) |
598 | bytesread = read_unsynched(fd, buffer + bufferpos, | 594 | bytesread = read_unsynched(fd, buffer + bufferpos, |
599 | framelen, false); | 595 | framelen); |
600 | else | 596 | else |
601 | bytesread = read(fd, buffer + bufferpos, framelen); | 597 | bytesread = read(fd, buffer + bufferpos, framelen); |
602 | 598 | ||
@@ -624,7 +620,7 @@ static void setid3v2title(int fd, struct mp3entry *entry) | |||
624 | skip it using the total size */ | 620 | skip it using the total size */ |
625 | 621 | ||
626 | if(global_unsynch && version <= ID3_VER_2_3) { | 622 | if(global_unsynch && version <= ID3_VER_2_3) { |
627 | skip_unsynched(fd, totframelen, false); | 623 | skip_unsynched(fd, totframelen); |
628 | } else { | 624 | } else { |
629 | if(data_length_ind) | 625 | if(data_length_ind) |
630 | totframelen = data_length_ind; | 626 | totframelen = data_length_ind; |