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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // kReachedIdLimit is returned if the demuxer cannot handle another ID right | 201 // kReachedIdLimit is returned if the demuxer cannot handle another ID right |
202 // now. | 202 // now. |
203 Status AddId(const std::string& id, const std::string& type, | 203 Status AddId(const std::string& id, const std::string& type, |
204 std::vector<std::string>& codecs); | 204 std::vector<std::string>& codecs); |
205 | 205 |
206 // Notifies a caller via |tracks_updated_cb| that the set of media tracks | 206 // Notifies a caller via |tracks_updated_cb| that the set of media tracks |
207 // for a given |id| has changed. | 207 // for a given |id| has changed. |
208 void SetTracksWatcher(const std::string& id, | 208 void SetTracksWatcher(const std::string& id, |
209 const MediaTracksUpdatedCB& tracks_updated_cb); | 209 const MediaTracksUpdatedCB& tracks_updated_cb); |
210 | 210 |
| 211 // Notifies the demuxer that track ids has been assigned to a media tracks. |
| 212 void OnTrackIdsAssigned(const MediaTracks& tracks, |
| 213 const std::vector<unsigned>& track_ids) override; |
| 214 |
| 215 // Finds a DemuxerStream corresponding to the given blink |track_id|. Note |
| 216 // that the input track id is blink track id and not bytestream track id. |
| 217 const DemuxerStream* GetDemuxerStreamByTrackId( |
| 218 unsigned track_id) const override; |
| 219 |
211 // Removed an ID & associated resources that were previously added with | 220 // Removed an ID & associated resources that were previously added with |
212 // AddId(). | 221 // AddId(). |
213 void RemoveId(const std::string& id); | 222 void RemoveId(const std::string& id); |
214 | 223 |
215 // Gets the currently buffered ranges for the specified ID. | 224 // Gets the currently buffered ranges for the specified ID. |
216 Ranges<base::TimeDelta> GetBufferedRanges(const std::string& id) const; | 225 Ranges<base::TimeDelta> GetBufferedRanges(const std::string& id) const; |
217 | 226 |
218 // Appends media data to the source buffer associated with |id|, applying | 227 // Appends media data to the source buffer associated with |id|, applying |
219 // and possibly updating |*timestamp_offset| during coded frame processing. | 228 // and possibly updating |*timestamp_offset| during coded frame processing. |
220 // |append_window_start| and |append_window_end| correspond to the MSE spec's | 229 // |append_window_start| and |append_window_end| correspond to the MSE spec's |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 // Returns true if any stream has seeked to a time without buffered data. | 320 // Returns true if any stream has seeked to a time without buffered data. |
312 bool IsSeekWaitingForData_Locked() const; | 321 bool IsSeekWaitingForData_Locked() const; |
313 | 322 |
314 // Returns true if all streams can successfully call EndOfStream, | 323 // Returns true if all streams can successfully call EndOfStream, |
315 // false if any can not. | 324 // false if any can not. |
316 bool CanEndOfStream_Locked() const; | 325 bool CanEndOfStream_Locked() const; |
317 | 326 |
318 // MediaSourceState callbacks. | 327 // MediaSourceState callbacks. |
319 void OnSourceInitDone(const StreamParser::InitParameters& params); | 328 void OnSourceInitDone(const StreamParser::InitParameters& params); |
320 | 329 |
321 // Creates a DemuxerStream for the specified |type|. | 330 // Creates a DemuxerStream for the specified |media_track|. |
322 // Returns a new ChunkDemuxerStream instance if a stream of this type | 331 // Returns a new ChunkDemuxerStream instance if a stream of this type |
323 // has not been created before. Returns NULL otherwise. | 332 // has not been created before. Returns NULL otherwise. |
324 ChunkDemuxerStream* CreateDemuxerStream(DemuxerStream::Type type); | 333 ChunkDemuxerStream* CreateDemuxerStream(const MediaTrack& media_track); |
325 | 334 |
326 void OnNewTextTrack(ChunkDemuxerStream* text_stream, | 335 void OnNewTextTrack(ChunkDemuxerStream* text_stream, |
327 const TextTrackConfig& config); | 336 const TextTrackConfig& config); |
328 | 337 |
329 // Returns true if |source_id| is valid, false otherwise. | 338 // Returns true if |source_id| is valid, false otherwise. |
330 bool IsValidId(const std::string& source_id) const; | 339 bool IsValidId(const std::string& source_id) const; |
331 | 340 |
332 // Increases |duration_| to |new_duration|, if |new_duration| is higher. | 341 // Increases |duration_| to |new_duration|, if |new_duration| is higher. |
333 void IncreaseDurationIfNecessary(base::TimeDelta new_duration); | 342 void IncreaseDurationIfNecessary(base::TimeDelta new_duration); |
334 | 343 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 // http://crbug.com/308226 | 387 // http://crbug.com/308226 |
379 PipelineStatusCB seek_cb_; | 388 PipelineStatusCB seek_cb_; |
380 | 389 |
381 scoped_ptr<ChunkDemuxerStream> audio_; | 390 scoped_ptr<ChunkDemuxerStream> audio_; |
382 scoped_ptr<ChunkDemuxerStream> video_; | 391 scoped_ptr<ChunkDemuxerStream> video_; |
383 | 392 |
384 // Counter to ensure that we do not transition too early to INITIALIZED. | 393 // Counter to ensure that we do not transition too early to INITIALIZED. |
385 // Incremented in AddId(), decremented in OnSourceInitDone(). | 394 // Incremented in AddId(), decremented in OnSourceInitDone(). |
386 int pending_source_init_done_count_; | 395 int pending_source_init_done_count_; |
387 | 396 |
| 397 std::map<unsigned, const DemuxerStream*> track_id_to_demux_stream_; |
| 398 |
388 base::TimeDelta duration_; | 399 base::TimeDelta duration_; |
389 | 400 |
390 // The duration passed to the last SetDuration(). If | 401 // The duration passed to the last SetDuration(). If |
391 // SetDuration() is never called or an AppendData() call or | 402 // SetDuration() is never called or an AppendData() call or |
392 // a EndOfStream() call changes |duration_|, then this | 403 // a EndOfStream() call changes |duration_|, then this |
393 // variable is set to < 0 to indicate that the |duration_| represents | 404 // variable is set to < 0 to indicate that the |duration_| represents |
394 // the actual duration instead of a user specified value. | 405 // the actual duration instead of a user specified value. |
395 double user_specified_duration_; | 406 double user_specified_duration_; |
396 | 407 |
397 base::Time timeline_offset_; | 408 base::Time timeline_offset_; |
(...skipping 15 matching lines...) Expand all Loading... |
413 int detected_audio_track_count_; | 424 int detected_audio_track_count_; |
414 int detected_video_track_count_; | 425 int detected_video_track_count_; |
415 int detected_text_track_count_; | 426 int detected_text_track_count_; |
416 | 427 |
417 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 428 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
418 }; | 429 }; |
419 | 430 |
420 } // namespace media | 431 } // namespace media |
421 | 432 |
422 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 433 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
OLD | NEW |