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 15 matching lines...) Expand all Loading... |
26 // Demuxer implementation that allows chunks of media data to be passed | 26 // Demuxer implementation that allows chunks of media data to be passed |
27 // from JavaScript to the media stack. | 27 // from JavaScript to the media stack. |
28 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { | 28 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { |
29 public: | 29 public: |
30 enum Status { | 30 enum Status { |
31 kOk, // ID added w/o error. | 31 kOk, // ID added w/o error. |
32 kNotSupported, // Type specified is not supported. | 32 kNotSupported, // Type specified is not supported. |
33 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. | 33 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. |
34 }; | 34 }; |
35 | 35 |
| 36 enum AppendMode { |
| 37 kSegments, // Timestamps in appended media determine coded frame placement. |
| 38 kSequence // Appended media will be treated as adjacent in time. |
| 39 }; |
| 40 |
36 // |open_cb| Run when Initialize() is called to signal that the demuxer | 41 // |open_cb| Run when Initialize() is called to signal that the demuxer |
37 // is ready to receive media data via AppenData(). | 42 // is ready to receive media data via AppenData(). |
38 // |need_key_cb| Run when the demuxer determines that an encryption key is | 43 // |need_key_cb| Run when the demuxer determines that an encryption key is |
39 // needed to decrypt the content. | 44 // needed to decrypt the content. |
40 // |enable_text| Process inband text tracks in the normal way when true, | 45 // |enable_text| Process inband text tracks in the normal way when true, |
41 // otherwise ignore them. | 46 // otherwise ignore them. |
42 // |log_cb| Run when parsing error messages need to be logged to the error | 47 // |log_cb| Run when parsing error messages need to be logged to the error |
43 // console. | 48 // console. |
44 ChunkDemuxer(const base::Closure& open_cb, | 49 ChunkDemuxer(const base::Closure& open_cb, |
45 const NeedKeyCB& need_key_cb, | 50 const NeedKeyCB& need_key_cb, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Notifies the demuxer that the duration of the media has changed to | 122 // Notifies the demuxer that the duration of the media has changed to |
118 // |duration|. | 123 // |duration|. |
119 void SetDuration(double duration); | 124 void SetDuration(double duration); |
120 | 125 |
121 // Sets a time |offset| to be applied to subsequent buffers appended to the | 126 // Sets a time |offset| to be applied to subsequent buffers appended to the |
122 // source buffer associated with |id|. Returns true if the offset is set | 127 // source buffer associated with |id|. Returns true if the offset is set |
123 // properly, false if the offset cannot be applied because we're in the | 128 // properly, false if the offset cannot be applied because we're in the |
124 // middle of parsing a media segment. | 129 // middle of parsing a media segment. |
125 bool SetTimestampOffset(const std::string& id, base::TimeDelta offset); | 130 bool SetTimestampOffset(const std::string& id, base::TimeDelta offset); |
126 | 131 |
| 132 // Set the append mode to be applied to subsequent buffers appended to the |
| 133 // source buffer associated with |id|. Returns true if the mode is set |
| 134 // properly, false if the mode cannot be set because we're in the middle of |
| 135 // parsing a media segment. |
| 136 bool SetAppendMode(const std::string& id, AppendMode mode); |
| 137 |
127 // Called to signal changes in the "end of stream" | 138 // Called to signal changes in the "end of stream" |
128 // state. UnmarkEndOfStream() must not be called if a matching | 139 // state. UnmarkEndOfStream() must not be called if a matching |
129 // MarkEndOfStream() has not come before it. | 140 // MarkEndOfStream() has not come before it. |
130 void MarkEndOfStream(PipelineStatus status); | 141 void MarkEndOfStream(PipelineStatus status); |
131 void UnmarkEndOfStream(); | 142 void UnmarkEndOfStream(); |
132 | 143 |
133 // Set the append window start and end values for the source buffer | 144 // Set the append window start and end values for the source buffer |
134 // associated with |id|. | 145 // associated with |id|. |
135 void SetAppendWindowStart(const std::string& id, base::TimeDelta start); | 146 void SetAppendWindowStart(const std::string& id, base::TimeDelta start); |
136 void SetAppendWindowEnd(const std::string& id, base::TimeDelta end); | 147 void SetAppendWindowEnd(const std::string& id, base::TimeDelta end); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // removed with RemoveID() but can not be re-added (yet). | 277 // removed with RemoveID() but can not be re-added (yet). |
267 std::string source_id_audio_; | 278 std::string source_id_audio_; |
268 std::string source_id_video_; | 279 std::string source_id_video_; |
269 | 280 |
270 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 281 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
271 }; | 282 }; |
272 | 283 |
273 } // namespace media | 284 } // namespace media |
274 | 285 |
275 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 286 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
OLD | NEW |