# TimestampWrapper

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

*** ** * ** ***


```
@UnstableApi
public final class TimestampWrapper implements GlEffect
```

<br />

*** ** * ** ***

Applies a `https://developer.android.com/reference/androidx/media3/effect/GlEffect` from `startTimeUs` to `endTimeUs`, and no change on all other timestamps.

## Summary

| ### Public fields |
|---|---|
| `final long` | `https://developer.android.com/reference/androidx/media3/effect/TimestampWrapper#endTimeUs()` |
| `final https://developer.android.com/reference/androidx/media3/effect/GlEffect` | `https://developer.android.com/reference/androidx/media3/effect/TimestampWrapper#glEffect()` |
| `final long` | `https://developer.android.com/reference/androidx/media3/effect/TimestampWrapper#startTimeUs()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/effect/TimestampWrapper#TimestampWrapper(androidx.media3.effect.GlEffect,long,long)( https://developer.android.com/reference/androidx/media3/effect/GlEffect glEffect, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long startTimeUs, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long endTimeUs )` Creates a new instance. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/media3/effect/TimestampWrapper#isNoOp(int,int)(int inputWidth, int inputHeight)` Returns whether a `https://developer.android.com/reference/androidx/media3/effect/GlEffect` applies no change at every timestamp. |
| `https://developer.android.com/reference/androidx/media3/effect/GlShaderProgram` | `https://developer.android.com/reference/androidx/media3/effect/TimestampWrapper#toGlShaderProgram(android.content.Context,boolean)(https://developer.android.com/reference/android/content/Context.html context, boolean useHdr)` Returns a `https://developer.android.com/reference/androidx/media3/effect/GlShaderProgram` that applies the effect. |

| ### Inherited methods |
|---|
| From [androidx.media3.common.Effect](https://developer.android.com/reference/androidx/media3/common/Effect) |---|---| | `long` | `https://developer.android.com/reference/androidx/media3/common/Effect#getDurationAfterEffectApplied(long)(long durationUs)` Returns the expected duration of the output stream when the effect is applied given a input `durationUs`. | |

## Public fields

### endTimeUs

```
public final long endTimeUs
```

### glEffect

```
public final GlEffect glEffect
```

### startTimeUs

```
public final long startTimeUs
```

## Public constructors

### TimestampWrapper

```
public TimestampWrapper(
    GlEffect glEffect,
    @IntRange(from = 0) long startTimeUs,
    @IntRange(from = 0) long endTimeUs
)
```

Creates a new instance.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/effect/GlEffect glEffect` | The `https://developer.android.com/reference/androidx/media3/effect/GlEffect` to apply, from `startTimeUs` to `endTimeUs`. This instance must not change the output dimensions. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long startTimeUs` | The time to begin applying `glEffect` on, in microseconds. Must be non-negative. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long endTimeUs` | The time to stop applying {code glEffect} on, in microseconds. Must be non-negative. |

## Public methods

### isNoOp

```
public boolean isNoOp(int inputWidth, int inputHeight)
```

Returns whether a `https://developer.android.com/reference/androidx/media3/effect/GlEffect` applies no change at every timestamp.

This can be used as a hint to skip this instance.

| Parameters |
|---|---|
| `int inputWidth` | The input frame width, in pixels. |
| `int inputHeight` | The input frame height, in pixels. |

### toGlShaderProgram

```
public GlShaderProgram toGlShaderProgram(Context context, boolean useHdr)
```

Returns a `https://developer.android.com/reference/androidx/media3/effect/GlShaderProgram` that applies the effect.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | A `https://developer.android.com/reference/android/content/Context.html`. |
| `boolean useHdr` | Whether input textures come from an HDR source. If `true`, colors will be in linear RGB BT.2020. If `false`, colors will be in linear RGB BT.709. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessingException` | If an error occurs while creating the `https://developer.android.com/reference/androidx/media3/effect/GlShaderProgram`. |