7 #ifndef MEDIA_FORMATS_WEBM_SEGMENTER_H_
8 #define MEDIA_FORMATS_WEBM_SEGMENTER_H_
11 #include "packager/base/memory/ref_counted.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"
23 class AudioStreamInfo;
28 class ProgressListener;
30 class VideoStreamInfo;
66 uint32_t max_sd_pixels,
67 uint32_t max_hd_pixels,
68 uint32_t max_uhd1_pixels,
69 double clear_lead_in_seconds);
106 void set_progress_target(uint64_t target) { progress_target_ = target; }
108 const MuxerOptions& options()
const {
return options_; }
109 mkvmuxer::Cluster* cluster() {
return cluster_.get(); }
110 mkvmuxer::Cues* cues() {
return &cues_; }
113 SeekHead* seek_head() {
return &seek_head_; }
115 int track_id()
const {
return track_id_; }
116 uint64_t segment_payload_pos()
const {
return segment_payload_pos_; }
117 uint64_t cluster_length_in_time_scale()
const {
118 return cluster_length_in_time_scale_;
121 virtual Status DoInitialize(std::unique_ptr<MkvWriter> writer) = 0;
122 virtual Status DoFinalize() = 0;
127 Status InitializeEncryptor(
KeySource* key_source, uint32_t max_sd_pixels,
128 uint32_t max_hd_pixels, uint32_t max_uhd1_pixels);
131 Status WriteFrame(
bool write_duration);
136 virtual Status NewSubsegment(uint64_t start_timescale) = 0;
140 virtual Status NewSegment(uint64_t start_timescale) = 0;
143 scoped_refptr<MediaSample> prev_sample_;
146 uint64_t reference_frame_timestamp_;
149 std::unique_ptr<Encryptor> encryptor_;
151 bool enable_encryption_;
153 std::unique_ptr<mkvmuxer::Cluster> cluster_;
154 mkvmuxer::Cues cues_;
156 mkvmuxer::SegmentInfo segment_info_;
157 mkvmuxer::Tracks tracks_;
162 uint64_t progress_target_;
163 uint64_t accumulated_progress_;
164 uint64_t first_timestamp_;
165 int64_t sample_duration_;
168 uint64_t segment_payload_pos_;
171 uint64_t cluster_length_in_time_scale_;
172 uint64_t segment_length_in_time_scale_;
183 #endif // MEDIA_FORMATS_WEBM_SEGMENTER_H_