7 #ifndef MEDIA_FORMATS_WEBM_SEGMENTER_H_
8 #define MEDIA_FORMATS_WEBM_SEGMENTER_H_
11 #include "packager/media/base/status.h"
12 #include "packager/media/formats/webm/mkv_writer.h"
13 #include "packager/media/formats/webm/seek_head.h"
14 #include "packager/third_party/libwebm/src/mkvmuxer.hpp"
21 class AudioStreamInfo;
24 class ProgressListener;
26 class VideoStreamInfo;
56 uint64_t duration_timescale,
57 bool is_subsegment) = 0;
85 void set_progress_target(uint64_t target) { progress_target_ = target; }
88 mkvmuxer::Cluster* cluster() {
return cluster_.get(); }
89 mkvmuxer::Cues* cues() {
return &cues_; }
92 SeekHead* seek_head() {
return &seek_head_; }
94 int track_id()
const {
return track_id_; }
95 uint64_t segment_payload_pos()
const {
return segment_payload_pos_; }
97 virtual Status DoInitialize() = 0;
98 virtual Status DoFinalize() = 0;
102 mkvmuxer::AudioTrack* track);
104 mkvmuxer::VideoTrack* track);
107 Status WriteFrame(
bool write_duration);
113 virtual Status NewSegment(uint64_t start_timescale,
bool is_subsegment) = 0;
116 std::shared_ptr<MediaSample> prev_sample_;
119 uint64_t reference_frame_timestamp_ = 0;
123 std::unique_ptr<mkvmuxer::Cluster> cluster_;
124 mkvmuxer::Cues cues_;
126 mkvmuxer::SegmentInfo segment_info_;
127 mkvmuxer::Tracks tracks_;
132 uint64_t progress_target_ = 0;
133 uint64_t accumulated_progress_ = 0;
134 uint64_t first_timestamp_ = 0;
135 int64_t sample_duration_ = 0;
138 uint64_t segment_payload_pos_ = 0;
142 bool new_segment_ =
true;
144 bool new_subsegment_ =
false;
154 #endif // MEDIA_FORMATS_WEBM_SEGMENTER_H_