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/encryption_modes.h"
16 #include "packager/media/base/status.h"
17 #include "packager/media/formats/mp4/box_definitions.h"
19 namespace edash_packager {
29 class ProgressListener;
44 scoped_ptr<FileType> ftyp,
45 scoped_ptr<Movie> moov);
67 uint32_t max_sd_pixels,
68 double clear_lead_in_seconds,
69 double crypto_period_duration_in_seconds,
70 EncryptionMode encryption_mode);
82 scoped_refptr<MediaSample> sample);
86 virtual bool GetInitRange(
size_t* offset,
size_t* size) = 0;
92 uint32_t GetReferenceTimeScale()
const;
107 const MuxerOptions& options()
const {
return options_; }
108 FileType* ftyp() {
return ftyp_.get(); }
109 Movie* moov() {
return moov_.get(); }
110 BufferWriter* fragment_buffer() {
return fragment_buffer_.get(); }
111 SegmentIndex* sidx() {
return sidx_.get(); }
112 MuxerListener* muxer_listener() {
return muxer_listener_; }
113 uint64_t progress_target() {
return progress_target_; }
115 void set_progress_target(uint64_t progress_target) {
116 progress_target_ = progress_target;
120 virtual Status DoInitialize() = 0;
121 virtual Status DoFinalize() = 0;
122 virtual Status DoFinalizeSegment() = 0;
124 Status FinalizeSegment();
125 uint32_t GetReferenceStreamId();
127 Status FinalizeFragment(
bool finalize_segment, Fragmenter* fragment);
129 const MuxerOptions& options_;
130 scoped_ptr<FileType> ftyp_;
131 scoped_ptr<Movie> moov_;
132 scoped_ptr<MovieFragment> moof_;
133 scoped_ptr<BufferWriter> fragment_buffer_;
134 scoped_ptr<SegmentIndex> sidx_;
135 std::vector<Fragmenter*> fragmenters_;
136 std::vector<uint64_t> segment_durations_;
137 std::map<const MediaStream*, uint32_t> stream_map_;
138 bool end_of_segment_;
139 MuxerListener* muxer_listener_;
140 ProgressListener* progress_listener_;
141 uint64_t progress_target_;
142 uint64_t accumulated_progress_;
143 uint32_t sample_duration_;
145 DISALLOW_COPY_AND_ASSIGN(Segmenter);
152 #endif // MEDIA_FORMATS_MP4_SEGMENTER_H_