Enabled looping for libmpg123

This commit is contained in:
bart@bart
2009-08-21 16:30:39 +02:00
parent d610cecc20
commit ae43b28ac4
+10 -2
View File
@@ -102,23 +102,31 @@ namespace lullaby
// If we're done, then EOF. If some error occurred, pretend we EOF'd. // If we're done, then EOF. If some error occurred, pretend we EOF'd.
if (r == MPG123_DONE || r != MPG123_OK) if (r == MPG123_DONE || r != MPG123_OK)
{
if ( r == MPG123_NEED_MORE )
{
size_t numbytes = 0;
mpg123_decode(handle, (unsigned char*) data->getData(), data->getSize(), (unsigned char*) buffer, bufferSize, &numbytes);
}
else
{ {
eof = true; eof = true;
numbytes = 0; numbytes = 0;
} }
}
return numbytes; return numbytes;
} }
bool Mpg123Decoder::seek(int ms) bool Mpg123Decoder::seek(int ms)
{ {
mpg123_seek(handle, SEEK_SET, ms); mpg123_seek(handle, ms, SEEK_SET);
return true; return true;
} }
bool Mpg123Decoder::rewind() bool Mpg123Decoder::rewind()
{ {
if(mpg123_seek(handle, SEEK_SET, 0) < 0) if(mpg123_seek(handle, 0, SEEK_SET) < 0)
return false; return false;
return true; return true;
} }