Shaka Packager SDK
Loading...
Searching...
No Matches
chunk_info_iterator.h
1// Copyright 2014 Google LLC. All rights reserved.
2//
3// Use of this source code is governed by a BSD-style
4// license that can be found in the LICENSE file or at
5// https://developers.google.com/open-source/licenses/bsd
6
7#ifndef PACKAGER_MEDIA_FORMATS_MP4_CHUNK_INFO_ITERATOR_H_
8#define PACKAGER_MEDIA_FORMATS_MP4_CHUNK_INFO_ITERATOR_H_
9
10#include <cstdint>
11#include <vector>
12
13#include <packager/macros/classes.h>
14#include <packager/media/formats/mp4/box_definitions.h>
15
16namespace shaka {
17namespace media {
18namespace mp4 {
19
24 public:
26 explicit ChunkInfoIterator(const SampleToChunk& sample_to_chunk);
28
31 bool AdvanceChunk();
32
35 bool AdvanceSample();
36
38 bool IsValid() const;
39
41 uint32_t current_chunk() const { return current_chunk_; }
42
44 uint32_t samples_per_chunk() const { return iterator_->samples_per_chunk; }
45
47 uint32_t sample_description_index() const {
48 return iterator_->sample_description_index;
49 }
50
53 uint32_t NumSamples(uint32_t start_chunk, uint32_t end_chunk) const;
54
56 uint32_t LastFirstChunk() const {
57 return chunk_info_table_.empty() ? 0
58 : chunk_info_table_.back().first_chunk;
59 }
60
61 private:
62 uint32_t chunk_sample_index_;
63 uint32_t current_chunk_;
64 const std::vector<ChunkInfo>& chunk_info_table_;
65 std::vector<ChunkInfo>::const_iterator iterator_;
66
67 DISALLOW_COPY_AND_ASSIGN(ChunkInfoIterator);
68};
69
70} // namespace mp4
71} // namespace media
72} // namespace shaka
73
74#endif // PACKAGER_MEDIA_FORMATS_MP4_CHUNK_INFO_ITERATOR_H_
uint32_t NumSamples(uint32_t start_chunk, uint32_t end_chunk) const
All the methods that are virtual are virtual for mocking.