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 |
| 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 #include <utility> | 13 #include <utility> |
13 | 14 |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/aligned_memory.h" | 17 #include "base/memory/aligned_memory.h" |
17 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
18 #include "base/memory/scoped_ptr.h" | |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
21 #include "media/base/decrypt_config.h" | 21 #include "media/base/decrypt_config.h" |
22 #include "media/base/media_export.h" | 22 #include "media/base/media_export.h" |
23 #include "media/base/timestamp_constants.h" | 23 #include "media/base/timestamp_constants.h" |
24 | 24 |
25 namespace media { | 25 namespace media { |
26 | 26 |
27 // A specialized buffer for interfacing with audio / video decoders. | 27 // A specialized buffer for interfacing with audio / video decoders. |
28 // | 28 // |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(scoped_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_|. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 size_t size, | 189 size_t size, |
190 const uint8_t* side_data, | 190 const uint8_t* side_data, |
191 size_t side_data_size); | 191 size_t side_data_size); |
192 virtual ~DecoderBuffer(); | 192 virtual ~DecoderBuffer(); |
193 | 193 |
194 private: | 194 private: |
195 base::TimeDelta timestamp_; | 195 base::TimeDelta timestamp_; |
196 base::TimeDelta duration_; | 196 base::TimeDelta duration_; |
197 | 197 |
198 size_t size_; | 198 size_t size_; |
199 scoped_ptr<uint8_t, base::AlignedFreeDeleter> data_; | 199 std::unique_ptr<uint8_t, base::AlignedFreeDeleter> data_; |
200 size_t side_data_size_; | 200 size_t side_data_size_; |
201 scoped_ptr<uint8_t, base::AlignedFreeDeleter> side_data_; | 201 std::unique_ptr<uint8_t, base::AlignedFreeDeleter> side_data_; |
202 scoped_ptr<DecryptConfig> decrypt_config_; | 202 std::unique_ptr<DecryptConfig> decrypt_config_; |
203 DiscardPadding discard_padding_; | 203 DiscardPadding discard_padding_; |
204 base::TimeDelta splice_timestamp_; | 204 base::TimeDelta splice_timestamp_; |
205 bool is_key_frame_; | 205 bool is_key_frame_; |
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 |