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 <list> | 8 #include <list> |
9 | 9 |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
11 #include "media/base/byte_queue.h" | 11 #include "media/base/byte_queue.h" |
12 #include "media/base/demuxer.h" | 12 #include "media/base/demuxer.h" |
13 #include "media/base/stream_parser.h" | 13 #include "media/base/stream_parser.h" |
14 | 14 |
15 namespace media { | 15 namespace media { |
16 | 16 |
17 class ChunkDemuxerClient; | 17 class ChunkDemuxerClient; |
18 class ChunkDemuxerStream; | 18 class ChunkDemuxerStream; |
19 class FFmpegURLProtocol; | 19 class FFmpegURLProtocol; |
20 | 20 |
21 // Demuxer implementation that allows chunks of media data to be passed | 21 // Demuxer implementation that allows chunks of media data to be passed |
22 // from JavaScript to the media stack. | 22 // from JavaScript to the media stack. |
23 class MEDIA_EXPORT ChunkDemuxer : public Demuxer, public StreamParserHost { | 23 class MEDIA_EXPORT ChunkDemuxer : public Demuxer, public StreamParserHost { |
24 public: | 24 public: |
25 explicit ChunkDemuxer(ChunkDemuxerClient* client); | 25 explicit ChunkDemuxer(ChunkDemuxerClient* client); |
26 virtual ~ChunkDemuxer(); | 26 virtual ~ChunkDemuxer(); |
27 | 27 |
28 // Demuxer implementation. | 28 // Demuxer implementation. |
29 virtual void Initialize(const PipelineStatusCB& cb) OVERRIDE; | 29 virtual void Initialize(DemuxerHost* host, |
| 30 const PipelineStatusCB& cb) OVERRIDE; |
30 virtual void Stop(const base::Closure& callback) OVERRIDE; | 31 virtual void Stop(const base::Closure& callback) OVERRIDE; |
31 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; | 32 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; |
32 virtual void OnAudioRendererDisabled() OVERRIDE; | 33 virtual void OnAudioRendererDisabled() OVERRIDE; |
33 virtual scoped_refptr<DemuxerStream> GetStream( | 34 virtual scoped_refptr<DemuxerStream> GetStream( |
34 DemuxerStream::Type type) OVERRIDE; | 35 DemuxerStream::Type type) OVERRIDE; |
35 virtual base::TimeDelta GetStartTime() const OVERRIDE; | 36 virtual base::TimeDelta GetStartTime() const OVERRIDE; |
36 virtual int GetBitrate() OVERRIDE; | 37 virtual int GetBitrate() OVERRIDE; |
37 virtual bool IsLocalSource() OVERRIDE; | 38 virtual bool IsLocalSource() OVERRIDE; |
38 virtual bool IsSeekable() OVERRIDE; | 39 virtual bool IsSeekable() OVERRIDE; |
39 | 40 |
(...skipping 27 matching lines...) Expand all Loading... |
67 | 68 |
68 // StreamParserHost implementation. | 69 // StreamParserHost implementation. |
69 virtual bool OnNewAudioConfig(const AudioDecoderConfig& config) OVERRIDE; | 70 virtual bool OnNewAudioConfig(const AudioDecoderConfig& config) OVERRIDE; |
70 virtual bool OnNewVideoConfig(const VideoDecoderConfig& config) OVERRIDE; | 71 virtual bool OnNewVideoConfig(const VideoDecoderConfig& config) OVERRIDE; |
71 virtual bool OnAudioBuffers(const BufferQueue& buffer) OVERRIDE; | 72 virtual bool OnAudioBuffers(const BufferQueue& buffer) OVERRIDE; |
72 virtual bool OnVideoBuffers(const BufferQueue& buffer) OVERRIDE; | 73 virtual bool OnVideoBuffers(const BufferQueue& buffer) OVERRIDE; |
73 | 74 |
74 base::Lock lock_; | 75 base::Lock lock_; |
75 State state_; | 76 State state_; |
76 | 77 |
| 78 DemuxerHost* host_; |
77 ChunkDemuxerClient* client_; | 79 ChunkDemuxerClient* client_; |
78 PipelineStatusCB init_cb_; | 80 PipelineStatusCB init_cb_; |
79 PipelineStatusCB seek_cb_; | 81 PipelineStatusCB seek_cb_; |
80 | 82 |
81 scoped_refptr<ChunkDemuxerStream> audio_; | 83 scoped_refptr<ChunkDemuxerStream> audio_; |
82 scoped_refptr<ChunkDemuxerStream> video_; | 84 scoped_refptr<ChunkDemuxerStream> video_; |
83 | 85 |
84 int64 buffered_bytes_; | 86 int64 buffered_bytes_; |
85 | 87 |
86 base::TimeDelta duration_; | 88 base::TimeDelta duration_; |
87 | 89 |
88 scoped_ptr<StreamParser> stream_parser_; | 90 scoped_ptr<StreamParser> stream_parser_; |
89 | 91 |
90 // Should a Seek() call wait for more data before calling the | 92 // Should a Seek() call wait for more data before calling the |
91 // callback. | 93 // callback. |
92 bool seek_waits_for_data_; | 94 bool seek_waits_for_data_; |
93 | 95 |
94 ByteQueue byte_queue_; | 96 ByteQueue byte_queue_; |
95 | 97 |
96 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 98 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
97 }; | 99 }; |
98 | 100 |
99 } // namespace media | 101 } // namespace media |
100 | 102 |
101 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 103 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
OLD | NEW |