diff --git a/multimedia/drm_framework/common/native_drm_common.h b/multimedia/drm_framework/common/native_drm_common.h index f634ebf107c8caa6ed9df0889225151b20797389..9b73502b7d86502d7488cace43e4fcd591cdf93c 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]; /** @@ -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 999aa04e1f36e8364863d01a41f88b92d5c3ee40..c6fdf82dc951a943284c1c40900b5ff60e6c596a 100644 --- a/multimedia/drm_framework/native_mediakeysession.h +++ b/multimedia/drm_framework/native_mediakeysession.h @@ -221,4 +221,4 @@ Drm_ErrCode OH_MediaKeySession_Destroy(MediaKeySession *mediaKeySessoin); } #endif -#endif // OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H \ No newline at end of file +#endif // OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H