# 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
public final class ColorInfo
```

<br />

*** ** * ** ***

Stores color info.

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

## Summary

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

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/androidx/media3/common/ColorInfo` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#SDR_BT709_LIMITED()` Color info representing SDR BT.709 limited range, which is a common SDR video color format. |
| `static final https://developer.android.com/reference/androidx/media3/common/ColorInfo` | `https://developer.android.com/reference/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 fields |
|---|---|
| `final int` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#chromaBitdepth()` The bit depth of the chroma samples of the video, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not set. |
| `final @https://developer.android.com/reference/androidx/media3/common/C.ColorRange int` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#colorRange()` The `https://developer.android.com/reference/androidx/media3/common/C.ColorRange`, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not set. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/C.ColorSpace https://developer.android.com/reference/androidx/media3/common/ColorInfo#colorSpace()` The `https://developer.android.com/reference/androidx/media3/common/C.ColorSpace`, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not set. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/C.ColorTransfer https://developer.android.com/reference/androidx/media3/common/ColorInfo#colorTransfer()` The `https://developer.android.com/reference/androidx/media3/common/C.ColorTransfer`, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not set. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable byte[]` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#hdrStaticInfo()` HdrStaticInfo as defined in CTA-861.3, or null if none specified. |
| `final int` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#lumaBitdepth()` The bit depth of the luma samples of the video, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not set. |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#buildUpon()()` Returns a `https://developer.android.com/reference/androidx/media3/common/ColorInfo.Builder` initialized with the values of this instance. |
| `static int` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#colorSpaceToIsoColorPrimaries(int)(@https://developer.android.com/reference/androidx/media3/common/C.ColorSpace int colorSpace)` Returns the ISO color primary code corresponding to the given `https://developer.android.com/reference/androidx/media3/common/C.ColorSpace`, as per table A.7.21.1 in Rec. |
| `static int` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#colorSpaceToIsoMatrixCoefficients(int)(@https://developer.android.com/reference/androidx/media3/common/C.ColorSpace int colorSpace)` Returns the ISO matrix coefficients code corresponding to the given `https://developer.android.com/reference/androidx/media3/common/C.ColorSpace`, as per table A.7.21.3 in Rec. |
| `static int` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#colorTransferToIsoTransferCharacteristics(int)( @https://developer.android.com/reference/androidx/media3/common/C.ColorTransfer int colorTransfer )` Returns the ISO transfer characteristics code corresponding to the given `https://developer.android.com/reference/androidx/media3/common/C.ColorTransfer`, as per table A.7.21.2 in Rec. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#equals(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html obj)` |
| `static https://developer.android.com/reference/androidx/media3/common/ColorInfo` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#fromBundle(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html bundle)` Restores a `ColorInfo` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `int` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#hashCode()()` |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#isBitdepthValid()()` Returns whether this instance has valid bitdepths. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#isDataSpaceValid()()` Returns whether this instance has valid DataSpace members. |
| `static boolean` | `@https://checkerframework.org/api/org/checkerframework/checker/nullness/qual/EnsuresNonNullIf.html(result = false, expression = "#1") https://developer.android.com/reference/androidx/media3/common/ColorInfo#isEquivalentToAssumedSdrDefault(androidx.media3.common.ColorInfo)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/ColorInfo 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. |
| `static boolean` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#isTransferHdr(androidx.media3.common.ColorInfo)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/ColorInfo colorInfo)` Returns whether the `ColorInfo` uses an HDR `https://developer.android.com/reference/androidx/media3/common/C.ColorTransfer`. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#isValid()()` Returns whether this instance is valid. |
| `static boolean` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#isWideColorGamut(androidx.media3.common.ColorInfo)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/ColorInfo colorInfo)` Returns whether the `colorInfo` is in a wide color gamut (BT.2020). |
| `static int` | `@https://checkerframework.org/api/org/checkerframework/dataflow/qual/Pure.html @https://developer.android.com/reference/androidx/media3/common/C.ColorSpace https://developer.android.com/reference/androidx/media3/common/ColorInfo#isoColorPrimariesToColorSpace(int)(int isoColorPrimaries)` Returns the `https://developer.android.com/reference/androidx/media3/common/C.ColorSpace` corresponding to the given ISO color primary code, as per table A.7.21.1 in Rec. |
| `static int` | `@https://checkerframework.org/api/org/checkerframework/dataflow/qual/Pure.html @https://developer.android.com/reference/androidx/media3/common/C.ColorTransfer https://developer.android.com/reference/androidx/media3/common/ColorInfo#isoTransferCharacteristicsToColorTransfer(int)( int isoTransferCharacteristics )` Returns the `https://developer.android.com/reference/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/androidx/media3/common/ColorInfo#toBundle()()` |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#toLogString()()` Returns a prettier `https://developer.android.com/reference/java/lang/String.html` than `https://developer.android.com/reference/androidx/media3/common/ColorInfo#toString()`, intended for logging. |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/common/ColorInfo#toString()()` |

