From 3afdc8de38298f04842fdba868cca7ad4fb4edbd Mon Sep 17 00:00:00 2001 From: qiu-qiu-wang Date: Mon, 29 Jan 2024 18:03:52 +0800 Subject: [PATCH 1/4] trigger compile sdk Signed-off-by: qiu-qiu-wang --- multimedia/drm_framework/native_mediakeysession.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/multimedia/drm_framework/native_mediakeysession.h b/multimedia/drm_framework/native_mediakeysession.h index 999aa04e1f3..a2f8de7aa74 100644 --- a/multimedia/drm_framework/native_mediakeysession.h +++ b/multimedia/drm_framework/native_mediakeysession.h @@ -217,8 +217,9 @@ Drm_ErrCode OH_MediaKeySession_SetMediaKeySessionCallback(MediaKeySession *media */ Drm_ErrCode OH_MediaKeySession_Destroy(MediaKeySession *mediaKeySessoin); + #ifdef __cplusplus } #endif -#endif // OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H \ No newline at end of file +#endif // OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H -- Gitee From 4ee3cafcfc1844e669754bbf989d80bc3a2be50a Mon Sep 17 00:00:00 2001 From: qiu-qiu-wang Date: Sat, 17 Feb 2024 16:45:44 +0800 Subject: [PATCH 2/4] add cenc info definiton to drm CAPI for application pass cenc info Signed-off-by: qiu-qiu-wang --- .../drm_framework/common/native_drm_common.h | 115 +++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-) diff --git a/multimedia/drm_framework/common/native_drm_common.h b/multimedia/drm_framework/common/native_drm_common.h index f634ebf107c..ef12eb28b36 100644 --- a/multimedia/drm_framework/common/native_drm_common.h +++ b/multimedia/drm_framework/common/native_drm_common.h @@ -502,8 +502,121 @@ typedef struct MediaKeySystem MediaKeySystem; */ typedef struct MediaKeySession MediaKeySession; +/** + * @brief Media key id size. + * @since 12 + * @version 1.0 + */ +#define META_DRM_KEY_ID_SIZE 16 +/** + * @brief Media key iv size. + * @since 12 + * @version 1.0 + */ +#define META_DRM_IV_SIZE 16 +/** + * @brief Max count of sub samples. + * @since 12 + * @version 1.0 + */ +#define META_DRM_MAX_SUB_SAMPLE_NUM 64 + +/** + * @brief Key string of drm cenc info used as param key by {@link OH_AVFormat_SetBuffer}. + * @since 12 + * @version 1.0 + */ +const char DRM_CENC_INFO[] = "drm_cenc_info"; + +/** + * @brief Drm cenc algorithm type. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 12 + * @version 1.0 + */ +enum MetaDrmCencAlgorithm { + /** + * Uncrypted. + */ + META_DRM_ALG_CENC_UNENCRYPTED = 0x0, + /** + * Aes ctr. + */ + META_DRM_ALG_CENC_AES_CTR = 0x1, + /** + * Aes wv. + */ + META_DRM_ALG_CENC_AES_WV = 0x2, + /** + * Aes cbc. + */ + META_DRM_ALG_CENC_AES_CBC = 0x3, + /** + * Sm4 cbc. + */ + META_DRM_ALG_CENC_SM4_CBC = 0x4, + /** + * Sm4 ctr. + */ + META_DRM_ALG_CENC_SM4_CTR, +}; + +/** + * @brief Subsample info of media. + * @since 12 + * @version 1.0 + */ +struct MetaDrmSubSample { + /* Clear header len. */ + uint32_t clearHeaderLen; + /* Payload Len. */ + uint32_t payLoadLen; +}; +/** + * @brief Struct MetaDrmSubSample alias. + * @since 12 + * @version 1.0 + */ +typedef struct MetaDrmSubSample MetaDrmSubSample; + +/** + * @brief Cenc info of media. + * @since 12 + * @version 1.0 + */ +struct MetaDrmCencInfo { + /* Cenc algorithm used. */ + MetaDrmCencAlgorithm algo; + /* Key id. */ + uint8_t keyId[META_DRM_KEY_ID_SIZE]; + /* Key id len. */ + uint32_t keyIdLen; + /* Iv. */ + uint8_t iv[META_DRM_IV_SIZE]; + /* Iv len. */ + uint32_t ivLen; + /* Whether ambiguity content exists, only used in TS format. */ + uint32_t isAmbiguity; + /* Encrytped blocks num. */ + uint32_t encryptBlocks; + /* Clear blocks num. */ + uint32_t skipBlocks; + /* First encrypted payload offset. */ + uint32_t firstEncryptOffset; + /* Subsamples info. */ + MetaDrmSubSample subSample[META_DRM_MAX_SUB_SAMPLE_NUM]; + /* Subsamples num. */ + uint32_t subSampleNum; +}; +/** + * @brief Struct MetaDrmCencInfo alias. + * @since 12 + * @version 1.0 + */ +typedef struct MetaDrmCencInfo MetaDrmCencInfo; + #ifdef __cplusplus } #endif -#endif // NATIVE_DRM_COMMON_H \ No newline at end of file +#endif // NATIVE_DRM_COMMON_H -- Gitee From e68214c97144e4390a06a9976e6699460b79b00e Mon Sep 17 00:00:00 2001 From: qiu-qiu-wang Date: Sat, 17 Feb 2024 16:45:44 +0800 Subject: [PATCH 3/4] add cenc info definiton to drm CAPI for application pass cenc info Signed-off-by: qiu-qiu-wang --- .../drm_framework/common/native_drm_common.h | 115 +++++++++++++++++- .../drm_framework/native_mediakeysession.h | 1 - 2 files changed, 114 insertions(+), 2 deletions(-) diff --git a/multimedia/drm_framework/common/native_drm_common.h b/multimedia/drm_framework/common/native_drm_common.h index f634ebf107c..ef12eb28b36 100644 --- a/multimedia/drm_framework/common/native_drm_common.h +++ b/multimedia/drm_framework/common/native_drm_common.h @@ -502,8 +502,121 @@ typedef struct MediaKeySystem MediaKeySystem; */ typedef struct MediaKeySession MediaKeySession; +/** + * @brief Media key id size. + * @since 12 + * @version 1.0 + */ +#define META_DRM_KEY_ID_SIZE 16 +/** + * @brief Media key iv size. + * @since 12 + * @version 1.0 + */ +#define META_DRM_IV_SIZE 16 +/** + * @brief Max count of sub samples. + * @since 12 + * @version 1.0 + */ +#define META_DRM_MAX_SUB_SAMPLE_NUM 64 + +/** + * @brief Key string of drm cenc info used as param key by {@link OH_AVFormat_SetBuffer}. + * @since 12 + * @version 1.0 + */ +const char DRM_CENC_INFO[] = "drm_cenc_info"; + +/** + * @brief Drm cenc algorithm type. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 12 + * @version 1.0 + */ +enum MetaDrmCencAlgorithm { + /** + * Uncrypted. + */ + META_DRM_ALG_CENC_UNENCRYPTED = 0x0, + /** + * Aes ctr. + */ + META_DRM_ALG_CENC_AES_CTR = 0x1, + /** + * Aes wv. + */ + META_DRM_ALG_CENC_AES_WV = 0x2, + /** + * Aes cbc. + */ + META_DRM_ALG_CENC_AES_CBC = 0x3, + /** + * Sm4 cbc. + */ + META_DRM_ALG_CENC_SM4_CBC = 0x4, + /** + * Sm4 ctr. + */ + META_DRM_ALG_CENC_SM4_CTR, +}; + +/** + * @brief Subsample info of media. + * @since 12 + * @version 1.0 + */ +struct MetaDrmSubSample { + /* Clear header len. */ + uint32_t clearHeaderLen; + /* Payload Len. */ + uint32_t payLoadLen; +}; +/** + * @brief Struct MetaDrmSubSample alias. + * @since 12 + * @version 1.0 + */ +typedef struct MetaDrmSubSample MetaDrmSubSample; + +/** + * @brief Cenc info of media. + * @since 12 + * @version 1.0 + */ +struct MetaDrmCencInfo { + /* Cenc algorithm used. */ + MetaDrmCencAlgorithm algo; + /* Key id. */ + uint8_t keyId[META_DRM_KEY_ID_SIZE]; + /* Key id len. */ + uint32_t keyIdLen; + /* Iv. */ + uint8_t iv[META_DRM_IV_SIZE]; + /* Iv len. */ + uint32_t ivLen; + /* Whether ambiguity content exists, only used in TS format. */ + uint32_t isAmbiguity; + /* Encrytped blocks num. */ + uint32_t encryptBlocks; + /* Clear blocks num. */ + uint32_t skipBlocks; + /* First encrypted payload offset. */ + uint32_t firstEncryptOffset; + /* Subsamples info. */ + MetaDrmSubSample subSample[META_DRM_MAX_SUB_SAMPLE_NUM]; + /* Subsamples num. */ + uint32_t subSampleNum; +}; +/** + * @brief Struct MetaDrmCencInfo alias. + * @since 12 + * @version 1.0 + */ +typedef struct MetaDrmCencInfo MetaDrmCencInfo; + #ifdef __cplusplus } #endif -#endif // NATIVE_DRM_COMMON_H \ No newline at end of file +#endif // NATIVE_DRM_COMMON_H diff --git a/multimedia/drm_framework/native_mediakeysession.h b/multimedia/drm_framework/native_mediakeysession.h index a2f8de7aa74..c6fdf82dc95 100644 --- a/multimedia/drm_framework/native_mediakeysession.h +++ b/multimedia/drm_framework/native_mediakeysession.h @@ -217,7 +217,6 @@ Drm_ErrCode OH_MediaKeySession_SetMediaKeySessionCallback(MediaKeySession *media */ Drm_ErrCode OH_MediaKeySession_Destroy(MediaKeySession *mediaKeySessoin); - #ifdef __cplusplus } #endif -- Gitee From 54b73ff6a69bbb2d0497dc08566675b206b2e97f Mon Sep 17 00:00:00 2001 From: qiu-qiu-wang Date: Fri, 8 Mar 2024 09:27:30 +0800 Subject: [PATCH 4/4] remove key request initdata encoding info 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 ef12eb28b36..9b73502b7d8 100644 --- a/multimedia/drm_framework/common/native_drm_common.h +++ b/multimedia/drm_framework/common/native_drm_common.h @@ -251,7 +251,7 @@ typedef struct DRM_MediaKeyRequestInfo { */ int32_t initDataLen; /** - * Initial data format as PSSH after base64 encoding. + * PSSH info. */ uint8_t initData[MAX_INIT_DATA_LEN]; /** -- Gitee