public final class EGLSurfaceTexture
extends java.lang.Object
implements android.graphics.SurfaceTexture.OnFrameAvailableListener, java.lang.Runnable
SurfaceTexture using EGL/GLES functions.| Modifier and Type | Class and Description |
|---|---|
static class |
EGLSurfaceTexture.GlException
A runtime exception to be thrown if some EGL operations failed.
|
static interface |
EGLSurfaceTexture.SecureMode
Secure mode to be used by the EGL surface and context.
|
static interface |
EGLSurfaceTexture.TextureImageListener
Listener to be called when the texture image on
SurfaceTexture has been updated. |
| Modifier and Type | Field and Description |
|---|---|
static int |
SECURE_MODE_NONE
No secure EGL surface and context required.
|
static int |
SECURE_MODE_PROTECTED_PBUFFER
Creating a secure surface backed by a pixel buffer.
|
static int |
SECURE_MODE_SURFACELESS_CONTEXT
Creating a surfaceless, secured EGL context.
|
| Constructor and Description |
|---|
EGLSurfaceTexture(android.os.Handler handler) |
EGLSurfaceTexture(android.os.Handler handler,
EGLSurfaceTexture.TextureImageListener callback) |
| Modifier and Type | Method and Description |
|---|---|
android.graphics.SurfaceTexture |
getSurfaceTexture()
Returns the wrapped
SurfaceTexture. |
void |
init(int secureMode)
Initializes required EGL parameters and creates the
SurfaceTexture. |
void |
onFrameAvailable(android.graphics.SurfaceTexture surfaceTexture) |
void |
release()
Releases all allocated resources.
|
void |
run() |
public static final int SECURE_MODE_NONE
public static final int SECURE_MODE_SURFACELESS_CONTEXT
public static final int SECURE_MODE_PROTECTED_PBUFFER
public EGLSurfaceTexture(android.os.Handler handler)
handler - The Handler that will be used to call SurfaceTexture.updateTexImage() to update images on the SurfaceTexture. Note that
init(int) has to be called on the same looper thread as the Handler's
looper.public EGLSurfaceTexture(android.os.Handler handler,
@Nullable
EGLSurfaceTexture.TextureImageListener callback)
handler - The Handler that will be used to call SurfaceTexture.updateTexImage() to update images on the SurfaceTexture. Note that
init(int) has to be called on the same looper thread as the looper of the Handler.callback - The EGLSurfaceTexture.TextureImageListener to be called when the texture image on SurfaceTexture has been updated. This callback will be called on the same handler thread
as the handler.public void init(@EGLSurfaceTexture.SecureMode int secureMode)
SurfaceTexture.secureMode - The EGLSurfaceTexture.SecureMode to be used for EGL surface.public void release()
public android.graphics.SurfaceTexture getSurfaceTexture()
SurfaceTexture. This can only be called after init(int).public void onFrameAvailable(android.graphics.SurfaceTexture surfaceTexture)
onFrameAvailable in interface android.graphics.SurfaceTexture.OnFrameAvailableListenerpublic void run()
run in interface java.lang.Runnable