Pepper_47_C_interfaces
pp_content_decryptor.h
Go to the documentation of this file.
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  */
5 
6 /* From private/pp_content_decryptor.idl modified Thu Oct 20 13:57:04 2016. */
7 
8 #ifndef PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_
9 #define PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_
10 
11 #include "ppapi/c/pp_macros.h"
12 #include "ppapi/c/pp_stdint.h"
13 
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.
19  */
20 
21 
22 /**
23  * @addtogroup Structs
24  * @{
25  */
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.
31  */
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.
42  */
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.
49  */
50  int64_t timestamp;
51 };
53 
54 /**
55  * The <code>PP_DecryptSubsampleDescription</code> struct contains information
56  * to support subsample decryption.
57  *
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:
62  *
63  * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->|
64  * | clear1 | cipher1 | clear2 | cipher2 | clear3 | cipher3 |
65  *
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.
69  *
70  * Logical stream to decrypt: | cipher1 | cipher2 | cipher3 |
71  * Decrypted stream: | decrypted1| decrypted2 | decrypted3 |
72  *
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:
76  *
77  * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->|
78  * | clear1 | decrypted1| clear2 | decrypted2 | clear3 | decrypted3 |
79  */
81  /**
82  * Size in bytes of clear data in a subsample entry.
83  */
84  uint32_t clear_bytes;
85  /**
86  * Size in bytes of encrypted data in a subsample entry.
87  */
88  uint32_t cipher_bytes;
89 };
91 
92 /**
93  * The <code>PP_EncryptedBlockInfo</code> struct contains all the information
94  * needed to decrypt an encrypted block.
95  */
97  /**
98  * Information needed by the client to track the block to be decrypted.
99  */
101  /**
102  * Size in bytes of data to be decrypted (data_offset included).
103  */
104  uint32_t data_size;
105  /**
106  * Key ID of the block to be decrypted.
107  *
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>.
113  */
114  uint8_t key_id[64];
115  uint32_t key_id_size;
116  /**
117  * Initialization vector of the block to be decrypted.
118  */
119  uint8_t iv[16];
120  uint32_t iv_size;
121  /**
122  * Subsample information of the block to be decrypted.
123  */
125  uint32_t num_subsamples;
126 };
128 /**
129  * @}
130  */
131 
132 /**
133  * @addtogroup Enums
134  * @{
135  */
136 /**
137  * <code>PP_DecryptedFrameFormat</code> contains video frame formats.
138  */
139 typedef enum {
145 
146 /**
147  * <code>PP_DecryptedSampleFormat</code> contains audio sample formats.
148  */
149 typedef enum {
159 
160 /**
161  * The <code>PP_DecryptResult</code> enum contains decryption and decoding
162  * result constants.
163  */
164 typedef enum {
165  /** The decryption (and/or decoding) operation finished successfully. */
167  /** The decryptor did not have the necessary decryption key. */
169  /** The input was accepted by the decoder but no frame(s) can be produced. */
171  /** An unexpected error happened during decryption. */
173  /** An unexpected error happened during decoding. */
177 /**
178  * @}
179  */
180 
181 /**
182  * @addtogroup Structs
183  * @{
184  */
185 /**
186  * <code>PP_DecryptedBlockInfo</code> struct contains the decryption result and
187  * tracking info associated with the decrypted block.
188  */
190  /**
191  * Result of the decryption (and/or decoding) operation.
192  */
194  /**
195  * Size in bytes of decrypted data, which may be less than the size of the
196  * corresponding buffer.
197  */
198  uint32_t data_size;
199  /**
200  * Information needed by the client to track the block to be decrypted.
201  */
203 };
205 /**
206  * @}
207  */
208 
209 /**
210  * @addtogroup Enums
211  * @{
212  */
213 /**
214  * <code>PP_DecryptedFramePlanes</code> provides YUV plane index values for
215  * accessing plane offsets stored in <code>PP_DecryptedFrameInfo</code>.
216  */
217 typedef enum {
223 /**
224  * @}
225  */
226 
227 /**
228  * @addtogroup Structs
229  * @{
230  */
231 /**
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.
235  */
237  /**
238  * Result of the decrypt and decode operation.
239  */
241  /**
242  * Format of the decrypted frame.
243  */
245  /**
246  * Offsets into the buffer resource for accessing video planes.
247  */
248  int32_t plane_offsets[3];
249  /**
250  * Stride of each plane.
251  */
252  int32_t strides[3];
253  /**
254  * Width of the video frame, in pixels.
255  */
256  int32_t width;
257  /**
258  * Height of the video frame, in pixels.
259  */
260  int32_t height;
261  /**
262  * Information needed by the client to track the decrypted frame.
263  */
265 };
267 
268 /**
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.
272  */
274  /**
275  * Result of the decrypt and decode operation.
276  */
278  /**
279  * Format of the decrypted samples.
280  */
282  /**
283  * Size in bytes of decrypted samples.
284  */
285  uint32_t data_size;
286  /**
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.
289  */
290  uint32_t padding;
291  /**
292  * Information needed by the client to track the decrypted samples.
293  */
295 };
297 /**
298  * @}
299  */
300 
301 /**
302  * @addtogroup Enums
303  * @{
304  */
305 /**
306  * <code>PP_AudioCodec</code> contains audio codec type constants.
307  */
308 typedef enum {
312 } PP_AudioCodec;
314 /**
315  * @}
316  */
317 
318 /**
319  * @addtogroup Structs
320  * @{
321  */
322 /**
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>.
329  */
331  /**
332  * The audio codec to initialize.
333  */
335  /**
336  * Number of audio channels.
337  */
338  int32_t channel_count;
339  /**
340  * Size of each audio channel.
341  */
343  /**
344  * Audio sampling rate.
345  */
347  /**
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.
351  */
352  uint32_t request_id;
353 };
355 /**
356  * @}
357  */
358 
359 /**
360  * @addtogroup Enums
361  * @{
362  */
363 /**
364  * <code>PP_VideoCodec</code> contains video codec type constants.
365  */
366 typedef enum {
371 } PP_VideoCodec;
373 
374 /**
375  * <code>PP_VideoCodecProfile</code> contains video codec profile type
376  * constants required for video decoder configuration.
377  *.
378  */
379 typedef enum {
391 /**
392  * @}
393  */
394 
395 /**
396  * @addtogroup Structs
397  * @{
398  */
399 /**
400  * <code>PP_VideoDecoderConfig</code> contains video decoder configuration
401  * information required to initialize video decoders, and a request ID
402  * that allows clients to associate a decoder initialization request with a
403  * status response. Note: When <code>codec</code> requires extra data for
404  * initialization, the data is sent as a <code>PP_Resource</code> carried
405  * alongside <code>PP_VideoDecoderConfig</code>.
406  */
408  /**
409  * The video codec to initialize.
410  */
412  /**
413  * Profile to use when initializing the video codec.
414  */
416  /**
417  * Output video format.
418  */
420  /**
421  * Width of decoded video frames, in pixels.
422  */
423  int32_t width;
424  /**
425  * Height of decoded video frames, in pixels.
426  */
427  int32_t height;
428  /**
429  * Client-specified identifier for the associated video decoder initialization
430  * request. By using this value, the client can associate a decoder
431  * initialization status response with an initialization request.
432  */
433  uint32_t request_id;
434 };
436 /**
437  * @}
438  */
439 
440 /**
441  * @addtogroup Enums
442  * @{
443  */
444 /**
445  * <code>PP_DecryptorStreamType</code> contains stream type constants.
446  */
447 typedef enum {
452 
453 /**
454  * <code>PP_SessionType</code> contains session type constants.
455  */
456 typedef enum {
462 
463 /**
464  * <code>PP_InitDataType</code> contains Initialization Data Type constants.
465  */
466 typedef enum {
472 
473 /**
474  * <code>PP_CdmExceptionCode</code> contains exception code constants.
475  */
476 typedef enum {
486 
487 /**
488  * <code>PP_CdmMessageType</code> contains message type constants.
489  */
490 typedef enum {
496 
497 /**
498  * <code>PP_CdmKeyStatus</code> contains key status constants.
499  */
500 typedef enum {
510 /**
511  * @}
512  */
513 
514 /**
515  * @addtogroup Structs
516  * @{
517  */
518 /**
519  * The <code>PP_KeyInformation</code> struct contains information about a
520  * key used for decryption.
521  */
523  /**
524  * Key ID.
525  */
526  uint8_t key_id[512];
527  uint32_t key_id_size;
528  /**
529  * Status of this key.
530  */
532  /**
533  * Optional error code for keys that are not usable.
534  */
535  uint32_t system_code;
536 };
538 /**
539  * @}
540  */
541 
542 #endif /* PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_ */
543 
PP_DecryptedFrameFormat format
PP_DecryptedFrameFormat
PP_DecryptorStreamType
struct PP_DecryptTrackingInfo tracking_info
struct PP_DecryptTrackingInfo tracking_info
PP_VideoCodecProfile profile
PP_CdmExceptionCode
PP_VideoCodecProfile
PP_CdmKeyStatus key_status
struct PP_DecryptTrackingInfo tracking_info
PP_DecryptedSampleFormat format
PP_CdmMessageType
PP_DecryptedFrameFormat format
struct PP_DecryptSubsampleDescription subsamples[16]
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptedFrameFormat, 4)
struct PP_DecryptTrackingInfo tracking_info
PP_DecryptResult
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptTrackingInfo, 16)
PP_DecryptedFramePlanes
PP_DecryptedSampleFormat