From 20d56341fc8f40695d8ceb1f9961f49df60b032c Mon Sep 17 00:00:00 2001 From: tofunmi Date: Wed, 12 Jun 2024 02:49:55 -0700 Subject: [PATCH] Remove useHdr from overlaySettings useHdr is unused option and doesn't make sense is the dynamic range of the overlay and video must match Also reorders and adds javadoc in line with coding conventions PiperOrigin-RevId: 642555396 --- RELEASENOTES.md | 2 + .../media3/effect/OverlaySettings.java | 75 +++++++++---------- 2 files changed, 36 insertions(+), 41 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index f143a14864..feb7a4dc53 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -19,6 +19,8 @@ * Metadata: * DRM: * Effect: + * Remove unused `OverlaySettings.useHdr` since dynamic range of overlay + and frame must match. * Muxers: * IMA extension: * Session: diff --git a/libraries/effect/src/main/java/androidx/media3/effect/OverlaySettings.java b/libraries/effect/src/main/java/androidx/media3/effect/OverlaySettings.java index 266b079454..85f3d5d856 100644 --- a/libraries/effect/src/main/java/androidx/media3/effect/OverlaySettings.java +++ b/libraries/effect/src/main/java/androidx/media3/effect/OverlaySettings.java @@ -28,36 +28,9 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; */ @UnstableApi public final class OverlaySettings { - public final boolean useHdr; - public final float alphaScale; - public final Pair backgroundFrameAnchor; - public final Pair overlayFrameAnchor; - public final Pair scale; - public final float rotationDegrees; - - private OverlaySettings( - boolean useHdr, - float alphaScale, - Pair backgroundFrameAnchor, - Pair overlayFrameAnchor, - Pair scale, - float rotationDegrees) { - this.useHdr = useHdr; - this.alphaScale = alphaScale; - this.backgroundFrameAnchor = backgroundFrameAnchor; - this.overlayFrameAnchor = overlayFrameAnchor; - this.scale = scale; - this.rotationDegrees = rotationDegrees; - } - - /** Returns a new {@link Builder} initialized with the values of this instance. */ - /* package */ Builder buildUpon() { - return new Builder(this); - } /** A builder for {@link OverlaySettings} instances. */ public static final class Builder { - private boolean useHdr; private float alphaScale; private Pair backgroundFrameAnchor; private Pair overlayFrameAnchor; @@ -74,7 +47,6 @@ public final class OverlaySettings { } private Builder(OverlaySettings overlaySettings) { - this.useHdr = overlaySettings.useHdr; this.alphaScale = overlaySettings.alphaScale; this.backgroundFrameAnchor = overlaySettings.backgroundFrameAnchor; this.overlayFrameAnchor = overlaySettings.overlayFrameAnchor; @@ -82,18 +54,6 @@ public final class OverlaySettings { this.rotationDegrees = overlaySettings.rotationDegrees; } - /** - * Sets whether input overlay comes from an HDR source. If {@code true}, colors will be in - * linear RGB BT.2020. If {@code false}, colors will be in linear RGB BT.709. - * - *

Set to {@code false} by default. - */ - @CanIgnoreReturnValue - public Builder setUsesHdr(boolean useHdr) { - this.useHdr = useHdr; - return this; - } - /** * Sets the alpha scale value of the overlay, altering its translucency. * @@ -183,7 +143,40 @@ public final class OverlaySettings { /** Creates an instance of {@link OverlaySettings}, using defaults if values are unset. */ public OverlaySettings build() { return new OverlaySettings( - useHdr, alphaScale, backgroundFrameAnchor, overlayFrameAnchor, scale, rotationDegrees); + alphaScale, backgroundFrameAnchor, overlayFrameAnchor, scale, rotationDegrees); } } + + /** The alpha scale value of the overlay, altering its translucency. */ + public final float alphaScale; + + /** The coordinates for the anchor point of the overlay within the background frame. */ + public final Pair backgroundFrameAnchor; + + /** The coordinates for the anchor point of the overlay frame. */ + public final Pair overlayFrameAnchor; + + /** The scaling of the overlay. */ + public final Pair scale; + + /** The rotation of the overlay, counter-clockwise. */ + public final float rotationDegrees; + + private OverlaySettings( + float alphaScale, + Pair backgroundFrameAnchor, + Pair overlayFrameAnchor, + Pair scale, + float rotationDegrees) { + this.alphaScale = alphaScale; + this.backgroundFrameAnchor = backgroundFrameAnchor; + this.overlayFrameAnchor = overlayFrameAnchor; + this.scale = scale; + this.rotationDegrees = rotationDegrees; + } + + /** Returns a new {@link Builder} initialized with the values of this instance. */ + /* package */ Builder buildUpon() { + return new Builder(this); + } }