• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 Tue Dec  3 17:05:10 2013.
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"
19 #include "ppapi/c/private/pp_content_decryptor.h"
20 
21 #define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_9 \
22     "PPP_ContentDecryptor_Private;0.9"
23 #define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE \
24     PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_9
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  */
45 struct PPP_ContentDecryptor_Private_0_9 {
46   /**
47    * Initialize for the specified key system.
48    *
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    */
52   void (*Initialize)(PP_Instance instance, struct PP_Var key_system);
53   /**
54    * Creates a session. <code>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.
57    *
58    * Note: <code>CreateSession()</code> must create the session ID used in
59    * other methods on this interface. The session ID must be provided to the
60    * browser by the CDM via <code>SessionCreated()</code> on the
61    * <code>PPB_ContentDecryptor_Private</code> interface.
62    *
63    * @param[in] session_id A reference for the session for which a session
64    * should be generated.
65    *
66    * @param[in] type A <code>PP_Var</code> of type
67    * <code>PP_VARTYPE_STRING</code> containing the MIME type for init_data.
68    *
69    * @param[in] init_data A <code>PP_Var</code> of type
70    * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific
71    * initialization data.
72    */
73   void (*CreateSession)(PP_Instance instance,
74                         uint32_t session_id,
75                         struct PP_Var type,
76                         struct PP_Var init_data);
77   /**
78    * Provides a license or other message to the decryptor.
79    *
80    * When the CDM needs more information, it must call
81    * <code>SessionMessage()</code> on the
82    * <code>PPB_ContentDecryptor_Private</code> interface, and the browser
83    * must notify the web application. When the CDM has finished processing
84    * <code>response</code> and needs no more information, it must call
85    * <code>SessionReady()</code> on the
86    * <code>PPB_ContentDecryptor_Private</code> interface, and the browser
87    * must notify the web application.
88    *
89    * @param[in] session_id A reference for the session to update.
90    *
91    * @param[in] response A <code>PP_Var</code> of type
92    * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the license or other
93    * message for the given session ID.
94    */
95   void (*UpdateSession)(PP_Instance instance,
96                         uint32_t session_id,
97                         struct PP_Var response);
98   /**
99    * Release the specified session and related resources.
100    *
101    * @param[in] session_id A reference for the session that should be
102    * released.
103    */
104   void (*ReleaseSession)(PP_Instance instance, uint32_t session_id);
105   /**
106    * Decrypts the block and returns the unencrypted block via
107    * <code>DeliverBlock()</code> on the
108    * <code>PPB_ContentDecryptor_Private</code> interface. The returned block
109    * contains encoded data.
110    *
111    * @param[in] resource A <code>PP_Resource</code> corresponding to a
112    * <code>PPB_Buffer_Dev</code> resource that contains an encrypted data
113    * block.
114    *
115    * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
116    * contains all auxiliary information needed for decryption of the
117    * <code>encrypted_block</code>.
118    */
119   void (*Decrypt)(PP_Instance instance,
120                   PP_Resource encrypted_block,
121                   const struct PP_EncryptedBlockInfo* encrypted_block_info);
122   /**
123    * Initializes the audio decoder using codec and settings in
124    * <code>decoder_config</code>, and returns the result of the initialization
125    * request to the browser using the <code>DecoderInitializeDone(
126       )</code> method
127    * on the <code>PPB_ContentDecryptor_Private</code> interface.
128    *
129    * @param[in] decoder_config A <code>PP_AudioDecoderConfig</code> that
130    * contains audio decoder settings and a request ID. The request ID is passed
131    * to the <code>DecoderInitializeDone()</code> method on the
132    * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to
133    * associate the result with a audio decoder initialization request.
134    *
135    * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a
136    * <code>PPB_Buffer_Dev</code> resource containing codec setup data required
137    * by some codecs. It should be set to 0 when the codec being initialized
138    * does not require it.
139    */
140   void (*InitializeAudioDecoder)(
141       PP_Instance instance,
142       const struct PP_AudioDecoderConfig* decoder_config,
143       PP_Resource codec_extra_data);
144   /**
145    * Initializes the video decoder using codec and settings in
146    * <code>decoder_config</code>, and returns the result of the initialization
147    * request to the browser using the <code>DecoderInitializeDone()</code>
148    * method on the <code>PPB_ContentDecryptor_Private</code> interface.
149    *
150    * @param[in] decoder_config A <code>PP_VideoDecoderConfig</code> that
151    * contains video decoder settings and a request ID. The request ID is passed
152    * to the <code>DecoderInitializeDone()</code> method on the
153    * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to
154    * associate the result with a video decoder initialization request.
155    *
156    * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a
157    * <code>PPB_Buffer_Dev</code> resource containing codec setup data required
158    * by some codecs. It should be set to 0 when the codec being initialized
159    * does not require it.
160    */
161   void (*InitializeVideoDecoder)(
162       PP_Instance instance,
163       const struct PP_VideoDecoderConfig* decoder_config,
164       PP_Resource codec_extra_data);
165   /**
166    * De-initializes the decoder for the <code>PP_DecryptorStreamType</code>
167    * specified by <code>decoder_type</code> and sets it to an uninitialized
168    * state. The decoder can be re-initialized after de-initialization completes
169    * by calling <code>InitializeAudioDecoder</code> or
170    * <code>InitializeVideoDecoder</code>.
171    *
172    * De-initialization completion is reported to the browser using the
173    * <code>DecoderDeinitializeDone()</code> method on the
174    * <code>PPB_ContentDecryptor_Private</code> interface.
175    *
176    * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
177    * specifies the decoder to de-initialize.
178    *
179    * @param[in] request_id A request ID that allows the browser to associate a
180    * request to de-initialize a decoder with the corresponding call to the
181    * <code>DecoderDeinitializeDone()</code> method on the
182    * <code>PPB_ContentDecryptor_Private</code> interface.
183    */
184   void (*DeinitializeDecoder)(PP_Instance instance,
185                               PP_DecryptorStreamType decoder_type,
186                               uint32_t request_id);
187   /**
188    * Resets the decoder for the <code>PP_DecryptorStreamType</code> specified
189    * by <code>decoder_type</code> to an initialized clean state. Reset
190    * completion is reported to the browser using the
191    * <code>DecoderResetDone()</code> method on the
192    * <code>PPB_ContentDecryptor_Private</code> interface. This method can be
193    * used to signal a discontinuity in the encoded data stream, and is safe to
194    * call multiple times.
195    *
196    * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
197    * specifies the decoder to reset.
198    *
199    * @param[in] request_id A request ID that allows the browser to associate a
200    * request to reset the decoder with a corresponding call to the
201    * <code>DecoderResetDone()</code> method on the
202    * <code>PPB_ContentDecryptor_Private</code> interface.
203    */
204   void (*ResetDecoder)(PP_Instance instance,
205                        PP_DecryptorStreamType decoder_type,
206                        uint32_t request_id);
207   /**
208    * Decrypts encrypted_buffer, decodes it, and returns the unencrypted
209    * uncompressed (decoded) data to the browser via the
210    * <code>DeliverFrame()</code> or <code>DeliverSamples()</code> method on the
211    * <code>PPB_ContentDecryptor_Private</code> interface.
212    *
213    * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
214    * specifies the decoder to use after <code>encrypted_buffer</code> is
215    * decrypted.
216    *
217    * @param[in] encrypted_buffer A <code>PP_Resource</code> corresponding to a
218    * <code>PPB_Buffer_Dev</code> resource that contains encrypted media data.
219    *
220    * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
221    * contains all auxiliary information needed for decryption of the
222    * <code>encrypted_block</code>.
223    */
224   void (*DecryptAndDecode)(
225       PP_Instance instance,
226       PP_DecryptorStreamType decoder_type,
227       PP_Resource encrypted_buffer,
228       const struct PP_EncryptedBlockInfo* encrypted_block_info);
229 };
230 
231 typedef struct PPP_ContentDecryptor_Private_0_9 PPP_ContentDecryptor_Private;
232 /**
233  * @}
234  */
235 
236 #endif  /* PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ */
237 
238