| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 Status AddId(const std::string& id, const std::string& type, | 91 Status AddId(const std::string& id, const std::string& type, |
| 92 std::vector<std::string>& codecs); | 92 std::vector<std::string>& codecs); |
| 93 | 93 |
| 94 // Removed an ID & associated resources that were previously added with | 94 // Removed an ID & associated resources that were previously added with |
| 95 // AddId(). | 95 // AddId(). |
| 96 void RemoveId(const std::string& id); | 96 void RemoveId(const std::string& id); |
| 97 | 97 |
| 98 // Gets the currently buffered ranges for the specified ID. | 98 // Gets the currently buffered ranges for the specified ID. |
| 99 Ranges<base::TimeDelta> GetBufferedRanges(const std::string& id) const; | 99 Ranges<base::TimeDelta> GetBufferedRanges(const std::string& id) const; |
| 100 | 100 |
| 101 // Appends media data to the source buffer associated with |id|. | 101 // Appends media data to the source buffer associated with |id|, applying |
| 102 // Appending may update |*timestamp_offset| if |timestamp_offset| is not NULL. | 102 // and possibly updating |*timestamp_offset| during coded frame processing. |
| 103 // |append_window_start| and |append_window_end| correspond to the MSE spec's |
| 104 // similarly named source buffer attributes that are used in coded frame |
| 105 // processing. |
| 103 void AppendData(const std::string& id, const uint8* data, size_t length, | 106 void AppendData(const std::string& id, const uint8* data, size_t length, |
| 104 double* timestamp_offset); | 107 base::TimeDelta append_window_start, |
| 108 base::TimeDelta append_window_end, |
| 109 base::TimeDelta* timestamp_offset); |
| 105 | 110 |
| 106 // Aborts parsing the current segment and reset the parser to a state where | 111 // Aborts parsing the current segment and reset the parser to a state where |
| 107 // it can accept a new segment. | 112 // it can accept a new segment. |
| 108 void Abort(const std::string& id); | 113 void Abort(const std::string& id); |
| 109 | 114 |
| 110 // Remove buffers between |start| and |end| for the source buffer | 115 // Remove buffers between |start| and |end| for the source buffer |
| 111 // associated with |id|. | 116 // associated with |id|. |
| 112 void Remove(const std::string& id, base::TimeDelta start, | 117 void Remove(const std::string& id, base::TimeDelta start, |
| 113 base::TimeDelta end); | 118 base::TimeDelta end); |
| 114 | 119 |
| 115 // Returns the current presentation duration. | 120 // Returns the current presentation duration. |
| 116 double GetDuration(); | 121 double GetDuration(); |
| 117 double GetDuration_Locked(); | 122 double GetDuration_Locked(); |
| 118 | 123 |
| 119 // Notifies the demuxer that the duration of the media has changed to | 124 // Notifies the demuxer that the duration of the media has changed to |
| 120 // |duration|. | 125 // |duration|. |
| 121 void SetDuration(double duration); | 126 void SetDuration(double duration); |
| 122 | 127 |
| 123 // Sets a time |offset| to be applied to subsequent buffers appended to the | 128 // Returns true if the source buffer associated with |id| is currently parsing |
| 124 // source buffer associated with |id|. Returns true if the offset is set | 129 // a media segment, or false otherwise. |
| 125 // properly, false if the offset cannot be applied because we're in the | 130 bool IsParsingMediaSegment(const std::string& id); |
| 126 // middle of parsing a media segment. | |
| 127 bool SetTimestampOffset(const std::string& id, base::TimeDelta offset); | |
| 128 | 131 |
| 129 // Set the append mode to be applied to subsequent buffers appended to the | 132 // Set the append mode to be applied to subsequent buffers appended to the |
| 130 // source buffer associated with |id|. If |sequence_mode| is true, caller | 133 // source buffer associated with |id|. If |sequence_mode| is true, caller |
| 131 // is requesting "sequence" mode. Otherwise, caller is requesting "segments" | 134 // is requesting "sequence" mode. Otherwise, caller is requesting "segments" |
| 132 // mode. Returns true if the mode update was allowed. Returns false if | 135 // mode. |
| 133 // the mode cannot be updated because we're in the middle of parsing a media | 136 void SetSequenceMode(const std::string& id, bool sequence_mode); |
| 134 // segment. | |
| 135 // In "sequence" mode, appended media will be treated as adjacent in time. | |
| 136 // In "segments" mode, timestamps in appended media determine coded frame | |
| 137 // placement. | |
| 138 bool SetSequenceMode(const std::string& id, bool sequence_mode); | |
| 139 | 137 |
| 140 // Called to signal changes in the "end of stream" | 138 // Called to signal changes in the "end of stream" |
| 141 // state. UnmarkEndOfStream() must not be called if a matching | 139 // state. UnmarkEndOfStream() must not be called if a matching |
| 142 // MarkEndOfStream() has not come before it. | 140 // MarkEndOfStream() has not come before it. |
| 143 void MarkEndOfStream(PipelineStatus status); | 141 void MarkEndOfStream(PipelineStatus status); |
| 144 void UnmarkEndOfStream(); | 142 void UnmarkEndOfStream(); |
| 145 | 143 |
| 146 // Set the append window start and end values for the source buffer | |
| 147 // associated with |id|. | |
| 148 void SetAppendWindowStart(const std::string& id, base::TimeDelta start); | |
| 149 void SetAppendWindowEnd(const std::string& id, base::TimeDelta end); | |
| 150 | |
| 151 void Shutdown(); | 144 void Shutdown(); |
| 152 | 145 |
| 153 // Sets the memory limit on each stream. |memory_limit| is the | 146 // Sets the memory limit on each stream. |memory_limit| is the |
| 154 // maximum number of bytes each stream is allowed to hold in its buffer. | 147 // maximum number of bytes each stream is allowed to hold in its buffer. |
| 155 void SetMemoryLimitsForTesting(int memory_limit); | 148 void SetMemoryLimitsForTesting(int memory_limit); |
| 156 | 149 |
| 157 // Returns the ranges representing the buffered data in the demuxer. | 150 // Returns the ranges representing the buffered data in the demuxer. |
| 158 // TODO(wolenetz): Remove this method once MediaSourceDelegate no longer | 151 // TODO(wolenetz): Remove this method once MediaSourceDelegate no longer |
| 159 // requires it for doing hack browser seeks to I-frame on Android. See | 152 // requires it for doing hack browser seeks to I-frame on Android. See |
| 160 // http://crbug.com/304234. | 153 // http://crbug.com/304234. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 // removed with RemoveID() but can not be re-added (yet). | 268 // removed with RemoveID() but can not be re-added (yet). |
| 276 std::string source_id_audio_; | 269 std::string source_id_audio_; |
| 277 std::string source_id_video_; | 270 std::string source_id_video_; |
| 278 | 271 |
| 279 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 272 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
| 280 }; | 273 }; |
| 281 | 274 |
| 282 } // namespace media | 275 } // namespace media |
| 283 | 276 |
| 284 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 277 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
| OLD | NEW |