diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2007-07-05 11:47:28 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2007-07-05 11:47:28 +0000 |
| commit | 296db6bd740c8aa0a2c4536449589c1019bca5db (patch) | |
| tree | d75f4b90184713fd6a778729cb675dd83e827fcc /lib | |
| parent | 8cbd1444b5f766b0cd03e953defc126311a8d915 (diff) | |
| download | qmmp-296db6bd740c8aa0a2c4536449589c1019bca5db.tar.gz qmmp-296db6bd740c8aa0a2c4536449589c1019bca5db.tar.bz2 qmmp-296db6bd740c8aa0a2c4536449589c1019bca5db.zip | |
various fixes in Ogg Vorbis plugin
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@21 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/qmmp/Input/vorbis/decoder_vorbis.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/qmmp/Input/vorbis/decoder_vorbis.cpp b/lib/qmmp/Input/vorbis/decoder_vorbis.cpp index 9555d6e6a..34ba9ae8f 100644 --- a/lib/qmmp/Input/vorbis/decoder_vorbis.cpp +++ b/lib/qmmp/Input/vorbis/decoder_vorbis.cpp @@ -166,6 +166,7 @@ void DecoderVorbis::flush(bool final) bool DecoderVorbis::initialize() { + qDebug("DecoderVorbis: initialize"); bks = blockSize(); inited = user_stop = done = finish = FALSE; @@ -174,10 +175,9 @@ bool DecoderVorbis::initialize() output_size = 0; seekTime = -1.0; totalTime = 0.0; - if (! input()) { - error("DecoderVorbis: cannot initialize. No input."); + qDebug("DecoderVorbis: cannot initialize. No input"); return FALSE; } @@ -189,11 +189,10 @@ bool DecoderVorbis::initialize() if (! input()->isOpen()) { - //if (! input()->open(IO_ReadOnly)) { if (! input()->open(QIODevice::ReadOnly)) { - //error("DecoderVorbis: Failed to open input. Error " + - // QString::number(input()->status()) + "."); + qWarning(qPrintable("DecoderVorbis: failed to open input. " + + input()->errorString () + ".")); return FALSE; } } @@ -207,7 +206,7 @@ bool DecoderVorbis::initialize() }; if (ov_open_callbacks(this, &oggfile, NULL, 0, oggcb) < 0) { - error("DecoderVorbis: Cannot open stream."); + qWarning("DecoderVorbis: cannot open stream"); return FALSE; } @@ -251,8 +250,8 @@ void DecoderVorbis::seek(double pos) void DecoderVorbis::deinit() { - ov_clear(&oggfile); - + if(inited) + ov_clear(&oggfile); inited = user_stop = done = finish = FALSE; len = freq = bitrate = 0; stat = chan = 0; @@ -297,10 +296,12 @@ void DecoderVorbis::run() output_size = long(ov_time_tell(&oggfile)) * long(freq * chan * 2); } - - len = ov_read(&oggfile, (char *) (output_buf + output_at), bks, 0, 2, 1, - §ion); - + len = -1; + while(len < 0) + { + len = ov_read(&oggfile, (char *) (output_buf + output_at), bks, 0, 2, 1, + §ion); + } if (len > 0) { bitrate = ov_bitrate_instant(&oggfile) / 1000; |
