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 <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "media/base/byte_queue.h" | 15 #include "media/base/byte_queue.h" |
16 #include "media/base/demuxer.h" | 16 #include "media/base/demuxer.h" |
17 #include "media/base/ranges.h" | 17 #include "media/base/ranges.h" |
18 #include "media/base/stream_parser.h" | 18 #include "media/base/stream_parser.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 FFmpegURLProtocol; | 23 class FFmpegURLProtocol; |
24 class SourceState; | 24 class SourceState; |
25 | 25 |
26 class ChunkDemuxerStream : public DemuxerStream { | 26 class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream { |
27 public: | 27 public: |
28 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue; | 28 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue; |
29 | 29 |
30 explicit ChunkDemuxerStream(Type type, bool splice_frames_enabled); | 30 explicit ChunkDemuxerStream(Type type, bool splice_frames_enabled); |
31 virtual ~ChunkDemuxerStream(); | 31 virtual ~ChunkDemuxerStream(); |
32 | 32 |
33 // ChunkDemuxerStream control methods. | 33 // ChunkDemuxerStream control methods. |
34 void StartReturningData(); | 34 void StartReturningData(); |
35 void AbortReads(); | 35 void AbortReads(); |
36 void CompletePendingReadIfPossible(); | 36 void CompletePendingReadIfPossible(); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // call received before a StartWaitingForSeek() call to immediately call its | 186 // call received before a StartWaitingForSeek() call to immediately call its |
187 // callback without waiting for any data. | 187 // callback without waiting for any data. |
188 // |seek_time| - The presentation timestamp for the seek request that | 188 // |seek_time| - The presentation timestamp for the seek request that |
189 // triggered this call. It represents the most recent position the caller is | 189 // triggered this call. It represents the most recent position the caller is |
190 // trying to seek to. | 190 // trying to seek to. |
191 void CancelPendingSeek(base::TimeDelta seek_time); | 191 void CancelPendingSeek(base::TimeDelta seek_time); |
192 | 192 |
193 // Registers a new |id| to use for AppendData() calls. |type| indicates | 193 // Registers a new |id| to use for AppendData() calls. |type| indicates |
194 // the MIME type for the data that we intend to append for this ID. | 194 // the MIME type for the data that we intend to append for this ID. |
195 // |use_legacy_frame_processor| determines which of LegacyFrameProcessor or | 195 // |use_legacy_frame_processor| determines which of LegacyFrameProcessor or |
196 // a (not yet implemented) more compliant frame processor to use to process | 196 // FrameProcessor to use to process parsed frames from AppendData() calls. |
197 // parsed frames from AppendData() calls. | |
198 // TODO(wolenetz): Enable usage of new frame processor based on this flag. | |
199 // See http://crbug.com/249422. | |
200 // kOk is returned if the demuxer has enough resources to support another ID | 197 // kOk is returned if the demuxer has enough resources to support another ID |
201 // and supports the format indicated by |type|. | 198 // and supports the format indicated by |type|. |
202 // kNotSupported is returned if |type| is not a supported format. | 199 // kNotSupported is returned if |type| is not a supported format. |
203 // kReachedIdLimit is returned if the demuxer cannot handle another ID right | 200 // kReachedIdLimit is returned if the demuxer cannot handle another ID right |
204 // now. | 201 // now. |
205 Status AddId(const std::string& id, const std::string& type, | 202 Status AddId(const std::string& id, const std::string& type, |
206 std::vector<std::string>& codecs, | 203 std::vector<std::string>& codecs, |
207 const bool use_legacy_frame_processor); | 204 const bool use_legacy_frame_processor); |
208 | 205 |
209 // Removed an ID & associated resources that were previously added with | 206 // Removed an ID & associated resources that were previously added with |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 // Returns true if the source buffer associated with |id| is currently parsing | 245 // Returns true if the source buffer associated with |id| is currently parsing |
249 // a media segment, or false otherwise. | 246 // a media segment, or false otherwise. |
250 bool IsParsingMediaSegment(const std::string& id); | 247 bool IsParsingMediaSegment(const std::string& id); |
251 | 248 |
252 // Set the append mode to be applied to subsequent buffers appended to the | 249 // Set the append mode to be applied to subsequent buffers appended to the |
253 // source buffer associated with |id|. If |sequence_mode| is true, caller | 250 // source buffer associated with |id|. If |sequence_mode| is true, caller |
254 // is requesting "sequence" mode. Otherwise, caller is requesting "segments" | 251 // is requesting "sequence" mode. Otherwise, caller is requesting "segments" |
255 // mode. | 252 // mode. |
256 void SetSequenceMode(const std::string& id, bool sequence_mode); | 253 void SetSequenceMode(const std::string& id, bool sequence_mode); |
257 | 254 |
| 255 // Signals the coded frame processor for the source buffer associated with |
| 256 // |id| to update its group start timestamp to be |timestamp_offset| if it is |
| 257 // in sequence append mode. |
| 258 void SetGroupStartTimestampIfInSequenceMode(const std::string& id, |
| 259 base::TimeDelta timestamp_offset); |
| 260 |
258 // Called to signal changes in the "end of stream" | 261 // Called to signal changes in the "end of stream" |
259 // state. UnmarkEndOfStream() must not be called if a matching | 262 // state. UnmarkEndOfStream() must not be called if a matching |
260 // MarkEndOfStream() has not come before it. | 263 // MarkEndOfStream() has not come before it. |
261 void MarkEndOfStream(PipelineStatus status); | 264 void MarkEndOfStream(PipelineStatus status); |
262 void UnmarkEndOfStream(); | 265 void UnmarkEndOfStream(); |
263 | 266 |
264 void Shutdown(); | 267 void Shutdown(); |
265 | 268 |
266 // Sets the memory limit on each stream. |memory_limit| is the | 269 // Sets the memory limit on each stream. |memory_limit| is the |
267 // maximum number of bytes each stream is allowed to hold in its buffer. | 270 // maximum number of bytes each stream is allowed to hold in its buffer. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 389 |
387 // Indicates that splice frame generation is enabled. | 390 // Indicates that splice frame generation is enabled. |
388 const bool splice_frames_enabled_; | 391 const bool splice_frames_enabled_; |
389 | 392 |
390 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 393 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
391 }; | 394 }; |
392 | 395 |
393 } // namespace media | 396 } // namespace media |
394 | 397 |
395 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 398 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
OLD | NEW |