From e2a251a95830bab97ccf438eb87434949f774bca Mon Sep 17 00:00:00 2001 From: qiu-qiu-wang Date: Thu, 18 Jan 2024 10:53:21 +0800 Subject: [PATCH 1/2] set input Array type param description from ArrayType[0] to ArrayType pointer Signed-off-by: qiu-qiu-wang --- multimedia/drm_framework/common/native_drm_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multimedia/drm_framework/common/native_drm_common.h b/multimedia/drm_framework/common/native_drm_common.h index d89905051..6bba899ff 100644 --- a/multimedia/drm_framework/common/native_drm_common.h +++ b/multimedia/drm_framework/common/native_drm_common.h @@ -303,7 +303,7 @@ typedef struct DRM_MediaKeyRequestInfo { /** * Options data the application set to drm framework. */ - DRM_CharBufferPair optionsData[0]; + DRM_CharBufferPair *optionsData; } DRM_MediaKeyRequestInfo; /** -- Gitee From 46a56d77a4a12ac485ead0d3e29371f157680adb Mon Sep 17 00:00:00 2001 From: qiu-qiu-wang Date: Mon, 22 Jan 2024 10:17:29 +0800 Subject: [PATCH 2/2] rename libnative_drm.ndk.json and revise some format issues refractor drm func with ram routine Signed-off-by: qiu-qiu-wang --- multimedia/drm_framework/BUILD.gn | 2 +- .../drm_framework/common/native_drm_common.h | 265 +++++++++++------- .../drm_framework/common/native_drm_err.h | 30 +- ...ivedrm.ndk.json => libnative_drm.ndk.json} | 0 .../drm_framework/native_mediakeysession.h | 43 +-- .../drm_framework/native_mediakeysystem.h | 71 +++-- 6 files changed, 248 insertions(+), 163 deletions(-) rename multimedia/drm_framework/{libnativedrm.ndk.json => libnative_drm.ndk.json} (100%) diff --git a/multimedia/drm_framework/BUILD.gn b/multimedia/drm_framework/BUILD.gn index 8c04d9bbb..1c08279e8 100644 --- a/multimedia/drm_framework/BUILD.gn +++ b/multimedia/drm_framework/BUILD.gn @@ -22,7 +22,7 @@ ohos_ndk_headers("native_drm_header") { } ohos_ndk_library("libnative_drm") { - ndk_description_file = "./libnativedrm.ndk.json" + ndk_description_file = "./libnative_drm.ndk.json" min_compact_version = "11" output_name = "native_drm" output_extension = "so" diff --git a/multimedia/drm_framework/common/native_drm_common.h b/multimedia/drm_framework/common/native_drm_common.h index 6bba899ff..f634ebf10 100644 --- a/multimedia/drm_framework/common/native_drm_common.h +++ b/multimedia/drm_framework/common/native_drm_common.h @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -44,37 +44,37 @@ extern "C" { #endif /** - * Enumerates event types of listener. - * @brief Content potection level. + * + * @brief Enumerates event types of listener. * @since 11 * @version 1.0 */ -typedef enum DRM_ListenerType { +typedef enum DRM_EventType { /** * DRM event base. */ - LISTENER_DRM_EVENT = 200, + EVENT_DRM_BASE = 200, /** * Provision required event. */ - LISTENER_PROVISION_REQUIRED = 201, + EVENT_PROVISION_REQUIRED = 201, /** * Media key required event. */ - LISTENER_KEY_REQUIRED = 202, + EVENT_KEY_REQUIRED = 202, /** * Media key expired event. */ - LISTENER_KEY_EXPIRED = 203, + EVENT_KEY_EXPIRED = 203, /** * Vendor defined event. */ - LISTENER_VENDOR_DEFINED = 204, + EVENT_VENDOR_DEFINED = 204, /** * Expiration update event. */ - LISTENER_EXPIRATION_UPDATE = 206, - } DRM_ListenerType; + EVENT_EXPIRATION_UPDATE = 206, + } DRM_EventType; /** * @brief Content potection level. @@ -206,77 +206,35 @@ typedef enum DRM_CertificateStatus { } DRM_CertificateStatus; /** - * @brief Offline media key status. - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Max count of media key request option. * @since 11 * @version 1.0 */ -typedef enum DRM_MediaKeyStatus { - /** - * Media key status OK. - */ - MEDIA_KEY_STATUS_OK = 0, - /** - * Media key is invalid e.g. not exist. - */ - MEDIA_KEY_STATUS_UNAVAILABLE = 1, -} DRM_MediaKeyStatus; - +#define MAX_MEDIA_KEY_REQUEST_OPTION_COUNT 16 /** - * @brief Unsigned char buffer. + * @brief Max len of media key request option name. * @since 11 * @version 1.0 */ -typedef struct DRM_Uint8Buffer { - /** - * Unsigned char buffer addr. - */ - unsigned char *buffer; - /** - * Unsigned char buffer len. - */ - uint32_t bufferLen; -} DRM_Uint8Buffer; - +#define MAX_MEDIA_KEY_REQUEST_OPTION_NAME_LEN 64 /** - * @brief Char buffer. + * @brief Max len of media key request option data. * @since 11 * @version 1.0 */ -typedef struct DRM_CharBuffer { - /** - * Char buffer addr. - */ - char *buffer; - /** - * Char buffer len. - */ - uint32_t bufferLen; -} DRM_CharBuffer; - +#define MAX_MEDIA_KEY_REQUEST_OPTION_DATA_LEN 128 /** - * @brief Char-char buffer pair. + * @brief Max len of media key request init data. * @since 11 * @version 1.0 */ -typedef struct DRM_CharBufferPair { - /* Name buffer in chars. */ - DRM_CharBuffer name; - /* Value buffer in chars. */ - DRM_CharBuffer value; -} DRM_CharBufferPair; - +#define MAX_INIT_DATA_LEN 2048 /** - * @brief Unsignedchar-char buffer. + * @brief Max len of media mimetype. * @since 11 * @version 1.0 */ -typedef struct DRM_Uint8CharBufferPair { - /* Key buffer in Uint8Array. */ - DRM_Uint8Buffer key; - /* Value buffer in chars. */ - DRM_CharBuffer value; -} DRM_Uint8CharBufferPair; +#define MAX_MIMETYPE_LEN 64 /** * @brief Media key request info. @@ -288,26 +246,46 @@ typedef struct DRM_MediaKeyRequestInfo { * Offline or online media key type. */ DRM_MediaKeyType type; + /** + * Initial data len. + */ + int32_t initDataLen; /** * Initial data format as PSSH after base64 encoding. */ - DRM_Uint8Buffer data; + uint8_t initData[MAX_INIT_DATA_LEN]; /** * Media content mime type. */ - DRM_CharBuffer mimeType; + char mimeType[MAX_MIMETYPE_LEN]; /** * OptionsData count. */ uint32_t optionsCount; + /** + * Options name the application set to drm framework. + */ + char optionName[MAX_MEDIA_KEY_REQUEST_OPTION_COUNT][MAX_MEDIA_KEY_REQUEST_OPTION_NAME_LEN]; /** * Options data the application set to drm framework. */ - DRM_CharBufferPair *optionsData; + char optionData[MAX_MEDIA_KEY_REQUEST_OPTION_COUNT][MAX_MEDIA_KEY_REQUEST_OPTION_DATA_LEN]; } DRM_MediaKeyRequestInfo; /** - * @brief Media key request info. + * @brief Max len of media key request. + * @since 11 + * @version 1.0 + */ +#define MAX_MEDIA_KEY_REQUEST_DATA_LEN 8192 +/** + * @brief Max len of URL. + * @since 11 + * @version 1.0 + */ +#define MAX_DEFAULT_URL_LEN 2048 +/** + * @brief Media key request. * @since 11 * @version 1.0 */ @@ -316,16 +294,39 @@ typedef struct DRM_MediaKeyRequest { * Media key request type. */ DRM_MediaKeyRequestType type; + /** + * Media key request data len. + */ + int32_t dataLen; /** * Media key request data sent to media key server. */ - DRM_Uint8Buffer data; + uint8_t data[MAX_MEDIA_KEY_REQUEST_DATA_LEN]; /** * Media key server URL. */ - DRM_CharBuffer defaultUrl; + char defaultUrl[MAX_DEFAULT_URL_LEN]; } DRM_MediaKeyRequest; +/** + * @brief Max count of statistics item. + * @since 11 + * @version 1.0 + */ +#define MAX_STATISTICS_COUNT 10 +/** + * @brief Max len of statistics item name. + * @since 11 + * @version 1.0 + */ +#define MAX_STATISTICS_NAME_LEN 64 +/** + * @brief Max len of statistics item buffer. + * @since 11 + * @version 1.0 + */ +#define MAX_STATISTICS_BUFFER_LEN 256 + /** * @brief Statistics of MediaKeySystem. * @since 11 @@ -334,21 +335,57 @@ typedef struct DRM_MediaKeyRequest { typedef struct DRM_Statistics { /* Statistics count. */ uint32_t statisticsCount; - /* Statistics info. */ - DRM_CharBufferPair info[0]; + /* Statistics name. */ + char statisticsName[MAX_STATISTICS_COUNT][MAX_STATISTICS_NAME_LEN]; + /* Statistics description. */ + char statisticsDescription[MAX_STATISTICS_COUNT][MAX_STATISTICS_BUFFER_LEN]; } DRM_Statistics; /** - * @brief MediaKeyIds array. + * @brief Max count of offline media key id. + * @since 11 + * @version 1.0 + */ +#define MAX_OFFLINE_MEDIA_KEY_ID_COUNT 512 +/** + * @brief Max len of offline media key id. + * @since 11 + * @version 1.0 + */ +#define MAX_OFFLINE_MEDIA_KEY_ID_LEN 64 + +/** + * @brief Offline media key ids array. + * @since 11 + * @version 1.0 + */ +typedef struct DRM_OfflineMediakeyIdArray { + /* Ids count. */ + uint32_t idsCount; + /* Ids len. */ + int32_t idsLen[MAX_OFFLINE_MEDIA_KEY_ID_COUNT]; + /* Ids. */ + uint8_t ids[MAX_OFFLINE_MEDIA_KEY_ID_COUNT][MAX_OFFLINE_MEDIA_KEY_ID_LEN]; +} DRM_OfflineMediakeyIdArray; + +/** + * @brief Max count of key info. + * @since 11 + * @version 1.0 + */ +#define MAX_KEY_INFO_COUNT 64 +/** + * @brief Max len of key id. + * @since 11 + * @version 1.0 + */ +#define MAX_KEY_ID_LEN 16 +/** + * @brief Max len of key status value. * @since 11 * @version 1.0 */ -typedef struct DRM_MediakeyIdArray { - /* MediaKeyId count. */ - uint32_t mediaKeyIdCount; - /* MediaKeyIds. */ - DRM_Uint8Buffer mediaKeyIds[0]; -} DRM_MediakeyIdArray; +#define MAX_KEY_STATUS_VALUE_LEN 128 /** * @brief Media key info. @@ -357,29 +394,58 @@ typedef struct DRM_MediakeyIdArray { */ typedef struct DRM_KeysInfo { /* Keys count. */ - uint32_t keysCount; - /* Keys info. */ - DRM_Uint8CharBufferPair keysInfo[0]; + uint32_t keysInfoCount; + /* Key id. */ + uint8_t keyId[MAX_KEY_INFO_COUNT][MAX_KEY_ID_LEN]; + /* Key status value. */ + char statusValue[MAX_KEY_INFO_COUNT][MAX_KEY_STATUS_VALUE_LEN]; } DRM_KeysInfo; /** - * @brief MediaKeydescription + * @brief Max count of media key status. * @since 11 * @version 1.0 */ -typedef struct DRM_MediaKeyDescription { - /* MediaKeycount. */ - uint32_t mediaKeyCount; - /* MediaKeyinfo. */ - DRM_CharBufferPair description[0]; -} DRM_MediaKeyDescription; +#define MAX_MEDIA_KEY_STATUS_COUNT 64 +/** + * @brief Max len of media key status name. + * @since 11 + * @version 1.0 + */ +#define MAX_MEDIA_KEY_STATUS_NAME_LEN 64 +/** + * @brief Max len of media key status value. + * @since 11 + * @version 1.0 + */ +#define MAX_MEDIA_KEY_STATUS_VALUE_LEN 256 /** - * @brief Drm system uuid. + * @brief Media key status like pocily etc. + * @since 11 + * @version 1.0 + */ +typedef struct DRM_MediaKeyStatus { + /* Status count. */ + uint32_t statusCount; + /* Status name. */ + char statusName[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_NAME_LEN]; + /* Status value. */ + char statusValue[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_VALUE_LEN]; +} DRM_MediaKeyStatus; + +/** + * @brief Drm system uuid len. * @since 11 * @version 1.0 */ #define DRM_UUID_LEN 16 +/** + * @brief Max len of PSSH data. + * @since 11 + * @version 1.0 + */ +#define MAX_PSSH_DATA_LEN 2048 /** * @brief PSSH info by uuid. @@ -390,17 +456,24 @@ typedef struct DRM_PsshInfo { /** * Uuid. */ - char uuid[DRM_UUID_LEN]; + uint8_t uuid[DRM_UUID_LEN]; /** - * Unsigned char PSSH len. + * PSSH data len. */ - uint32_t dataLen; + int32_t dataLen; /** - * Unsigned char PSSH data. + * uint8_t PSSH data. */ - unsigned char *data; + uint8_t data[MAX_PSSH_DATA_LEN]; } DRM_PsshInfo; +/** + * @brief Max count of PSSH info. + * @since 11 + * @version 1.0 + */ +#define MAX_PSSH_INFO_COUNT 8 + /** * @brief MediaKeySystemInfo used for player to get media key system info from media source. * @since 11 @@ -410,10 +483,10 @@ typedef struct DRM_MediaKeySystemInfo { /* PSSH count. */ uint32_t psshCount; /* PSSH info. */ - DRM_PsshInfo psshInfo[0]; + DRM_PsshInfo psshInfo[MAX_PSSH_INFO_COUNT]; } DRM_MediaKeySystemInfo; -typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo* mediaKeySystemInfo); +typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo *mediaKeySystemInfo); /** * @brief Media key system struct. diff --git a/multimedia/drm_framework/common/native_drm_err.h b/multimedia/drm_framework/common/native_drm_err.h index c998cc863..a2f0db88b 100644 --- a/multimedia/drm_framework/common/native_drm_err.h +++ b/multimedia/drm_framework/common/native_drm_err.h @@ -53,58 +53,62 @@ typedef enum Drm_ErrCode { * the operation completed successfully. */ DRM_ERR_OK = 0, + /** + * DRM CAPI ERROR BASE. + */ + DRM_CAPI_ERR_BASE = 24700500, /** * no memory. */ - DRM_ERR_NO_MEMORY, + DRM_ERR_NO_MEMORY = DRM_CAPI_ERR_BASE + 1, /** * opertation not be permitted. */ - DRM_ERR_OPERATION_NOT_PERMITTED, + DRM_ERR_OPERATION_NOT_PERMITTED = DRM_CAPI_ERR_BASE + 2, /** * invalid argument. */ - DRM_ERR_INVALID_VAL, + DRM_ERR_INVALID_VAL = DRM_CAPI_ERR_BASE + 3, /** * IO error. */ - DRM_ERR_IO, + DRM_ERR_IO = DRM_CAPI_ERR_BASE + 4, /** * network timeout. */ - DRM_ERR_TIMEOUT, + DRM_ERR_TIMEOUT = DRM_CAPI_ERR_BASE + 5, /** * unknown error. */ - DRM_ERR_UNKNOWN, + DRM_ERR_UNKNOWN = DRM_CAPI_ERR_BASE + 6, /** * drm service died. */ - DRM_ERR_SERVICE_DIED, + DRM_ERR_SERVICE_DIED = DRM_CAPI_ERR_BASE + 7, /** * not support this operation in this state. */ - DRM_ERR_INVALID_STATE, + DRM_ERR_INVALID_STATE = DRM_CAPI_ERR_BASE + 8, /** * unsupport interface. */ - DRM_ERR_UNSUPPORTED, + DRM_ERR_UNSUPPORTED = DRM_CAPI_ERR_BASE + 9, /** * Meet max MediaKeySystem num limit. */ - DRM_ERR_MAX_SYSTEM_NUM_REACHED, + DRM_ERR_MAX_SYSTEM_NUM_REACHED = DRM_CAPI_ERR_BASE + 10, /** * Meet max MediaKeySession num limit. */ - DRM_ERR_MAX_SESSION_NUM_REACHED, + DRM_ERR_MAX_SESSION_NUM_REACHED = DRM_CAPI_ERR_BASE + 11, /** * extend err start. */ - DRM_ERR_EXTEND_START = 100, + DRM_ERR_EXTEND_START = DRM_CAPI_ERR_BASE + 100, } Drm_ErrCode; #ifdef __cplusplus } #endif -#endif // NATIVE_DRM_ERR_H \ No newline at end of file +#endif // NATIVE_DRM_ERR_H diff --git a/multimedia/drm_framework/libnativedrm.ndk.json b/multimedia/drm_framework/libnative_drm.ndk.json similarity index 100% rename from multimedia/drm_framework/libnativedrm.ndk.json rename to multimedia/drm_framework/libnative_drm.ndk.json diff --git a/multimedia/drm_framework/native_mediakeysession.h b/multimedia/drm_framework/native_mediakeysession.h index fdcd89eed..999aa04e1 100644 --- a/multimedia/drm_framework/native_mediakeysession.h +++ b/multimedia/drm_framework/native_mediakeysession.h @@ -50,16 +50,20 @@ extern "C" /** * @brief Call back will be invoked when event triggers. * @param eventType Event type. - * @param eventInfo Event info gotten from media key system. + * @param info Event info gotten from media key session. + * @param infoLen Event info len. + * @param extra Extra info gotten from media key session. * @return Drm_ErrCode. * @since 11 * @version 1.0 */ -typedef Drm_ErrCode (*MediaKeySession_EventCallback)(DRM_ListenerType eventType, DRM_Uint8CharBufferPair *eventInfo); +typedef Drm_ErrCode (*MediaKeySession_EventCallback)(DRM_EventType eventType, uint8_t *info, + int32_t infoLen, char *extra); /** * @brief Call back will be invoked when key changes. * @param keysInfo Key info gotten from media key system. + * @param newKeysAvailable Whether new keys available. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 @@ -92,31 +96,32 @@ typedef struct MediaKeySession_Callback { * @version 1.0 */ Drm_ErrCode OH_MediaKeySession_GenerateMediaKeyRequest(MediaKeySession *mediaKeySession, - DRM_MediaKeyRequestInfo *info, DRM_MediaKeyRequest **mediaKeyRequest); + DRM_MediaKeyRequestInfo *info, DRM_MediaKeyRequest *mediaKeyRequest); /** * @brief Process media key response. * @param mediaKeySession Media key session instance. * @param response Media Key resposne. - * @param mediaKeyId Media key identifier. - * @param mediaKeyIdLen Media key identifier len. + * @param responseLen Media Key resposne len. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len for in buffer and out data. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySession_ProcessMediaKeyResponse(MediaKeySession *keySession, - DRM_Uint8Buffer *response, unsigned char **mediaKeyId, int32_t *mediaKeyIdLen); +Drm_ErrCode OH_MediaKeySession_ProcessMediaKeyResponse(MediaKeySession *mediaKeySession, + uint8_t *response, int32_t responseLen, uint8_t *offlineMediaKeyId, int32_t *offlineMediaKeyIdLen); /** * @brief Check media key status. * @param mediaKeySession Media key session instance. - * @param mediaKeyDescription Media key status description. + * @param mediaKeyStatus Media key status. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySession_CheckMediaKeyStatus(MediaKeySession *mediaKeySessoin, - DRM_MediaKeyDescription **mediaKeyDescription); + DRM_MediaKeyStatus *mediaKeyStatus); /** * @brief Clear media keys of the current session . @@ -130,38 +135,44 @@ Drm_ErrCode OH_MediaKeySession_ClearMediaKeys(MediaKeySession *mediaKeySessoin); /** * @brief Generate offline media key release request. * @param mediaKeySession Media key session instance. - * @param mediaKeyId Media key identifier. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. * @param releaseRequest Media Key release request. - * @param releaseRequestLen Media Key release request len. + * @param releaseRequestLen Media Key release request len for in buffer and out data. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySession_GenerateOfflineReleaseRequest(MediaKeySession *mediaKeySessoin, - DRM_Uint8Buffer *mediaKeyId, unsigned char **releaseRequest, int32_t *releaseRequestLen); + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, uint8_t *releaseRequest, + int32_t *releaseRequestLen); /** * @brief Process offline media key release response. * @param mediaKeySession Media key session instance. - * @param mediaKeyId Media key identifier. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. * @param releaseReponse Media Key resposne. + * @param releaseReponseLen Media Key resposne len. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySession_ProcessOfflineReleaseResponse(MediaKeySession *mediaKeySessoin, - DRM_Uint8Buffer *mediaKeyId, DRM_Uint8Buffer *releaseReponse); + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, uint8_t *releaseReponse, + int32_t releaseReponseLen); /** * @brief Restore offline media keys by ID. * @param mediaKeySession Media key session instance. - * @param mediaKeyId Media key identifier. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySession_RestoreOfflineMediaKeys(MediaKeySession *mediaKeySessoin, - DRM_Uint8Buffer *mediaKeyId); + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen); /** * @brief Get content protection level of the session. diff --git a/multimedia/drm_framework/native_mediakeysystem.h b/multimedia/drm_framework/native_mediakeysystem.h index 6b3af5d47..463e50e0b 100644 --- a/multimedia/drm_framework/native_mediakeysystem.h +++ b/multimedia/drm_framework/native_mediakeysystem.h @@ -52,22 +52,15 @@ extern "C" { /** * @brief Call back will be invoked when event triggers. * @param eventType Event type. - * @param eventInfo Event info gotten from media key system. + * @param info Event info gotten from media key system. + * @param infoLen Event info len. + * @param extra Extra info gotten from media key system. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ -typedef Drm_ErrCode (*MediaKeySystem_Callback)(DRM_ListenerType eventType, DRM_Uint8CharBufferPair *eventInfo); -/** - * @brief Get a media key system name by uuid. - * @param uuid Secifies drm system. - * @param name Name string to be gotten. - * @param nameLen Name string len. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. - * @since 11 - * @version 1.0 - */ -Drm_ErrCode OH_MediaKeySystem_GetMediaKeySystemName(const char *uuid, unsigned char **name, int32_t *nameLen); +typedef Drm_ErrCode (*MediaKeySystem_Callback)(DRM_EventType eventType, uint8_t *info, + int32_t infoLen, char *extra); /** * @brief Query if media key system is supported. @@ -111,8 +104,8 @@ Drm_ErrCode OH_MediaKeySystem_Create(const char *name, MediaKeySystem **mediaKey /** * @brief Set media key system configuration value by name. * @param mediaKeySystem Media key system instance. - * @param configName Configuratoin name string. - * @param value Configuratoin vaule string to be set. + * @param configName Configuration name string. + * @param value Configuration vaule string to be set. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 @@ -122,38 +115,39 @@ Drm_ErrCode OH_MediaKeySystem_SetConfigurationString(MediaKeySystem *mediaKeySys /** * @brief Get media key system configuration value by name. * @param mediaKeySystem Media key system instance. - * @param configName Configuratoin name string. - * @param value Configuratoin vaule string to be get. - * @param valueLen Configuratoin vaule string len. + * @param configName Configuration name string. + * @param value Configuration vaule string to be get. + * @param valueLen Configuration vaule string len for in buffer. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_GetConfigurationString(MediaKeySystem *mediaKeySystem, - const char *configName, char **value, int32_t *valueLen); + const char *configName, char *value, int32_t valueLen); /** * @brief Set media key system configuration value by name. * @param mediaKeySystem Media key system instance. - * @param configName Configuratoin name string. - * @param value Configuratoin vaule in byte array to be set. + * @param configName Configuration name string. + * @param value Configuration vaule in byte array to be set. + * @param valueLen Value array len. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_SetConfigurationByteArray(MediaKeySystem *mediaKeySystem, - const char *configName, DRM_Uint8Buffer *value); + const char *configName, uint8_t *value, int32_t valueLen); /** * @brief Get media key system configuration value by name. * @param mediaKeySystem Media key system instance. - * @param configName Configuratoin name string. - * @param value Configuratoin vaule in byte array to be get. - * @param valueLen Configuratoin vaule len in byte. + * @param configName Configuration name string. + * @param value Configuration vaule in byte array to be get. + * @param valueLen Configuration vaule len for in buffer and out data. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_GetConfigurationByteArray(MediaKeySystem *mediaKeySystem, - const char *configName, unsigned char **value, int32_t *valueLen); + const char *configName, uint8_t *value, int32_t *valueLen); /** * @brief Get media key system statistics info. * @param mediaKeySystem Media key system instance. @@ -162,7 +156,7 @@ Drm_ErrCode OH_MediaKeySystem_GetConfigurationByteArray(MediaKeySystem *mediaKey * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySystem_GetStatistics(MediaKeySystem *mediaKeySystem, DRM_Statistics **statistics); +Drm_ErrCode OH_MediaKeySystem_GetStatistics(MediaKeySystem *mediaKeySystem, DRM_Statistics *statistics); /** * @brief Get the max content protection level media key system supported. * @param mediaKeySystem Media key system instance. @@ -201,60 +195,63 @@ Drm_ErrCode OH_MediaKeySystem_CreateMediaKeySession(MediaKeySystem *mediaKeySyst * @brief Generate a media key system provision request. * @param mediaKeySystem Media key system instance. * @param request Provision request data sent to provision server. - * @param requestLen Provision request data len. + * @param requestLen Provision request data len for in buffer and out data. * @param defaultUrl Provision server URL. - * @param defaultUrlLen Provision server URL len. + * @param defaultUrlLen Provision server URL len for in buffer. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySystem_GenerateKeySystemRequest(MediaKeySystem *mediaKeySystem, unsigned char **request, - int32_t *requestLen, char **defaultUrl, int32_t *defaultUrlLen); +Drm_ErrCode OH_MediaKeySystem_GenerateKeySystemRequest(MediaKeySystem *mediaKeySystem, uint8_t *request, + int32_t *requestLen, char *defaultUrl, int32_t defaultUrlLen); /** * @brief Process a media key system provision response. * @param mediaKeySystem Media key system instance. * @param response The provision reponse will be processed. + * @param responseLen The response len. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_ProcessKeySystemResponse(MediaKeySystem *mediaKeySystem, - DRM_Uint8Buffer *response); + uint8_t *response, int32_t responseLen); /** * @brief Get offline media key ids . * @param mediaKeySystem Media key system instance. - * @param mediaKeyIds Media key ids of all offline media keys. + * @param offlineMediaKeyIds Media key ids of all offline media keys. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyIds(MediaKeySystem *mediaKeySystem, - DRM_MediakeyIdArray **mediaKeyIds); + DRM_OfflineMediakeyIdArray *offlineMediaKeyIds); /** * @brief Get offline media key status. * @param mediaKeySystem Media key system instance. - * @param mediaKeyId Media key identifier. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. * @param status The media key status gotten. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyStatus(MediaKeySystem *mediaKeySystem, - DRM_Uint8Buffer *mediaKeyId, DRM_OfflineMediaKeyStatus *status); + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, DRM_OfflineMediaKeyStatus *status); /** * @brief Clear an offline media key by id. * @param mediaKeySystem Media key system instance. - * @param mediaKeyId Media key identifier. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_ClearOfflineMediaKeys(MediaKeySystem *mediaKeySystem, - DRM_Uint8Buffer *mediaKeyId); + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen); /** * @brief Get certificate status of media key system. -- Gitee