ColorConversion


@ExperimentalApi
class ColorConversion : 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 functions

java-static ColorConversion!
create(outputColorInfo: ColorInfo!)

Creates an instance that converts frames to outputColorInfo.

GlShaderProgram!
toGlShaderProgram(context: Context!, useHdr: Boolean)

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

Inherited functions

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(inputWidth: Int, inputHeight: Int)

Returns whether a GlEffect applies no change at every timestamp.

Public functions

create

java-static fun create(outputColorInfo: ColorInfo!): ColorConversion!

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
outputColorInfo: ColorInfo!

The ColorInfo to convert frames to.

Returns
ColorConversion!

A new instance.

Throws
java.lang.IllegalArgumentException

If outputColorInfo is not supported.

toGlShaderProgram

fun toGlShaderProgram(context: Context!, useHdr: Boolean): GlShaderProgram!

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.