diff options
Diffstat (limited to 'apps/codecs/mpa.c')
-rw-r--r-- | apps/codecs/mpa.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c index c9e2131450..ac81f06cab 100644 --- a/apps/codecs/mpa.c +++ b/apps/codecs/mpa.c | |||
@@ -144,6 +144,7 @@ static void set_elapsed(struct mp3entry* id3) | |||
144 | { | 144 | { |
145 | unsigned long offset = id3->offset > id3->first_frame_offset ? | 145 | unsigned long offset = id3->offset > id3->first_frame_offset ? |
146 | id3->offset - id3->first_frame_offset : 0; | 146 | id3->offset - id3->first_frame_offset : 0; |
147 | unsigned long elapsed = id3->elapsed; | ||
147 | 148 | ||
148 | if ( id3->vbr ) { | 149 | if ( id3->vbr ) { |
149 | if ( id3->has_toc ) { | 150 | if ( id3->has_toc ) { |
@@ -172,27 +173,28 @@ static void set_elapsed(struct mp3entry* id3) | |||
172 | /* set time for this percent (divide before multiply to prevent | 173 | /* set time for this percent (divide before multiply to prevent |
173 | overflow on long files. loss of precision is negligible on | 174 | overflow on long files. loss of precision is negligible on |
174 | short files) */ | 175 | short files) */ |
175 | id3->elapsed = i * (id3->length / 100); | 176 | elapsed = i * (id3->length / 100); |
176 | 177 | ||
177 | /* calculate remainder time */ | 178 | /* calculate remainder time */ |
178 | plen = (nextpos - relpos) * (id3->filesize / 256); | 179 | plen = (nextpos - relpos) * (id3->filesize / 256); |
179 | id3->elapsed += (((remainder * 100) / plen) * | 180 | elapsed += (((remainder * 100) / plen) * (id3->length / 10000)); |
180 | (id3->length / 10000)); | ||
181 | } | 181 | } |
182 | else { | 182 | else { |
183 | /* no TOC exists. set a rough estimate using average bitrate */ | 183 | /* no TOC exists. set a rough estimate using average bitrate */ |
184 | int tpk = id3->length / | 184 | int tpk = id3->length / |
185 | ((id3->filesize - id3->first_frame_offset - id3->id3v1len) / | 185 | ((id3->filesize - id3->first_frame_offset - id3->id3v1len) / |
186 | 1024); | 186 | 1024); |
187 | id3->elapsed = offset / 1024 * tpk; | 187 | elapsed = offset / 1024 * tpk; |
188 | } | 188 | } |
189 | } | 189 | } |
190 | else | 190 | else |
191 | { | 191 | { |
192 | /* constant bitrate, use exact calculation */ | 192 | /* constant bitrate, use exact calculation */ |
193 | if (id3->bitrate != 0) | 193 | if (id3->bitrate != 0) |
194 | id3->elapsed = offset / (id3->bitrate / 8); | 194 | elapsed = offset / (id3->bitrate / 8); |
195 | } | 195 | } |
196 | |||
197 | ci->set_elapsed(elapsed); | ||
196 | } | 198 | } |
197 | 199 | ||
198 | #ifdef MPA_SYNTH_ON_COP | 200 | #ifdef MPA_SYNTH_ON_COP |