Pepper_31_C_interfaces
ppb_content_decryptor_samsung.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 samsung/ppb_content_decryptor_samsung.idl,
7  * modified Tue Sep 17 10:04:17 2013.
8  */
9 
10 #ifndef PPAPI_C_SAMSUNG_PPB_CONTENT_DECRYPTOR_SAMSUNG_H_
11 #define PPAPI_C_SAMSUNG_PPB_CONTENT_DECRYPTOR_SAMSUNG_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/samsung/pp_content_decryptor_samsung.h"
20 
21 #define PPB_CONTENTDECRYPTOR_SAMSUNG_INTERFACE_0_6 \
22  "PPB_ContentDecryptor_Samsung;0.6"
23 #define PPB_CONTENTDECRYPTOR_SAMSUNG_INTERFACE \
24  PPB_CONTENTDECRYPTOR_SAMSUNG_INTERFACE_0_6
25 
26 /**
27  * @file
28  * Aim of this extension is to provide a way that NaCl application can
29  * provide functionality of Content Decryption Module (CDM).
30  *
31  * This API is almost the same as PP[PB]_ContentDecryptor_Private API
32  * with some additional methods allowing NaCl application to register
33  * itself as CDM for given keySystem.
34  *
35  * TODO(samsung) Add support for decoding audio/video present in
36  * ContentDecryptor_Private API
37  */
38 
39 
40 /**
41  * @addtogroup Interfaces
42  * @{
43  */
44 /**
45  * <code>PPB_ContentDecryptor_Samsung</code> structure contains the function
46  * pointers the browser must implement to support plugins implementing the
47  * <code>PPP_ContentDecryptor_Samsung</code> interface. This interface provides
48  * browser side support for the Content Decryption Module (CDM) for v0.1 of the
49  * proposed Encrypted Media Extensions: http://goo.gl/rbdnR
50  */
52  /**
53  * The decryptor must register itself in the Browser, so that it can be used
54  * by the Browser as Content Decryptor Module.
55  *
56  * @param[in] key_system A <code>PP_Var</code> that contains name of this
57  * content decryptor uder which the Browser will recognize it.
58  *
59  * @param[in] type A <code>PP_Var</code> that contains type of media that
60  * are supported by this content decryptor.
61  *
62  * @return A <code>PP_Bool</code> containing containing <code>PP_TRUE</code>
63  * if the registration succeed, otherwise <code>PP_FALSE</code>.
64  */
66  struct PP_Var key_system,
67  struct PP_Var type);
68  /**
69  * The decryptor requires a key that has not been provided.
70  *
71  * Sent when the decryptor encounters encrypted content, but it does not have
72  * the key required to decrypt the data. The plugin will call this method in
73  * response to a call to the <code>Decrypt()</code> method on the
74  * <code>PPP_ContentDecryptor_Samsung<code> interface.
75  *
76  * The browser must notify the application that a key is needed, and, in
77  * response, the web application must direct the browser to call
78  * <code>AddKey()</code> on the <code>PPP_ContentDecryptor_Samsung</code>
79  * interface.
80  *
81  * @param[in] key_system A <code>PP_Var</code> of type
82  * <code>PP_VARTYPE_STRING</code> containing the name of the key system.
83  *
84  * @param[in] session_id A <code>PP_Var</code> of type
85  * <code>PP_VARTYPE_STRING</code> containing the session ID.
86  *
87  * @param[in] init_data A <code>PP_Var</code> of type
88  * <code>PP_VARTYPE_ARRAY_BUFFER</code> containing container-specific
89  * initialization data.
90  */
91  void (*NeedKey)(PP_Instance instance,
92  struct PP_Var key_system,
93  struct PP_Var session_id,
94  struct PP_Var init_data);
95  /**
96  * A key has been added as the result of a call to the <code>AddKey()</code>
97  * method on the <code>PPP_ContentDecryptor_Samsung</code> interface.
98  *
99  * Note: The above describes the most simple case. Depending on the key
100  * system, a series of <code>KeyMessage()</code> calls from the CDM will be
101  * sent to the browser, and then on to the web application. The web
102  * application must then provide more data to the CDM by directing the browser
103  * to pass the data to the CDM via calls to <code>AddKey()</code> on the
104  * <code>PPP_ContentDecryptor_Samsung</code> interface.
105  * The CDM must call <code>KeyAdded()</code> when the sequence is completed,
106  * and, in response, the browser must notify the web application.
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  void (*KeyAdded)(PP_Instance instance,
115  struct PP_Var key_system,
116  struct PP_Var session_id);
117  /**
118  * A message or request has been generated for key_system in the CDM, and
119  * must be sent to the web application.
120  *
121  * For example, when the browser invokes <code>GenerateKeyRequest()</code>
122  * on the <code>PPP_ContentDecryptor_Samsung</code> interface, the plugin
123  * must send a key message containing the key request.
124  *
125  * Note that <code>KeyMessage()</code> can be used for purposes other than
126  * responses to <code>GenerateKeyRequest()</code> calls. See also the text
127  * in the comment for <code>KeyAdded()</code>, which describes a sequence of
128  * <code>AddKey()</code> and <code>KeyMessage()</code> calls required to
129  * prepare for decryption.
130  *
131  * @param[in] key_system A <code>PP_Var</code> of type
132  * <code>PP_VARTYPE_STRING</code> containing the name of the key system.
133  *
134  * @param[in] session_id A <code>PP_Var</code> of type
135  * <code>PP_VARTYPE_STRING</code> containing the session ID.
136  *
137  * @param[in] message A <code>PP_Var</code> of type
138  * <code>PP_VARTYPE_ARRAY_BUFFER</code> that contains the message.
139  *
140  * @param[in] default_url A <code>PP_Var</code> of type
141  * <code>PP_VARTYPE_STRING</code> containing the default URL for the message.
142  */
143  void (*KeyMessage)(PP_Instance instance,
144  struct PP_Var key_system,
145  struct PP_Var session_id,
146  struct PP_Var message,
147  struct PP_Var default_url);
148  /**
149  * An error occurred in a <code>PPP_ContentDecryptor_Samsung</code> method,
150  * or within the plugin implementing the interface.
151  *
152  * @param[in] key_system A <code>PP_Var</code> of type
153  * <code>PP_VARTYPE_STRING</code> containing the name of the key system.
154  *
155  * @param[in] session_id A <code>PP_Var</code> of type
156  * <code>PP_VARTYPE_STRING</code> containing the session ID.
157  *
158  * @param[in] media_error A MediaKeyError.
159  *
160  * @param[in] system_error A system error code.
161  */
162  void (*KeyError)(PP_Instance instance,
163  struct PP_Var key_system,
164  struct PP_Var session_id,
165  PP_MediaKeyError media_error,
166  int32_t system_code);
167  /**
168  * Called after the <code>Decrypt()</code> method on the
169  * <code>PPP_ContentDecryptor_Samsung</code> interface completes to
170  * deliver decrypted_block to the browser for decoding and rendering.
171  *
172  * The plugin must not hold a reference to the encrypted buffer resource
173  * provided to <code>Decrypt()</code> when it calls this method. The browser
174  * will reuse the buffer in a subsequent <code>Decrypt()</code> call.
175  *
176  * @param[in] decrypted_block A <code>PP_Resource</code> corresponding to a
177  * <code>PPB_Buffer_Dev</code> resource that contains a decrypted data
178  * block.
179  *
180  * @param[in] decrypted_block_info A <code>PP_DecryptedBlockInfo</code> that
181  * contains the result code and tracking info associated with the
182  * <code>decrypted_block</code>.
183  */
184  void (*DeliverBlock)(
185  PP_Instance instance,
186  PP_Resource decrypted_block,
187  const struct PP_DecryptedBlockInfo* decrypted_block_info);
188 };
189 
191 /**
192  * @}
193  */
194 
195 #endif /* PPAPI_C_SAMSUNG_PPB_CONTENT_DECRYPTOR_SAMSUNG_H_ */
196 
void(* KeyError)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, PP_MediaKeyError media_error, int32_t system_code)
PP_VarType type
Definition: pp_var.h:156
int32_t PP_Resource
Definition: pp_resource.h:40
void(* KeyMessage)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, struct PP_Var message, struct PP_Var default_url)
PP_Bool(* RegisterDecryptor)(PP_Instance instance, struct PP_Var key_system, struct PP_Var type)
Definition: pp_var.h:155
int32_t PP_Instance
Definition: pp_instance.h:34
void(* NeedKey)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, struct PP_Var init_data)
void(* KeyAdded)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id)
PP_Bool
Definition: pp_bool.h:30
void(* DeliverBlock)(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo *decrypted_block_info)