# ColorInfo

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/ColorInfo.java+class:androidx.media3.common.ColorInfo)

*** ** * ** ***


```
@UnstableApi
class ColorInfo
```

<br />

*** ** * ** ***

Stores color info.

When a `null``ColorInfo` instance is used, this often represents a generic `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#SDR_BT709_LIMITED()` instance.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo.Builder` Builds `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo` instances. |

| ### Constants |
|---|---|
| `const https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#SDR_BT709_LIMITED()` Color info representing SDR BT.709 limited range, which is a common SDR video color format. |
| `const https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#SRGB_BT709_FULL()` Color info representing SDR sRGB in accordance with `https://developer.android.com/reference/android/hardware/DataSpace.html#DATASPACE_SRGB`, which is a common SDR image color format. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo.Builder!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#buildUpon()()` Returns a `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo.Builder` initialized with the values of this instance. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#colorSpaceToIsoColorPrimaries(int)(@https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorSpace colorSpace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the ISO color primary code corresponding to the given `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorSpace`, as per table A.7.21.1 in Rec. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#colorSpaceToIsoMatrixCoefficients(int)(@https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorSpace colorSpace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the ISO matrix coefficients code corresponding to the given `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorSpace`, as per table A.7.21.3 in Rec. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#colorTransferToIsoTransferCharacteristics(int)( @https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer colorTransfer: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Returns the ISO transfer characteristics code corresponding to the given `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer`, as per table A.7.21.2 in Rec. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#equals(java.lang.Object)(obj: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#fromBundle(android.os.Bundle)(bundle: https://developer.android.com/reference/android/os/Bundle.html!)` Restores a `ColorInfo` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#isBitdepthValid()()` Returns whether this instance has valid bitdepths. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#isDataSpaceValid()()` Returns whether this instance has valid DataSpace members. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://checkerframework.org/api/org/checkerframework/checker/nullness/qual/EnsuresNonNullIf.html(result = false, expression = "#1") https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#isEquivalentToAssumedSdrDefault(androidx.media3.common.ColorInfo)(colorInfo: https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo?)` Returns whether the given color info is equivalent to values for a standard dynamic range video that could generally be assumed if no further information is given. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#isTransferHdr(androidx.media3.common.ColorInfo)(colorInfo: https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo?)` Returns whether the `ColorInfo` uses an HDR `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#isValid()()` Returns whether this instance is valid. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#isWideColorGamut(androidx.media3.common.ColorInfo)(colorInfo: https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo?)` Returns whether the `colorInfo` is in a wide color gamut (BT.2020). |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://checkerframework.org/api/org/checkerframework/dataflow/qual/Pure.html @https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorSpace https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#isoColorPrimariesToColorSpace(int)(isoColorPrimaries: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorSpace` corresponding to the given ISO color primary code, as per table A.7.21.1 in Rec. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://checkerframework.org/api/org/checkerframework/dataflow/qual/Pure.html @https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#isoTransferCharacteristicsToColorTransfer(int)( isoTransferCharacteristics: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer` corresponding to the given ISO transfer characteristics code, as per table A.7.21.2 in Rec. |
| `https://developer.android.com/reference/android/os/Bundle.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#toBundle()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#toLogString()()` Returns a prettier `https://developer.android.com/reference/java/lang/String.html` than `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#toString()`, intended for logging. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#toString()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#chromaBitdepth()` The bit depth of the chroma samples of the video, or `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()` if not set. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorRange https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#colorRange()` The `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorRange`, or `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()` if not set. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorSpace https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#colorSpace()` The `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorSpace`, or `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()` if not set. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#colorTransfer()` The `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer`, or `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()` if not set. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>?` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#hdrStaticInfo()` HdrStaticInfo as defined in CTA-861.3, or null if none specified. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#lumaBitdepth()` The bit depth of the luma samples of the video, or `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()` if not set. |

## Constants

### SDR_BT709_LIMITED

```
const val SDR_BT709_LIMITED: ColorInfo!
```

Color info representing SDR BT.709 limited range, which is a common SDR video color format.

### SRGB_BT709_FULL

```
const val SRGB_BT709_FULL: ColorInfo!
```

Color info representing SDR sRGB in accordance with `https://developer.android.com/reference/android/hardware/DataSpace.html#DATASPACE_SRGB`, which is a common SDR image color format.

## Public functions

### buildUpon

```
fun buildUpon(): ColorInfo.Builder!
```

Returns a `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo.Builder` initialized with the values of this instance.

### colorSpaceToIsoColorPrimaries

```
java-static fun colorSpaceToIsoColorPrimaries(@C.ColorSpace colorSpace: Int): Int
```

Returns the ISO color primary code corresponding to the given `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorSpace`, as per table A.7.21.1 in Rec. ITU-T T.832 (06/2019). made.

### colorSpaceToIsoMatrixCoefficients

