Most visited

Recently visited

Added in API level 16

MediaCodec.CryptoInfo

public static final class MediaCodec.CryptoInfo
extends Object

java.lang.Object
   ↳ android.media.MediaCodec.CryptoInfo


Metadata describing the structure of a (at least partially) encrypted input sample. A buffer's data is considered to be partitioned into "subSamples", each subSample starts with a (potentially empty) run of plain, unencrypted bytes followed by a (also potentially empty) run of encrypted bytes. If pattern encryption applies, each of the latter runs is encrypted only partly, according to a repeating pattern of "encrypt" and "skip" blocks. numBytesOfClearData can be null to indicate that all data is encrypted. This information encapsulates per-sample metadata as outlined in ISO/IEC FDIS 23001-7:2011 "Common encryption in ISO base media file format files".

Summary

Nested classes

class MediaCodec.CryptoInfo.Pattern

Metadata describing an encryption pattern for the protected bytes in a subsample. 

Fields

public byte[] iv

A 16-byte initialization vector

public byte[] key

A 16-byte key id

public int mode

The type of encryption that has been applied, see CRYPTO_MODE_UNENCRYPTED, CRYPTO_MODE_AES_CTR and CRYPTO_MODE_AES_CBC

public int[] numBytesOfClearData

The number of leading unencrypted bytes in each subSample.

public int[] numBytesOfEncryptedData

The number of trailing encrypted bytes in each subSample.

public int numSubSamples

The number of subSamples that make up the buffer's contents.

Public constructors

MediaCodec.CryptoInfo()

Public methods

void set(int newNumSubSamples, int[] newNumBytesOfClearData, int[] newNumBytesOfEncryptedData, byte[] newKey, byte[] newIV, int newMode)

Set the subsample count, clear/encrypted sizes, key, IV and mode fields of a MediaCodec.CryptoInfo instance.

void setPattern(MediaCodec.CryptoInfo.Pattern newPattern)

Set the encryption pattern on a MediaCodec.CryptoInfo instance.

String toString()

Returns a string representation of the object.

Inherited methods

From class java.lang.Object

Fields

iv

Added in API level 16
byte[] iv

A 16-byte initialization vector

key

Added in API level 16
byte[] key

A 16-byte key id

mode

Added in API level 16
int mode

The type of encryption that has been applied, see CRYPTO_MODE_UNENCRYPTED, CRYPTO_MODE_AES_CTR and CRYPTO_MODE_AES_CBC

numBytesOfClearData

Added in API level 16
int[] numBytesOfClearData

The number of leading unencrypted bytes in each subSample.

numBytesOfEncryptedData

Added in API level 16
int[] numBytesOfEncryptedData

The number of trailing encrypted bytes in each subSample.

numSubSamples

Added in API level 16
int numSubSamples

The number of subSamples that make up the buffer's contents.

Public constructors

MediaCodec.CryptoInfo

Added in API level 16
MediaCodec.CryptoInfo ()

Public methods

set

Added in API level 16
void set (int newNumSubSamples, 
                int[] newNumBytesOfClearData, 
                int[] newNumBytesOfEncryptedData, 
                byte[] newKey, 
                byte[] newIV, 
                int newMode)

Set the subsample count, clear/encrypted sizes, key, IV and mode fields of a MediaCodec.CryptoInfo instance.

Parameters
newNumSubSamples int
newNumBytesOfClearData int
newNumBytesOfEncryptedData int
newKey byte
newIV byte
newMode int

setPattern

Added in API level 24
void setPattern (MediaCodec.CryptoInfo.Pattern newPattern)

Set the encryption pattern on a MediaCodec.CryptoInfo instance. See MediaCodec.CryptoInfo.Pattern.

Parameters
newPattern MediaCodec.CryptoInfo.Pattern

toString

Added in API level 16
String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.

Hooray!