• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <utils/Vector.h>
18 
19 namespace android {
20 
21 struct SampleTable;
22 
23 struct SampleIterator {
24     SampleIterator(SampleTable *table);
25 
26     status_t seekTo(uint32_t sampleIndex);
27 
getChunkIndexSampleIterator28     uint32_t getChunkIndex() const { return mCurrentChunkIndex; }
getDescIndexSampleIterator29     uint32_t getDescIndex() const { return mChunkDesc; }
getSampleOffsetSampleIterator30     off64_t getSampleOffset() const { return mCurrentSampleOffset; }
getSampleSizeSampleIterator31     size_t getSampleSize() const { return mCurrentSampleSize; }
getSampleTimeSampleIterator32     uint32_t getSampleTime() const { return mCurrentSampleTime; }
33 
34     status_t getSampleSizeDirect(
35             uint32_t sampleIndex, size_t *size);
36 
37 private:
38     SampleTable *mTable;
39 
40     bool mInitialized;
41 
42     uint32_t mSampleToChunkIndex;
43     uint32_t mFirstChunk;
44     uint32_t mFirstChunkSampleIndex;
45     uint32_t mStopChunk;
46     uint32_t mStopChunkSampleIndex;
47     uint32_t mSamplesPerChunk;
48     uint32_t mChunkDesc;
49 
50     uint32_t mCurrentChunkIndex;
51     off64_t mCurrentChunkOffset;
52     Vector<size_t> mCurrentChunkSampleSizes;
53 
54     uint32_t mTimeToSampleIndex;
55     uint32_t mTTSSampleIndex;
56     uint32_t mTTSSampleTime;
57     uint32_t mTTSCount;
58     uint32_t mTTSDuration;
59 
60     uint32_t mCurrentSampleIndex;
61     off64_t mCurrentSampleOffset;
62     size_t mCurrentSampleSize;
63     uint32_t mCurrentSampleTime;
64 
65     void reset();
66     status_t findChunkRange(uint32_t sampleIndex);
67     status_t getChunkOffset(uint32_t chunk, off64_t *offset);
68     status_t findSampleTime(uint32_t sampleIndex, uint32_t *time);
69 
70     SampleIterator(const SampleIterator &);
71     SampleIterator &operator=(const SampleIterator &);
72 };
73 
74 }  // namespace android
75 
76