Class EGLSurfaceTexture
- java.lang.Object
-
- com.google.android.exoplayer2.util.EGLSurfaceTexture
-
- All Implemented Interfaces:
SurfaceTexture.OnFrameAvailableListener,Runnable
@RequiresApi(17) public final class EGLSurfaceTexture extends Object implements SurfaceTexture.OnFrameAvailableListener, Runnable
Generates aSurfaceTextureusing EGL/GLES functions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEGLSurfaceTexture.GlExceptionA runtime exception to be thrown if some EGL operations failed.static interfaceEGLSurfaceTexture.SecureModeSecure mode to be used by the EGL surface and context.static interfaceEGLSurfaceTexture.TextureImageListenerListener to be called when the texture image onSurfaceTexturehas been updated.
-
Field Summary
Fields Modifier and Type Field Description static intSECURE_MODE_NONENo secure EGL surface and context required.static intSECURE_MODE_PROTECTED_PBUFFERCreating a secure surface backed by a pixel buffer.static intSECURE_MODE_SURFACELESS_CONTEXTCreating a surfaceless, secured EGL context.
-
Constructor Summary
Constructors Constructor Description EGLSurfaceTexture(Handler handler)EGLSurfaceTexture(Handler handler, EGLSurfaceTexture.TextureImageListener callback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SurfaceTexturegetSurfaceTexture()Returns the wrappedSurfaceTexture.voidinit(@com.google.android.exoplayer2.util.EGLSurfaceTexture.SecureMode int secureMode)Initializes required EGL parameters and creates theSurfaceTexture.voidonFrameAvailable(SurfaceTexture surfaceTexture)voidrelease()Releases all allocated resources.voidrun()
-
-
-
Field Detail
-
SECURE_MODE_NONE
public static final int SECURE_MODE_NONE
No secure EGL surface and context required.- See Also:
- Constant Field Values
-
SECURE_MODE_SURFACELESS_CONTEXT
public static final int SECURE_MODE_SURFACELESS_CONTEXT
Creating a surfaceless, secured EGL context.- See Also:
- Constant Field Values
-
SECURE_MODE_PROTECTED_PBUFFER
public static final int SECURE_MODE_PROTECTED_PBUFFER
Creating a secure surface backed by a pixel buffer.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EGLSurfaceTexture
public EGLSurfaceTexture(Handler handler)
- Parameters:
handler- TheHandlerthat will be used to callSurfaceTexture.updateTexImage()to update images on theSurfaceTexture. Note thatinit(int)has to be called on the same looper thread as theHandler's looper.
-
EGLSurfaceTexture
public EGLSurfaceTexture(Handler handler, @Nullable EGLSurfaceTexture.TextureImageListener callback)
- Parameters:
handler- TheHandlerthat will be used to callSurfaceTexture.updateTexImage()to update images on theSurfaceTexture. Note thatinit(int)has to be called on the same looper thread as the looper of theHandler.callback- TheEGLSurfaceTexture.TextureImageListenerto be called when the texture image onSurfaceTexturehas been updated. This callback will be called on the same handler thread as thehandler.
-
-
Method Detail
-
init
public void init(@com.google.android.exoplayer2.util.EGLSurfaceTexture.SecureMode int secureMode)
Initializes required EGL parameters and creates theSurfaceTexture.- Parameters:
secureMode- TheEGLSurfaceTexture.SecureModeto be used for EGL surface.
-
release
public void release()
Releases all allocated resources.
-
getSurfaceTexture
public SurfaceTexture getSurfaceTexture()
Returns the wrappedSurfaceTexture. This can only be called afterinit(int).
-
onFrameAvailable
public void onFrameAvailable(SurfaceTexture surfaceTexture)
- Specified by:
onFrameAvailablein interfaceSurfaceTexture.OnFrameAvailableListener
-
-