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 Thu Mar 19 16:02:53 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_14 \
22 "PPP_ContentDecryptor_Private;0.14"
23 #define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE \
24 PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_14
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_14
{
47 * Initialize for the specified key system.
49 * @param[in] key_system A <code>PP_Var</code> of type
50 * <code>PP_VARTYPE_STRING</code> containing the name of the key system.
51 * @param[in] allow_distinctive_identifier Inform the CDM that it may use a
52 * distinctive identifier.
53 * @param[in] allow_persistent_state Inform the CDM that it may use persistent
56 void (*Initialize
)(PP_Instance instance
,
57 struct PP_Var key_system
,
58 PP_Bool allow_distinctive_identifier
,
59 PP_Bool allow_persistent_state
);
61 * Provides a server certificate to be used to encrypt messages to the
64 * @param[in] promise_id A reference for the promise that gets resolved or
65 * rejected depending upon the success or failure of setting the certificate.
67 * @param[in] server_certificate A <code>PP_Var</code> of type
68 * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the certificate to be used.
70 void (*SetServerCertificate
)(PP_Instance instance
,
72 struct PP_Var server_certificate
);
74 * Creates a session and subsequently generates a request for a license.
75 * <code>init_data_type</code> contains the MIME type of
76 * <code>init_data</code>. <code>init_data</code> is a data buffer
77 * containing data for use in generating the request.
79 * Note: <code>CreateSessionAndGenerateRequest()</code> must create a
80 * session ID and provide it to the browser via <code>SessionCreated()</code>
81 * on the <code>PPB_ContentDecryptor_Private</code> interface.
83 * @param[in] promise_id A reference for the promise that gets resolved or
84 * rejected depending upon the success or failure when creating the session.
86 * @param[in] session_type A <code>PP_SessionType</code> that indicates the
87 * type of session to be created.
89 * @param[in] init_data_type A <code>PP_InitDataType</code> that indicates
90 * the Initialization Data Type for init_data.
92 * @param[in] init_data A <code>PP_Var</code> of type
93 * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific
94 * initialization data.
96 void (*CreateSessionAndGenerateRequest
)(PP_Instance instance
,
98 PP_SessionType session_type
,
99 PP_InitDataType init_data_type
,
100 struct PP_Var init_data
);
102 * Loads a session whose session ID is <code>session_id</code>.
104 * Note: After the session is successfully loaded, the CDM must call
105 * <code>SessionCreated()</code> with <code>session_id</code> on the
106 * <code>PPB_ContentDecryptor_Private</code> interface.
108 * @param[in] promise_id A reference for the promise that gets resolved or
109 * rejected depending upon the success or failure of loading the session.
111 * @param[in] session_type A <code>PP_SessionType</code> that indicates the
112 * type of session to be loaded.
114 * @param[in] session_id A <code>PP_Var</code> of type
115 * <code>PP_VARTYPE_STRING</code> containing the session ID of the session
118 void (*LoadSession
)(PP_Instance instance
,
120 PP_SessionType session_type
,
121 struct PP_Var session_id
);
123 * Provides a license or other message to the decryptor.
125 * When the CDM needs more information, it must call
126 * <code>SessionMessage()</code> on the
127 * <code>PPB_ContentDecryptor_Private</code> interface, and the browser
128 * must notify the web application. When the CDM has finished processing
129 * <code>response</code> and needs no more information, it must call
130 * <code>SessionReady()</code> on the
131 * <code>PPB_ContentDecryptor_Private</code> interface, and the browser
132 * must notify the web application.
134 * @param[in] promise_id A reference for the promise that gets resolved or
135 * rejected depending upon the success or failure of updating the session.
137 * @param[in] session_id A <code>PP_Var</code> of type
138 * <code>PP_VARTYPE_STRING</code> containing the session ID of the session
141 * @param[in] response A <code>PP_Var</code> of type
142 * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the license or other
143 * message for the given session ID.
145 void (*UpdateSession
)(PP_Instance instance
,
147 struct PP_Var session_id
,
148 struct PP_Var response
);
150 * Close the specified session and related resources.
152 * @param[in] promise_id A reference for the promise that gets resolved or
153 * rejected depending upon the success or failure of closing the session.
155 * @param[in] session_id A <code>PP_Var</code> of type
156 * <code>PP_VARTYPE_STRING</code> containing the session ID of the session
160 void (*CloseSession
)(PP_Instance instance
,
162 struct PP_Var session_id
);
164 * Remove stored data associated with this session.
166 * @param[in] promise_id A reference for the promise that gets resolved or
167 * rejected depending upon the success or failure of removing the session
170 * @param[in] session_id A <code>PP_Var</code> of type
171 * <code>PP_VARTYPE_STRING</code> containing the session ID of the session
175 void (*RemoveSession
)(PP_Instance instance
,
177 struct PP_Var session_id
);
179 * Decrypts the block and returns the unencrypted block via
180 * <code>DeliverBlock()</code> on the
181 * <code>PPB_ContentDecryptor_Private</code> interface. The returned block
182 * contains encoded data.
184 * @param[in] resource A <code>PP_Resource</code> corresponding to a
185 * <code>PPB_Buffer_Dev</code> resource that contains an encrypted data
188 * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
189 * contains all auxiliary information needed for decryption of the
190 * <code>encrypted_block</code>.
192 void (*Decrypt
)(PP_Instance instance
,
193 PP_Resource encrypted_block
,
194 const struct PP_EncryptedBlockInfo
* encrypted_block_info
);
196 * Initializes the audio decoder using codec and settings in
197 * <code>decoder_config</code>, and returns the result of the initialization
198 * request to the browser using the <code>DecoderInitializeDone(
200 * on the <code>PPB_ContentDecryptor_Private</code> interface.
202 * @param[in] decoder_config A <code>PP_AudioDecoderConfig</code> that
203 * contains audio decoder settings and a request ID. The request ID is passed
204 * to the <code>DecoderInitializeDone()</code> method on the
205 * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to
206 * associate the result with a audio decoder initialization request.
208 * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a
209 * <code>PPB_Buffer_Dev</code> resource containing codec setup data required
210 * by some codecs. It should be set to 0 when the codec being initialized
211 * does not require it.
213 void (*InitializeAudioDecoder
)(
214 PP_Instance instance
,
215 const struct PP_AudioDecoderConfig
* decoder_config
,
216 PP_Resource codec_extra_data
);
218 * Initializes the video decoder using codec and settings in
219 * <code>decoder_config</code>, and returns the result of the initialization
220 * request to the browser using the <code>DecoderInitializeDone()</code>
221 * method on the <code>PPB_ContentDecryptor_Private</code> interface.
223 * @param[in] decoder_config A <code>PP_VideoDecoderConfig</code> that
224 * contains video decoder settings and a request ID. The request ID is passed
225 * to the <code>DecoderInitializeDone()</code> method on the
226 * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to
227 * associate the result with a video decoder initialization request.
229 * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a
230 * <code>PPB_Buffer_Dev</code> resource containing codec setup data required
231 * by some codecs. It should be set to 0 when the codec being initialized
232 * does not require it.
234 void (*InitializeVideoDecoder
)(
235 PP_Instance instance
,
236 const struct PP_VideoDecoderConfig
* decoder_config
,
237 PP_Resource codec_extra_data
);
239 * De-initializes the decoder for the <code>PP_DecryptorStreamType</code>
240 * specified by <code>decoder_type</code> and sets it to an uninitialized
241 * state. The decoder can be re-initialized after de-initialization completes
242 * by calling <code>InitializeAudioDecoder</code> or
243 * <code>InitializeVideoDecoder</code>.
245 * De-initialization completion is reported to the browser using the
246 * <code>DecoderDeinitializeDone()</code> method on the
247 * <code>PPB_ContentDecryptor_Private</code> interface.
249 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
250 * specifies the decoder to de-initialize.
252 * @param[in] request_id A request ID that allows the browser to associate a
253 * request to de-initialize a decoder with the corresponding call to the
254 * <code>DecoderDeinitializeDone()</code> method on the
255 * <code>PPB_ContentDecryptor_Private</code> interface.
257 void (*DeinitializeDecoder
)(PP_Instance instance
,
258 PP_DecryptorStreamType decoder_type
,
259 uint32_t request_id
);
261 * Resets the decoder for the <code>PP_DecryptorStreamType</code> specified
262 * by <code>decoder_type</code> to an initialized clean state. Reset
263 * completion is reported to the browser using the
264 * <code>DecoderResetDone()</code> method on the
265 * <code>PPB_ContentDecryptor_Private</code> interface. This method can be
266 * used to signal a discontinuity in the encoded data stream, and is safe to
267 * call multiple times.
269 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
270 * specifies the decoder to reset.
272 * @param[in] request_id A request ID that allows the browser to associate a
273 * request to reset the decoder with a corresponding call to the
274 * <code>DecoderResetDone()</code> method on the
275 * <code>PPB_ContentDecryptor_Private</code> interface.
277 void (*ResetDecoder
)(PP_Instance instance
,
278 PP_DecryptorStreamType decoder_type
,
279 uint32_t request_id
);
281 * Decrypts encrypted_buffer, decodes it, and returns the unencrypted
282 * uncompressed (decoded) data to the browser via the
283 * <code>DeliverFrame()</code> or <code>DeliverSamples()</code> method on the
284 * <code>PPB_ContentDecryptor_Private</code> interface.
286 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
287 * specifies the decoder to use after <code>encrypted_buffer</code> is
290 * @param[in] encrypted_buffer A <code>PP_Resource</code> corresponding to a
291 * <code>PPB_Buffer_Dev</code> resource that contains encrypted media data.
293 * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
294 * contains all auxiliary information needed for decryption of the
295 * <code>encrypted_block</code>.
297 void (*DecryptAndDecode
)(
298 PP_Instance instance
,
299 PP_DecryptorStreamType decoder_type
,
300 PP_Resource encrypted_buffer
,
301 const struct PP_EncryptedBlockInfo
* encrypted_block_info
);
304 typedef struct PPP_ContentDecryptor_Private_0_14 PPP_ContentDecryptor_Private
;
309 #endif /* PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ */