Back to Exoplayer

DefaultVideoFrameProcessor (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/effect/DefaultVideoFrameProcessor.html

latest18.3 KB
Original Source

Package com.google.android.exoplayer2.effect

Class DefaultVideoFrameProcessor

  • java.lang.Object

    • com.google.android.exoplayer2.effect.DefaultVideoFrameProcessor
  • All Implemented Interfaces:VideoFrameProcessor


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classDefaultVideoFrameProcessorextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[VideoFrameProcessor](../util/VideoFrameProcessor.html "interface in com.google.android.exoplayer2.util")

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.

A VideoFrameProcessor implementation that applies GlEffect instances using OpenGL on a background thread.

Nested Class Summary

Nested Classes | Modifier and Type | Class | Description | | --- | --- | --- | | static class | DefaultVideoFrameProcessor.Factory | Deprecated.

A factory for DefaultVideoFrameProcessor instances. | | static interface | DefaultVideoFrameProcessor.ReleaseOutputTextureCallback | Deprecated.

Releases the output information stored for textures before and at presentationTimeUs. | | 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 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. | | 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 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 | 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 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. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

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 with VideoFrameProcessor.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](https://developer.android.com/reference/android/graphics/Bitmap.html "class or interface in android.graphics")inputBitmap,
                             long durationUs,
                             float frameRate)

Deprecated.

Description copied from interface: VideoFrameProcessor

Provides an input Bitmap to the VideoFrameProcessor.

Can be called on any thread.

Specified by:queueInputBitmap in interface VideoFrameProcessorParameters: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.

- 

queueInputTexture

public void queueInputTexture​(int textureId,
                              long presentationTimeUs)

Deprecated.

Description copied from interface: VideoFrameProcessor

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.

Specified by:queueInputTexture in interface VideoFrameProcessorParameters:textureId - The ID of the texture queued to the VideoFrameProcessor.presentationTimeUs - The presentation time of the queued texture, in microseconds.

- 

setOnInputFrameProcessedListener

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

Deprecated.

Description copied from interface: VideoFrameProcessor

Sets the OnInputFrameProcessedListener.

Can be called on any thread.

Specified by:setOnInputFrameProcessedListener in interface VideoFrameProcessorParameters:listener - The OnInputFrameProcessedListener.

- 

getInputSurface

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

Deprecated.

Description copied from interface: VideoFrameProcessor

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

Can be called on any thread.

Specified by:getInputSurface in interface VideoFrameProcessor

- 

registerInputStream

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

Deprecated.

Description copied from interface: VideoFrameProcessor

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

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

Specified by:registerInputStream in interface VideoFrameProcessor

- 

setInputFrameInfo

public void setInputFrameInfo​([FrameInfo](../util/FrameInfo.html "class in com.google.android.exoplayer2.util")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 interface VideoFrameProcessor

- 

registerInputFrame

public void registerInputFrame()

Deprecated.

Description copied from interface: VideoFrameProcessor

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.

Specified by:registerInputFrame in interface VideoFrameProcessor

- 

getPendingInputFrameCount

public int getPendingInputFrameCount()

Deprecated.

Description copied from interface: VideoFrameProcessor

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.

Specified by:getPendingInputFrameCount in interface VideoFrameProcessor

- 

setOutputSurfaceInfo

public void setOutputSurfaceInfo​(@Nullable[SurfaceInfo](../util/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.

If texture output is set, calling this method will be a no-op.

Specified by:setOutputSurfaceInfo in interface VideoFrameProcessor

- 

renderOutputFrame

public 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.

If texture output is set, calling this method will be a no-op.

Specified by:renderOutputFrame in interface VideoFrameProcessorParameters:renderTimeNs - The render time to use for the frame, in nanoseconds. The render time can be before or after the current system time. Use VideoFrameProcessor.DROP_OUTPUT_FRAME to drop the frame, or VideoFrameProcessor.RENDER_OUTPUT_FRAME_IMMEDIATELY to render the frame immediately.

- 

signalEndOfInput

public void signalEndOfInput()

Deprecated.

Description copied from interface: VideoFrameProcessor

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

Can be called on any thread.

Specified by:signalEndOfInput in interface VideoFrameProcessor

- 

flush

public void flush()

Deprecated.

Description copied from interface: VideoFrameProcessor

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.

Specified by:flush in interface VideoFrameProcessor

- 

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 interface VideoFrameProcessor