## Constants

### SDR_BT709_LIMITED

```
public static final ColorInfo SDR_BT709_LIMITED
```

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

### SRGB_BT709_FULL

```
public static final 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 fields

### chromaBitdepth

```
public final int chromaBitdepth
```

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

### colorRange

```
public final @C.ColorRange int colorRange
```

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

Value is one of the following:

- `Format.NO_VALUE`

<br />

### colorSpace

```
@C.ColorSpace
public final int colorSpace
```

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

Value is one of the following:

- `Format.NO_VALUE`

<br />

### colorTransfer

```
@C.ColorTransfer
public final int colorTransfer
```

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

Value is one of the following:

- `Format.NO_VALUE`

<br />

### hdrStaticInfo

```
public final @Nullable byte[] hdrStaticInfo
```

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

### lumaBitdepth

```
public final int lumaBitdepth
```

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

## Public methods

### buildUpon

```
public ColorInfo.Builder buildUpon()
```

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

### colorSpaceToIsoColorPrimaries

```
public static int colorSpaceToIsoColorPrimaries(@C.ColorSpace int colorSpace)
```

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

### colorSpaceToIsoMatrixCoefficients

```
public static int colorSpaceToIsoMatrixCoefficients(@C.ColorSpace int colorSpace)
```

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

### colorTransferToIsoTransferCharacteristics

```
public static int colorTransferToIsoTransferCharacteristics(
    @C.ColorTransfer int colorTransfer
)
```

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

### equals

```
public boolean equals(@Nullable Object obj)
```

### fromBundle

```
public static ColorInfo fromBundle(Bundle bundle)
```

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

### hashCode

```
public int hashCode()
```

### isBitdepthValid

```
public boolean isBitdepthValid()
```

Returns whether this instance has valid bitdepths.

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

### isDataSpaceValid

```
public boolean isDataSpaceValid()
```

Returns whether this instance has valid DataSpace members.

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

### isEquivalentToAssumedSdrDefault

```
@EnsuresNonNullIf(result = false, expression = "#1")
public static boolean isEquivalentToAssumedSdrDefault(@Nullable ColorInfo 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.

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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/ColorInfo colorInfo` | The color info to evaluate. |

| Returns |
|---|---|
| `boolean` | Whether the given color info is equivalent to the assumed default SDR color info. |

### isTransferHdr

```
public static boolean isTransferHdr(@Nullable ColorInfo colorInfo)
```

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

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

### isValid

```
public boolean isValid()
```

Returns whether this instance is valid.

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

### isWideColorGamut

```
public static boolean isWideColorGamut(@Nullable ColorInfo colorInfo)
```

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

### isoColorPrimariesToColorSpace

```
@Pure
@C.ColorSpace
public static int isoColorPrimariesToColorSpace(int isoColorPrimaries)
```

Returns the `https://developer.android.com/reference/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/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
public static int isoTransferCharacteristicsToColorTransfer(
    int isoTransferCharacteristics
)
```

Returns the `https://developer.android.com/reference/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/androidx/media3/common/Format#NO_VALUE()` if no mapping can be made.

Value is one of the following:

- `Format.NO_VALUE`

<br />

### toBundle

```
public Bundle toBundle()
```

### toLogString

```
public String toLogString()
```

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

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

### toString

```
public String toString()
```