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 Feb 10 13:23:32 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_11 \
22 "PPP_ContentDecryptor_Private;0.11"
23 #define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE \
24 PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_11
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_11
{
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>content_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] session_id A reference for the session for which a session
63 * should be generated.
65 * @param[in] content_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 void (*CreateSession
)(PP_Instance instance
,
74 struct PP_Var content_type
,
75 struct PP_Var init_data
);
77 * Loads a session whose web session ID is <code>web_session_id</code>.
79 * Note: After the session is successfully loaded, the CDM must call
80 * <code>SessionCreated()</code> with <code>web_session_id</code> on the
81 * <code>PPB_ContentDecryptor_Private</code> interface.
83 * @param[in] session_id A reference for the session for which a session
86 * @param[in] web_session_id A <code>PP_Var</code> of type
87 * <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
90 void (*LoadSession
)(PP_Instance instance
,
92 struct PP_Var web_session_id
);
94 * Provides a license or other message to the decryptor.
96 * When the CDM needs more information, it must call
97 * <code>SessionMessage()</code> on the
98 * <code>PPB_ContentDecryptor_Private</code> interface, and the browser
99 * must notify the web application. When the CDM has finished processing
100 * <code>response</code> and needs no more information, it must call
101 * <code>SessionReady()</code> on the
102 * <code>PPB_ContentDecryptor_Private</code> interface, and the browser
103 * must notify the web application.
105 * @param[in] session_id A reference for the session to update.
107 * @param[in] response A <code>PP_Var</code> of type
108 * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the license or other
109 * message for the given session ID.
111 void (*UpdateSession
)(PP_Instance instance
,
113 struct PP_Var response
);
115 * Release the specified session and related resources.
117 * @param[in] session_id A reference for the session that should be
120 void (*ReleaseSession
)(PP_Instance instance
, uint32_t session_id
);
122 * Decrypts the block and returns the unencrypted block via
123 * <code>DeliverBlock()</code> on the
124 * <code>PPB_ContentDecryptor_Private</code> interface. The returned block
125 * contains encoded data.
127 * @param[in] resource A <code>PP_Resource</code> corresponding to a
128 * <code>PPB_Buffer_Dev</code> resource that contains an encrypted data
131 * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
132 * contains all auxiliary information needed for decryption of the
133 * <code>encrypted_block</code>.
135 void (*Decrypt
)(PP_Instance instance
,
136 PP_Resource encrypted_block
,
137 const struct PP_EncryptedBlockInfo
* encrypted_block_info
);
139 * Initializes the audio decoder using codec and settings in
140 * <code>decoder_config</code>, and returns the result of the initialization
141 * request to the browser using the <code>DecoderInitializeDone(
143 * on the <code>PPB_ContentDecryptor_Private</code> interface.
145 * @param[in] decoder_config A <code>PP_AudioDecoderConfig</code> that
146 * contains audio decoder settings and a request ID. The request ID is passed
147 * to the <code>DecoderInitializeDone()</code> method on the
148 * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to
149 * associate the result with a audio decoder initialization request.
151 * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a
152 * <code>PPB_Buffer_Dev</code> resource containing codec setup data required
153 * by some codecs. It should be set to 0 when the codec being initialized
154 * does not require it.
156 void (*InitializeAudioDecoder
)(
157 PP_Instance instance
,
158 const struct PP_AudioDecoderConfig
* decoder_config
,
159 PP_Resource codec_extra_data
);
161 * Initializes the video decoder using codec and settings in
162 * <code>decoder_config</code>, and returns the result of the initialization
163 * request to the browser using the <code>DecoderInitializeDone()</code>
164 * method on the <code>PPB_ContentDecryptor_Private</code> interface.
166 * @param[in] decoder_config A <code>PP_VideoDecoderConfig</code> that
167 * contains video decoder settings and a request ID. The request ID is passed
168 * to the <code>DecoderInitializeDone()</code> method on the
169 * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to
170 * associate the result with a video decoder initialization request.
172 * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a
173 * <code>PPB_Buffer_Dev</code> resource containing codec setup data required
174 * by some codecs. It should be set to 0 when the codec being initialized
175 * does not require it.
177 void (*InitializeVideoDecoder
)(
178 PP_Instance instance
,
179 const struct PP_VideoDecoderConfig
* decoder_config
,
180 PP_Resource codec_extra_data
);
182 * De-initializes the decoder for the <code>PP_DecryptorStreamType</code>
183 * specified by <code>decoder_type</code> and sets it to an uninitialized
184 * state. The decoder can be re-initialized after de-initialization completes
185 * by calling <code>InitializeAudioDecoder</code> or
186 * <code>InitializeVideoDecoder</code>.
188 * De-initialization completion is reported to the browser using the
189 * <code>DecoderDeinitializeDone()</code> method on the
190 * <code>PPB_ContentDecryptor_Private</code> interface.
192 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
193 * specifies the decoder to de-initialize.
195 * @param[in] request_id A request ID that allows the browser to associate a
196 * request to de-initialize a decoder with the corresponding call to the
197 * <code>DecoderDeinitializeDone()</code> method on the
198 * <code>PPB_ContentDecryptor_Private</code> interface.
200 void (*DeinitializeDecoder
)(PP_Instance instance
,
201 PP_DecryptorStreamType decoder_type
,
202 uint32_t request_id
);
204 * Resets the decoder for the <code>PP_DecryptorStreamType</code> specified
205 * by <code>decoder_type</code> to an initialized clean state. Reset
206 * completion is reported to the browser using the
207 * <code>DecoderResetDone()</code> method on the
208 * <code>PPB_ContentDecryptor_Private</code> interface. This method can be
209 * used to signal a discontinuity in the encoded data stream, and is safe to
210 * call multiple times.
212 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
213 * specifies the decoder to reset.
215 * @param[in] request_id A request ID that allows the browser to associate a
216 * request to reset the decoder with a corresponding call to the
217 * <code>DecoderResetDone()</code> method on the
218 * <code>PPB_ContentDecryptor_Private</code> interface.
220 void (*ResetDecoder
)(PP_Instance instance
,
221 PP_DecryptorStreamType decoder_type
,
222 uint32_t request_id
);
224 * Decrypts encrypted_buffer, decodes it, and returns the unencrypted
225 * uncompressed (decoded) data to the browser via the
226 * <code>DeliverFrame()</code> or <code>DeliverSamples()</code> method on the
227 * <code>PPB_ContentDecryptor_Private</code> interface.
229 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that
230 * specifies the decoder to use after <code>encrypted_buffer</code> is
233 * @param[in] encrypted_buffer A <code>PP_Resource</code> corresponding to a
234 * <code>PPB_Buffer_Dev</code> resource that contains encrypted media data.
236 * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
237 * contains all auxiliary information needed for decryption of the
238 * <code>encrypted_block</code>.
240 void (*DecryptAndDecode
)(
241 PP_Instance instance
,
242 PP_DecryptorStreamType decoder_type
,
243 PP_Resource encrypted_buffer
,
244 const struct PP_EncryptedBlockInfo
* encrypted_block_info
);
247 typedef struct PPP_ContentDecryptor_Private_0_11 PPP_ContentDecryptor_Private
;
252 #endif /* PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ */