summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2009-08-10 20:08:53 +0200
committerGravatar waker <wakeroid@gmail.com>2009-08-10 20:08:53 +0200
commit38554844d56c75253a902698ad20efa662d221eb (patch)
treef128dc72637b8b64740dbc859b171bd1f44025a7
parent64afdee10e69f6deffb15b2741d6886e99006b9b (diff)
fixed cmp3 crashbug
-rw-r--r--cmp3.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmp3.c b/cmp3.c
index 30082ffd..01d3910b 100644
--- a/cmp3.c
+++ b/cmp3.c
@@ -62,6 +62,7 @@ cmp3_scan_stream2 (float position);
int
cmp3_init (struct playItem_s *it) {
+ printf ("opening file %s\n", it->fname);
buffer.file = fopen (it->fname, "rb");
if (!buffer.file) {
return -1;
@@ -74,9 +75,12 @@ cmp3_init (struct playItem_s *it) {
mad_timer_reset(&timer);
if (it->duration <= 0) {
- it->duration = cmp3_scan_stream (-1);
+ it->duration = cmp3_scan_stream (-1); // scan entire stream, calc duration
rewind (buffer.file);
}
+ else {
+ cmp3_scan_stream (0); // load up to 1st frame
+ }
mad_stream_init(&stream);
mad_frame_init(&frame);
mad_synth_init(&synth);