Loading drm/libmediadrm/CryptoHal.cpp +3 −37 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include <media/stagefright/foundation/hexdump.h> #include <media/stagefright/MediaErrors.h> #include <mediadrm/CryptoHal.h> #include <mediadrm/DrmUtils.h> using drm::V1_0::BufferType; using drm::V1_0::DestinationBuffer; Loading @@ -39,6 +40,7 @@ using drm::V1_0::SharedBuffer; using drm::V1_0::Status; using drm::V1_0::SubSample; using ::android::DrmUtils::toStatusT; using ::android::hardware::hidl_array; using ::android::hardware::hidl_handle; using ::android::hardware::hidl_memory; Loading @@ -53,42 +55,6 @@ typedef drm::V1_2::Status Status_V1_2; namespace android { static status_t toStatusT(Status status) { switch (status) { case Status::OK: return OK; case Status::ERROR_DRM_NO_LICENSE: return ERROR_DRM_NO_LICENSE; case Status::ERROR_DRM_LICENSE_EXPIRED: return ERROR_DRM_LICENSE_EXPIRED; case Status::ERROR_DRM_RESOURCE_BUSY: return ERROR_DRM_RESOURCE_BUSY; case Status::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION: return ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION; case Status::ERROR_DRM_SESSION_NOT_OPENED: return ERROR_DRM_SESSION_NOT_OPENED; case Status::ERROR_DRM_CANNOT_HANDLE: return ERROR_DRM_CANNOT_HANDLE; case Status::ERROR_DRM_DECRYPT: return ERROR_DRM_DECRYPT; default: return UNKNOWN_ERROR; } } static status_t toStatusT_1_2(Status_V1_2 status) { switch (status) { case Status_V1_2::ERROR_DRM_SESSION_LOST_STATE: return ERROR_DRM_SESSION_LOST_STATE;; case Status_V1_2::ERROR_DRM_FRAME_TOO_LARGE: return ERROR_DRM_FRAME_TOO_LARGE; case Status_V1_2::ERROR_DRM_INSUFFICIENT_SECURITY: return ERROR_DRM_INSUFFICIENT_SECURITY; default: return toStatusT(static_cast<Status>(status)); } } static hidl_vec<uint8_t> toHidlVec(const Vector<uint8_t> &vector) { hidl_vec<uint8_t> vec; vec.setToExternal(const_cast<uint8_t *>(vector.array()), vector.size()); Loading Loading @@ -384,7 +350,7 @@ ssize_t CryptoHal::decrypt(const uint8_t keyId[16], const uint8_t iv[16], bytesWritten = hBytesWritten; *errorDetailMsg = toString8(hDetailedError); } err = toStatusT_1_2(status); err = toStatusT(status); } ); } else { Loading drm/libmediadrm/DrmHal.cpp +4 −55 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ using drm::V1_1::SecureStopRelease; using drm::V1_1::SecurityLevel; using drm::V1_2::KeySetId; using drm::V1_2::KeyStatusType; using ::android::DrmUtils::toStatusT; using ::android::hardware::drm::V1_1::DrmMetricGroup; using ::android::hardware::hidl_array; using ::android::hardware::hidl_string; Loading Loading @@ -235,58 +236,6 @@ static List<Vector<uint8_t>> toKeySetIds(const hidl_vec<KeySetId>& return keySetIds; } static status_t toStatusT(Status status) { switch (status) { case Status::OK: return OK; break; case Status::ERROR_DRM_NO_LICENSE: return ERROR_DRM_NO_LICENSE; break; case Status::ERROR_DRM_LICENSE_EXPIRED: return ERROR_DRM_LICENSE_EXPIRED; break; case Status::ERROR_DRM_SESSION_NOT_OPENED: return ERROR_DRM_SESSION_NOT_OPENED; break; case Status::ERROR_DRM_CANNOT_HANDLE: return ERROR_DRM_CANNOT_HANDLE; break; case Status::ERROR_DRM_INVALID_STATE: return ERROR_DRM_INVALID_STATE; break; case Status::BAD_VALUE: return BAD_VALUE; break; case Status::ERROR_DRM_NOT_PROVISIONED: return ERROR_DRM_NOT_PROVISIONED; break; case Status::ERROR_DRM_RESOURCE_BUSY: return ERROR_DRM_RESOURCE_BUSY; break; case Status::ERROR_DRM_DEVICE_REVOKED: return ERROR_DRM_DEVICE_REVOKED; break; case Status::ERROR_DRM_UNKNOWN: default: return ERROR_DRM_UNKNOWN; break; } } static status_t toStatusT_1_2(Status_V1_2 status) { switch (status) { case Status_V1_2::ERROR_DRM_RESOURCE_CONTENTION: return ERROR_DRM_RESOURCE_CONTENTION; case Status_V1_2::ERROR_DRM_FRAME_TOO_LARGE: return ERROR_DRM_FRAME_TOO_LARGE; case Status_V1_2::ERROR_DRM_INSUFFICIENT_SECURITY: return ERROR_DRM_INSUFFICIENT_SECURITY; default: return toStatusT(static_cast<Status>(status)); } } Mutex DrmHal::mLock; struct DrmHal::DrmSessionClient : public aidl::android::media::BnResourceManagerClient { Loading Loading @@ -825,7 +774,7 @@ status_t DrmHal::getKeyRequest(Vector<uint8_t> const &sessionId, defaultUrl = toString8(hDefaultUrl); *keyRequestType = toKeyRequestType_1_1(hKeyRequestType); } err = toStatusT_1_2(status); err = toStatusT(status); }); } else if (mPluginV1_1 != NULL) { hResult = mPluginV1_1->getKeyRequest_1_1( Loading Loading @@ -947,7 +896,7 @@ status_t DrmHal::getProvisionRequest(String8 const &certType, request = toVector(hRequest); defaultUrl = toString8(hDefaultUrl); } err = toStatusT_1_2(status); err = toStatusT(status); } ); } else { Loading Loading @@ -1119,7 +1068,7 @@ status_t DrmHal::getHdcpLevels(DrmPlugin::HdcpLevel *connected, *connected = toHdcpLevel(hConnected); *max = toHdcpLevel(hMax); } err = toStatusT_1_2(status); err = toStatusT(status); }); } else if (mPluginV1_1 != NULL) { hResult = mPluginV1_1->getHdcpLevels( Loading drm/libmediadrm/DrmUtils.cpp +88 −0 Original line number Diff line number Diff line Loading @@ -177,5 +177,93 @@ std::vector<sp<ICryptoPlugin>> MakeCryptoPlugins(const uint8_t uuid[16], const v return plugins; } status_t toStatusT_1_4(::V1_4::Status status) { switch (status) { case ::V1_4::Status::OK: return OK; case ::V1_4::Status::BAD_VALUE: return BAD_VALUE; case ::V1_4::Status::ERROR_DRM_CANNOT_HANDLE: return ERROR_DRM_CANNOT_HANDLE; case ::V1_4::Status::ERROR_DRM_DECRYPT: return ERROR_DRM_DECRYPT; case ::V1_4::Status::ERROR_DRM_DEVICE_REVOKED: return ERROR_DRM_DEVICE_REVOKED; case ::V1_4::Status::ERROR_DRM_FRAME_TOO_LARGE: return ERROR_DRM_FRAME_TOO_LARGE; case ::V1_4::Status::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION: return ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION; case ::V1_4::Status::ERROR_DRM_INSUFFICIENT_SECURITY: return ERROR_DRM_INSUFFICIENT_SECURITY; case ::V1_4::Status::ERROR_DRM_INVALID_STATE: return ERROR_DRM_INVALID_STATE; case ::V1_4::Status::ERROR_DRM_LICENSE_EXPIRED: return ERROR_DRM_LICENSE_EXPIRED; case ::V1_4::Status::ERROR_DRM_NO_LICENSE: return ERROR_DRM_NO_LICENSE; case ::V1_4::Status::ERROR_DRM_NOT_PROVISIONED: return ERROR_DRM_NOT_PROVISIONED; case ::V1_4::Status::ERROR_DRM_RESOURCE_BUSY: return ERROR_DRM_RESOURCE_BUSY; case ::V1_4::Status::ERROR_DRM_RESOURCE_CONTENTION: return ERROR_DRM_RESOURCE_CONTENTION; case ::V1_4::Status::ERROR_DRM_SESSION_LOST_STATE: return ERROR_DRM_SESSION_LOST_STATE; case ::V1_4::Status::ERROR_DRM_SESSION_NOT_OPENED: return ERROR_DRM_SESSION_NOT_OPENED; // New in S / drm@1.4: case ::V1_4::Status::CANNOT_DECRYPT_ZERO_SUBSAMPLES: return ERROR_DRM_ZERO_SUBSAMPLES; case ::V1_4::Status::CRYPTO_LIBRARY_ERROR: return ERROR_DRM_CRYPTO_LIBRARY; case ::V1_4::Status::GENERAL_OEM_ERROR: return ERROR_DRM_GENERIC_OEM; case ::V1_4::Status::GENERAL_PLUGIN_ERROR: return ERROR_DRM_GENERIC_PLUGIN; case ::V1_4::Status::INIT_DATA_INVALID: return ERROR_DRM_INIT_DATA; case ::V1_4::Status::KEY_NOT_LOADED: return ERROR_DRM_KEY_NOT_LOADED; case ::V1_4::Status::LICENSE_PARSE_ERROR: return ERROR_DRM_LICENSE_PARSE; case ::V1_4::Status::LICENSE_POLICY_ERROR: return ERROR_DRM_LICENSE_POLICY; case ::V1_4::Status::LICENSE_RELEASE_ERROR: return ERROR_DRM_LICENSE_RELEASE; case ::V1_4::Status::LICENSE_REQUEST_REJECTED: return ERROR_DRM_LICENSE_REQUEST_REJECTED; case ::V1_4::Status::LICENSE_RESTORE_ERROR: return ERROR_DRM_LICENSE_RESTORE; case ::V1_4::Status::LICENSE_STATE_ERROR: return ERROR_DRM_LICENSE_STATE; case ::V1_4::Status::MALFORMED_CERTIFICATE: return ERROR_DRM_CERTIFICATE_MALFORMED; case ::V1_4::Status::MEDIA_FRAMEWORK_ERROR: return ERROR_DRM_MEDIA_FRAMEWORK; case ::V1_4::Status::MISSING_CERTIFICATE: return ERROR_DRM_CERTIFICATE_MISSING; case ::V1_4::Status::PROVISIONING_CERTIFICATE_ERROR: return ERROR_DRM_PROVISIONING_CERTIFICATE; case ::V1_4::Status::PROVISIONING_CONFIGURATION_ERROR: return ERROR_DRM_PROVISIONING_CONFIG; case ::V1_4::Status::PROVISIONING_PARSE_ERROR: return ERROR_DRM_PROVISIONING_PARSE; case ::V1_4::Status::RETRYABLE_PROVISIONING_ERROR: return ERROR_DRM_PROVISIONING_RETRY; case ::V1_4::Status::SECURE_STOP_RELEASE_ERROR: return ERROR_DRM_SECURE_STOP_RELEASE; case ::V1_4::Status::STORAGE_READ_FAILURE: return ERROR_DRM_STORAGE_READ; case ::V1_4::Status::STORAGE_WRITE_FAILURE: return ERROR_DRM_STORAGE_WRITE; case ::V1_4::Status::ERROR_DRM_UNKNOWN: default: return ERROR_DRM_UNKNOWN; } return ERROR_DRM_UNKNOWN; } } // namespace DrmUtils } // namespace android drm/libmediadrm/interface/mediadrm/DrmUtils.h +16 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <android/hardware/drm/1.0/ICryptoFactory.h> #include <android/hardware/drm/1.0/IDrmFactory.h> #include <android/hardware/drm/1.4/types.h> #include <utils/Errors.h> // for status_t #include <utils/StrongPointer.h> #include <vector> Loading Loading @@ -91,8 +92,21 @@ std::vector<sp<::V1_0::ICryptoFactory>> MakeCryptoFactories(const uint8_t uuid[1 std::vector<sp<::V1_0::ICryptoPlugin>> MakeCryptoPlugins(const uint8_t uuid[16], const void *initData, size_t initDataSize); } // namespace DrmUtils status_t toStatusT_1_4(::V1_4::Status status); } // namespace android template<typename S> inline status_t toStatusT(S status) { auto err = static_cast<::V1_4::Status>(status); return toStatusT_1_4(err); } template<typename T> inline status_t toStatusT(const android::hardware::Return<T> &status) { auto t = static_cast<T>(status); auto err = static_cast<::V1_4::Status>(t); return toStatusT_1_4(err); } } // namespace DrmUtils } // namespace android #endif // ANDROID_DRMUTILS_H media/libstagefright/include/media/stagefright/MediaErrors.h +25 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,31 @@ enum { ERROR_DRM_RESOURCE_CONTENTION = DRM_ERROR_BASE - 14, ERROR_DRM_SESSION_LOST_STATE = DRM_ERROR_BASE - 15, ERROR_DRM_INVALID_STATE = DRM_ERROR_BASE - 16, ERROR_DRM_LAST_USED_ERRORCODE = DRM_ERROR_BASE - 16, // New in S / drm@1.4: ERROR_DRM_CERTIFICATE_MALFORMED = DRM_ERROR_BASE - 17, ERROR_DRM_CERTIFICATE_MISSING = DRM_ERROR_BASE - 18, ERROR_DRM_CRYPTO_LIBRARY = DRM_ERROR_BASE - 19, ERROR_DRM_GENERIC_OEM = DRM_ERROR_BASE - 20, ERROR_DRM_GENERIC_PLUGIN = DRM_ERROR_BASE - 21, ERROR_DRM_INIT_DATA = DRM_ERROR_BASE - 22, ERROR_DRM_KEY_NOT_LOADED = DRM_ERROR_BASE - 23, ERROR_DRM_LICENSE_PARSE = DRM_ERROR_BASE - 24, ERROR_DRM_LICENSE_POLICY = DRM_ERROR_BASE - 25, ERROR_DRM_LICENSE_RELEASE = DRM_ERROR_BASE - 26, ERROR_DRM_LICENSE_REQUEST_REJECTED = DRM_ERROR_BASE - 27, ERROR_DRM_LICENSE_RESTORE = DRM_ERROR_BASE - 28, ERROR_DRM_LICENSE_STATE = DRM_ERROR_BASE - 29, ERROR_DRM_MEDIA_FRAMEWORK = DRM_ERROR_BASE - 30, ERROR_DRM_PROVISIONING_CERTIFICATE = DRM_ERROR_BASE - 31, ERROR_DRM_PROVISIONING_CONFIG = DRM_ERROR_BASE - 32, ERROR_DRM_PROVISIONING_PARSE = DRM_ERROR_BASE - 33, ERROR_DRM_PROVISIONING_RETRY = DRM_ERROR_BASE - 34, ERROR_DRM_SECURE_STOP_RELEASE = DRM_ERROR_BASE - 35, ERROR_DRM_STORAGE_READ = DRM_ERROR_BASE - 36, ERROR_DRM_STORAGE_WRITE = DRM_ERROR_BASE - 37, ERROR_DRM_ZERO_SUBSAMPLES = DRM_ERROR_BASE - 38, ERROR_DRM_LAST_USED_ERRORCODE = DRM_ERROR_BASE - 38, ERROR_DRM_VENDOR_MAX = DRM_ERROR_BASE - 500, ERROR_DRM_VENDOR_MIN = DRM_ERROR_BASE - 999, Loading Loading
drm/libmediadrm/CryptoHal.cpp +3 −37 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include <media/stagefright/foundation/hexdump.h> #include <media/stagefright/MediaErrors.h> #include <mediadrm/CryptoHal.h> #include <mediadrm/DrmUtils.h> using drm::V1_0::BufferType; using drm::V1_0::DestinationBuffer; Loading @@ -39,6 +40,7 @@ using drm::V1_0::SharedBuffer; using drm::V1_0::Status; using drm::V1_0::SubSample; using ::android::DrmUtils::toStatusT; using ::android::hardware::hidl_array; using ::android::hardware::hidl_handle; using ::android::hardware::hidl_memory; Loading @@ -53,42 +55,6 @@ typedef drm::V1_2::Status Status_V1_2; namespace android { static status_t toStatusT(Status status) { switch (status) { case Status::OK: return OK; case Status::ERROR_DRM_NO_LICENSE: return ERROR_DRM_NO_LICENSE; case Status::ERROR_DRM_LICENSE_EXPIRED: return ERROR_DRM_LICENSE_EXPIRED; case Status::ERROR_DRM_RESOURCE_BUSY: return ERROR_DRM_RESOURCE_BUSY; case Status::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION: return ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION; case Status::ERROR_DRM_SESSION_NOT_OPENED: return ERROR_DRM_SESSION_NOT_OPENED; case Status::ERROR_DRM_CANNOT_HANDLE: return ERROR_DRM_CANNOT_HANDLE; case Status::ERROR_DRM_DECRYPT: return ERROR_DRM_DECRYPT; default: return UNKNOWN_ERROR; } } static status_t toStatusT_1_2(Status_V1_2 status) { switch (status) { case Status_V1_2::ERROR_DRM_SESSION_LOST_STATE: return ERROR_DRM_SESSION_LOST_STATE;; case Status_V1_2::ERROR_DRM_FRAME_TOO_LARGE: return ERROR_DRM_FRAME_TOO_LARGE; case Status_V1_2::ERROR_DRM_INSUFFICIENT_SECURITY: return ERROR_DRM_INSUFFICIENT_SECURITY; default: return toStatusT(static_cast<Status>(status)); } } static hidl_vec<uint8_t> toHidlVec(const Vector<uint8_t> &vector) { hidl_vec<uint8_t> vec; vec.setToExternal(const_cast<uint8_t *>(vector.array()), vector.size()); Loading Loading @@ -384,7 +350,7 @@ ssize_t CryptoHal::decrypt(const uint8_t keyId[16], const uint8_t iv[16], bytesWritten = hBytesWritten; *errorDetailMsg = toString8(hDetailedError); } err = toStatusT_1_2(status); err = toStatusT(status); } ); } else { Loading
drm/libmediadrm/DrmHal.cpp +4 −55 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ using drm::V1_1::SecureStopRelease; using drm::V1_1::SecurityLevel; using drm::V1_2::KeySetId; using drm::V1_2::KeyStatusType; using ::android::DrmUtils::toStatusT; using ::android::hardware::drm::V1_1::DrmMetricGroup; using ::android::hardware::hidl_array; using ::android::hardware::hidl_string; Loading Loading @@ -235,58 +236,6 @@ static List<Vector<uint8_t>> toKeySetIds(const hidl_vec<KeySetId>& return keySetIds; } static status_t toStatusT(Status status) { switch (status) { case Status::OK: return OK; break; case Status::ERROR_DRM_NO_LICENSE: return ERROR_DRM_NO_LICENSE; break; case Status::ERROR_DRM_LICENSE_EXPIRED: return ERROR_DRM_LICENSE_EXPIRED; break; case Status::ERROR_DRM_SESSION_NOT_OPENED: return ERROR_DRM_SESSION_NOT_OPENED; break; case Status::ERROR_DRM_CANNOT_HANDLE: return ERROR_DRM_CANNOT_HANDLE; break; case Status::ERROR_DRM_INVALID_STATE: return ERROR_DRM_INVALID_STATE; break; case Status::BAD_VALUE: return BAD_VALUE; break; case Status::ERROR_DRM_NOT_PROVISIONED: return ERROR_DRM_NOT_PROVISIONED; break; case Status::ERROR_DRM_RESOURCE_BUSY: return ERROR_DRM_RESOURCE_BUSY; break; case Status::ERROR_DRM_DEVICE_REVOKED: return ERROR_DRM_DEVICE_REVOKED; break; case Status::ERROR_DRM_UNKNOWN: default: return ERROR_DRM_UNKNOWN; break; } } static status_t toStatusT_1_2(Status_V1_2 status) { switch (status) { case Status_V1_2::ERROR_DRM_RESOURCE_CONTENTION: return ERROR_DRM_RESOURCE_CONTENTION; case Status_V1_2::ERROR_DRM_FRAME_TOO_LARGE: return ERROR_DRM_FRAME_TOO_LARGE; case Status_V1_2::ERROR_DRM_INSUFFICIENT_SECURITY: return ERROR_DRM_INSUFFICIENT_SECURITY; default: return toStatusT(static_cast<Status>(status)); } } Mutex DrmHal::mLock; struct DrmHal::DrmSessionClient : public aidl::android::media::BnResourceManagerClient { Loading Loading @@ -825,7 +774,7 @@ status_t DrmHal::getKeyRequest(Vector<uint8_t> const &sessionId, defaultUrl = toString8(hDefaultUrl); *keyRequestType = toKeyRequestType_1_1(hKeyRequestType); } err = toStatusT_1_2(status); err = toStatusT(status); }); } else if (mPluginV1_1 != NULL) { hResult = mPluginV1_1->getKeyRequest_1_1( Loading Loading @@ -947,7 +896,7 @@ status_t DrmHal::getProvisionRequest(String8 const &certType, request = toVector(hRequest); defaultUrl = toString8(hDefaultUrl); } err = toStatusT_1_2(status); err = toStatusT(status); } ); } else { Loading Loading @@ -1119,7 +1068,7 @@ status_t DrmHal::getHdcpLevels(DrmPlugin::HdcpLevel *connected, *connected = toHdcpLevel(hConnected); *max = toHdcpLevel(hMax); } err = toStatusT_1_2(status); err = toStatusT(status); }); } else if (mPluginV1_1 != NULL) { hResult = mPluginV1_1->getHdcpLevels( Loading
drm/libmediadrm/DrmUtils.cpp +88 −0 Original line number Diff line number Diff line Loading @@ -177,5 +177,93 @@ std::vector<sp<ICryptoPlugin>> MakeCryptoPlugins(const uint8_t uuid[16], const v return plugins; } status_t toStatusT_1_4(::V1_4::Status status) { switch (status) { case ::V1_4::Status::OK: return OK; case ::V1_4::Status::BAD_VALUE: return BAD_VALUE; case ::V1_4::Status::ERROR_DRM_CANNOT_HANDLE: return ERROR_DRM_CANNOT_HANDLE; case ::V1_4::Status::ERROR_DRM_DECRYPT: return ERROR_DRM_DECRYPT; case ::V1_4::Status::ERROR_DRM_DEVICE_REVOKED: return ERROR_DRM_DEVICE_REVOKED; case ::V1_4::Status::ERROR_DRM_FRAME_TOO_LARGE: return ERROR_DRM_FRAME_TOO_LARGE; case ::V1_4::Status::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION: return ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION; case ::V1_4::Status::ERROR_DRM_INSUFFICIENT_SECURITY: return ERROR_DRM_INSUFFICIENT_SECURITY; case ::V1_4::Status::ERROR_DRM_INVALID_STATE: return ERROR_DRM_INVALID_STATE; case ::V1_4::Status::ERROR_DRM_LICENSE_EXPIRED: return ERROR_DRM_LICENSE_EXPIRED; case ::V1_4::Status::ERROR_DRM_NO_LICENSE: return ERROR_DRM_NO_LICENSE; case ::V1_4::Status::ERROR_DRM_NOT_PROVISIONED: return ERROR_DRM_NOT_PROVISIONED; case ::V1_4::Status::ERROR_DRM_RESOURCE_BUSY: return ERROR_DRM_RESOURCE_BUSY; case ::V1_4::Status::ERROR_DRM_RESOURCE_CONTENTION: return ERROR_DRM_RESOURCE_CONTENTION; case ::V1_4::Status::ERROR_DRM_SESSION_LOST_STATE: return ERROR_DRM_SESSION_LOST_STATE; case ::V1_4::Status::ERROR_DRM_SESSION_NOT_OPENED: return ERROR_DRM_SESSION_NOT_OPENED; // New in S / drm@1.4: case ::V1_4::Status::CANNOT_DECRYPT_ZERO_SUBSAMPLES: return ERROR_DRM_ZERO_SUBSAMPLES; case ::V1_4::Status::CRYPTO_LIBRARY_ERROR: return ERROR_DRM_CRYPTO_LIBRARY; case ::V1_4::Status::GENERAL_OEM_ERROR: return ERROR_DRM_GENERIC_OEM; case ::V1_4::Status::GENERAL_PLUGIN_ERROR: return ERROR_DRM_GENERIC_PLUGIN; case ::V1_4::Status::INIT_DATA_INVALID: return ERROR_DRM_INIT_DATA; case ::V1_4::Status::KEY_NOT_LOADED: return ERROR_DRM_KEY_NOT_LOADED; case ::V1_4::Status::LICENSE_PARSE_ERROR: return ERROR_DRM_LICENSE_PARSE; case ::V1_4::Status::LICENSE_POLICY_ERROR: return ERROR_DRM_LICENSE_POLICY; case ::V1_4::Status::LICENSE_RELEASE_ERROR: return ERROR_DRM_LICENSE_RELEASE; case ::V1_4::Status::LICENSE_REQUEST_REJECTED: return ERROR_DRM_LICENSE_REQUEST_REJECTED; case ::V1_4::Status::LICENSE_RESTORE_ERROR: return ERROR_DRM_LICENSE_RESTORE; case ::V1_4::Status::LICENSE_STATE_ERROR: return ERROR_DRM_LICENSE_STATE; case ::V1_4::Status::MALFORMED_CERTIFICATE: return ERROR_DRM_CERTIFICATE_MALFORMED; case ::V1_4::Status::MEDIA_FRAMEWORK_ERROR: return ERROR_DRM_MEDIA_FRAMEWORK; case ::V1_4::Status::MISSING_CERTIFICATE: return ERROR_DRM_CERTIFICATE_MISSING; case ::V1_4::Status::PROVISIONING_CERTIFICATE_ERROR: return ERROR_DRM_PROVISIONING_CERTIFICATE; case ::V1_4::Status::PROVISIONING_CONFIGURATION_ERROR: return ERROR_DRM_PROVISIONING_CONFIG; case ::V1_4::Status::PROVISIONING_PARSE_ERROR: return ERROR_DRM_PROVISIONING_PARSE; case ::V1_4::Status::RETRYABLE_PROVISIONING_ERROR: return ERROR_DRM_PROVISIONING_RETRY; case ::V1_4::Status::SECURE_STOP_RELEASE_ERROR: return ERROR_DRM_SECURE_STOP_RELEASE; case ::V1_4::Status::STORAGE_READ_FAILURE: return ERROR_DRM_STORAGE_READ; case ::V1_4::Status::STORAGE_WRITE_FAILURE: return ERROR_DRM_STORAGE_WRITE; case ::V1_4::Status::ERROR_DRM_UNKNOWN: default: return ERROR_DRM_UNKNOWN; } return ERROR_DRM_UNKNOWN; } } // namespace DrmUtils } // namespace android
drm/libmediadrm/interface/mediadrm/DrmUtils.h +16 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <android/hardware/drm/1.0/ICryptoFactory.h> #include <android/hardware/drm/1.0/IDrmFactory.h> #include <android/hardware/drm/1.4/types.h> #include <utils/Errors.h> // for status_t #include <utils/StrongPointer.h> #include <vector> Loading Loading @@ -91,8 +92,21 @@ std::vector<sp<::V1_0::ICryptoFactory>> MakeCryptoFactories(const uint8_t uuid[1 std::vector<sp<::V1_0::ICryptoPlugin>> MakeCryptoPlugins(const uint8_t uuid[16], const void *initData, size_t initDataSize); } // namespace DrmUtils status_t toStatusT_1_4(::V1_4::Status status); } // namespace android template<typename S> inline status_t toStatusT(S status) { auto err = static_cast<::V1_4::Status>(status); return toStatusT_1_4(err); } template<typename T> inline status_t toStatusT(const android::hardware::Return<T> &status) { auto t = static_cast<T>(status); auto err = static_cast<::V1_4::Status>(t); return toStatusT_1_4(err); } } // namespace DrmUtils } // namespace android #endif // ANDROID_DRMUTILS_H
media/libstagefright/include/media/stagefright/MediaErrors.h +25 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,31 @@ enum { ERROR_DRM_RESOURCE_CONTENTION = DRM_ERROR_BASE - 14, ERROR_DRM_SESSION_LOST_STATE = DRM_ERROR_BASE - 15, ERROR_DRM_INVALID_STATE = DRM_ERROR_BASE - 16, ERROR_DRM_LAST_USED_ERRORCODE = DRM_ERROR_BASE - 16, // New in S / drm@1.4: ERROR_DRM_CERTIFICATE_MALFORMED = DRM_ERROR_BASE - 17, ERROR_DRM_CERTIFICATE_MISSING = DRM_ERROR_BASE - 18, ERROR_DRM_CRYPTO_LIBRARY = DRM_ERROR_BASE - 19, ERROR_DRM_GENERIC_OEM = DRM_ERROR_BASE - 20, ERROR_DRM_GENERIC_PLUGIN = DRM_ERROR_BASE - 21, ERROR_DRM_INIT_DATA = DRM_ERROR_BASE - 22, ERROR_DRM_KEY_NOT_LOADED = DRM_ERROR_BASE - 23, ERROR_DRM_LICENSE_PARSE = DRM_ERROR_BASE - 24, ERROR_DRM_LICENSE_POLICY = DRM_ERROR_BASE - 25, ERROR_DRM_LICENSE_RELEASE = DRM_ERROR_BASE - 26, ERROR_DRM_LICENSE_REQUEST_REJECTED = DRM_ERROR_BASE - 27, ERROR_DRM_LICENSE_RESTORE = DRM_ERROR_BASE - 28, ERROR_DRM_LICENSE_STATE = DRM_ERROR_BASE - 29, ERROR_DRM_MEDIA_FRAMEWORK = DRM_ERROR_BASE - 30, ERROR_DRM_PROVISIONING_CERTIFICATE = DRM_ERROR_BASE - 31, ERROR_DRM_PROVISIONING_CONFIG = DRM_ERROR_BASE - 32, ERROR_DRM_PROVISIONING_PARSE = DRM_ERROR_BASE - 33, ERROR_DRM_PROVISIONING_RETRY = DRM_ERROR_BASE - 34, ERROR_DRM_SECURE_STOP_RELEASE = DRM_ERROR_BASE - 35, ERROR_DRM_STORAGE_READ = DRM_ERROR_BASE - 36, ERROR_DRM_STORAGE_WRITE = DRM_ERROR_BASE - 37, ERROR_DRM_ZERO_SUBSAMPLES = DRM_ERROR_BASE - 38, ERROR_DRM_LAST_USED_ERRORCODE = DRM_ERROR_BASE - 38, ERROR_DRM_VENDOR_MAX = DRM_ERROR_BASE - 500, ERROR_DRM_VENDOR_MIN = DRM_ERROR_BASE - 999, Loading