OLD | NEW |
(Empty) | |
| 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 Tue Aug 14 11:53:03 2012. |
| 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_var.h" |
| 19 |
| 20 #define PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_1 \ |
| 21 "PPB_ContentDecryptor_Private;0.1" |
| 22 #define PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE \ |
| 23 PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_1 |
| 24 |
| 25 /** |
| 26 * @file |
| 27 * This file defines the <code>PPB_ContentDecryptor_Private</code> |
| 28 * interface. Note: This is a special interface, only to be used for Content |
| 29 * Decryption Modules, not normal plugins. |
| 30 */ |
| 31 |
| 32 |
| 33 /** |
| 34 * @addtogroup Interfaces |
| 35 * @{ |
| 36 */ |
| 37 /** |
| 38 * <code>PPB_ContentDecryptor_Private</code> structure contains the function |
| 39 * pointers the browser must implement to support plugins implementing the |
| 40 * <code>PPP_ContentDecryptor_Private</code> interface. This interface provides |
| 41 * browser side support for the Content Decryption Module (CDM) for v0.1 of the |
| 42 * proposed Encrypted Media Extensions: http://goo.gl/rbdnR |
| 43 */ |
| 44 struct PPB_ContentDecryptor_Private_0_1 { |
| 45 /** |
| 46 * The decryptor requires a key that has not been provided. |
| 47 * |
| 48 * Sent when the decryptor encounters encrypted content, but it does not have |
| 49 * the key required to decrypt the data. The plugin will call this method in |
| 50 * response to a call to the <code>Decrypt()</code> method on the |
| 51 * <code>PPP_ContentDecryptor_Private<code> interface. |
| 52 * |
| 53 * The browser must notify the application that a key is needed, and, in |
| 54 * response, the web application must direct the browser to call |
| 55 * <code>AddKey()</code> on the <code>PPP_ContentDecryptor_Private<code> |
| 56 * interface. |
| 57 * |
| 58 * @param[in] key_system A <code>PP_Var</code> of type |
| 59 * <code>PP_VARTYPE_STRING</code> containing the name of the key system. |
| 60 * |
| 61 * @param[in] session_id A <code>PP_Var</code> of type |
| 62 * <code>PP_VARTYPE_STRING</code> containing the session ID. |
| 63 * |
| 64 * @param[in] init_data A <code>PP_Var</code> of type |
| 65 * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container-specific |
| 66 * initialization data. |
| 67 */ |
| 68 void (*NeedKey)(PP_Instance instance, |
| 69 struct PP_Var key_system, |
| 70 struct PP_Var session_id, |
| 71 struct PP_Var init_data); |
| 72 /** |
| 73 * A key has been added as the result of a call to the <code>AddKey()</code> |
| 74 * method on the <code>PPP_ContentDecryptor_Private</code> interface. |
| 75 * |
| 76 * Note: The above describes the most simple case. Depending on the key |
| 77 * system, a series of <code>KeyMessage()</code> calls from the CDM will be |
| 78 * sent to the browser, and then on to the web application. The web |
| 79 * application must then provide more data to the CDM by directing the browser |
| 80 * to pass the data to the CDM via calls to <code>AddKey()</code> on the |
| 81 * <code>PPP_ContentDecryptor_Private</code> interface. |
| 82 * The CDM must call <code>KeyAdded()</code> when the sequence is completed, |
| 83 * and, in response, the browser must notify the web application. |
| 84 * |
| 85 * @param[in] key_system A <code>PP_Var</code> of type |
| 86 * <code>PP_VARTYPE_STRING</code> containing the name of the key system. |
| 87 * |
| 88 * @param[in] session_id A <code>PP_Var</code> of type |
| 89 * <code>PP_VARTYPE_STRING</code> containing the session ID. |
| 90 */ |
| 91 void (*KeyAdded)(PP_Instance instance, |
| 92 struct PP_Var key_system, |
| 93 struct PP_Var session_id); |
| 94 /** |
| 95 * A message or request has been generated for key_system in the CDM, and |
| 96 * must be sent to the web application. |
| 97 * |
| 98 * For example, when the browser invokes <code>GenerateKeyRequest()</code> |
| 99 * on the <code>PPP_ContentDecryptor_Private</code> interface, the plugin |
| 100 * must send a key message containing the key request. |
| 101 * |
| 102 * Note that <code>KeyMessage()</code> can be used for purposes other than |
| 103 * responses to <code>GenerateKeyRequest()</code> calls. See also the text |
| 104 * in the comment for <code>KeyAdded()</code>, which describes a sequence of |
| 105 * <code>AddKey()</code> and <code>KeyMessage()</code> calls required to |
| 106 * prepare for decryption. |
| 107 * |
| 108 * @param[in] key_system A <code>PP_Var</code> of type |
| 109 * <code>PP_VARTYPE_STRING</code> containing the name of the key system. |
| 110 * |
| 111 * @param[in] session_id A <code>PP_Var</code> of type |
| 112 * <code>PP_VARTYPE_STRING</code> containing the session ID. |
| 113 * |
| 114 * @param[in] resource A <code>PP_Resource</code> corresponding to a |
| 115 * <code>PPB_Buffer_Dev</code> resource that contains the message. |
| 116 * |
| 117 * @param[in] default_url A <code>PP_Var</code> of type |
| 118 * <code>PP_VARTYPE_STRING</code> containing the default URL for the message. |
| 119 */ |
| 120 void (*KeyMessage)(PP_Instance instance, |
| 121 struct PP_Var key_system, |
| 122 struct PP_Var session_id, |
| 123 PP_Resource message, |
| 124 struct PP_Var default_url); |
| 125 /** |
| 126 * An error occurred in a <code>PPP_ContentDecryptor_Private</code> method, |
| 127 * or within the plugin implementing the interface. |
| 128 * |
| 129 * @param[in] key_system A <code>PP_Var</code> of type |
| 130 * <code>PP_VARTYPE_STRING</code> containing the name of the key system. |
| 131 * |
| 132 * @param[in] session_id A <code>PP_Var</code> of type |
| 133 * <code>PP_VARTYPE_STRING</code> containing the session ID. |
| 134 * |
| 135 * @param[in] media_error A MediaKeyError. |
| 136 * |
| 137 * @param[in] system_error A system error code. |
| 138 */ |
| 139 void (*KeyError)(PP_Instance instance, |
| 140 struct PP_Var key_system, |
| 141 struct PP_Var session_id, |
| 142 int32_t media_error, |
| 143 int32_t system_code); |
| 144 /** |
| 145 * Called after the <code>Decrypt()</code> method on the |
| 146 * <code>PPP_ContentDecryptor_Private</code> interface completes to |
| 147 * deliver decrypted_block to the browser for decoding and rendering. |
| 148 * |
| 149 * @param[in] decrypted_block A <code>PP_Resource</code> corresponding to a |
| 150 * <code>PPB_Buffer_Dev</code> resource that contains a decrypted data |
| 151 * block. |
| 152 * |
| 153 * @param[in] request_id A unique value the browser can use to associate |
| 154 * decrypted_block with a decrypt call. |
| 155 */ |
| 156 void (*DeliverBlock)(PP_Instance instance, |
| 157 PP_Resource decrypted_block, |
| 158 int32_t request_id); |
| 159 /** |
| 160 * Called after the <code>DecryptAndDecode()</code> method on the |
| 161 * <code>PPP_ContentDecryptor_Private</code> interface completes to deliver |
| 162 * a decrypted and decoded video frame to the browser for rendering. |
| 163 * |
| 164 * @param[in] decrypted_frame A <code>PP_Resource</code> corresponding to a |
| 165 * <code>PPB_Buffer_Dev</code> resource that contains a video frame. |
| 166 * |
| 167 * @param[in] request_id A unique value the browser can use to associate |
| 168 * decrypted_frame with a decrypt call. |
| 169 */ |
| 170 void (*DeliverFrame)(PP_Instance instance, |
| 171 PP_Resource decrypted_frame, |
| 172 int32_t request_id); |
| 173 /** |
| 174 * Called after the <code>DecryptAndDecode()</code> method on the |
| 175 * <code>PPP_ContentDecryptor_Private</code> interface completes to |
| 176 * deliver a buffer of decrypted and decoded audio samples to the browser for |
| 177 * rendering. |
| 178 * |
| 179 * @param[in] decrypted_samples A <code>PP_Resource</code> corresponding to a |
| 180 * <code>PPB_Buffer_Dev</code> resource that contains a decrypted buffer |
| 181 * of decoded audio samples. |
| 182 * |
| 183 * @param[in] request_id A unique value the browser can use to associate |
| 184 * decrypted_samples with a decrypt call. |
| 185 */ |
| 186 void (*DeliverSamples)(PP_Instance instance, |
| 187 PP_Resource decrypted_samples, |
| 188 int32_t request_id); |
| 189 }; |
| 190 |
| 191 typedef struct PPB_ContentDecryptor_Private_0_1 PPB_ContentDecryptor_Private; |
| 192 /** |
| 193 * @} |
| 194 */ |
| 195 |
| 196 #endif /* PPAPI_C_PRIVATE_PPB_CONTENT_DECRYPTOR_PRIVATE_H_ */ |
| 197 |
OLD | NEW |