1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
|
/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
* The <code>PP_DecryptTrackingInfo</code> struct contains necessary information
* that can be used to associate the decrypted block with a decrypt request
* and/or an input block.
*/
[assert_size(16)]
struct PP_DecryptTrackingInfo {
/**
* Client-specified identifier for the associated decrypt request. By using
* this value, the client can associate the decrypted block with a decryption
* request.
*/
uint32_t request_id;
/**
* A unique buffer ID to identify a PPB_Buffer_Dev. Unlike a PP_Resource,
* this ID is identical at both the renderer side and the plugin side.
* In <code>PPB_ContentDecryptor_Private</code> calls, this is the ID of the
* buffer associated with the decrypted block/frame/samples.
* In <code>PPP_ContentDecryptor_Private</code> calls, this is the ID of a
* buffer that is no longer need at the renderer side, which can be released
* or recycled by the plugin. This ID can be 0 if there is no buffer to be
* released or recycled.
*/
uint32_t buffer_id;
/**
* Timestamp in microseconds of the associated block. By using this value,
* the client can associate the decrypted (and decoded) data with an input
* block. This is needed because buffers may be delivered out of order and
* not in response to the <code>request_id</code> they were provided with.
*/
int64_t timestamp;
};
/**
* The <code>PP_DecryptSubsampleDescription</code> struct contains information
* to support subsample decryption.
*
* An input block can be split into several continuous subsamples.
* A <code>PP_DecryptSubsampleEntry</code> specifies the number of clear and
* cipher bytes in each subsample. For example, the following block has three
* subsamples:
*
* |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->|
* | clear1 | cipher1 | clear2 | cipher2 | clear3 | cipher3 |
*
* For decryption, all of the cipher bytes in a block should be treated as a
* contiguous (in the subsample order) logical stream. The clear bytes should
* not be considered as part of decryption.
*
* Logical stream to decrypt: | cipher1 | cipher2 | cipher3 |
* Decrypted stream: | decrypted1| decrypted2 | decrypted3 |
*
* After decryption, the decrypted bytes should be copied over the position
* of the corresponding cipher bytes in the original block to form the output
* block. Following the above example, the decrypted block should be:
*
* |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->|
* | clear1 | decrypted1| clear2 | decrypted2 | clear3 | decrypted3 |
*/
[assert_size(8)]
struct PP_DecryptSubsampleDescription {
/**
* Size in bytes of clear data in a subsample entry.
*/
uint32_t clear_bytes;
/**
* Size in bytes of encrypted data in a subsample entry.
*/
uint32_t cipher_bytes;
};
/**
* The <code>PP_EncryptedBlockInfo</code> struct contains all the information
* needed to decrypt an encrypted block.
*/
[assert_size(240)]
struct PP_EncryptedBlockInfo {
/**
* Information needed by the client to track the block to be decrypted.
*/
PP_DecryptTrackingInfo tracking_info;
/**
* Size in bytes of data to be decrypted (data_offset included).
*/
uint32_t data_size;
/**
* Key ID of the block to be decrypted.
*
* TODO(xhwang): For WebM the key ID can be as large as 2048 bytes in theory.
* But it's not used in current implementations. If we really need to support
* it, we should move key ID out as a separate parameter, e.g.
* as a <code>PP_Var</code>, or make the whole
* <code>PP_EncryptedBlockInfo</code> as a <code>PP_Resource</code>.
*/
uint8_t[64] key_id;
uint32_t key_id_size;
/**
* Initialization vector of the block to be decrypted.
*/
uint8_t[16] iv;
uint32_t iv_size;
/**
* Subsample information of the block to be decrypted.
*/
PP_DecryptSubsampleDescription[16] subsamples;
uint32_t num_subsamples;
};
/**
* <code>PP_DecryptedFrameFormat</code> contains video frame formats.
*/
[assert_size(4)]
enum PP_DecryptedFrameFormat {
PP_DECRYPTEDFRAMEFORMAT_UNKNOWN = 0,
PP_DECRYPTEDFRAMEFORMAT_YV12 = 1,
PP_DECRYPTEDFRAMEFORMAT_I420 = 2
};
/**
* <code>PP_DecryptedSampleFormat</code> contains audio sample formats.
*/
[assert_size(4)]
enum PP_DecryptedSampleFormat {
PP_DECRYPTEDSAMPLEFORMAT_UNKNOWN = 0,
PP_DECRYPTEDSAMPLEFORMAT_U8 = 1,
PP_DECRYPTEDSAMPLEFORMAT_S16 = 2,
PP_DECRYPTEDSAMPLEFORMAT_S32 = 3,
PP_DECRYPTEDSAMPLEFORMAT_F32 = 4,
PP_DECRYPTEDSAMPLEFORMAT_PLANAR_S16 = 5,
PP_DECRYPTEDSAMPLEFORMAT_PLANAR_F32 = 6
};
/**
* The <code>PP_DecryptResult</code> enum contains decryption and decoding
* result constants.
*/
[assert_size(4)]
enum PP_DecryptResult {
/** The decryption (and/or decoding) operation finished successfully. */
PP_DECRYPTRESULT_SUCCESS = 0,
/** The decryptor did not have the necessary decryption key. */
PP_DECRYPTRESULT_DECRYPT_NOKEY = 1,
/** The input was accepted by the decoder but no frame(s) can be produced. */
PP_DECRYPTRESULT_NEEDMOREDATA = 2,
/** An unexpected error happened during decryption. */
PP_DECRYPTRESULT_DECRYPT_ERROR = 3,
/** An unexpected error happened during decoding. */
PP_DECRYPTRESULT_DECODE_ERROR = 4
};
/**
* <code>PP_DecryptedBlockInfo</code> struct contains the decryption result and
* tracking info associated with the decrypted block.
*/
[assert_size(24)]
struct PP_DecryptedBlockInfo {
/**
* Result of the decryption (and/or decoding) operation.
*/
PP_DecryptResult result;
/**
* Size in bytes of decrypted data, which may be less than the size of the
* corresponding buffer.
*/
uint32_t data_size;
/**
* Information needed by the client to track the block to be decrypted.
*/
PP_DecryptTrackingInfo tracking_info;
};
/**
* <code>PP_DecryptedFramePlanes</code> provides YUV plane index values for
* accessing plane offsets stored in <code>PP_DecryptedFrameInfo</code>.
*/
[assert_size(4)]
enum PP_DecryptedFramePlanes {
PP_DECRYPTEDFRAMEPLANES_Y = 0,
PP_DECRYPTEDFRAMEPLANES_U = 1,
PP_DECRYPTEDFRAMEPLANES_V = 2
};
/**
* <code>PP_DecryptedFrameInfo</code> contains the result of the
* decrypt and decode operation on the associated frame, information required
* to access the frame data in buffer, and tracking info.
*/
[assert_size(56)]
struct PP_DecryptedFrameInfo {
/**
* Result of the decrypt and decode operation.
*/
PP_DecryptResult result;
/**
* Format of the decrypted frame.
*/
PP_DecryptedFrameFormat format;
/**
* Offsets into the buffer resource for accessing video planes.
*/
int32_t[3] plane_offsets;
/**
* Stride of each plane.
*/
int32_t[3] strides;
/**
* Width of the video frame, in pixels.
*/
int32_t width;
/**
* Height of the video frame, in pixels.
*/
int32_t height;
/**
* Information needed by the client to track the decrypted frame.
*/
PP_DecryptTrackingInfo tracking_info;
};
/**
* <code>PP_DecryptedSampleInfo</code> contains the result of the
* decrypt and decode operation on the associated samples, information required
* to access the sample data in buffer, and tracking info.
*/
[assert_size(32)]
struct PP_DecryptedSampleInfo {
/**
* Result of the decrypt and decode operation.
*/
PP_DecryptResult result;
/**
* Format of the decrypted samples.
*/
PP_DecryptedSampleFormat format;
/**
* Size in bytes of decrypted samples.
*/
uint32_t data_size;
/**
* 4-byte padding to make the size of <code>PP_DecryptedSampleInfo</code>
* a multiple of 8 bytes. The value of this field should not be used.
*/
uint32_t padding;
/**
* Information needed by the client to track the decrypted samples.
*/
PP_DecryptTrackingInfo tracking_info;
};
/**
* <code>PP_AudioCodec</code> contains audio codec type constants.
*/
[assert_size(4)]
enum PP_AudioCodec {
PP_AUDIOCODEC_UNKNOWN = 0,
PP_AUDIOCODEC_VORBIS = 1,
PP_AUDIOCODEC_AAC = 2
};
/**
* <code>PP_AudioDecoderConfig</code> contains audio decoder configuration
* information required to initialize audio decoders, and a request ID
* that allows clients to associate a decoder initialization request with a
* status response. Note: When <code>codec</code> requires extra data for
* initialization, the data is sent as a <code>PP_Resource</code> carried
* alongside <code>PP_AudioDecoderConfig</code>.
*/
[assert_size(20)]
struct PP_AudioDecoderConfig {
/**
* The audio codec to initialize.
*/
PP_AudioCodec codec;
/**
* Number of audio channels.
*/
int32_t channel_count;
/**
* Size of each audio channel.
*/
int32_t bits_per_channel;
/**
* Audio sampling rate.
*/
int32_t samples_per_second;
/**
* Client-specified identifier for the associated audio decoder initialization
* request. By using this value, the client can associate a decoder
* initialization status response with an initialization request.
*/
uint32_t request_id;
};
/**
* <code>PP_VideoCodec</code> contains video codec type constants.
*/
[assert_size(4)]
enum PP_VideoCodec {
PP_VIDEOCODEC_UNKNOWN = 0,
PP_VIDEOCODEC_VP8 = 1,
PP_VIDEOCODEC_H264 = 2,
PP_VIDEOCODEC_VP9 = 3
};
/**
* <code>PP_VideoCodecProfile</code> contains video codec profile type
* constants required for video decoder configuration.
*.
*/
[assert_size(4)]
enum PP_VideoCodecProfile {
PP_VIDEOCODECPROFILE_UNKNOWN = 0,
PP_VIDEOCODECPROFILE_NOT_NEEDED = 1,
PP_VIDEOCODECPROFILE_H264_BASELINE = 2,
PP_VIDEOCODECPROFILE_H264_MAIN = 3,
PP_VIDEOCODECPROFILE_H264_EXTENDED = 4,
PP_VIDEOCODECPROFILE_H264_HIGH = 5,
PP_VIDEOCODECPROFILE_H264_HIGH_10 = 6,
PP_VIDEOCODECPROFILE_H264_HIGH_422 = 7,
PP_VIDEOCODECPROFILE_H264_HIGH_444_PREDICTIVE = 8
};
/**
* <code>PP_VideoDecoderConfig</code> contains video decoder configuration
* information required to initialize video decoders, and a request ID
* that allows clients to associate a decoder initialization request with a
* status response. Note: When <code>codec</code> requires extra data for
* initialization, the data is sent as a <code>PP_Resource</code> carried
* alongside <code>PP_VideoDecoderConfig</code>.
*/
[assert_size(24)]
struct PP_VideoDecoderConfig {
/**
* The video codec to initialize.
*/
PP_VideoCodec codec;
/**
* Profile to use when initializing the video codec.
*/
PP_VideoCodecProfile profile;
/**
* Output video format.
*/
PP_DecryptedFrameFormat format;
/**
* Width of decoded video frames, in pixels.
*/
int32_t width;
/**
* Height of decoded video frames, in pixels.
*/
int32_t height;
/**
* Client-specified identifier for the associated video decoder initialization
* request. By using this value, the client can associate a decoder
* initialization status response with an initialization request.
*/
uint32_t request_id;
};
/**
* <code>PP_DecryptorStreamType</code> contains stream type constants.
*/
[assert_size(4)]
enum PP_DecryptorStreamType {
PP_DECRYPTORSTREAMTYPE_AUDIO = 0,
PP_DECRYPTORSTREAMTYPE_VIDEO = 1
};
/**
* <code>PP_SessionType</code> contains session type constants.
*/
[assert_size(4)]
enum PP_SessionType {
PP_SESSIONTYPE_TEMPORARY = 0,
PP_SESSIONTYPE_PERSISTENT = 1
};
/**
* <code>PP_CdmExceptionCode</code> contains exception code constants.
*/
[assert_size(4)]
enum PP_CdmExceptionCode {
PP_CDMEXCEPTIONCODE_NOTSUPPORTEDERROR = 1,
PP_CDMEXCEPTIONCODE_INVALIDSTATEERROR = 2,
PP_CDMEXCEPTIONCODE_INVALIDACCESSERROR = 3,
PP_CDMEXCEPTIONCODE_QUOTAEXCEEDEDERROR = 4,
PP_CDMEXCEPTIONCODE_UNKNOWNERROR = 5,
PP_CDMEXCEPTIONCODE_CLIENTERROR = 6,
PP_CDMEXCEPTIONCODE_OUTPUTERROR = 7
};
|