DefaultVideoFrameProcessor.Factory.Builder


public final class DefaultVideoFrameProcessor.Factory.Builder


A builder for DefaultVideoFrameProcessor.Factory instances.

Summary

Public constructors

Creates an instance.

Public methods

DefaultVideoFrameProcessor.Factory

Builds an DefaultVideoFrameProcessor.Factory instance.

DefaultVideoFrameProcessor.Factory.Builder

Sets the newSingleThreadScheduledExecutor to execute GL commands from.

DefaultVideoFrameProcessor.Factory.Builder
@CanIgnoreReturnValue
setExperimentalAdjustSurfaceTextureTransformationMatrix(
    boolean experimentalAdjustSurfaceTextureTransformationMatrix
)

This method is deprecated.

This experimental method will be removed in a future release.

DefaultVideoFrameProcessor.Factory.Builder
@CanIgnoreReturnValue
setExperimentalRepeatInputBitmapWithoutResampling(
    boolean experimentalRepeatInputBitmapWithoutResampling
)

This method is deprecated.

This experimental method will be removed in a future release.

DefaultVideoFrameProcessor.Factory.Builder

Sets the GlObjectsProvider.

DefaultVideoFrameProcessor.Factory.Builder
@CanIgnoreReturnValue
setRequireRegisteringAllInputFrames(
    boolean requireRegisteringAllInputFrames
)

This method is deprecated.

For automatic frame registration ( setRequireRegisteringAllInputFrames(false)), use INPUT_TYPE_SURFACE_AUTOMATIC_FRAME_REGISTRATION instead.

DefaultVideoFrameProcessor.Factory.Builder

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

DefaultVideoFrameProcessor.Factory.Builder
@CanIgnoreReturnValue
setTextureOutput(
    GlTextureProducer.Listener textureOutputListener,
    @IntRange(from = 1) int textureOutputCapacity
)

Sets texture output settings.

Public constructors

Builder

public Builder()

Creates an instance.

Public methods

setExecutorService

@CanIgnoreReturnValue
public DefaultVideoFrameProcessor.Factory.Builder setExecutorService(@Nullable ExecutorService executorService)

Sets the newSingleThreadScheduledExecutor to execute GL commands from.

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

The default value is a new newSingleThreadScheduledExecutor, owned and shutdown by the created DefaultVideoFrameProcessor. Setting a nullExecutorService is equivalent to using the default value.

Parameters
@Nullable ExecutorService executorService

The ExecutorService.

setExperimentalAdjustSurfaceTextureTransformationMatrix

@CanIgnoreReturnValue
public DefaultVideoFrameProcessor.Factory.Builder setExperimentalAdjustSurfaceTextureTransformationMatrix(
    boolean experimentalAdjustSurfaceTextureTransformationMatrix
)

Sets whether the getTransformMatrix 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.

setExperimentalRepeatInputBitmapWithoutResampling

@CanIgnoreReturnValue
public DefaultVideoFrameProcessor.Factory.Builder setExperimentalRepeatInputBitmapWithoutResampling(
    boolean experimentalRepeatInputBitmapWithoutResampling
)

Sets whether 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.

setRequireRegisteringAllInputFrames

@CanIgnoreReturnValue
public DefaultVideoFrameProcessor.Factory.Builder setRequireRegisteringAllInputFrames(
    boolean requireRegisteringAllInputFrames
)

Sets whether registering every input frame is required.

The default value is true, meaning that all frames input to the '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, 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, registerInputStream must be called for each input stream to specify the format for upcoming frames before calling registerInputFrame.

Parameters
boolean requireRegisteringAllInputFrames

Whether registering every input frame is required.

setSdrWorkingColorSpace

@CanIgnoreReturnValue
public DefaultVideoFrameProcessor.Factory.Builder setSdrWorkingColorSpace(
    @DefaultVideoFrameProcessor.WorkingColorSpace int sdrWorkingColorSpace
)

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

The default value is 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.

setTextureOutput

@CanIgnoreReturnValue
public DefaultVideoFrameProcessor.Factory.Builder setTextureOutput(
    GlTextureProducer.Listener textureOutputListener,
    @IntRange(from = 1) int textureOutputCapacity
)

Sets texture output settings.

If set, the VideoFrameProcessor will output to OpenGL textures, accessible via onTextureRendered. Textures will stop being outputted when the number of output textures available reaches the textureOutputCapacity. To regain capacity, output textures must be released using .

If set, setOutputSurfaceInfo and renderOutputFrame 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
GlTextureProducer.Listener textureOutputListener

The GlTextureProducer.Listener.

@IntRange(from = 1) int 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.