Back to Exoplayer

VideoFrameProcessor (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/util/VideoFrameProcessor.html

latest17.2 KB
Original Source

Package com.google.android.exoplayer2.util

Interface VideoFrameProcessor

  • All Known Implementing Classes:DefaultVideoFrameProcessor

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public interfaceVideoFrameProcessor

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 to VideoFrameProcessor.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 via getInputSurface(). The output Surface must be set by the caller using setOutputSurfaceInfo(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 for VideoFrameProcessor instances. | | static interface | VideoFrameProcessor.InputType | Deprecated.

Specifies how the input frames are made available to the VideoFrameProcessor. | | 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 after renderOutputFrame(long) is invoked. | | static int | INPUT_TYPE_BITMAP | Deprecated.

Input frames come from a Bitmap. | | static int | INPUT_TYPE_SURFACE | Deprecated.

Input frames come from a surface. | | 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 after renderOutputFrame(long) is invoked. |

Method Summary

All Methods Instance Methods Abstract Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | void | flush() | Deprecated.

Flushes the VideoFrameProcessor. | | Surface | getInputSurface() | Deprecated.

Returns the input Surface, where VideoFrameProcessor consumes input frames from. | | int | getPendingInputFrameCount() | Deprecated.

Returns the number of input frames that have been made available to the VideoFrameProcessor but have not been processed yet. | | void | queueInputBitmap​(Bitmap inputBitmap, long durationUs, float frameRate) | Deprecated.

Provides an input Bitmap to the VideoFrameProcessor. | | void | queueInputTexture​(int textureId, long presentationTimeUs) | Deprecated.

Provides an input texture ID to the VideoFrameProcessor. | | void | registerInputFrame() | Deprecated.

Informs the VideoFrameProcessor that a frame will be queued to its input surface. | | void | registerInputStream​(@com.google.android.exoplayer2.util.VideoFrameProcessor.InputType int inputType) | Deprecated.

Informs the VideoFrameProcessor 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 given renderTimeNs. | | void | setInputFrameInfo​(FrameInfo inputFrameInfo) | Deprecated.

Sets information about the input frames. | | void | setOnInputFrameProcessedListener​(OnInputFrameProcessedListener listener) | Deprecated.

Sets the OnInputFrameProcessedListener. | | void | setOutputSurfaceInfo​(SurfaceInfo outputSurfaceInfo) | Deprecated.

Sets the output surface and supporting information. | | void | signalEndOfInput() | Deprecated.

Informs the VideoFrameProcessor that no further input frames should be accepted. |

Field Detail

- 

INPUT_TYPE_SURFACE

static final int INPUT_TYPE_SURFACE

Deprecated.

Input frames come from a surface. See Also:Constant Field Values

- 

INPUT_TYPE_BITMAP

static final int INPUT_TYPE_BITMAP

Deprecated.

Input frames come from a Bitmap. 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 after renderOutputFrame(long) is invoked. See Also:Constant Field Values

- 

DROP_OUTPUT_FRAME

static final long DROP_OUTPUT_FRAME

Deprecated.

Indicates the frame should be dropped after renderOutputFrame(long) is invoked. See Also:Constant Field Values

Method Detail

- 

queueInputBitmap

void queueInputBitmap​([Bitmap](https://developer.android.com/reference/android/graphics/Bitmap.html "class or interface in android.graphics")inputBitmap,
                      long durationUs,
                      float frameRate)

Deprecated.

Provides an input Bitmap to the VideoFrameProcessor.

Can be called on any thread.

Parameters:inputBitmap - The Bitmap queued to the VideoFrameProcessor.durationUs - The duration for which to display the inputBitmap, in microseconds.frameRate - The frame rate at which to display the inputBitmap, in frames per second.Throws:UnsupportedOperationException - If the VideoFrameProcessor does not accept bitmap input.

- 

queueInputTexture

void queueInputTexture​(int textureId,
                       long presentationTimeUs)

Deprecated.

Provides an input texture ID to the VideoFrameProcessor.

It must be called after the onInputFrameProcessedListener and the frameInfo have been set.

Can be called on any thread.

Parameters:textureId - The ID of the texture queued to the VideoFrameProcessor.presentationTimeUs - The presentation time of the queued texture, in microseconds.

- 

setOnInputFrameProcessedListener

void setOnInputFrameProcessedListener​([OnInputFrameProcessedListener](OnInputFrameProcessedListener.html "interface in com.google.android.exoplayer2.util")listener)

Deprecated.

Sets the OnInputFrameProcessedListener.

Can be called on any thread.

Parameters:listener - The OnInputFrameProcessedListener.

- 

getInputSurface

[Surface](https://developer.android.com/reference/android/view/Surface.html "class or interface in android.view")getInputSurface()

Deprecated.

Returns the input Surface, where VideoFrameProcessor consumes input frames from.

Can be called on any thread.

Throws:UnsupportedOperationException - If the VideoFrameProcessor does not accept surface input.

- 

registerInputStream

void registerInputStream​(@com.google.android.exoplayer2.util.VideoFrameProcessor.InputType int inputType)

Deprecated.

Informs the VideoFrameProcessor that a new input stream will be queued.

Call setInputFrameInfo(com.google.android.exoplayer2.util.FrameInfo) before this method if the FrameInfo of the new input stream differs from that of the current input stream.

- 

setInputFrameInfo

void setInputFrameInfo​([FrameInfo](FrameInfo.html "class in com.google.android.exoplayer2.util")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 the VideoFrameProcessor 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 the VideoFrameProcessor does not accept surface input.IllegalStateException - If called after signalEndOfInput() or before setInputFrameInfo(FrameInfo).

- 

getPendingInputFrameCount

int getPendingInputFrameCount()

Deprecated.

Returns the number of input frames that have been made available to the VideoFrameProcessor but have not been processed yet.

Can be called on any thread.

- 

setOutputSurfaceInfo

void setOutputSurfaceInfo​(@Nullable[SurfaceInfo](SurfaceInfo.html "class in com.google.android.exoplayer2.util")outputSurfaceInfo)

Deprecated.

Sets the output surface and supporting information. When output frames are rendered and not dropped, they will be rendered to this output SurfaceInfo.

The new output SurfaceInfo is applied from the next output frame rendered onwards. If the output SurfaceInfo is null, the VideoFrameProcessor will stop rendering pending frames and resume rendering once a non-null SurfaceInfo 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 given renderTimeNs.

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 to false using the VideoFrameProcessor.Factory and should be called exactly once for each frame that becomes available for rendering.

The renderTimeNs may be passed to EGLExt.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. Use DROP_OUTPUT_FRAME to drop the frame, or RENDER_OUTPUT_FRAME_IMMEDIATELY to render the frame immediately.

- 

signalEndOfInput

void signalEndOfInput()

Deprecated.

Informs the VideoFrameProcessor 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 the VideoFrameProcessor.

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 the VideoFrameProcessor 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.