Chromium Code Reviews| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "media/base/byte_queue.h" | 14 #include "media/base/byte_queue.h" |
| 15 #include "media/base/demuxer.h" | 15 #include "media/base/demuxer.h" |
| 16 #include "media/base/ranges.h" | 16 #include "media/base/ranges.h" |
| 17 #include "media/base/stream_parser.h" | 17 #include "media/base/stream_parser.h" |
| 18 #include "media/base/text_track.h" | |
| 18 #include "media/filters/source_buffer_stream.h" | 19 #include "media/filters/source_buffer_stream.h" |
| 19 | 20 |
| 20 namespace media { | 21 namespace media { |
| 21 | 22 |
| 22 class ChunkDemuxerStream; | 23 class ChunkDemuxerStream; |
| 23 class FFmpegURLProtocol; | 24 class FFmpegURLProtocol; |
| 24 class SourceState; | 25 class SourceState; |
| 25 | 26 |
| 26 // Demuxer implementation that allows chunks of media data to be passed | 27 // Demuxer implementation that allows chunks of media data to be passed |
| 27 // from JavaScript to the media stack. | 28 // from JavaScript to the media stack. |
| 28 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { | 29 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { |
| 29 public: | 30 public: |
| 30 enum Status { | 31 enum Status { |
| 31 kOk, // ID added w/o error. | 32 kOk, // ID added w/o error. |
| 32 kNotSupported, // Type specified is not supported. | 33 kNotSupported, // Type specified is not supported. |
| 33 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. | 34 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 typedef base::Callback<void(const std::string& type, | 37 typedef base::Callback<void(const std::string& type, |
| 37 scoped_ptr<uint8[]> init_data, | 38 scoped_ptr<uint8[]> init_data, |
| 38 int init_data_size)> NeedKeyCB; | 39 int init_data_size)> NeedKeyCB; |
| 39 | 40 |
| 40 // |open_cb| Run when Initialize() is called to signal that the demuxer | 41 // |open_cb| Run when Initialize() is called to signal that the demuxer |
| 41 // is ready to receive media data via AppenData(). | 42 // is ready to receive media data via AppenData(). |
| 42 // |need_key_cb| Run when the demuxer determines that an encryption key is | 43 // |need_key_cb| Run when the demuxer determines that an encryption key is |
| 43 // needed to decrypt the content. | 44 // needed to decrypt the content. |
| 45 // |text_track_cb| Run when demuxer detects the presence of an inband | |
|
acolwell GONE FROM CHROMIUM
2013/05/10 02:22:08
nit: s/text_track_cb/add_text_track_cb/
Matthew Heaney (Chromium)
2013/05/10 05:21:08
Done.
| |
| 46 // text track. | |
| 44 // |log_cb| Run when parsing error messages need to be logged to the error | 47 // |log_cb| Run when parsing error messages need to be logged to the error |
| 45 // console. | 48 // console. |
| 46 ChunkDemuxer(const base::Closure& open_cb, const NeedKeyCB& need_key_cb, | 49 ChunkDemuxer(const base::Closure& open_cb, |
| 50 const NeedKeyCB& need_key_cb, | |
| 51 const AddTextTrackCB& add_text_track_cb, | |
| 47 const LogCB& log_cb); | 52 const LogCB& log_cb); |
| 48 virtual ~ChunkDemuxer(); | 53 virtual ~ChunkDemuxer(); |
| 49 | 54 |
| 50 // Demuxer implementation. | 55 // Demuxer implementation. |
| 51 virtual void Initialize(DemuxerHost* host, | 56 virtual void Initialize(DemuxerHost* host, |
| 52 const PipelineStatusCB& cb) OVERRIDE; | 57 const PipelineStatusCB& cb) OVERRIDE; |
| 53 virtual void Stop(const base::Closure& callback) OVERRIDE; | 58 virtual void Stop(const base::Closure& callback) OVERRIDE; |
| 54 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; | 59 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; |
| 55 virtual void OnAudioRendererDisabled() OVERRIDE; | 60 virtual void OnAudioRendererDisabled() OVERRIDE; |
| 56 virtual DemuxerStream* GetStream(DemuxerStream::Type type) OVERRIDE; | 61 virtual DemuxerStream* GetStream(DemuxerStream::Type type) OVERRIDE; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 | 173 |
| 169 // Returns the ranges representing the buffered data in the demuxer. | 174 // Returns the ranges representing the buffered data in the demuxer. |
| 170 Ranges<base::TimeDelta> GetBufferedRanges() const; | 175 Ranges<base::TimeDelta> GetBufferedRanges() const; |
| 171 | 176 |
| 172 mutable base::Lock lock_; | 177 mutable base::Lock lock_; |
| 173 State state_; | 178 State state_; |
| 174 | 179 |
| 175 DemuxerHost* host_; | 180 DemuxerHost* host_; |
| 176 base::Closure open_cb_; | 181 base::Closure open_cb_; |
| 177 NeedKeyCB need_key_cb_; | 182 NeedKeyCB need_key_cb_; |
| 183 AddTextTrackCB add_text_track_cb_; | |
| 178 // Callback used to report error strings that can help the web developer | 184 // Callback used to report error strings that can help the web developer |
| 179 // figure out what is wrong with the content. | 185 // figure out what is wrong with the content. |
| 180 LogCB log_cb_; | 186 LogCB log_cb_; |
| 181 | 187 |
| 182 PipelineStatusCB init_cb_; | 188 PipelineStatusCB init_cb_; |
| 183 PipelineStatusCB seek_cb_; | 189 PipelineStatusCB seek_cb_; |
| 184 | 190 |
| 185 scoped_ptr<ChunkDemuxerStream> audio_; | 191 scoped_ptr<ChunkDemuxerStream> audio_; |
| 186 scoped_ptr<ChunkDemuxerStream> video_; | 192 scoped_ptr<ChunkDemuxerStream> video_; |
| 187 | 193 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 205 // removed with RemoveID() but can not be re-added (yet). | 211 // removed with RemoveID() but can not be re-added (yet). |
| 206 std::string source_id_audio_; | 212 std::string source_id_audio_; |
| 207 std::string source_id_video_; | 213 std::string source_id_video_; |
| 208 | 214 |
| 209 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 215 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
| 210 }; | 216 }; |
| 211 | 217 |
| 212 } // namespace media | 218 } // namespace media |
| 213 | 219 |
| 214 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 220 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
| OLD | NEW |