7 #ifndef MEDIA_FORMATS_MP4_SEGMENTER_H_
8 #define MEDIA_FORMATS_MP4_SEGMENTER_H_
13 #include "packager/base/memory/ref_counted.h"
14 #include "packager/base/memory/scoped_ptr.h"
15 #include "packager/media/base/status.h"
16 #include "packager/media/formats/mp4/box_definitions.h"
18 namespace edash_packager {
28 class ProgressListener;
43 scoped_ptr<FileType> ftyp,
44 scoped_ptr<Movie> moov);
66 uint32_t max_sd_pixels,
67 double clear_lead_in_seconds,
68 double crypto_period_duration_in_seconds);
80 scoped_refptr<MediaSample> sample);
84 virtual bool GetInitRange(
size_t* offset,
size_t* size) = 0;
90 uint32_t GetReferenceTimeScale()
const;
105 const MuxerOptions& options()
const {
return options_; }
106 FileType* ftyp() {
return ftyp_.get(); }
107 Movie* moov() {
return moov_.get(); }
108 BufferWriter* fragment_buffer() {
return fragment_buffer_.get(); }
109 SegmentIndex* sidx() {
return sidx_.get(); }
110 MuxerListener* muxer_listener() {
return muxer_listener_; }
111 uint64_t progress_target() {
return progress_target_; }
113 void set_progress_target(uint64_t progress_target) {
114 progress_target_ = progress_target;
118 virtual Status DoInitialize() = 0;
119 virtual Status DoFinalize() = 0;
120 virtual Status DoFinalizeSegment() = 0;
122 Status FinalizeSegment();
123 uint32_t GetReferenceStreamId();
125 Status FinalizeFragment(
bool finalize_segment, Fragmenter* fragment);
127 const MuxerOptions& options_;
128 scoped_ptr<FileType> ftyp_;
129 scoped_ptr<Movie> moov_;
130 scoped_ptr<MovieFragment> moof_;
131 scoped_ptr<BufferWriter> fragment_buffer_;
132 scoped_ptr<SegmentIndex> sidx_;
133 std::vector<Fragmenter*> fragmenters_;
134 std::vector<uint64_t> segment_durations_;
135 std::map<const MediaStream*, uint32_t> stream_map_;
136 bool end_of_segment_;
137 MuxerListener* muxer_listener_;
138 ProgressListener* progress_listener_;
139 uint64_t progress_target_;
140 uint64_t accumulated_progress_;
141 uint32_t sample_duration_;
143 DISALLOW_COPY_AND_ASSIGN(Segmenter);
150 #endif // MEDIA_FORMATS_MP4_SEGMENTER_H_