7 #ifndef MEDIA_FORMATS_MP4_SEGMENTER_H_
8 #define MEDIA_FORMATS_MP4_SEGMENTER_H_
14 #include "packager/base/memory/ref_counted.h"
15 #include "packager/media/base/fourccs.h"
16 #include "packager/media/base/status.h"
17 #include "packager/media/formats/mp4/box_definitions.h"
29 class ProgressListener;
44 std::unique_ptr<FileType> ftyp,
45 std::unique_ptr<Movie> moov);
69 uint32_t max_sd_pixels,
70 double clear_lead_in_seconds,
71 double crypto_period_duration_in_seconds,
72 FourCC protection_scheme);
84 scoped_refptr<MediaSample> sample);
88 virtual bool GetInitRange(
size_t* offset,
size_t* size) = 0;
94 uint32_t GetReferenceTimeScale()
const;
109 const MuxerOptions& options()
const {
return options_; }
110 FileType* ftyp() {
return ftyp_.get(); }
111 Movie* moov() {
return moov_.get(); }
112 BufferWriter* fragment_buffer() {
return fragment_buffer_.get(); }
113 SegmentIndex* sidx() {
return sidx_.get(); }
114 MuxerListener* muxer_listener() {
return muxer_listener_; }
115 uint64_t progress_target() {
return progress_target_; }
117 void set_progress_target(uint64_t progress_target) {
118 progress_target_ = progress_target;
122 virtual Status DoInitialize() = 0;
123 virtual Status DoFinalize() = 0;
124 virtual Status DoFinalizeSegment() = 0;
126 Status FinalizeSegment();
127 uint32_t GetReferenceStreamId();
129 Status FinalizeFragment(
bool finalize_segment, Fragmenter* fragment);
131 const MuxerOptions& options_;
132 std::unique_ptr<FileType> ftyp_;
133 std::unique_ptr<Movie> moov_;
134 std::unique_ptr<MovieFragment> moof_;
135 std::unique_ptr<BufferWriter> fragment_buffer_;
136 std::unique_ptr<SegmentIndex> sidx_;
137 std::vector<std::unique_ptr<Fragmenter>> fragmenters_;
138 std::vector<uint64_t> segment_durations_;
139 std::map<const MediaStream*, uint32_t> stream_map_;
140 MuxerListener* muxer_listener_;
141 ProgressListener* progress_listener_;
142 uint64_t progress_target_;
143 uint64_t accumulated_progress_;
144 uint32_t sample_duration_;
146 DISALLOW_COPY_AND_ASSIGN(Segmenter);
153 #endif // MEDIA_FORMATS_MP4_SEGMENTER_H_