HardwareBufferJni


@RequiresApi(value = 26)
@ExperimentalApi
class HardwareBufferJni : HardwareBufferJniWrapper


JNI methods for HardwareBuffer interaction.

Summary

Constants

const HardwareBufferJni!

Public functions

native Boolean
nativeBindEGLImage(target: Int, eglImageHandle: Long)

Binds an EGLImage to the specified texture target.

native Boolean

Copies a Bitmap to a HardwareBuffer.

native Boolean

Copies the contents of a source HardwareBuffer to a destination HardwareBuffer.

native Long
nativeCreateEglImageFromHardwareBuffer(
    displayHandle: Long,
    hardwareBuffer: HardwareBuffer!
)

Creates an EGLImage from a HardwareBuffer.

native Boolean
nativeDestroyEGLImage(displayHandle: Long, imageHandle: Long)

Destroys an EGLImage.

Inherited functions

From androidx.media3.common.video.HardwareBufferNativeHelpers
abstract Boolean

Copies the contents of a source HardwareBuffer to a destination HardwareBuffer.

Constants

INSTANCE

const val INSTANCE: HardwareBufferJni!

Public functions

nativeBindEGLImage

native fun nativeBindEGLImage(target: Int, eglImageHandle: Long): Boolean

Binds an EGLImage to the specified texture target. Returns whether the binding is successful.

nativeCopyBitmapToHardwareBuffer

native fun nativeCopyBitmapToHardwareBuffer(bitmap: Bitmap!, hb: HardwareBuffer!): Boolean

Copies a Bitmap to a HardwareBuffer. Returns whether the copy is successful.

The destination HardwareBuffer must have USAGE_CPU_WRITE_OFTEN usage.

The source Bitmap.Config must match the destination getFormat, and be either ARGB_8888 and RGBA_8888 or RGBA_1010102 and RGBA_1010102.

nativeCopyHardwareBufferToHardwareBuffer

native fun nativeCopyHardwareBufferToHardwareBuffer(
    srcHb: HardwareBuffer!,
    dstHb: HardwareBuffer!
): Boolean

Copies the contents of a source HardwareBuffer to a destination HardwareBuffer. Returns whether the copy is successful.

The source HardwareBuffer must have USAGE_CPU_READ_OFTEN usage, and the destination HardwareBuffer must have USAGE_CPU_WRITE_OFTEN usage.

The formats of the source and destination buffers must match, and be either RGBA_8888 or RGBA_1010102.

nativeCreateEglImageFromHardwareBuffer

native fun nativeCreateEglImageFromHardwareBuffer(
    displayHandle: Long,
    hardwareBuffer: HardwareBuffer!
): Long

Creates an EGLImage from a HardwareBuffer.

nativeDestroyEGLImage

native fun nativeDestroyEGLImage(displayHandle: Long, imageHandle: Long): Boolean

Destroys an EGLImage. Returns whether the deletion is successful.