5 #ifndef MEDIA_FORMATS_WEBM_WEBM_CLUSTER_PARSER_H_
6 #define MEDIA_FORMATS_WEBM_WEBM_CLUSTER_PARSER_H_
13 #include "packager/base/compiler_specific.h"
14 #include "packager/base/memory/scoped_ptr.h"
15 #include "packager/media/base/decryptor_source.h"
16 #include "packager/media/base/media_parser.h"
17 #include "packager/media/base/media_sample.h"
18 #include "packager/media/formats/webm/webm_parser.h"
19 #include "packager/media/formats/webm/webm_tracks_parser.h"
21 namespace edash_packager {
43 int64_t default_duration,
47 int track_num()
const {
return track_num_; }
53 bool EmitBuffer(
const scoped_refptr<MediaSample>& buffer);
59 bool ApplyDurationEstimateIfNeeded();
70 bool EmitBufferHelp(
const scoped_refptr<MediaSample>& buffer);
74 int64_t GetDurationEstimate();
82 scoped_refptr<MediaSample> last_added_buffer_missing_duration_;
85 int64_t default_duration_;
90 int64_t estimated_next_frame_duration_;
95 typedef std::map<int, Track> TextTrackMap;
121 scoped_refptr<AudioStreamInfo> audio_stream_info,
122 scoped_refptr<VideoStreamInfo> video_stream_info,
123 int64_t audio_default_duration,
124 int64_t video_default_duration,
125 const WebMTracksParser::TextTracks& text_tracks,
126 const std::set<int64_t>& ignored_tracks,
127 const std::string& audio_encryption_key_id,
128 const std::string& video_encryption_key_id,
131 KeySource* decryption_key_source);
140 bool Flush() WARN_UNUSED_RESULT;
146 int Parse(const uint8_t* buf,
int size);
148 int64_t cluster_start_time()
const {
return cluster_start_time_; }
156 bool OnListEnd(
int id)
override;
157 bool OnUInt(
int id, int64_t val)
override;
158 bool OnBinary(
int id,
const uint8_t* data,
int size)
override;
160 bool ParseBlock(
bool is_simple_block,
163 const uint8_t* additional,
166 int64_t discard_padding);
167 bool OnBlock(
bool is_simple_block,
174 const uint8_t* additional,
176 int64_t discard_padding);
179 void ResetTextTracks();
183 Track* FindTextTrack(
int track_num);
186 double timecode_multiplier_;
188 scoped_refptr<AudioStreamInfo> audio_stream_info_;
189 scoped_refptr<VideoStreamInfo> video_stream_info_;
190 std::set<int64_t> ignored_tracks_;
192 scoped_ptr<DecryptorSource> decryptor_source_;
193 std::string audio_encryption_key_id_;
194 std::string video_encryption_key_id_;
204 int64_t last_block_timecode_ = -1;
205 scoped_ptr<uint8_t[]> block_data_;
206 int block_data_size_ = -1;
207 int64_t block_duration_ = -1;
208 int64_t block_add_id_ = -1;
210 scoped_ptr<uint8_t[]> block_additional_data_;
213 int block_additional_data_size_ = 0;
215 int64_t discard_padding_ = -1;
216 bool discard_padding_set_ =
false;
218 int64_t cluster_timecode_ = -1;
219 int64_t cluster_start_time_;
220 bool cluster_ended_ =
false;
224 TextTrackMap text_track_map_;
232 #endif // MEDIA_FORMATS_WEBM_WEBM_CLUSTER_PARSER_H_