blob: 96bd254157556337db3e704a3809a66144ae5a9e [file] [log] [blame]
/* 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(368)]
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.
*
* 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.
*
* We need to have a fixed size of |subsamples| here. Choose 32 because it is
* sufficient for almost all real life scenarios. Note that in theory the
* number of subsamples could be larger than 32. If that happens, playback
* will fail.
*/
PP_DecryptSubsampleDescription[32] 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_HdcpVersion</code> contains HDCP version constants.
*/
[assert_size(4)]
enum PP_HdcpVersion {
PP_HDCPVERSION_NONE = 0,
PP_HDCPVERSION_1_0 = 1,
PP_HDCPVERSION_1_1 = 2,
PP_HDCPVERSION_1_2 = 3,
PP_HDCPVERSION_1_3 = 4,
PP_HDCPVERSION_1_4 = 5,
PP_HDCPVERSION_2_0 = 6,
PP_HDCPVERSION_2_1 = 7,
PP_HDCPVERSION_2_2 = 8,
PP_HDCPVERSION_MAX = PP_HDCPVERSION_2_2
};
/**
* <code>PP_DecryptorStreamType</code> contains stream type constants.
*/
[assert_size(4)]
enum PP_DecryptorStreamType {
PP_DECRYPTORSTREAMTYPE_AUDIO = 0,
PP_DECRYPTORSTREAMTYPE_VIDEO = 1,
PP_DECRYPTORSTREAMTYPE_MAX = PP_DECRYPTORSTREAMTYPE_VIDEO
};
/**
* <code>PP_SessionType</code> contains session type constants.
*/
[assert_size(4)]
enum PP_SessionType {
PP_SESSIONTYPE_TEMPORARY = 0,
PP_SESSIONTYPE_PERSISTENT_LICENSE = 1,
PP_SESSIONTYPE_PERSISTENT_RELEASE = 2,
PP_SESSIONTYPE_MAX = PP_SESSIONTYPE_PERSISTENT_RELEASE
};
/**
* <code>PP_InitDataType</code> contains Initialization Data Type constants.
*/
[assert_size(4)]
enum PP_InitDataType {
PP_INITDATATYPE_CENC = 0,
PP_INITDATATYPE_KEYIDS = 1,
PP_INITDATATYPE_WEBM = 2,
PP_INITDATATYPE_MAX = PP_INITDATATYPE_WEBM
};
/**
* <code>PP_CdmExceptionCode</code> contains exception code constants.
*/
[assert_size(4)]
enum PP_CdmExceptionCode {
PP_CDMEXCEPTIONCODE_NOTSUPPORTEDERROR = 1,
PP_CDMEXCEPTIONCODE_INVALIDSTATEERROR = 2,
PP_CDMEXCEPTIONCODE_TYPEERROR = 3,
PP_CDMEXCEPTIONCODE_QUOTAEXCEEDEDERROR = 4,
PP_CDMEXCEPTIONCODE_MAX = PP_CDMEXCEPTIONCODE_QUOTAEXCEEDEDERROR
};
/**
* <code>PP_CdmMessageType</code> contains message type constants.
*/
[assert_size(4)]
enum PP_CdmMessageType {
PP_CDMMESSAGETYPE_LICENSE_REQUEST = 0,
PP_CDMMESSAGETYPE_LICENSE_RENEWAL = 1,
PP_CDMMESSAGETYPE_LICENSE_RELEASE = 2,
PP_CDMMESSAGETYPE_MAX = PP_CDMMESSAGETYPE_LICENSE_RELEASE
};
/**
* <code>PP_CdmKeyStatus</code> contains key status constants.
*/
[assert_size(4)]
enum PP_CdmKeyStatus {
PP_CDMKEYSTATUS_USABLE = 0,
PP_CDMKEYSTATUS_INVALID = 1,
PP_CDMKEYSTATUS_EXPIRED = 2,
PP_CDMKEYSTATUS_OUTPUTRESTRICTED = 3,
PP_CDMKEYSTATUS_OUTPUTDOWNSCALED = 4,
PP_CDMKEYSTATUS_STATUSPENDING = 5,
PP_CDMKEYSTATUS_RELEASED = 6,
PP_CDMKEYSTATUS_MAX = PP_CDMKEYSTATUS_RELEASED
};
/**
* The <code>PP_KeyInformation</code> struct contains information about a
* key used for decryption.
*/
[assert_size(524)]
struct PP_KeyInformation {
/**
* Key ID.
*/
uint8_t[512] key_id;
uint32_t key_id_size;
/**
* Status of this key.
*/
PP_CdmKeyStatus key_status;
/**
* Optional error code for keys that are not usable.
*/
uint32_t system_code;
};