From daeea81e50d3dc10d58c76dce2db4b42302e4dfe Mon Sep 17 00:00:00 2001 From: huangdarwin Date: Mon, 6 Dec 2021 12:41:11 +0000 Subject: [PATCH] Transformer GL: Create demo UI for changing resolution. Also, add 144p as an acceptable output resolution, to allow for a more obvious resolution difference when running the demo. PiperOrigin-RevId: 414406664 --- .../google/android/exoplayer2/transformer/Transformer.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Transformer.java b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Transformer.java index 7a877e284b..1472506669 100644 --- a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Transformer.java +++ b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Transformer.java @@ -235,7 +235,7 @@ public final class Transformer { * Sets the output resolution using the output height. The default value is the same height as * the input. Output width will scale to preserve the input video's aspect ratio. * - *

For now, only "popular" heights like 240, 360, 480, 720, 1080, 1440, or 2160 are + *

For now, only "popular" heights like 144, 240, 360, 480, 720, 1080, 1440, or 2160 are * supported, to ensure compatibility on different devices. * *

For example, a 1920x1440 video can be scaled to 640x480 by calling setResolution(480). @@ -247,7 +247,8 @@ public final class Transformer { // TODO(Internal b/201293185): Restructure to input a Presentation class. // TODO(Internal b/201293185): Check encoder codec capabilities in order to allow arbitrary // resolutions and reasonable fallbacks. - if (outputHeight != 240 + if (outputHeight != 144 + && outputHeight != 240 && outputHeight != 360 && outputHeight != 480 && outputHeight != 720 @@ -255,7 +256,7 @@ public final class Transformer { && outputHeight != 1440 && outputHeight != 2160) { throw new IllegalArgumentException( - "Please use a height of 240, 360, 480, 720, 1080, 1440, or 2160."); + "Please use a height of 144, 240, 360, 480, 720, 1080, 1440, or 2160."); } this.outputHeight = outputHeight; return this;