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"
27 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);
91 std::shared_ptr<MediaSample> sample);
95 virtual bool GetInitRange(
size_t* offset,
size_t* size) = 0;
101 uint32_t GetReferenceTimeScale()
const;
116 const MuxerOptions& options()
const {
return options_; }
117 FileType* ftyp() {
return ftyp_.get(); }
118 Movie* moov() {
return moov_.get(); }
119 BufferWriter* fragment_buffer() {
return fragment_buffer_.get(); }
120 SegmentIndex* sidx() {
return sidx_.get(); }
121 MuxerListener* muxer_listener() {
return muxer_listener_; }
122 uint64_t progress_target() {
return progress_target_; }
124 void set_progress_target(uint64_t progress_target) {
125 progress_target_ = progress_target;
129 virtual Status DoInitialize() = 0;
130 virtual Status DoFinalize() = 0;
131 virtual Status DoFinalizeSegment() = 0;
133 Status FinalizeSegment();
134 uint32_t GetReferenceStreamId();
136 Status FinalizeFragment(
bool finalize_segment, Fragmenter* fragment);
138 const MuxerOptions& options_;
139 std::unique_ptr<FileType> ftyp_;
140 std::unique_ptr<Movie> moov_;
141 std::unique_ptr<MovieFragment> moof_;
142 std::unique_ptr<BufferWriter> fragment_buffer_;
143 std::unique_ptr<SegmentIndex> sidx_;
144 std::vector<std::unique_ptr<Fragmenter>> fragmenters_;
145 std::vector<uint64_t> segment_durations_;
146 MuxerListener* muxer_listener_;
147 ProgressListener* progress_listener_;
148 uint64_t progress_target_;
149 uint64_t accumulated_progress_;
150 uint32_t sample_duration_;
152 DISALLOW_COPY_AND_ASSIGN(Segmenter);
159 #endif // MEDIA_FORMATS_MP4_SEGMENTER_H_