MediaCodec.CryptoInfo Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Metadata describing the structure of an encrypted input sample.
[Android.Runtime.Register("android/media/MediaCodec$CryptoInfo", DoNotGenerateAcw=true)]
public sealed class MediaCodec.CryptoInfo : Java.Lang.Object
[<Android.Runtime.Register("android/media/MediaCodec$CryptoInfo", DoNotGenerateAcw=true)>]
type MediaCodec.CryptoInfo = class
inherit Object
- Inheritance
- Attributes
Remarks
Metadata describing the structure of an encrypted input sample.
A buffer's data is considered to be partitioned into "subSamples". Each subSample starts with a run of plain, unencrypted bytes followed by a run of encrypted bytes. Either of these runs may be empty. If pattern encryption applies, each of the encrypted 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, and #numBytesOfEncryptedData
can be null to indicate that all data is clear. At least one of #numBytesOfClearData
and #numBytesOfEncryptedData
must be non-null.
This information encapsulates per-sample metadata as outlined in ISO/IEC FDIS 23001-7:2016 "Common encryption in ISO base media file format files".
<h3>ISO-CENC Schemes</h3> ISO/IEC FDIS 23001-7:2016 defines four possible schemes by which media may be encrypted, corresponding to each possible combination of an AES mode with the presence or absence of patterned encryption.
<table style="width: 0%"> <thead> <tr> <th> </th> <th>AES-CTR</th> <th>AES-CBC</th> </tr> </thead> <tbody> <tr> <th>Without Patterns</th> <td>cenc</td> <td>cbc1</td> </tr><tr> <th>With Patterns</th> <td>cens</td> <td>cbcs</td> </tr> </tbody> </table>
For CryptoInfo
, the scheme is selected implicitly by the combination of the #mode
field and the value set with #setPattern
. For the pattern, setting the pattern to all zeroes (that is, both blocksToEncrypt
and blocksToSkip
are zero) is interpreted as turning patterns off completely. A scheme that does not use patterns will be selected, either cenc or cbc1. Setting the pattern to any nonzero value will choose one of the pattern-supporting schemes, cens or cbcs. The default pattern if #setPattern
is never called is all zeroes.
<h4>HLS SAMPLE-AES Audio</h4> HLS SAMPLE-AES audio is encrypted in a manner compatible with the cbcs scheme, except that it does not use patterned encryption. However, if #setPattern
is used to set the pattern to all zeroes, this will be interpreted as selecting the cbc1 scheme. The cbc1 scheme cannot successfully decrypt HLS SAMPLE-AES audio because of differences in how the IVs are handled. For this reason, it is recommended that a pattern of 1
encrypted block and 0
skip blocks be used with HLS SAMPLE-AES audio. This will trigger decryption to use cbcs mode while still decrypting every block.
Java documentation for android.media.MediaCodec.CryptoInfo
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Constructors
MediaCodec.CryptoInfo() |
Properties
Class |
Returns the runtime class of this |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
Iv |
A 16-byte initialization vector |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
Key |
A 16-byte key id |
Mode |
The type of encryption that has been applied,
see |
NumBytesOfClearData |
The number of leading unencrypted bytes in each subSample. |
NumBytesOfEncryptedData |
The number of trailing encrypted bytes in each subSample. |
NumSubSamples |
The number of subSamples that make up the buffer's contents. |
PeerReference | (Inherited from Object) |
ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
Methods
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
GetPattern() | |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
Set(Int32, Int32[], Int32[], Byte[], Byte[], MediaCodecCryptoMode) |
Set the subsample count, clear/encrypted sizes, key, IV and mode fields of
a |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
SetPattern(MediaCodec+CryptoInfo+Pattern) | |
ToArray<T>() | (Inherited from Object) |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
UnregisterFromRuntime() | (Inherited from Object) |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |