1 /* Copyright (c) 2014 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 pp_codecs.idl modified Fri Sep 18 10:42:55 2015. */ 7 8 #ifndef PPAPI_C_PP_CODECS_H_ 9 #define PPAPI_C_PP_CODECS_H_ 10 11 #include "ppapi/c/pp_bool.h" 12 #include "ppapi/c/pp_macros.h" 13 #include "ppapi/c/pp_point.h" 14 #include "ppapi/c/pp_rect.h" 15 #include "ppapi/c/pp_size.h" 16 #include "ppapi/c/pp_stdint.h" 17 18 /** 19 * @file 20 * Video profiles. 21 */ 22 23 24 /** 25 * @addtogroup Enums 26 * @{ 27 */ 28 typedef enum { 29 PP_VIDEOPROFILE_H264BASELINE = 0, 30 PP_VIDEOPROFILE_H264MAIN = 1, 31 PP_VIDEOPROFILE_H264EXTENDED = 2, 32 PP_VIDEOPROFILE_H264HIGH = 3, 33 PP_VIDEOPROFILE_H264HIGH10PROFILE = 4, 34 PP_VIDEOPROFILE_H264HIGH422PROFILE = 5, 35 PP_VIDEOPROFILE_H264HIGH444PREDICTIVEPROFILE = 6, 36 PP_VIDEOPROFILE_H264SCALABLEBASELINE = 7, 37 PP_VIDEOPROFILE_H264SCALABLEHIGH = 8, 38 PP_VIDEOPROFILE_H264STEREOHIGH = 9, 39 PP_VIDEOPROFILE_H264MULTIVIEWHIGH = 10, 40 PP_VIDEOPROFILE_VP8_ANY = 11, 41 PP_VIDEOPROFILE_VP9_ANY = 12, 42 PP_VIDEOPROFILE_MAX = PP_VIDEOPROFILE_VP9_ANY 43 } PP_VideoProfile; 44 45 /** 46 * Audio profiles. 47 */ 48 typedef enum { 49 PP_AUDIOPROFILE_OPUS = 0, 50 PP_AUDIOPROFILE_MAX = PP_AUDIOPROFILE_OPUS 51 } PP_AudioProfile; 52 53 /** 54 * Hardware acceleration options. 55 */ 56 typedef enum { 57 /** Create a hardware accelerated resource only. */ 58 PP_HARDWAREACCELERATION_ONLY = 0, 59 /** 60 * Create a hardware accelerated resource if possible. Otherwise, fall back 61 * to the software implementation. 62 */ 63 PP_HARDWAREACCELERATION_WITHFALLBACK = 1, 64 /** Create the software implementation only. */ 65 PP_HARDWAREACCELERATION_NONE = 2, 66 PP_HARDWAREACCELERATION_LAST = PP_HARDWAREACCELERATION_NONE 67 } PP_HardwareAcceleration; 68 /** 69 * @} 70 */ 71 72 /** 73 * @addtogroup Structs 74 * @{ 75 */ 76 /** 77 * Struct describing a decoded video picture. The decoded picture data is stored 78 * in the GL texture corresponding to |texture_id|. The plugin can determine 79 * which Decode call generated the picture using |decode_id|. 80 */ 81 struct PP_VideoPicture { 82 /** 83 * |decode_id| parameter of the Decode call which generated this picture. 84 * See the PPB_VideoDecoder function Decode() for more details. 85 */ 86 uint32_t decode_id; 87 /** 88 * Texture ID in the plugin's GL context. The plugin can use this to render 89 * the decoded picture. 90 */ 91 uint32_t texture_id; 92 /** 93 * The GL texture target for the decoded picture. Possible values are: 94 * GL_TEXTURE_2D 95 * GL_TEXTURE_RECTANGLE_ARB 96 * GL_TEXTURE_EXTERNAL_OES 97 * 98 * The pixel format of the texture is GL_RGBA. 99 */ 100 uint32_t texture_target; 101 /** 102 * Dimensions of the texture holding the decoded picture. 103 */ 104 struct PP_Size texture_size; 105 /** 106 * The visible subrectangle of the picture. The plugin should display only 107 * this part of the picture. 108 */ 109 struct PP_Rect visible_rect; 110 }; 111 112 /** 113 * Struct describing a decoded video picture. The decoded picture data is stored 114 * in the GL texture corresponding to |texture_id|. The plugin can determine 115 * which Decode call generated the picture using |decode_id|. 116 */ 117 struct PP_VideoPicture_0_1 { 118 /** 119 * |decode_id| parameter of the Decode call which generated this picture. 120 * See the PPB_VideoDecoder function Decode() for more details. 121 */ 122 uint32_t decode_id; 123 /** 124 * Texture ID in the plugin's GL context. The plugin can use this to render 125 * the decoded picture. 126 */ 127 uint32_t texture_id; 128 /** 129 * The GL texture target for the decoded picture. Possible values are: 130 * GL_TEXTURE_2D 131 * GL_TEXTURE_RECTANGLE_ARB 132 * GL_TEXTURE_EXTERNAL_OES 133 * 134 * The pixel format of the texture is GL_RGBA. 135 */ 136 uint32_t texture_target; 137 /** 138 * Dimensions of the texture holding the decoded picture. 139 */ 140 struct PP_Size texture_size; 141 }; 142 143 /** 144 * Supported video profile information. See the PPB_VideoEncoder function 145 * GetSupportedProfiles() for more details. 146 */ 147 struct PP_VideoProfileDescription { 148 /** 149 * The codec profile. 150 */ 151 PP_VideoProfile profile; 152 /** 153 * Dimensions of the maximum resolution of video frames, in pixels. 154 */ 155 struct PP_Size max_resolution; 156 /** 157 * The numerator of the maximum frame rate. 158 */ 159 uint32_t max_framerate_numerator; 160 /** 161 * The denominator of the maximum frame rate. 162 */ 163 uint32_t max_framerate_denominator; 164 /** 165 * Whether the profile is hardware accelerated. 166 */ 167 PP_Bool hardware_accelerated; 168 }; 169 170 /** 171 * Supported video profile information. See the PPB_VideoEncoder function 172 * GetSupportedProfiles() for more details. 173 */ 174 struct PP_VideoProfileDescription_0_1 { 175 /** 176 * The codec profile. 177 */ 178 PP_VideoProfile profile; 179 /** 180 * Dimensions of the maximum resolution of video frames, in pixels. 181 */ 182 struct PP_Size max_resolution; 183 /** 184 * The numerator of the maximum frame rate. 185 */ 186 uint32_t max_framerate_numerator; 187 /** 188 * The denominator of the maximum frame rate. 189 */ 190 uint32_t max_framerate_denominator; 191 /** 192 * A value indicating if the profile is available in hardware, software, or 193 * both. 194 */ 195 PP_HardwareAcceleration acceleration; 196 }; 197 198 /** 199 * Supported audio profile information. See the PPB_AudioEncoder function 200 * GetSupportedProfiles() for more details. 201 */ 202 struct PP_AudioProfileDescription { 203 /** 204 * The codec profile. 205 */ 206 PP_AudioProfile profile; 207 /** 208 * Maximum number of channels that can be encoded. 209 */ 210 uint32_t max_channels; 211 /** 212 * Sample size. 213 */ 214 uint32_t sample_size; 215 /** 216 * Sampling rate that can be encoded 217 */ 218 uint32_t sample_rate; 219 /** 220 * Whether the profile is hardware accelerated. 221 */ 222 PP_Bool hardware_accelerated; 223 }; 224 225 /** 226 * Struct describing a bitstream buffer. 227 */ 228 struct PP_BitstreamBuffer { 229 /** 230 * The size, in bytes, of the bitstream data. 231 */ 232 uint32_t size; 233 /** 234 * The base address of the bitstream data. 235 */ 236 void* buffer; 237 /** 238 * Whether the buffer represents a key frame. 239 */ 240 PP_Bool key_frame; 241 }; 242 243 /** 244 * Struct describing an audio bitstream buffer. 245 */ 246 struct PP_AudioBitstreamBuffer { 247 /** 248 * The size, in bytes, of the bitstream data. 249 */ 250 uint32_t size; 251 /** 252 * The base address of the bitstream data. 253 */ 254 void* buffer; 255 }; 256 /** 257 * @} 258 */ 259 260 #endif /* PPAPI_C_PP_CODECS_H_ */ 261 262