Class DefaultVideoFrameProcessor
- java.lang.Object
-
- com.google.android.exoplayer2.effect.DefaultVideoFrameProcessor
-
- All Implemented Interfaces:
VideoFrameProcessor
@Deprecated public final class DefaultVideoFrameProcessor extends Object implements VideoFrameProcessor
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.AVideoFrameProcessor
implementation that appliesGlEffect
instances using OpenGL on a background thread.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultVideoFrameProcessor.Factory
Deprecated.A factory forDefaultVideoFrameProcessor
instances.static interface
DefaultVideoFrameProcessor.ReleaseOutputTextureCallback
Deprecated.Releases the output information stored for textures before and atpresentationTimeUs
.static interface
DefaultVideoFrameProcessor.TextureOutputListener
Deprecated.Listener interface for texture output.-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.util.VideoFrameProcessor
VideoFrameProcessor.InputType, VideoFrameProcessor.Listener
-
-
Field Summary
-
Fields inherited from interface com.google.android.exoplayer2.util.VideoFrameProcessor
DROP_OUTPUT_FRAME, INPUT_TYPE_BITMAP, INPUT_TYPE_SURFACE, INPUT_TYPE_TEXTURE_ID, RENDER_OUTPUT_FRAME_IMMEDIATELY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
flush()
Deprecated.Flushes theVideoFrameProcessor
.Surface
getInputSurface()
Deprecated.Returns the inputSurface
, whereVideoFrameProcessor
consumes input frames from.int
getPendingInputFrameCount()
Deprecated.Returns the number of input frames that have been made available to theVideoFrameProcessor
but have not been processed yet.com.google.android.exoplayer2.effect.VideoFrameProcessingTaskExecutor
getTaskExecutor()
Deprecated.Returns the task executor that runs video frame processing tasks.void
queueInputBitmap(Bitmap inputBitmap, long durationUs, float frameRate)
Deprecated.Provides an inputBitmap
to theVideoFrameProcessor
.void
queueInputTexture(int textureId, long presentationTimeUs)
Deprecated.Provides an input texture ID to theVideoFrameProcessor
.void
registerInputFrame()
Deprecated.Informs theVideoFrameProcessor
that a frame will be queued to its input surface.void
registerInputStream(@com.google.android.exoplayer2.util.VideoFrameProcessor.InputType int inputType)
Deprecated.Informs theVideoFrameProcessor
that a new input stream will be queued.void
release()
Deprecated.Releases all resources.void
renderOutputFrame(long renderTimeNs)
Deprecated.Renders the oldest unrendered output frame that has become available for rendering at the givenrenderTimeNs
.void
setInputDefaultBufferSize(int width, int height)
Deprecated.Sets the default size for input buffers, for the case where the producer providing input does not override the buffer size.void
setInputFrameInfo(FrameInfo inputFrameInfo)
Deprecated.Sets information about the input frames.void
setOnInputFrameProcessedListener(OnInputFrameProcessedListener listener)
Deprecated.Sets theOnInputFrameProcessedListener
.void
setOutputSurfaceInfo(SurfaceInfo outputSurfaceInfo)
Deprecated.Sets the output surface and supporting information.void
signalEndOfInput()
Deprecated.Informs theVideoFrameProcessor
that no further input frames should be accepted.
-
-
-
Method Detail
-
getTaskExecutor
public com.google.android.exoplayer2.effect.VideoFrameProcessingTaskExecutor getTaskExecutor()
Deprecated.Returns the task executor that runs video frame processing tasks.
-
setInputDefaultBufferSize
public void setInputDefaultBufferSize(int width, int height)
Deprecated.Sets the default size for input buffers, for the case where the producer providing input does not override the buffer size.When input comes from a media codec it's not necessary to call this method because the codec (producer) sets the buffer size automatically. For the case where input comes from CameraX, call this method after instantiation to ensure that buffers are handled at full resolution. See
SurfaceTexture.setDefaultBufferSize(int, int)
for more information.This method must only be called when the
VideoFrameProcessor
is created withVideoFrameProcessor.INPUT_TYPE_SURFACE
.- Parameters:
width
- The default width for input buffers, in pixels.height
- The default height for input buffers, in pixels.
-
queueInputBitmap
public void queueInputBitmap(Bitmap inputBitmap, long durationUs, float frameRate)
Deprecated.Description copied from interface:VideoFrameProcessor
- Specified by:
queueInputBitmap
in interfaceVideoFrameProcessor
- Parameters:
inputBitmap
- TheBitmap
queued to theVideoFrameProcessor
.durationUs
- The duration for which to display theinputBitmap
, in microseconds.frameRate
- The frame rate at which to display theinputBitmap
, in frames per second.
-
queueInputTexture
public void queueInputTexture(int textureId, long presentationTimeUs)
Deprecated.Description copied from interface:VideoFrameProcessor
Provides an input texture ID to theVideoFrameProcessor
.It must be called after the
onInputFrameProcessedListener
and theframeInfo
have been set.Can be called on any thread.
- Specified by:
queueInputTexture
in interfaceVideoFrameProcessor
- Parameters:
textureId
- The ID of the texture queued to theVideoFrameProcessor
.presentationTimeUs
- The presentation time of the queued texture, in microseconds.
-
setOnInputFrameProcessedListener
public void setOnInputFrameProcessedListener(OnInputFrameProcessedListener listener)
Deprecated.Description copied from interface:VideoFrameProcessor
Sets theOnInputFrameProcessedListener
.Can be called on any thread.
- Specified by:
setOnInputFrameProcessedListener
in interfaceVideoFrameProcessor
- Parameters:
listener
- TheOnInputFrameProcessedListener
.
-
getInputSurface
public Surface getInputSurface()
Deprecated.Description copied from interface:VideoFrameProcessor
Returns the inputSurface
, whereVideoFrameProcessor
consumes input frames from.Can be called on any thread.
- Specified by:
getInputSurface
in interfaceVideoFrameProcessor
-
registerInputStream
public void registerInputStream(@com.google.android.exoplayer2.util.VideoFrameProcessor.InputType int inputType)
Deprecated.Description copied from interface:VideoFrameProcessor
Informs theVideoFrameProcessor
that a new input stream will be queued.Call
VideoFrameProcessor.setInputFrameInfo(com.google.android.exoplayer2.util.FrameInfo)
before this method if theFrameInfo
of the new input stream differs from that of the current input stream.- Specified by:
registerInputStream
in interfaceVideoFrameProcessor
-
setInputFrameInfo
public void setInputFrameInfo(FrameInfo inputFrameInfo)
Deprecated.Description copied from interface:VideoFrameProcessor
Sets information about the input frames.The new input information is applied from the next frame registered or VideoFrameProcessor.queueInputTexture(int, long) queued} onwards.
Pixels are expanded using the
FrameInfo.pixelWidthHeightRatio
so that the output frames' pixels have a ratio of 1.Can be called on any thread.
- Specified by:
setInputFrameInfo
in interfaceVideoFrameProcessor
-
registerInputFrame
public void registerInputFrame()
Deprecated.Description copied from interface:VideoFrameProcessor
Informs theVideoFrameProcessor
that a frame will be queued to its input surface.Must be called before rendering a frame to the input surface.
Can be called on any thread.
- Specified by:
registerInputFrame
in interfaceVideoFrameProcessor
-
getPendingInputFrameCount
public int getPendingInputFrameCount()
Deprecated.Description copied from interface:VideoFrameProcessor
Returns the number of input frames that have been made available to theVideoFrameProcessor
but have not been processed yet.Can be called on any thread.
- Specified by:
getPendingInputFrameCount
in interfaceVideoFrameProcessor
-
setOutputSurfaceInfo
public void setOutputSurfaceInfo(@Nullable SurfaceInfo outputSurfaceInfo)
Deprecated.Sets the output surface and supporting information. When output frames are rendered 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
, theVideoFrameProcessor
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.If texture output is set, calling this method will be a no-op.
- Specified by:
setOutputSurfaceInfo
in interfaceVideoFrameProcessor
-
renderOutputFrame
public void renderOutputFrame(long renderTimeNs)
Deprecated.Renders the oldest unrendered output frame that has become available for rendering at the givenrenderTimeNs
.This will either render the output frame to the output surface, or drop the frame, per
renderTimeNs
.This method must only be called if
renderFramesAutomatically
was set tofalse
using theVideoFrameProcessor.Factory
and should be called exactly once for each frame that becomes available for rendering.The
renderTimeNs
may be passed toEGLExt.eglPresentationTimeANDROID(android.opengl.EGLDisplay, android.opengl.EGLSurface, long)
depending on the implementation.If texture output is set, calling this method will be a no-op.
- Specified by:
renderOutputFrame
in interfaceVideoFrameProcessor
- Parameters:
renderTimeNs
- The render time to use for the frame, in nanoseconds. The render time can be before or after the current system time. UseVideoFrameProcessor.DROP_OUTPUT_FRAME
to drop the frame, orVideoFrameProcessor.RENDER_OUTPUT_FRAME_IMMEDIATELY
to render the frame immediately.
-
signalEndOfInput
public void signalEndOfInput()
Deprecated.Description copied from interface:VideoFrameProcessor
Informs theVideoFrameProcessor
that no further input frames should be accepted.Can be called on any thread.
- Specified by:
signalEndOfInput
in interfaceVideoFrameProcessor
-
flush
public void flush()
Deprecated.Description copied from interface:VideoFrameProcessor
Flushes theVideoFrameProcessor
.All the frames that are registered prior to calling this method are no longer considered to be registered when this method returns.
VideoFrameProcessor.Listener
methods invoked prior to calling this method should be ignored.- Specified by:
flush
in interfaceVideoFrameProcessor
-
release
public void release()
Deprecated.Description copied from interface:VideoFrameProcessor
Releases all resources.If the
VideoFrameProcessor
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.
Can be called on any thread.
- Specified by:
release
in interfaceVideoFrameProcessor
-
-