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 May 1 10:36:31 2014. 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_12 \ 22 "PPP_ContentDecryptor_Private;0.12" 23 #define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE \ 24 PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_12 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_12 { 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>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. 57 * 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. 61 * 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. 64 * 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. 67 * 68 * @param[in] init_data A <code>PP_Var</code> of type 69 * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific 70 * initialization data. 71 * 72 * @param[in] session_type A <code>PP_SessionType</code> that indicates the 73 * type of session to be created. 74 */ 75 void (*CreateSession)(PP_Instance instance, 76 uint32_t promise_id, 77 struct PP_Var init_data_type, 78 struct PP_Var init_data, 79 PP_SessionType session_type); 80 /** 81 * Loads a session whose web session ID is <code>web_session_id</code>. 82 * 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. 86 * 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. 89 * 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 92 * to load. 93 */ 94 void (*LoadSession)(PP_Instance instance, 95 uint32_t promise_id, 96 struct PP_Var web_session_id); 97 /** 98 * Provides a license or other message to the decryptor. 99 * 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. 108 * 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. 111 * 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 114 * to be updated. 115 * 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. 119 */ 120 void (*UpdateSession)(PP_Instance instance, 121 uint32_t promise_id, 122 struct PP_Var web_session_id, 123 struct PP_Var response); 124 /** 125 * Release the specified session and related resources. 126 * 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. 129 * 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 132 * to be released. 133 * 134 */ 135 void (*ReleaseSession)(PP_Instance instance, 136 uint32_t promise_id, 137 struct PP_Var web_session_id); 138 /** 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. 143 * 144 * @param[in] resource A <code>PP_Resource</code> corresponding to a 145 * <code>PPB_Buffer_Dev</code> resource that contains an encrypted data 146 * block. 147 * 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>. 151 */ 152 void (*Decrypt)(PP_Instance instance, 153 PP_Resource encrypted_block, 154 const struct PP_EncryptedBlockInfo* encrypted_block_info); 155 /** 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( 159 )</code> method 160 * on the <code>PPB_ContentDecryptor_Private</code> interface. 161 * 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. 167 * 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. 172 */ 173 void (*InitializeAudioDecoder)( 174 PP_Instance instance, 175 const struct PP_AudioDecoderConfig* decoder_config, 176 PP_Resource codec_extra_data); 177 /** 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. 182 * 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. 188 * 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. 193 */ 194 void (*InitializeVideoDecoder)( 195 PP_Instance instance, 196 const struct PP_VideoDecoderConfig* decoder_config, 197 PP_Resource codec_extra_data); 198 /** 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>. 204 * 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. 208 * 209 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that 210 * specifies the decoder to de-initialize. 211 * 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. 216 */ 217 void (*DeinitializeDecoder)(PP_Instance instance, 218 PP_DecryptorStreamType decoder_type, 219 uint32_t request_id); 220 /** 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. 228 * 229 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that 230 * specifies the decoder to reset. 231 * 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. 236 */ 237 void (*ResetDecoder)(PP_Instance instance, 238 PP_DecryptorStreamType decoder_type, 239 uint32_t request_id); 240 /** 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. 245 * 246 * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that 247 * specifies the decoder to use after <code>encrypted_buffer</code> is 248 * decrypted. 249 * 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. 252 * 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>. 256 */ 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); 262 }; 263 264 typedef struct PPP_ContentDecryptor_Private_0_12 PPP_ContentDecryptor_Private; 265 /** 266 * @} 267 */ 268 269 #endif /* PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ */ 270 271