DefaultGlFrameProcessor.Factory.Builder


public final class DefaultGlFrameProcessor.Factory.Builder


A builder for Factory instances.

Summary

Public constructors

Builder(Context context)

Creates an instance.

Public methods

DefaultGlFrameProcessor.Factory

Builds a Factory instance.

DefaultGlFrameProcessor.Factory.Builder

Sets the GlObjectsProvider and the ExecutorService to execute OpenGL commands on.

DefaultGlFrameProcessor.Factory.Builder

Sets the HardwareBufferJniWrapper.

DefaultGlFrameProcessor.Factory.Builder

Sets the working color space, which is the color space of frames as they move through the pipeline.

Public constructors

Builder

public Builder(Context context)

Creates an instance.

Parameters
Context context

The Context.

Public methods

build

public DefaultGlFrameProcessor.Factory build()

Builds a Factory instance.

setGlObjectsProviderAndExecutorService

@CanIgnoreReturnValue
public DefaultGlFrameProcessor.Factory.Builder setGlObjectsProviderAndExecutorService(
    GlObjectsProvider glObjectsProvider,
    ExecutorService executorService
)

Sets the GlObjectsProvider and the ExecutorService to execute OpenGL commands on.

If not set, each created DefaultGlFrameProcessor uses a new DefaultGlObjectsProvider and a new single-thread executor, and releases both when it's closed.

If set, the caller owns both. After all the DefaultGlFrameProcessor instances created by the built Factory have been closed, the caller must release the GlObjectsProvider on the ExecutorService's thread, and then shut down the ExecutorService.

Parameters
GlObjectsProvider glObjectsProvider

The GlObjectsProvider.

ExecutorService executorService

The ExecutorService.

setHardwareBufferJniWrapper

@CanIgnoreReturnValue
public DefaultGlFrameProcessor.Factory.Builder setHardwareBufferJniWrapper(
    HardwareBufferJniWrapper hardwareBufferJniWrapper
)

Sets the HardwareBufferJniWrapper.

The default value is INSTANCE.

Parameters
HardwareBufferJniWrapper hardwareBufferJniWrapper

The HardwareBufferJniWrapper.

setWorkingColorSpace

@CanIgnoreReturnValue
public DefaultGlFrameProcessor.Factory.Builder setWorkingColorSpace(ColorInfo workingColorSpace)

Sets the working color space, which is the color space of frames as they move through the pipeline. Input frames are converted to it, and effects receive frames in it. Effects other than ColorConversion also output frames in it.

Supported values are BT2020_LINEAR, BT2020_HLG, BT709_LINEAR and BT709_SRGB.

Before frames are written to the FrameWriter, frames in a linear working color space are converted to an electrical color space: BT2020_LINEAR to BT2020_HLG, and BT709_LINEAR to BT709_SRGB. Frames in an electrical working color space are written unchanged. A ColorConversion applied as the last effect overrides both.

When the working color space is BT.709, HDR input is tone mapped to SDR. Ultra HDR gain maps are only applied when the working color space is BT.2020, on API 34+.

If not set, the working color space is resolved from the first input frame: BT2020_LINEAR for HDR video and Ultra HDR images, and BT709_SRGB otherwise.

Parameters
ColorInfo workingColorSpace

The working ColorInfo.

Throws
java.lang.IllegalArgumentException

If workingColorSpace is not supported.