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> |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 enum Status { | 29 enum Status { |
| 30 kOk, // ID added w/o error. | 30 kOk, // ID added w/o error. |
| 31 kNotSupported, // Type specified is not supported. | 31 kNotSupported, // Type specified is not supported. |
| 32 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. | 32 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 typedef base::Callback<void(const std::string& type, | 35 typedef base::Callback<void(const std::string& type, |
| 36 scoped_array<uint8> init_data, | 36 scoped_array<uint8> init_data, |
| 37 int init_data_size)> NeedKeyCB; | 37 int init_data_size)> NeedKeyCB; |
| 38 | 38 |
| 39 // TODO(matthewjheaney): temp hack to test cue rendering. We must | |
| 40 // either remove the callback entirely, or keep it but add the | |
| 41 // actual cue payload. | |
| 42 typedef base::Callback<void(const base::TimeDelta& time)> TextCB; | |
| 43 | |
| 39 // |open_cb| Run when Initialize() is called to signal that the demuxer | 44 // |open_cb| Run when Initialize() is called to signal that the demuxer |
| 40 // is ready to receive media data via AppenData(). | 45 // is ready to receive media data via AppenData(). |
| 41 // |need_key_cb| Run when the demuxer determines that an encryption key is | 46 // |need_key_cb| Run when the demuxer determines that an encryption key is |
| 42 // needed to decrypt the content. | 47 // needed to decrypt the content. |
| 43 // |log_cb| Run when parsing error messages need to be logged to the error | 48 // |log_cb| Run when parsing error messages need to be logged to the error |
| 44 // console. | 49 // console. |
| 45 ChunkDemuxer(const base::Closure& open_cb, const NeedKeyCB& need_key_cb, | 50 ChunkDemuxer(const base::Closure& open_cb, const NeedKeyCB& need_key_cb, |
| 51 const TextTrackCB& text_track_cb, | |
| 52 // TODO(matthewjheaney): TextCB is temp hack to test | |
| 53 // cue rendering. We must either remove the callback | |
| 54 // entirely, or keep it but add the actual cue payload. | |
| 55 const TextCB& text_cb, | |
|
acolwell GONE FROM CHROMIUM
2013/04/05 16:29:23
I think this should be removed and the NewTextTrac
Matthew Heaney (Chromium)
2013/05/09 03:53:11
I changed this per your sketch of the mechanism.
| |
| 46 const LogCB& log_cb); | 56 const LogCB& log_cb); |
| 47 | 57 |
| 48 // Demuxer implementation. | 58 // Demuxer implementation. |
| 49 virtual void Initialize(DemuxerHost* host, | 59 virtual void Initialize(DemuxerHost* host, |
| 50 const PipelineStatusCB& cb) OVERRIDE; | 60 const PipelineStatusCB& cb) OVERRIDE; |
| 51 virtual void Stop(const base::Closure& callback) OVERRIDE; | 61 virtual void Stop(const base::Closure& callback) OVERRIDE; |
| 52 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; | 62 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; |
| 53 virtual void OnAudioRendererDisabled() OVERRIDE; | 63 virtual void OnAudioRendererDisabled() OVERRIDE; |
| 54 virtual scoped_refptr<DemuxerStream> GetStream( | 64 virtual scoped_refptr<DemuxerStream> GetStream( |
| 55 DemuxerStream::Type type) OVERRIDE; | 65 DemuxerStream::Type type) OVERRIDE; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 // StreamParser callbacks. | 142 // StreamParser callbacks. |
| 133 void OnStreamParserInitDone(bool success, base::TimeDelta duration); | 143 void OnStreamParserInitDone(bool success, base::TimeDelta duration); |
| 134 bool OnNewConfigs(bool has_audio, bool has_video, | 144 bool OnNewConfigs(bool has_audio, bool has_video, |
| 135 const AudioDecoderConfig& audio_config, | 145 const AudioDecoderConfig& audio_config, |
| 136 const VideoDecoderConfig& video_config); | 146 const VideoDecoderConfig& video_config); |
| 137 bool OnAudioBuffers(const StreamParser::BufferQueue& buffers); | 147 bool OnAudioBuffers(const StreamParser::BufferQueue& buffers); |
| 138 bool OnVideoBuffers(const StreamParser::BufferQueue& buffers); | 148 bool OnVideoBuffers(const StreamParser::BufferQueue& buffers); |
| 139 bool OnNeedKey(const std::string& type, | 149 bool OnNeedKey(const std::string& type, |
| 140 scoped_array<uint8> init_data, | 150 scoped_array<uint8> init_data, |
| 141 int init_data_size); | 151 int init_data_size); |
| 152 bool OnTextBuffers(const StreamParser::BufferQueue& buffers); | |
| 142 void OnNewMediaSegment(const std::string& source_id, | 153 void OnNewMediaSegment(const std::string& source_id, |
| 143 base::TimeDelta start_timestamp); | 154 base::TimeDelta start_timestamp); |
| 144 void OnEndOfMediaSegment(const std::string& source_id); | 155 void OnEndOfMediaSegment(const std::string& source_id); |
| 145 | 156 |
| 146 // Computes the intersection between the video & audio | 157 // Computes the intersection between the video & audio |
| 147 // buffered ranges. | 158 // buffered ranges. |
| 148 Ranges<base::TimeDelta> ComputeIntersection() const; | 159 Ranges<base::TimeDelta> ComputeIntersection() const; |
| 149 | 160 |
| 150 // Applies |time_offset| to the timestamps of |buffers|. | 161 // Applies |time_offset| to the timestamps of |buffers|. |
| 151 void AdjustBufferTimestamps(const StreamParser::BufferQueue& buffers, | 162 void AdjustBufferTimestamps(const StreamParser::BufferQueue& buffers, |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 171 | 182 |
| 172 // Returns the ranges representing the buffered data in the demuxer. | 183 // Returns the ranges representing the buffered data in the demuxer. |
| 173 Ranges<base::TimeDelta> GetBufferedRanges() const; | 184 Ranges<base::TimeDelta> GetBufferedRanges() const; |
| 174 | 185 |
| 175 mutable base::Lock lock_; | 186 mutable base::Lock lock_; |
| 176 State state_; | 187 State state_; |
| 177 | 188 |
| 178 DemuxerHost* host_; | 189 DemuxerHost* host_; |
| 179 base::Closure open_cb_; | 190 base::Closure open_cb_; |
| 180 NeedKeyCB need_key_cb_; | 191 NeedKeyCB need_key_cb_; |
| 192 TextTrackCB text_track_cb_; | |
| 193 TextCB text_cb_; // TODO(matthewjheaney): temp hack to test cue rendering | |
| 181 // Callback used to report error strings that can help the web developer | 194 // Callback used to report error strings that can help the web developer |
| 182 // figure out what is wrong with the content. | 195 // figure out what is wrong with the content. |
| 183 LogCB log_cb_; | 196 LogCB log_cb_; |
| 184 | 197 |
| 185 PipelineStatusCB init_cb_; | 198 PipelineStatusCB init_cb_; |
| 186 PipelineStatusCB seek_cb_; | 199 PipelineStatusCB seek_cb_; |
| 187 | 200 |
| 188 scoped_refptr<ChunkDemuxerStream> audio_; | 201 scoped_refptr<ChunkDemuxerStream> audio_; |
| 189 scoped_refptr<ChunkDemuxerStream> video_; | 202 scoped_refptr<ChunkDemuxerStream> video_; |
| 190 | 203 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 213 // removed with RemoveID() but can not be re-added (yet). | 226 // removed with RemoveID() but can not be re-added (yet). |
| 214 std::string source_id_audio_; | 227 std::string source_id_audio_; |
| 215 std::string source_id_video_; | 228 std::string source_id_video_; |
| 216 | 229 |
| 217 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 230 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
| 218 }; | 231 }; |
| 219 | 232 |
| 220 } // namespace media | 233 } // namespace media |
| 221 | 234 |
| 222 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 235 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
| OLD | NEW |