Class CryptoInfo
java.lang.Object
com.castlabs.sdk.base.subtitles.buffer.CryptoInfo
Compatibility wrapper for
MediaCodec.CryptoInfo.-
Field Summary
FieldsModifier and TypeFieldDescriptionintbyte[]intbyte[]The 16 byte initialization vector.byte[]The 16 byte key id.intThe type of encryption that has been applied.int[]The number of leading unencrypted bytes in each sub-sample.int[]The number of trailing encrypted bytes in each sub-sample.intThe number of subSamples that make up the buffer's contents. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns an equivalentMediaCodec.CryptoInfoinstance.Deprecated.voidincreaseClearDataFirstSubSampleBy(int count) Increases the number of clear data for the first sub sample bycount.voidset(int numSubSamples, int[] numBytesOfClearData, int[] numBytesOfEncryptedData, byte[] key, byte[] iv, int mode, int encryptedBlocks, int clearBlocks) voidset(int numSubSamples, int[] numBytesOfClearData, int[] numBytesOfEncryptedData, byte[] key, byte[] iv, int mode, int encryptedBlocks, int clearBlocks, byte[] ecmData)
-
Field Details
-
iv
public byte[] ivThe 16 byte initialization vector. If the initialization vector of the content is shorter than 16 bytes, 0 byte padding is appended to extend the vector to the required 16 byte length.- See Also:
-
key
public byte[] keyThe 16 byte key id.- See Also:
-
mode
The type of encryption that has been applied. Must be one of theConstants.CryptoModevalues.- See Also:
-
numBytesOfClearData
@Nullable public int[] numBytesOfClearDataThe number of leading unencrypted bytes in each sub-sample. If null, all bytes are treated as encrypted andnumBytesOfEncryptedDatamust be specified.- See Also:
-
numBytesOfEncryptedData
public int[] numBytesOfEncryptedDataThe number of trailing encrypted bytes in each sub-sample. If null, all bytes are treated as clear andnumBytesOfClearDatamust be specified.- See Also:
-
numSubSamples
public int numSubSamplesThe number of subSamples that make up the buffer's contents.- See Also:
-
encryptedBlocks
public int encryptedBlocks- See Also:
-
clearBlocks
public int clearBlocks- See Also:
-
ecmData
@Nullable public byte[] ecmData
-
-
Constructor Details
-
CryptoInfo
public CryptoInfo()
-
-
Method Details
-
set
public void set(int numSubSamples, int[] numBytesOfClearData, int[] numBytesOfEncryptedData, byte[] key, byte[] iv, @CryptoMode int mode, int encryptedBlocks, int clearBlocks) - See Also:
-
set
public void set(int numSubSamples, int[] numBytesOfClearData, int[] numBytesOfEncryptedData, byte[] key, byte[] iv, @CryptoMode int mode, int encryptedBlocks, int clearBlocks, byte[] ecmData) -
getFrameworkCryptoInfo
Returns an equivalentMediaCodec.CryptoInfoinstance.Successive calls to this method on a single
CryptoInfowill return the same instance. Changes to theCryptoInfowill be reflected in the returned object. The return object should not be modified directly.- Returns:
- The equivalent
MediaCodec.CryptoInfoinstance.
-
increaseClearDataFirstSubSampleBy
public void increaseClearDataFirstSubSampleBy(int count) Increases the number of clear data for the first sub sample bycount.If
countis 0, this method is a no-op. Otherwise, it addscounttonumBytesOfClearData[0].If
numBytesOfClearDatais null (which is permitted), this method will instantiate it to a newint[1].- Parameters:
count- The number of bytes to be added to the first subSample ofnumBytesOfClearData.
-
getFrameworkCryptoInfoV16
Deprecated.
-
getFrameworkCryptoInfo().