Pepper_47_C_interfaces
ppp_content_decryptor_private.h
Go to the documentation of this file.
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.
4  */
5 
6 /* From private/ppp_content_decryptor_private.idl,
7  * modified Thu Oct 20 13:57:04 2016.
8  */
9 
10 #ifndef PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_
11 #define PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_
12 
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"
20 
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
25 
26 /**
27  * @file
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.
31  */
32 
33 
34 /**
35  * @addtogroup Interfaces
36  * @{
37  */
38 /**
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/
44  */
46  /**
47  * Initialize for the specified key system.
48  *
49  * @param[in] promise_id A reference for the promise that gets resolved or
50  * rejected depending upon the success or failure of initialization.
51  *
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
57  * state.
58  */
59  void (*Initialize)(PP_Instance instance,
60  uint32_t promise_id,
61  struct PP_Var key_system,
62  PP_Bool allow_distinctive_identifier,
63  PP_Bool allow_persistent_state);
64  /**
65  * Provides a server certificate to be used to encrypt messages to the
66  * license server.
67  *
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.
70  *
71  * @param[in] server_certificate A <code>PP_Var</code> of type
72  * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the certificate to be used.
73  */
75  uint32_t promise_id,
76  struct PP_Var server_certificate);
77  /**
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.
82  *
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.
86  *
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.
89  *
90  * @param[in] session_type A <code>PP_SessionType</code> that indicates the
91  * type of session to be created.
92  *
93  * @param[in] init_data_type A <code>PP_InitDataType</code> that indicates
94  * the Initialization Data Type for init_data.
95  *
96  * @param[in] init_data A <code>PP_Var</code> of type
97  * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific
98  * initialization data.
99  */
101  uint32_t promise_id,
102  PP_SessionType session_type,
103  PP_InitDataType init_data_type,
104  struct PP_Var init_data);
105  /**
106  * Loads a session whose session ID is <code>session_id</code>.
107  *
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.
111  *
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.
114  *
115  * @param[in] session_type A <code>PP_SessionType</code> that indicates the
116  * type of session to be loaded.
117  *
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
120  * to load.
121  */
122  void (*LoadSession)(PP_Instance instance,
123  uint32_t promise_id,
124  PP_SessionType session_type,
125  struct PP_Var session_id);
126  /**
127  * Provides a license or other message to the decryptor.
128  *
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.
137  *
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.
140  *
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
143  * to be updated.
144  *
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.
148  */
149  void (*UpdateSession)(PP_Instance instance,
150  uint32_t promise_id,
151  struct PP_Var session_id,
152  struct PP_Var response);
153  /**
154  * Close the specified session and related resources.
155  *
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.
158  *
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
161  * to be closed.
162  *
163  */
164  void (*CloseSession)(PP_Instance instance,
165  uint32_t promise_id,
166  struct PP_Var session_id);
167  /**
168  * Remove stored data associated with this session.
169  *
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
172  * data.
173  *
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
176  * to be removed.
177  *
178  */
179  void (*RemoveSession)(PP_Instance instance,
180  uint32_t promise_id,
181  struct PP_Var session_id);
182  /**
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.
187  *
188  * @param[in] resource A <code>PP_Resource</code> corresponding to a
189  * <code>PPB_Buffer_Dev</code> resource that contains an encrypted data
190  * block.
191  *
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>.
195  */
196  void (*Decrypt)(PP_Instance instance,
197  PP_Resource encrypted_block,
198  const struct PP_EncryptedBlockInfo* encrypted_block_info);
199  /**
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(
203  )</code> method
204  * on the <code>PPB_ContentDecryptor_Private</code> interface.
205  *
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.
211  *
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.
216  */
218  PP_Instance instance,
219  const struct PP_AudioDecoderConfig* decoder_config,
220  PP_Resource codec_extra_data);
221  /**
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.
226  *
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.
232  *
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.
237  */
239  PP_Instance instance,
240  const struct PP_VideoDecoderConfig* decoder_config,
241  PP_Resource codec_extra_data);
242  /**
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>.
248  *
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.
252  *
253  * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
254  * specifies the decoder to de-initialize.
255  *
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.
260  */
262  PP_DecryptorStreamType decoder_type,
263  uint32_t request_id);
264  /**
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.
272  *
273  * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
274  * specifies the decoder to reset.
275  *
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.
280  */
281  void (*ResetDecoder)(PP_Instance instance,
282  PP_DecryptorStreamType decoder_type,
283  uint32_t request_id);
284  /**
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.
289  *
290  * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
291  * specifies the decoder to use after <code>encrypted_buffer</code> is
292  * decrypted.
293  *
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.
296  *
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>.
300  */
302  PP_Instance instance,
303  PP_DecryptorStreamType decoder_type,
304  PP_Resource encrypted_buffer,
305  const struct PP_EncryptedBlockInfo* encrypted_block_info);
306 };
307 
309 /**
310  * @}
311  */
312 
313 #endif /* PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ */
314 
void(* DecryptAndDecode)(PP_Instance instance, PP_DecryptorStreamType decoder_type, PP_Resource encrypted_buffer, const struct PP_EncryptedBlockInfo *encrypted_block_info)
PP_DecryptorStreamType
void(* LoadSession)(PP_Instance instance, uint32_t promise_id, PP_SessionType session_type, struct PP_Var session_id)
void(* DeinitializeDecoder)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id)
void(* RemoveSession)(PP_Instance instance, uint32_t promise_id, struct PP_Var session_id)
int32_t PP_Resource
Definition: pp_resource.h:40
void(* UpdateSession)(PP_Instance instance, uint32_t promise_id, struct PP_Var session_id, struct PP_Var response)
void(* InitializeAudioDecoder)(PP_Instance instance, const struct PP_AudioDecoderConfig *decoder_config, PP_Resource codec_extra_data)
void(* InitializeVideoDecoder)(PP_Instance instance, const struct PP_VideoDecoderConfig *decoder_config, PP_Resource codec_extra_data)
void(* CloseSession)(PP_Instance instance, uint32_t promise_id, struct PP_Var session_id)
void(* SetServerCertificate)(PP_Instance instance, uint32_t promise_id, struct PP_Var server_certificate)
Definition: pp_var.h:166
int32_t PP_Instance
Definition: pp_instance.h:34
PP_Bool
Definition: pp_bool.h:30
void(* Initialize)(PP_Instance instance, uint32_t promise_id, struct PP_Var key_system, PP_Bool allow_distinctive_identifier, PP_Bool allow_persistent_state)
void(* CreateSessionAndGenerateRequest)(PP_Instance instance, uint32_t promise_id, PP_SessionType session_type, PP_InitDataType init_data_type, struct PP_Var init_data)
void(* Decrypt)(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo *encrypted_block_info)
void(* ResetDecoder)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id)