[Scummvm-cvs-logs] SF.net SVN: scummvm:[47085] scummvm/trunk/sound

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Wed Jan 6 17:11:24 CET 2010


Revision: 47085
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47085&view=rev
Author:   lordhoto
Date:     2010-01-06 16:11:21 +0000 (Wed, 06 Jan 2010)

Log Message:
-----------
Adapt FLAC and Vorbis to use calculateSampleOffset in their seek implementation.

Modified Paths:
--------------
    scummvm/trunk/sound/flac.cpp
    scummvm/trunk/sound/vorbis.cpp

Modified: scummvm/trunk/sound/flac.cpp
===================================================================
--- scummvm/trunk/sound/flac.cpp	2010-01-06 16:09:57 UTC (rev 47084)
+++ scummvm/trunk/sound/flac.cpp	2010-01-06 16:11:21 UTC (rev 47085)
@@ -335,9 +335,7 @@
 bool FlacInputStream::seek(const Timestamp &where) {
 	_sampleCache.bufFill = 0;
 	_sampleCache.bufReadPos = NULL;
-	// Compute the start/end sample (we use floating point arithmetics here to
-	// avoid overflows).
-	return seekAbsolute((FLAC__uint64)(where.msecs() * (_streaminfo.sample_rate / 1000.0)));
+	return seekAbsolute((FLAC__uint64)calculateSampleOffset(where, _streaminfo.sample_rate));
 }
 
 int FlacInputStream::readBuffer(int16 *buffer, const int numSamples) {

Modified: scummvm/trunk/sound/vorbis.cpp
===================================================================
--- scummvm/trunk/sound/vorbis.cpp	2010-01-06 16:09:57 UTC (rev 47084)
+++ scummvm/trunk/sound/vorbis.cpp	2010-01-06 16:11:21 UTC (rev 47085)
@@ -240,14 +240,8 @@
 }
 
 bool VorbisInputStream::seek(const Timestamp &where) {
-#ifdef USE_TREMOR
-	ogg_int64_t pos = where.msecs();
-#else
-	double pos = where.msecs() / 1000.0;
-#endif
-
-	int res = ov_time_seek(&_ovFile, pos);
-	if (res < 0) {
+	int res = ov_pcm_seek(&_ovFile, calculateSampleOffset(where, getRate()));
+	if (res) {
 		warning("Error seeking in Vorbis stream (%d)", res);
 		_pos = _bufferEnd;
 		return false;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list