7 #ifndef MEDIA_FORMATS_MP4_SEGMENTER_H_
8 #define MEDIA_FORMATS_MP4_SEGMENTER_H_
14 #include "packager/media/base/fourccs.h"
15 #include "packager/media/base/status.h"
16 #include "packager/media/formats/mp4/box_definitions.h"
28 class ProgressListener;
43 std::unique_ptr<FileType> ftyp,
44 std::unique_ptr<Movie> moov);
76 uint32_t max_sd_pixels,
77 uint32_t max_hd_pixels,
78 uint32_t max_uhd1_pixels,
79 double clear_lead_in_seconds,
80 double crypto_period_duration_in_seconds,
81 FourCC protection_scheme);
93 std::shared_ptr<MediaSample> sample);
97 virtual bool GetInitRange(
size_t* offset,
size_t* size) = 0;
101 virtual bool GetIndexRange(
size_t* offset,
size_t* size) = 0;
103 uint32_t GetReferenceTimeScale()
const;
118 const MuxerOptions& options()
const {
return options_; }
119 FileType* ftyp() {
return ftyp_.get(); }
120 Movie* moov() {
return moov_.get(); }
121 BufferWriter* fragment_buffer() {
return fragment_buffer_.get(); }
122 SegmentIndex* sidx() {
return sidx_.get(); }
123 MuxerListener* muxer_listener() {
return muxer_listener_; }
124 uint64_t progress_target() {
return progress_target_; }
126 void set_progress_target(uint64_t progress_target) {
127 progress_target_ = progress_target;
131 virtual Status DoInitialize() = 0;
132 virtual Status DoFinalize() = 0;
133 virtual Status DoFinalizeSegment() = 0;
135 Status FinalizeSegment();
136 uint32_t GetReferenceStreamId();
138 Status FinalizeFragment(
bool finalize_segment, Fragmenter* fragment);
140 const MuxerOptions& options_;
141 std::unique_ptr<FileType> ftyp_;
142 std::unique_ptr<Movie> moov_;
143 std::unique_ptr<MovieFragment> moof_;
144 std::unique_ptr<BufferWriter> fragment_buffer_;
145 std::unique_ptr<SegmentIndex> sidx_;
146 std::vector<std::unique_ptr<Fragmenter>> fragmenters_;
147 std::vector<uint64_t> segment_durations_;
148 std::map<const MediaStream*, uint32_t> stream_map_;
149 MuxerListener* muxer_listener_;
150 ProgressListener* progress_listener_;
151 uint64_t progress_target_;
152 uint64_t accumulated_progress_;
153 uint32_t sample_duration_;
155 DISALLOW_COPY_AND_ASSIGN(Segmenter);
162 #endif // MEDIA_FORMATS_MP4_SEGMENTER_H_