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 #include "media/base/video_decoder_config.h" | 5 #include "media/base/video_decoder_config.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 bool VideoDecoderConfig::IsValidConfig() const { | 143 bool VideoDecoderConfig::IsValidConfig() const { |
144 return codec_ != kUnknownVideoCodec && | 144 return codec_ != kUnknownVideoCodec && |
145 frame_rate_denominator_ > 0 && | 145 frame_rate_denominator_ > 0 && |
146 aspect_ratio_numerator_ > 0 && | 146 aspect_ratio_numerator_ > 0 && |
147 aspect_ratio_denominator_ > 0 && | 147 aspect_ratio_denominator_ > 0 && |
148 VideoFrame::IsValidConfig( | 148 VideoFrame::IsValidConfig( |
149 format_, natural_size_.width(), natural_size_.height()); | 149 format_, natural_size_.width(), natural_size_.height()); |
150 } | 150 } |
151 | 151 |
| 152 bool VideoDecoderConfig::Matches(const VideoDecoderConfig& config) const { |
| 153 return ((codec() == config.codec()) && |
| 154 (format() == config.format()) && |
| 155 (profile() == config.profile()) && |
| 156 (coded_size() == config.coded_size()) && |
| 157 (visible_rect() == config.visible_rect()) && |
| 158 (natural_size() == config.natural_size()) && |
| 159 (extra_data_size() == config.extra_data_size()) && |
| 160 (!extra_data() || !memcmp(extra_data(), config.extra_data(), |
| 161 extra_data_size()))); |
| 162 } |
| 163 |
152 std::string VideoDecoderConfig::AsHumanReadableString() const { | 164 std::string VideoDecoderConfig::AsHumanReadableString() const { |
153 std::ostringstream s; | 165 std::ostringstream s; |
154 s << "codec: " << codec() | 166 s << "codec: " << codec() |
155 << " format: " << format() | 167 << " format: " << format() |
156 << " coded size: [" << coded_size().width() | 168 << " coded size: [" << coded_size().width() |
157 << "," << coded_size().height() << "]" | 169 << "," << coded_size().height() << "]" |
158 << " visible rect: [" << visible_rect().x() | 170 << " visible rect: [" << visible_rect().x() |
159 << "," << visible_rect().y() | 171 << "," << visible_rect().y() |
160 << "," << visible_rect().width() | 172 << "," << visible_rect().width() |
161 << "," << visible_rect().height() << "]" | 173 << "," << visible_rect().height() << "]" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 222 |
211 uint8* VideoDecoderConfig::extra_data() const { | 223 uint8* VideoDecoderConfig::extra_data() const { |
212 return extra_data_.get(); | 224 return extra_data_.get(); |
213 } | 225 } |
214 | 226 |
215 size_t VideoDecoderConfig::extra_data_size() const { | 227 size_t VideoDecoderConfig::extra_data_size() const { |
216 return extra_data_size_; | 228 return extra_data_size_; |
217 } | 229 } |
218 | 230 |
219 } // namespace media | 231 } // namespace media |
OLD | NEW |