7 #ifndef PACKAGER_MEDIA_FORMATS_WEBM_SEGMENTER_H_ 8 #define PACKAGER_MEDIA_FORMATS_WEBM_SEGMENTER_H_ 12 #include "packager/base/optional.h" 13 #include "packager/media/base/range.h" 14 #include "packager/media/formats/webm/mkv_writer.h" 15 #include "packager/media/formats/webm/seek_head.h" 16 #include "packager/status.h" 17 #include "packager/third_party/libwebm/src/mkvmuxer.hpp" 24 class AudioStreamInfo;
27 class ProgressListener;
29 class VideoStreamInfo;
59 uint64_t duration_timestamp,
60 bool is_subsegment) = 0;
73 virtual std::vector<Range> GetSegmentRanges() = 0;
92 void set_progress_target(uint64_t target) { progress_target_ = target; }
95 mkvmuxer::Cluster* cluster() {
return cluster_.get(); }
96 mkvmuxer::Cues* cues() {
return &cues_; }
98 SeekHead* seek_head() {
return &seek_head_; }
100 int track_id()
const {
return track_id_; }
101 uint64_t segment_payload_pos()
const {
return segment_payload_pos_; }
103 uint64_t duration()
const {
return duration_; }
105 virtual Status DoInitialize() = 0;
106 virtual Status DoFinalize() = 0;
110 mkvmuxer::AudioTrack* track);
112 mkvmuxer::VideoTrack* track);
115 Status WriteFrame(
bool write_duration);
121 virtual Status NewSegment(uint64_t start_timestamp,
bool is_subsegment) = 0;
124 std::shared_ptr<const MediaSample> prev_sample_;
127 uint64_t reference_frame_timestamp_ = 0;
131 std::unique_ptr<mkvmuxer::Cluster> cluster_;
132 mkvmuxer::Cues cues_;
134 mkvmuxer::SegmentInfo segment_info_;
135 mkvmuxer::Tracks tracks_;
139 uint64_t progress_target_ = 0;
140 uint64_t accumulated_progress_ = 0;
141 uint64_t first_timestamp_ = 0;
142 int64_t sample_duration_ = 0;
145 uint64_t segment_payload_pos_ = 0;
149 bool new_segment_ =
true;
151 bool new_subsegment_ =
false;
155 bool is_encrypted_ =
false;
156 uint64_t time_scale_ = 0;
157 uint64_t duration_ = 0;
166 #endif // PACKAGER_MEDIA_FORMATS_WEBM_SEGMENTER_H_
All the methods that are virtual are virtual for mocking.