Class GlEffectsFrameProcessor
- java.lang.Object
-
- com.google.android.exoplayer2.effect.GlEffectsFrameProcessor
-
- All Implemented Interfaces:
FrameProcessor
public final class GlEffectsFrameProcessor extends Object implements FrameProcessor
AFrameProcessor
implementation that appliesGlEffect
instances using OpenGL on a background thread.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GlEffectsFrameProcessor.Factory
A factory forGlEffectsFrameProcessor
instances.-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.util.FrameProcessor
FrameProcessor.Listener
-
-
Field Summary
-
Fields inherited from interface com.google.android.exoplayer2.util.FrameProcessor
DROP_OUTPUT_FRAME, RELEASE_OUTPUT_FRAME_IMMEDIATELY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Surface
getInputSurface()
Returns the inputSurface
, whereFrameProcessor
consumes input frames from.int
getPendingInputFrameCount()
Returns the number of input frames that have been registered but not processed off the input surface yet.void
registerInputFrame()
Informs theFrameProcessor
that a frame will be queued to its input surface.void
release()
Releases all resources.void
releaseOutputFrame(long releaseTimeNs)
Releases the oldest unreleased output frame that has become available at the givenreleaseTimeNs
.void
setInputFrameInfo(FrameInfo inputFrameInfo)
Sets information about the input frames.void
setOutputSurfaceInfo(SurfaceInfo outputSurfaceInfo)
Sets the output surface and supporting information.void
signalEndOfInput()
Informs theFrameProcessor
that no further input frames should be accepted.
-
-
-
Method Detail
-
getInputSurface
public Surface getInputSurface()
Description copied from interface:FrameProcessor
Returns the inputSurface
, whereFrameProcessor
consumes input frames from.- Specified by:
getInputSurface
in interfaceFrameProcessor
-
setInputFrameInfo
public void setInputFrameInfo(FrameInfo inputFrameInfo)
Description copied from interface:FrameProcessor
Sets information about the input frames.The new input information is applied from the next frame registered onwards.
Pixels are expanded using the
FrameInfo.pixelWidthHeightRatio
so that the output frames' pixels have a ratio of 1.The caller should update
FrameInfo.streamOffsetUs
when switching input streams to ensure that frame timestamps are always monotonically increasing.- Specified by:
setInputFrameInfo
in interfaceFrameProcessor
-
registerInputFrame
public void registerInputFrame()
Description copied from interface:FrameProcessor
Informs theFrameProcessor
that a frame will be queued to its input surface.Must be called before rendering a frame to the frame processor's input surface.
- Specified by:
registerInputFrame
in interfaceFrameProcessor
-
getPendingInputFrameCount
public int getPendingInputFrameCount()
Description copied from interface:FrameProcessor
Returns the number of input frames that have been registered but not processed off the input surface yet.- Specified by:
getPendingInputFrameCount
in interfaceFrameProcessor
-
setOutputSurfaceInfo
public void setOutputSurfaceInfo(@Nullable SurfaceInfo outputSurfaceInfo)
Description copied from interface:FrameProcessor
Sets the output surface and supporting information. When output frames are released and not dropped, they will be rendered to this outputSurfaceInfo
.The new output
SurfaceInfo
is applied from the next output frame rendered onwards. If the outputSurfaceInfo
isnull
, theFrameProcessor
will stop rendering pending frames and resume rendering once a non-nullSurfaceInfo
is set.If the dimensions given in
SurfaceInfo
do not match the output size after applying the final effect the frames are resized before rendering to the surface and letter/pillar-boxing is applied.The caller is responsible for tracking the lifecycle of the
SurfaceInfo.surface
including calling this method with a new surface if it is destroyed. When this method returns, the previous output surface is no longer being used and can safely be released by the caller.- Specified by:
setOutputSurfaceInfo
in interfaceFrameProcessor
-
releaseOutputFrame
public void releaseOutputFrame(long releaseTimeNs)
Description copied from interface:FrameProcessor
Releases the oldest unreleased output frame that has become available at the givenreleaseTimeNs
.This will either render the output frame to the output surface, or drop the frame, per
releaseTimeNs
.This method must only be called if
releaseFramesAutomatically
was set tofalse
using theFrameProcessor.Factory
and should be called exactly once for each frame that becomes available.The
releaseTimeNs
may be passed toEGLExt.eglPresentationTimeANDROID(android.opengl.EGLDisplay, android.opengl.EGLSurface, long)
depending on the implementation.- Specified by:
releaseOutputFrame
in interfaceFrameProcessor
- Parameters:
releaseTimeNs
- The release time to use for the frame, in nanoseconds. The release time can be before of after the current system time. UseFrameProcessor.DROP_OUTPUT_FRAME
to drop the frame, orFrameProcessor.RELEASE_OUTPUT_FRAME_IMMEDIATELY
to release the frame immediately.
-
signalEndOfInput
public void signalEndOfInput()
Description copied from interface:FrameProcessor
Informs theFrameProcessor
that no further input frames should be accepted.- Specified by:
signalEndOfInput
in interfaceFrameProcessor
-
release
public void release()
Description copied from interface:FrameProcessor
Releases all resources.If the frame processor is released before it has ended, it will attempt to cancel processing any input frames that have already become available. Input frames that become available after release are ignored.
This method blocks until all resources are released or releasing times out.
- Specified by:
release
in interfaceFrameProcessor
-
-