ColorConversion


@ExperimentalApi
public final class ColorConversion implements GlEffect


Converts frames from an input color space to an electrical output color space.

Applying this effect last in an effect chain sets the output color space of the video frame processing pipeline.

Summary

Public methods

static ColorConversion
create(ColorInfo outputColorInfo)

Creates an instance that converts frames to outputColorInfo.

GlShaderProgram
toGlShaderProgram(Context context, boolean useHdr)

Not supported, because the input color space is only known once the pipeline receives frames.

Inherited methods

From androidx.media3.common.Effect
long

Returns the expected duration of the output stream when the effect is applied given a input durationUs.

From androidx.media3.effect.GlEffect
boolean
isNoOp(int inputWidth, int inputHeight)

Returns whether a GlEffect applies no change at every timestamp.

Public methods

create

public static ColorConversion create(ColorInfo outputColorInfo)

Creates an instance that converts frames to outputColorInfo.

Supported outputs are BT.2020 with COLOR_TRANSFER_HLG, and BT.709 with COLOR_TRANSFER_SRGB. Other properties of outputColorInfo, such as the color range, do not affect the conversion and are propagated to the output frames unchanged.

Parameters
ColorInfo outputColorInfo

The ColorInfo to convert frames to.

Returns
ColorConversion

A new instance.

Throws
java.lang.IllegalArgumentException

If outputColorInfo is not supported.

toGlShaderProgram

public GlShaderProgram toGlShaderProgram(Context context, boolean useHdr)

Not supported, because the input color space is only known once the pipeline receives frames.

Throws
java.lang.UnsupportedOperationException

Always. This effect is only supported by DefaultGlFrameProcessor.