[Scummvm-cvs-logs] CVS: scummvm/sound audiostream.cpp,1.28,1.29
Max Horn
fingolfin at users.sourceforge.net
Tue Aug 5 04:31:03 CEST 2003
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv21642
Modified Files:
audiostream.cpp
Log Message:
fix bug #783423
Index: audiostream.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/audiostream.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- audiostream.cpp 5 Aug 2003 01:22:09 -0000 1.28
+++ audiostream.cpp 5 Aug 2003 11:30:13 -0000 1.29
@@ -214,10 +214,9 @@
File *_file;
byte *_ptr;
int _rate;
- bool _initialized;
bool init();
- void refill();
+ void refill(bool first = false);
inline int16 readIntern();
inline bool eosIntern() const;
public:
@@ -260,7 +259,7 @@
_ptr = (byte *)malloc(_bufferSize + MAD_BUFFER_GUARD);
_rate = 0;
- _initialized = init();
+ init();
// If a size is specified, we do not perform any further read operations
if (size) {
@@ -291,7 +290,7 @@
mad_stream_buffer(&_stream, _ptr, _size);
// Read in initial data
- refill();
+ refill(true);
// Check the header, determine if this is a stereo stream
int num;
@@ -316,7 +315,7 @@
return true;
}
-void MP3InputStream::refill() {
+void MP3InputStream::refill(bool first) {
// Read the next frame (may have to retry several times, e.g.
// to skip over ID3 information).
@@ -363,7 +362,7 @@
mad_timer_negate(&frame_duration);
mad_timer_add(&_duration, frame_duration);
- if (mad_timer_compare(_duration, mad_timer_zero) <= 0)
+ if (!first && _file && mad_timer_compare(_duration, mad_timer_zero) <= 0)
_size = -1; // Mark for EOF
// Synthesise the frame into PCM samples and reset the buffer position
More information about the Scummvm-git-logs
mailing list