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 Mon Aug 25 14:02:40 2014.
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_12 \
22 "PPP_ContentDecryptor_Private;0.12"
23 #define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE \
24 PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_12
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_12 {
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.
52 void (*Initialize)(PP_Instance instance, struct PP_Var key_system);
54 * Provides a server certificate to be used to encrypt messages to the
57 * @param[in] promise_id A reference for the promise that gets resolved or
58 * rejected depending upon the success or failure of setting the certificate.
60 * @param[in] server_certificate A <code>PP_Var</code> of type
61 * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the certificate to be used.
63 void (*SetServerCertificate)(PP_Instance instance,
65 struct PP_Var server_certificate);
67 * Creates a session. <code>init_data_type</code> contains the MIME type of
68 * <code>init_data</code>. <code>init_data</code> is a data buffer
69 * containing data for use in generating the request.
71 * Note: <code>CreateSession()</code> must create a web session ID and provide
72 * it to the browser via <code>SessionCreated()</code> on the
73 * <code>PPB_ContentDecryptor_Private</code> interface.
75 * @param[in] promise_id A reference for the promise that gets resolved or
76 * rejected depending upon the success or failure when creating the session.
78 * @param[in] init_data_type A <code>PP_Var</code> of type
79 * <code>PP_VARTYPE_STRING</code> containing the MIME type for init_data.
81 * @param[in] init_data A <code>PP_Var</code> of type
82 * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific
83 * initialization data.
85 * @param[in] session_type A <code>PP_SessionType</code> that indicates the
86 * type of session to be created.
88 void (*CreateSession)(PP_Instance instance,
90 struct PP_Var init_data_type,
91 struct PP_Var init_data,
92 PP_SessionType session_type);
94 * Loads a session whose web session ID is <code>web_session_id</code>.
96 * Note: After the session is successfully loaded, the CDM must call
97 * <code>SessionCreated()</code> with <code>web_session_id</code> on the
98 * <code>PPB_ContentDecryptor_Private</code> interface.
100 * @param[in] promise_id A reference for the promise that gets resolved or
101 * rejected depending upon the success or failure of loading the session.
103 * @param[in] web_session_id A <code>PP_Var</code> of type
104 * <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
107 void (*LoadSession)(PP_Instance instance,
109 struct PP_Var web_session_id);
111 * Provides a license or other message to the decryptor.
113 * When the CDM needs more information, it must call
114 * <code>SessionMessage()</code> on the
115 * <code>PPB_ContentDecryptor_Private</code> interface, and the browser
116 * must notify the web application. When the CDM has finished processing
117 * <code>response</code> and needs no more information, it must call
118 * <code>SessionReady()</code> on the
119 * <code>PPB_ContentDecryptor_Private</code> interface, and the browser
120 * must notify the web application.
122 * @param[in] promise_id A reference for the promise that gets resolved or
123 * rejected depending upon the success or failure of updating the session.
125 * @param[in] web_session_id A <code>PP_Var</code> of type
126 * <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
129 * @param[in] response A <code>PP_Var</code> of type
130 * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the license or other
131 * message for the given session ID.
133 void (*UpdateSession)(PP_Instance instance,
135 struct PP_Var web_session_id,
136 struct PP_Var response);
138 * Close the specified session and related resources.
140 * @param[in] promise_id A reference for the promise that gets resolved or
141 * rejected depending upon the success or failure of closing the session.
143 * @param[in] web_session_id A <code>PP_Var</code> of type
144 * <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
148 void (*CloseSession)(PP_Instance instance,
150 struct PP_Var web_session_id);
152 * Remove stored data associated with this session.
154 * @param[in] promise_id A reference for the promise that gets resolved or
155 * rejected depending upon the success or failure of removing the session
158 * @param[in] web_session_id A <code>PP_Var</code> of type
159 * <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
163 void (*RemoveSession)(PP_Instance instance,
165 struct PP_Var web_session_id);
167 * Get the key IDs for keys in the session that the CDM knows are currently
168 * usable to decrypt media data.
170 * @param[in] promise_id A reference for the promise that gets resolved or
171 * rejected depending upon the success or failure of obtaining the key IDs.
173 * @param[in] web_session_id A <code>PP_Var</code> of type
174 * <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
178 void (*GetUsableKeyIds)(PP_Instance instance,
180 struct PP_Var web_session_id);
182 * Decrypts the block and returns the unencrypted block via
183 * <code>DeliverBlock()</code> on the
184 * <code>PPB_ContentDecryptor_Private</code> interface. The returned block
185 * contains encoded data.
187 * @param[in] resource A <code>PP_Resource</code> corresponding to a
188 * <code>PPB_Buffer_Dev</code> resource that contains an encrypted data
191 * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
192 * contains all auxiliary information needed for decryption of the
193 * <code>encrypted_block</code>.
195 void (*Decrypt)(PP_Instance instance,
196 PP_Resource encrypted_block,
197 const struct PP_EncryptedBlockInfo* encrypted_block_info);
199 * Initializes the audio decoder using codec and settings in
200 * <code>decoder_config</code>, and returns the result of the initialization
201 * request to the browser using the <code>DecoderInitializeDone(
203 * on the <code>PPB_ContentDecryptor_Private</code> interface.
205 * @param[in] decoder_config A <code>PP_AudioDecoderConfig</code> that
206 * contains audio decoder settings and a request ID. The request ID is passed
207 * to the <code>DecoderInitializeDone()</code> method on the
208 * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to
209 * associate the result with a audio decoder initialization request.
211 * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a
212 * <code>PPB_Buffer_Dev</code> resource containing codec setup data required
213 * by some codecs. It should be set to 0 when the codec being initialized
214 * does not require it.
216 void (*InitializeAudioDecoder)(
217 PP_Instance instance,
218 const struct PP_AudioDecoderConfig* decoder_config,
219 PP_Resource codec_extra_data);
221 * Initializes the video decoder using codec and settings in
222 * <code>decoder_config</code>, and returns the result of the initialization
223 * request to the browser using the <code>DecoderInitializeDone()</code>
224 * method on the <code>PPB_ContentDecryptor_Private</code> interface.
226 * @param[in] decoder_config A <code>PP_VideoDecoderConfig</code> that
227 * contains video decoder settings and a request ID. The request ID is passed
228 * to the <code>DecoderInitializeDone()</code> method on the
229 * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to
230 * associate the result with a video decoder initialization request.
232 * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a
233 * <code>PPB_Buffer_Dev</code> resource containing codec setup data required
234 * by some codecs. It should be set to 0 when the codec being initialized
235 * does not require it.
237 void (*InitializeVideoDecoder)(
238 PP_Instance instance,
239 const struct PP_VideoDecoderConfig* decoder_config,
240 PP_Resource codec_extra_data);
242 * De-initializes the decoder for the <code>PP_DecryptorStreamType</code>
243 * specified by <code>decoder_type</code> and sets it to an uninitialized
244 * state. The decoder can be re-initialized after de-initialization completes
245 * by calling <code>InitializeAudioDecoder</code> or
246 * <code>InitializeVideoDecoder</code>.
248 * De-initialization completion is reported to the browser using the
249 * <code>DecoderDeinitializeDone()</code> method on the
250 * <code>PPB_ContentDecryptor_Private</code> interface.
252 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
253 * specifies the decoder to de-initialize.
255 * @param[in] request_id A request ID that allows the browser to associate a
256 * request to de-initialize a decoder with the corresponding call to the
257 * <code>DecoderDeinitializeDone()</code> method on the
258 * <code>PPB_ContentDecryptor_Private</code> interface.
260 void (*DeinitializeDecoder)(PP_Instance instance,
261 PP_DecryptorStreamType decoder_type,
262 uint32_t request_id);
264 * Resets the decoder for the <code>PP_DecryptorStreamType</code> specified
265 * by <code>decoder_type</code> to an initialized clean state. Reset
266 * completion is reported to the browser using the
267 * <code>DecoderResetDone()</code> method on the
268 * <code>PPB_ContentDecryptor_Private</code> interface. This method can be
269 * used to signal a discontinuity in the encoded data stream, and is safe to
270 * call multiple times.
272 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
273 * specifies the decoder to reset.
275 * @param[in] request_id A request ID that allows the browser to associate a
276 * request to reset the decoder with a corresponding call to the
277 * <code>DecoderResetDone()</code> method on the
278 * <code>PPB_ContentDecryptor_Private</code> interface.
280 void (*ResetDecoder)(PP_Instance instance,
281 PP_DecryptorStreamType decoder_type,
282 uint32_t request_id);
284 * Decrypts encrypted_buffer, decodes it, and returns the unencrypted
285 * uncompressed (decoded) data to the browser via the
286 * <code>DeliverFrame()</code> or <code>DeliverSamples()</code> method on the
287 * <code>PPB_ContentDecryptor_Private</code> interface.
289 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
290 * specifies the decoder to use after <code>encrypted_buffer</code> is
293 * @param[in] encrypted_buffer A <code>PP_Resource</code> corresponding to a
294 * <code>PPB_Buffer_Dev</code> resource that contains encrypted media data.
296 * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
297 * contains all auxiliary information needed for decryption of the
298 * <code>encrypted_block</code>.
300 void (*DecryptAndDecode)(
301 PP_Instance instance,
302 PP_DecryptorStreamType decoder_type,
303 PP_Resource encrypted_buffer,
304 const struct PP_EncryptedBlockInfo* encrypted_block_info);
307 typedef struct PPP_ContentDecryptor_Private_0_12 PPP_ContentDecryptor_Private;
312 #endif /* PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ */