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 <string> | 8 #include <string> |
| 9 #include <utility> |
9 | 10 |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/memory/aligned_memory.h" | 12 #include "base/memory/aligned_memory.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "media/base/decrypt_config.h" | 17 #include "media/base/decrypt_config.h" |
17 #include "media/base/media_export.h" | 18 #include "media/base/media_export.h" |
18 | 19 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 const uint8* side_data() const { | 99 const uint8* side_data() const { |
99 DCHECK(!end_of_stream()); | 100 DCHECK(!end_of_stream()); |
100 return side_data_.get(); | 101 return side_data_.get(); |
101 } | 102 } |
102 | 103 |
103 int side_data_size() const { | 104 int side_data_size() const { |
104 DCHECK(!end_of_stream()); | 105 DCHECK(!end_of_stream()); |
105 return side_data_size_; | 106 return side_data_size_; |
106 } | 107 } |
107 | 108 |
108 base::TimeDelta discard_padding() const { | 109 // A discard window indicates the amount of data which should be discard from |
| 110 // this buffer after decoding. The first value is the amount of the front and |
| 111 // the second the amount off the back. |
| 112 typedef std::pair<base::TimeDelta, base::TimeDelta> DiscardPadding; |
| 113 const DiscardPadding& discard_padding() const { |
109 DCHECK(!end_of_stream()); | 114 DCHECK(!end_of_stream()); |
110 return discard_padding_; | 115 return discard_padding_; |
111 } | 116 } |
112 | 117 |
113 void set_discard_padding(const base::TimeDelta discard_padding) { | 118 void set_discard_padding(const DiscardPadding& discard_padding) { |
114 DCHECK(!end_of_stream()); | 119 DCHECK(!end_of_stream()); |
115 discard_padding_ = discard_padding; | 120 discard_padding_ = discard_padding; |
116 } | 121 } |
117 | 122 |
118 const DecryptConfig* decrypt_config() const { | 123 const DecryptConfig* decrypt_config() const { |
119 DCHECK(!end_of_stream()); | 124 DCHECK(!end_of_stream()); |
120 return decrypt_config_.get(); | 125 return decrypt_config_.get(); |
121 } | 126 } |
122 | 127 |
123 void set_decrypt_config(scoped_ptr<DecryptConfig> decrypt_config) { | 128 void set_decrypt_config(scoped_ptr<DecryptConfig> decrypt_config) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 164 |
160 private: | 165 private: |
161 base::TimeDelta timestamp_; | 166 base::TimeDelta timestamp_; |
162 base::TimeDelta duration_; | 167 base::TimeDelta duration_; |
163 | 168 |
164 int size_; | 169 int size_; |
165 scoped_ptr<uint8, base::AlignedFreeDeleter> data_; | 170 scoped_ptr<uint8, base::AlignedFreeDeleter> data_; |
166 int side_data_size_; | 171 int side_data_size_; |
167 scoped_ptr<uint8, base::AlignedFreeDeleter> side_data_; | 172 scoped_ptr<uint8, base::AlignedFreeDeleter> side_data_; |
168 scoped_ptr<DecryptConfig> decrypt_config_; | 173 scoped_ptr<DecryptConfig> decrypt_config_; |
169 base::TimeDelta discard_padding_; | 174 DiscardPadding discard_padding_; |
170 base::TimeDelta splice_timestamp_; | 175 base::TimeDelta splice_timestamp_; |
171 | 176 |
172 // Constructor helper method for memory allocations. | 177 // Constructor helper method for memory allocations. |
173 void Initialize(); | 178 void Initialize(); |
174 | 179 |
175 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); | 180 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); |
176 }; | 181 }; |
177 | 182 |
178 } // namespace media | 183 } // namespace media |
179 | 184 |
180 #endif // MEDIA_BASE_DECODER_BUFFER_H_ | 185 #endif // MEDIA_BASE_DECODER_BUFFER_H_ |
OLD | NEW |