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

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

Issue 7779001: Replace the use of an int32* with a proper struct for decoder configuration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Replaced struct with explicit profile parameter. Created 9 years, 3 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"
11 #include "ppapi/c/pp_macros.h" 11 #include "ppapi/c/pp_macros.h"
12 #include "ppapi/c/pp_resource.h" 12 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/c/pp_size.h" 13 #include "ppapi/c/pp_size.h"
14 #include "ppapi/c/pp_stdint.h" 14 #include "ppapi/c/pp_stdint.h"
15 15
16 // Enumeration defining global dictionary ranges for various purposes that are 16 // Video decoder configuration-related enums.
17 // used to handle the configurations of the video decoder.
18 //
19 // IMPORTANT! Dictionary keys and corresponding values MUST match the ones found
20 // in VideoDecodeAccelerator interface in Chromium media stack
21 // (media/video/video_decode_accelerator.h)!
22 enum PP_VideoAttributeDictionary {
23 PP_VIDEOATTR_DICTIONARY_TERMINATOR = 0,
24 17
25 PP_VIDEOATTR_DICTIONARY_BITSTREAM_FORMAT_BASE = 0x100, 18 // NOTE: these must be kept in sync with the versions in
26 // Array of key/value pairs describing video configuration. 19 // media/video/video_decode_accelerator.h!
27 // It could include any keys from PP_VideoKey. Its last element shall be
28 // PP_VIDEOATTR_BITSTREAMFORMATKEY_NONE with no corresponding value.
29 // An example:
30 // {
31 // PP_VIDEOATTR_BITSTREAMFORMATKEY_FOURCC, PP_VIDEODECODECID_VP8,
32 // PP_VIDEOATTR_BITSTREAMFORMATKEY_VP8_PROFILE, (PP_VP8PROFILE_1 |
33 // PP_VP8PROFILE_2 |
34 // PP_VP8PROFILE_3),
35 // PP_VIDEOATTR_DICTIONARY_TERMINATOR
36 // };
37 // Keys for defining video bitstream format.
38 // Value is type of PP_VideoCodecFourcc. Commonly known attributes values are
39 // defined in PP_VideoCodecFourcc enumeration.
40 PP_VIDEOATTR_BITSTREAMFORMATKEY_FOURCC,
41 // Bitrate in bits/s. Attribute value is 32-bit unsigned integer.
42 PP_VIDEOATTR_BITSTREAMFORMATKEY_BITRATE,
43 // Width and height of the input video bitstream, if known by the application.
44 // Decoder will expect the bitstream to match these values and does memory
45 // considerations accordingly.
46 PP_VIDEOATTR_BITSTREAMFORMATKEY_WIDTH,
47 PP_VIDEOATTR_BITSTREAMFORMATKEY_HEIGHT,
48 // Following attributes are applicable only in case of VP8.
49 // Key for VP8 profile attribute. Attribute value is bitmask of flags defined
50 // in PP_VP8Profile_Dev enumeration.
51 PP_VIDEOATTR_BITSTREAMFORMATKEY_VP8_PROFILE,
52 // Number of partitions per picture. Attribute value is unsigned 32-bit
53 // integer.
54 PP_VIDEOATTR_BITSTREAMFORMATKEY_VP8_NUM_OF_PARTITIONS,
55 // Following attributes are applicable only in case of H.264.
56 // Value is bitmask collection from the flags defined in PP_H264Profile.
57 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_PROFILE,
58 // Value is type of PP_H264Level.
59 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_LEVEL,
60 // Value is type of PP_H264PayloadFormat_Dev.
61 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_PAYLOADFORMAT,
62 // Subset for H.264 features, attribute value 0 signifies unsupported.
63 // This is needed in case decoder has partial support for certain profile.
64 // Default for features are enabled if they're part of supported profile.
65 // H264 tool called Flexible Macroblock Ordering.
66 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_FMO,
67 // H264 tool called Arbitrary Slice Ordering.
68 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_ASO,
69 // H264 tool called Interlacing.
70 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_INTERLACE,
71 // H264 tool called Context-Adaptive Binary Arithmetic Coding.
72 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_CABAC,
73 // H264 tool called Weighted Prediction.
74 PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_WEIGHTEDPREDICTION,
75 20
76 PP_VIDEOATTR_DICTIONARY_COLOR_FORMAT_BASE = 0x1000, 21 // Video stream profile.
77 // This specifies the output color format for a decoded frame. Value is one 22 enum PP_VideoDecoder_Profile {
78 // of the values in PP_ColorFormat_Dev enumeration. 23 // Keep the values in this enum unique, as they imply format (h.264 vs. VP8,
79 PP_VIDEOATTR_PICTUREFORMATKEY_COLORFORMAT 24 // for example), and keep the values for a particular format grouped together
25 // for clarity.
26 PP_VIDEODECODER_H264PROFILE_NONE = 0,
27 PP_VIDEODECODER_H264PROFILE_BASELINE,
28 PP_VIDEODECODER_H264PROFILE_MAIN,
29 PP_VIDEODECODER_H264PROFILE_EXTENDED,
30 PP_VIDEODECODER_H264PROFILE_HIGH,
31 PP_VIDEODECODER_H264PROFILE_HIGH10PROFILE,
32 PP_VIDEODECODER_H264PROFILE_HIGH422PROFILE,
33 PP_VIDEODECODER_H264PROFILE_HIGH444PREDICTIVEPROFILE,
34 PP_VIDEODECODER_H264PROFILE_SCALABLEBASELINE,
35 PP_VIDEODECODER_H264PROFILE_SCALABLEHIGH,
36 PP_VIDEODECODER_H264PROFILE_STEREOHIGH,
37 PP_VIDEODECODER_H264PROFILE_MULTIVIEWHIGH
80 }; 38 };
81 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoAttributeDictionary, 4);
82 typedef int32_t PP_VideoConfigElement;
83
84 enum PP_VideoCodecFourcc {
85 PP_VIDEOCODECFOURCC_NONE = 0,
86 PP_VIDEOCODECFOURCC_VP8 = 0x00385056, // a.k.a. Fourcc 'VP8\0'.
87 PP_VIDEOCODECFOURCC_H264 = 0x31637661 // a.k.a. Fourcc 'avc1'.
88 };
89 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoCodecFourcc, 4);
90
91 // VP8 specific information to be carried over the APIs.
92 // Enumeration for flags defining supported VP8 profiles.
93 enum PP_VP8Profile_Dev {
94 PP_VP8PROFILE_NONE = 0,
95 PP_VP8PROFILE_0 = 1,
96 PP_VP8PROFILE_1 = 1 << 1,
97 PP_VP8PROFILE_2 = 1 << 2,
98 PP_VP8PROFILE_3 = 1 << 3
99 };
100 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VP8Profile_Dev, 4);
101
102 // H.264 specific information to be carried over the APIs.
103 // Enumeration for flags defining supported H.264 profiles.
104 enum PP_H264Profile_Dev {
105 PP_H264PROFILE_NONE = 0,
106 PP_H264PROFILE_BASELINE = 1,
107 PP_H264PROFILE_MAIN = 1 << 2,
108 PP_H264PROFILE_EXTENDED = 1 << 3,
109 PP_H264PROFILE_HIGH = 1 << 4,
110 PP_H264PROFILE_HIGH10PROFILE = 1 << 5,
111 PP_H264PROFILE_HIGH422PROFILE = 1 << 6,
112 PP_H264PROFILE_HIGH444PREDICTIVEPROFILE = 1 << 7,
113 PP_H264PROFILE_SCALABLEBASELINE = 1 << 8,
114 PP_H264PROFILE_SCALABLEHIGH = 1 << 9,
115 PP_H264PROFILE_STEREOHIGH = 1 << 10,
116 PP_H264PROFILE_MULTIVIEWHIGH = 1 << 11
117 };
118 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_H264Profile_Dev, 4);
119
120 // Enumeration for defining H.264 level of decoder implementation.
121 enum PP_H264Level_Dev {
122 PP_H264LEVEL_NONE = 0,
123 PP_H264LEVEL_10 = 1,
124 PP_H264LEVEL_1B = PP_H264LEVEL_10 | 1 << 1,
125 PP_H264LEVEL_11 = PP_H264LEVEL_1B | 1 << 2,
126 PP_H264LEVEL_12 = PP_H264LEVEL_11 | 1 << 3,
127 PP_H264LEVEL_13 = PP_H264LEVEL_12 | 1 << 4,
128 PP_H264LEVEL_20 = PP_H264LEVEL_13 | 1 << 5,
129 PP_H264LEVEL_21 = PP_H264LEVEL_20 | 1 << 6,
130 PP_H264LEVEL_22 = PP_H264LEVEL_21 | 1 << 7,
131 PP_H264LEVEL_30 = PP_H264LEVEL_22 | 1 << 8,
132 PP_H264LEVEL_31 = PP_H264LEVEL_30 | 1 << 9,
133 PP_H264LEVEL_32 = PP_H264LEVEL_31 | 1 << 10,
134 PP_H264LEVEL_40 = PP_H264LEVEL_32 | 1 << 11,
135 PP_H264LEVEL_41 = PP_H264LEVEL_40 | 1 << 12,
136 PP_H264LEVEL_42 = PP_H264LEVEL_41 | 1 << 13,
137 PP_H264LEVEL_50 = PP_H264LEVEL_42 | 1 << 14,
138 PP_H264LEVEL_51 = PP_H264LEVEL_50 | 1 << 15
139 };
140 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_H264Level_Dev, 4);
141
142 // Enumeration to describe which payload format is used within the exchanged
143 // bitstream buffers.
144 enum PP_H264PayloadFormat_Dev {
145 PP_H264PAYLOADFORMAT_NONE = 0,
146 // NALUs separated by Start Code.
147 PP_H264PAYLOADFORMAT_BYTESTREAM = 1,
148 // Exactly one raw NALU per buffer.
149 PP_H264PAYLOADFORMAT_ONE_NALU_PER_BUFFER = 1 << 1,
150 // NALU separated by 1-byte interleaved length field.
151 PP_H264PAYLOADFORMAT_ONE_BYTE_INTERLEAVED_LENGTH = 1 << 2,
152 // NALU separated by 2-byte interleaved length field.
153 PP_H264PAYLOADFORMAT_TWO_BYTE_INTERLEAVED_LENGTH = 1 << 3,
154 // NALU separated by 4-byte interleaved length field.
155 PP_H264PAYLOADFORMAT_FOUR_BYTE_INTERLEAVED_LENGTH = 1 << 4
156 };
157 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_H264PayloadFormat_Dev, 4);
158
159 // Enumeration for various color formats.
160 enum PP_ColorFormat_Dev {
161 // Value represents 32-bit RGBA format where each component is 8-bit in order
162 // R-G-B-A. Regardless of endianness of the architecture color components are
163 // stored in this order in the memory.
164 PP_VIDEOATTR_COLORFORMAT_RGBA = 0
165 };
166 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_ColorFormat_Dev, 4);
167 39
168 // The data structure for video bitstream buffer. 40 // The data structure for video bitstream buffer.
169 struct PP_VideoBitstreamBuffer_Dev { 41 struct PP_VideoBitstreamBuffer_Dev {
170 // Client-specified identifier for the bitstream buffer. 42 // Client-specified identifier for the bitstream buffer.
171 int32_t id; 43 int32_t id;
172 44
173 // Buffer to hold the bitstream data. Should be allocated using the PPB_Buffer 45 // Buffer to hold the bitstream data. Should be allocated using the PPB_Buffer
174 // interface for consistent interprocess behaviour. 46 // interface for consistent interprocess behaviour.
175 PP_Resource data; 47 PP_Resource data;
176 48
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // Encoded input is unreadable. 84 // Encoded input is unreadable.
213 PP_VIDEODECODERERROR_UNREADABLE_INPUT, 85 PP_VIDEODECODERERROR_UNREADABLE_INPUT,
214 // A failure occurred at the browser layer or lower. Examples of such 86 // A failure occurred at the browser layer or lower. Examples of such
215 // failures include GPU hardware failures, GPU driver failures, GPU library 87 // failures include GPU hardware failures, GPU driver failures, GPU library
216 // failures, browser programming errors, and so on. 88 // failures, browser programming errors, and so on.
217 PP_VIDEODECODERERROR_PLATFORM_FAILURE 89 PP_VIDEODECODERERROR_PLATFORM_FAILURE
218 }; 90 };
219 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoDecodeError_Dev, 4); 91 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoDecodeError_Dev, 4);
220 92
221 #endif /* PPAPI_C_DEV_PP_VIDEO_DEV_H_ */ 93 #endif /* PPAPI_C_DEV_PP_VIDEO_DEV_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698