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