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 #include "media/formats/mp4/sample_to_group_iterator.h"
7 #include "base/logging.h"
12 SampleToGroupIterator::SampleToGroupIterator(
13 const SampleToGroup
& sample_to_group
)
14 : remaining_samples_(0),
15 sample_to_group_table_(sample_to_group
.entries
),
16 iterator_(sample_to_group_table_
.begin()) {
17 // Handle the case that the table contains an entry with sample count 0.
18 while (iterator_
!= sample_to_group_table_
.end()) {
19 remaining_samples_
= iterator_
->sample_count
;
20 if (remaining_samples_
> 0)
26 SampleToGroupIterator::~SampleToGroupIterator() {}
28 bool SampleToGroupIterator::Advance() {
32 // Handle the case that the table contains an entry with sample count 0.
33 while (remaining_samples_
== 0) {
35 if (iterator_
== sample_to_group_table_
.end())
37 remaining_samples_
= iterator_
->sample_count
;
42 bool SampleToGroupIterator::IsValid() const {
43 return remaining_samples_
> 0;