7 #ifndef MEDIA_FORMATS_WEBM_SEGMENTER_H_
8 #define MEDIA_FORMATS_WEBM_SEGMENTER_H_
10 #include "packager/base/memory/ref_counted.h"
11 #include "packager/base/memory/scoped_ptr.h"
12 #include "packager/media/base/status.h"
13 #include "packager/media/formats/webm/encryptor.h"
14 #include "packager/media/formats/webm/mkv_writer.h"
15 #include "packager/media/formats/webm/seek_head.h"
16 #include "packager/third_party/libwebm/src/mkvmuxer.hpp"
18 namespace edash_packager {
23 class AudioStreamInfo;
28 class ProgressListener;
30 class VideoStreamInfo;
58 uint32_t max_sd_pixels,
59 double clear_lead_in_seconds);
96 void set_progress_target(uint64_t target) { progress_target_ = target; }
99 mkvmuxer::Cluster* cluster() {
return cluster_.get(); }
100 mkvmuxer::Cues* cues() {
return &cues_; }
103 SeekHead* seek_head() {
return &seek_head_; }
105 int track_id()
const {
return track_id_; }
106 uint64_t segment_payload_pos()
const {
return segment_payload_pos_; }
107 double cluster_length_sec()
const {
return cluster_length_sec_; }
109 virtual Status DoInitialize(scoped_ptr<MkvWriter> writer) = 0;
110 virtual Status DoFinalize() = 0;
115 Status InitializeEncryptor(
KeySource* key_source, uint32_t max_sd_pixels);
118 Status WriteFrame(
bool write_duration);
123 virtual Status NewSubsegment(uint64_t start_timescale) = 0;
127 virtual Status NewSegment(uint64_t start_timescale) = 0;
130 scoped_refptr<MediaSample> prev_sample_;
133 uint64_t reference_frame_timestamp_;
136 scoped_ptr<Encryptor> encryptor_;
139 scoped_ptr<mkvmuxer::Cluster> cluster_;
140 mkvmuxer::Cues cues_;
142 mkvmuxer::SegmentInfo segment_info_;
143 mkvmuxer::Tracks tracks_;
148 uint64_t progress_target_;
149 uint64_t accumulated_progress_;
150 uint64_t first_timestamp_;
151 int64_t sample_duration_;
154 uint64_t segment_payload_pos_;
156 double cluster_length_sec_;
157 double segment_length_sec_;
168 #endif // MEDIA_FORMATS_WEBM_SEGMENTER_H_