OLD | NEW |
(Empty) | |
| 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. |
| 4 */ |
| 5 |
| 6 /* From private/ppb_output_protection_private.idl, |
| 7 * modified Sat Aug 31 03:18:39 2013. |
| 8 */ |
| 9 |
| 10 #ifndef PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_ |
| 11 #define PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_ |
| 12 |
| 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" |
| 19 |
| 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 |
| 24 |
| 25 /** |
| 26 * @file |
| 27 * This file defines the API for output protection. Currently, it only supports |
| 28 * Chrome OS. |
| 29 */ |
| 30 |
| 31 |
| 32 /** |
| 33 * @addtogroup Enums |
| 34 * @{ |
| 35 */ |
| 36 /** |
| 37 * Content protection methods applied on video output link. |
| 38 */ |
| 39 typedef enum { |
| 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); |
| 44 |
| 45 /** |
| 46 * Video output link types. |
| 47 */ |
| 48 typedef enum { |
| 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_OutputProtectionLinkType_Private; |
| 57 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_OutputProtectionLinkType_Private, 4); |
| 58 /** |
| 59 * @} |
| 60 */ |
| 61 |
| 62 /** |
| 63 * @addtogroup Interfaces |
| 64 * @{ |
| 65 */ |
| 66 /** |
| 67 * The <code>PPB_OutputProtection_Private</code> interface allows controlling |
| 68 * output protection. |
| 69 * |
| 70 * <strong>Example:</strong> |
| 71 * |
| 72 * @code |
| 73 * op = output_protection->Create(instance); |
| 74 * output_protection->QueryStatus(op, &link_mask, &protection_mask, |
| 75 * done_callback); |
| 76 * @endcode |
| 77 * |
| 78 * In this example, the plugin wants to enforce HDCP for HDMI link. |
| 79 * @code |
| 80 * if (link_mask & PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI) { |
| 81 * output_protection->EnableProtection( |
| 82 * op, PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP, done_callback); |
| 83 * } |
| 84 * @endcode |
| 85 * |
| 86 * After EnableProtection() completes, the plugin has to query protection |
| 87 * status periodically to make sure the protection is enabled and remains |
| 88 * enabled. |
| 89 */ |
| 90 struct PPB_OutputProtection_Private_0_1 { |
| 91 /** |
| 92 * Create() creates a new <code>PPB_OutputProtection_Private</code> object. |
| 93 * |
| 94 * @pram[in] instance A <code>PP_Instance</code> identifying one instance of |
| 95 * a module. |
| 96 * |
| 97 * @return A <code>PP_Resource</code> corresponding to a |
| 98 * <code>PPB_OutputProtection_Private</code> if successful, 0 if creation |
| 99 * failed. |
| 100 */ |
| 101 PP_Resource (*Create)(PP_Instance instance); |
| 102 /** |
| 103 * IsOutputProtection() determines if the provided resource is a |
| 104 * <code>PPB_OutputProtection_Private</code>. |
| 105 * |
| 106 * @param[in] resource A <code>PP_Resource</code> corresponding to a |
| 107 * <code>PPB_OutputProtection_Private</code>. |
| 108 * |
| 109 * @return <code>PP_TRUE</code> if the resource is a |
| 110 * <code>PPB_OutputProtection_Private</code>, <code>PP_FALSE</code> if the |
| 111 * resource is invalid or some type other than |
| 112 * <code>PPB_OutputProtection_Private</code>. |
| 113 */ |
| 114 PP_Bool (*IsOutputProtection)(PP_Resource resource); |
| 115 /** |
| 116 * Query link status and protection status. |
| 117 * Clients have to query status periodically in order to detect changes. |
| 118 * |
| 119 * @param[in] resource A <code>PP_Resource</code> corresponding to a |
| 120 * <code>PPB_OutputProtection_Private</code>. |
| 121 * @param[out] link_mask The type of connected output links, which is a |
| 122 * bit-mask of the <code>PP_OutputProtectionLinkType_Private</code> values. |
| 123 * @param[out] protection_mask Enabled protection methods, which is a |
| 124 * bit-mask of the <code>PP_OutputProtectionMethod_Private</code> values. |
| 125 * @param[in] callback A <code>PP_CompletionCallback</code> to run on |
| 126 * asynchronous completion of QueryStatus(). This callback will only run if |
| 127 * QueryStatus() returns <code>PP_OK_COMPLETIONPENDING</code>. |
| 128 * |
| 129 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 130 */ |
| 131 int32_t (*QueryStatus)(PP_Resource resource, |
| 132 uint32_t* link_mask, |
| 133 uint32_t* protection_mask, |
| 134 struct PP_CompletionCallback callback); |
| 135 /** |
| 136 * Set desired protection methods. |
| 137 * |
| 138 * When the desired protection method(s) have been applied to all applicable |
| 139 * output links, the relevant bit(s) of the protection_mask returned by |
| 140 * QueryStatus() will be set. Otherwise, the relevant bit(s) of |
| 141 * protection_mask will not be set; there is no separate error code or |
| 142 * callback. |
| 143 * |
| 144 * Protections will be disabled if no longer desired by all instances. |
| 145 * |
| 146 * @param[in] resource A <code>PP_Resource</code> corresponding to a |
| 147 * <code>PPB_OutputProtection_Private</code>. |
| 148 * @param[in] desired_protection_mask The desired protection methods, which |
| 149 * is a bit-mask of the <code>PP_OutputProtectionMethod_Private</code> |
| 150 * values. |
| 151 * @param[in] callback A <code>PP_CompletionCallback</code> to be called when |
| 152 * the protection request has been made. This may be before the protection |
| 153 * have actually been applied. Call QueryStatus to get protection status. |
| 154 * |
| 155 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 156 */ |
| 157 int32_t (*EnableProtection)(PP_Resource resource, |
| 158 uint32_t desired_protection_mask, |
| 159 struct PP_CompletionCallback callback); |
| 160 }; |
| 161 |
| 162 typedef struct PPB_OutputProtection_Private_0_1 PPB_OutputProtection_Private; |
| 163 /** |
| 164 * @} |
| 165 */ |
| 166 |
| 167 #endif /* PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_ */ |
| 168 |
OLD | NEW |