| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/stl_util.h" | 5 #include "base/stl_util.h" |
| 6 #include "base/strings/string_number_conversions.h" |
| 6 #include "media/base/cdm_key_information.h" | 7 #include "media/base/cdm_key_information.h" |
| 7 | 8 |
| 8 namespace media { | 9 namespace media { |
| 9 | 10 |
| 10 CdmKeyInformation::CdmKeyInformation() | 11 CdmKeyInformation::CdmKeyInformation() |
| 11 : status(INTERNAL_ERROR), system_code(0) { | 12 : status(INTERNAL_ERROR), system_code(0) { |
| 12 } | 13 } |
| 13 | 14 |
| 14 CdmKeyInformation::CdmKeyInformation(const std::vector<uint8_t>& key_id, | 15 CdmKeyInformation::CdmKeyInformation(const std::vector<uint8_t>& key_id, |
| 15 KeyStatus status, | 16 KeyStatus status, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 30 uint32_t system_code) | 31 uint32_t system_code) |
| 31 : key_id(key_id_data, key_id_data + key_id_length), | 32 : key_id(key_id_data, key_id_data + key_id_length), |
| 32 status(status), | 33 status(status), |
| 33 system_code(system_code) {} | 34 system_code(system_code) {} |
| 34 | 35 |
| 35 CdmKeyInformation::CdmKeyInformation(const CdmKeyInformation& other) = default; | 36 CdmKeyInformation::CdmKeyInformation(const CdmKeyInformation& other) = default; |
| 36 | 37 |
| 37 CdmKeyInformation::~CdmKeyInformation() { | 38 CdmKeyInformation::~CdmKeyInformation() { |
| 38 } | 39 } |
| 39 | 40 |
| 41 // static |
| 42 std::string CdmKeyInformation::KeyStatusToString(KeyStatus key_status) { |
| 43 switch (key_status) { |
| 44 case USABLE: |
| 45 return "USABLE"; |
| 46 case INTERNAL_ERROR: |
| 47 return "INTERNAL_ERROR"; |
| 48 case EXPIRED: |
| 49 return "EXPIRED"; |
| 50 case OUTPUT_RESTRICTED: |
| 51 return "OUTPUT_RESTRICTED"; |
| 52 case OUTPUT_DOWNSCALED: |
| 53 return "OUTPUT_DOWNSCALED"; |
| 54 case KEY_STATUS_PENDING: |
| 55 return "KEY_STATUS_PENDING"; |
| 56 case RELEASED: |
| 57 return "RELEASED"; |
| 58 } |
| 59 |
| 60 NOTREACHED(); |
| 61 return ""; |
| 62 } |
| 63 |
| 64 std::ostream& operator<<(std::ostream& os, const CdmKeyInformation& info) { |
| 65 return os << "key_id = " |
| 66 << base::HexEncode(info.key_id.data(), info.key_id.size()) |
| 67 << ", status = " |
| 68 << CdmKeyInformation::KeyStatusToString(info.status) |
| 69 << ", system_code = " << info.system_code; |
| 70 } |
| 71 |
| 40 } // namespace media | 72 } // namespace media |
| OLD | NEW |