native_cencinfo.h

Overview

The native_cencinfo.h file declares the native APIs used to set decryption parameters.

Library: libnative_media_avcencinfo.so

Since: 12

Related module: Multimedia_Drm

Summary

Structs

Name Description
struct DrmSubsample Describes the subsample type.

Macros

Name Description
DRM_KEY_ID_SIZE 16 The length of the key ID is 16 bytes.
DRM_KEY_IV_SIZE 16 The length of the Initialization Vector (IV) is 16 bytes.
DRM_KEY_MAX_SUB_SAMPLE_NUM 64 The maximum number of subsamples is 64.

Types

Name Description
typedef struct OH_AVBuffer OH_AVBuffer Defines a struct for the audio/video buffer.
typedef struct OH_AVCencInfo OH_AVCencInfo Defines a struct for the audio/video Common Encryption Scheme (CENC) information.
typedef enum DrmCencAlgorithm DrmCencAlgorithm Defines an enum for the DRM CENC algorithm types.
typedef enum DrmCencInfoMode DrmCencInfoMode Defines an enum for the modes for setting the key ID, IV, and subsample information in the CENC information.
typedef struct DrmSubsample DrmSubsample Defines a struct for the subsample type.

Enums

Name Description
DrmCencAlgorithm {
DRM_ALG_CENC_UNENCRYPTED = 0x0, DRM_ALG_CENC_AES_CTR = 0x1,
DRM_ALG_CENC_AES_WV = 0x2, DRM_ALG_CENC_AES_CBC = 0x3,
DRM_ALG_CENC_SM4_CBC = 0x4, DRM_ALG_CENC_SM4_CTR = 0x5
}
Enumerates the DRM CENC algorithm types.
DrmCencInfoMode {
DRM_CENC_INFO_KEY_IV_SUBSAMPLES_SET = 0x0,
DRM_CENC_INFO_KEY_IV_SUBSAMPLES_NOT_SET = 0x1 }
Enumerates the modes for setting the key ID, IV, and subsample information in the CENC information.

Functions

Name Description
OH_AVCencInfo * OH_AVCencInfo_Create () Creates an OH_AVCencInfo instance for setting the CENC information.
OH_AVErrCode OH_AVCencInfo_Destroy (OH_AVCencInfo *cencInfo) Destroys an OH_AVCencInfo instance and clears internal resources.
OH_AVErrCode OH_AVCencInfo_SetAlgorithm (OH_AVCencInfo *cencInfo, enum DrmCencAlgorithm algo) Sets an encryption algorithm of the CENC information.
OH_AVErrCode OH_AVCencInfo_SetKeyIdAndIv (OH_AVCencInfo *cencInfo, uint8_t *keyId, uint32_t keyIdLen, uint8_t *iv, uint32_t ivLen) Sets the key ID and IV in the CENC information.
OH_AVErrCode OH_AVCencInfo_SetSubsampleInfo (OH_AVCencInfo *cencInfo, uint32_t encryptedBlockCount, uint32_t skippedBlockCount, uint32_t firstEncryptedOffset, uint32_t subsampleCount, DrmSubsample *subsamples) Sets the subsample information in the CENC information.
OH_AVErrCode OH_AVCencInfo_SetMode (OH_AVCencInfo *cencInfo, enum DrmCencInfoMode mode) Sets the CENC information mode.
OH_AVErrCode OH_AVCencInfo_SetAVBuffer (OH_AVCencInfo *cencInfo, OH_AVBuffer *buffer) Sets the CENC information to an AVBuffer.