# VideoDecoderOutputBuffer

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/VideoDecoderOutputBuffer.java+class:androidx.media3.decoder.VideoDecoderOutputBuffer)

*** ** * ** ***


```
@UnstableApi
class VideoDecoderOutputBuffer : DecoderOutputBuffer
```

<br />

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) ||||
| ↳ | [androidx.media3.decoder.Buffer](https://developer.android.com/reference/kotlin/androidx/media3/decoder/Buffer) |||
|   | ↳ | [androidx.media3.decoder.DecoderOutputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/decoder/DecoderOutputBuffer) ||
|   |   | ↳ | [androidx.media3.decoder.VideoDecoderOutputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer) |

*** ** * ** ***

Video decoder output buffer containing video frame data.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#COLORSPACE_BT2020() = 3` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#COLORSPACE_BT601() = 1` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#COLORSPACE_BT709() = 2` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#COLORSPACE_UNKNOWN() = 0` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#VideoDecoderOutputBuffer(androidx.media3.decoder.DecoderOutputBuffer.Owner<androidx.media3.decoder.VideoDecoderOutputBuffer>)( owner: https://developer.android.com/reference/kotlin/androidx/media3/decoder/DecoderOutputBuffer.Owner<https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer!>! )` Creates VideoDecoderOutputBuffer. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#init(long,int,java.nio.ByteBuffer)( timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, @https://developer.android.com/reference/kotlin/androidx/media3/common/C.VideoOutputMode mode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, supplementalData: https://developer.android.com/reference/java/nio/ByteBuffer.html? )` Initializes the buffer. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#initForOffsetFrames(int,int,int,int,int,int,int)( offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, yStride: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uvStride: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, colorspace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, alignedHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#initForPrivateFrame(int,int)(width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Configures the buffer for the given frame dimensions when passing actual frame data via `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#decoderPrivate()`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#initForYuvFrame(int,int,int,int,int)( width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, yStride: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, uvStride: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, colorspace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Resizes the buffer based on the given stride. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#release()()` Releases the output buffer for reuse. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#colorspace()` |
| `https://developer.android.com/reference/java/nio/ByteBuffer.html?` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#data()` RGB buffer for RGB mode. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#decoderPrivate()` Decoder private data. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Format?` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#format()` The format of the input from which this output buffer was decoded. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#height()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.VideoOutputMode https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#mode()` Output mode. |
| `https://developer.android.com/reference/java/nio/ByteBuffer.html?` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#supplementalData()` Supplemental data related to the output frame, if `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Buffer#hasSupplementalData()` returns true. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#uvStride()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#width()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#yStride()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/java/nio/ByteBuffer.html!>?` | `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#yuvPlanes()` YUV planes for YUV mode. |
| `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/VideoDecoderOutputBuffer#yuvStrides()` |

### Inherited functions

From [androidx.media3.decoder.Buffer](https://developer.android.com/reference/kotlin/androidx/media3/decoder/Buffer) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Buffer#addFlag(int)(@https://developer.android.com/reference/kotlin/androidx/media3/common/C.BufferFlags flag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Adds the `flag` to this buffer's flags.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Buffer#clearFlag(int)(@https://developer.android.com/reference/kotlin/androidx/media3/common/C.BufferFlags flag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Removes the `flag` from this buffer's flags, if it is set.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://checkerframework.org/api/org/checkerframework/dataflow/qual/Pure.html
https://developer.android.com/reference/kotlin/androidx/media3/decoder/Buffer#getFlag(int)(@https://developer.android.com/reference/kotlin/androidx/media3/common/C.BufferFlags flag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Returns whether the specified flag has been set on this buffer.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://checkerframework.org/api/org/checkerframework/dataflow/qual/Pure.html
https://developer.android.com/reference/kotlin/androidx/media3/decoder/Buffer#hasSupplementalData()()`

Returns whether the `https://developer.android.com/reference/kotlin/androidx/media3/common/C#BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA()` flag is set.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://checkerframework.org/api/org/checkerframework/dataflow/qual/Pure.html
https://developer.android.com/reference/kotlin/androidx/media3/decoder/Buffer#isEndOfStream()()`

Returns whether the `https://developer.android.com/reference/kotlin/androidx/media3/common/C#BUFFER_FLAG_END_OF_STREAM()` flag is set.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://checkerframework.org/api/org/checkerframework/dataflow/qual/Pure.html
https://developer.android.com/reference/kotlin/androidx/media3/decoder/Buffer#isFirstSample()()`

Returns whether the `https://developer.android.com/reference/kotlin/androidx/media3/common/C#BUFFER_FLAG_FIRST_SAMPLE()` flag is set.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://checkerframework.org/api/org/checkerframework/dataflow/qual/Pure.html
https://developer.android.com/reference/kotlin/androidx/media3/decoder/Buffer#isKeyFrame()()`

Returns whether the `https://developer.android.com/reference/kotlin/androidx/media3/common/C#BUFFER_FLAG_KEY_FRAME()` flag is set.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://checkerframework.org/api/org/checkerframework/dataflow/qual/Pure.html
https://developer.android.com/reference/kotlin/androidx/media3/decoder/Buffer#isLastSample()()`

Returns whether the `https://developer.android.com/reference/kotlin/androidx/media3/common/C#BUFFER_FLAG_LAST_SAMPLE()` flag is set.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://checkerframework.org/api/org/checkerframework/dataflow/qual/Pure.html
https://developer.android.com/reference/kotlin/androidx/media3/decoder/Buffer#notDependedOn()()`

Returns whether the `https://developer.android.com/reference/kotlin/androidx/media3/common/C#BUFFER_FLAG_NOT_DEPENDED_ON()` flag is set.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Buffer#setFlags(int)(@https://developer.android.com/reference/kotlin/androidx/media3/common/C.BufferFlags flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Replaces this buffer's flags with `flags`.
From [androidx.media3.decoder.DecoderOutputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/decoder/DecoderOutputBuffer) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper
https://developer.android.com/reference/kotlin/androidx/media3/decoder/DecoderOutputBuffer#clear()()`

Clears the buffer.

### Inherited properties

From [androidx.media3.decoder.DecoderOutputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/decoder/DecoderOutputBuffer) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/DecoderOutputBuffer#shouldBeSkipped()`

Whether this buffer should be skipped, usually because the decoding process generated no data or invalid data.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/DecoderOutputBuffer#skippedOutputBufferCount()`

The number of buffers immediately prior to this one that were skipped in the `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/DecoderOutputBuffer#timeUs()`

The presentation timestamp for the buffer, in microseconds.

## Constants

### COLORSPACE_BT2020

```
const val COLORSPACE_BT2020 = 3: Int
```

### COLORSPACE_BT601

```
const val COLORSPACE_BT601 = 1: Int
```

### COLORSPACE_BT709

```
const val COLORSPACE_BT709 = 2: Int
```

### COLORSPACE_UNKNOWN

```
const val COLORSPACE_UNKNOWN = 0: Int
```

## Public constructors

### VideoDecoderOutputBuffer

```
VideoDecoderOutputBuffer(
    owner: DecoderOutputBuffer.Owner<VideoDecoderOutputBuffer!>!
)
```

Creates VideoDecoderOutputBuffer.

| Parameters |
|---|---|
| `owner: https://developer.android.com/reference/kotlin/androidx/media3/decoder/DecoderOutputBuffer.Owner<https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer!>!` | Buffer owner. |

## Public functions

### init

```
fun init(
    timeUs: Long,
    @C.VideoOutputMode mode: Int,
    supplementalData: ByteBuffer?
): Unit
```

Initializes the buffer.

| Parameters |
|---|---|
| `timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The presentation timestamp for the buffer, in microseconds. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.VideoOutputMode mode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The output mode. One of `https://developer.android.com/reference/kotlin/androidx/media3/common/C#VIDEO_OUTPUT_MODE_NONE()`, `https://developer.android.com/reference/kotlin/androidx/media3/common/C#VIDEO_OUTPUT_MODE_YUV()` and `https://developer.android.com/reference/kotlin/androidx/media3/common/C#VIDEO_OUTPUT_MODE_SURFACE_YUV()`. |
| `supplementalData: https://developer.android.com/reference/java/nio/ByteBuffer.html?` | Supplemental data associated with the frame, or `null` if not present. It is safe to reuse the provided buffer after this method returns. |

### initForOffsetFrames

```
fun initForOffsetFrames(
    offset: Int,
    width: Int,
    height: Int,
    yStride: Int,
    uvStride: Int,
    colorspace: Int,
    alignedHeight: Int
): Boolean
```

### initForPrivateFrame

```
fun initForPrivateFrame(width: Int, height: Int): Unit
```

Configures the buffer for the given frame dimensions when passing actual frame data via `https://developer.android.com/reference/kotlin/androidx/media3/decoder/VideoDecoderOutputBuffer#decoderPrivate()`. Called via JNI after decoding completes.

### initForYuvFrame

```
fun initForYuvFrame(
    width: Int,
    height: Int,
    yStride: Int,
    uvStride: Int,
    colorspace: Int
): Boolean
```

Resizes the buffer based on the given stride. Called via JNI after decoding completes.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the buffer was resized successfully. |

### release

```
fun release(): Unit
```

Releases the output buffer for reuse. Must be called when the buffer is no longer needed.

## Public properties

### colorspace

```
val colorspace: Int
```

### data

```
val data: ByteBuffer?
```

RGB buffer for RGB mode.

### decoderPrivate

```
val decoderPrivate: Long
```

Decoder private data. Used from native code.

### format

```
val format: Format?
```

The format of the input from which this output buffer was decoded.

### height

```
val height: Int
```

### mode

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

Output mode.

### supplementalData

```
val supplementalData: ByteBuffer?
```

Supplemental data related to the output frame, if `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Buffer#hasSupplementalData()` returns true. If present, the buffer is populated with supplemental data from position 0 to its limit.

### uvStride

```
val uvStride: Int
```

### width

```
val width: Int
```

### yStride

```
val yStride: Int
```

### yuvPlanes

```
val yuvPlanes: Array<ByteBuffer!>?
```

YUV planes for YUV mode.

### yuvStrides

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