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 <set> | 13 #include <set> |
14 #include <string> | 14 #include <string> |
15 #include <utility> | 15 #include <utility> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
20 #include "media/base/byte_queue.h" | 20 #include "media/base/byte_queue.h" |
21 #include "media/base/demuxer.h" | 21 #include "media/base/demuxer.h" |
22 #include "media/base/demuxer_stream.h" | 22 #include "media/base/demuxer_stream.h" |
23 #include "media/base/media_tracks.h" | 23 #include "media/base/media_tracks.h" |
24 #include "media/base/ranges.h" | 24 #include "media/base/ranges.h" |
25 #include "media/base/stream_parser.h" | 25 #include "media/base/stream_parser.h" |
26 #include "media/filters/media_source_state.h" | 26 #include "media/filters/source_buffer_state.h" |
27 #include "media/filters/source_buffer_stream.h" | 27 #include "media/filters/source_buffer_stream.h" |
28 | 28 |
29 namespace media { | 29 namespace media { |
30 | 30 |
31 class FFmpegURLProtocol; | 31 class FFmpegURLProtocol; |
32 | 32 |
33 class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream { | 33 class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream { |
34 public: | 34 public: |
35 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue; | 35 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue; |
36 | 36 |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 // data. | 338 // data. |
339 void ReportError_Locked(PipelineStatus error); | 339 void ReportError_Locked(PipelineStatus error); |
340 | 340 |
341 // Returns true if any stream has seeked to a time without buffered data. | 341 // Returns true if any stream has seeked to a time without buffered data. |
342 bool IsSeekWaitingForData_Locked() const; | 342 bool IsSeekWaitingForData_Locked() const; |
343 | 343 |
344 // Returns true if all streams can successfully call EndOfStream, | 344 // Returns true if all streams can successfully call EndOfStream, |
345 // false if any can not. | 345 // false if any can not. |
346 bool CanEndOfStream_Locked() const; | 346 bool CanEndOfStream_Locked() const; |
347 | 347 |
348 // MediaSourceState callbacks. | 348 // SourceBufferState callbacks. |
349 void OnSourceInitDone(const std::string& source_id, | 349 void OnSourceInitDone(const std::string& source_id, |
350 const StreamParser::InitParameters& params); | 350 const StreamParser::InitParameters& params); |
351 | 351 |
352 // Creates a DemuxerStream of the specified |type| for the MediaSourceState | 352 // Creates a DemuxerStream of the specified |type| for the SourceBufferState |
353 // with the given |source_id|. | 353 // with the given |source_id|. |
354 // Returns a pointer to a new ChunkDemuxerStream instance, which is owned by | 354 // Returns a pointer to a new ChunkDemuxerStream instance, which is owned by |
355 // ChunkDemuxer. | 355 // ChunkDemuxer. |
356 ChunkDemuxerStream* CreateDemuxerStream(const std::string& source_id, | 356 ChunkDemuxerStream* CreateDemuxerStream(const std::string& source_id, |
357 DemuxerStream::Type type); | 357 DemuxerStream::Type type); |
358 | 358 |
359 void OnNewTextTrack(ChunkDemuxerStream* text_stream, | 359 void OnNewTextTrack(ChunkDemuxerStream* text_stream, |
360 const TextTrackConfig& config); | 360 const TextTrackConfig& config); |
361 | 361 |
362 // Returns true if |source_id| is valid, false otherwise. | 362 // Returns true if |source_id| is valid, false otherwise. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 // The duration passed to the last SetDuration(). If | 428 // The duration passed to the last SetDuration(). If |
429 // SetDuration() is never called or an AppendData() call or | 429 // SetDuration() is never called or an AppendData() call or |
430 // a EndOfStream() call changes |duration_|, then this | 430 // a EndOfStream() call changes |duration_|, then this |
431 // variable is set to < 0 to indicate that the |duration_| represents | 431 // variable is set to < 0 to indicate that the |duration_| represents |
432 // the actual duration instead of a user specified value. | 432 // the actual duration instead of a user specified value. |
433 double user_specified_duration_; | 433 double user_specified_duration_; |
434 | 434 |
435 base::Time timeline_offset_; | 435 base::Time timeline_offset_; |
436 DemuxerStream::Liveness liveness_; | 436 DemuxerStream::Liveness liveness_; |
437 | 437 |
438 std::map<std::string, std::unique_ptr<MediaSourceState>> source_state_map_; | 438 std::map<std::string, std::unique_ptr<SourceBufferState>> source_state_map_; |
439 | 439 |
440 std::map<std::string, std::vector<ChunkDemuxerStream*>> id_to_streams_map_; | 440 std::map<std::string, std::vector<ChunkDemuxerStream*>> id_to_streams_map_; |
441 // Used to hold alive the demuxer streams that were created for removed / | 441 // Used to hold alive the demuxer streams that were created for removed / |
442 // released MediaSourceState objects. Demuxer clients might still have | 442 // released SourceBufferState objects. Demuxer clients might still have |
443 // references to these streams, so we need to keep them alive. But they'll be | 443 // references to these streams, so we need to keep them alive. But they'll be |
444 // in a shut down state, so reading from them will return EOS. | 444 // in a shut down state, so reading from them will return EOS. |
445 std::vector<std::unique_ptr<ChunkDemuxerStream>> removed_streams_; | 445 std::vector<std::unique_ptr<ChunkDemuxerStream>> removed_streams_; |
446 | 446 |
447 // Indicates that splice frame generation is enabled. | 447 // Indicates that splice frame generation is enabled. |
448 const bool splice_frames_enabled_; | 448 const bool splice_frames_enabled_; |
449 | 449 |
450 // Accumulate, by type, detected track counts across the SourceBuffers. | 450 // Accumulate, by type, detected track counts across the SourceBuffers. |
451 int detected_audio_track_count_; | 451 int detected_audio_track_count_; |
452 int detected_video_track_count_; | 452 int detected_video_track_count_; |
453 int detected_text_track_count_; | 453 int detected_text_track_count_; |
454 | 454 |
455 std::map<MediaTrack::Id, DemuxerStream*> track_id_to_demux_stream_map_; | 455 std::map<MediaTrack::Id, DemuxerStream*> track_id_to_demux_stream_map_; |
456 | 456 |
457 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 457 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
458 }; | 458 }; |
459 | 459 |
460 } // namespace media | 460 } // namespace media |
461 | 461 |
462 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 462 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
OLD | NEW |