1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
6 /* From private/ppp_content_decryptor_private.idl,
7 * modified Fri Apr 24 13:08:50 2015.
10 #ifndef PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_
11 #define PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_
13 #include "ppapi/c/pp_bool.h"
14 #include "ppapi/c/pp_instance.h"
15 #include "ppapi/c/pp_macros.h"
16 #include "ppapi/c/pp_resource.h"
17 #include "ppapi/c/pp_stdint.h"
18 #include "ppapi/c/pp_var.h"
19 #include "ppapi/c/private/pp_content_decryptor.h"
21 #define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_15 \
22 "PPP_ContentDecryptor_Private;0.15"
23 #define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE \
24 PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_15
28 * This file defines the <code>PPP_ContentDecryptor_Private</code>
29 * interface. Note: This is a special interface, only to be used for Content
30 * Decryption Modules, not normal plugins.
35 * @addtogroup Interfaces
39 * <code>PPP_ContentDecryptor_Private</code> structure contains the function
40 * pointers the decryption plugin must implement to provide services needed by
41 * the browser. This interface provides the plugin side support for the Content
42 * Decryption Module (CDM) for Encrypted Media Extensions:
43 * http://www.w3.org/TR/encrypted-media/
45 struct PPP_ContentDecryptor_Private_0_15
{
47 * Initialize for the specified key system.
49 * @param[in] promise_id A reference for the promise that gets resolved or
50 * rejected depending upon the success or failure of initialization.
52 * @param[in] key_system A <code>PP_Var</code> of type
53 * <code>PP_VARTYPE_STRING</code> containing the name of the key system.
54 * @param[in] allow_distinctive_identifier Inform the CDM that it may use a
55 * distinctive identifier.
56 * @param[in] allow_persistent_state Inform the CDM that it may use persistent
59 void (*Initialize
)(PP_Instance instance
,
61 struct PP_Var key_system
,
62 PP_Bool allow_distinctive_identifier
,
63 PP_Bool allow_persistent_state
);
65 * Provides a server certificate to be used to encrypt messages to the
68 * @param[in] promise_id A reference for the promise that gets resolved or
69 * rejected depending upon the success or failure of setting the certificate.
71 * @param[in] server_certificate A <code>PP_Var</code> of type
72 * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the certificate to be used.
74 void (*SetServerCertificate
)(PP_Instance instance
,
76 struct PP_Var server_certificate
);
78 * Creates a session and subsequently generates a request for a license.
79 * <code>init_data_type</code> contains the MIME type of
80 * <code>init_data</code>. <code>init_data</code> is a data buffer
81 * containing data for use in generating the request.
83 * Note: <code>CreateSessionAndGenerateRequest()</code> must create a
84 * session ID and provide it to the browser via <code>SessionCreated()</code>
85 * on the <code>PPB_ContentDecryptor_Private</code> interface.
87 * @param[in] promise_id A reference for the promise that gets resolved or
88 * rejected depending upon the success or failure when creating the session.
90 * @param[in] session_type A <code>PP_SessionType</code> that indicates the
91 * type of session to be created.
93 * @param[in] init_data_type A <code>PP_InitDataType</code> that indicates
94 * the Initialization Data Type for init_data.
96 * @param[in] init_data A <code>PP_Var</code> of type
97 * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific
98 * initialization data.
100 void (*CreateSessionAndGenerateRequest
)(PP_Instance instance
,
102 PP_SessionType session_type
,
103 PP_InitDataType init_data_type
,
104 struct PP_Var init_data
);
106 * Loads a session whose session ID is <code>session_id</code>.
108 * Note: After the session is successfully loaded, the CDM must call
109 * <code>SessionCreated()</code> with <code>session_id</code> on the
110 * <code>PPB_ContentDecryptor_Private</code> interface.
112 * @param[in] promise_id A reference for the promise that gets resolved or
113 * rejected depending upon the success or failure of loading the session.
115 * @param[in] session_type A <code>PP_SessionType</code> that indicates the
116 * type of session to be loaded.
118 * @param[in] session_id A <code>PP_Var</code> of type
119 * <code>PP_VARTYPE_STRING</code> containing the session ID of the session
122 void (*LoadSession
)(PP_Instance instance
,
124 PP_SessionType session_type
,
125 struct PP_Var session_id
);
127 * Provides a license or other message to the decryptor.
129 * When the CDM needs more information, it must call
130 * <code>SessionMessage()</code> on the
131 * <code>PPB_ContentDecryptor_Private</code> interface, and the browser
132 * must notify the web application. When the CDM has finished processing
133 * <code>response</code> and needs no more information, it must call
134 * <code>SessionReady()</code> on the
135 * <code>PPB_ContentDecryptor_Private</code> interface, and the browser
136 * must notify the web application.
138 * @param[in] promise_id A reference for the promise that gets resolved or
139 * rejected depending upon the success or failure of updating the session.
141 * @param[in] session_id A <code>PP_Var</code> of type
142 * <code>PP_VARTYPE_STRING</code> containing the session ID of the session
145 * @param[in] response A <code>PP_Var</code> of type
146 * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the license or other
147 * message for the given session ID.
149 void (*UpdateSession
)(PP_Instance instance
,
151 struct PP_Var session_id
,
152 struct PP_Var response
);
154 * Close the specified session and related resources.
156 * @param[in] promise_id A reference for the promise that gets resolved or
157 * rejected depending upon the success or failure of closing the session.
159 * @param[in] session_id A <code>PP_Var</code> of type
160 * <code>PP_VARTYPE_STRING</code> containing the session ID of the session
164 void (*CloseSession
)(PP_Instance instance
,
166 struct PP_Var session_id
);
168 * Remove stored data associated with this session.
170 * @param[in] promise_id A reference for the promise that gets resolved or
171 * rejected depending upon the success or failure of removing the session
174 * @param[in] session_id A <code>PP_Var</code> of type
175 * <code>PP_VARTYPE_STRING</code> containing the session ID of the session
179 void (*RemoveSession
)(PP_Instance instance
,
181 struct PP_Var session_id
);
183 * Decrypts the block and returns the unencrypted block via
184 * <code>DeliverBlock()</code> on the
185 * <code>PPB_ContentDecryptor_Private</code> interface. The returned block
186 * contains encoded data.
188 * @param[in] resource A <code>PP_Resource</code> corresponding to a
189 * <code>PPB_Buffer_Dev</code> resource that contains an encrypted data
192 * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
193 * contains all auxiliary information needed for decryption of the
194 * <code>encrypted_block</code>.
196 void (*Decrypt
)(PP_Instance instance
,
197 PP_Resource encrypted_block
,
198 const struct PP_EncryptedBlockInfo
* encrypted_block_info
);
200 * Initializes the audio decoder using codec and settings in
201 * <code>decoder_config</code>, and returns the result of the initialization
202 * request to the browser using the <code>DecoderInitializeDone(
204 * on the <code>PPB_ContentDecryptor_Private</code> interface.
206 * @param[in] decoder_config A <code>PP_AudioDecoderConfig</code> that
207 * contains audio decoder settings and a request ID. The request ID is passed
208 * to the <code>DecoderInitializeDone()</code> method on the
209 * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to
210 * associate the result with a audio decoder initialization request.
212 * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a
213 * <code>PPB_Buffer_Dev</code> resource containing codec setup data required
214 * by some codecs. It should be set to 0 when the codec being initialized
215 * does not require it.
217 void (*InitializeAudioDecoder
)(
218 PP_Instance instance
,
219 const struct PP_AudioDecoderConfig
* decoder_config
,
220 PP_Resource codec_extra_data
);
222 * Initializes the video decoder using codec and settings in
223 * <code>decoder_config</code>, and returns the result of the initialization
224 * request to the browser using the <code>DecoderInitializeDone()</code>
225 * method on the <code>PPB_ContentDecryptor_Private</code> interface.
227 * @param[in] decoder_config A <code>PP_VideoDecoderConfig</code> that
228 * contains video decoder settings and a request ID. The request ID is passed
229 * to the <code>DecoderInitializeDone()</code> method on the
230 * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to
231 * associate the result with a video decoder initialization request.
233 * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a
234 * <code>PPB_Buffer_Dev</code> resource containing codec setup data required
235 * by some codecs. It should be set to 0 when the codec being initialized
236 * does not require it.
238 void (*InitializeVideoDecoder
)(
239 PP_Instance instance
,
240 const struct PP_VideoDecoderConfig
* decoder_config
,
241 PP_Resource codec_extra_data
);
243 * De-initializes the decoder for the <code>PP_DecryptorStreamType</code>
244 * specified by <code>decoder_type</code> and sets it to an uninitialized
245 * state. The decoder can be re-initialized after de-initialization completes
246 * by calling <code>InitializeAudioDecoder</code> or
247 * <code>InitializeVideoDecoder</code>.
249 * De-initialization completion is reported to the browser using the
250 * <code>DecoderDeinitializeDone()</code> method on the
251 * <code>PPB_ContentDecryptor_Private</code> interface.
253 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
254 * specifies the decoder to de-initialize.
256 * @param[in] request_id A request ID that allows the browser to associate a
257 * request to de-initialize a decoder with the corresponding call to the
258 * <code>DecoderDeinitializeDone()</code> method on the
259 * <code>PPB_ContentDecryptor_Private</code> interface.
261 void (*DeinitializeDecoder
)(PP_Instance instance
,
262 PP_DecryptorStreamType decoder_type
,
263 uint32_t request_id
);
265 * Resets the decoder for the <code>PP_DecryptorStreamType</code> specified
266 * by <code>decoder_type</code> to an initialized clean state. Reset
267 * completion is reported to the browser using the
268 * <code>DecoderResetDone()</code> method on the
269 * <code>PPB_ContentDecryptor_Private</code> interface. This method can be
270 * used to signal a discontinuity in the encoded data stream, and is safe to
271 * call multiple times.
273 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
274 * specifies the decoder to reset.
276 * @param[in] request_id A request ID that allows the browser to associate a
277 * request to reset the decoder with a corresponding call to the
278 * <code>DecoderResetDone()</code> method on the
279 * <code>PPB_ContentDecryptor_Private</code> interface.
281 void (*ResetDecoder
)(PP_Instance instance
,
282 PP_DecryptorStreamType decoder_type
,
283 uint32_t request_id
);
285 * Decrypts encrypted_buffer, decodes it, and returns the unencrypted
286 * uncompressed (decoded) data to the browser via the
287 * <code>DeliverFrame()</code> or <code>DeliverSamples()</code> method on the
288 * <code>PPB_ContentDecryptor_Private</code> interface.
290 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
291 * specifies the decoder to use after <code>encrypted_buffer</code> is
294 * @param[in] encrypted_buffer A <code>PP_Resource</code> corresponding to a
295 * <code>PPB_Buffer_Dev</code> resource that contains encrypted media data.
297 * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
298 * contains all auxiliary information needed for decryption of the
299 * <code>encrypted_block</code>.
301 void (*DecryptAndDecode
)(
302 PP_Instance instance
,
303 PP_DecryptorStreamType decoder_type
,
304 PP_Resource encrypted_buffer
,
305 const struct PP_EncryptedBlockInfo
* encrypted_block_info
);
308 typedef struct PPP_ContentDecryptor_Private_0_15 PPP_ContentDecryptor_Private
;
313 #endif /* PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ */