Fix infinite recursion on hiding panel when created during fullscreen mode.
[chromium-blink-merge.git] / ppapi / c / private / pp_content_decryptor.h
blob6440ce13e5c3045edeaaf0bec3aef3873bd7bb50
1 /* Copyright (c) 2012 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 */
6 /* From private/pp_content_decryptor.idl modified Mon Dec 30 15:55:57 2013. */
8 #ifndef PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_
9 #define PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_
11 #include "ppapi/c/pp_macros.h"
12 #include "ppapi/c/pp_stdint.h"
14 /**
15 * @file
16 * The <code>PP_DecryptTrackingInfo</code> struct contains necessary information
17 * that can be used to associate the decrypted block with a decrypt request
18 * and/or an input block.
22 /**
23 * @addtogroup Structs
24 * @{
26 struct PP_DecryptTrackingInfo {
27 /**
28 * Client-specified identifier for the associated decrypt request. By using
29 * this value, the client can associate the decrypted block with a decryption
30 * request.
32 uint32_t request_id;
33 /**
34 * A unique buffer ID to identify a PPB_Buffer_Dev. Unlike a PP_Resource,
35 * this ID is identical at both the renderer side and the plugin side.
36 * In <code>PPB_ContentDecryptor_Private</code> calls, this is the ID of the
37 * buffer associated with the decrypted block/frame/samples.
38 * In <code>PPP_ContentDecryptor_Private</code> calls, this is the ID of a
39 * buffer that is no longer need at the renderer side, which can be released
40 * or recycled by the plugin. This ID can be 0 if there is no buffer to be
41 * released or recycled.
43 uint32_t buffer_id;
44 /**
45 * Timestamp in microseconds of the associated block. By using this value,
46 * the client can associate the decrypted (and decoded) data with an input
47 * block. This is needed because buffers may be delivered out of order and
48 * not in response to the <code>request_id</code> they were provided with.
50 int64_t timestamp;
52 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptTrackingInfo, 16);
54 /**
55 * The <code>PP_DecryptSubsampleDescription</code> struct contains information
56 * to support subsample decryption.
58 * An input block can be split into several continuous subsamples.
59 * A <code>PP_DecryptSubsampleEntry</code> specifies the number of clear and
60 * cipher bytes in each subsample. For example, the following block has three
61 * subsamples:
63 * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->|
64 * | clear1 | cipher1 | clear2 | cipher2 | clear3 | cipher3 |
66 * For decryption, all of the cipher bytes in a block should be treated as a
67 * contiguous (in the subsample order) logical stream. The clear bytes should
68 * not be considered as part of decryption.
70 * Logical stream to decrypt: | cipher1 | cipher2 | cipher3 |
71 * Decrypted stream: | decrypted1| decrypted2 | decrypted3 |
73 * After decryption, the decrypted bytes should be copied over the position
74 * of the corresponding cipher bytes in the original block to form the output
75 * block. Following the above example, the decrypted block should be:
77 * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->|
78 * | clear1 | decrypted1| clear2 | decrypted2 | clear3 | decrypted3 |
80 struct PP_DecryptSubsampleDescription {
81 /**
82 * Size in bytes of clear data in a subsample entry.
84 uint32_t clear_bytes;
85 /**
86 * Size in bytes of encrypted data in a subsample entry.
88 uint32_t cipher_bytes;
90 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptSubsampleDescription, 8);
92 /**
93 * The <code>PP_EncryptedBlockInfo</code> struct contains all the information
94 * needed to decrypt an encrypted block.
96 struct PP_EncryptedBlockInfo {
97 /**
98 * Information needed by the client to track the block to be decrypted.
100 struct PP_DecryptTrackingInfo tracking_info;
102 * Size in bytes of data to be decrypted (data_offset included).
104 uint32_t data_size;
106 * Key ID of the block to be decrypted.
108 * TODO(xhwang): For WebM the key ID can be as large as 2048 bytes in theory.
109 * But it's not used in current implementations. If we really need to support
110 * it, we should move key ID out as a separate parameter, e.g.
111 * as a <code>PP_Var</code>, or make the whole
112 * <code>PP_EncryptedBlockInfo</code> as a <code>PP_Resource</code>.
114 uint8_t key_id[64];
115 uint32_t key_id_size;
117 * Initialization vector of the block to be decrypted.
119 uint8_t iv[16];
120 uint32_t iv_size;
122 * Subsample information of the block to be decrypted.
124 struct PP_DecryptSubsampleDescription subsamples[16];
125 uint32_t num_subsamples;
127 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_EncryptedBlockInfo, 240);
129 * @}
133 * @addtogroup Enums
134 * @{
137 * <code>PP_DecryptedFrameFormat</code> contains video frame formats.
139 typedef enum {
140 PP_DECRYPTEDFRAMEFORMAT_UNKNOWN = 0,
141 PP_DECRYPTEDFRAMEFORMAT_YV12 = 1,
142 PP_DECRYPTEDFRAMEFORMAT_I420 = 2
143 } PP_DecryptedFrameFormat;
144 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptedFrameFormat, 4);
147 * <code>PP_DecryptedSampleFormat</code> contains audio sample formats.
149 typedef enum {
150 PP_DECRYPTEDSAMPLEFORMAT_UNKNOWN = 0,
151 PP_DECRYPTEDSAMPLEFORMAT_U8 = 1,
152 PP_DECRYPTEDSAMPLEFORMAT_S16 = 2,
153 PP_DECRYPTEDSAMPLEFORMAT_S32 = 3,
154 PP_DECRYPTEDSAMPLEFORMAT_F32 = 4,
155 PP_DECRYPTEDSAMPLEFORMAT_PLANAR_S16 = 5,
156 PP_DECRYPTEDSAMPLEFORMAT_PLANAR_F32 = 6
157 } PP_DecryptedSampleFormat;
158 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptedSampleFormat, 4);
161 * The <code>PP_DecryptResult</code> enum contains decryption and decoding
162 * result constants.
164 typedef enum {
165 /** The decryption (and/or decoding) operation finished successfully. */
166 PP_DECRYPTRESULT_SUCCESS = 0,
167 /** The decryptor did not have the necessary decryption key. */
168 PP_DECRYPTRESULT_DECRYPT_NOKEY = 1,
169 /** The input was accepted by the decoder but no frame(s) can be produced. */
170 PP_DECRYPTRESULT_NEEDMOREDATA = 2,
171 /** An unexpected error happened during decryption. */
172 PP_DECRYPTRESULT_DECRYPT_ERROR = 3,
173 /** An unexpected error happened during decoding. */
174 PP_DECRYPTRESULT_DECODE_ERROR = 4
175 } PP_DecryptResult;
176 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptResult, 4);
178 * @}
182 * @addtogroup Structs
183 * @{
186 * <code>PP_DecryptedBlockInfo</code> struct contains the decryption result and
187 * tracking info associated with the decrypted block.
189 struct PP_DecryptedBlockInfo {
191 * Result of the decryption (and/or decoding) operation.
193 PP_DecryptResult result;
195 * Size in bytes of decrypted data, which may be less than the size of the
196 * corresponding buffer.
198 uint32_t data_size;
200 * Information needed by the client to track the block to be decrypted.
202 struct PP_DecryptTrackingInfo tracking_info;
204 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptedBlockInfo, 24);
206 * @}
210 * @addtogroup Enums
211 * @{
214 * <code>PP_DecryptedFramePlanes</code> provides YUV plane index values for
215 * accessing plane offsets stored in <code>PP_DecryptedFrameInfo</code>.
217 typedef enum {
218 PP_DECRYPTEDFRAMEPLANES_Y = 0,
219 PP_DECRYPTEDFRAMEPLANES_U = 1,
220 PP_DECRYPTEDFRAMEPLANES_V = 2
221 } PP_DecryptedFramePlanes;
222 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptedFramePlanes, 4);
224 * @}
228 * @addtogroup Structs
229 * @{
232 * <code>PP_DecryptedFrameInfo</code> contains the result of the
233 * decrypt and decode operation on the associated frame, information required
234 * to access the frame data in buffer, and tracking info.
236 struct PP_DecryptedFrameInfo {
238 * Result of the decrypt and decode operation.
240 PP_DecryptResult result;
242 * Format of the decrypted frame.
244 PP_DecryptedFrameFormat format;
246 * Offsets into the buffer resource for accessing video planes.
248 int32_t plane_offsets[3];
250 * Stride of each plane.
252 int32_t strides[3];
254 * Width of the video frame, in pixels.
256 int32_t width;
258 * Height of the video frame, in pixels.
260 int32_t height;
262 * Information needed by the client to track the decrypted frame.
264 struct PP_DecryptTrackingInfo tracking_info;
266 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptedFrameInfo, 56);
269 * <code>PP_DecryptedSampleInfo</code> contains the result of the
270 * decrypt and decode operation on the associated samples, information required
271 * to access the sample data in buffer, and tracking info.
273 struct PP_DecryptedSampleInfo {
275 * Result of the decrypt and decode operation.
277 PP_DecryptResult result;
279 * Format of the decrypted samples.
281 PP_DecryptedSampleFormat format;
283 * Size in bytes of decrypted samples.
285 uint32_t data_size;
287 * 4-byte padding to make the size of <code>PP_DecryptedSampleInfo</code>
288 * a multiple of 8 bytes. The value of this field should not be used.
290 uint32_t padding;
292 * Information needed by the client to track the decrypted samples.
294 struct PP_DecryptTrackingInfo tracking_info;
296 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptedSampleInfo, 32);
298 * @}
302 * @addtogroup Enums
303 * @{
306 * <code>PP_AudioCodec</code> contains audio codec type constants.
308 typedef enum {
309 PP_AUDIOCODEC_UNKNOWN = 0,
310 PP_AUDIOCODEC_VORBIS = 1,
311 PP_AUDIOCODEC_AAC = 2
312 } PP_AudioCodec;
313 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_AudioCodec, 4);
315 * @}
319 * @addtogroup Structs
320 * @{
323 * <code>PP_AudioDecoderConfig</code> contains audio decoder configuration
324 * information required to initialize audio decoders, and a request ID
325 * that allows clients to associate a decoder initialization request with a
326 * status response. Note: When <code>codec</code> requires extra data for
327 * initialization, the data is sent as a <code>PP_Resource</code> carried
328 * alongside <code>PP_AudioDecoderConfig</code>.
330 struct PP_AudioDecoderConfig {
332 * The audio codec to initialize.
334 PP_AudioCodec codec;
336 * Number of audio channels.
338 int32_t channel_count;
340 * Size of each audio channel.
342 int32_t bits_per_channel;
344 * Audio sampling rate.
346 int32_t samples_per_second;
348 * Client-specified identifier for the associated audio decoder initialization
349 * request. By using this value, the client can associate a decoder
350 * initialization status response with an initialization request.
352 uint32_t request_id;
354 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_AudioDecoderConfig, 20);
356 * @}
360 * @addtogroup Enums
361 * @{
364 * <code>PP_VideoCodec</code> contains video codec type constants.
366 typedef enum {
367 PP_VIDEOCODEC_UNKNOWN = 0,
368 PP_VIDEOCODEC_VP8 = 1,
369 PP_VIDEOCODEC_H264 = 2
370 } PP_VideoCodec;
371 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoCodec, 4);
374 * <code>PP_VideoCodecProfile</code> contains video codec profile type
375 * constants required for video decoder configuration.
378 typedef enum {
379 PP_VIDEOCODECPROFILE_UNKNOWN = 0,
380 PP_VIDEOCODECPROFILE_VP8_MAIN = 1,
381 PP_VIDEOCODECPROFILE_H264_BASELINE = 2,
382 PP_VIDEOCODECPROFILE_H264_MAIN = 3,
383 PP_VIDEOCODECPROFILE_H264_EXTENDED = 4,
384 PP_VIDEOCODECPROFILE_H264_HIGH = 5,
385 PP_VIDEOCODECPROFILE_H264_HIGH_10 = 6,
386 PP_VIDEOCODECPROFILE_H264_HIGH_422 = 7,
387 PP_VIDEOCODECPROFILE_H264_HIGH_444_PREDICTIVE = 8
388 } PP_VideoCodecProfile;
389 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoCodecProfile, 4);
391 * @}
395 * @addtogroup Structs
396 * @{
399 * <code>PP_VideoDecoderConfig</code> contains video decoder configuration
400 * information required to initialize video decoders, and a request ID
401 * that allows clients to associate a decoder initialization request with a
402 * status response. Note: When <code>codec</code> requires extra data for
403 * initialization, the data is sent as a <code>PP_Resource</code> carried
404 * alongside <code>PP_VideoDecoderConfig</code>.
406 struct PP_VideoDecoderConfig {
408 * The video codec to initialize.
410 PP_VideoCodec codec;
412 * Profile to use when initializing the video codec.
414 PP_VideoCodecProfile profile;
416 * Output video format.
418 PP_DecryptedFrameFormat format;
420 * Width of decoded video frames, in pixels.
422 int32_t width;
424 * Height of decoded video frames, in pixels.
426 int32_t height;
428 * Client-specified identifier for the associated video decoder initialization
429 * request. By using this value, the client can associate a decoder
430 * initialization status response with an initialization request.
432 uint32_t request_id;
434 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoDecoderConfig, 24);
436 * @}
440 * @addtogroup Enums
441 * @{
444 * <code>PP_DecryptorStreamType</code> contains stream type constants.
446 typedef enum {
447 PP_DECRYPTORSTREAMTYPE_AUDIO = 0,
448 PP_DECRYPTORSTREAMTYPE_VIDEO = 1
449 } PP_DecryptorStreamType;
450 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptorStreamType, 4);
452 * @}
455 #endif /* PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_ */