# Frame

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/video/Frame.java+class:androidx.media3.common.video.Frame)

*** ** * ** ***

<br />

```
@ExperimentalApi
interface Frame
```

<br />

Known direct subclasses [HardwareBufferFrame](https://developer.android.com/reference/kotlin/androidx/media3/common/video/HardwareBufferFrame)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/video/HardwareBufferFrame` | A `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame` backed by a `https://developer.android.com/reference/android/hardware/HardwareBuffer.html`. |

*** ** * ** ***

Holds a frame of video data.

Pixel data is accessible via subtypes.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) @https://developer.android.com/reference/kotlin/androidx/annotation/LongDef(flag = true, value = ) annotation https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame.Usage` Flags that define how `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame` are used. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame#KEY_DISPLAY_TIME_NS() = "KEY_DISPLAY_TIME_NS"` Metadata key for storing the system time that this frame should be displayed at to maintain A/V sync. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame#KEY_PRESENTATION_TIME_US() = "KEY_PRESENTATION_TIME_US"` Metadata key for storing the composition presentation time of this frame, in microseconds. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame#USAGE_COMPOSER_OVERLAY() = 2048` The frame will be used as a hardware composer overlay layer. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame#USAGE_CPU_READ_OFTEN() = 3` The frame will often be read by the CPU. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame#USAGE_CPU_READ_RARELY() = 2` The frame will sometimes be read by the CPU. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame#USAGE_CPU_WRITE_OFTEN() = 48` The frame will often be written to by the CPU. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame#USAGE_CPU_WRITE_RARELY() = 32` The frame will sometimes be written to by the CPU. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame#USAGE_GPU_COLOR_OUTPUT() = 512` The frame will be written to by the GPU. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame#USAGE_GPU_SAMPLED_IMAGE() = 256` The frame will be read from by the GPU. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame#USAGE_VIDEO_ENCODE() = 65536` The frame will be read by a hardware video encoder. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame#getContentTimeUs()()` The time of the frame in the context of the input media in microseconds, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if it is not set. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame#getFormat()()` The frame format. |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/Frame#getMetadata()()` The frame metadata. |

## Constants

### KEY_DISPLAY_TIME_NS

```
const val KEY_DISPLAY_TIME_NS = "KEY_DISPLAY_TIME_NS": String!
```

Metadata key for storing the system time that this frame should be displayed at to maintain A/V sync. The value should be a `Long`.

### KEY_PRESENTATION_TIME_US

```
const val KEY_PRESENTATION_TIME_US = "KEY_PRESENTATION_TIME_US": String!
```

Metadata key for storing the composition presentation time of this frame, in microseconds. The value should be a `Long`.

### USAGE_COMPOSER_OVERLAY

```
const val USAGE_COMPOSER_OVERLAY = 2048: Long
```

The frame will be used as a hardware composer overlay layer. That is, it will be displayed using the system compositor via `https://developer.android.com/reference/android/view/SurfaceControl.html`.

### USAGE_CPU_READ_OFTEN

```
const val USAGE_CPU_READ_OFTEN = 3: Long
```

The frame will often be read by the CPU.

### USAGE_CPU_READ_RARELY

```
const val USAGE_CPU_READ_RARELY = 2: Long
```

The frame will sometimes be read by the CPU.

### USAGE_CPU_WRITE_OFTEN

```
const val USAGE_CPU_WRITE_OFTEN = 48: Long
```

The frame will often be written to by the CPU.

### USAGE_CPU_WRITE_RARELY

```
const val USAGE_CPU_WRITE_RARELY = 32: Long
```

The frame will sometimes be written to by the CPU.

### USAGE_GPU_COLOR_OUTPUT

```
const val USAGE_GPU_COLOR_OUTPUT = 512: Long
```

The frame will be written to by the GPU.

### USAGE_GPU_SAMPLED_IMAGE

```
const val USAGE_GPU_SAMPLED_IMAGE = 256: Long
```

The frame will be read from by the GPU.

### USAGE_VIDEO_ENCODE

```
const val USAGE_VIDEO_ENCODE = 65536: Long
```

The frame will be read by a hardware video encoder.

## Public functions

### getContentTimeUs

```
fun getContentTimeUs(): Long
```

The time of the frame in the context of the input media in microseconds, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if it is not set.

### getFormat

```
fun getFormat(): Format!
```

The frame format.

### getMetadata

```
fun getMetadata(): ImmutableMap<String!, Any!>!
```

The frame metadata.