• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @addtogroup HdiDrm
18 * @
19 * @brief Defines APIs of the Drm module.
20 * The Drm module provides APIs for multimedia Drm.
21 * @since 4.1
22 * @version 1.0
23 */
24
25/**
26 * @file MediaKeySystemTypes.idl
27 *
28 * @brief Defines the types used in HdiDrm.
29 * @since 4.1
30 * @version 1.0
31 */
32
33package ohos.hdi.drm.v1_0;
34
35enum ContentProtectionLevel {
36    SECURE_UNKNOWN = 0,
37    SW_SECURE_CRYPTO,
38    HW_SECURE_CRYPTO,
39    HW_ENHANCED_SECURE_CRYPTO,
40    HW_SECURE_MAX,
41};
42
43enum MediaKeyRequestType {
44    MEDIA_KEY_REQUEST_TYPE_UNKNOWN = 0,
45    MEDIA_KEY_REQUEST_TYPE_INITIAL,
46    MEDIA_KEY_REQUEST_TYPE_RENEWAL,
47    MEDIA_KEY_REQUEST_TYPE_RELEASE,
48    MEDIA_KEY_REQUEST_TYPE_NONE,
49    MEDIA_KEY_REQUEST_TYPE_UPDATE,
50};
51
52enum EventType {
53    EVENTTYPE_PROVISIONREQUIRED = 0,
54    EVENTTYPE_KEYREQUIRED,
55    EVENTTYPE_KEYEXPIRED,
56    EVENTTYPE_VENDOR_DEFINED,
57    EVENTTYPE_EXPIRATIONUPDATE,
58    EVENTTYPE_KEYCHANGE,
59};
60
61enum CryptoAlgorithmType {
62    ALGTYPE_UNENCRYPTED = 0,
63    ALGTYPE_AES_CTR,
64    ALGTYPE_AES_WV,
65    ALGTYPE_AES_CBC,
66    ALGTYPE_SM4_CBC,
67    ALGTYPE_SM4_CTR,
68};
69
70enum OfflineMediaKeyStatus {
71    OFFLINE_MEDIA_KEY_STATUS_UNKNOWN = 0,
72    OFFLINE_MEDIA_KEY_STATUS_USABLE,
73    OFFLINE_MEDIA_KEY_STATUS_INACTIVE,
74};
75
76enum MediaKeyType {
77    MEDIA_KEY_TYPE_OFFLINE = 0,
78    MEDIA_KEY_TYPE_ONLINE,
79};
80
81enum CertificateStatus {
82    CERT_STATUS_PROVISIONED = 0,
83    CERT_STATUS_NOT_PROVISIONED,
84    CERT_STATUS_EXPIRED,
85    CERT_STATUS_INVALID,
86    CERT_STATUS_UNAVAILABLE,
87};
88
89enum MediaKeySessionKeyStatus {
90    MEDIA_KEY_SESSION_KEY_STATUS_USABLE = 0,
91    MEDIA_KEY_SESSION_KEY_STATUS_EXPIRED,
92    MEDIA_KEY_SESSION_KEY_STATUS_OUTPUT_NOT_ALLOWED,
93    MEDIA_KEY_SESSION_KEY_STATUS_PENDING,
94    MEDIA_KEY_SESSION_KEY_STATUS_INTERNAL_ERROR,
95    MEDIA_KEY_SESSION_KEY_STATUS_USABLE_IN_FUTURE,
96};
97
98struct MediaKeyRequestInfo {
99    enum MediaKeyType mediaKeyType;
100    String mimeType;
101    unsigned char[] initData;
102    Map<String, String> optionalData;
103};
104
105struct MediaKeyRequest {
106    enum MediaKeyRequestType requestType;
107    unsigned char[] data;
108    String defaultUrl;
109};
110
111struct Pattern {
112    unsigned int encryptBlocks;
113    unsigned int skipBlocks;
114};
115
116struct SubSample {
117    unsigned int clearHeaderLen;
118    unsigned int payLoadLen;
119};
120
121struct CryptoInfo {
122    enum CryptoAlgorithmType type;
123    unsigned char[] keyId;
124    unsigned char[] iv;
125    struct Pattern pattern;
126    struct SubSample[] subSamples;
127};
128
129struct DrmBuffer {
130    unsigned int bufferType;
131    FileDescriptor fd;
132    unsigned int bufferLen;
133    /* Reserved */
134    /* Size of buffer allocated. */
135    unsigned int allocLen;
136    /* Size of buffer filled. */
137    unsigned int filledLen;
138    /* Offset of the vaild data from the buffer start. */
139    unsigned int offset;
140    /* Shared memory type like read/write etc.. */
141    unsigned int sharedMemType;
142};
143