[Scummvm-cvs-logs] CVS: scummvm/sound audiostream.cpp,1.47,1.48 mixer.cpp,1.138,1.139 mp3.cpp,1.2,1.3 rate.cpp,1.29,1.30 vorbis.cpp,1.2,1.3 audiostream.h,1.24,1.25

Max Horn fingolfin at users.sourceforge.net
Thu Dec 18 17:31:02 CET 2003


Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv29710/sound

Modified Files:
	audiostream.cpp mixer.cpp mp3.cpp rate.cpp vorbis.cpp 
	audiostream.h 
Log Message:
distinguish between end of stream and end of data

Index: audiostream.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/audiostream.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- audiostream.cpp	19 Dec 2003 00:32:47 -0000	1.47
+++ audiostream.cpp	19 Dec 2003 01:30:19 -0000	1.48
@@ -82,7 +82,7 @@
 		return val;
 	}
 	bool isStereo() const		{ return stereo; }
-	bool eos() const			{ return eosIntern(); }
+	bool endOfData() const		{ return eosIntern(); }
 
 	int getRate() const			{ return _rate; }
 };
@@ -131,7 +131,8 @@
 
 	int16 read();
 	bool isStereo() const		{ return stereo; }
-	bool eos() const			{ return _finalized && eosIntern(); }
+	bool endOfStream() const	{ return _finalized && eosIntern(); }
+	bool endOfData() const		{ return eosIntern(); }
 
 	int getRate() const			{ return _rate; }
 
@@ -276,7 +277,7 @@
 		return *_pos++;
 	}
 	bool isStereo() const { return _isStereo; }
-	bool eos() const { return false; }
+	bool endOfData() const { return false; }
 	
 	int getRate() const { return _rate; }
 };

Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- mixer.cpp	19 Dec 2003 00:32:47 -0000	1.138
+++ mixer.cpp	19 Dec 2003 01:30:19 -0000	1.139
@@ -485,9 +485,11 @@
  */
 void Channel::mix(int16 *data, uint len) {
 	assert(_input);
-	if (_input->eos()) {
-		// TODO: call drain method
+
+	if (_input->endOfStream()) {
 		destroy();
+	} else if (_input->endOfData()) {
+		// TODO: call drain method
 	} else {
 		assert(_converter);
 

Index: mp3.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mp3.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mp3.cpp	19 Dec 2003 00:32:47 -0000	1.2
+++ mp3.cpp	19 Dec 2003 01:30:19 -0000	1.3
@@ -152,7 +152,7 @@
 	int readBuffer(int16 *buffer, const int numSamples);
 
 	int16 read();
-	bool eos() const			{ return eosIntern(); }
+	bool endOfData() const		{ return eosIntern(); }
 	bool isStereo() const		{ return _isStereo; }
 	
 	int getRate() const			{ return _frame.header.samplerate; }

Index: rate.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/rate.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- rate.cpp	8 Nov 2003 23:05:04 -0000	1.29
+++ rate.cpp	19 Dec 2003 01:30:19 -0000	1.30
@@ -200,7 +200,7 @@
 		int16 tmp[2];
 		st_size_t len = osamp;
 		assert(input.isStereo() == stereo);
-		while (!input.eos() && len--) {
+		while (!input.endOfData() && len--) {
 			tmp[0] = tmp[1] = input.read();
 			if (stereo)
 				tmp[reverseStereo ? 0 : 1] = input.read();

Index: vorbis.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/vorbis.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- vorbis.cpp	19 Dec 2003 00:32:47 -0000	1.2
+++ vorbis.cpp	19 Dec 2003 01:30:19 -0000	1.3
@@ -166,7 +166,7 @@
 	int readBuffer(int16 *buffer, const int numSamples);
 
 	int16 read();
-	bool eos() const			{ return eosIntern(); }
+	bool endOfData() const		{ return eosIntern(); }
 	bool isStereo() const		{ return _numChannels >= 2; }
 	
 	int getRate() const			{ return ov_info(_ov_file, -1)->rate; }

Index: audiostream.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/audiostream.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- audiostream.h	19 Dec 2003 00:32:47 -0000	1.24
+++ audiostream.h	19 Dec 2003 01:30:19 -0000	1.25
@@ -53,8 +53,24 @@
 	/** Is this a stereo stream? */
 	virtual bool isStereo() const = 0;
 	
-	/** End of stream reached? */
-	virtual bool eos() const = 0;
+	/**
+	 * End of data reached? If this returns true, it means that at this
+	 * time there is no data available in the stream. However there may be
+	 * more data in the future.
+	 * This is used by e.g. a rate converter to decide whether to keep on
+	 * converting data or stop.
+	 */
+	virtual bool endOfData() const = 0;
+	
+	/**
+	 * End of stream reached? If this returns true, it means that all data
+	 * in this stream is used up and no additional data will appear in it
+	 * in the future.
+	 * This is used by the mixer to decide whether a given stream shall be
+	 * removed from the list of active streams (and thus be destroyed).
+	 * By default this maps to endOfData()
+	 */
+	virtual bool endOfStream() const { return endOfData(); }
 
 	/** Sample rate of the stream. */
 	virtual int getRate() const = 0;





More information about the Scummvm-git-logs mailing list