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.
7 * This file defines the API for output protection. Currently, it only supports
18 * Content protection methods applied on video output link.
20 [assert_size
(4)] enum PP_OutputProtectionMethod_Private
{
21 PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE
= 0,
22 PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP
= 1 << 0
26 * Video output link types.
28 [assert_size
(4)] enum PP_OutputProtectionLinkType_Private
{
29 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NONE
= 0,
30 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_UNKNOWN
= 1 << 0,
31 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_INTERNAL
= 1 << 1,
32 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA
= 1 << 2,
33 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI
= 1 << 3,
34 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI
= 1 << 4,
35 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT
= 1 << 5,
36 PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK
= 1 << 6
40 * The <code>PPB_OutputProtection_Private</code> interface allows controlling
43 * <strong>Example:</strong>
46 * op = output_protection->Create(instance);
47 * output_protection->QueryStatus(op, &link_mask, &protection_mask,
51 * In this example, the plugin wants to enforce HDCP for HDMI link.
53 * if (link_mask & PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI) {
54 * output_protection->EnableProtection(
55 * op, PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP, done_callback);
59 * After EnableProtection() completes, the plugin has to query protection
60 * status periodically to make sure the protection is enabled and remains
63 interface PPB_OutputProtection_Private
{
65 * Create() creates a new <code>PPB_OutputProtection_Private</code> object.
67 * @pram[in] instance A <code>PP_Instance</code> identifying one instance of
70 * @return A <code>PP_Resource</code> corresponding to a
71 * <code>PPB_OutputProtection_Private</code> if successful, 0 if creation
74 PP_Resource Create
([in] PP_Instance instance
);
77 * IsOutputProtection() determines if the provided resource is a
78 * <code>PPB_OutputProtection_Private</code>.
80 * @param[in] resource A <code>PP_Resource</code> corresponding to a
81 * <code>PPB_OutputProtection_Private</code>.
83 * @return <code>PP_TRUE</code> if the resource is a
84 * <code>PPB_OutputProtection_Private</code>, <code>PP_FALSE</code> if the
85 * resource is invalid or some type other than
86 * <code>PPB_OutputProtection_Private</code>.
88 PP_Bool IsOutputProtection
([in] PP_Resource resource
);
91 * Query link status and protection status.
92 * Clients have to query status periodically in order to detect changes.
94 * @param[in] resource A <code>PP_Resource</code> corresponding to a
95 * <code>PPB_OutputProtection_Private</code>.
96 * @param[out] link_mask The type of connected output links, which is a
97 * bit-mask of the <code>PP_OutputProtectionLinkType_Private</code> values.
98 * @param[out] protection_mask Enabled protection methods, which is a
99 * bit-mask of the <code>PP_OutputProtectionMethod_Private</code> values.
100 * @param[in] callback A <code>PP_CompletionCallback</code> to run on
101 * asynchronous completion of QueryStatus(). This callback will only run if
102 * QueryStatus() returns <code>PP_OK_COMPLETIONPENDING</code>.
104 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
107 [in] PP_Resource resource
,
108 [out] uint32_t link_mask
,
109 [out] uint32_t protection_mask
,
110 [in] PP_CompletionCallback
callback);
113 * Set desired protection methods.
115 * When the desired protection method(s) have been applied to all applicable
116 * output links, the relevant bit(s) of the protection_mask returned by
117 * QueryStatus() will be set. Otherwise, the relevant bit(s) of
118 * protection_mask will not be set; there is no separate error code or
121 * Protections will be disabled if no longer desired by all instances.
123 * @param[in] resource A <code>PP_Resource</code> corresponding to a
124 * <code>PPB_OutputProtection_Private</code>.
125 * @param[in] desired_protection_mask The desired protection methods, which
126 * is a bit-mask of the <code>PP_OutputProtectionMethod_Private</code>
128 * @param[in] callback A <code>PP_CompletionCallback</code> to be called with
129 * <code>PP_OK</code> when the protection request has been made. This may be
130 * before the protection have actually been applied. Call QueryStatus to get
131 * protection status. If it failed to make the protection request, the
132 * callback is called with <code>PP_ERROR_FAILED</code> and there is no need
133 * to call QueryStatus().
135 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
137 int32_t EnableProtection
(
138 [in] PP_Resource resource
,
139 [in] uint32_t desired_protection_mask
,
140 [in] PP_CompletionCallback
callback);