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/fourccs.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);
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 scoped_ptr<FileType> ftyp_;
133 scoped_ptr<Movie> moov_;
134 scoped_ptr<MovieFragment> moof_;
135 scoped_ptr<BufferWriter> fragment_buffer_;
136 scoped_ptr<SegmentIndex> sidx_;
137 std::vector<Fragmenter*> fragmenters_;
138 std::vector<uint64_t> segment_durations_;
139 std::map<const MediaStream*, uint32_t> stream_map_;
140 bool end_of_segment_;
141 MuxerListener* muxer_listener_;
142 ProgressListener* progress_listener_;
143 uint64_t progress_target_;
144 uint64_t accumulated_progress_;
145 uint32_t sample_duration_;
147 DISALLOW_COPY_AND_ASSIGN(Segmenter);
154 #endif // MEDIA_FORMATS_MP4_SEGMENTER_H_