From 4c9538bd4c869909365e0df269381bf7336267a2 Mon Sep 17 00:00:00 2001 From: huangdarwin Date: Tue, 24 Jan 2023 20:13:31 +0000 Subject: [PATCH] Effect: Clarify OpenGL configuration. This information may be needed for applications to create their own OpenGL contexts and textures passed into or interacting with Effects. PiperOrigin-RevId: 504342258 --- .../exoplayer2/effect/GlEffectsFrameProcessor.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/effect/src/main/java/com/google/android/exoplayer2/effect/GlEffectsFrameProcessor.java b/library/effect/src/main/java/com/google/android/exoplayer2/effect/GlEffectsFrameProcessor.java index be7ab9c1e4..d4d35e8489 100644 --- a/library/effect/src/main/java/com/google/android/exoplayer2/effect/GlEffectsFrameProcessor.java +++ b/library/effect/src/main/java/com/google/android/exoplayer2/effect/GlEffectsFrameProcessor.java @@ -24,6 +24,8 @@ import android.content.Context; import android.graphics.SurfaceTexture; import android.opengl.EGLContext; import android.opengl.EGLDisplay; +import android.opengl.GLES20; +import android.opengl.GLES30; import android.view.Surface; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; @@ -73,6 +75,14 @@ public final class GlEffectsFrameProcessor implements FrameProcessor { * outputColorInfo}'s {@link ColorInfo#colorRange} values are currently ignored, in favor of * {@code null} and {@link C#COLOR_RANGE_FULL}, respectively. * + *

The OpenGL context will use OpenGL version {@code 3}, and textures will be {@link + * GLES30#GL_RGBA16F} and {@link GLES30#GL_HALF_FLOAT} if {@code inputColorInfo} or {@code + * outputColorInfo} {@linkplain ColorInfo#isTransferHdr} are HDR}, and OpenGL version {@code 2} + * with {@link GLES20#GL_RGBA} and {@link GLES20#GL_UNSIGNED_BYTE} otherwise. It will be + * configured with {@link GlUtil#EGL_CONFIG_ATTRIBUTES_RGBA_1010102} if {@code outputColorInfo} + * {@linkplain ColorInfo#isTransferHdr is HDR}, and {@link + * GlUtil#EGL_CONFIG_ATTRIBUTES_RGBA_8888} otherwise. + * *

Pass a {@link MoreExecutors#directExecutor() direct listenerExecutor} if invoking the * {@code listener} on {@link GlEffectsFrameProcessor}'s internal thread is desired. */