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> | |
| 7 #include "base/logging.h" | 8 #include "base/logging.h" |
| 8 | 9 |
| 9 namespace media { | 10 namespace media { |
| 10 | 11 |
| 11 DecryptConfig::DecryptConfig(const std::string& key_id, | 12 DecryptConfig::DecryptConfig(const std::string& key_id, |
| 12 const std::string& iv, | 13 const std::string& iv, |
| 13 const std::vector<SubsampleEntry>& subsamples) | 14 const std::vector<SubsampleEntry>& subsamples) |
| 14 : key_id_(key_id), | 15 : key_id_(key_id), |
| 15 iv_(iv), | 16 iv_(iv), |
| 16 subsamples_(subsamples) { | 17 subsamples_(subsamples) { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 30 for (size_t i = 0; i < subsamples().size(); ++i) { | 31 for (size_t i = 0; i < subsamples().size(); ++i) { |
| 31 if ((subsamples()[i].clear_bytes != config.subsamples()[i].clear_bytes) || | 32 if ((subsamples()[i].clear_bytes != config.subsamples()[i].clear_bytes) || |
| 32 (subsamples()[i].cypher_bytes != config.subsamples()[i].cypher_bytes)) { | 33 (subsamples()[i].cypher_bytes != config.subsamples()[i].cypher_bytes)) { |
| 33 return false; | 34 return false; |
| 34 } | 35 } |
| 35 } | 36 } |
| 36 | 37 |
| 37 return true; | 38 return true; |
| 38 } | 39 } |
| 39 | 40 |
| 41 std::ostream& DecryptConfig::Print(std::ostream& os) const { | |
| 42 os << "key_id:" << std::hex << std::setfill('0'); | |
| 43 for (char ch : key_id_) | |
| 44 os << std::setw(2) << static_cast<int>(ch); | |
|
xhwang
2015/10/22 06:13:51
Here and below, will base::HexEncode() make things
Tima Vaisburd
2015/10/22 21:57:26
Done.
| |
| 45 | |
| 46 os << " iv:'" << std::hex << std::setfill('0'); | |
| 47 for (char ch : iv_) | |
| 48 os << std::setw(2) << static_cast<int>(ch); | |
| 49 | |
| 50 os << std::dec << std::setfill(' ') << "' subsamples:["; | |
| 51 for (SubsampleEntry entry : subsamples_) { | |
| 52 os << "(clear:" << entry.clear_bytes << ", cypher:" << entry.cypher_bytes | |
| 53 << ")"; | |
| 54 } | |
| 55 os << "]"; | |
| 56 return os; | |
| 57 } | |
| 58 | |
| 40 } // namespace media | 59 } // namespace media |
| OLD | NEW |