| OLD | NEW |
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 #ifndef PPAPI_C_DEV_PP_VIDEO_DEV_H_ | 5 #ifndef PPAPI_C_DEV_PP_VIDEO_DEV_H_ |
| 6 #define PPAPI_C_DEV_PP_VIDEO_DEV_H_ | 6 #define PPAPI_C_DEV_PP_VIDEO_DEV_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/dev/ppb_opengles_dev.h" | 8 #include "ppapi/c/dev/ppb_opengles_dev.h" |
| 9 #include "ppapi/c/pp_bool.h" | 9 #include "ppapi/c/pp_bool.h" |
| 10 #include "ppapi/c/pp_instance.h" | 10 #include "ppapi/c/pp_instance.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_FMO, | 62 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_FMO, |
| 63 // H264 tool called Arbitrary Slice Ordering. | 63 // H264 tool called Arbitrary Slice Ordering. |
| 64 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_ASO, | 64 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_ASO, |
| 65 // H264 tool called Interlacing. | 65 // H264 tool called Interlacing. |
| 66 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_INTERLACE, | 66 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_INTERLACE, |
| 67 // H264 tool called Context-Adaptive Binary Arithmetic Coding. | 67 // H264 tool called Context-Adaptive Binary Arithmetic Coding. |
| 68 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_CABAC, | 68 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_CABAC, |
| 69 // H264 tool called Weighted Prediction. | 69 // H264 tool called Weighted Prediction. |
| 70 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_WEIGHTEDPREDICTION, | 70 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_WEIGHTEDPREDICTION, |
| 71 | 71 |
| 72 PP_VIDEOATTR_DICTIONARY_COLOR_CORMAT_BASE = 0x1000, | 72 PP_VIDEOATTR_DICTIONARY_COLOR_FORMAT_BASE = 0x1000, |
| 73 // Keys for definining attributes of a color buffer. Using these attributes | 73 // This specifies the output color format for a decoded frame. |
| 74 // users can define color spaces in terms of red, green, blue and alpha | |
| 75 // components as well as with combination of luma and chroma values with | |
| 76 // different subsampling schemes. Also planar, semiplanar and interleaved | |
| 77 // formats can be described by using the provided keys as instructed. | |
| 78 // | 74 // |
| 79 // Rules for describing the color planes (1 or more) that constitute the whole | 75 // Value represents 32-bit RGBA format where each component is 8-bit. |
| 80 // picture are: | 76 PP_VIDEOATTR_COLORFORMAT_RGBA |
| 81 // 1. Each plane starts with PP_VIDEOATTR_COLORFORMATKEY_PLANE_PIXEL_SIZE | |
| 82 // attribute telling how many bits per pixel the plane contains. | |
| 83 // 2. PP_VIDEOATTR_COLORFORMATKEY_PLANE_PIXEL_SIZE attribute must be | |
| 84 // followed either by | |
| 85 // a. Red, green and blue components followed optionally by alpha size | |
| 86 // attribute. | |
| 87 // OR | |
| 88 // b. Luma, blue difference chroma and red difference chroma components as | |
| 89 // well as three sampling reference factors that tell how the chroma may | |
| 90 // have been subsampled with respect to luma. | |
| 91 // 3. Description must be terminated with PP_VIDEOATTR_COLORFORMATKEY_NONE | |
| 92 // key with no value for attribute. | |
| 93 // | |
| 94 // For example, semiplanar YCbCr 4:2:2 (2 planes, one containing 8-bit luma, | |
| 95 // the other containing two interleaved chroma data components) may be | |
| 96 // described with the following attributes: | |
| 97 // { | |
| 98 // PP_VIDEOATTR_COLORFORMATKEY_PLANE_PIXEL_SIZE, 8, | |
| 99 // PP_VIDEOATTR_COLORFORMATKEY_LUMA_SIZE, 8, | |
| 100 // PP_VIDEOATTR_COLORFORMATKEY_PLANE_PIXEL_SIZE, 16, | |
| 101 // PP_VIDEOATTR_COLORFORMATKEY_CHROMA_BLUE_SIZE, 8, | |
| 102 // PP_VIDEOATTR_COLORFORMATKEY_CHROMA_RED_SIZE, 8, | |
| 103 // PP_VIDEOATTR_COLORFORMATKEY_HORIZONTAL_SAMPLING_FACTOR_REFERENCE, 4, | |
| 104 // PP_VIDEOATTR_COLORFORMATKEY_CHROMA_HORIZONTAL_SUBSAMPLING_FACTOR, 2, | |
| 105 // PP_VIDEOATTR_COLORFORMATKEY_CHROMA_VERTICAL_SUBSAMPLING_FACTOR, 2 | |
| 106 // PP_VIDEOATTR_DICTIONARY_TERMINATOR | |
| 107 // } | |
| 108 // | |
| 109 // Another example, commonly known 16-bit RGB 565 color format may be | |
| 110 // specified as follows: | |
| 111 // { | |
| 112 // PP_VIDEOATTR_COLORFORMATKEY_PLANE_PIXEL_SIZE, 16, | |
| 113 // PP_VIDEOATTR_COLORFORMATKEY_RED_SIZE, 5, | |
| 114 // PP_VIDEOATTR_COLORFORMATKEY_GREEN_SIZE, 6, | |
| 115 // PP_VIDEOATTR_COLORFORMATKEY_BLUE_SIZE, 5, | |
| 116 // PP_VIDEOATTR_DICTIONARY_TERMINATOR | |
| 117 // } | |
| 118 // Total color component bits per pixel in the picture buffer. | |
| 119 PP_VIDEOATTR_COLORFORMATKEY_PLANE_PIXEL_SIZE, | |
| 120 // Bits of red per pixel in picture buffer. | |
| 121 PP_VIDEOATTR_COLORFORMATKEY_RED_SIZE, | |
| 122 // Bits of green per pixel in picture buffer. | |
| 123 PP_VIDEOATTR_COLORFORMATKEY_GREEN_SIZE, | |
| 124 // Bits of blue per pixel in picture buffer. | |
| 125 PP_VIDEOATTR_COLORFORMATKEY_BLUE_SIZE, | |
| 126 // Bits of alpha in color buffer. | |
| 127 PP_VIDEOATTR_COLORFORMATKEY_ALPHA_SIZE, | |
| 128 // Bits of luma per pixel in color buffer. | |
| 129 PP_VIDEOATTR_COLORFORMATKEY_LUMA_SIZE, | |
| 130 // Bits of blue difference chroma (Cb) data in color buffer. | |
| 131 PP_VIDEOATTR_COLORFORMATKEY_CHROMA_BLUE_SIZE, | |
| 132 // Bits of blue difference chroma (Cr) data in color buffer. | |
| 133 PP_VIDEOATTR_COLORFORMATKEY_CHROMA_RED_SIZE, | |
| 134 // Three keys to describe the subsampling of YCbCr sampled digital video | |
| 135 // signal. For example, 4:2:2 sampling could be defined by setting: | |
| 136 // PP_VIDEOATTR_COLORFORMATKEY_HORIZONTAL_SAMPLING_FACTOR_REFERENCE = 4 | |
| 137 // PP_VIDEOATTR_COLORFORMATKEY_CHROMINANCE_HORIZONTAL_SUBSAMPLING_FACTOR = 2 | |
| 138 // PP_VIDEOATTR_COLORFORMATKEY_CHROMINANCE_VERTICAL_SUBSAMPLING_FACTOR = 2 | |
| 139 PP_VIDEOATTR_COLORFORMATKEY_HORIZONTAL_SAMPLING_FACTOR_REFERENCE, | |
| 140 PP_VIDEOATTR_COLORFORMATKEY_CHROMA_HORIZONTAL_SUBSAMPLING_FACTOR, | |
| 141 PP_VIDEOATTR_COLORFORMATKEY_CHROMA_VERTICAL_SUBSAMPLING_FACTOR, | |
| 142 // Base for telling implementation specific information about the optimal | |
| 143 // number of picture buffers to be provided to the implementation. | |
| 144 PP_VIDEOATTR_DICTIONARY_PICTUREBUFFER_REQUIREMENTS_BASE = 0x10000, | |
| 145 // Following two keys are used to signal how many buffers are needed by the | |
| 146 // implementation as a function of the maximum number of reference frames set | |
| 147 // by the stream. Number of required buffers is | |
| 148 // MAX_REF_FRAMES * REFERENCE_PIC_MULTIPLIER + ADDITIONAL_BUFFERS | |
| 149 PP_VIDEOATTR_PICTUREBUFFER_REQUIREMENTS_ADDITIONAL_BUFFERS, | |
| 150 PP_VIDEOATTR_PICTUREBUFFER_REQUIREMENTS_REFERENCE_PIC_MULTIPLIER, | |
| 151 // If decoder does not support pixel accurate strides for picture buffer, this | |
| 152 // parameter tells the stride multiple that is needed by the decoder. Plugin | |
| 153 // must obey the given stride in its picture buffer allocations. | |
| 154 PP_VIDEOATTR_PICTUREBUFFER_REQUIREMENTS_STRIDE_MULTIPLE | |
| 155 }; | 77 }; |
| 156 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoAttributeDictionary, 4); | 78 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoAttributeDictionary, 4); |
| 157 typedef int32_t* PP_VideoConfigElement; | 79 typedef int32_t PP_VideoConfigElement; |
| 158 | 80 |
| 159 enum PP_VideoCodecFourcc { | 81 enum PP_VideoCodecFourcc { |
| 160 PP_VIDEOCODECFOURCC_NONE = 0, | 82 PP_VIDEOCODECFOURCC_NONE = 0, |
| 161 PP_VIDEOCODECFOURCC_VP8 = 0x00385056, // a.k.a. Fourcc 'VP8\0'. | 83 PP_VIDEOCODECFOURCC_VP8 = 0x00385056, // a.k.a. Fourcc 'VP8\0'. |
| 162 PP_VIDEOCODECFOURCC_H264 = 0x31637661 // a.k.a. Fourcc 'avc1'. | 84 PP_VIDEOCODECFOURCC_H264 = 0x31637661 // a.k.a. Fourcc 'avc1'. |
| 163 }; | 85 }; |
| 164 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoCodecFourcc, 4); | 86 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoCodecFourcc, 4); |
| 165 | 87 |
| 166 // VP8 specific information to be carried over the APIs. | 88 // VP8 specific information to be carried over the APIs. |
| 167 // Enumeration for flags defining supported VP8 profiles. | 89 // Enumeration for flags defining supported VP8 profiles. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // Enumeration to determine which type of memory for buffer is used. | 156 // Enumeration to determine which type of memory for buffer is used. |
| 235 enum PP_PictureBufferType_Dev { | 157 enum PP_PictureBufferType_Dev { |
| 236 PP_PICTUREBUFFERTYPE_NONE = 0, | 158 PP_PICTUREBUFFERTYPE_NONE = 0, |
| 237 // System memory a.k.a. RAM. | 159 // System memory a.k.a. RAM. |
| 238 PP_PICTUREBUFFERTYPE_SYSTEM = 1, | 160 PP_PICTUREBUFFERTYPE_SYSTEM = 1, |
| 239 // GLES texture allocated using OpenGL ES APIs. | 161 // GLES texture allocated using OpenGL ES APIs. |
| 240 PP_PICTUREBUFFERTYPE_GLESTEXTURE = 1 << 1 | 162 PP_PICTUREBUFFERTYPE_GLESTEXTURE = 1 << 1 |
| 241 }; | 163 }; |
| 242 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_PictureBufferType_Dev, 4); | 164 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_PictureBufferType_Dev, 4); |
| 243 | 165 |
| 244 // Structure to describe storage properties for a picture. | |
| 245 struct PP_PictureBufferProperties_Dev { | |
| 246 // Size of the storage (as per width & height in pixels). | |
| 247 struct PP_Size size; | |
| 248 | |
| 249 // Type of the picture buffer (GLES, system memory). | |
| 250 enum PP_PictureBufferType_Dev type; | |
| 251 | |
| 252 // Key-attribute pairs defining color format for the buffer. | |
| 253 PP_VideoConfigElement color_format; | |
| 254 }; | |
| 255 | |
| 256 // Requested decoder configuration and callback from plugin. | |
| 257 struct PP_VideoDecoderConfig_Dev { | |
| 258 // Input bitstream properties. | |
| 259 PP_VideoConfigElement bitstream_properties; | |
| 260 // Output picture properties. | |
| 261 struct PP_PictureBufferProperties_Dev picture_properties; | |
| 262 }; | |
| 263 | |
| 264 // The data structure for video bitstream buffer. | 166 // The data structure for video bitstream buffer. |
| 265 struct PP_VideoBitstreamBuffer_Dev { | 167 struct PP_VideoBitstreamBuffer_Dev { |
| 266 // Buffer to hold the bitstream data. Should be allocated using the PPB_Buffer | 168 // Buffer to hold the bitstream data. Should be allocated using the PPB_Buffer |
| 267 // interface for consistent interprocess behaviour. | 169 // interface for consistent interprocess behaviour. |
| 268 PP_Resource bitstream; | 170 PP_Resource bitstream; |
| 269 | 171 |
| 270 // Size of the bitstream contained in buffer (in bytes). | 172 // Size of the bitstream contained in buffer (in bytes). |
| 271 int32_t bitstream_size; | 173 int32_t bitstream_size; |
| 272 | 174 |
| 273 // Optional pointer for application to associate information with a sample. | 175 // Handle to identify the bitstream buffer. |
| 274 // The pointer will be associated with the resulting decoded picture. | |
| 275 // Typically applications associate timestamps with buffers. | |
| 276 void* user_handle; | 176 void* user_handle; |
| 277 | |
| 278 // TODO(vmr): Add information about access unit boundaries. | |
| 279 }; | 177 }; |
| 280 | 178 |
| 281 // Union for specifying picture data. | 179 // Struct for specifying data about buffer. |
| 282 union PP_PictureData_Dev { | 180 struct PP_BufferInfo_Dev { |
| 283 // Resource representing system memory from shared memory address space. | |
| 284 // Use PPB_Buffer_Dev interface to handle this resource. | |
| 285 PP_Resource sysmem; | |
| 286 | |
| 287 // Structure to define explicitly a GLES2 context. | |
| 288 struct { | |
| 289 // Context allocated using PPB_Context3D_Dev. | |
| 290 PP_Resource context; | |
| 291 | |
| 292 // Texture ID in the given context where picture is stored. | |
| 293 GLuint texture_id; | |
| 294 } gles2_texture; | |
| 295 | |
| 296 // Client-specified id for the picture buffer. By using this value client can | 181 // Client-specified id for the picture buffer. By using this value client can |
| 297 // keep track of the buffers it has assigned to the video decoder and how they | 182 // keep track of the buffers it has assigned to the video decoder and how they |
| 298 // are passed back to it. | 183 // are passed back to it. |
| 299 int32_t id; | 184 int32_t id; |
| 185 |
| 186 // Dimensions of the buffer. |
| 187 struct PP_Size size; |
| 300 }; | 188 }; |
| 301 | 189 |
| 302 // Structure to describe the decoded output picture for the plug-in along with | 190 // Struct for specifying texture-backed picture data. |
| 303 // optional metadata associated with the picture. | 191 struct PP_GLESBuffer_Dev { |
| 192 // Context allocated using PPB_Context3D_Dev. |
| 193 PP_Resource context; |
| 194 |
| 195 // Texture ID in the given context where picture is stored. |
| 196 GLuint texture_id; |
| 197 |
| 198 // Information about the buffer. |
| 199 struct PP_BufferInfo_Dev info; |
| 200 }; |
| 201 |
| 202 // Struct for specifying sysmem-backed picture data. |
| 203 struct PP_SysmemBuffer_Dev { |
| 204 // Resource representing system memory from shared memory address space. |
| 205 // Use PPB_Buffer_Dev interface to handle this resource. |
| 206 PP_Resource data; |
| 207 |
| 208 // Information about the buffer. |
| 209 struct PP_BufferInfo_Dev info; |
| 210 }; |
| 211 |
| 212 // Structure to describe a decoded output frame. |
| 213 // The decoded pixels will always begin flush with the upper left-hand corner |
| 214 // of the buffer (0, 0). |
| 304 struct PP_Picture_Dev { | 215 struct PP_Picture_Dev { |
| 305 // Resource that represents the buffer where the picture data is stored. | 216 // ID of the picture buffer where the picture is stored. |
| 306 // Actual implementation style of the picture buffer may be OpenGL ES texture | 217 int32_t picture_buffer_id; |
| 307 // (allocated using PPB_OpenGLES2_Dev) or system memory (allocated using | |
| 308 // PPB_Buffer_Dev). | |
| 309 union PP_PictureData_Dev picture_data; | |
| 310 | 218 |
| 311 // Optional pointer to associated metadata with the picture. Typical | 219 // Visible size of the picture. |
| 312 // information carried over metadata includes timestamps. If there is | 220 // This describes the dimensions of the picture that is intended to be |
| 313 // multiple NAL units each with their own respective metadata, only the | 221 // displayed from the decoded output. |
| 314 // metadata from the latest call to Decode will be carried over. | 222 struct PP_Size visible_size; |
| 315 void* user_handle; | 223 |
| 224 // Decoded size of the picture. |
| 225 // This describes the dimensions of the decoded output. This may be slightly |
| 226 // larger than the visible size because the stride is sometimes larger than |
| 227 // the width of the output. The plugin should handle rendering the frame |
| 228 // appropriately with respect to the sizes. |
| 229 struct PP_Size decoded_size; |
| 230 |
| 231 // Handle to identify the bitstream buffer from which this picture was |
| 232 // decoded. |
| 233 void* bitstream_user_handle; |
| 316 }; | 234 }; |
| 317 | 235 |
| 318 // Enumeration for error events that may be reported through | 236 // Enumeration for error events that may be reported through |
| 319 // PP_VideoDecodeErrorHandler_Func_Dev callback function to the plugin. Default | 237 // PP_VideoDecodeErrorHandler_Func_Dev callback function to the plugin. Default |
| 320 // error handling functionality expected from the plugin is to Flush and Destroy | 238 // error handling functionality expected from the plugin is to Flush and Destroy |
| 321 // the decoder. | 239 // the decoder. |
| 322 enum PP_VideoDecodeError_Dev { | 240 enum PP_VideoDecodeError_Dev { |
| 323 PP_VIDEODECODEERROR_NONE = 0, | 241 PP_VIDEODECODEERROR_NONE = 0, |
| 324 // Decoder has not been initialized and configured properly. | 242 // Decoder has not been initialized and configured properly. |
| 325 PP_VIDEODECODEERROR_UNINITIALIZED, | 243 PP_VIDEODECODEERROR_UNINITIALIZED, |
| 326 // Decoder does not support feature of configuration or bitstream. | 244 // Decoder does not support feature of configuration or bitstream. |
| 327 PP_VIDEODECODEERROR_UNSUPPORTED, | 245 PP_VIDEODECODEERROR_UNSUPPORTED, |
| 328 // Decoder did not get valid input. | 246 // Decoder did not get valid input. |
| 329 PP_VIDEODECODERERROR_INVALIDINPUT, | 247 PP_VIDEODECODERERROR_INVALIDINPUT, |
| 330 // Failure in memory allocation or mapping. | 248 // Failure in memory allocation or mapping. |
| 331 PP_VIDEODECODERERROR_MEMFAILURE, | 249 PP_VIDEODECODERERROR_MEMFAILURE, |
| 332 // Decoder was given bitstream that would result in output pictures but it | 250 // Decoder was given bitstream that would result in output pictures but it |
| 333 // has not been provided buffers to do all this. | 251 // has not been provided buffers to do all this. |
| 334 PP_VIDEODECODEERROR_INSUFFICIENT_BUFFERS, | 252 PP_VIDEODECODEERROR_INSUFFICIENT_BUFFERS, |
| 335 // Decoder cannot continue operation due to insufficient resources for the | 253 // Decoder cannot continue operation due to insufficient resources for the |
| 336 // current configuration. | 254 // current configuration. |
| 337 PP_VIDEODECODEERROR_INSUFFICIENTRESOURCES, | 255 PP_VIDEODECODEERROR_INSUFFICIENTRESOURCES, |
| 338 // Decoder hardware has reported hardware error. | 256 // Decoder hardware has reported hardware error. |
| 339 PP_VIDEODECODEERROR_HARDWARE | 257 PP_VIDEODECODEERROR_HARDWARE |
| 340 }; | 258 }; |
| 341 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoDecodeError_Dev, 4); | 259 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoDecodeError_Dev, 4); |
| 342 | 260 |
| 343 #endif /* PPAPI_C_DEV_PP_VIDEO_DEV_H_ */ | 261 #endif /* PPAPI_C_DEV_PP_VIDEO_DEV_H_ */ |
| OLD | NEW |