HardwareBufferFrame


@ExperimentalApi
class HardwareBufferFrame


A Frame implementation backed by a HardwareBuffer.

Frames of this type may be mappable to memory accessible by various hardware systems, such as GPU, media codecs, NPU, or other auxiliary processing units.

On API levels before 26, where HardwareBuffer is not defined, internalFrame will be set for use within this package. internalFrame is not intended for use by third party apps.

Summary

Nested types

A builder for HardwareBufferFrame instances.

Public functions

HardwareBufferFrame.Builder!

Returns a Builder initialized with the values of this instance.

Unit

Releases the frame and its underlying resources.

Public properties

SyncFence?

An acquire SyncFence for the HardwareBuffer.

Format!

The format of the frame.

HardwareBuffer?

Returns the HardwareBuffer which holds the frame data, or null if hardware buffers are not supported on the current API level.

Any?

An optional internal frame type that is used when hardwareBuffer is not supported.

Frame.Metadata!
Long

The presentation time of the frame, in microseconds.

Long

The release time of the frame, in nanoseconds.

Constants

END_OF_STREAM_FRAME

const val END_OF_STREAM_FRAMEHardwareBufferFrame!

Public functions

buildUpon

fun buildUpon(): HardwareBufferFrame.Builder!

Returns a Builder initialized with the values of this instance.

release

fun release(): Unit

Releases the frame and its underlying resources.

Public properties

acquireFence

val acquireFenceSyncFence?

An acquire SyncFence for the HardwareBuffer.

Callers should ensure that the acquire fence has signaled before accessing HardwareBuffer.

If the acquire fence is null, it's safe to access HardwareBuffer.

format

val formatFormat!

The format of the frame.

hardwareBuffer

val hardwareBufferHardwareBuffer?

Returns the HardwareBuffer which holds the frame data, or null if hardware buffers are not supported on the current API level.

internalFrame

val internalFrameAny?

An optional internal frame type that is used when hardwareBuffer is not supported.

metadata

val metadataFrame.Metadata!

presentationTimeUs

val presentationTimeUsLong

The presentation time of the frame, in microseconds.

releaseTimeNs

val releaseTimeNsLong

The release time of the frame, in nanoseconds.