| 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 "media/cdm/cdm_adapter.h" | 5 #include "media/cdm/cdm_adapter.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "media/cdm/cdm_allocator.h" | 28 #include "media/cdm/cdm_allocator.h" |
| 29 #include "media/cdm/cdm_file_io.h" | 29 #include "media/cdm/cdm_file_io.h" |
| 30 #include "media/cdm/cdm_helpers.h" | 30 #include "media/cdm/cdm_helpers.h" |
| 31 #include "media/cdm/cdm_wrapper.h" | 31 #include "media/cdm/cdm_wrapper.h" |
| 32 #include "ui/gfx/geometry/rect.h" | 32 #include "ui/gfx/geometry/rect.h" |
| 33 | 33 |
| 34 namespace media { | 34 namespace media { |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 cdm::SessionType ToCdmSessionType(MediaKeys::SessionType session_type) { | 38 cdm::SessionType ToCdmSessionType( |
| 39 ContentDecryptionModule::SessionType session_type) { |
| 39 switch (session_type) { | 40 switch (session_type) { |
| 40 case MediaKeys::TEMPORARY_SESSION: | 41 case ContentDecryptionModule::TEMPORARY_SESSION: |
| 41 return cdm::kTemporary; | 42 return cdm::kTemporary; |
| 42 case MediaKeys::PERSISTENT_LICENSE_SESSION: | 43 case ContentDecryptionModule::PERSISTENT_LICENSE_SESSION: |
| 43 return cdm::kPersistentLicense; | 44 return cdm::kPersistentLicense; |
| 44 case MediaKeys::PERSISTENT_RELEASE_MESSAGE_SESSION: | 45 case ContentDecryptionModule::PERSISTENT_RELEASE_MESSAGE_SESSION: |
| 45 return cdm::kPersistentKeyRelease; | 46 return cdm::kPersistentKeyRelease; |
| 46 } | 47 } |
| 47 | 48 |
| 48 NOTREACHED() << "Unexpected SessionType " << session_type; | 49 NOTREACHED() << "Unexpected SessionType " << session_type; |
| 49 return cdm::kTemporary; | 50 return cdm::kTemporary; |
| 50 } | 51 } |
| 51 | 52 |
| 52 cdm::InitDataType ToCdmInitDataType(EmeInitDataType init_data_type) { | 53 cdm::InitDataType ToCdmInitDataType(EmeInitDataType init_data_type) { |
| 53 switch (init_data_type) { | 54 switch (init_data_type) { |
| 54 case EmeInitDataType::CENC: | 55 case EmeInitDataType::CENC: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 80 case cdm::kClientError: | 81 case cdm::kClientError: |
| 81 return CdmPromise::CLIENT_ERROR; | 82 return CdmPromise::CLIENT_ERROR; |
| 82 case cdm::kOutputError: | 83 case cdm::kOutputError: |
| 83 return CdmPromise::OUTPUT_ERROR; | 84 return CdmPromise::OUTPUT_ERROR; |
| 84 } | 85 } |
| 85 | 86 |
| 86 NOTREACHED() << "Unexpected cdm::Error " << error; | 87 NOTREACHED() << "Unexpected cdm::Error " << error; |
| 87 return CdmPromise::UNKNOWN_ERROR; | 88 return CdmPromise::UNKNOWN_ERROR; |
| 88 } | 89 } |
| 89 | 90 |
| 90 MediaKeys::MessageType ToMediaMessageType(cdm::MessageType message_type) { | 91 ContentDecryptionModule::MessageType ToMediaMessageType( |
| 92 cdm::MessageType message_type) { |
| 91 switch (message_type) { | 93 switch (message_type) { |
| 92 case cdm::kLicenseRequest: | 94 case cdm::kLicenseRequest: |
| 93 return MediaKeys::LICENSE_REQUEST; | 95 return ContentDecryptionModule::LICENSE_REQUEST; |
| 94 case cdm::kLicenseRenewal: | 96 case cdm::kLicenseRenewal: |
| 95 return MediaKeys::LICENSE_RENEWAL; | 97 return ContentDecryptionModule::LICENSE_RENEWAL; |
| 96 case cdm::kLicenseRelease: | 98 case cdm::kLicenseRelease: |
| 97 return MediaKeys::LICENSE_RELEASE; | 99 return ContentDecryptionModule::LICENSE_RELEASE; |
| 98 } | 100 } |
| 99 | 101 |
| 100 NOTREACHED() << "Unexpected cdm::MessageType " << message_type; | 102 NOTREACHED() << "Unexpected cdm::MessageType " << message_type; |
| 101 return MediaKeys::LICENSE_REQUEST; | 103 return ContentDecryptionModule::LICENSE_REQUEST; |
| 102 } | 104 } |
| 103 | 105 |
| 104 CdmKeyInformation::KeyStatus ToCdmKeyInformationKeyStatus( | 106 CdmKeyInformation::KeyStatus ToCdmKeyInformationKeyStatus( |
| 105 cdm::KeyStatus status) { | 107 cdm::KeyStatus status) { |
| 106 switch (status) { | 108 switch (status) { |
| 107 case cdm::kUsable: | 109 case cdm::kUsable: |
| 108 return CdmKeyInformation::USABLE; | 110 return CdmKeyInformation::USABLE; |
| 109 case cdm::kInternalError: | 111 case cdm::kInternalError: |
| 110 return CdmKeyInformation::INTERNAL_ERROR; | 112 return CdmKeyInformation::INTERNAL_ERROR; |
| 111 case cdm::kExpired: | 113 case cdm::kExpired: |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 result_frames->push_back(frame); | 941 result_frames->push_back(frame); |
| 940 | 942 |
| 941 data += frame_size; | 943 data += frame_size; |
| 942 bytes_left -= frame_size; | 944 bytes_left -= frame_size; |
| 943 } while (bytes_left > 0); | 945 } while (bytes_left > 0); |
| 944 | 946 |
| 945 return true; | 947 return true; |
| 946 } | 948 } |
| 947 | 949 |
| 948 } // namespace media | 950 } // namespace media |
| OLD | NEW |