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 14 matching lines...) Expand all Loading... |
25 // Demuxer implementation that allows chunks of media data to be passed | 25 // Demuxer implementation that allows chunks of media data to be passed |
26 // from JavaScript to the media stack. | 26 // from JavaScript to the media stack. |
27 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { | 27 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { |
28 public: | 28 public: |
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(scoped_array<uint8> init_data, | 35 typedef base::Callback<void(const std::string& type, |
| 36 scoped_array<uint8> init_data, |
36 int init_data_size)> NeedKeyCB; | 37 int init_data_size)> NeedKeyCB; |
37 | 38 |
38 // |open_cb| Run when Initialize() is called to signal that the demuxer | 39 // |open_cb| Run when Initialize() is called to signal that the demuxer |
39 // is ready to receive media data via AppenData(). | 40 // is ready to receive media data via AppenData(). |
40 // |need_key_cb| Run when the demuxer determines that an encryption key is | 41 // |need_key_cb| Run when the demuxer determines that an encryption key is |
41 // needed to decrypt the content. | 42 // needed to decrypt the content. |
42 ChunkDemuxer(const base::Closure& open_cb, const NeedKeyCB& need_key_cb); | 43 ChunkDemuxer(const base::Closure& open_cb, const NeedKeyCB& need_key_cb); |
43 | 44 |
44 // Demuxer implementation. | 45 // Demuxer implementation. |
45 virtual void Initialize(DemuxerHost* host, | 46 virtual void Initialize(DemuxerHost* host, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // false if any can not. | 123 // false if any can not. |
123 bool CanEndOfStream_Locked() const; | 124 bool CanEndOfStream_Locked() const; |
124 | 125 |
125 // StreamParser callbacks. | 126 // StreamParser callbacks. |
126 void OnStreamParserInitDone(bool success, base::TimeDelta duration); | 127 void OnStreamParserInitDone(bool success, base::TimeDelta duration); |
127 bool OnNewConfigs(bool has_audio, bool has_video, | 128 bool OnNewConfigs(bool has_audio, bool has_video, |
128 const AudioDecoderConfig& audio_config, | 129 const AudioDecoderConfig& audio_config, |
129 const VideoDecoderConfig& video_config); | 130 const VideoDecoderConfig& video_config); |
130 bool OnAudioBuffers(const StreamParser::BufferQueue& buffers); | 131 bool OnAudioBuffers(const StreamParser::BufferQueue& buffers); |
131 bool OnVideoBuffers(const StreamParser::BufferQueue& buffers); | 132 bool OnVideoBuffers(const StreamParser::BufferQueue& buffers); |
132 bool OnNeedKey(scoped_array<uint8> init_data, int init_data_size); | 133 bool OnNeedKey(const std::string& type, |
| 134 scoped_array<uint8> init_data, |
| 135 int init_data_size); |
133 void OnNewMediaSegment(const std::string& source_id, | 136 void OnNewMediaSegment(const std::string& source_id, |
134 base::TimeDelta start_timestamp); | 137 base::TimeDelta start_timestamp); |
135 void OnEndOfMediaSegment(const std::string& source_id); | 138 void OnEndOfMediaSegment(const std::string& source_id); |
136 | 139 |
137 // Computes the intersection between the video & audio | 140 // Computes the intersection between the video & audio |
138 // buffered ranges. | 141 // buffered ranges. |
139 Ranges<base::TimeDelta> ComputeIntersection() const; | 142 Ranges<base::TimeDelta> ComputeIntersection() const; |
140 | 143 |
141 // Applies |time_offset| to the timestamps of |buffers|. | 144 // Applies |time_offset| to the timestamps of |buffers|. |
142 void AdjustBufferTimestamps(const StreamParser::BufferQueue& buffers, | 145 void AdjustBufferTimestamps(const StreamParser::BufferQueue& buffers, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // removed with RemoveID() but can not be re-added (yet). | 196 // removed with RemoveID() but can not be re-added (yet). |
194 std::string source_id_audio_; | 197 std::string source_id_audio_; |
195 std::string source_id_video_; | 198 std::string source_id_video_; |
196 | 199 |
197 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 200 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
198 }; | 201 }; |
199 | 202 |
200 } // namespace media | 203 } // namespace media |
201 | 204 |
202 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 205 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
OLD | NEW |