native_mediakeysystem.h

Overview

The native_mediakeysystem.h file declares the MediaKeySystem API. The APIs can be used to check whether a specific DRM scheme is supported, create a media key session, obtain and set DRM configurations, obtain device-specific DRM statistics information, obtain the content protection level, generate provision requests, process responses to these requests, listen for events, and manage offline media keys.

Library: libnative_drm.so

File to include: <multimedia/drm_framework/native_mediakeysystem.h>

System capability: SystemCapability.Multimedia.Drm.Core

Since: 11

Related module: Drm

Summary

Types

Name Description
typedef Drm_ErrCode(* MediaKeySystem_Callback) (DRM_EventType eventType, uint8_t *info, int32_t infoLen, char *extra) Defines the callback that is invoked when a DRM event is triggered. It does not return media key system instances and applies to the scenario where a single media key system is used.
typedef Drm_ErrCode(* OH_MediaKeySystem_Callback) (MediaKeySystem *mediaKeySystem, DRM_EventType eventType, uint8_t *info, int32_t infoLen, char *extra) Defines the callback that is invoked when a DRM event is triggered. It returns media key system instances and applies to the scenario with where media key systems are used.

Functions

Name Description
Drm_ErrCode OH_MediaKeySystem_SetCallback (MediaKeySystem *mediaKeySystem, OH_MediaKeySystem_Callback callback) Sets a media key system event callback.
bool OH_MediaKeySystem_IsSupported (const char *name) Checks whether the device supports the specified DRM scheme.
bool OH_MediaKeySystem_IsSupported2 (const char *name, const char *mimeType) Checks whether the device supports the combination of the DRM scheme and MIME type.
bool OH_MediaKeySystem_IsSupported3 (const char *name, const char *mimeType, DRM_ContentProtectionLevel contentProtectionLevel) Checks whether the device supports the combination of the DRM scheme, MIME type, and content protection level.
Drm_ErrCode OH_MediaKeySystem_GetMediaKeySystems (DRM_MediaKeySystemDescription *infos, uint32_t *count) Obtains the names and UUIDs of the DRM schemes supported by the device.
Drm_ErrCode OH_MediaKeySystem_Create (const char *name, MediaKeySystem **mediaKeySystem) Creates a MediaKeySystem instance based on the DRM scheme name.
Drm_ErrCode OH_MediaKeySystem_SetConfigurationString (MediaKeySystem *mediaKeySystem, const char *configName, const char *value) Sets a configuration item in the form of a string.
Drm_ErrCode OH_MediaKeySystem_GetConfigurationString (MediaKeySystem *mediaKeySystem, const char *configName, char *value, int32_t valueLen) Obtains the value of a configuration item in the form of a string.
Drm_ErrCode OH_MediaKeySystem_SetConfigurationByteArray (MediaKeySystem *mediaKeySystem, const char *configName, uint8_t *value, int32_t valueLen) Sets a configuration item in the form of an array.
Drm_ErrCode OH_MediaKeySystem_GetConfigurationByteArray (MediaKeySystem *mediaKeySystem, const char *configName, uint8_t *value, int32_t *valueLen) Obtains the value of a configuration item in the form of an array.
Drm_ErrCode OH_MediaKeySystem_GetStatistics (MediaKeySystem *mediaKeySystem, DRM_Statistics *statistics) Obtains the statistics information about a media key system.
Drm_ErrCode OH_MediaKeySystem_GetMaxContentProtectionLevel (MediaKeySystem *mediaKeySystem, DRM_ContentProtectionLevel *contentProtectionLevel) Obtains the maximum content protection level supported by the current DRM scheme.
Drm_ErrCode OH_MediaKeySystem_SetMediaKeySystemCallback (MediaKeySystem *mediaKeySystem, MediaKeySystem_Callback callback) Sets a media key system event callback.
Drm_ErrCode OH_MediaKeySystem_CreateMediaKeySession (MediaKeySystem *mediaKeySystem, DRM_ContentProtectionLevel *level, MediaKeySession **mediaKeySession) Creates a MediaKeySession instance.
Drm_ErrCode OH_MediaKeySystem_GenerateKeySystemRequest (MediaKeySystem *mediaKeySystem, uint8_t *request, int32_t *requestLen, char *defaultUrl, int32_t defaultUrlLen) Generates a provision request.
Drm_ErrCode OH_MediaKeySystem_ProcessKeySystemResponse (MediaKeySystem *mediaKeySystem, uint8_t *response, int32_t responseLen) Processes a provision response.
Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyIds (MediaKeySystem *mediaKeySystem, DRM_OfflineMediakeyIdArray *offlineMediaKeyIds) Obtains the IDs of offline media keys.
Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyStatus (MediaKeySystem *mediaKeySystem, uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, DRM_OfflineMediaKeyStatus *status) Obtains the status of an offline media key.
Drm_ErrCode OH_MediaKeySystem_ClearOfflineMediaKeys (MediaKeySystem *mediaKeySystem, uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen) Clears offline media keys.
Drm_ErrCode OH_MediaKeySystem_GetCertificateStatus (MediaKeySystem *mediaKeySystem, DRM_CertificateStatus *certStatus) Obtains the status of a DRM certificate.
Drm_ErrCode OH_MediaKeySystem_Destroy (MediaKeySystem *mediaKeySystem) Destroys a MediaKeySystem instance.