[Scummvm-cvs-logs] scummvm master -> df88a1f2a79faabeabb90c66de4f1404dc12f3ea
clone2727
clone2727 at gmail.com
Thu Dec 29 20:51:00 CET 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
df88a1f2a7 AUDIO: Fix M4A seeking with multiple time->sample chunks
Commit: df88a1f2a79faabeabb90c66de4f1404dc12f3ea
https://github.com/scummvm/scummvm/commit/df88a1f2a79faabeabb90c66de4f1404dc12f3ea
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-12-29T11:50:05-08:00
Commit Message:
AUDIO: Fix M4A seeking with multiple time->sample chunks
Changed paths:
audio/decoders/quicktime.cpp
diff --git a/audio/decoders/quicktime.cpp b/audio/decoders/quicktime.cpp
index 621964c..dcf80ea 100644
--- a/audio/decoders/quicktime.cpp
+++ b/audio/decoders/quicktime.cpp
@@ -230,16 +230,23 @@ void QuickTimeAudioDecoder::setAudioStreamPos(const Timestamp &where) {
uint32 seekSample = sample;
if (!isOldDemuxing()) {
- // We shouldn't have audio samples that are a different duration
- // That would be quite bad!
- if (_tracks[_audioTrackIndex]->timeToSampleCount != 1) {
- warning("Failed seeking");
- return;
- }
+ // For MPEG-4 style demuxing, we need to track down the sample based on the time
+ // The old style demuxing doesn't require this because each "sample"'s duration
+ // is just 1
+ uint32 curSample = 0;
+ seekSample = 0;
+
+ for (int32 i = 0; i < _tracks[_audioTrackIndex]->timeToSampleCount; i++) {
+ uint32 sampleCount = _tracks[_audioTrackIndex]->timeToSample[i].count * _tracks[_audioTrackIndex]->timeToSample[i].duration;
+
+ if (sample < curSample + sampleCount) {
+ seekSample += (sample - curSample) / _tracks[_audioTrackIndex]->timeToSample[i].duration;
+ break;
+ }
- // Note that duration is in terms of *one* channel
- // This eases calculation a bit
- seekSample /= _tracks[_audioTrackIndex]->timeToSample[0].duration;
+ seekSample += _tracks[_audioTrackIndex]->timeToSample[i].count;
+ curSample += sampleCount;
+ }
}
// Now to track down what chunk it's in
More information about the Scummvm-git-logs
mailing list