1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_FORMATS_MP4_SAMPLE_TO_GROUP_ITERATOR_H_
6 #define MEDIA_FORMATS_MP4_SAMPLE_TO_GROUP_ITERATOR_H_
10 #include "media/formats/mp4/box_definitions.h"
15 // Sample To Group Box ('sbgp') can be used to find the group that a sample
16 // belongs to and the associated description of that sample group. It is
17 // compactly coded though. This class implements the iterator to iterate
18 // through the compressed table to get the associated sample group description
20 class MEDIA_EXPORT SampleToGroupIterator
{
22 explicit SampleToGroupIterator(const SampleToGroup
& sample_to_group
);
23 ~SampleToGroupIterator();
25 // Advances the iterator to refer to the next sample. Return status
26 // indicating whether the sample is still valid.
29 // Returns whether the current sample is valid.
32 // Returns group description index for current sample.
33 uint32
group_description_index() const {
34 return iterator_
->group_description_index
;
38 // Track how many samples remaining for current table entry.
39 uint32 remaining_samples_
;
40 const std::vector
<SampleToGroupEntry
>& sample_to_group_table_
;
41 std::vector
<SampleToGroupEntry
>::const_iterator iterator_
;
43 DISALLOW_COPY_AND_ASSIGN(SampleToGroupIterator
);
49 #endif // MEDIA_FORMATS_MP4_SAMPLE_TO_GROUP_ITERATOR_H_