~ubuntu-branches/ubuntu/raring/scummvm/raring

« back to all changes in this revision

Viewing changes to audio/decoders/quicktime.cpp

  • Committer: Package Import Robot
  • Author(s): Moritz Muehlenhoff
  • Date: 2012-01-14 11:39:15 UTC
  • mfrom: (21.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20120114113915-hy9kyzbyncrqen3y
Tags: 1.4.1-1
* New upstream release
* Install translations.dat into scummvm-data    

Show diffs side-by-side

added added

removed removed

Lines of Context:
227
227
        uint32 seekSample = sample;
228
228
 
229
229
        if (!isOldDemuxing()) {
230
 
                // We shouldn't have audio samples that are a different duration
231
 
                // That would be quite bad!
232
 
                if (_tracks[_audioTrackIndex]->timeToSampleCount != 1) {
233
 
                        warning("Failed seeking");
234
 
                        return;
 
230
                // For MPEG-4 style demuxing, we need to track down the sample based on the time
 
231
                // The old style demuxing doesn't require this because each "sample"'s duration
 
232
                // is just 1
 
233
                uint32 curSample = 0;
 
234
                seekSample = 0;
 
235
 
 
236
                for (int32 i = 0; i < _tracks[_audioTrackIndex]->timeToSampleCount; i++) {
 
237
                        uint32 sampleCount = _tracks[_audioTrackIndex]->timeToSample[i].count * _tracks[_audioTrackIndex]->timeToSample[i].duration;
 
238
 
 
239
                        if (sample < curSample + sampleCount) {
 
240
                                seekSample += (sample - curSample) / _tracks[_audioTrackIndex]->timeToSample[i].duration;
 
241
                                break;
 
242
                        }
 
243
 
 
244
                        seekSample += _tracks[_audioTrackIndex]->timeToSample[i].count;
 
245
                        curSample += sampleCount;
235
246
                }
236
 
 
237
 
                // Note that duration is in terms of *one* channel
238
 
                // This eases calculation a bit
239
 
                seekSample /= _tracks[_audioTrackIndex]->timeToSample[0].duration;
240
247
        }
241
248
 
242
249
        // Now to track down what chunk it's in