diff --git a/src/mpg123/mpg123.c b/src/mpg123/mpg123.c index 636dc5d..8f41939 100644 --- a/src/mpg123/mpg123.c +++ b/src/mpg123/mpg123.c @@ -36,6 +36,8 @@ #include #include +#include + /* Define to read all frame headers when calculating file length */ /* #define FULL_SCAN */ @@ -284,6 +286,7 @@ static bool_t mpg123_playback_worker (const char * filename, VFSFile * file) set_format (ctx.decoder); + printf ("trying to play %s\n", filename); if (mpg123_open_handle (ctx.decoder, file) < 0) { OPEN_ERROR: @@ -321,16 +324,27 @@ GET_FORMAT: if (! aud_input_open_audio (FMT_FLOAT, ctx.rate, ctx.channels)) { + printf ("open_audio error\n"); error = TRUE; goto cleanup; } - while (! aud_input_check_stop ()) + int total_bytes_written = 0; + + printf ("entering play loop\n"); + while (1) { + if (aud_input_check_stop ()) + { + printf ("stopped manually\n"); + break; + } + int seek = aud_input_check_seek (); if (seek >= 0) { + printf ("seeking to %d\n", seek); if (mpg123_seek (ctx.decoder, (int64_t) seek * ctx.rate / 1000, SEEK_SET) < 0) print_mpg123_error (filename, ctx.decoder); @@ -360,6 +374,8 @@ GET_FORMAT: if (! outbuf_size && (ret = mpg123_read (ctx.decoder, (void *) outbuf, sizeof outbuf, & outbuf_size)) < 0) { + printf ("mpg123_read returned %d\n", ret); + printf ("total bytes written: %d\n", total_bytes_written); if (ret == MPG123_DONE || ret == MPG123_ERR_READER) break; @@ -375,12 +391,14 @@ GET_FORMAT: { error_count = 0; + total_bytes_written += outbuf_size; aud_input_write_audio (outbuf, outbuf_size); outbuf_size = 0; } } cleanup: + printf ("playback done\n"); mpg123_delete(ctx.decoder); if (ctx.tu) tuple_unref (ctx.tu);