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 Status AddSample(
size_t stream_id, std::shared_ptr<MediaSample> sample);
101 virtual bool GetInitRange(
size_t* offset,
size_t* size) = 0;
105 virtual bool GetIndexRange(
size_t* offset,
size_t* size) = 0;
107 uint32_t GetReferenceTimeScale()
const;
122 const MuxerOptions& options()
const {
return options_; }
123 FileType* ftyp() {
return ftyp_.get(); }
124 Movie* moov() {
return moov_.get(); }
125 BufferWriter* fragment_buffer() {
return fragment_buffer_.get(); }
126 SegmentIndex* sidx() {
return sidx_.get(); }
127 MuxerListener* muxer_listener() {
return muxer_listener_; }
128 uint64_t progress_target() {
return progress_target_; }
130 void set_progress_target(uint64_t progress_target) {
131 progress_target_ = progress_target;
135 virtual Status DoInitialize() = 0;
136 virtual Status DoFinalize() = 0;
137 virtual Status DoFinalizeSegment() = 0;
139 uint32_t GetReferenceStreamId();
141 const MuxerOptions& options_;
142 std::unique_ptr<FileType> ftyp_;
143 std::unique_ptr<Movie> moov_;
144 std::unique_ptr<MovieFragment> moof_;
145 std::unique_ptr<BufferWriter> fragment_buffer_;
146 std::unique_ptr<SegmentIndex> sidx_;
147 std::vector<std::unique_ptr<Fragmenter>> fragmenters_;
148 MuxerListener* muxer_listener_;
149 ProgressListener* progress_listener_;
150 uint64_t progress_target_;
151 uint64_t accumulated_progress_;
152 uint32_t sample_duration_;
154 DISALLOW_COPY_AND_ASSIGN(Segmenter);
161 #endif // MEDIA_FORMATS_MP4_SEGMENTER_H_