| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // Demuxer implementation that allows chunks of media data to be passed | 131 // Demuxer implementation that allows chunks of media data to be passed |
| 132 // from JavaScript to the media stack. | 132 // from JavaScript to the media stack. |
| 133 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { | 133 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { |
| 134 public: | 134 public: |
| 135 enum Status { | 135 enum Status { |
| 136 kOk, // ID added w/o error. | 136 kOk, // ID added w/o error. |
| 137 kNotSupported, // Type specified is not supported. | 137 kNotSupported, // Type specified is not supported. |
| 138 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. | 138 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 typedef base::Closure InitSegmentReceivedCB; |
| 142 |
| 141 // |open_cb| Run when Initialize() is called to signal that the demuxer | 143 // |open_cb| Run when Initialize() is called to signal that the demuxer |
| 142 // is ready to receive media data via AppenData(). | 144 // is ready to receive media data via AppenData(). |
| 143 // |need_key_cb| Run when the demuxer determines that an encryption key is | 145 // |need_key_cb| Run when the demuxer determines that an encryption key is |
| 144 // needed to decrypt the content. | 146 // needed to decrypt the content. |
| 145 // |enable_text| Process inband text tracks in the normal way when true, | 147 // |enable_text| Process inband text tracks in the normal way when true, |
| 146 // otherwise ignore them. | 148 // otherwise ignore them. |
| 147 // |log_cb| Run when parsing error messages need to be logged to the error | 149 // |log_cb| Run when parsing error messages need to be logged to the error |
| 148 // console. | 150 // console. |
| 149 // |splice_frames_enabled| Indicates that it's okay to generate splice frames | 151 // |splice_frames_enabled| Indicates that it's okay to generate splice frames |
| 150 // per the MSE specification. Renderers must understand DecoderBuffer's | 152 // per the MSE specification. Renderers must understand DecoderBuffer's |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 void RemoveId(const std::string& id); | 207 void RemoveId(const std::string& id); |
| 206 | 208 |
| 207 // Gets the currently buffered ranges for the specified ID. | 209 // Gets the currently buffered ranges for the specified ID. |
| 208 Ranges<base::TimeDelta> GetBufferedRanges(const std::string& id) const; | 210 Ranges<base::TimeDelta> GetBufferedRanges(const std::string& id) const; |
| 209 | 211 |
| 210 // Appends media data to the source buffer associated with |id|, applying | 212 // Appends media data to the source buffer associated with |id|, applying |
| 211 // and possibly updating |*timestamp_offset| during coded frame processing. | 213 // and possibly updating |*timestamp_offset| during coded frame processing. |
| 212 // |append_window_start| and |append_window_end| correspond to the MSE spec's | 214 // |append_window_start| and |append_window_end| correspond to the MSE spec's |
| 213 // similarly named source buffer attributes that are used in coded frame | 215 // similarly named source buffer attributes that are used in coded frame |
| 214 // processing. | 216 // processing. |
| 217 // |init_segment_received_cb| is run for each newly successfully parsed |
| 218 // initialization segment. |
| 215 void AppendData(const std::string& id, const uint8* data, size_t length, | 219 void AppendData(const std::string& id, const uint8* data, size_t length, |
| 216 base::TimeDelta append_window_start, | 220 base::TimeDelta append_window_start, |
| 217 base::TimeDelta append_window_end, | 221 base::TimeDelta append_window_end, |
| 218 base::TimeDelta* timestamp_offset); | 222 base::TimeDelta* timestamp_offset, |
| 223 const InitSegmentReceivedCB& init_segment_received_cb); |
| 219 | 224 |
| 220 // Aborts parsing the current segment and reset the parser to a state where | 225 // Aborts parsing the current segment and reset the parser to a state where |
| 221 // it can accept a new segment. | 226 // it can accept a new segment. |
| 222 // Some pending frames can be emitted during that process. These frames are | 227 // Some pending frames can be emitted during that process. These frames are |
| 223 // applied |timestamp_offset|. | 228 // applied |timestamp_offset|. |
| 224 void Abort(const std::string& id, | 229 void Abort(const std::string& id, |
| 225 base::TimeDelta append_window_start, | 230 base::TimeDelta append_window_start, |
| 226 base::TimeDelta append_window_end, | 231 base::TimeDelta append_window_end, |
| 227 base::TimeDelta* timestamp_offset); | 232 base::TimeDelta* timestamp_offset); |
| 228 | 233 |
| (...skipping 157 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 |