Shaka Packager SDK
low_latency_segment_segmenter.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_LOW_LATENCY_SEGMENT_SEGMENTER_H_
8 #define PACKAGER_MEDIA_FORMATS_MP4_LOW_LATENCY_SEGMENT_SEGMENTER_H_
9 
10 #include <packager/file.h>
11 #include <packager/file/file_closer.h>
12 #include <packager/macros/classes.h>
13 #include <packager/media/formats/mp4/segmenter.h>
14 
15 namespace shaka {
16 namespace media {
17 namespace mp4 {
18 
19 struct SegmentType;
20 
30  public:
32  std::unique_ptr<FileType> ftyp,
33  std::unique_ptr<Movie> moov);
34  ~LowLatencySegmentSegmenter() override;
35 
38  bool GetInitRange(size_t* offset, size_t* size) override;
39  bool GetIndexRange(size_t* offset, size_t* size) override;
40  std::vector<Range> GetSegmentRanges() override;
42 
43  private:
44  // Segmenter implementation overrides.
45  Status DoInitialize() override;
46  Status DoFinalize() override;
47  Status DoFinalizeSegment(int64_t segment_number) override;
48  Status DoFinalizeChunk(int64_t segment_number) override;
49 
50  // Write segment to file.
51  Status WriteInitSegment();
52  Status WriteChunk();
53  Status WriteInitialChunk(int64_t segment_number);
54  Status FinalizeSegment();
55 
56  uint64_t GetSegmentDuration();
57 
58  std::unique_ptr<SegmentType> styp_;
59  uint32_t num_segments_;
60  bool is_initial_chunk_in_seg_ = true;
61  bool ll_dash_mpd_values_initialized_ = false;
62  std::unique_ptr<File, FileCloser> segment_file_;
63  std::string file_name_;
64  size_t segment_size_ = 0u;
65 
66  DISALLOW_COPY_AND_ASSIGN(LowLatencySegmentSegmenter);
67 };
68 
69 } // namespace mp4
70 } // namespace media
71 } // namespace shaka
72 
73 #endif // PACKAGER_MEDIA_FORMATS_MP4_LOW_LATENCY_SEGMENT_SEGMENTER_H_
bool GetInitRange(size_t *offset, size_t *size) override
bool GetIndexRange(size_t *offset, size_t *size) override
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66
This structure contains the list of configuration options for Muxer.
Definition: muxer_options.h:19