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 May 1 10:36:31 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 * Creates a session. <code>init_data_type</code> contains the MIME type of
55 * <code>init_data</code>. <code>init_data</code> is a data buffer
56 * containing data for use in generating the request.
58 * Note: <code>CreateSession()</code> must create a web session ID and provide
59 * it to the browser via <code>SessionCreated()</code> on the
60 * <code>PPB_ContentDecryptor_Private</code> interface.
62 * @param[in] promise_id A reference for the promise that gets resolved or
63 * rejected depending upon the success or failure when creating the session.
65 * @param[in] init_data_type A <code>PP_Var</code> of type
66 * <code>PP_VARTYPE_STRING</code> containing the MIME type for init_data.
68 * @param[in] init_data A <code>PP_Var</code> of type
69 * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific
70 * initialization data.
72 * @param[in] session_type A <code>PP_SessionType</code> that indicates the
73 * type of session to be created.
75 void (*CreateSession
)(PP_Instance instance
,
77 struct PP_Var init_data_type
,
78 struct PP_Var init_data
,
79 PP_SessionType session_type
);
81 * Loads a session whose web session ID is <code>web_session_id</code>.
83 * Note: After the session is successfully loaded, the CDM must call
84 * <code>SessionCreated()</code> with <code>web_session_id</code> on the
85 * <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 of loading the session.
90 * @param[in] web_session_id A <code>PP_Var</code> of type
91 * <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
94 void (*LoadSession
)(PP_Instance instance
,
96 struct PP_Var web_session_id
);
98 * Provides a license or other message to the decryptor.
100 * When the CDM needs more information, it must call
101 * <code>SessionMessage()</code> on the
102 * <code>PPB_ContentDecryptor_Private</code> interface, and the browser
103 * must notify the web application. When the CDM has finished processing
104 * <code>response</code> and needs no more information, it must call
105 * <code>SessionReady()</code> on the
106 * <code>PPB_ContentDecryptor_Private</code> interface, and the browser
107 * must notify the web application.
109 * @param[in] promise_id A reference for the promise that gets resolved or
110 * rejected depending upon the success or failure of updating the session.
112 * @param[in] web_session_id A <code>PP_Var</code> of type
113 * <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
116 * @param[in] response A <code>PP_Var</code> of type
117 * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the license or other
118 * message for the given session ID.
120 void (*UpdateSession
)(PP_Instance instance
,
122 struct PP_Var web_session_id
,
123 struct PP_Var response
);
125 * Release the specified session and related resources.
127 * @param[in] promise_id A reference for the promise that gets resolved or
128 * rejected depending upon the success or failure of releasing the session.
130 * @param[in] web_session_id A <code>PP_Var</code> of type
131 * <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
135 void (*ReleaseSession
)(PP_Instance instance
,
137 struct PP_Var web_session_id
);
139 * Decrypts the block and returns the unencrypted block via
140 * <code>DeliverBlock()</code> on the
141 * <code>PPB_ContentDecryptor_Private</code> interface. The returned block
142 * contains encoded data.
144 * @param[in] resource A <code>PP_Resource</code> corresponding to a
145 * <code>PPB_Buffer_Dev</code> resource that contains an encrypted data
148 * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
149 * contains all auxiliary information needed for decryption of the
150 * <code>encrypted_block</code>.
152 void (*Decrypt
)(PP_Instance instance
,
153 PP_Resource encrypted_block
,
154 const struct PP_EncryptedBlockInfo
* encrypted_block_info
);
156 * Initializes the audio decoder using codec and settings in
157 * <code>decoder_config</code>, and returns the result of the initialization
158 * request to the browser using the <code>DecoderInitializeDone(
160 * on the <code>PPB_ContentDecryptor_Private</code> interface.
162 * @param[in] decoder_config A <code>PP_AudioDecoderConfig</code> that
163 * contains audio decoder settings and a request ID. The request ID is passed
164 * to the <code>DecoderInitializeDone()</code> method on the
165 * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to
166 * associate the result with a audio decoder initialization request.
168 * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a
169 * <code>PPB_Buffer_Dev</code> resource containing codec setup data required
170 * by some codecs. It should be set to 0 when the codec being initialized
171 * does not require it.
173 void (*InitializeAudioDecoder
)(
174 PP_Instance instance
,
175 const struct PP_AudioDecoderConfig
* decoder_config
,
176 PP_Resource codec_extra_data
);
178 * Initializes the video decoder using codec and settings in
179 * <code>decoder_config</code>, and returns the result of the initialization
180 * request to the browser using the <code>DecoderInitializeDone()</code>
181 * method on the <code>PPB_ContentDecryptor_Private</code> interface.
183 * @param[in] decoder_config A <code>PP_VideoDecoderConfig</code> that
184 * contains video decoder settings and a request ID. The request ID is passed
185 * to the <code>DecoderInitializeDone()</code> method on the
186 * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to
187 * associate the result with a video decoder initialization request.
189 * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a
190 * <code>PPB_Buffer_Dev</code> resource containing codec setup data required
191 * by some codecs. It should be set to 0 when the codec being initialized
192 * does not require it.
194 void (*InitializeVideoDecoder
)(
195 PP_Instance instance
,
196 const struct PP_VideoDecoderConfig
* decoder_config
,
197 PP_Resource codec_extra_data
);
199 * De-initializes the decoder for the <code>PP_DecryptorStreamType</code>
200 * specified by <code>decoder_type</code> and sets it to an uninitialized
201 * state. The decoder can be re-initialized after de-initialization completes
202 * by calling <code>InitializeAudioDecoder</code> or
203 * <code>InitializeVideoDecoder</code>.
205 * De-initialization completion is reported to the browser using the
206 * <code>DecoderDeinitializeDone()</code> method on the
207 * <code>PPB_ContentDecryptor_Private</code> interface.
209 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
210 * specifies the decoder to de-initialize.
212 * @param[in] request_id A request ID that allows the browser to associate a
213 * request to de-initialize a decoder with the corresponding call to the
214 * <code>DecoderDeinitializeDone()</code> method on the
215 * <code>PPB_ContentDecryptor_Private</code> interface.
217 void (*DeinitializeDecoder
)(PP_Instance instance
,
218 PP_DecryptorStreamType decoder_type
,
219 uint32_t request_id
);
221 * Resets the decoder for the <code>PP_DecryptorStreamType</code> specified
222 * by <code>decoder_type</code> to an initialized clean state. Reset
223 * completion is reported to the browser using the
224 * <code>DecoderResetDone()</code> method on the
225 * <code>PPB_ContentDecryptor_Private</code> interface. This method can be
226 * used to signal a discontinuity in the encoded data stream, and is safe to
227 * call multiple times.
229 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
230 * specifies the decoder to reset.
232 * @param[in] request_id A request ID that allows the browser to associate a
233 * request to reset the decoder with a corresponding call to the
234 * <code>DecoderResetDone()</code> method on the
235 * <code>PPB_ContentDecryptor_Private</code> interface.
237 void (*ResetDecoder
)(PP_Instance instance
,
238 PP_DecryptorStreamType decoder_type
,
239 uint32_t request_id
);
241 * Decrypts encrypted_buffer, decodes it, and returns the unencrypted
242 * uncompressed (decoded) data to the browser via the
243 * <code>DeliverFrame()</code> or <code>DeliverSamples()</code> method on the
244 * <code>PPB_ContentDecryptor_Private</code> interface.
246 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
247 * specifies the decoder to use after <code>encrypted_buffer</code> is
250 * @param[in] encrypted_buffer A <code>PP_Resource</code> corresponding to a
251 * <code>PPB_Buffer_Dev</code> resource that contains encrypted media data.
253 * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
254 * contains all auxiliary information needed for decryption of the
255 * <code>encrypted_block</code>.
257 void (*DecryptAndDecode
)(
258 PP_Instance instance
,
259 PP_DecryptorStreamType decoder_type
,
260 PP_Resource encrypted_buffer
,
261 const struct PP_EncryptedBlockInfo
* encrypted_block_info
);
264 typedef struct PPP_ContentDecryptor_Private_0_12 PPP_ContentDecryptor_Private
;
269 #endif /* PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ */