Interface VideoFrameProcessor
-
- All Known Implementing Classes:
DefaultVideoFrameProcessor
@Deprecated public interface 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.Interface for a video frame processor that applies changes to individual video frames.The changes are specified by
Effect
instances passed toVideoFrameProcessor.Factory.create(android.content.Context, java.util.List<com.google.android.exoplayer2.util.Effect>, com.google.android.exoplayer2.util.DebugViewProvider, com.google.android.exoplayer2.video.ColorInfo, com.google.android.exoplayer2.video.ColorInfo, boolean, java.util.concurrent.Executor, com.google.android.exoplayer2.util.VideoFrameProcessor.Listener)
.Manages its input
Surface
, which can be accessed viagetInputSurface()
. The outputSurface
must be set by the caller usingsetOutputSurfaceInfo(SurfaceInfo)
.The caller must register input frames before rendering them to the input
Surface
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
VideoFrameProcessor.Factory
Deprecated.A factory forVideoFrameProcessor
instances.static interface
VideoFrameProcessor.InputType
Deprecated.Specifies how the input frames are made available to theVideoFrameProcessor
.static interface
VideoFrameProcessor.Listener
Deprecated.Listener for asynchronous frame processing events.
-
Field Summary
Fields Modifier and Type Field Description static long
DROP_OUTPUT_FRAME
Deprecated.Indicates the frame should be dropped afterrenderOutputFrame(long)
is invoked.static int
INPUT_TYPE_BITMAP
Deprecated.Input frames come from aBitmap
.static int
INPUT_TYPE_SURFACE
Deprecated.Input frames come from asurface
.static int
INPUT_TYPE_TEXTURE_ID
Deprecated.Input frames come from a traditional GLES texture.static long
RENDER_OUTPUT_FRAME_IMMEDIATELY
Deprecated.Indicates the frame should be rendered immediately afterrenderOutputFrame(long)
is invoked.
-
Method Summary
All Methods Instance Methods Abstract 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.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
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.
-
-
-
Field Detail
-
INPUT_TYPE_SURFACE
static final int INPUT_TYPE_SURFACE
Deprecated.Input frames come from asurface
.- See Also:
- Constant Field Values
-
INPUT_TYPE_BITMAP
static final int INPUT_TYPE_BITMAP
Deprecated.Input frames come from aBitmap
.- See Also:
- Constant Field Values
-
INPUT_TYPE_TEXTURE_ID
static final int INPUT_TYPE_TEXTURE_ID
Deprecated.Input frames come from a traditional GLES texture.- See Also:
- Constant Field Values
-
RENDER_OUTPUT_FRAME_IMMEDIATELY
static final long RENDER_OUTPUT_FRAME_IMMEDIATELY
Deprecated.Indicates the frame should be rendered immediately afterrenderOutputFrame(long)
is invoked.- See Also:
- Constant Field Values
-
DROP_OUTPUT_FRAME
static final long DROP_OUTPUT_FRAME
Deprecated.Indicates the frame should be dropped afterrenderOutputFrame(long)
is invoked.- See Also:
- Constant Field Values
-
-
Method Detail
-
queueInputBitmap
void queueInputBitmap(Bitmap inputBitmap, long durationUs, float frameRate)
Deprecated.- 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.- Throws:
UnsupportedOperationException
- If theVideoFrameProcessor
does not accept bitmap input.
-
queueInputTexture
void queueInputTexture(int textureId, long presentationTimeUs)
Deprecated.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.
- Parameters:
textureId
- The ID of the texture queued to theVideoFrameProcessor
.presentationTimeUs
- The presentation time of the queued texture, in microseconds.
-
setOnInputFrameProcessedListener
void setOnInputFrameProcessedListener(OnInputFrameProcessedListener listener)
Deprecated.Sets theOnInputFrameProcessedListener
.Can be called on any thread.
- Parameters:
listener
- TheOnInputFrameProcessedListener
.
-
getInputSurface
Surface getInputSurface()
Deprecated.Returns the inputSurface
, whereVideoFrameProcessor
consumes input frames from.Can be called on any thread.
- Throws:
UnsupportedOperationException
- If theVideoFrameProcessor
does not accept surface input.
-
registerInputStream
void registerInputStream(@com.google.android.exoplayer2.util.VideoFrameProcessor.InputType int inputType)
Deprecated.Informs theVideoFrameProcessor
that a new input stream will be queued.Call
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.
-
setInputFrameInfo
void setInputFrameInfo(FrameInfo inputFrameInfo)
Deprecated.Sets information about the input frames.The new input information is applied from the next frame registered or 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.
-
registerInputFrame
void registerInputFrame()
Deprecated.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.
- Throws:
UnsupportedOperationException
- If theVideoFrameProcessor
does not accept surface input.IllegalStateException
- If called aftersignalEndOfInput()
or beforesetInputFrameInfo(FrameInfo)
.
-
getPendingInputFrameCount
int getPendingInputFrameCount()
Deprecated.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.
-
setOutputSurfaceInfo
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.
-
renderOutputFrame
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.- Parameters:
renderTimeNs
- The render time to use for the frame, in nanoseconds. The render time can be before or after the current system time. UseDROP_OUTPUT_FRAME
to drop the frame, orRENDER_OUTPUT_FRAME_IMMEDIATELY
to render the frame immediately.
-
signalEndOfInput
void signalEndOfInput()
Deprecated.Informs theVideoFrameProcessor
that no further input frames should be accepted.Can be called on any thread.
- Throws:
IllegalStateException
- If called more than once.
-
flush
void flush()
Deprecated.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.- Throws:
UnsupportedOperationException
- If theVideoFrameProcessor
does not accept surface input.
-
release
void release()
Deprecated.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.
-
-