public final class

DefaultVideoFrameProcessor.Factory.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.media3.effect.DefaultVideoFrameProcessor.Factory.Builder

Overview

A builder for DefaultVideoFrameProcessor.Factory instances.

Summary

Constructors
publicBuilder()

Creates an instance.

Methods
public DefaultVideoFrameProcessor.Factorybuild()

Builds an DefaultVideoFrameProcessor.Factory instance.

public DefaultVideoFrameProcessor.Factory.BuildersetExecutorService(java.util.concurrent.ExecutorService executorService)

Sets the Util.newSingleThreadScheduledExecutor(String) to execute GL commands from.

public DefaultVideoFrameProcessor.Factory.BuildersetExperimentalAdjustSurfaceTextureTransformationMatrix(boolean experimentalAdjustSurfaceTextureTransformationMatrix)

Sets whether the SurfaceTexture is adjusted to remove the scale that cuts off a 1- or 2-texel border around the edge of a crop.

public DefaultVideoFrameProcessor.Factory.BuildersetExperimentalRepeatInputBitmapWithoutResampling(boolean experimentalRepeatInputBitmapWithoutResampling)

Sets whether androidx.media3.effect.BitmapTextureManager will sample from the input bitmap only once for a sequence of output frames.

public DefaultVideoFrameProcessor.Factory.BuildersetGlObjectsProvider(GlObjectsProvider glObjectsProvider)

Sets the GlObjectsProvider.

public DefaultVideoFrameProcessor.Factory.BuildersetRequireRegisteringAllInputFrames(boolean requireRegisteringAllInputFrames)

Sets whether registering every input frame is required.

public DefaultVideoFrameProcessor.Factory.BuildersetSdrWorkingColorSpace(int sdrWorkingColorSpace)

Sets the DefaultVideoFrameProcessor.WorkingColorSpace in which frames passed to intermediate effects will be represented.

public DefaultVideoFrameProcessor.Factory.BuildersetTextureOutput(GlTextureProducer.Listener textureOutputListener, int textureOutputCapacity)

Sets texture output settings.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder()

Creates an instance.

Methods

public DefaultVideoFrameProcessor.Factory.Builder setSdrWorkingColorSpace(int sdrWorkingColorSpace)

Sets the DefaultVideoFrameProcessor.WorkingColorSpace in which frames passed to intermediate effects will be represented.

The default value is DefaultVideoFrameProcessor.WORKING_COLOR_SPACE_LINEAR.

This setter doesn't affect the working color space for HDR output, since the working color space must have a linear transfer function for HDR output.

public DefaultVideoFrameProcessor.Factory.Builder setRequireRegisteringAllInputFrames(boolean requireRegisteringAllInputFrames)

Deprecated: For automatic frame registration (setRequireRegisteringAllInputFrames(false)), use VideoFrameProcessor.INPUT_TYPE_SURFACE_AUTOMATIC_FRAME_REGISTRATION instead. This call can be removed otherwise.

Sets whether registering every input frame is required.

The default value is true, meaning that all frames input to the VideoFrameProcessor's input Surface must be registered before they are rendered. In this mode the input format change between input streams is handled frame-exactly. If false, VideoFrameProcessor.registerInputFrame() can be called only once for each registered input stream before rendering the first frame to the input Surface. The same registered FrameInfo is repeated for the subsequent frames. To ensure the format change between input streams is applied on the right frame, the caller needs to register the new input stream strictly after rendering all frames from the previous input stream. This mode should be used in streams where users don't have direct control over rendering frames, like in a camera feed.

Regardless of the value set, VideoFrameProcessor.registerInputStream(int, List, FrameInfo) must be called for each input stream to specify the format for upcoming frames before calling VideoFrameProcessor.registerInputFrame().

Parameters:

requireRegisteringAllInputFrames: Whether registering every input frame is required.

public DefaultVideoFrameProcessor.Factory.Builder setGlObjectsProvider(GlObjectsProvider glObjectsProvider)

Sets the GlObjectsProvider.

The default value is a DefaultGlObjectsProvider.

public DefaultVideoFrameProcessor.Factory.Builder setExecutorService(java.util.concurrent.ExecutorService executorService)

Sets the Util.newSingleThreadScheduledExecutor(String) to execute GL commands from.

If set to a non-null value, the java.util.concurrent.ExecutorService must be shut down by the caller after all VideoFrameProcessors using it have been released.

The default value is a new Util.newSingleThreadScheduledExecutor(String), owned and shutdown by the created DefaultVideoFrameProcessor. Setting a null java.util.concurrent.ExecutorService is equivalent to using the default value.

Parameters:

executorService: The java.util.concurrent.ExecutorService.

public DefaultVideoFrameProcessor.Factory.Builder setTextureOutput(GlTextureProducer.Listener textureOutputListener, int textureOutputCapacity)

Sets texture output settings.

If set, the VideoFrameProcessor will output to OpenGL textures, accessible via GlTextureProducer.Listener.onTextureRendered(GlTextureProducer, GlTextureInfo, long, long). Textures will stop being outputted when the number of output textures available reaches the textureOutputCapacity. To regain capacity, output textures must be released using DefaultVideoFrameProcessor.ReleaseOutputTextureCallback.

If set, VideoFrameProcessor.setOutputSurfaceInfo(SurfaceInfo) and VideoFrameProcessor.renderOutputFrame(long) will be no-ops, and renderFramesAutomatically will behave as if it is set to true.

If not set, there will be no texture output.

Parameters:

textureOutputListener: The GlTextureProducer.Listener.
textureOutputCapacity: The amount of output textures that may be allocated at a time before texture output blocks. Must be greater than or equal to 1.

public DefaultVideoFrameProcessor.Factory.Builder setExperimentalAdjustSurfaceTextureTransformationMatrix(boolean experimentalAdjustSurfaceTextureTransformationMatrix)

Deprecated: This experimental method will be removed in a future release.

Sets whether the SurfaceTexture is adjusted to remove the scale that cuts off a 1- or 2-texel border around the edge of a crop.

When set, programs sampling GL_TEXTURE_EXTERNAL_OES from SurfaceTexture must not attempt to access data in any cropped region, including via GL_LINEAR resampling filter.

Defaults to true.

public DefaultVideoFrameProcessor.Factory.Builder setExperimentalRepeatInputBitmapWithoutResampling(boolean experimentalRepeatInputBitmapWithoutResampling)

Deprecated: This experimental method will be removed in a future release.

Sets whether androidx.media3.effect.BitmapTextureManager will sample from the input bitmap only once for a sequence of output frames.

Defaults to true. That is, each output frame will sample from the full resolution input bitmap.

Builds an DefaultVideoFrameProcessor.Factory instance.