blob: c2ea60f827e6b508ea3153571ae3915b57acb9b0 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <vector>
#include "media/formats/mp4/box_definitions.h"
namespace media {
namespace mp4 {
// Sample To Group Box ('sbgp') can be used to find the group that a sample
// belongs to and the associated description of that sample group. It is
// compactly coded though. This class implements the iterator to iterate
// through the compressed table to get the associated sample group description
// index.
class MEDIA_EXPORT SampleToGroupIterator {
explicit SampleToGroupIterator(const SampleToGroup& sample_to_group);
// Advances the iterator to refer to the next sample. Return status
// indicating whether the sample is still valid.
bool Advance();
// Returns whether the current sample is valid.
bool IsValid() const;
// Returns group description index for current sample.
uint32 group_description_index() const {
return iterator_->group_description_index;
// Track how many samples remaining for current table entry.
uint32 remaining_samples_;
const std::vector<SampleToGroupEntry>& sample_to_group_table_;
std::vector<SampleToGroupEntry>::const_iterator iterator_;
} // namespace mp4
} // namespace media