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 21 matching lines...) Expand all Loading... | |
32 // | 32 // |
33 // Also includes decoder specific functionality for decryption. | 33 // Also includes decoder specific functionality for decryption. |
34 // | 34 // |
35 // NOTE: It is illegal to call any method when end_of_stream() is true. | 35 // NOTE: It is illegal to call any method when end_of_stream() is true. |
36 class MEDIA_EXPORT DecoderBuffer | 36 class MEDIA_EXPORT DecoderBuffer |
37 : public base::RefCountedThreadSafe<DecoderBuffer> { | 37 : public base::RefCountedThreadSafe<DecoderBuffer> { |
38 public: | 38 public: |
39 enum { | 39 enum { |
40 kPaddingSize = 32, | 40 kPaddingSize = 32, |
41 #if defined(ARCH_CPU_ARM_FAMILY) | 41 #if defined(ARCH_CPU_ARM_FAMILY) |
42 kAlignmentSize = 16 | 42 kAlignmentSize = 16, |
43 #else | 43 #else |
44 kAlignmentSize = 32 | 44 kAlignmentSize = 32, |
45 #endif | 45 #endif |
46 // A flag gor AsHumanReadableString() | |
xhwang
2016/02/05 21:37:36
s/gor/for/
Tima Vaisburd
2016/02/06 03:54:11
Deleted.
| |
47 kShortFormat = 1, | |
46 }; | 48 }; |
47 | 49 |
48 // Allocates buffer with |size| >= 0. Buffer will be padded and aligned | 50 // Allocates buffer with |size| >= 0. Buffer will be padded and aligned |
49 // as necessary, and |is_key_frame_| will default to false. | 51 // as necessary, and |is_key_frame_| will default to false. |
50 explicit DecoderBuffer(size_t size); | 52 explicit DecoderBuffer(size_t size); |
51 | 53 |
52 // Create a DecoderBuffer whose |data_| is copied from |data|. Buffer will be | 54 // Create a DecoderBuffer whose |data_| is copied from |data|. Buffer will be |
53 // padded and aligned as necessary. |data| must not be NULL and |size| >= 0. | 55 // padded and aligned as necessary. |data| must not be NULL and |size| >= 0. |
54 // The buffer's |is_key_frame_| will default to false. | 56 // The buffer's |is_key_frame_| will default to false. |
55 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8_t* data, | 57 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8_t* data, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 DCHECK(!end_of_stream()); | 168 DCHECK(!end_of_stream()); |
167 return is_key_frame_; | 169 return is_key_frame_; |
168 } | 170 } |
169 | 171 |
170 void set_is_key_frame(bool is_key_frame) { | 172 void set_is_key_frame(bool is_key_frame) { |
171 DCHECK(!end_of_stream()); | 173 DCHECK(!end_of_stream()); |
172 is_key_frame_ = is_key_frame; | 174 is_key_frame_ = is_key_frame; |
173 } | 175 } |
174 | 176 |
175 // Returns a human-readable string describing |*this|. | 177 // Returns a human-readable string describing |*this|. |
176 std::string AsHumanReadableString(); | 178 std::string AsHumanReadableString(int flags = 0); |
xhwang
2016/02/05 21:37:36
|flags| is very ambiguous... I would like "bool ve
Tima Vaisburd
2016/02/06 03:54:11
I humbly disagree. The usage ... << AsHumanReadabl
xhwang
2016/02/08 20:03:33
Good point. But I still feel AsHumanReadableString
| |
177 | 179 |
178 // Replaces any existing side data with data copied from |side_data|. | 180 // Replaces any existing side data with data copied from |side_data|. |
179 void CopySideDataFrom(const uint8_t* side_data, size_t side_data_size); | 181 void CopySideDataFrom(const uint8_t* side_data, size_t side_data_size); |
180 | 182 |
181 protected: | 183 protected: |
182 friend class base::RefCountedThreadSafe<DecoderBuffer>; | 184 friend class base::RefCountedThreadSafe<DecoderBuffer>; |
183 | 185 |
184 // Allocates a buffer of size |size| >= 0 and copies |data| into it. Buffer | 186 // Allocates a buffer of size |size| >= 0 and copies |data| into it. Buffer |
185 // will be padded and aligned as necessary. If |data| is NULL then |data_| is | 187 // will be padded and aligned as necessary. If |data| is NULL then |data_| is |
186 // set to NULL and |buffer_size_| to 0. |is_key_frame_| will default to | 188 // set to NULL and |buffer_size_| to 0. |is_key_frame_| will default to |
(...skipping 19 matching lines...) Expand all Loading... | |
206 | 208 |
207 // Constructor helper method for memory allocations. | 209 // Constructor helper method for memory allocations. |
208 void Initialize(); | 210 void Initialize(); |
209 | 211 |
210 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); | 212 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); |
211 }; | 213 }; |
212 | 214 |
213 } // namespace media | 215 } // namespace media |
214 | 216 |
215 #endif // MEDIA_BASE_DECODER_BUFFER_H_ | 217 #endif // MEDIA_BASE_DECODER_BUFFER_H_ |
OLD | NEW |