Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: media/filters/chunk_demuxer.h

Issue 23702007: Render inband text tracks in the media pipeline (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: incorporate aaron's comments (10/16) Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <set>
9 #include <string> 10 #include <string>
10 #include <utility> 11 #include <utility>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
14 #include "media/base/byte_queue.h" 15 #include "media/base/byte_queue.h"
15 #include "media/base/demuxer.h" 16 #include "media/base/demuxer.h"
16 #include "media/base/ranges.h" 17 #include "media/base/ranges.h"
17 #include "media/base/stream_parser.h" 18 #include "media/base/stream_parser.h"
18 #include "media/base/text_track.h"
19 #include "media/filters/source_buffer_stream.h" 19 #include "media/filters/source_buffer_stream.h"
20 20
21 namespace media { 21 namespace media {
22 22
23 class ChunkDemuxerStream; 23 class ChunkDemuxerStream;
24 class FFmpegURLProtocol; 24 class FFmpegURLProtocol;
25 class SourceState; 25 class SourceState;
26 26
27 // Demuxer implementation that allows chunks of media data to be passed 27 // Demuxer implementation that allows chunks of media data to be passed
28 // from JavaScript to the media stack. 28 // from JavaScript to the media stack.
29 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { 29 class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
30 public: 30 public:
31 enum Status { 31 enum Status {
32 kOk, // ID added w/o error. 32 kOk, // ID added w/o error.
33 kNotSupported, // Type specified is not supported. 33 kNotSupported, // Type specified is not supported.
34 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. 34 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs.
35 }; 35 };
36 36
37 // |open_cb| Run when Initialize() is called to signal that the demuxer 37 // |open_cb| Run when Initialize() is called to signal that the demuxer
38 // is ready to receive media data via AppenData(). 38 // is ready to receive media data via AppenData().
39 // |need_key_cb| Run when the demuxer determines that an encryption key is 39 // |need_key_cb| Run when the demuxer determines that an encryption key is
40 // needed to decrypt the content. 40 // needed to decrypt the content.
41 // |add_text_track_cb| Run when demuxer detects the presence of an inband 41 // |enable_text| Process inband text tracks in the normal way when true,
42 // text track. 42 // otherwise ignore them.
43 // |log_cb| Run when parsing error messages need to be logged to the error 43 // |log_cb| Run when parsing error messages need to be logged to the error
44 // console. 44 // console.
45 ChunkDemuxer(const base::Closure& open_cb, 45 ChunkDemuxer(const base::Closure& open_cb,
46 const NeedKeyCB& need_key_cb, 46 const NeedKeyCB& need_key_cb,
47 const AddTextTrackCB& add_text_track_cb, 47 bool enable_text,
48 const LogCB& log_cb); 48 const LogCB& log_cb);
49 virtual ~ChunkDemuxer(); 49 virtual ~ChunkDemuxer();
50 50
51 // Demuxer implementation. 51 // Demuxer implementation.
52 virtual void Initialize(DemuxerHost* host, 52 virtual void Initialize(DemuxerHost* host,
53 const PipelineStatusCB& cb) OVERRIDE; 53 const PipelineStatusCB& cb) OVERRIDE;
54 virtual void Stop(const base::Closure& callback) OVERRIDE; 54 virtual void Stop(const base::Closure& callback) OVERRIDE;
55 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; 55 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE;
56 virtual void OnAudioRendererDisabled() OVERRIDE; 56 virtual void OnAudioRendererDisabled() OVERRIDE;
57 virtual DemuxerStream* GetStream(DemuxerStream::Type type) OVERRIDE; 57 virtual DemuxerStream* GetStream(DemuxerStream::Type type) OVERRIDE;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 bool CanEndOfStream_Locked() const; 164 bool CanEndOfStream_Locked() const;
165 165
166 // SourceState callbacks. 166 // SourceState callbacks.
167 void OnSourceInitDone(bool success, base::TimeDelta duration); 167 void OnSourceInitDone(bool success, base::TimeDelta duration);
168 168
169 // Creates a DemuxerStream for the specified |type|. 169 // Creates a DemuxerStream for the specified |type|.
170 // Returns a new ChunkDemuxerStream instance if a stream of this type 170 // Returns a new ChunkDemuxerStream instance if a stream of this type
171 // has not been created before. Returns NULL otherwise. 171 // has not been created before. Returns NULL otherwise.
172 ChunkDemuxerStream* CreateDemuxerStream(DemuxerStream::Type type); 172 ChunkDemuxerStream* CreateDemuxerStream(DemuxerStream::Type type);
173 173
174 bool OnTextBuffers(TextTrack* text_track, 174 void OnNewTextTrack(ChunkDemuxerStream* text_stream,
175 const StreamParser::BufferQueue& buffers); 175 TextKind kind,
acolwell GONE FROM CHROMIUM 2013/10/21 20:10:40 nit: Use const TextTrackConfig& here.
Matthew Heaney (Chromium) 2013/10/23 05:09:01 Done.
176 const std::string& name,
177 const std::string& language);
176 void OnNewMediaSegment(const std::string& source_id, 178 void OnNewMediaSegment(const std::string& source_id,
177 base::TimeDelta start_timestamp); 179 base::TimeDelta start_timestamp);
178 180
179 // Computes the intersection between the video & audio 181 // Computes the intersection between the video & audio
180 // buffered ranges. 182 // buffered ranges.
181 Ranges<base::TimeDelta> ComputeIntersection() const; 183 Ranges<base::TimeDelta> ComputeIntersection() const;
182 184
183 // Applies |time_offset| to the timestamps of |buffers|. 185 // Applies |time_offset| to the timestamps of |buffers|.
184 void AdjustBufferTimestamps(const StreamParser::BufferQueue& buffers, 186 void AdjustBufferTimestamps(const StreamParser::BufferQueue& buffers,
185 base::TimeDelta timestamp_offset); 187 base::TimeDelta timestamp_offset);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // Seeks all SourceBufferStreams to |seek_time|. 219 // Seeks all SourceBufferStreams to |seek_time|.
218 void SeekAllSources(base::TimeDelta seek_time); 220 void SeekAllSources(base::TimeDelta seek_time);
219 221
220 mutable base::Lock lock_; 222 mutable base::Lock lock_;
221 State state_; 223 State state_;
222 bool cancel_next_seek_; 224 bool cancel_next_seek_;
223 225
224 DemuxerHost* host_; 226 DemuxerHost* host_;
225 base::Closure open_cb_; 227 base::Closure open_cb_;
226 NeedKeyCB need_key_cb_; 228 NeedKeyCB need_key_cb_;
227 AddTextTrackCB add_text_track_cb_; 229 bool enable_text_;
228 // Callback used to report error strings that can help the web developer 230 // Callback used to report error strings that can help the web developer
229 // figure out what is wrong with the content. 231 // figure out what is wrong with the content.
230 LogCB log_cb_; 232 LogCB log_cb_;
231 233
232 PipelineStatusCB init_cb_; 234 PipelineStatusCB init_cb_;
233 PipelineStatusCB seek_cb_; 235 PipelineStatusCB seek_cb_;
234 236
235 scoped_ptr<ChunkDemuxerStream> audio_; 237 scoped_ptr<ChunkDemuxerStream> audio_;
236 scoped_ptr<ChunkDemuxerStream> video_; 238 scoped_ptr<ChunkDemuxerStream> video_;
237 239
(...skipping 17 matching lines...) Expand all
255 // removed with RemoveID() but can not be re-added (yet). 257 // removed with RemoveID() but can not be re-added (yet).
256 std::string source_id_audio_; 258 std::string source_id_audio_;
257 std::string source_id_video_; 259 std::string source_id_video_;
258 260
259 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); 261 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer);
260 }; 262 };
261 263
262 } // namespace media 264 } // namespace media
263 265
264 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ 266 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698