Pepper_31_C_interfaces
ppp_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/ppp_content_decryptor_samsung.idl,
7  * modified Mon Sep 16 15:36:54 2013.
8  */
9 
10 #ifndef PPAPI_C_SAMSUNG_PPP_CONTENT_DECRYPTOR_SAMSUNG_H_
11 #define PPAPI_C_SAMSUNG_PPP_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 PPP_CONTENTDECRYPTOR_SAMSUNG_INTERFACE_0_6 \
22  "PPP_ContentDecryptor_Samsung;0.6"
23 #define PPP_CONTENTDECRYPTOR_SAMSUNG_INTERFACE \
24  PPP_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>PPP_ContentDecryptor_Samsung</code> structure contains the function
46  * pointers the decryption plugin must implement to provide services needed by
47  * the browser. This interface provides the plugin side support for the Content
48  * Decryption Module (CDM) for v0.1 of the proposed Encrypted Media Extensions:
49  * http://goo.gl/rbdnR
50  */
52  /**
53  * Generates a key request. key_system specifies the key or licensing system
54  * to use. type contains the MIME type of init_data. init_data is a data
55  * buffer containing data for use in generating the request.
56  *
57  * Note: <code>GenerateKeyRequest()</code> must create the session ID used in
58  * other methods on this interface. The session ID must be provided to the
59  * browser by the CDM via <code>KeyMessage()</code> on the
60  * <code>PPB_ContentDecryptor_Samsung</code> interface.
61  *
62  * @param[in] key_system A <code>PP_Var</code> of type
63  * <code>PP_VARTYPE_STRING</code> containing the name of the key system.
64  *
65  * @param[in] 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  void (*GenerateKeyRequest)(PP_Instance instance,
73  struct PP_Var key_system,
74  struct PP_Var type,
75  struct PP_Var init_data);
76  /**
77  * Provides a key or license to the decryptor for decrypting media data.
78  *
79  * When the CDM needs more information to complete addition of the key it
80  * will call <code>KeyMessage()</code> on the
81  * <code>PPB_ContentDecryptor_Samsung</code> interface, which the browser
82  * passes to the application. When the key is ready to use, the CDM
83  * must call call <code>KeyAdded()</code> on the
84  * <code>PPB_ContentDecryptor_Samsung</code> interface, and the browser
85  * must notify the web application.
86  *
87  * @param[in] session_id A <code>PP_Var</code> of type
88  * <code>PP_VARTYPE_STRING</code> containing the session ID.
89  *
90  * @param[in] key A <code>PP_Var</code> of type
91  * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the decryption key, license,
92  * or other message for the given session ID.
93  *
94  * @param[in] init_data A <code>PP_Var</code> of type
95  * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific
96  * initialization data.
97  */
98  void (*AddKey)(PP_Instance instance,
99  struct PP_Var session_id,
100  struct PP_Var key,
101  struct PP_Var init_data);
102  /**
103  * Cancels a pending key request for the specified session ID.
104  *
105  * @param[in] session_id A <code>PP_Var</code> of type
106  * <code>PP_VARTYPE_STRING</code> containing the session ID.
107  */
108  void (*CancelKeyRequest)(PP_Instance instance, struct PP_Var session_id);
109  /**
110  * Decrypts the block and returns the unencrypted block via
111  * <code>DeliverBlock()</code> on the
112  * <code>PPB_ContentDecryptor_Samsung</code> interface. The returned block
113  * contains encoded data.
114  *
115  * @param[in] resource A <code>PP_Resource</code> corresponding to a
116  * <code>PPB_Buffer_Dev</code> resource that contains an encrypted data
117  * block.
118  *
119  * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that
120  * contains all auxiliary information needed for decryption of the
121  * <code>encrypted_block</code>.
122  */
123  void (*Decrypt)(PP_Instance instance,
124  PP_Resource encrypted_block,
125  const struct PP_EncryptedBlockInfo* encrypted_block_info);
126 };
127 
129 /**
130  * @}
131  */
132 
133 #endif /* PPAPI_C_SAMSUNG_PPP_CONTENT_DECRYPTOR_SAMSUNG_H_ */
134 
void(* CancelKeyRequest)(PP_Instance instance, struct PP_Var session_id)
PP_VarType type
Definition: pp_var.h:156
int32_t PP_Resource
Definition: pp_resource.h:40
void(* AddKey)(PP_Instance instance, struct PP_Var session_id, struct PP_Var key, struct PP_Var init_data)
Definition: pp_var.h:155
int32_t PP_Instance
Definition: pp_instance.h:34
void(* Decrypt)(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo *encrypted_block_info)
void(* GenerateKeyRequest)(PP_Instance instance, struct PP_Var key_system, struct PP_Var type, struct PP_Var init_data)