# CryptoInfo

Artifact: [androidx.media3:media3-decoder](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/decoder/CryptoInfo.java+class:androidx.media3.decoder.CryptoInfo)

*** ** * ** ***

<br />

```
@UnstableApi
class CryptoInfo
```

<br />

*** ** * ** ***

Metadata describing the structure of an encrypted input sample.

This class is a compatibility wrapper for `https://developer.android.com/reference/android/media/MediaCodec.CryptoInfo.html`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#CryptoInfo()()` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#increaseClearDataFirstSubSampleBy(int)(count: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Increases the number of clear data for the first sub sample by `count`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#set(int,int[],int[],byte[],byte[],int,int,int)( numSubSamples: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, numBytesOfClearData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!, numBytesOfEncryptedData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!, key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, iv: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, @https://developer.android.com/reference/kotlin/androidx/media3/common/C.CryptoMode mode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, encryptedBlocks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, clearBlocks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#clearBlocks()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#encryptedBlocks()` |
| `https://developer.android.com/reference/android/media/MediaCodec.CryptoInfo.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#frameworkCryptoInfo()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>?` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#iv()` The 16 byte initialization vector. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>?` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#key()` The 16 byte key id. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.CryptoMode https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#mode()` The type of encryption that has been applied. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>?` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#numBytesOfClearData()` The number of leading unencrypted bytes in each sub-sample. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>?` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#numBytesOfEncryptedData()` The number of trailing encrypted bytes in each sub-sample. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#numSubSamples()` The number of subSamples that make up the buffer's contents. |

## Public constructors

### CryptoInfo

```
CryptoInfo()
```

## Public functions

### increaseClearDataFirstSubSampleBy

```
fun increaseClearDataFirstSubSampleBy(count: Int): Unit
```

Increases the number of clear data for the first sub sample by `count`.

If `count` is 0, this method is a no-op. Otherwise, it adds `count` to `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#numBytesOfClearData()`\[0\].

If `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#numBytesOfClearData()` is null (which is permitted), this method will instantiate it to a new `int[1]`.

| Parameters |
|---|---|
| `count: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The number of bytes to be added to the first subSample of `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#numBytesOfClearData()`. |

### set

```
fun set(
    numSubSamples: Int,
    numBytesOfClearData: IntArray<Int>!,
    numBytesOfEncryptedData: IntArray<Int>!,
    key: ByteArray<Byte>!,
    iv: ByteArray<Byte>!,
    @C.CryptoMode mode: Int,
    encryptedBlocks: Int,
    clearBlocks: Int
): Unit
```

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaCodec.CryptoInfo.html#set(int, int[], int[], byte[], byte[], int)` |   |

## Public properties

### clearBlocks

```
val clearBlocks: Int
```

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaCodec.CryptoInfo.Pattern.html` |   |

### encryptedBlocks

```
val encryptedBlocks: Int
```

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaCodec.CryptoInfo.Pattern.html` |   |

### frameworkCryptoInfo

```
val frameworkCryptoInfo: MediaCodec.CryptoInfo!
```

### iv

```
val iv: Array<Byte>?
```

The 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 |
|---|---|
| `https://developer.android.com/reference/android/media/MediaCodec.CryptoInfo.html#iv` |   |

### key

```
val key: Array<Byte>?
```

The 16 byte key id.

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaCodec.CryptoInfo.html#key` |   |

### mode

```
@C.CryptoMode
val mode: Int
```

The type of encryption that has been applied. Must be one of the `https://developer.android.com/reference/kotlin/androidx/media3/common/C.CryptoMode` values.

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaCodec.CryptoInfo.html#mode` |   |

### numBytesOfClearData

```
val numBytesOfClearData: Array<Int>?
```

The number of leading unencrypted bytes in each sub-sample. If null, all bytes are treated as encrypted and `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#numBytesOfEncryptedData()` must be specified.

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaCodec.CryptoInfo.html#numBytesOfClearData` |   |

### numBytesOfEncryptedData

```
val numBytesOfEncryptedData: Array<Int>?
```

The number of trailing encrypted bytes in each sub-sample. If null, all bytes are treated as clear and `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoInfo#numBytesOfClearData()` must be specified.

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaCodec.CryptoInfo.html#numBytesOfEncryptedData` |   |

### numSubSamples

```
val numSubSamples: Int
```

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

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaCodec.CryptoInfo.html#numSubSamples` |   |