public class EglRenderer extends java.lang.Object implements VideoSink
Modifier and Type | Class and Description |
---|---|
static interface |
EglRenderer.ErrorCallback
Callback for clients to be notified about errors encountered during rendering.
|
static interface |
EglRenderer.FrameListener |
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
name |
Constructor and Description |
---|
EglRenderer(java.lang.String name)
Standard constructor.
|
EglRenderer(java.lang.String name,
VideoFrameDrawer videoFrameDrawer) |
Modifier and Type | Method and Description |
---|---|
void |
addFrameListener(EglRenderer.FrameListener listener,
float scale)
Register a callback to be invoked when a new video frame has been received.
|
void |
addFrameListener(EglRenderer.FrameListener listener,
float scale,
RendererCommon.GlDrawer drawerParam)
Register a callback to be invoked when a new video frame has been received.
|
void |
addFrameListener(EglRenderer.FrameListener listener,
float scale,
RendererCommon.GlDrawer drawerParam,
boolean applyFpsReduction)
Register a callback to be invoked when a new video frame has been received.
|
void |
clearImage()
Post a task to clear the surface to a transparent uniform color.
|
void |
clearImage(float r,
float g,
float b,
float a)
Post a task to clear the surface to a specific color.
|
void |
createEglSurface(android.view.Surface surface) |
void |
createEglSurface(android.graphics.SurfaceTexture surfaceTexture) |
void |
disableFpsReduction() |
void |
init(EglBase.Context sharedContext,
int[] configAttributes,
RendererCommon.GlDrawer drawer)
Same as above with usePresentationTimeStamp set to false.
|
void |
init(EglBase.Context sharedContext,
int[] configAttributes,
RendererCommon.GlDrawer drawer,
boolean usePresentationTimeStamp)
Initialize this class, sharing resources with |sharedContext|.
|
void |
onFrame(VideoFrame frame)
Implementations should call frame.retain() if they need to hold a reference to the frame after
this function returns.
|
void |
pauseVideo() |
void |
printStackTrace() |
void |
release()
Block until any pending frame is returned and all GL resources released, even if an interrupt
occurs.
|
void |
releaseEglSurface(java.lang.Runnable completionCallback)
Release EGL surface.
|
void |
removeFrameListener(EglRenderer.FrameListener listener)
Remove any pending callback that was added with addFrameListener.
|
void |
setErrorCallback(EglRenderer.ErrorCallback errorCallback)
Can be set in order to be notified about errors encountered during rendering.
|
void |
setFpsReduction(float fps)
Limit render framerate.
|
void |
setLayoutAspectRatio(float layoutAspectRatio)
Set layout aspect ratio.
|
void |
setMirror(boolean mirror)
Set if the video stream should be mirrored horizontally or not.
|
void |
setMirrorVertically(boolean mirrorVertically)
Set if the video stream should be mirrored vertically or not.
|
public EglRenderer(java.lang.String name)
public EglRenderer(java.lang.String name, VideoFrameDrawer videoFrameDrawer)
public void init(@Nullable EglBase.Context sharedContext, int[] configAttributes, RendererCommon.GlDrawer drawer, boolean usePresentationTimeStamp)
public void init(@Nullable EglBase.Context sharedContext, int[] configAttributes, RendererCommon.GlDrawer drawer)
public void createEglSurface(android.view.Surface surface)
public void createEglSurface(android.graphics.SurfaceTexture surfaceTexture)
public void release()
public void printStackTrace()
public void setMirror(boolean mirror)
public void setMirrorVertically(boolean mirrorVertically)
public void setLayoutAspectRatio(float layoutAspectRatio)
public void setFpsReduction(float fps)
fps
- Limit render framerate to this value, or use Float.POSITIVE_INFINITY to disable fps
reduction.public void disableFpsReduction()
public void pauseVideo()
public void addFrameListener(EglRenderer.FrameListener listener, float scale)
listener
- The callback to be invoked. The callback will be invoked on the render thread.
It should be lightweight and must not call removeFrameListener.scale
- The scale of the Bitmap passed to the callback, or 0 if no Bitmap is
required.public void addFrameListener(EglRenderer.FrameListener listener, float scale, RendererCommon.GlDrawer drawerParam)
listener
- The callback to be invoked. The callback will be invoked on the render thread.
It should be lightweight and must not call removeFrameListener.scale
- The scale of the Bitmap passed to the callback, or 0 if no Bitmap is
required.drawerParam
- Custom drawer to use for this frame listener or null to use the default one.public void addFrameListener(EglRenderer.FrameListener listener, float scale, @Nullable RendererCommon.GlDrawer drawerParam, boolean applyFpsReduction)
listener
- The callback to be invoked. The callback will be invoked on the render thread.
It should be lightweight and must not call removeFrameListener.scale
- The scale of the Bitmap passed to the callback, or 0 if no Bitmap is
required.drawerParam
- Custom drawer to use for this frame listener or null to use the default one.applyFpsReduction
- This callback will not be called for frames that have been dropped by
FPS reduction.public void removeFrameListener(EglRenderer.FrameListener listener)
listener
- The callback to remove.public void setErrorCallback(EglRenderer.ErrorCallback errorCallback)
public void onFrame(VideoFrame frame)
VideoSink
public void releaseEglSurface(java.lang.Runnable completionCallback)
public void clearImage()
public void clearImage(float r, float g, float b, float a)
6.0.0