Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: ppapi/c/dev/pp_video_dev.h

Issue 6901036: Update VideoDecode PPAPI structs to be consistent with media structures, part 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing a few parameter types Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 74 PP_VIDEOATTR_COLORFORMAT_RGBA
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 Comment this is 32-bit, 8bit per each of RGBA?
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 Done.
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 //
79 // Rules for describing the color planes (1 or more) that constitute the whole
80 // picture are:
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 }; 75 };
156 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoAttributeDictionary, 4); 76 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoAttributeDictionary, 4);
157 typedef int32_t* PP_VideoConfigElement; 77 typedef int32_t PP_VideoConfigElement;
158 78
159 enum PP_VideoCodecFourcc { 79 enum PP_VideoCodecFourcc {
160 PP_VIDEOCODECFOURCC_NONE = 0, 80 PP_VIDEOCODECFOURCC_NONE = 0,
161 PP_VIDEOCODECFOURCC_VP8 = 0x00385056, // a.k.a. Fourcc 'VP8\0'. 81 PP_VIDEOCODECFOURCC_VP8 = 0x00385056, // a.k.a. Fourcc 'VP8\0'.
162 PP_VIDEOCODECFOURCC_H264 = 0x31637661 // a.k.a. Fourcc 'avc1'. 82 PP_VIDEOCODECFOURCC_H264 = 0x31637661 // a.k.a. Fourcc 'avc1'.
163 }; 83 };
164 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoCodecFourcc, 4); 84 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoCodecFourcc, 4);
165 85
166 // VP8 specific information to be carried over the APIs. 86 // VP8 specific information to be carried over the APIs.
167 // Enumeration for flags defining supported VP8 profiles. 87 // Enumeration for flags defining supported VP8 profiles.
168 enum PP_VP8Profile_Dev { 88 enum PP_VP8Profile_Dev {
169 PP_VP8PROFILE_NONE = 0, 89 PP_VP8PROFILE_NONE = 0,
170 PP_VP8PROFILE_0 = 1, 90 PP_VP8PROFILE_0 = 1,
171 PP_VP8PROFILE_1 = 1 << 1, 91 PP_VP8PROFILE_1 = 1 << 1,
172 PP_VP8PROFILE_2 = 1 << 2, 92 PP_VP8PROFILE_2 = 1 << 2,
173 PP_VP8PROFILE_3 = 1 << 3 93 PP_VP8PROFILE_3 = 1 << 3
174 }; 94 };
175 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VP8Profile_Dev, 4); 95 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VP8Profile_Dev, 4);
176 96
177 // H.264 specific information to be carried over the APIs. 97 // H.264 specific information to be carried over the APIs.
178 // Enumeration for flags defining supported H.264 profiles. 98 // Enumeration for flags defining supported H.264 profiles.
179 enum PP_H264Profile_Dev { 99 enum PP_H264Profile_Dev {
180 PP_H264PROFILE_NONE = 0, 100 PP_H264PROFILE_NONE = 0,
181 PP_H264PROFILE_BASELINE = 1, 101 PP_H264PROFILE_BASELINE = 1,
182 PP_H264PROFILE_MAIN = 1 << 2, 102 PP_H264PROFILE_MAIN = 1 << 2,
183 PP_H264PROFILE_EXTENDED = 1 << 3, 103 PP_H264PROFILE_EXTENDED = 1 << 3,
184 PP_H264PROFILE_HIGH = 1 << 4, 104 PP_H264PROFILE_HIGH = 1 << 4,
185 PP_H264PROFILE_HIGH10PROFILE = 1 << 5, 105 PP_H264PROFILE_HIGH10PROFILE = 1 << 5,
186 PP_H264PROFILE_HIGH422PROFILE = 1 << 6, 106 PP_H264PROFILE_HIGH422PROFILE = 1 << 6,
187 PP_H264PROFILE_HIGH444PREDICTIVEPROFILE = 1 << 7, 107 PP_H264PROFILE_HIGH444PREDICTIVEPROFILE= 1 << 7,
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 ??
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 My bad! Reverted.
188 PP_H264PROFILE_SCALABLEBASELINE = 1 << 8, 108 PP_H264PROFILE_SCALABLEBASELINE = 1 << 8,
189 PP_H264PROFILE_SCALABLEHIGH = 1 << 9, 109 PP_H264PROFILE_SCALABLEHIGH = 1 << 9,
190 PP_H264PROFILE_STEREOHIGH = 1 << 10, 110 PP_H264PROFILE_STEREOHIGH = 1 << 10,
191 PP_H264PROFILE_MULTIVIEWHIGH = 1 << 11 111 PP_H264PROFILE_MULTIVIEWHIGH = 1 << 11
192 }; 112 };
193 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_H264Profile_Dev, 4); 113 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_H264Profile_Dev, 4);
194 114
195 // Enumeration for defining H.264 level of decoder implementation. 115 // Enumeration for defining H.264 level of decoder implementation.
196 enum PP_H264Level_Dev { 116 enum PP_H264Level_Dev {
197 PP_H264LEVEL_NONE = 0, 117 PP_H264LEVEL_NONE = 0,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // Enumeration to determine which type of memory for buffer is used. 154 // Enumeration to determine which type of memory for buffer is used.
235 enum PP_PictureBufferType_Dev { 155 enum PP_PictureBufferType_Dev {
236 PP_PICTUREBUFFERTYPE_NONE = 0, 156 PP_PICTUREBUFFERTYPE_NONE = 0,
237 // System memory a.k.a. RAM. 157 // System memory a.k.a. RAM.
238 PP_PICTUREBUFFERTYPE_SYSTEM = 1, 158 PP_PICTUREBUFFERTYPE_SYSTEM = 1,
239 // GLES texture allocated using OpenGL ES APIs. 159 // GLES texture allocated using OpenGL ES APIs.
240 PP_PICTUREBUFFERTYPE_GLESTEXTURE = 1 << 1 160 PP_PICTUREBUFFERTYPE_GLESTEXTURE = 1 << 1
241 }; 161 };
242 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_PictureBufferType_Dev, 4); 162 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_PictureBufferType_Dev, 4);
243 163
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. 164 // The data structure for video bitstream buffer.
265 struct PP_VideoBitstreamBuffer_Dev { 165 struct PP_VideoBitstreamBuffer_Dev {
266 // Buffer to hold the bitstream data. Should be allocated using the PPB_Buffer 166 // Buffer to hold the bitstream data. Should be allocated using the PPB_Buffer
267 // interface for consistent interprocess behaviour. 167 // interface for consistent interprocess behaviour.
268 PP_Resource bitstream; 168 PP_Resource bitstream;
269 169
270 // Size of the bitstream contained in buffer (in bytes). 170 // Size of the bitstream contained in buffer (in bytes).
271 int32_t bitstream_size; 171 int32_t bitstream_size;
272 172
273 // Optional pointer for application to associate information with a sample. 173 // 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; 174 void* user_handle;
277
278 // TODO(vmr): Add information about access unit boundaries.
279 }; 175 };
280 176
281 // Union for specifying picture data. 177 // Struct for specifiying picture buffers.
282 union PP_PictureData_Dev { 178 struct PP_PictureBuffer_Dev {
283 // Resource representing system memory from shared memory address space. 179 // Client-specified id for the picture buffer.
284 // Use PPB_Buffer_Dev interface to handle this resource.
285 PP_Resource sysmem;
286 // Structure to define explicitly a GLES2 context.
287 struct {
288 // Context allocated using PPB_Context3D_Dev.
289 PP_Resource context;
290 // Texture ID in the given context where picture is stored.
291 GLuint texture_id;
292 } gles2_texture;
293 // Client-specified id for the picture buffer. By using this value client can
294 // keep track of the buffers it has assigned to the video decoder and how they
295 // are passed back to it.
296 int32_t id; 180 int32_t id;
181
182 union {
183 // Resource representing system memory from shared memory address space.
184 // Use PPB_Buffer_Dev interface to handle this resource.
185 PP_Resource sysmem;
186 // Structure to define explicitly a GLES2 context.
187 struct {
188 // Context allocated using PPB_Context3D_Dev.
189 PP_Resource context_id;
190 // Texture ID in the given context where picture is stored.
191 GLuint texture_id;
192 } gles2_texture;
193 } data;
194
195 // Dimensions of the buffer.
196 struct PP_Size dimensions;
197
198 // Type of data stored in planes.
199 enum PP_PictureBufferType_Dev storage_type;
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 IMO this goes better right before or after the uni
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 n/a now
297 }; 200 };
298 201
299 // Structure to describe the decoded output picture for the plug-in along with 202 // Structure to describe the decoded output picture for the plug-in along with
300 // optional metadata associated with the picture. 203 // optional metadata associated with the picture.
301 struct PP_Picture_Dev { 204 struct PP_Picture_Dev {
302 // Resource that represents the buffer where the picture data is stored. 205 // ID for the picture buffer where the picture is stored.
303 // Actual implementation style of the picture buffer may be OpenGL ES texture 206 int32_t picture_buffer_id;
304 // (allocated using PPB_OpenGLES2_Dev) or system memory (allocated using
305 // PPB_Buffer_Dev).
306 union PP_PictureData_Dev picture_data;
307 207
308 // Optional pointer to associated metadata with the picture. Typical 208 // Handle to identify the bitstream buffer from which this picture was
309 // information carried over metadata includes timestamps. If there is 209 // decoded.
310 // multiple NAL units each with their own respective metadata, only the 210 void* bitstream_user_handle;
311 // metadata from the latest call to Decode will be carried over. 211
312 void* user_handle; 212 // Visible size of the picture.
213 struct PP_Size visible_size;
Ami GONE FROM CHROMIUM 2011/04/29 18:40:34 Should this be a PP_Rect to describe the offset/po
vrk (LEFT CHROMIUM) 2011/05/03 18:19:58 I think the decoder will always decode flush to th
214
215 // Decoded size of the picture.
216 struct PP_Size decoded_size;
313 }; 217 };
314 218
315 // Enumeration for error events that may be reported through 219 // Enumeration for error events that may be reported through
316 // PP_VideoDecodeErrorHandler_Func_Dev callback function to the plugin. Default 220 // PP_VideoDecodeErrorHandler_Func_Dev callback function to the plugin. Default
317 // error handling functionality expected from the plugin is to Flush and Destroy 221 // error handling functionality expected from the plugin is to Flush and Destroy
318 // the decoder. 222 // the decoder.
319 enum PP_VideoDecodeError_Dev { 223 enum PP_VideoDecodeError_Dev {
320 PP_VIDEODECODEERROR_NONE = 0, 224 PP_VIDEODECODEERROR_NONE = 0,
321 // Decoder has not been initialized and configured properly. 225 // Decoder has not been initialized and configured properly.
322 PP_VIDEODECODEERROR_UNINITIALIZED, 226 PP_VIDEODECODEERROR_UNINITIALIZED,
323 // Decoder does not support feature of configuration or bitstream. 227 // Decoder does not support feature of configuration or bitstream.
324 PP_VIDEODECODEERROR_UNSUPPORTED, 228 PP_VIDEODECODEERROR_UNSUPPORTED,
325 // Decoder did not get valid input. 229 // Decoder did not get valid input.
326 PP_VIDEODECODERERROR_INVALIDINPUT, 230 PP_VIDEODECODERERROR_INVALIDINPUT,
327 // Failure in memory allocation or mapping. 231 // Failure in memory allocation or mapping.
328 PP_VIDEODECODERERROR_MEMFAILURE, 232 PP_VIDEODECODERERROR_MEMFAILURE,
329 // Decoder was given bitstream that would result in output pictures but it 233 // Decoder was given bitstream that would result in output pictures but it
330 // has not been provided buffers to do all this. 234 // has not been provided buffers to do all this.
331 PP_VIDEODECODEERROR_INSUFFICIENT_BUFFERS, 235 PP_VIDEODECODEERROR_INSUFFICIENT_BUFFERS,
332 // Decoder cannot continue operation due to insufficient resources for the 236 // Decoder cannot continue operation due to insufficient resources for the
333 // current configuration. 237 // current configuration.
334 PP_VIDEODECODEERROR_INSUFFICIENTRESOURCES, 238 PP_VIDEODECODEERROR_INSUFFICIENTRESOURCES,
335 // Decoder hardware has reported hardware error. 239 // Decoder hardware has reported hardware error.
336 PP_VIDEODECODEERROR_HARDWARE 240 PP_VIDEODECODEERROR_HARDWARE
337 }; 241 };
338 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoDecodeError_Dev, 4); 242 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoDecodeError_Dev, 4);
339 243
340 #endif /* PPAPI_C_DEV_PP_VIDEO_DEV_H_ */ 244 #endif /* PPAPI_C_DEV_PP_VIDEO_DEV_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698