# MediaCodec.QueueRequest

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# QueueRequest

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/media/MediaCodec.QueueRequest "View this page in Java")  

```
class QueueRequest
```

|---|--------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                 ||
| ↳ | [android.media.MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) |

Builder-like class for queue requests. Use this class to prepare a queue request and send it.

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ||
|------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                     | [queue](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#queue())`()` Finish building a queue request and queue the buffers with tunings.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | [setByteBufferParameter](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#setByteBufferParameter(kotlin.String,%20java.nio.ByteBuffer))`(`key:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `value:` `[ByteBuffer](https://developer.android.com/reference/kotlin/java/nio/ByteBuffer.html#)`)` Add a[ByteBuffer](https://developer.android.com/reference/kotlin/java/nio/ByteBuffer.html#)parameter.                                                                                                                                                                                                                                                                                                                                                                                                  |
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | [setEncryptedLinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#setEncryptedLinearBlock(android.media.MediaCodec.LinearBlock,%20kotlin.Int,%20kotlin.Int,%20android.media.MediaCodec.CryptoInfo))`(`block:` `[MediaCodec.LinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.LinearBlock)`, `offset:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `size:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `cryptoInfo:` `[MediaCodec.CryptoInfo](https://developer.android.com/reference/kotlin/android/media/MediaCodec.CryptoInfo)`)` Set an encrypted linear block to this queue request.                                                                                                                                       |
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | [setFlags](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#setFlags(kotlin.Int))`(`flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set flags to this queue request.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | [setFloatParameter](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#setFloatParameter(kotlin.String,%20kotlin.Float))`(`key:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `value:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` Add a float parameter.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | [setHardwareBuffer](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#setHardwareBuffer(android.hardware.HardwareBuffer))`(`buffer:` `[HardwareBuffer](https://developer.android.com/reference/kotlin/android/hardware/HardwareBuffer.html#)`)` Set a hardware graphic buffer to this queue request.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | [setIntegerParameter](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#setIntegerParameter(kotlin.String,%20kotlin.Int))`(`key:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `value:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Add an integer parameter.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | [setLinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#setLinearBlock(android.media.MediaCodec.LinearBlock,%20kotlin.Int,%20kotlin.Int))`(`block:` `[MediaCodec.LinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.LinearBlock)`, `offset:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `size:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set a linear block to this queue request.                                                                                                                                                                                                                                                                                                                                        |
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | [setLongParameter](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#setLongParameter(kotlin.String,%20kotlin.Long))`(`key:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `value:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Add a long parameter.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | [setMultiFrameEncryptedLinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#setMultiFrameEncryptedLinearBlock(android.media.MediaCodec.LinearBlock,%20java.util.ArrayDeque,%20java.util.ArrayDeque))`(`block:` `[MediaCodec.LinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.LinearBlock)`, `bufferInfos:` `[ArrayDeque](https://developer.android.com/reference/kotlin/java/util/ArrayDeque.html#)<[MediaCodec.BufferInfo](https://developer.android.com/reference/kotlin/android/media/MediaCodec.BufferInfo)!>`, `cryptoInfos:` `[ArrayDeque](https://developer.android.com/reference/kotlin/java/util/ArrayDeque.html#)<[MediaCodec.CryptoInfo](https://developer.android.com/reference/kotlin/android/media/MediaCodec.CryptoInfo)!>`)` Set an encrypted linear block to this queue request. |
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | [setMultiFrameLinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#setMultiFrameLinearBlock(android.media.MediaCodec.LinearBlock,%20java.util.ArrayDeque))`(`block:` `[MediaCodec.LinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.LinearBlock)`, `infos:` `[ArrayDeque](https://developer.android.com/reference/kotlin/java/util/ArrayDeque.html#)<[MediaCodec.BufferInfo](https://developer.android.com/reference/kotlin/android/media/MediaCodec.BufferInfo)!>`)` Set a linear block that contain multiple non-encrypted access unit to this queue request.                                                                                                                                                                                                                                    |
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | [setPresentationTimeUs](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#setPresentationTimeUs(kotlin.Long))`(`presentationTimeUs:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Set timestamp to this queue request.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | [setStringParameter](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#setStringParameter(kotlin.String,%20kotlin.String))`(`key:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `value:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Add a string parameter.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

## Public methods

### queue

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun queue(): Unit
```

Finish building a queue request and queue the buffers with tunings.  

### setByteBufferParameter

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setByteBufferParameter(
    key: String, 
    value: ByteBuffer
): MediaCodec.QueueRequest
```

Add a[ByteBuffer](https://developer.android.com/reference/kotlin/java/nio/ByteBuffer.html#)parameter. See[MediaFormat](https://developer.android.com/reference/kotlin/android/media/MediaFormat)for an exhaustive list of supported keys with values of byte buffer, that can also be set with[MediaFormat.setByteBuffer](https://developer.android.com/reference/kotlin/android/media/MediaFormat#setByteBuffer(kotlin.String,%20java.nio.ByteBuffer)). If there was[MediaCodec.setParameters](https://developer.android.com/reference/kotlin/android/media/MediaCodec#setParameters(android.os.Bundle))call with the same key which is not processed by the codec yet, the value set from this method will override the unprocessed value.

|                                                         Parameters                                                          ||
|---------|--------------------------------------------------------------------------------------------------------------------|
| `key`   | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`.       |
| `value` | [ByteBuffer](https://developer.android.com/reference/kotlin/java/nio/ByteBuffer.html#):This value cannot be`null`. |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | this object This value cannot be`null`. |

### setEncryptedLinearBlock

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setEncryptedLinearBlock(
    block: MediaCodec.LinearBlock, 
    offset: Int, 
    size: Int, 
    cryptoInfo: MediaCodec.CryptoInfo
): MediaCodec.QueueRequest
```

Set an encrypted linear block to this queue request. Exactly one buffer must be set for a queue request before calling[queue](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#queue()). It is possible to use the same[LinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.LinearBlock)object for multiple queue requests. The behavior is undefined if the range of the buffer overlaps for multiple requests, or the application writes into the region being processed by the codec.

|                                                                                                       Parameters                                                                                                       ||
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `block`      | [MediaCodec.LinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.LinearBlock):The linear block object This value cannot be`null`.                                        |
| `offset`     | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The byte offset into the input buffer at which the data starts.                                                               |
| `size`       | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The number of bytes of valid input data.                                                                                      |
| `cryptoInfo` | [MediaCodec.CryptoInfo](https://developer.android.com/reference/kotlin/android/media/MediaCodec.CryptoInfo):Metadata describing the structure of the encrypted input sample. This value cannot be`null`. |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | this object This value cannot be`null`. |

|                          Exceptions                           ||
|-----------------------------------|----------------------------|
| `java.lang.IllegalStateException` | if a buffer is already set |

### setFlags

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setFlags(flags: Int): MediaCodec.QueueRequest
```

Set flags to this queue request.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ||
|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):A bitmask of flags[BUFFER_FLAG_CODEC_CONFIG](https://developer.android.com/reference/kotlin/android/media/MediaCodec#BUFFER_FLAG_CODEC_CONFIG:kotlin.Int)and[BUFFER_FLAG_END_OF_STREAM](https://developer.android.com/reference/kotlin/android/media/MediaCodec#BUFFER_FLAG_END_OF_STREAM:kotlin.Int). While not prohibited, most codecs do not use the[BUFFER_FLAG_KEY_FRAME](https://developer.android.com/reference/kotlin/android/media/MediaCodec#BUFFER_FLAG_KEY_FRAME:kotlin.Int)flag for input buffers. Value is either`0`or a combination of[android.media.MediaCodec#BUFFER_FLAG_SYNC_FRAME](https://developer.android.com/reference/kotlin/android/media/MediaCodec#BUFFER_FLAG_SYNC_FRAME:kotlin.Int),[android.media.MediaCodec#BUFFER_FLAG_KEY_FRAME](https://developer.android.com/reference/kotlin/android/media/MediaCodec#BUFFER_FLAG_KEY_FRAME:kotlin.Int),[android.media.MediaCodec#BUFFER_FLAG_CODEC_CONFIG](https://developer.android.com/reference/kotlin/android/media/MediaCodec#BUFFER_FLAG_CODEC_CONFIG:kotlin.Int),[android.media.MediaCodec#BUFFER_FLAG_END_OF_STREAM](https://developer.android.com/reference/kotlin/android/media/MediaCodec#BUFFER_FLAG_END_OF_STREAM:kotlin.Int),[android.media.MediaCodec#BUFFER_FLAG_PARTIAL_FRAME](https://developer.android.com/reference/kotlin/android/media/MediaCodec#BUFFER_FLAG_PARTIAL_FRAME:kotlin.Int), android.media.MediaCodec.BUFFER_FLAG_MUXER_DATA, and[android.media.MediaCodec#BUFFER_FLAG_DECODE_ONLY](https://developer.android.com/reference/kotlin/android/media/MediaCodec#BUFFER_FLAG_DECODE_ONLY:kotlin.Int) |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | this object This value cannot be`null`. |

### setFloatParameter

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setFloatParameter(
    key: String, 
    value: Float
): MediaCodec.QueueRequest
```

Add a float parameter. See[MediaFormat](https://developer.android.com/reference/kotlin/android/media/MediaFormat)for an exhaustive list of supported keys with values of type float, that can also be set with[MediaFormat.setFloat](https://developer.android.com/reference/kotlin/android/media/MediaFormat#setFloat(kotlin.String,%20kotlin.Float)). If there was[MediaCodec.setParameters](https://developer.android.com/reference/kotlin/android/media/MediaCodec#setParameters(android.os.Bundle))call with the same key which is not processed by the codec yet, the value set from this method will override the unprocessed value.

|                                                     Parameters                                                      ||
|-------|--------------------------------------------------------------------------------------------------------------|
| `key` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | this object This value cannot be`null`. |

### setHardwareBuffer

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setHardwareBuffer(buffer: HardwareBuffer): MediaCodec.QueueRequest
```

Set a hardware graphic buffer to this queue request. Exactly one buffer must be set for a queue request before calling[queue](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#queue()). Ownership of the hardware buffer is not transferred to this queue request, nor will it be transferred to the codec once[queue](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#queue())is called.

Note: buffers should have format[HardwareBuffer.YCBCR_420_888](https://developer.android.com/reference/kotlin/android/hardware/HardwareBuffer.html#YCBCR_420_888:kotlin.Int), a single layer, and an appropriate usage ([HardwareBuffer.USAGE_CPU_READ_OFTEN](https://developer.android.com/reference/kotlin/android/hardware/HardwareBuffer.html#USAGE_CPU_READ_OFTEN:kotlin.Long)for software codecs and[HardwareBuffer.USAGE_VIDEO_ENCODE](https://developer.android.com/reference/kotlin/android/hardware/HardwareBuffer.html#USAGE_VIDEO_ENCODE:kotlin.Long)for hardware) for codecs to recognize. Format[ImageFormat.PRIVATE](https://developer.android.com/reference/kotlin/android/graphics/ImageFormat.html#PRIVATE:kotlin.Int)together with usage[HardwareBuffer.USAGE_VIDEO_ENCODE](https://developer.android.com/reference/kotlin/android/hardware/HardwareBuffer.html#USAGE_VIDEO_ENCODE:kotlin.Long)will also work for hardware codecs. Codecs may throw exception if the buffer is not recognizable.

|                                                                                   Parameters                                                                                    ||
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `buffer` | [HardwareBuffer](https://developer.android.com/reference/kotlin/android/hardware/HardwareBuffer.html#):The hardware graphic buffer object This value cannot be`null`. |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | this object This value cannot be`null`. |

|                          Exceptions                           ||
|-----------------------------------|----------------------------|
| `java.lang.IllegalStateException` | if a buffer is already set |

### setIntegerParameter

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setIntegerParameter(
    key: String, 
    value: Int
): MediaCodec.QueueRequest
```

Add an integer parameter. See[MediaFormat](https://developer.android.com/reference/kotlin/android/media/MediaFormat)for an exhaustive list of supported keys with values of type int, that can also be set with[MediaFormat.setInteger](https://developer.android.com/reference/kotlin/android/media/MediaFormat#setInteger(kotlin.String,%20kotlin.Int)). If there was[MediaCodec.setParameters](https://developer.android.com/reference/kotlin/android/media/MediaCodec#setParameters(android.os.Bundle))call with the same key which is not processed by the codec yet, the value set from this method will override the unprocessed value.

|                                                     Parameters                                                      ||
|-------|--------------------------------------------------------------------------------------------------------------|
| `key` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | this object This value cannot be`null`. |

### setLinearBlock

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setLinearBlock(
    block: MediaCodec.LinearBlock, 
    offset: Int, 
    size: Int
): MediaCodec.QueueRequest
```

Set a linear block to this queue request. Exactly one buffer must be set for a queue request before calling[queue](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#queue()). It is possible to use the same[LinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.LinearBlock)object for multiple queue requests. The behavior is undefined if the range of the buffer overlaps for multiple requests, or the application writes into the region being processed by the codec.

|                                                                                 Parameters                                                                                  ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `block`  | [MediaCodec.LinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.LinearBlock):The linear block object This value cannot be`null`. |
| `offset` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The byte offset into the input buffer at which the data starts.                        |
| `size`   | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The number of bytes of valid input data.                                               |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | this object This value cannot be`null`. |

|                          Exceptions                           ||
|-----------------------------------|----------------------------|
| `java.lang.IllegalStateException` | if a buffer is already set |

### setLongParameter

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setLongParameter(
    key: String, 
    value: Long
): MediaCodec.QueueRequest
```

Add a long parameter. See[MediaFormat](https://developer.android.com/reference/kotlin/android/media/MediaFormat)for an exhaustive list of supported keys with values of type long, that can also be set with[MediaFormat.setLong](https://developer.android.com/reference/kotlin/android/media/MediaFormat#setLong(kotlin.String,%20kotlin.Long)). If there was[MediaCodec.setParameters](https://developer.android.com/reference/kotlin/android/media/MediaCodec#setParameters(android.os.Bundle))call with the same key which is not processed by the codec yet, the value set from this method will override the unprocessed value.

|                                                     Parameters                                                      ||
|-------|--------------------------------------------------------------------------------------------------------------|
| `key` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | this object This value cannot be`null`. |

### setMultiFrameEncryptedLinearBlock

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setMultiFrameEncryptedLinearBlock(
    block: MediaCodec.LinearBlock, 
    bufferInfos: ArrayDeque<MediaCodec.BufferInfo!>, 
    cryptoInfos: ArrayDeque<MediaCodec.CryptoInfo!>
): MediaCodec.QueueRequest
```

Set an encrypted linear block to this queue request. Exactly one buffer must be set for a queue request before calling[queue](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#queue()). The block can contain multiple access units and if present should be laid out contiguously and without gaps.

|                                                                                                                                                                                                                                                              Parameters                                                                                                                                                                                                                                                              ||
|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `block`       | [MediaCodec.LinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.LinearBlock):The linear block object This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                     |
| `bufferInfos` | [ArrayDeque](https://developer.android.com/reference/kotlin/java/util/ArrayDeque.html#)\<[MediaCodec.BufferInfo](https://developer.android.com/reference/kotlin/android/media/MediaCodec.BufferInfo)!\>:ArrayDeque of[MediaCodec.BufferInfo](https://developer.android.com/reference/kotlin/android/media/MediaCodec.BufferInfo)that describes the contents in the buffer. The ArrayDeque and the BufferInfo objects provided can be recycled by the caller for re-use. This value cannot be`null`.                   |
| `cryptoInfos` | [ArrayDeque](https://developer.android.com/reference/kotlin/java/util/ArrayDeque.html#)\<[MediaCodec.CryptoInfo](https://developer.android.com/reference/kotlin/android/media/MediaCodec.CryptoInfo)!\>:ArrayDeque of[MediaCodec.CryptoInfo](https://developer.android.com/reference/kotlin/android/media/MediaCodec.CryptoInfo)that describes the structure of the encrypted input samples. The ArrayDeque and the BufferInfo objects provided can be recycled by the caller for re-use. This value cannot be`null`. |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | this object This value cannot be`null`. |

|                                                          Exceptions                                                           ||
|--------------------------------------|-----------------------------------------------------------------------------------------|
| `java.lang.IllegalStateException`    | if a buffer is already set                                                              |
| `java.lang.IllegalArgumentException` | upon if bufferInfos is empty, contains null, or if the access units are not contiguous. |

### setMultiFrameLinearBlock

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setMultiFrameLinearBlock(
    block: MediaCodec.LinearBlock, 
    infos: ArrayDeque<MediaCodec.BufferInfo!>
): MediaCodec.QueueRequest
```

Set a linear block that contain multiple non-encrypted access unit to this queue request. Exactly one buffer must be set for a queue request before calling[queue](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#queue()). Multiple access units if present must be laid out contiguously and without gaps and in order. An IllegalArgumentException will be thrown during[queue](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#queue())if access units are not laid out contiguously.

|                                                                                                                                                                                                                         Parameters                                                                                                                                                                                                                         ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `block` | [MediaCodec.LinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.LinearBlock):The linear block object This value cannot be`null`.                                                                                                                                                                                                                                                                                 |
| `infos` | [ArrayDeque](https://developer.android.com/reference/kotlin/java/util/ArrayDeque.html#)\<[MediaCodec.BufferInfo](https://developer.android.com/reference/kotlin/android/media/MediaCodec.BufferInfo)!\>:Represents[MediaCodec.BufferInfo](https://developer.android.com/reference/kotlin/android/media/MediaCodec.BufferInfo)objects to mark individual access-unit boundaries and the timestamps associated with it. This value cannot be`null`. |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | this object This value cannot be`null`. |

|                          Exceptions                           ||
|-----------------------------------|----------------------------|
| `java.lang.IllegalStateException` | if a buffer is already set |

### setPresentationTimeUs

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setPresentationTimeUs(presentationTimeUs: Long): MediaCodec.QueueRequest
```

Set timestamp to this queue request.

|                                                                                                                                                                                                                                   Parameters                                                                                                                                                                                                                                    ||
|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `presentationTimeUs` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html):The presentation timestamp in microseconds for this buffer. This is normally the media time at which this buffer should be presented (rendered). When using an output surface, this will be propagated as the[timestamp](https://developer.android.com/reference/kotlin/android/graphics/SurfaceTexture.html#getTimestamp())for the frame (after conversion to nanoseconds). |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | this object This value cannot be`null`. |

### setStringParameter

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setStringParameter(
    key: String, 
    value: String
): MediaCodec.QueueRequest
```

Add a string parameter. See[MediaFormat](https://developer.android.com/reference/kotlin/android/media/MediaFormat)for an exhaustive list of supported keys with values of type string, that can also be set with[MediaFormat.setString](https://developer.android.com/reference/kotlin/android/media/MediaFormat#setString(kotlin.String,%20kotlin.String)). If there was[MediaCodec.setParameters](https://developer.android.com/reference/kotlin/android/media/MediaCodec#setParameters(android.os.Bundle))call with the same key which is not processed by the codec yet, the value set from this method will override the unprocessed value.

|                                                      Parameters                                                       ||
|---------|--------------------------------------------------------------------------------------------------------------|
| `key`   | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |
| `value` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [MediaCodec.QueueRequest](https://developer.android.com/reference/kotlin/android/media/MediaCodec.QueueRequest#) | this object This value cannot be`null`. |