Mercurial > audlegacy-plugins
comparison src/madplug/decoder.c @ 997:e46b98155d5d trunk
[svn] - fix a bug which counts number of frames twice in handling xing header.
- now fileinfo dialog calculates play length even though TLEN tag exists so that it can overwrite wrong TLEN tag.
author | yaz |
---|---|
date | Tue, 01 May 2007 12:49:27 -0700 |
parents | 6ba4a4bfd127 |
children | 29519d604e8c |
comparison
equal
deleted
inserted
replaced
996:34da98fd7d26 | 997:e46b98155d5d |
---|---|
189 | 189 |
190 info->bitrate = 0; | 190 info->bitrate = 0; |
191 info->pos = mad_timer_zero; | 191 info->pos = mad_timer_zero; |
192 info->duration = mad_timer_zero; // should be cleared before loop, if we use it as break condition. | 192 info->duration = mad_timer_zero; // should be cleared before loop, if we use it as break condition. |
193 | 193 |
194 if(info->fileinfo_request == TRUE) { | |
195 info->tuple->length = -1; | |
196 info->fileinfo_request = FALSE; | |
197 } | |
198 | |
194 #ifdef DEBUG | 199 #ifdef DEBUG |
195 g_message("f: scan_file"); | 200 g_message("f: scan_file"); |
196 g_message("scan_file frames = %d", info->frames); | 201 g_message("scan_file frames = %d", info->frames); |
197 #endif /* DEBUG */ | 202 #endif /* DEBUG */ |
198 | 203 |
292 #ifdef DEBUG | 297 #ifdef DEBUG |
293 g_message("xing header found "); | 298 g_message("xing header found "); |
294 #endif /* DEBUG */ | 299 #endif /* DEBUG */ |
295 has_xing = TRUE; | 300 has_xing = TRUE; |
296 info->vbr = TRUE; /* otherwise xing header would have been 'Info' */ | 301 info->vbr = TRUE; /* otherwise xing header would have been 'Info' */ |
297 info->frames = info->xing.frames; | 302 if(info->tuple->length == -1) { |
298 if(info->tuple->length == -1) | 303 info->duration = mad_timer_zero; |
299 mad_timer_multiply(&info->duration, info->frames); | 304 mad_timer_multiply(&info->duration, info->xing.frames); |
305 } | |
300 else { | 306 else { |
301 info->duration.seconds = info->tuple->length / 1000; | 307 info->duration.seconds = info->tuple->length / 1000; |
302 info->duration.fraction = info->tuple->length % 1000; | 308 info->duration.fraction = info->tuple->length % 1000; |
303 } | 309 } |
304 | 310 |
375 } | 381 } |
376 } /* while */ | 382 } /* while */ |
377 if (stream.error != MAD_ERROR_BUFLEN) | 383 if (stream.error != MAD_ERROR_BUFLEN) |
378 break; | 384 break; |
379 } | 385 } |
386 | |
387 if (info->xing.frames) | |
388 info->frames = info->xing.frames; | |
380 | 389 |
381 if (info->vbr && xing_bitrate != 0) { | 390 if (info->vbr && xing_bitrate != 0) { |
382 info->bitrate = xing_bitrate; | 391 info->bitrate = xing_bitrate; |
383 } | 392 } |
384 else if (info->vbr && xing_bitrate == 0 && bitrate_frames != 0) { | 393 else if (info->vbr && xing_bitrate == 0 && bitrate_frames != 0) { |