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/filters/source_buffer_stream.h" | 18 #include "media/filters/source_buffer_stream.h" |
| 19 | 19 |
| 20 namespace media { | 20 namespace media { |
| 21 | 21 |
| 22 class ChunkDemuxerClient; | |
| 23 class ChunkDemuxerStream; | 22 class ChunkDemuxerStream; |
| 24 class FFmpegURLProtocol; | 23 class FFmpegURLProtocol; |
| 25 | 24 |
| 26 // Demuxer implementation that allows chunks of media data to be passed | 25 // Demuxer implementation that allows chunks of media data to be passed |
| 27 // from JavaScript to the media stack. | 26 // from JavaScript to the media stack. |
| 28 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { | 27 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { |
| 29 public: | 28 public: |
| 30 enum Status { | 29 enum Status { |
| 31 kOk, // ID added w/o error. | 30 kOk, // ID added w/o error. |
| 32 kNotSupported, // Type specified is not supported. | 31 kNotSupported, // Type specified is not supported. |
| 33 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. | 32 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. |
| 34 }; | 33 }; |
| 35 | 34 |
| 36 explicit ChunkDemuxer(ChunkDemuxerClient* client); | 35 typedef base::Callback<void(scoped_array<uint8> init_data, |
| 36 int init_data_size)> NeedKeyCB; | |
| 37 | |
| 38 ChunkDemuxer(const base::Closure& open_cb, const NeedKeyCB& need_key_cb); | |
|
Ami GONE FROM CHROMIUM
2012/09/12 18:45:34
doco when callbacks are called
Ami GONE FROM CHROMIUM
2012/09/12 18:45:34
is it easy to see why these are not needed in Demu
acolwell GONE FROM CHROMIUM
2012/09/12 22:03:53
Done.
acolwell GONE FROM CHROMIUM
2012/09/12 22:03:53
Eventually I believe the need_key_cb could be move
| |
| 37 | 39 |
| 38 // Demuxer implementation. | 40 // Demuxer implementation. |
| 39 virtual void Initialize(DemuxerHost* host, | 41 virtual void Initialize(DemuxerHost* host, |
| 40 const PipelineStatusCB& cb) OVERRIDE; | 42 const PipelineStatusCB& cb) OVERRIDE; |
| 41 virtual void Stop(const base::Closure& callback) OVERRIDE; | 43 virtual void Stop(const base::Closure& callback) OVERRIDE; |
| 42 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; | 44 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; |
| 43 virtual void OnAudioRendererDisabled() OVERRIDE; | 45 virtual void OnAudioRendererDisabled() OVERRIDE; |
| 44 virtual scoped_refptr<DemuxerStream> GetStream( | 46 virtual scoped_refptr<DemuxerStream> GetStream( |
| 45 DemuxerStream::Type type) OVERRIDE; | 47 DemuxerStream::Type type) OVERRIDE; |
| 46 virtual base::TimeDelta GetStartTime() const OVERRIDE; | 48 virtual base::TimeDelta GetStartTime() const OVERRIDE; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 // Sets |duration_| to |new_duration| and notifies |host_|. | 155 // Sets |duration_| to |new_duration| and notifies |host_|. |
| 154 void UpdateDuration(base::TimeDelta new_duration); | 156 void UpdateDuration(base::TimeDelta new_duration); |
| 155 | 157 |
| 156 // Returns the ranges representing the buffered data in the demuxer. | 158 // Returns the ranges representing the buffered data in the demuxer. |
| 157 Ranges<base::TimeDelta> GetBufferedRanges() const; | 159 Ranges<base::TimeDelta> GetBufferedRanges() const; |
| 158 | 160 |
| 159 mutable base::Lock lock_; | 161 mutable base::Lock lock_; |
| 160 State state_; | 162 State state_; |
| 161 | 163 |
| 162 DemuxerHost* host_; | 164 DemuxerHost* host_; |
| 163 ChunkDemuxerClient* client_; | 165 base::Closure open_cb_; |
| 166 NeedKeyCB need_key_cb_; | |
| 167 | |
| 164 PipelineStatusCB init_cb_; | 168 PipelineStatusCB init_cb_; |
| 165 PipelineStatusCB seek_cb_; | 169 PipelineStatusCB seek_cb_; |
| 166 | 170 |
| 167 scoped_refptr<ChunkDemuxerStream> audio_; | 171 scoped_refptr<ChunkDemuxerStream> audio_; |
| 168 scoped_refptr<ChunkDemuxerStream> video_; | 172 scoped_refptr<ChunkDemuxerStream> video_; |
| 169 | 173 |
| 170 base::TimeDelta duration_; | 174 base::TimeDelta duration_; |
| 171 | 175 |
| 172 typedef std::map<std::string, StreamParser*> StreamParserMap; | 176 typedef std::map<std::string, StreamParser*> StreamParserMap; |
| 173 StreamParserMap stream_parser_map_; | 177 StreamParserMap stream_parser_map_; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 185 // removed with RemoveID() but can not be re-added (yet). | 189 // removed with RemoveID() but can not be re-added (yet). |
| 186 std::string source_id_audio_; | 190 std::string source_id_audio_; |
| 187 std::string source_id_video_; | 191 std::string source_id_video_; |
| 188 | 192 |
| 189 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 193 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
| 190 }; | 194 }; |
| 191 | 195 |
| 192 } // namespace media | 196 } // namespace media |
| 193 | 197 |
| 194 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 198 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
| OLD | NEW |