1# native_drm_common.h 2 3## Overview 4 5The file declares the DRM data types. 6 7**File to include**: <multimedia/drm_framework/native_drm_common.h> 8 9**Library**: libnative_drm.z.so 10 11**System capability**: SystemCapability.Multimedia.Drm.Core 12 13**Since**: 11 14 15**Related module**: [Drm](capi-drm.md) 16 17## Summary 18 19### Structs 20 21| Name| typedef Keyword| Description| 22| -- | -- | -- | 23| [DRM_MediaKeyRequestInfo](capi-drm-drm-mediakeyrequestinfo.md) | DRM_MediaKeyRequestInfo | Describes the information about a media key request.| 24| [DRM_MediaKeyRequest](capi-drm-drm-mediakeyrequest.md) | DRM_MediaKeyRequest | Describes a media key request.| 25| [DRM_Statistics](capi-drm-drm-statistics.md) | DRM_Statistics | Describes the statistical information of a media key system.| 26| [DRM_OfflineMediakeyIdArray](capi-drm-drm-offlinemediakeyidarray.md) | DRM_OfflineMediakeyIdArray | Describes an array holding the IDs of offline media keys.| 27| [DRM_KeysInfo](capi-drm-drm-keysinfo.md) | DRM_KeysInfo | Describes the information about media keys.| 28| [DRM_MediaKeyStatus](capi-drm-drm-mediakeystatus.md) | DRM_MediaKeyStatus | Describes the media key status.| 29| [DRM_PsshInfo](capi-drm-drm-psshinfo.md) | DRM_PsshInfo | Describes the Protection System Specific Header (PSSH) in DRM information.| 30| [DRM_MediaKeySystemInfo](capi-drm-drm-mediakeysysteminfo.md) | DRM_MediaKeySystemInfo | Describes the DRM information, which is used to encrypt content.| 31| [DRM_MediaKeySystemDescription](capi-drm-drm-mediakeysystemdescription.md) | DRM_MediaKeySystemDescription | Describes the DRM solution name and UUID list.| 32| [MediaKeySystem](capi-drm-mediakeysystem.md) | MediaKeySystem | Describes the media key system.| 33| [MediaKeySession](capi-drm-mediakeysession.md) | MediaKeySession | Describes the media key session. | 34 35### Enums 36 37| Name| typedef Keyword| Description| 38| -- | -- | -- | 39| [DRM_EventType](#drm_eventtype) | DRM_EventType | Enumerates the types of events that can be subscribed to.| 40| [DRM_ContentProtectionLevel](#drm_contentprotectionlevel) | DRM_ContentProtectionLevel | Enumerates the content protection levels.| 41| [DRM_MediaKeyType](#drm_mediakeytype) | DRM_MediaKeyType | Enumerates the types of media keys.| 42| [DRM_MediaKeyRequestType](#drm_mediakeyrequesttype) | DRM_MediaKeyRequestType | Enumerates the types of media key requests.| 43| [DRM_OfflineMediaKeyStatus](#drm_offlinemediakeystatus) | DRM_OfflineMediaKeyStatus | Enumerates the statuses of offline media keys.| 44| [DRM_CertificateStatus](#drm_certificatestatus) | DRM_CertificateStatus | Enumerates the DRM certificate statuses.| 45 46### Functions 47 48| Name| typedef Keyword| Description| 49| -- | -- | -- | 50| [typedef void (\*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo *mediaKeySystemInfo)](#drm_mediakeysysteminfocallback) | DRM_MediaKeySystemInfoCallback | Defines the callback used to obtain DRM information from a media source.| 51 52### Macros 53 54| Name| Description| 55| -- | -- | 56| MAX_MEDIA_KEY_REQUEST_OPTION_COUNT 16 | Maximum number of optional data items in a media key request.<br>**Since**: 11| 57| MAX_MEDIA_KEY_REQUEST_OPTION_NAME_LEN 64 | Maximum length of an optional data name in a media key request.<br>**Since**: 11| 58| MAX_MEDIA_KEY_REQUEST_OPTION_DATA_LEN 128 | Maximum length of optional data in a media key request.<br>**Since**: 11| 59| MAX_INIT_DATA_LEN 2048 | Maximum length of data in an initial request.<br>**Since**: 11| 60| MAX_MIMETYPE_LEN 64 | Maximum length of a MIME type.<br>**Since**: 11| 61| MAX_MEDIA_KEY_REQUEST_DATA_LEN 8192 | Maximum length of data in a media key request.<br>**Since**: 11| 62| MAX_DEFAULT_URL_LEN 2048 | Maximum length of a URL.<br>**Since**: 11| 63| MAX_STATISTICS_COUNT 10 | Maximum number of statistical items.<br>**Since**: 11| 64| MAX_STATISTICS_NAME_LEN 64 | Maximum length of a statistical item name.<br>**Since**: 11| 65| MAX_STATISTICS_BUFFER_LEN 256 | Maximum length of a statistical item buffer.<br>**Since**: 11| 66| MAX_OFFLINE_MEDIA_KEY_ID_COUNT 512 | Maximum number of offline media key IDs.<br>**Since**: 11| 67| MAX_OFFLINE_MEDIA_KEY_ID_LEN 64 | Maximum length of an offline media key ID.<br>**Since**: 11| 68| MAX_KEY_INFO_COUNT 64 | Maximum number of pieces of media key information.<br>**Since**: 11| 69| MAX_KEY_ID_LEN 16 | Maximum length of a media key ID.<br>**Since**: 11| 70| MAX_KEY_STATUS_VALUE_LEN 128 | Maximum length of a key status value.<br>**Since**: 11| 71| MAX_MEDIA_KEY_STATUS_COUNT 64 | Maximum number of media key statuses.<br>**Since**: 11| 72| MAX_MEDIA_KEY_STATUS_NAME_LEN 64 | Maximum length of a media key status name.<br>**Since**: 11| 73| MAX_MEDIA_KEY_STATUS_VALUE_LEN 256 | Maximum length of a media key status value.<br>**Since**: 11| 74| DRM_UUID_LEN 16 | Length of the UUID of a DRM solution.<br>**Since**: 11| 75| MAX_PSSH_DATA_LEN 2048 | Maximum length of PSSH data.<br>**Since**: 11| 76| MAX_PSSH_INFO_COUNT 8 | Maximum number of pieces of PSSH data.<br>**Since**: 11| 77| MAX_MEDIA_KEY_SYSTEM_NAME_LEN 128 | Maximum length of a MediaKeySystem instance name.<br>**Since**: 12| 78| MAX_MEDIA_KEY_SYSTEM_NUM 8 | Maximum number of MediaKeySystem instances.<br>**Since**: 12| 79 80## Enum Description 81 82### DRM_EventType 83 84``` 85enum DRM_EventType 86``` 87 88**Description** 89 90Enumerates the types of events that can be subscribed to. 91 92**Since**: 11 93 94| Enum Item| Description| 95| -- | -- | 96| EVENT_DRM_BASE = 200 | DRM event.| 97| EVENT_PROVISION_REQUIRED = 201 | Event indicating that the application needs to request a device certificate.| 98| EVENT_KEY_REQUIRED = 202 | Event indicating that the application needs to request a media key.| 99| EVENT_KEY_EXPIRED = 203 | Event indicating that the media key expires.| 100| EVENT_VENDOR_DEFINED = 204 | Vendor-defined event.| 101| EVENT_EXPIRATION_UPDATE = 206 | Event indicating that the media key updates on expiry.| 102 103### DRM_ContentProtectionLevel 104 105``` 106enum DRM_ContentProtectionLevel 107``` 108 109**Description** 110 111Enumerates the content protection levels. 112 113**System capability**: SystemCapability.Multimedia.Drm.Core 114 115**Since**: 11 116 117| Enum Item| Description| 118| -- | -- | 119| CONTENT_PROTECTION_LEVEL_UNKNOWN = 0 | Unknown level.| 120| CONTENT_PROTECTION_LEVEL_SW_CRYPTO | Software content protection level.| 121| CONTENT_PROTECTION_LEVEL_HW_CRYPTO | Hardware content protection level.| 122| CONTENT_PROTECTION_LEVEL_ENHANCED_HW_CRYPTO | Hardware enhancement level.| 123| CONTENT_PROTECTION_LEVEL_MAX | Highest content protection level.| 124 125### DRM_MediaKeyType 126 127``` 128enum DRM_MediaKeyType 129``` 130 131**Description** 132 133Enumerates the types of media keys. 134 135**System capability**: SystemCapability.Multimedia.Drm.Core 136 137**Since**: 11 138 139| Enum Item| Description| 140| -- | -- | 141| MEDIA_KEY_TYPE_OFFLINE = 0 | Offline.| 142| MEDIA_KEY_TYPE_ONLINE | Online.| 143 144### DRM_MediaKeyRequestType 145 146``` 147enum DRM_MediaKeyRequestType 148``` 149 150**Description** 151 152Enumerates the types of media key requests. 153 154**System capability**: SystemCapability.Multimedia.Drm.Core 155 156**Since**: 11 157 158| Enum Item| Description| 159| -- | -- | 160| MEDIA_KEY_REQUEST_TYPE_UNKNOWN = 0 | Unknown type.| 161| MEDIA_KEY_REQUEST_TYPE_INITIAL | Initial request.| 162| MEDIA_KEY_REQUEST_TYPE_RENEWAL | Renewal request.| 163| MEDIA_KEY_REQUEST_TYPE_RELEASE | Release request.| 164| MEDIA_KEY_REQUEST_TYPE_NONE | None.| 165| MEDIA_KEY_REQUEST_TYPE_UPDATE | Update request.| 166 167### DRM_OfflineMediaKeyStatus 168 169``` 170enum DRM_OfflineMediaKeyStatus 171``` 172 173**Description** 174 175Enumerates the statuses of offline media keys. 176 177**System capability**: SystemCapability.Multimedia.Drm.Core 178 179**Since**: 11 180 181| Enum Item| Description| 182| -- | -- | 183| OFFLINE_MEDIA_KEY_STATUS_UNKNOWN = 0 | Unknown status.| 184| OFFLINE_MEDIA_KEY_STATUS_USABLE | The media key is available.| 185| OFFLINE_MEDIA_KEY_STATUS_INACTIVE | The media key is inactive.| 186 187### DRM_CertificateStatus 188 189``` 190enum DRM_CertificateStatus 191``` 192 193**Description** 194 195Enumerates the DRM certificate statuses. 196 197**System capability**: SystemCapability.Multimedia.Drm.Core 198 199**Since**: 11 200 201| Enum Item| Description| 202| -- | -- | 203| CERT_STATUS_PROVISIONED = 0 | A DRM certificate has been installed on the device.| 204| CERT_STATUS_NOT_PROVISIONED | No device certificate is installed on the device or the certificate status is abnormal.| 205| CERT_STATUS_EXPIRED | The DRM certificate has expired.| 206| CERT_STATUS_INVALID | The DRM certificate is invalid.| 207| CERT_STATUS_UNAVAILABLE | The DRM certificate is unavailable.| 208 209 210## Function Description 211 212### DRM_MediaKeySystemInfoCallback() 213 214``` 215typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo *mediaKeySystemInfo) 216``` 217 218**Description** 219 220Defines the callback used to obtain DRM information from a media source. 221 222**Since**: 11 223 224 225**Parameters** 226 227| Name| Description| 228| -- | -- | 229| [DRM_MediaKeySystemInfo](capi-drm-drm-mediakeysysteminfo.md) *mediaKeySystemInfo | Pointer to the DRM information obtained from the media source.| 230