Chromium Code Reviews| 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/decrypt_config.h" | 5 #include "media/base/decrypt_config.h" |
| 6 | 6 |
| 7 #include <iomanip> | |
|
watk
2015/10/22 22:49:26
Newline after this
dcheng
2015/10/23 00:44:47
What is this for?
Tima Vaisburd
2015/10/23 18:51:41
Missed during prior cleanup, removed.
| |
| 7 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_number_conversions.h" | |
| 8 | 10 |
| 9 namespace media { | 11 namespace media { |
| 10 | 12 |
| 11 DecryptConfig::DecryptConfig(const std::string& key_id, | 13 DecryptConfig::DecryptConfig(const std::string& key_id, |
| 12 const std::string& iv, | 14 const std::string& iv, |
| 13 const std::vector<SubsampleEntry>& subsamples) | 15 const std::vector<SubsampleEntry>& subsamples) |
| 14 : key_id_(key_id), | 16 : key_id_(key_id), |
| 15 iv_(iv), | 17 iv_(iv), |
| 16 subsamples_(subsamples) { | 18 subsamples_(subsamples) { |
| 17 CHECK_GT(key_id.size(), 0u); | 19 CHECK_GT(key_id.size(), 0u); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 30 for (size_t i = 0; i < subsamples().size(); ++i) { | 32 for (size_t i = 0; i < subsamples().size(); ++i) { |
| 31 if ((subsamples()[i].clear_bytes != config.subsamples()[i].clear_bytes) || | 33 if ((subsamples()[i].clear_bytes != config.subsamples()[i].clear_bytes) || |
| 32 (subsamples()[i].cypher_bytes != config.subsamples()[i].cypher_bytes)) { | 34 (subsamples()[i].cypher_bytes != config.subsamples()[i].cypher_bytes)) { |
| 33 return false; | 35 return false; |
| 34 } | 36 } |
| 35 } | 37 } |
| 36 | 38 |
| 37 return true; | 39 return true; |
| 38 } | 40 } |
| 39 | 41 |
| 42 std::ostream& DecryptConfig::Print(std::ostream& os) const { | |
| 43 os << "key_id:'" << base::HexEncode(key_id_.data(), key_id_.size()) << "'" | |
| 44 << " iv:'" << base::HexEncode(iv_.data(), iv_.size()) << "'"; | |
| 45 | |
| 46 os << " subsamples:["; | |
| 47 for (SubsampleEntry entry : subsamples_) { | |
|
dcheng
2015/10/23 00:44:47
This copies entry. const SubsampleEntry&
Tima Vaisburd
2015/10/23 18:51:41
Done.
| |
| 48 os << "(clear:" << entry.clear_bytes << ", cypher:" << entry.cypher_bytes | |
| 49 << ")"; | |
| 50 } | |
| 51 os << "]"; | |
| 52 return os; | |
| 53 } | |
| 54 | |
| 40 } // namespace media | 55 } // namespace media |
| OLD | NEW |