OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 5 #ifndef MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
6 #define MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 6 #define MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // Demuxer implementation that allows chunks of media data to be passed | 130 // Demuxer implementation that allows chunks of media data to be passed |
131 // from JavaScript to the media stack. | 131 // from JavaScript to the media stack. |
132 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { | 132 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { |
133 public: | 133 public: |
134 enum Status { | 134 enum Status { |
135 kOk, // ID added w/o error. | 135 kOk, // ID added w/o error. |
136 kNotSupported, // Type specified is not supported. | 136 kNotSupported, // Type specified is not supported. |
137 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. | 137 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. |
138 }; | 138 }; |
139 | 139 |
| 140 typedef base::Closure InitSegmentReceivedCB; |
| 141 |
140 // |open_cb| Run when Initialize() is called to signal that the demuxer | 142 // |open_cb| Run when Initialize() is called to signal that the demuxer |
141 // is ready to receive media data via AppenData(). | 143 // is ready to receive media data via AppenData(). |
142 // |need_key_cb| Run when the demuxer determines that an encryption key is | 144 // |need_key_cb| Run when the demuxer determines that an encryption key is |
143 // needed to decrypt the content. | 145 // needed to decrypt the content. |
144 // |enable_text| Process inband text tracks in the normal way when true, | 146 // |enable_text| Process inband text tracks in the normal way when true, |
145 // otherwise ignore them. | 147 // otherwise ignore them. |
146 // |log_cb| Run when parsing error messages need to be logged to the error | 148 // |log_cb| Run when parsing error messages need to be logged to the error |
147 // console. | 149 // console. |
148 // |splice_frames_enabled| Indicates that it's okay to generate splice frames | 150 // |splice_frames_enabled| Indicates that it's okay to generate splice frames |
149 // per the MSE specification. Renderers must understand DecoderBuffer's | 151 // per the MSE specification. Renderers must understand DecoderBuffer's |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 void RemoveId(const std::string& id); | 206 void RemoveId(const std::string& id); |
205 | 207 |
206 // Gets the currently buffered ranges for the specified ID. | 208 // Gets the currently buffered ranges for the specified ID. |
207 Ranges<base::TimeDelta> GetBufferedRanges(const std::string& id) const; | 209 Ranges<base::TimeDelta> GetBufferedRanges(const std::string& id) const; |
208 | 210 |
209 // Appends media data to the source buffer associated with |id|, applying | 211 // Appends media data to the source buffer associated with |id|, applying |
210 // and possibly updating |*timestamp_offset| during coded frame processing. | 212 // and possibly updating |*timestamp_offset| during coded frame processing. |
211 // |append_window_start| and |append_window_end| correspond to the MSE spec's | 213 // |append_window_start| and |append_window_end| correspond to the MSE spec's |
212 // similarly named source buffer attributes that are used in coded frame | 214 // similarly named source buffer attributes that are used in coded frame |
213 // processing. | 215 // processing. |
| 216 // |init_segment_received_cb| is run for each newly successfully parsed |
| 217 // initialization segment. |
214 void AppendData(const std::string& id, const uint8* data, size_t length, | 218 void AppendData(const std::string& id, const uint8* data, size_t length, |
215 base::TimeDelta append_window_start, | 219 base::TimeDelta append_window_start, |
216 base::TimeDelta append_window_end, | 220 base::TimeDelta append_window_end, |
217 base::TimeDelta* timestamp_offset); | 221 base::TimeDelta* timestamp_offset, |
| 222 const InitSegmentReceivedCB& init_segment_received_cb); |
218 | 223 |
219 // Aborts parsing the current segment and reset the parser to a state where | 224 // Aborts parsing the current segment and reset the parser to a state where |
220 // it can accept a new segment. | 225 // it can accept a new segment. |
221 // Some pending frames can be emitted during that process. These frames are | 226 // Some pending frames can be emitted during that process. These frames are |
222 // applied |timestamp_offset|. | 227 // applied |timestamp_offset|. |
223 void Abort(const std::string& id, | 228 void Abort(const std::string& id, |
224 base::TimeDelta append_window_start, | 229 base::TimeDelta append_window_start, |
225 base::TimeDelta append_window_end, | 230 base::TimeDelta append_window_end, |
226 base::TimeDelta* timestamp_offset); | 231 base::TimeDelta* timestamp_offset); |
227 | 232 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 391 |
387 // Indicates that splice frame generation is enabled. | 392 // Indicates that splice frame generation is enabled. |
388 const bool splice_frames_enabled_; | 393 const bool splice_frames_enabled_; |
389 | 394 |
390 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 395 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
391 }; | 396 }; |
392 | 397 |
393 } // namespace media | 398 } // namespace media |
394 | 399 |
395 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 400 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
OLD | NEW |