Pepper_47_C_interfaces
ppb_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/ppb_content_decryptor_private.idl,
7  * modified Thu Oct 20 13:57:04 2016.
8  */
9 
10 #ifndef PPAPI_C_PRIVATE_PPB_CONTENT_DECRYPTOR_PRIVATE_H_
11 #define PPAPI_C_PRIVATE_PPB_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_time.h"
19 #include "ppapi/c/pp_var.h"
21 
22 #define PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_14 \
23  "PPB_ContentDecryptor_Private;0.14"
24 #define PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE \
25  PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_14
26 
27 /**
28  * @file
29  * This file defines the <code>PPB_ContentDecryptor_Private</code>
30  * interface. Note: This is a special interface, only to be used for Content
31  * Decryption Modules, not normal plugins.
32  */
33 
34 
35 /**
36  * @addtogroup Interfaces
37  * @{
38  */
39 /**
40  * <code>PPB_ContentDecryptor_Private</code> structure contains the function
41  * pointers the browser must implement to support plugins implementing the
42  * <code>PPP_ContentDecryptor_Private</code> interface. This interface provides
43  * browser side support for the Content Decryption Module (CDM) for Encrypted
44  * Media Extensions: http://www.w3.org/TR/encrypted-media/
45  */
47  /**
48  * A promise has been resolved by the CDM.
49  *
50  * @param[in] promise_id Identifies the promise that the CDM resolved.
51  */
52  void (*PromiseResolved)(PP_Instance instance, uint32_t promise_id);
53  /**
54  * A promise that resulted in a new session has been resolved by the CDM.
55  *
56  * @param[in] promise_id Identifies the promise that the CDM resolved.
57  *
58  * @param[in] session_id A <code>PP_Var</code> of type
59  * <code>PP_VARTYPE_STRING</code> containing the session's ID attribute.
60  */
62  uint32_t promise_id,
63  struct PP_Var session_id);
64  /**
65  * A promise has been rejected by the CDM due to an error.
66  *
67  * @param[in] promise_id Identifies the promise that the CDM rejected.
68  *
69  * @param[in] exception_code A <code>PP_CdmExceptionCode</code> containing
70  * the exception code.
71  *
72  * @param[in] system_code A system error code.
73  *
74  * @param[in] error_description A <code>PP_Var</code> of type
75  * <code>PP_VARTYPE_STRING</code> containing the error description.
76  */
77  void (*PromiseRejected)(PP_Instance instance,
78  uint32_t promise_id,
79  PP_CdmExceptionCode exception_code,
80  uint32_t system_code,
81  struct PP_Var error_description);
82  /**
83  * A message or request has been generated for key_system in the CDM, and
84  * must be sent to the web application.
85  *
86  * For example, when the browser invokes <code>CreateSession()</code>
87  * on the <code>PPP_ContentDecryptor_Private</code> interface, the plugin
88  * must send a message containing the license request.
89  *
90  * Note that <code>SessionMessage()</code> can be used for purposes other than
91  * responses to <code>CreateSession()</code> calls. See also the text
92  * in the comment for <code>SessionReady()</code>, which describes a sequence
93  * of <code>UpdateSession()</code> and <code>SessionMessage()</code> calls
94  * required to prepare for decryption.
95  *
96  * @param[in] session_id A <code>PP_Var</code> of type
97  * <code>PP_VARTYPE_STRING</code> containing the ID of a session for
98  * which this message is intended.
99  *
100  * @param[in] message_type A <code>PP_CdmMessageType</code> containing the
101  * message type.
102  *
103  * @param[in] message A <code>PP_Var</code> of type
104  * <code>PP_VARTYPE_ARRAY_BUFFER</code> that contains the message.
105  *
106  * @param[in] legacy_destination_url A <code>PP_Var</code> of type
107  * <code>PP_VARTYPE_STRING</code> containing the destination URL for the
108  * message.
109  */
110  void (*SessionMessage)(PP_Instance instance,
111  struct PP_Var session_id,
112  PP_CdmMessageType message_type,
113  struct PP_Var message,
114  struct PP_Var legacy_destination_url);
115  /**
116  * The keys for a session have changed.
117  *
118  * @param[in] session_id A <code>PP_Var</code> of type
119  * <code>PP_VARTYPE_STRING</code> containing the ID of the session that has
120  * a change in keys.
121  *
122  * @param[in] has_additional_usable_key A <code>PP_Bool</code> indicating if
123  * a new usable key has been added.
124  *
125  * @param[in] key_count The number of arguments contained in
126  * <code>key_information</code>
127  *
128  * @param[in] key_information An array of type <code>PP_KeyInformation</code>
129  * that are the session's key IDs and their status.
130  */
131  void (*SessionKeysChange)(PP_Instance instance,
132  struct PP_Var session_id,
133  PP_Bool has_additional_usable_key,
134  uint32_t key_count,
135  const struct PP_KeyInformation key_information[]);
136  /**
137  * The expiration time for a session has changed.
138  *
139  * @param[in] session_id A <code>PP_Var</code> of type
140  * <code>PP_VARTYPE_STRING</code> containing the ID of the session that has
141  * a new expiration time.
142  *
143  * @param[in] new_expiry_time A <code>PP_Time</code> indicating the new
144  * expiry time of the session. The value is defined as the number of seconds
145  * since the Epoch (00:00:00 UTC, January 1, 1970).
146  */
148  struct PP_Var session_id,
149  PP_Time new_expiry_time);
150  /**
151  * The session has been closed as the result of a call to the
152  * <code>ReleaseSession()</code> method on the
153  * <code>PPP_ContentDecryptor_Private</code> interface, or due to other
154  * factors as determined by the CDM.
155  *
156  * @param[in] session_id A <code>PP_Var</code> of type
157  * <code>PP_VARTYPE_STRING</code> containing the session's ID attribute of
158  * the session that is now closed.
159  */
160  void (*SessionClosed)(PP_Instance instance, struct PP_Var session_id);
161  /**
162  * An error occurred in a <code>PPP_ContentDecryptor_Private</code> method,
163  * or within the plugin implementing the interface.
164  *
165  * @param[in] session_id A <code>PP_Var</code> of type
166  * <code>PP_VARTYPE_STRING</code> containing the session's ID attribute of
167  * the session that caused the error.
168  *
169  * @param[in] exception_code A <code>PP_CdmExceptionCode</code> containing
170  * the exception code.
171  *
172  * @param[in] system_code A system error code.
173  *
174  * @param[in] error_description A <code>PP_Var</code> of type
175  * <code>PP_VARTYPE_STRING</code> containing the error description.
176  */
177  void (*LegacySessionError)(PP_Instance instance,
178  struct PP_Var session_id,
179  PP_CdmExceptionCode exception_code,
180  uint32_t system_code,
181  struct PP_Var error_description);
182  /**
183  * Called after the <code>Decrypt()</code> method on the
184  * <code>PPP_ContentDecryptor_Private</code> interface completes to
185  * deliver decrypted_block to the browser for decoding and rendering.
186  *
187  * The plugin must not hold a reference to the encrypted buffer resource
188  * provided to <code>Decrypt()</code> when it calls this method. The browser
189  * will reuse the buffer in a subsequent <code>Decrypt()</code> call.
190  *
191  * @param[in] decrypted_block A <code>PP_Resource</code> corresponding to a
192  * <code>PPB_Buffer_Dev</code> resource that contains a decrypted data
193  * block.
194  *
195  * @param[in] decrypted_block_info A <code>PP_DecryptedBlockInfo</code> that
196  * contains the result code and tracking info associated with the
197  * <code>decrypted_block</code>.
198  */
199  void (*DeliverBlock)(
200  PP_Instance instance,
201  PP_Resource decrypted_block,
202  const struct PP_DecryptedBlockInfo* decrypted_block_info);
203  /**
204  * Called after the <code>InitializeAudioDecoder()</code> or
205  * <code>InitializeVideoDecoder()</code> method on the
206  * <code>PPP_ContentDecryptor_Private</code> interface completes to report
207  * decoder initialization status to the browser.
208  *
209  * @param[in] success A <code>PP_Bool</code> that is set to
210  * <code>PP_TRUE</code> when the decoder initialization request associated
211  * with <code>request_id</code> was successful.
212  *
213  * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> identifying
214  * the decoder type for which this initialization status response was sent.
215  *
216  * @param[in] request_id The <code>request_id</code> value passed to
217  * <code>InitializeAudioDecoder</code> or <code>InitializeVideoDecoder</code>
218  * in <code>PP_AudioDecoderConfig</code> or
219  * <code>PP_VideoDecoderConfig</code>.
220  */
222  PP_DecryptorStreamType decoder_type,
223  uint32_t request_id,
224  PP_Bool success);
225  /**
226  * Called after the <code>DeinitializeDecoder()</code> method on the
227  * <code>PPP_ContentDecryptor_Private</code> interface completes to report
228  * decoder de-initialization completion to the browser.
229  *
230  * @param[in] decoder_type The <code>PP_DecryptorStreamType</code> passed to
231  * <code>DeinitializeDecoder()</code>.
232  *
233  * @param[in] request_id The <code>request_id</code> value passed to
234  * <code>DeinitializeDecoder()</code>.
235  */
237  PP_DecryptorStreamType decoder_type,
238  uint32_t request_id);
239  /**
240  * Called after the <code>ResetDecoder()</code> method on the
241  * <code>PPP_ContentDecryptor_Private</code> interface completes to report
242  * decoder reset completion to the browser.
243  *
244  * @param[in] decoder_type The <code>PP_DecryptorStreamType</code> passed to
245  * <code>ResetDecoder()</code>.
246  *
247  * @param[in] request_id The <code>request_id</code> value passed to
248  * <code>ResetDecoder()</code>.
249  */
250  void (*DecoderResetDone)(PP_Instance instance,
251  PP_DecryptorStreamType decoder_type,
252  uint32_t request_id);
253  /**
254  * Called after the <code>DecryptAndDecode()</code> method on the
255  * <code>PPP_ContentDecryptor_Private</code> interface completes to deliver
256  * a decrypted and decoded video frame to the browser for rendering.
257  *
258  * The plugin must not hold a reference to the encrypted buffer resource
259  * provided to <code>DecryptAndDecode()</code> when it calls this method. The
260  * browser will reuse the buffer in a subsequent
261  * <code>DecryptAndDecode()</code> call.
262  *
263  * @param[in] decrypted_frame A <code>PP_Resource</code> corresponding to a
264  * <code>PPB_Buffer_Dev</code> resource that contains a video frame.
265  *
266  * @param[in] decrypted_frame_info A <code>PP_DecryptedFrameInfo</code> that
267  * contains the result code, tracking info, and buffer format associated with
268  * <code>decrypted_frame</code>.
269  */
270  void (*DeliverFrame)(
271  PP_Instance instance,
272  PP_Resource decrypted_frame,
273  const struct PP_DecryptedFrameInfo* decrypted_frame_info);
274  /**
275  * Called after the <code>DecryptAndDecode()</code> method on the
276  * <code>PPP_ContentDecryptor_Private</code> interface completes to deliver
277  * a buffer of decrypted and decoded audio samples to the browser for
278  * rendering.
279  *
280  * The plugin must not hold a reference to the encrypted buffer resource
281  * provided to <code>DecryptAndDecode()</code> when it calls this method. The
282  * browser will reuse the buffer in a subsequent
283  * <code>DecryptAndDecode()</code> call.
284  *
285  * <code>audio_frames</code> can contain multiple audio output buffers. Each
286  * buffer is serialized in this format:
287  *
288  * |<------------------- serialized audio buffer ------------------->|
289  * | int64_t timestamp | int64_t length | length bytes of audio data |
290  *
291  * For example, with three audio output buffers, |audio_frames| will look
292  * like this:
293  *
294  * |<---------------- audio_frames ------------------>|
295  * | audio buffer 0 | audio buffer 1 | audio buffer 2 |
296  *
297  * @param[in] audio_frames A <code>PP_Resource</code> corresponding to a
298  * <code>PPB_Buffer_Dev</code> resource that contains a decrypted buffer
299  * of decoded audio samples.
300  *
301  * @param[in] decrypted_sample_info A <code>PP_DecryptedSampleInfo</code> that
302  * contains the tracking info and result code associated with the decrypted
303  * samples.
304  */
305  void (*DeliverSamples)(
306  PP_Instance instance,
307  PP_Resource audio_frames,
308  const struct PP_DecryptedSampleInfo* decrypted_sample_info);
309 };
310 
312 /**
313  * @}
314  */
315 
316 #endif /* PPAPI_C_PRIVATE_PPB_CONTENT_DECRYPTOR_PRIVATE_H_ */
317 
double PP_Time
Definition: pp_time.h:29
PP_DecryptorStreamType
void(* PromiseResolved)(PP_Instance instance, uint32_t promise_id)
void(* DeliverFrame)(PP_Instance instance, PP_Resource decrypted_frame, const struct PP_DecryptedFrameInfo *decrypted_frame_info)
void(* PromiseRejected)(PP_Instance instance, uint32_t promise_id, PP_CdmExceptionCode exception_code, uint32_t system_code, struct PP_Var error_description)
void(* DecoderInitializeDone)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success)
void(* SessionMessage)(PP_Instance instance, struct PP_Var session_id, PP_CdmMessageType message_type, struct PP_Var message, struct PP_Var legacy_destination_url)
PP_CdmExceptionCode
int32_t PP_Resource
Definition: pp_resource.h:40
void(* PromiseResolvedWithSession)(PP_Instance instance, uint32_t promise_id, struct PP_Var session_id)
void(* DeliverSamples)(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedSampleInfo *decrypted_sample_info)
void(* SessionKeysChange)(PP_Instance instance, struct PP_Var session_id, PP_Bool has_additional_usable_key, uint32_t key_count, const struct PP_KeyInformation key_information[])
PP_CdmMessageType
void(* LegacySessionError)(PP_Instance instance, struct PP_Var session_id, PP_CdmExceptionCode exception_code, uint32_t system_code, struct PP_Var error_description)
void(* DecoderResetDone)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id)
Definition: pp_var.h:166
int32_t PP_Instance
Definition: pp_instance.h:34
void(* SessionExpirationChange)(PP_Instance instance, struct PP_Var session_id, PP_Time new_expiry_time)
PP_Bool
Definition: pp_bool.h:30
void(* SessionClosed)(PP_Instance instance, struct PP_Var session_id)
void(* DecoderDeinitializeDone)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id)
void(* DeliverBlock)(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo *decrypted_block_info)