# MediaCodec.OutputFrame

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

# OutputFrame

*** ** * ** ***

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

```
class OutputFrame
```

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

A single output frame and its associated metadata.

## Summary

|                                                                                                                                                                                                                   Public methods                                                                                                                                                                                                                    ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ArrayDeque](https://developer.android.com/reference/kotlin/java/util/ArrayDeque.html#)\<[MediaCodec.BufferInfo](https://developer.android.com/reference/kotlin/android/media/MediaCodec.BufferInfo)!\> | [getBufferInfos](https://developer.android.com/reference/kotlin/android/media/MediaCodec.OutputFrame#getBufferInfos())`()` <br />                                                                                                          |
| [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>              | [getChangedKeys](https://developer.android.com/reference/kotlin/android/media/MediaCodec.OutputFrame#getChangedKeys())`()` Returns an unmodifiable set of the names of entries that has changed from the previous frame.                   |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                                              | [getFlags](https://developer.android.com/reference/kotlin/android/media/MediaCodec.OutputFrame#getFlags())`()` Returns the buffer flags.                                                                                                   |
| [MediaFormat](https://developer.android.com/reference/kotlin/android/media/MediaFormat)                                                                                                                 | [getFormat](https://developer.android.com/reference/kotlin/android/media/MediaCodec.OutputFrame#getFormat())`()` Returns a read-only[MediaFormat](https://developer.android.com/reference/kotlin/android/media/MediaFormat)for this frame. |
| [HardwareBuffer](https://developer.android.com/reference/kotlin/android/hardware/HardwareBuffer.html#)?                                                                                                 | [getHardwareBuffer](https://developer.android.com/reference/kotlin/android/media/MediaCodec.OutputFrame#getHardwareBuffer())`()` Returns the output hardware graphic buffer, or null if this frame is empty.                               |
| [MediaCodec.LinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.LinearBlock)?                                                                                          | [getLinearBlock](https://developer.android.com/reference/kotlin/android/media/MediaCodec.OutputFrame#getLinearBlock())`()` Returns the output linear block, or null if this frame is empty.                                                |
| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)                                                                                                                            | [getPresentationTimeUs](https://developer.android.com/reference/kotlin/android/media/MediaCodec.OutputFrame#getPresentationTimeUs())`()` Returns the presentation timestamp in microseconds.                                               |

## Public methods

### getBufferInfos

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

```
fun getBufferInfos(): ArrayDeque<MediaCodec.BufferInfo!>
```

|                                                                                                               Return                                                                                                               ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ArrayDeque](https://developer.android.com/reference/kotlin/java/util/ArrayDeque.html#)<[MediaCodec.BufferInfo](https://developer.android.com/reference/kotlin/android/media/MediaCodec.BufferInfo)!> | This value cannot be`null`. |

### getChangedKeys

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

```
fun getChangedKeys(): MutableSet<String!>
```

Returns an unmodifiable set of the names of entries that has changed from the previous frame. The entries may have been removed/changed/added. Client can find out what the change is by querying[MediaFormat](https://developer.android.com/reference/kotlin/android/media/MediaFormat)object returned from[getFormat](https://developer.android.com/reference/kotlin/android/media/MediaCodec.OutputFrame#getFormat()).

|                                                                                                        Return                                                                                                         ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!> | This value cannot be`null`. |

### getFlags

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

```
fun getFlags(): Int
```

Returns the buffer flags.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               Return                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ||
|----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | 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) |

### getFormat

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

```
fun getFormat(): MediaFormat
```

Returns a read-only[MediaFormat](https://developer.android.com/reference/kotlin/android/media/MediaFormat)for this frame. The returned object is valid only until the client calls android.media.MediaCodec#releaseOutputBuffer.

|                                                        Return                                                        ||
|-----------------------------------------------------------------------------------------|-----------------------------|
| [MediaFormat](https://developer.android.com/reference/kotlin/android/media/MediaFormat) | This value cannot be`null`. |

### getHardwareBuffer

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

```
fun getHardwareBuffer(): HardwareBuffer?
```

Returns the output hardware graphic buffer, or null if this frame is empty.

|                               Exceptions                                ||
|-----------------------------------|--------------------------------------|
| `java.lang.IllegalStateException` | if this output frame is not graphic. |

### getLinearBlock

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

```
fun getLinearBlock(): MediaCodec.LinearBlock?
```

Returns the output linear block, or null if this frame is empty.

|                               Exceptions                               ||
|-----------------------------------|-------------------------------------|
| `java.lang.IllegalStateException` | if this output frame is not linear. |

### getPresentationTimeUs

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

```
fun getPresentationTimeUs(): Long
```

Returns the presentation timestamp in microseconds.