diff --git a/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json b/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json index 0f1551246d802812986609a36989a170eb00d451..2a3cb212f6ff277c6801502b05a573e86a028c25 100644 --- a/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json +++ b/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json @@ -26,5 +26,13 @@ { "first_introduced": "11", "name": "OH_AVDemuxer_ReadSampleBuffer" + }, + { + "first_introduced": "11", + "name": "OH_AVDemuxer_SetMediaKeySystemInfoCallback" + }, + { + "first_introduced": "11", + "name": "OH_AVDemuxer_GetMediaKeySystemInfo" } ] diff --git a/multimedia/av_codec/native_avcodec_videodecoder.h b/multimedia/av_codec/native_avcodec_videodecoder.h index 46dc45b8c99b4bbc433dce7b2a24c8e8ecfdd994..a2f9b6641cf9d249e875552b05f22f3357229268 100644 --- a/multimedia/av_codec/native_avcodec_videodecoder.h +++ b/multimedia/av_codec/native_avcodec_videodecoder.h @@ -24,6 +24,8 @@ extern "C" { #endif +typedef struct MediaKeySession MediaKeySession; + /** * @brief Creates a video decoder instance from the mime type, which is recommended in most cases. * @syscap SystemCapability.Multimedia.Media.VideoDecoder @@ -300,6 +302,21 @@ OH_AVErrCode OH_VideoDecoder_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index) */ OH_AVErrCode OH_VideoDecoder_IsValid(OH_AVCodec *codec, bool *isValid); +/** + * @brief Set decryption info. + * + * @syscap SystemCapability.Multimedia.Media.VideoDecoder + * @param codec Pointer to an OH_AVCodec instance + * @param mediaKeySession A media key session instance with decryption function. + * @param secureVideoPath Require secure decoder or not. + * @return Returns AV_ERR_OK if the execution is successful, + * otherwise returns a specific error code, refer to {@link OH_AVErrCode} + * @since 11 + * @version 1.0 +*/ +OH_AVErrCode OH_VideoDecoder_SetDecryptionConfig(OH_AVCodec *codec, MediaKeySession *mediaKeySession, + bool secureVideoPath); + #ifdef __cplusplus } #endif diff --git a/multimedia/av_codec/native_avdemuxer.h b/multimedia/av_codec/native_avdemuxer.h index c5935a2e028b632dfed01c02601324ad5a128f84..84634687e987dbfa241f494a726351ff3fa3bbdf 100644 --- a/multimedia/av_codec/native_avdemuxer.h +++ b/multimedia/av_codec/native_avdemuxer.h @@ -25,6 +25,8 @@ extern "C" { #endif typedef struct OH_AVDemuxer OH_AVDemuxer; +typedef struct DRM_MediaKeySystemInfo DRM_MediaKeySystemInfo; +typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo* mediaKeySystemInfo); /** * @brief Creates an OH_AVDemuxer instance for getting samples from source. @@ -125,6 +127,32 @@ OH_AVErrCode OH_AVDemuxer_ReadSampleBuffer(OH_AVDemuxer *demuxer, uint32_t track */ OH_AVErrCode OH_AVDemuxer_SeekToTime(OH_AVDemuxer *demuxer, int64_t millisecond, OH_AVSeekMode mode); +/** + * @brief Method to set player media key system info callback. + * @syscap SystemCapability.Multimedia.Media.Spliter + * @param demuxer Pointer to an OH_AVDemuxer instance + * @param callback object pointer. + * @return Returns {@link AV_ERR_OK} if the drm info callback is set; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVDemuxer_SetMediaKeySystemInfoCallback(OH_AVDemuxer *demuxer, + DRM_MediaKeySystemInfoCallback callback); + +/** + * @brief Obtains media key system info to create media key session. + * @syscap SystemCapability.Multimedia.Media.Spliter + * @param demuxer Pointer to an OH_AVDemuxer instance + * @param mediaKeySystemInfo Indicates the media key system info which ram space allocated by callee and + released by caller. + * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVDemuxer_GetMediaKeySystemInfo(OH_AVDemuxer *demuxer, DRM_MediaKeySystemInfo *mediaKeySystemInfo); + #ifdef __cplusplus } #endif diff --git a/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json b/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json index e39821e1aa16dcab39df73d59c78203983217742..fa3c059ff46f2ea55ac2dae03a1649eebf1cae2e 100644 --- a/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json +++ b/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json @@ -82,5 +82,9 @@ { "first_introduced": "11", "name": "OH_VideoDecoder_RenderOutputBuffer" + }, + { + "first_introduced": "11", + "name": "OH_VideoDecoder_SetDecryptionConfig" } ] diff --git a/multimedia/drm_framework/BUILD.gn b/multimedia/drm_framework/BUILD.gn index 8c04d9bbb4b0f28ca3ab1a238c6ec46758f68ec4..1c08279e82d607ee6a4256b4e704927adc8eea6a 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 d89905051d594fb1ab74ffa27ebfa730e26fed8e..f634ebf107c8caa6ed9df0889225151b20797389 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[0]; + 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 c998cc863eb0b0771c3204576179f31c1298861b..a2f0db88b67ff535bbc2888414633c3630007b8f 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 fdcd89eedda1abcf8b36509a6fe442d6390cacd0..999aa04e1f36e8364863d01a41f88b92d5c3ee40 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 6b3af5d47303b89420d2dd701b420f56ea2d9c19..463e50e0b2382f38cd6306678e0a200aa8b62e42 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.