| 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_BASE_DECODER_BUFFER_H_ | 5 #ifndef MEDIA_BASE_DECODER_BUFFER_H_ |
| 6 #define MEDIA_BASE_DECODER_BUFFER_H_ | 6 #define MEDIA_BASE_DECODER_BUFFER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // shave keep as a virtual with hacker_style() for now. | 79 // shave keep as a virtual with hacker_style() for now. |
| 80 virtual void set_timestamp(base::TimeDelta timestamp); | 80 virtual void set_timestamp(base::TimeDelta timestamp); |
| 81 | 81 |
| 82 base::TimeDelta duration() const { | 82 base::TimeDelta duration() const { |
| 83 DCHECK(!end_of_stream()); | 83 DCHECK(!end_of_stream()); |
| 84 return duration_; | 84 return duration_; |
| 85 } | 85 } |
| 86 | 86 |
| 87 void set_duration(base::TimeDelta duration) { | 87 void set_duration(base::TimeDelta duration) { |
| 88 DCHECK(!end_of_stream()); | 88 DCHECK(!end_of_stream()); |
| 89 DCHECK(duration == kNoTimestamp() || | 89 DCHECK(duration == kNoTimestamp || |
| 90 (duration >= base::TimeDelta() && duration != kInfiniteDuration())) | 90 (duration >= base::TimeDelta() && duration != kInfiniteDuration)) |
| 91 << duration.InSecondsF(); | 91 << duration.InSecondsF(); |
| 92 duration_ = duration; | 92 duration_ = duration; |
| 93 } | 93 } |
| 94 | 94 |
| 95 const uint8_t* data() const { | 95 const uint8_t* data() const { |
| 96 DCHECK(!end_of_stream()); | 96 DCHECK(!end_of_stream()); |
| 97 return data_.get(); | 97 return data_.get(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 uint8_t* writable_data() const { | 100 uint8_t* writable_data() const { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 112 return side_data_.get(); | 112 return side_data_.get(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 size_t side_data_size() const { | 115 size_t side_data_size() const { |
| 116 DCHECK(!end_of_stream()); | 116 DCHECK(!end_of_stream()); |
| 117 return side_data_size_; | 117 return side_data_size_; |
| 118 } | 118 } |
| 119 | 119 |
| 120 // A discard window indicates the amount of data which should be discard from | 120 // A discard window indicates the amount of data which should be discard from |
| 121 // this buffer after decoding. The first value is the amount of the front and | 121 // this buffer after decoding. The first value is the amount of the front and |
| 122 // the second the amount off the back. A value of kInfiniteDuration() for the | 122 // the second the amount off the back. A value of kInfiniteDuration for the |
| 123 // first value indicates the entire buffer should be discarded; the second | 123 // first value indicates the entire buffer should be discarded; the second |
| 124 // value must be base::TimeDelta() in this case. | 124 // value must be base::TimeDelta() in this case. |
| 125 typedef std::pair<base::TimeDelta, base::TimeDelta> DiscardPadding; | 125 typedef std::pair<base::TimeDelta, base::TimeDelta> DiscardPadding; |
| 126 const DiscardPadding& discard_padding() const { | 126 const DiscardPadding& discard_padding() const { |
| 127 DCHECK(!end_of_stream()); | 127 DCHECK(!end_of_stream()); |
| 128 return discard_padding_; | 128 return discard_padding_; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void set_discard_padding(const DiscardPadding& discard_padding) { | 131 void set_discard_padding(const DiscardPadding& discard_padding) { |
| 132 DCHECK(!end_of_stream()); | 132 DCHECK(!end_of_stream()); |
| 133 discard_padding_ = discard_padding; | 133 discard_padding_ = discard_padding; |
| 134 } | 134 } |
| 135 | 135 |
| 136 const DecryptConfig* decrypt_config() const { | 136 const DecryptConfig* decrypt_config() const { |
| 137 DCHECK(!end_of_stream()); | 137 DCHECK(!end_of_stream()); |
| 138 return decrypt_config_.get(); | 138 return decrypt_config_.get(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void set_decrypt_config(std::unique_ptr<DecryptConfig> decrypt_config) { | 141 void set_decrypt_config(std::unique_ptr<DecryptConfig> decrypt_config) { |
| 142 DCHECK(!end_of_stream()); | 142 DCHECK(!end_of_stream()); |
| 143 decrypt_config_ = std::move(decrypt_config); | 143 decrypt_config_ = std::move(decrypt_config); |
| 144 } | 144 } |
| 145 | 145 |
| 146 // If there's no data in this buffer, it represents end of stream. | 146 // If there's no data in this buffer, it represents end of stream. |
| 147 bool end_of_stream() const { | 147 bool end_of_stream() const { |
| 148 return data_ == NULL; | 148 return data_ == NULL; |
| 149 } | 149 } |
| 150 | 150 |
| 151 // Indicates this buffer is part of a splice around |splice_timestamp_|. | 151 // Indicates this buffer is part of a splice around |splice_timestamp_|. |
| 152 // Returns kNoTimestamp() if the buffer is not part of a splice. | 152 // Returns kNoTimestamp if the buffer is not part of a splice. |
| 153 base::TimeDelta splice_timestamp() const { | 153 base::TimeDelta splice_timestamp() const { |
| 154 DCHECK(!end_of_stream()); | 154 DCHECK(!end_of_stream()); |
| 155 return splice_timestamp_; | 155 return splice_timestamp_; |
| 156 } | 156 } |
| 157 | 157 |
| 158 // When set to anything but kNoTimestamp() indicates this buffer is part of a | 158 // When set to anything but kNoTimestamp indicates this buffer is part of a |
| 159 // splice around |splice_timestamp|. | 159 // splice around |splice_timestamp|. |
| 160 void set_splice_timestamp(base::TimeDelta splice_timestamp) { | 160 void set_splice_timestamp(base::TimeDelta splice_timestamp) { |
| 161 DCHECK(!end_of_stream()); | 161 DCHECK(!end_of_stream()); |
| 162 splice_timestamp_ = splice_timestamp; | 162 splice_timestamp_ = splice_timestamp; |
| 163 } | 163 } |
| 164 | 164 |
| 165 bool is_key_frame() const { | 165 bool is_key_frame() const { |
| 166 DCHECK(!end_of_stream()); | 166 DCHECK(!end_of_stream()); |
| 167 return is_key_frame_; | 167 return is_key_frame_; |
| 168 } | 168 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 // Constructor helper method for memory allocations. | 207 // Constructor helper method for memory allocations. |
| 208 void Initialize(); | 208 void Initialize(); |
| 209 | 209 |
| 210 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); | 210 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); |
| 211 }; | 211 }; |
| 212 | 212 |
| 213 } // namespace media | 213 } // namespace media |
| 214 | 214 |
| 215 #endif // MEDIA_BASE_DECODER_BUFFER_H_ | 215 #endif // MEDIA_BASE_DECODER_BUFFER_H_ |
| OLD | NEW |