EGLSurfaceTexture


@RequiresApi(value = 17)
@UnstableApi
public final class EGLSurfaceTexture implements SurfaceTexture.OnFrameAvailableListener, Runnable


Generates a SurfaceTexture using EGL/GLES functions.

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
public annotation EGLSurfaceTexture.SecureMode

Secure mode to be used by the EGL surface and context.

Listener to be called when the texture image on SurfaceTexture has been updated.

Constants

static final int

No secure EGL surface and context required.

static final int

Creating a secure surface backed by a pixel buffer.

static final int

Creating a surfaceless, secured EGL context.

Public constructors

Public methods

SurfaceTexture

Returns the wrapped SurfaceTexture.

void

Initializes required EGL parameters and creates the SurfaceTexture.

void
void

Releases all allocated resources.

void
run()

Constants

SECURE_MODE_NONE

public static final int SECURE_MODE_NONE = 0

No secure EGL surface and context required.

SECURE_MODE_PROTECTED_PBUFFER

public static final int SECURE_MODE_PROTECTED_PBUFFER = 2

Creating a secure surface backed by a pixel buffer.

SECURE_MODE_SURFACELESS_CONTEXT

public static final int SECURE_MODE_SURFACELESS_CONTEXT = 1

Creating a surfaceless, secured EGL context.

Public constructors

EGLSurfaceTexture

public EGLSurfaceTexture(Handler handler)
Parameters
Handler handler

The Handler that will be used to call updateTexImage to update images on the SurfaceTexture. Note that init has to be called on the same looper thread as the Handler's looper.

EGLSurfaceTexture

public EGLSurfaceTexture(
    Handler handler,
    @Nullable EGLSurfaceTexture.TextureImageListener callback
)
Parameters
Handler handler

The Handler that will be used to call updateTexImage to update images on the SurfaceTexture. Note that init has to be called on the same looper thread as the looper of the .

@Nullable EGLSurfaceTexture.TextureImageListener callback

The TextureImageListener to be called when the texture image on has been updated. This callback will be called on the same handler thread as the handler.

Public methods

getSurfaceTexture

public SurfaceTexture getSurfaceTexture()

Returns the wrapped SurfaceTexture. This can only be called after init.

init

public void init(@EGLSurfaceTexture.SecureMode int secureMode)

Initializes required EGL parameters and creates the SurfaceTexture.

Parameters
@EGLSurfaceTexture.SecureMode int secureMode

The SecureMode to be used for EGL surface.

onFrameAvailable

public void onFrameAvailable(SurfaceTexture surfaceTexture)

release

public void release()

Releases all allocated resources.

run

public void run()