5 #ifndef MEDIA_FORMATS_WEBM_WEBM_CLUSTER_PARSER_H_
6 #define MEDIA_FORMATS_WEBM_WEBM_CLUSTER_PARSER_H_
13 #include "packager/base/memory/scoped_ptr.h"
14 #include "packager/media/base/decryptor_source.h"
15 #include "packager/media/base/media_parser.h"
16 #include "packager/media/base/media_sample.h"
17 #include "packager/media/formats/webm/webm_parser.h"
18 #include "packager/media/formats/webm/webm_tracks_parser.h"
20 namespace edash_packager {
42 int64_t default_duration,
46 int track_num()
const {
return track_num_; }
52 bool EmitBuffer(
const scoped_refptr<MediaSample>& buffer);
58 void ApplyDurationEstimateIfNeeded();
69 bool EmitBufferHelp(
const scoped_refptr<MediaSample>& buffer);
73 int64_t GetDurationEstimate();
81 scoped_refptr<MediaSample> last_added_buffer_missing_duration_;
84 int64_t default_duration_;
89 int64_t estimated_next_frame_duration_;
94 typedef std::map<int, Track> TextTrackMap;
120 scoped_refptr<AudioStreamInfo> audio_stream_info,
121 scoped_refptr<VideoStreamInfo> video_stream_info,
122 int64_t audio_default_duration,
123 int64_t video_default_duration,
124 const WebMTracksParser::TextTracks& text_tracks,
125 const std::set<int64_t>& ignored_tracks,
126 const std::string& audio_encryption_key_id,
127 const std::string& video_encryption_key_id,
130 KeySource* decryption_key_source);
144 int Parse(
const uint8_t* buf,
int size);
146 int64_t cluster_start_time()
const {
return cluster_start_time_; }
154 bool OnListEnd(
int id)
override;
155 bool OnUInt(
int id, int64_t val)
override;
156 bool OnBinary(
int id,
const uint8_t* data,
int size)
override;
158 bool ParseBlock(
bool is_simple_block,
161 const uint8_t* additional,
164 int64_t discard_padding);
165 bool OnBlock(
bool is_simple_block,
172 const uint8_t* additional,
174 int64_t discard_padding);
177 void ResetTextTracks();
181 Track* FindTextTrack(
int track_num);
184 double timecode_multiplier_;
186 scoped_refptr<AudioStreamInfo> audio_stream_info_;
187 scoped_refptr<VideoStreamInfo> video_stream_info_;
188 std::set<int64_t> ignored_tracks_;
190 scoped_ptr<DecryptorSource> decryptor_source_;
191 std::string audio_encryption_key_id_;
192 std::string video_encryption_key_id_;
202 int64_t last_block_timecode_ = -1;
203 scoped_ptr<uint8_t[]> block_data_;
204 int block_data_size_ = -1;
205 int64_t block_duration_ = -1;
206 int64_t block_add_id_ = -1;
208 scoped_ptr<uint8_t[]> block_additional_data_;
211 int block_additional_data_size_ = 0;
213 int64_t discard_padding_ = -1;
214 bool discard_padding_set_ =
false;
216 int64_t cluster_timecode_ = -1;
217 int64_t cluster_start_time_;
218 bool cluster_ended_ =
false;
222 TextTrackMap text_track_map_;
230 #endif // MEDIA_FORMATS_WEBM_WEBM_CLUSTER_PARSER_H_