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
Effectinstances 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 outputSurfacemust 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 interfaceVideoFrameProcessor.FactoryDeprecated.A factory forVideoFrameProcessorinstances.static interfaceVideoFrameProcessor.InputTypeDeprecated.Specifies how the input frames are made available to theVideoFrameProcessor.static interfaceVideoFrameProcessor.ListenerDeprecated.Listener for asynchronous frame processing events.
-
Field Summary
Fields Modifier and Type Field Description static longDROP_OUTPUT_FRAMEDeprecated.Indicates the frame should be dropped afterrenderOutputFrame(long)is invoked.static intINPUT_TYPE_BITMAPDeprecated.Input frames come from aBitmap.static intINPUT_TYPE_SURFACEDeprecated.Input frames come from asurface.static intINPUT_TYPE_TEXTURE_IDDeprecated.Input frames come from a traditional GLES texture.static longRENDER_OUTPUT_FRAME_IMMEDIATELYDeprecated.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 voidflush()Deprecated.Flushes theVideoFrameProcessor.SurfacegetInputSurface()Deprecated.Returns the inputSurface, whereVideoFrameProcessorconsumes input frames from.intgetPendingInputFrameCount()Deprecated.Returns the number of input frames that have been made available to theVideoFrameProcessorbut have not been processed yet.voidqueueInputBitmap(Bitmap inputBitmap, long durationUs, float frameRate)Deprecated.Provides an inputBitmapto theVideoFrameProcessor.voidqueueInputTexture(int textureId, long presentationTimeUs)Deprecated.Provides an input texture ID to theVideoFrameProcessor.voidregisterInputFrame()Deprecated.Informs theVideoFrameProcessorthat a frame will be queued to its input surface.voidregisterInputStream(@com.google.android.exoplayer2.util.VideoFrameProcessor.InputType int inputType)Deprecated.Informs theVideoFrameProcessorthat a new input stream will be queued.voidrelease()Deprecated.Releases all resources.voidrenderOutputFrame(long renderTimeNs)Deprecated.Renders the oldest unrendered output frame that has become available for rendering at the givenrenderTimeNs.voidsetInputFrameInfo(FrameInfo inputFrameInfo)Deprecated.Sets information about the input frames.voidsetOnInputFrameProcessedListener(OnInputFrameProcessedListener listener)Deprecated.Sets theOnInputFrameProcessedListener.voidsetOutputSurfaceInfo(SurfaceInfo outputSurfaceInfo)Deprecated.Sets the output surface and supporting information.voidsignalEndOfInput()Deprecated.Informs theVideoFrameProcessorthat 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- TheBitmapqueued 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 theVideoFrameProcessordoes 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
onInputFrameProcessedListenerand theframeInfohave 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, whereVideoFrameProcessorconsumes input frames from.Can be called on any thread.
- Throws:
UnsupportedOperationException- If theVideoFrameProcessordoes not accept surface input.
-
registerInputStream
void registerInputStream(@com.google.android.exoplayer2.util.VideoFrameProcessor.InputType int inputType)
Deprecated.Informs theVideoFrameProcessorthat a new input stream will be queued.Call
setInputFrameInfo(com.google.android.exoplayer2.util.FrameInfo)before this method if theFrameInfoof 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.pixelWidthHeightRatioso that the output frames' pixels have a ratio of 1.Can be called on any thread.
-
registerInputFrame
void registerInputFrame()
Deprecated.Informs theVideoFrameProcessorthat 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 theVideoFrameProcessordoes 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 theVideoFrameProcessorbut 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
SurfaceInfois applied from the next output frame rendered onwards. If the outputSurfaceInfoisnull, theVideoFrameProcessorwill stop rendering pending frames and resume rendering once a non-nullSurfaceInfois set.If the dimensions given in
SurfaceInfodo 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.surfaceincluding 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
renderFramesAutomaticallywas set tofalseusing theVideoFrameProcessor.Factoryand should be called exactly once for each frame that becomes available for rendering.The
renderTimeNsmay 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_FRAMEto drop the frame, orRENDER_OUTPUT_FRAME_IMMEDIATELYto render the frame immediately.
-
signalEndOfInput
void signalEndOfInput()
Deprecated.Informs theVideoFrameProcessorthat 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.Listenermethods invoked prior to calling this method should be ignored.- Throws:
UnsupportedOperationException- If theVideoFrameProcessordoes not accept surface input.
-
release
void release()
Deprecated.Releases all resources.If the
VideoFrameProcessoris 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.
-
-