| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SOURCE_BUFFER_RANGE_H_ | 5 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_ |
| 6 #define MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_ | 6 #define MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 // Returns true if the range knows the position of the next buffer it should | 172 // Returns true if the range knows the position of the next buffer it should |
| 173 // return, i.e. it has been Seek()ed. This does not necessarily mean that it | 173 // return, i.e. it has been Seek()ed. This does not necessarily mean that it |
| 174 // has the next buffer yet. | 174 // has the next buffer yet. |
| 175 bool HasNextBufferPosition() const; | 175 bool HasNextBufferPosition() const; |
| 176 | 176 |
| 177 // Resets this range to an "unseeked" state. | 177 // Resets this range to an "unseeked" state. |
| 178 void ResetNextBufferPosition(); | 178 void ResetNextBufferPosition(); |
| 179 | 179 |
| 180 // Returns the timestamp of the next buffer that will be returned from | 180 // Returns the timestamp of the next buffer that will be returned from |
| 181 // GetNextBuffer(), or kNoTimestamp() if the timestamp is unknown. | 181 // GetNextBuffer(), or kNoTimestamp if the timestamp is unknown. |
| 182 DecodeTimestamp GetNextTimestamp() const; | 182 DecodeTimestamp GetNextTimestamp() const; |
| 183 | 183 |
| 184 // Returns the start timestamp of the range. | 184 // Returns the start timestamp of the range. |
| 185 DecodeTimestamp GetStartTimestamp() const; | 185 DecodeTimestamp GetStartTimestamp() const; |
| 186 | 186 |
| 187 // Returns the timestamp of the last buffer in the range. | 187 // Returns the timestamp of the last buffer in the range. |
| 188 DecodeTimestamp GetEndTimestamp() const; | 188 DecodeTimestamp GetEndTimestamp() const; |
| 189 | 189 |
| 190 // Returns the timestamp for the end of the buffered region in this range. | 190 // Returns the timestamp for the end of the buffered region in this range. |
| 191 // This is an approximation if the duration for the last buffer in the range | 191 // This is an approximation if the duration for the last buffer in the range |
| 192 // is unset. | 192 // is unset. |
| 193 DecodeTimestamp GetBufferedEndTimestamp() const; | 193 DecodeTimestamp GetBufferedEndTimestamp() const; |
| 194 | 194 |
| 195 // Gets the timestamp for the keyframe that is after |timestamp|. If | 195 // Gets the timestamp for the keyframe that is after |timestamp|. If |
| 196 // there isn't a keyframe in the range after |timestamp| then kNoTimestamp() | 196 // there isn't a keyframe in the range after |timestamp| then kNoTimestamp |
| 197 // is returned. If |timestamp| is in the "gap" between the value returned by | 197 // is returned. If |timestamp| is in the "gap" between the value returned by |
| 198 // GetStartTimestamp() and the timestamp on the first buffer in |buffers_|, | 198 // GetStartTimestamp() and the timestamp on the first buffer in |buffers_|, |
| 199 // then |timestamp| is returned. | 199 // then |timestamp| is returned. |
| 200 DecodeTimestamp NextKeyframeTimestamp(DecodeTimestamp timestamp); | 200 DecodeTimestamp NextKeyframeTimestamp(DecodeTimestamp timestamp); |
| 201 | 201 |
| 202 // Gets the timestamp for the closest keyframe that is <= |timestamp|. If | 202 // Gets the timestamp for the closest keyframe that is <= |timestamp|. If |
| 203 // there isn't a keyframe before |timestamp| or |timestamp| is outside | 203 // there isn't a keyframe before |timestamp| or |timestamp| is outside |
| 204 // this range, then kNoTimestamp() is returned. | 204 // this range, then kNoTimestamp is returned. |
| 205 DecodeTimestamp KeyframeBeforeTimestamp(DecodeTimestamp timestamp); | 205 DecodeTimestamp KeyframeBeforeTimestamp(DecodeTimestamp timestamp); |
| 206 | 206 |
| 207 // Returns whether a buffer with a starting timestamp of |timestamp| would | 207 // Returns whether a buffer with a starting timestamp of |timestamp| would |
| 208 // belong in this range. This includes a buffer that would be appended to | 208 // belong in this range. This includes a buffer that would be appended to |
| 209 // the end of the range. | 209 // the end of the range. |
| 210 bool BelongsToRange(DecodeTimestamp timestamp) const; | 210 bool BelongsToRange(DecodeTimestamp timestamp) const; |
| 211 | 211 |
| 212 // Returns true if the range has enough data to seek to the specified | 212 // Returns true if the range has enough data to seek to the specified |
| 213 // |timestamp|, false otherwise. | 213 // |timestamp|, false otherwise. |
| 214 bool CanSeekTo(DecodeTimestamp timestamp) const; | 214 bool CanSeekTo(DecodeTimestamp timestamp) const; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 316 |
| 317 // Stores the amount of memory taken up by the data in |buffers_|. | 317 // Stores the amount of memory taken up by the data in |buffers_|. |
| 318 size_t size_in_bytes_; | 318 size_t size_in_bytes_; |
| 319 | 319 |
| 320 DISALLOW_COPY_AND_ASSIGN(SourceBufferRange); | 320 DISALLOW_COPY_AND_ASSIGN(SourceBufferRange); |
| 321 }; | 321 }; |
| 322 | 322 |
| 323 } // namespace media | 323 } // namespace media |
| 324 | 324 |
| 325 #endif // MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_ | 325 #endif // MEDIA_FILTERS_SOURCE_BUFFER_RANGE_H_ |
| OLD | NEW |