aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorMatthew Hoops2011-05-13 02:22:11 -0400
committerMatthew Hoops2011-05-13 02:22:11 -0400
commitbc7ff278281f46a77ba955d6f5fa20dab611bd90 (patch)
tree5167f74fd401b5e8e11aec0f5164c57bd4e127fb /audio
parentd2f5b91a9a2da6b6d8a31b0bd503dc79d8397f00 (diff)
downloadscummvm-rg350-bc7ff278281f46a77ba955d6f5fa20dab611bd90.tar.gz
scummvm-rg350-bc7ff278281f46a77ba955d6f5fa20dab611bd90.tar.bz2
scummvm-rg350-bc7ff278281f46a77ba955d6f5fa20dab611bd90.zip
AUDIO: Fix QuickTime stereo audio seeking
Diffstat (limited to 'audio')
-rw-r--r--audio/decoders/quicktime.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/audio/decoders/quicktime.cpp b/audio/decoders/quicktime.cpp
index e80c2b592c..bdde9db883 100644
--- a/audio/decoders/quicktime.cpp
+++ b/audio/decoders/quicktime.cpp
@@ -305,7 +305,7 @@ void QuickTimeAudioDecoder::setAudioStreamPos(const Timestamp &where) {
// First, we need to track down what audio sample we need
Audio::Timestamp curAudioTime = where.convertToFramerate(_streams[_audioStreamIndex]->time_scale);
- uint32 sample = curAudioTime.totalNumberOfFrames() / entry->channels;
+ uint32 sample = curAudioTime.totalNumberOfFrames();
uint32 seekSample = sample;
if (!isOldDemuxing()) {
@@ -316,6 +316,8 @@ void QuickTimeAudioDecoder::setAudioStreamPos(const Timestamp &where) {
return;
}
+ // Note that duration is in terms of *one* channel
+ // This eases calculation a bit
seekSample /= _streams[_audioStreamIndex]->stts_data[0].duration;
}
@@ -336,7 +338,7 @@ void QuickTimeAudioDecoder::setAudioStreamPos(const Timestamp &where) {
if (sample != totalSamples) {
// HACK: Skip a certain amount of samples from the stream
// (There's got to be a better way to do this!)
- int skipSamples = (sample - totalSamples) * ((AudioSampleDesc *)_streams[_audioStreamIndex]->sampleDescs[0])->channels;
+ int skipSamples = (sample - totalSamples) * entry->channels;
int16 *tempBuffer = new int16[skipSamples];
_audStream->readBuffer(tempBuffer, skipSamples);