1 /* Copyright 2013 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/ppb_output_protection_private.idl,
7 * modified Tue Oct 8 13:22:13 2013.
10 #ifndef PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_
11 #define PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_
13 #include "ppapi/c/pp_bool.h"
14 #include "ppapi/c/pp_completion_callback.h"
15 #include "ppapi/c/pp_instance.h"
16 #include "ppapi/c/pp_macros.h"
17 #include "ppapi/c/pp_resource.h"
18 #include "ppapi/c/pp_stdint.h"
20 #define PPB_OUTPUTPROTECTION_PRIVATE_INTERFACE_0_1 \
21 "PPB_OutputProtection_Private;0.1"
22 #define PPB_OUTPUTPROTECTION_PRIVATE_INTERFACE \
23 PPB_OUTPUTPROTECTION_PRIVATE_INTERFACE_0_1
27 * This file defines the API for output protection. Currently, it only supports
37 * Content protection methods applied on video output link.
40 PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE
= 0,
41 PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP
= 1 << 0
42 } PP_OutputProtectionMethod_Private
;
43 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_OutputProtectionMethod_Private
, 4);
46 * Video output link types.
49 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NONE
= 0,
50 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_UNKNOWN
= 1 << 0,
51 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_INTERNAL
= 1 << 1,
52 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA
= 1 << 2,
53 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI
= 1 << 3,
54 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI
= 1 << 4,
55 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT
= 1 << 5,
56 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK
= 1 << 6
57 } PP_OutputProtectionLinkType_Private
;
58 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_OutputProtectionLinkType_Private
, 4);
64 * @addtogroup Interfaces
68 * The <code>PPB_OutputProtection_Private</code> interface allows controlling
71 * <strong>Example:</strong>
74 * op = output_protection->Create(instance);
75 * output_protection->QueryStatus(op, &link_mask, &protection_mask,
79 * In this example, the plugin wants to enforce HDCP for HDMI link.
81 * if (link_mask & PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI) {
82 * output_protection->EnableProtection(
83 * op, PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP, done_callback);
87 * After EnableProtection() completes, the plugin has to query protection
88 * status periodically to make sure the protection is enabled and remains
91 struct PPB_OutputProtection_Private_0_1
{
93 * Create() creates a new <code>PPB_OutputProtection_Private</code> object.
95 * @pram[in] instance A <code>PP_Instance</code> identifying one instance of
98 * @return A <code>PP_Resource</code> corresponding to a
99 * <code>PPB_OutputProtection_Private</code> if successful, 0 if creation
102 PP_Resource (*Create
)(PP_Instance instance
);
104 * IsOutputProtection() determines if the provided resource is a
105 * <code>PPB_OutputProtection_Private</code>.
107 * @param[in] resource A <code>PP_Resource</code> corresponding to a
108 * <code>PPB_OutputProtection_Private</code>.
110 * @return <code>PP_TRUE</code> if the resource is a
111 * <code>PPB_OutputProtection_Private</code>, <code>PP_FALSE</code> if the
112 * resource is invalid or some type other than
113 * <code>PPB_OutputProtection_Private</code>.
115 PP_Bool (*IsOutputProtection
)(PP_Resource resource
);
117 * Query link status and protection status.
118 * Clients have to query status periodically in order to detect changes.
120 * @param[in] resource A <code>PP_Resource</code> corresponding to a
121 * <code>PPB_OutputProtection_Private</code>.
122 * @param[out] link_mask The type of connected output links, which is a
123 * bit-mask of the <code>PP_OutputProtectionLinkType_Private</code> values.
124 * @param[out] protection_mask Enabled protection methods, which is a
125 * bit-mask of the <code>PP_OutputProtectionMethod_Private</code> values.
126 * @param[in] callback A <code>PP_CompletionCallback</code> to run on
127 * asynchronous completion of QueryStatus(). This callback will only run if
128 * QueryStatus() returns <code>PP_OK_COMPLETIONPENDING</code>.
130 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
132 int32_t (*QueryStatus
)(PP_Resource resource
,
134 uint32_t* protection_mask
,
135 struct PP_CompletionCallback callback
);
137 * Set desired protection methods.
139 * When the desired protection method(s) have been applied to all applicable
140 * output links, the relevant bit(s) of the protection_mask returned by
141 * QueryStatus() will be set. Otherwise, the relevant bit(s) of
142 * protection_mask will not be set; there is no separate error code or
145 * Protections will be disabled if no longer desired by all instances.
147 * @param[in] resource A <code>PP_Resource</code> corresponding to a
148 * <code>PPB_OutputProtection_Private</code>.
149 * @param[in] desired_protection_mask The desired protection methods, which
150 * is a bit-mask of the <code>PP_OutputProtectionMethod_Private</code>
152 * @param[in] callback A <code>PP_CompletionCallback</code> to be called with
153 * <code>PP_OK</code> when the protection request has been made. This may be
154 * before the protection have actually been applied. Call QueryStatus to get
155 * protection status. If it failed to make the protection request, the
156 * callback is called with <code>PP_ERROR_FAILED</code> and there is no need
157 * to call QueryStatus().
159 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
161 int32_t (*EnableProtection
)(PP_Resource resource
,
162 uint32_t desired_protection_mask
,
163 struct PP_CompletionCallback callback
);
166 typedef struct PPB_OutputProtection_Private_0_1 PPB_OutputProtection_Private
;
171 #endif /* PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_ */