```
java-static fun colorSpaceToIsoMatrixCoefficients(@C.ColorSpace colorSpace: Int): Int
```

Returns the ISO matrix coefficients code corresponding to the given `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorSpace`, as per table A.7.21.3 in Rec. ITU-T T.832 (06/2019).

### colorTransferToIsoTransferCharacteristics

```
java-static fun colorTransferToIsoTransferCharacteristics(
    @C.ColorTransfer colorTransfer: Int
): Int
```

Returns the ISO transfer characteristics code corresponding to the given `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer`, as per table A.7.21.2 in Rec. ITU-T T.832 (06/2019).

### equals

```
fun equals(obj: Any?): Boolean
```

### fromBundle

```
java-static fun fromBundle(bundle: Bundle!): ColorInfo!
```

Restores a `ColorInfo` from a `https://developer.android.com/reference/android/os/Bundle.html`.

### hashCode

```
fun hashCode(): Int
```

### isBitdepthValid

```
fun isBitdepthValid(): Boolean
```

Returns whether this instance has valid bitdepths.

This instance has valid bitdepths if none of them is `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()`.

### isDataSpaceValid

```
fun isDataSpaceValid(): Boolean
```

Returns whether this instance has valid DataSpace members.

This instance is valid if no DataSpace members are `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()`.

### isEquivalentToAssumedSdrDefault

```
@EnsuresNonNullIf(result = false, expression = "#1")
java-static fun isEquivalentToAssumedSdrDefault(colorInfo: ColorInfo?): Boolean
```

Returns whether the given color info is equivalent to values for a standard dynamic range video that could generally be assumed if no further information is given.

The color info is deemed to be equivalent to SDR video if it either has unset values or values matching a 8-bit (chroma+luma), BT.709 or BT.601 color space, SDR transfer and Limited range color info.

| Parameters |
|---|---|
| `colorInfo: https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo?` | The color info to evaluate. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the given color info is equivalent to the assumed default SDR color info. |

### isTransferHdr

```
java-static fun isTransferHdr(colorInfo: ColorInfo?): Boolean
```

Returns whether the `ColorInfo` uses an HDR `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer`.

`https://developer.android.com/reference/kotlin/androidx/media3/common/C#COLOR_TRANSFER_LINEAR()` is not considered to be an HDR `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer`, because it may represent either SDR or HDR contents.

### isValid

```
fun isValid(): Boolean
```

Returns whether this instance is valid.

This instance is valid if at least one between bitdepths and DataSpace info are valid.

### isWideColorGamut

```
java-static fun isWideColorGamut(colorInfo: ColorInfo?): Boolean
```

Returns whether the `colorInfo` is in a wide color gamut (BT.2020).

### isoColorPrimariesToColorSpace

```
@Pure
@C.ColorSpace
java-static fun isoColorPrimariesToColorSpace(isoColorPrimaries: Int): Int
```

Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorSpace` corresponding to the given ISO color primary code, as per table A.7.21.1 in Rec. ITU-T T.832 (06/2019), or `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()` if no mapping can be made.

Value is one of the following:

- `Format.NO_VALUE`

<br />

### isoTransferCharacteristicsToColorTransfer

```
@Pure
@C.ColorTransfer
java-static fun isoTransferCharacteristicsToColorTransfer(
    isoTransferCharacteristics: Int
): Int
```

Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer` corresponding to the given ISO transfer characteristics code, as per table A.7.21.2 in Rec. ITU-T T.832 (06/2019), or `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()` if no mapping can be made.

Value is one of the following:

- `Format.NO_VALUE`

<br />

### toBundle

```
fun toBundle(): Bundle!
```

### toLogString

```
fun toLogString(): String!
```

Returns a prettier `https://developer.android.com/reference/java/lang/String.html` than `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo#toString()`, intended for logging.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#toLogString(androidx.media3.common.Format)` |   |

### toString

```
fun toString(): String!
```

## Public properties

### chromaBitdepth

```
val chromaBitdepth: Int
```

The bit depth of the chroma samples of the video, or `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()` if not set. It may differ from the luma bit depth.

### colorRange

```
val colorRange: @C.ColorRange Int
```

The `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorRange`, or `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()` if not set.

Value is one of the following:

- `Format.NO_VALUE`

<br />

### colorSpace

```
@C.ColorSpace
val colorSpace: Int
```

The `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorSpace`, or `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()` if not set.

Value is one of the following:

- `Format.NO_VALUE`

<br />

### colorTransfer

```
@C.ColorTransfer
val colorTransfer: Int
```

The `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ColorTransfer`, or `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()` if not set.

Value is one of the following:

- `Format.NO_VALUE`

<br />

### hdrStaticInfo

```
val hdrStaticInfo: Array<Byte>?
```

HdrStaticInfo as defined in CTA-861.3, or null if none specified.

### lumaBitdepth

```
val lumaBitdepth: Int
```

The bit depth of the luma samples of the video, or `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()` if not set.