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

Side by Side Diff: c/pp_video.h

Issue 2827052: Add pepper C API for video decode (Closed) Base URL: http://ppapi.googlecode.com/svn/trunk/
Patch Set: several change from review Created 10 years, 4 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
« no previous file with comments | « no previous file | c/ppb_video_decoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 #ifndef PPAPI_C_PP_VIDEO_H_
6 #define PPAPI_C_PP_VIDEO_H_
7
8 #include "ppapi/c/pp_instance.h"
9 #include "ppapi/c/pp_resource.h"
10 #include "ppapi/c/pp_stdint.h"
11
12 enum PP_VideoKey {
13 PP_VIDEOKEY_NONE = 0,
14 // Value is type of PP_VideoCodecId.
15 PP_VIDEOKEY_CODECID,
16 // Value is type of PP_VideoOperation.
17 PP_VIDEOKEY_OPERATION,
18 // Value is type of PP_VideoCodecProfile.
19 PP_VIDEOKEY_CODECPROFILE,
20 // Value is type of PP_VideoCodecLevel.
21 PP_VIDEOKEY_CODECLEVEL,
22 // Value is 0 or 1.
23 PP_VIDEOKEY_ACCELERATION,
24 // Value is type of PP_VideoPayloadFormat.
25 PP_VIDEOKEY_PAYLOADFORMAT,
26 // Value is type of PP_VideoFrameColorType.
27 PP_VIDEOKEY_COLORTYPE,
28 // Value is type of PP_VideoFrameSurfaceType.
29 PP_VIDEOKEY_SURFACETYPE,
30 // Value is type of PP_VideoFrameInfoFlag.
31 PP_VIDEOKEY_FRAMEINFOFLAG,
32
33 // Subset for H.264 features, value of 1 means supported. This is needed in
34 // case decoder has partial support for certain profile.
35 PP_VIDEOKEY_H264FEATURE_FMO = 0x100,
36 PP_VIDEOKEY_H264FEATURE_ASO,
37 PP_VIDEOKEY_H264FEATURE_INTERLACE,
38 PP_VIDEOKEY_H264FEATURE_CABAC,
39 PP_VIDEOKEY_H264FEATURE_WEIGHTEDPREDICTION,
40 };
41
42 enum PP_VideoDecoderEvent {
43 PP_VIDEODECODEREVENT_NONE = 0,
44 // Signaling that an error has been hit.
45 PP_VIDEODECODEREVENT_ERROR,
46 // Signaling new width/height of video frame
47 PP_VIDEODECODEREVENT_NEWDIMENSION,
48 // Signaling new cropping rectangle
49 PP_VIDEODECODEREVENT_NEWCROP,
50 };
51
52 enum PP_VideoDecodeError {
53 PP_VIDEODECODEERROR_NONE = 0,
54 PP_VIDEODECODEERROR_NOTSUPPORTED,
55 PP_VIDEODECODEERROR_INSUFFICIENTRESOURCES,
56 PP_VIDEODECODEERROR_UNDEFINED,
57 PP_VIDEODECODEERROR_BADINPUT,
58 PP_VIDEODECODEERROR_HARDWARE,
59 };
60
61 enum PP_VideoCodecId {
62 PP_VIDEODECODECID_NONE = 0,
63 PP_VIDEODECODECID_H264,
64 PP_VIDEODECODECID_VC1,
65 PP_VIDEODECODECID_MPEG2,
66 PP_VIDEODECODECID_VP8,
67 };
68
69 enum PP_VideoOperation {
70 PP_VIDEOOPERATION_NONE = 0,
71 PP_VIDEOOPERATION_DECODE,
72 PP_VIDEOOPERATION_ENCODE,
73 };
74
75 enum PP_VideoCodecProfile {
76 PP_VIDEOCODECPROFILE_NONE = 0,
77 PP_VIDEOCODECPROFILE_H264_BASELINE,
78 PP_VIDEOCODECPROFILE_H264_MAIN,
79 PP_VIDEOCODECPROFILE_H264_EXTENDED,
80 PP_VIDEOCODECPROFILE_H264_HIGH,
81 PP_VIDEOCODECPROFILE_H264_SCALABLEBASELINE,
82 PP_VIDEOCODECPROFILE_H264_SCALABLEHIGH,
83 PP_VIDEOCODECPROFILE_H264_STEREOHIGH,
84 PP_VIDEOCODECPROFILE_H264_MULTIVIEWHIGH,
85
86 PP_VIDEOCODECPROFILE_VC1_SIMPLE = 0x40,
87 PP_VIDEOCODECPROFILE_VC1_MAIN,
88 PP_VIDEOCODECPROFILE_VC1_ADVANCED,
89
90 PP_VIDEOCODECPROFILE_MPEG2_SIMPLE = 0x80,
91 PP_VIDEOCODECPROFILE_MPEG2_MAIN,
92 PP_VIDEOCODECPROFILE_MPEG2_SNR,
93 PP_VIDEOCODECPROFILE_MPEG2_SPATIAL,
94 PP_VIDEOCODECPROFILE_MPEG2_HIGH,
95 };
96
97 enum PP_VideoCodecLevel {
98 PP_VIDEOCODECLEVEL_NONE = 0,
99 PP_VIDEOCODECLEVEL_H264_10,
100 PP_VIDEOCODECLEVEL_H264_1B,
101 PP_VIDEOCODECLEVEL_H264_11,
102 PP_VIDEOCODECLEVEL_H264_12,
103 PP_VIDEOCODECLEVEL_H264_13,
104 PP_VIDEOCODECLEVEL_H264_20,
105 PP_VIDEOCODECLEVEL_H264_21,
106 PP_VIDEOCODECLEVEL_H264_22,
107 PP_VIDEOCODECLEVEL_H264_30,
108 PP_VIDEOCODECLEVEL_H264_31,
109 PP_VIDEOCODECLEVEL_H264_32,
110 PP_VIDEOCODECLEVEL_H264_40,
111 PP_VIDEOCODECLEVEL_H264_41,
112 PP_VIDEOCODECLEVEL_H264_42,
113 PP_VIDEOCODECLEVEL_H264_50,
114 PP_VIDEOCODECLEVEL_H264_51,
115
116 PP_VIDEOCODECLEVEL_VC1_LOW = 0x40,
117 PP_VIDEOCODECLEVEL_VC1_MEDIUM,
118 PP_VIDEOCODECLEVEL_VC1_HIGH,
119 PP_VIDEOCODECLEVEL_VC1_L0,
120 PP_VIDEOCODECLEVEL_VC1_L1,
121 PP_VIDEOCODECLEVEL_VC1_L2,
122 PP_VIDEOCODECLEVEL_VC1_L3,
123 PP_VIDEOCODECLEVEL_VC1_L4,
124
125 PP_VIDEOCODECLEVEL_MPEG2_LOW = 0x80,
126 PP_VIDEOCODECLEVEL_MPEG2_MAIN,
127 PP_VIDEOCODECLEVEL_MPEG2_HIGH1440,
128 PP_VIDEOCODECLEVEL_MPEG2_HIGH,
129 };
130
131 enum PP_VideoPayloadFormat {
132 PP_VIDEOPAYLOADFORMAT_NONE = 0,
133 PP_VIDEOPAYLOADFORMAT_BYTESTREAM,
134 PP_VIDEOPAYLOADFORMAT_RTPPAYLOAD,
135 };
136
137 enum PP_VideoFrameColorType {
138 PP_VIDEOFRAMECOLORTYPE_NONE = 0,
139 PP_VIDEOFRAMECOLORTYPE_RGB565,
140 PP_VIDEOFRAMECOLORTYPE_ARGB8888,
141 PP_VIDEOFRAMECOLORTYPE_YUV,
142 PP_VIDEOFRAMECOLORTYPE_Monochrome,
143 PP_VIDEOFRAMECOLORTYPE_YUV420PLANAR,
144 PP_VIDEOFRAMECOLORTYPE_YUV422PLANAR,
145 PP_VIDEOFRAMECOLORTYPE_YUV444PLANAR,
146 };
147
148 enum PP_VideoFrameSurfaceType {
149 PP_VIDEOFRAMESURFACETYPE_NONE = 0,
150 PP_VIDEOFRAMESURFACETYPE_SYSTEMMEMORY,
151 PP_VIDEOFRAMESURFACETYPE_GLTEXTURE,
152 PP_VIDEOFRAMESURFACETYPE_PIXMAP,
153 };
154
155 enum PP_VideoFrameInfoFlag {
156 PP_VIDEOFRAMEINFOFLAG_NONE = 0,
157 // Indicate this is the end of stream. Used by both plugin and browser.
158 PP_VIDEOFRAMEINFOFLAG_EOS = 1 << 0,
159 // Decode the frame only, don't return decoded frame. Used by plugin.
160 PP_VIDEOFRAMEINFOFLAG_NOEMIT = 1 << 1,
161 // Indicate this is an anchor frame. Used by plugin.
162 PP_VIDEOFRAMEINFOFLAG_SYNCFRAME = 1 << 2,
163 // Indicate the decoded frame has data corruption. Used by browser.
164 PP_VIDEOFRAMEINFOFLAG_DATACORRUPT = 1 << 3,
165 };
166
167 enum PP_VideoFrameBufferConst {
168 // YUV formats
169 PP_VIDEOFRAMEBUFFER_YPLANE = 0,
170 PP_VIDEOFRAMEBUFFER_UPLANE = 1,
171 PP_VIDEOFRAMEBUFFER_VPLANE = 2,
172 PP_VIDEOFRAMEBUFFER_NUMBERYUVPLANES = 3,
173
174 // RGBA formats
175 PP_VIDEOFRAMEBUFFER_RGBAPLANE = 0,
176 PP_VIDEOFRAMEBUFFER_NUMBERRGBAPLANES = 1,
177
178 PP_VIDEOFRAMEBUFFER_MAXNUMBERPLANES = 4,
179 };
180
181 typedef int64_t PP_VideoDecodeData;
182
183 // Array of key/value pairs describing video configuration.
184 // It could include any keys from PP_VideoKey. Its last element shall be
185 // PP_VIDEOKEY_NONE with no corresponding value.
186 // An example:
187 // {
188 // PP_VIDEOKEY_CODECID, PP_VIDEODECODECID_H264,
189 // PP_VIDEOKEY_OPERATION, PP_VIDEOOPERATION_DECODE,
190 // PP_VIDEOKEY_CODECPROFILE, PP_VIDEOCODECPROFILE_H264_HIGH,
191 // PP_VIDEOKEY_CODECLEVEL, PP_VIDEOCODECLEVEL_H264_41,
192 // PP_VIDEOKEY_ACCELERATION, 1
193 // PP_VIDEOKEY_NONE,
194 // };
195 typedef int32_t* PP_VideoConfig;
196 typedef int32_t PP_VideoConfigElement;
197
198 // The data structure for compressed data buffer.
199 typedef struct _pp_VideoCompressedDataBuffer {
200 // The buffer is created through PPB_Buffer API.
201 // TODO(wjia): would uint8_t* be good, too?
202 PP_Resource buffer;
203 // number of bytes with real data in the buffer.
204 int32_t filled_size;
205 } PP_VideoCompressedDataBuffer;
206
207 typedef struct _pp_VideoFrameInfo {
208 // Time stamp of the frame in microsecond.
209 uint64_t time_stamp_us;
210
211 // Bit mask of PP_VideoFrameInfoFlag.
212 uint32_t flags;
213
214 // Output from decoder, indicating the decoded frame has error pixels. This
215 // could be resulted from corrupted input bit stream and error concealment
216 // in decoding.
217 // TODO(wjia): add more info about error pixels, such as error MB map, etc.
218 bool has_error;
219 } PP_VideoFrameInfo;
220
221 typedef struct _pp_VideoFrameBuffer {
222 union {
223 struct {
224 int32_t planes;
225 struct {
226 int32_t width;
227 int32_t height;
228 int32_t stride;
229
230 // TODO(wjia): uint8* would be better for some cases.
231 PP_Resource buffer;
232 } data_plane[PP_VIDEOFRAMEBUFFER_MAXNUMBERPLANES];
233 } sys_mem;
234
235 // Handle for pixmap, gl texture, etc.
236 void* handle;
237 } buffer;
238
239 // Storage for decoder to save some private data. It could be useful when
240 // plugin returns frame buffer to decoder.
241 void* private_handle;
242 } PP_VideoFrameBuffer;
243
244 typedef struct _pp_VideoUncompressedDataBuffer {
245 PP_VideoConfig format;
246 PP_VideoFrameBuffer buffer;
247 } PP_VideoUncompressedDataBuffer;
248
249 // Plugin callback for decoder to deliver decoded frame buffers.
250 // |format| in |buffer| specifies the format of decoded frame, with
251 // PP_VIDEOKEY_COLORTYPE and PP_VIDEOKEY_SURFACETYPE required.
252 typedef void (*PP_VideoDecodeOutputCallback_Func)(PP_Instance instance,
253 PP_VideoUncompressedDataBuffer* buffer,
254 PP_VideoFrameInfo* frame_info);
255
256 // Plugin callback for decoder to return input data buffers.
257 // Plugin can optionally provide this callback only when it wants to recycle
258 // input data buffers.
259 typedef void (*PP_VideoDecodeInputCallback_Func)(
260 PP_Instance instance,
261 PP_VideoCompressedDataBuffer* buffer);
262
263 // Event handling Function for decoder to deliver events to plugin.
264 // The correspondence between event and data1, data2:
265 // When event == PP_VIDEODECODEREVENT_ERROR,
266 // data1 is type of PP_VideoDecodeError id and data2 is ignored;
267 // When event == PP_VIDEODECODEREVENT_NEWDIMENSION,
268 // data1 is type of PP_Size*, data2 is ignored;
269 // When event == PP_VIDEODECODEREVENT_NEWCROP,
270 // data1 is type of PP_Rect*, data2 is ignored;
271 typedef void (*PP_VideoDecodeEventHandler_Func)(
272 PP_Instance instance,
273 PP_VideoDecoderEvent event,
274 PP_VideoDecodeData data1,
275 PP_VideoDecodeData data2);
276
277 // Requested decoder configuration and callback from plugin.
278 typedef struct _pp_VideoDecoderConfig {
279 PP_VideoConfig input_format;
280 PP_VideoConfig output_format;
281 PP_VideoDecodeOutputCallback_Func output_callback;
282 PP_VideoDecodeInputCallback_Func input_callback;
283 PP_VideoDecodeEventHandler_Func event_handler;
284 } PP_VideoDecoderConfig;
285
286 #endif // PPAPI_C_PP_VIDEO_H_
OLDNEW
« no previous file with comments | « no previous file | c/ppb_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698