Shaka Packager SDK
composition_offset_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_COMPOSITION_OFFSET_ITERATOR_H_
8 #define PACKAGER_MEDIA_FORMATS_MP4_COMPOSITION_OFFSET_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 
16 namespace shaka {
17 namespace media {
18 namespace mp4 {
19 
24  public:
27  const CompositionTimeToSample& composition_time_to_sample);
29 
32  bool AdvanceSample();
33 
36  bool IsValid() const;
37 
39  int64_t sample_offset() const { return iterator_->sample_offset; }
40 
42  int64_t SampleOffset(uint32_t sample) const;
43 
45  uint32_t NumSamples() const;
46 
47  private:
48  uint32_t sample_index_;
49  const std::vector<CompositionOffset>& composition_offset_table_;
50  std::vector<CompositionOffset>::const_iterator iterator_;
51 
52  DISALLOW_COPY_AND_ASSIGN(CompositionOffsetIterator);
53 };
54 
55 } // namespace mp4
56 } // namespace media
57 } // namespace shaka
58 
59 #endif // PACKAGER_MEDIA_FORMATS_MP4_COMPOSITION_OFFSET_ITERATOR_H_
CompositionOffsetIterator(const CompositionTimeToSample &composition_time_to_sample)
Create CompositionOffsetIterator from composition time to sample box.
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66