VideoDecoderOutputBuffer


@UnstableApi
class VideoDecoderOutputBuffer : DecoderOutputBuffer


Video decoder output buffer containing video frame data.

Summary

Constants

const Int
const Int
const Int
const Int

Public constructors

Creates VideoDecoderOutputBuffer.

Public functions

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

Initializes the buffer.

Unit
initForPrivateFrame(width: Int, height: Int)

Configures the buffer for the given frame dimensions when passing actual frame data via decoderPrivate.

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

Resizes the buffer based on the given stride.

Unit

Releases the output buffer for reuse.

Public properties

Int
ByteBuffer?

RGB buffer for RGB mode.

Int

Decoder private data.

Format?

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

Int
Int

Output mode.

ByteBuffer?

Supplemental data related to the output frame, if hasSupplementalData returns true.

Int
Array<ByteBuffer!>?

YUV planes for YUV mode.

IntArray<Int>?

Inherited functions

From androidx.media3.decoder.Buffer
Unit

Adds the flag to this buffer's flags.

Unit

Removes the flag from this buffer's flags, if it is set.

Boolean

Returns whether the specified flag has been set on this buffer.

Boolean

Returns whether the BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA flag is set.

Boolean

This function is deprecated.

Check instead whether the buffer time is greater or equal to the desired start time.

Boolean

Returns whether the BUFFER_FLAG_END_OF_STREAM flag is set.

Boolean

Returns whether the BUFFER_FLAG_FIRST_SAMPLE flag is set.

Boolean

Returns whether the BUFFER_FLAG_KEY_FRAME flag is set.

Boolean

Returns whether the BUFFER_FLAG_LAST_SAMPLE flag is set.

Unit

Replaces this buffer's flags with flags.

From androidx.media3.decoder.DecoderOutputBuffer
Unit

Clears the buffer.

Inherited properties

From androidx.media3.decoder.DecoderOutputBuffer
Boolean

Whether this buffer should be skipped, usually because the decoding process generated no data or invalid data.

Int

The number of buffers immediately prior to this one that were skipped in the Decoder.

Long

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: DecoderOutputBuffer.Owner<VideoDecoderOutputBuffer!>!

Buffer owner.

Public functions

init

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

Initializes the buffer.

Parameters
timeUs: Long

The presentation timestamp for the buffer, in microseconds.

@C.VideoOutputMode mode: Int

The output mode. One of VIDEO_OUTPUT_MODE_NONE, VIDEO_OUTPUT_MODE_YUV and VIDEO_OUTPUT_MODE_SURFACE_YUV.

supplementalData: ByteBuffer?

Supplemental data associated with the frame, or null if not present. It is safe to reuse the provided buffer after this method returns.

initForPrivateFrame

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

Configures the buffer for the given frame dimensions when passing actual frame data via 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
Boolean

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 colorspaceInt

data

val dataByteBuffer?

RGB buffer for RGB mode.

decoderPrivate

val decoderPrivateInt

Decoder private data. Used from native code.

format

val formatFormat?

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

height

val heightInt

mode

@C.VideoOutputMode
val modeInt

Output mode.

supplementalData

val supplementalDataByteBuffer?

Supplemental data related to the output frame, if hasSupplementalData returns true. If present, the buffer is populated with supplemental data from position 0 to its limit.

width

val widthInt

yuvPlanes

val yuvPlanesArray<ByteBuffer!>?

YUV planes for YUV mode.

yuvStrides

val yuvStridesIntArray<Int>?