Add Discord community version (64-bit only)

- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
This commit is contained in:
2026-02-18 15:48:36 -08:00
parent c19eb3d7ff
commit c080f0d97f
26930 changed files with 2529574 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
package com.google.android.exoplayer2.video.spherical;
import android.opengl.Matrix;
import com.google.android.exoplayer2.util.TimedValueQueue;
/* loaded from: classes2.dex */
public final class FrameRotationQueue {
public boolean recenterMatrixComputed;
public final float[] recenterMatrix = new float[16];
public final float[] rotationMatrix = new float[16];
public final TimedValueQueue rotations = new TimedValueQueue();
public boolean pollRotationMatrix(float[] fArr, long j) {
float[] fArr2 = (float[]) this.rotations.pollFloor(j);
if (fArr2 == null) {
return false;
}
getRotationMatrixFromAngleAxis(this.rotationMatrix, fArr2);
if (!this.recenterMatrixComputed) {
computeRecenterMatrix(this.recenterMatrix, this.rotationMatrix);
this.recenterMatrixComputed = true;
}
Matrix.multiplyMM(fArr, 0, this.recenterMatrix, 0, this.rotationMatrix, 0);
return true;
}
public static void computeRecenterMatrix(float[] fArr, float[] fArr2) {
Matrix.setIdentityM(fArr, 0);
float f = fArr2[10];
float f2 = fArr2[8];
float sqrt = (float) Math.sqrt((f * f) + (f2 * f2));
float f3 = fArr2[10];
fArr[0] = f3 / sqrt;
float f4 = fArr2[8];
fArr[2] = f4 / sqrt;
fArr[8] = (-f4) / sqrt;
fArr[10] = f3 / sqrt;
}
public static void getRotationMatrixFromAngleAxis(float[] fArr, float[] fArr2) {
float f = fArr2[0];
float f2 = -fArr2[1];
float f3 = -fArr2[2];
float length = Matrix.length(f, f2, f3);
if (length != 0.0f) {
Matrix.setRotateM(fArr, 0, (float) Math.toDegrees(length), f / length, f2 / length, f3 / length);
} else {
Matrix.setIdentityM(fArr, 0);
}
}
}

View File

@@ -0,0 +1,89 @@
package com.google.android.exoplayer2.video.spherical;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.opengl.Matrix;
import android.view.Display;
/* loaded from: classes2.dex */
public final class OrientationListener implements SensorEventListener {
public final Display display;
public final Listener[] listeners;
public boolean recenterMatrixComputed;
public final float[] deviceOrientationMatrix4x4 = new float[16];
public final float[] tempMatrix4x4 = new float[16];
public final float[] recenterMatrix4x4 = new float[16];
public final float[] angles = new float[3];
public interface Listener {
void onOrientationChange(float[] fArr, float f);
}
@Override // android.hardware.SensorEventListener
public void onAccuracyChanged(Sensor sensor, int i) {
}
public OrientationListener(Display display, Listener... listenerArr) {
this.display = display;
this.listeners = listenerArr;
}
@Override // android.hardware.SensorEventListener
public void onSensorChanged(SensorEvent sensorEvent) {
SensorManager.getRotationMatrixFromVector(this.deviceOrientationMatrix4x4, sensorEvent.values);
rotateAroundZ(this.deviceOrientationMatrix4x4, this.display.getRotation());
float extractRoll = extractRoll(this.deviceOrientationMatrix4x4);
rotateYtoSky(this.deviceOrientationMatrix4x4);
recenter(this.deviceOrientationMatrix4x4);
notifyListeners(this.deviceOrientationMatrix4x4, extractRoll);
}
public final void notifyListeners(float[] fArr, float f) {
for (Listener listener : this.listeners) {
listener.onOrientationChange(fArr, f);
}
}
public final void recenter(float[] fArr) {
if (!this.recenterMatrixComputed) {
FrameRotationQueue.computeRecenterMatrix(this.recenterMatrix4x4, fArr);
this.recenterMatrixComputed = true;
}
float[] fArr2 = this.tempMatrix4x4;
System.arraycopy(fArr, 0, fArr2, 0, fArr2.length);
Matrix.multiplyMM(fArr, 0, this.tempMatrix4x4, 0, this.recenterMatrix4x4, 0);
}
public final float extractRoll(float[] fArr) {
SensorManager.remapCoordinateSystem(fArr, 1, 131, this.tempMatrix4x4);
SensorManager.getOrientation(this.tempMatrix4x4, this.angles);
return this.angles[2];
}
public final void rotateAroundZ(float[] fArr, int i) {
if (i != 0) {
int i2 = 129;
int i3 = 1;
if (i == 1) {
i3 = 129;
i2 = 2;
} else if (i == 2) {
i3 = 130;
} else {
if (i != 3) {
throw new IllegalStateException();
}
i2 = 130;
}
float[] fArr2 = this.tempMatrix4x4;
System.arraycopy(fArr, 0, fArr2, 0, fArr2.length);
SensorManager.remapCoordinateSystem(this.tempMatrix4x4, i2, i3, fArr);
}
}
public static void rotateYtoSky(float[] fArr) {
Matrix.rotateM(fArr, 0, 90.0f, 1.0f, 0.0f, 0.0f);
}
}

View File

@@ -0,0 +1,34 @@
package com.google.android.exoplayer2.video.spherical;
import android.opengl.GLES20;
import com.google.android.exoplayer2.util.GlUtil;
/* loaded from: classes2.dex */
public final class ProjectionRenderer {
public int mvpMatrixHandle;
public int positionHandle;
public int program;
public int texCoordsHandle;
public int textureHandle;
public int uTexMatrixHandle;
public static final String[] VERTEX_SHADER_CODE = {"uniform mat4 uMvpMatrix;", "uniform mat3 uTexMatrix;", "attribute vec4 aPosition;", "attribute vec2 aTexCoords;", "varying vec2 vTexCoords;", "void main() {", " gl_Position = uMvpMatrix * aPosition;", " vTexCoords = (uTexMatrix * vec3(aTexCoords, 1)).xy;", "}"};
public static final String[] FRAGMENT_SHADER_CODE = {"#extension GL_OES_EGL_image_external : require", "precision mediump float;", "uniform samplerExternalOES uTexture;", "varying vec2 vTexCoords;", "void main() {", " gl_FragColor = texture2D(uTexture, vTexCoords);", "}"};
public static final float[] TEX_MATRIX_WHOLE = {1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f};
public static final float[] TEX_MATRIX_TOP = {1.0f, 0.0f, 0.0f, 0.0f, -0.5f, 0.0f, 0.0f, 0.5f, 1.0f};
public static final float[] TEX_MATRIX_BOTTOM = {1.0f, 0.0f, 0.0f, 0.0f, -0.5f, 0.0f, 0.0f, 1.0f, 1.0f};
public static final float[] TEX_MATRIX_LEFT = {0.5f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f};
public static final float[] TEX_MATRIX_RIGHT = {0.5f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.5f, 1.0f, 1.0f};
public void draw(int i, float[] fArr, boolean z) {
}
public void init() {
int compileProgram = GlUtil.compileProgram(VERTEX_SHADER_CODE, FRAGMENT_SHADER_CODE);
this.program = compileProgram;
this.mvpMatrixHandle = GLES20.glGetUniformLocation(compileProgram, "uMvpMatrix");
this.uTexMatrixHandle = GLES20.glGetUniformLocation(this.program, "uTexMatrix");
this.positionHandle = GLES20.glGetAttribLocation(this.program, "aPosition");
this.texCoordsHandle = GLES20.glGetAttribLocation(this.program, "aTexCoords");
this.textureHandle = GLES20.glGetUniformLocation(this.program, "uTexture");
}
}

View File

@@ -0,0 +1,71 @@
package com.google.android.exoplayer2.video.spherical;
import android.graphics.SurfaceTexture;
import android.opengl.GLES20;
import android.opengl.Matrix;
import com.amazonaws.handlers.HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0;
import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.util.GlUtil;
import com.google.android.exoplayer2.util.TimedValueQueue;
import java.util.concurrent.atomic.AtomicBoolean;
/* loaded from: classes2.dex */
public final class SceneRenderer {
public SurfaceTexture surfaceTexture;
public int textureId;
public final AtomicBoolean frameAvailable = new AtomicBoolean();
public final AtomicBoolean resetRotationAtNextFrame = new AtomicBoolean(true);
public final ProjectionRenderer projectionRenderer = new ProjectionRenderer();
public final FrameRotationQueue frameRotationQueue = new FrameRotationQueue();
public final TimedValueQueue sampleTimestampQueue = new TimedValueQueue();
public final TimedValueQueue projectionQueue = new TimedValueQueue();
public final float[] rotationMatrix = new float[16];
public final float[] tempMatrix = new float[16];
public volatile int defaultStereoMode = 0;
public int lastStereoMode = -1;
public void setDefaultStereoMode(int i) {
this.defaultStereoMode = i;
}
public SurfaceTexture init() {
GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
GlUtil.checkGlError();
this.projectionRenderer.init();
GlUtil.checkGlError();
this.textureId = GlUtil.createExternalTexture();
SurfaceTexture surfaceTexture = new SurfaceTexture(this.textureId);
this.surfaceTexture = surfaceTexture;
surfaceTexture.setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() { // from class: com.google.android.exoplayer2.video.spherical.SceneRenderer$$ExternalSyntheticLambda0
@Override // android.graphics.SurfaceTexture.OnFrameAvailableListener
public final void onFrameAvailable(SurfaceTexture surfaceTexture2) {
SceneRenderer.this.lambda$init$0(surfaceTexture2);
}
});
return this.surfaceTexture;
}
public final /* synthetic */ void lambda$init$0(SurfaceTexture surfaceTexture) {
this.frameAvailable.set(true);
}
public void drawFrame(float[] fArr, boolean z) {
GLES20.glClear(16384);
GlUtil.checkGlError();
if (this.frameAvailable.compareAndSet(true, false)) {
((SurfaceTexture) Assertions.checkNotNull(this.surfaceTexture)).updateTexImage();
GlUtil.checkGlError();
if (this.resetRotationAtNextFrame.compareAndSet(true, false)) {
Matrix.setIdentityM(this.rotationMatrix, 0);
}
long timestamp = this.surfaceTexture.getTimestamp();
Long l = (Long) this.sampleTimestampQueue.poll(timestamp);
if (l != null) {
this.frameRotationQueue.pollRotationMatrix(this.rotationMatrix, l.longValue());
}
HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0.m(this.projectionQueue.pollFloor(timestamp));
}
Matrix.multiplyMM(this.tempMatrix, 0, fArr, 0, this.rotationMatrix, 0);
this.projectionRenderer.draw(this.textureId, this.tempMatrix, z);
}
}

View File

@@ -0,0 +1,241 @@
package com.google.android.exoplayer2.video.spherical;
import android.content.Context;
import android.graphics.PointF;
import android.graphics.SurfaceTexture;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.opengl.Matrix;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.WindowManager;
import androidx.annotation.Nullable;
import com.amazonaws.handlers.HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0;
import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.util.Util;
import com.google.android.exoplayer2.video.spherical.OrientationListener;
import com.google.android.exoplayer2.video.spherical.TouchTracker;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
/* loaded from: classes2.dex */
public final class SphericalGLSurfaceView extends GLSurfaceView {
public static final /* synthetic */ int $r8$clinit = 0;
public boolean isOrientationListenerRegistered;
public boolean isStarted;
public final Handler mainHandler;
public final OrientationListener orientationListener;
public final Sensor orientationSensor;
public final SceneRenderer scene;
public final SensorManager sensorManager;
public Surface surface;
public SurfaceTexture surfaceTexture;
public final TouchTracker touchTracker;
public boolean useSensorRotation;
public final CopyOnWriteArrayList videoSurfaceListeners;
public SphericalGLSurfaceView(Context context) {
this(context, null);
}
public SphericalGLSurfaceView(Context context, @Nullable AttributeSet attributeSet) {
super(context, attributeSet);
this.videoSurfaceListeners = new CopyOnWriteArrayList();
this.mainHandler = new Handler(Looper.getMainLooper());
SensorManager sensorManager = (SensorManager) Assertions.checkNotNull(context.getSystemService("sensor"));
this.sensorManager = sensorManager;
Sensor defaultSensor = Util.SDK_INT >= 18 ? sensorManager.getDefaultSensor(15) : null;
this.orientationSensor = defaultSensor == null ? sensorManager.getDefaultSensor(11) : defaultSensor;
SceneRenderer sceneRenderer = new SceneRenderer();
this.scene = sceneRenderer;
Renderer renderer = new Renderer(sceneRenderer);
TouchTracker touchTracker = new TouchTracker(context, renderer, 25.0f);
this.touchTracker = touchTracker;
this.orientationListener = new OrientationListener(((WindowManager) Assertions.checkNotNull((WindowManager) context.getSystemService("window"))).getDefaultDisplay(), touchTracker, renderer);
this.useSensorRotation = true;
setEGLContextClientVersion(2);
setRenderer(renderer);
setOnTouchListener(touchTracker);
}
public void setDefaultStereoMode(int i) {
this.scene.setDefaultStereoMode(i);
}
public void setUseSensorRotation(boolean z) {
this.useSensorRotation = z;
updateOrientationListenerRegistration();
}
@Override // android.opengl.GLSurfaceView
public void onResume() {
super.onResume();
this.isStarted = true;
updateOrientationListenerRegistration();
}
@Override // android.opengl.GLSurfaceView
public void onPause() {
this.isStarted = false;
updateOrientationListenerRegistration();
super.onPause();
}
@Override // android.opengl.GLSurfaceView, android.view.SurfaceView, android.view.View
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
this.mainHandler.post(new Runnable() { // from class: com.google.android.exoplayer2.video.spherical.SphericalGLSurfaceView$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
SphericalGLSurfaceView.this.lambda$onDetachedFromWindow$0();
}
});
}
public final /* synthetic */ void lambda$onDetachedFromWindow$0() {
Surface surface = this.surface;
if (surface != null) {
Iterator it = this.videoSurfaceListeners.iterator();
if (it.hasNext()) {
HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0.m(it.next());
throw null;
}
}
releaseSurface(this.surfaceTexture, surface);
this.surfaceTexture = null;
this.surface = null;
}
public final void updateOrientationListenerRegistration() {
boolean z = this.useSensorRotation && this.isStarted;
Sensor sensor = this.orientationSensor;
if (sensor == null || z == this.isOrientationListenerRegistered) {
return;
}
if (z) {
this.sensorManager.registerListener(this.orientationListener, sensor, 0);
} else {
this.sensorManager.unregisterListener(this.orientationListener);
}
this.isOrientationListenerRegistered = z;
}
public final void onSurfaceTextureAvailable(final SurfaceTexture surfaceTexture) {
this.mainHandler.post(new Runnable() { // from class: com.google.android.exoplayer2.video.spherical.SphericalGLSurfaceView$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
SphericalGLSurfaceView.this.lambda$onSurfaceTextureAvailable$1(surfaceTexture);
}
});
}
public final /* synthetic */ void lambda$onSurfaceTextureAvailable$1(SurfaceTexture surfaceTexture) {
SurfaceTexture surfaceTexture2 = this.surfaceTexture;
Surface surface = this.surface;
Surface surface2 = new Surface(surfaceTexture);
this.surfaceTexture = surfaceTexture;
this.surface = surface2;
Iterator it = this.videoSurfaceListeners.iterator();
if (it.hasNext()) {
HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0.m(it.next());
throw null;
}
releaseSurface(surfaceTexture2, surface);
}
public static void releaseSurface(SurfaceTexture surfaceTexture, Surface surface) {
if (surfaceTexture != null) {
surfaceTexture.release();
}
if (surface != null) {
surface.release();
}
}
public final class Renderer implements GLSurfaceView.Renderer, TouchTracker.Listener, OrientationListener.Listener {
public final float[] deviceOrientationMatrix;
public float deviceRoll;
public final SceneRenderer scene;
public float touchPitch;
public final float[] touchPitchMatrix;
public final float[] touchYawMatrix;
public final float[] projectionMatrix = new float[16];
public final float[] viewProjectionMatrix = new float[16];
public final float[] viewMatrix = new float[16];
public final float[] tempMatrix = new float[16];
public Renderer(SceneRenderer sceneRenderer) {
float[] fArr = new float[16];
this.deviceOrientationMatrix = fArr;
float[] fArr2 = new float[16];
this.touchPitchMatrix = fArr2;
float[] fArr3 = new float[16];
this.touchYawMatrix = fArr3;
this.scene = sceneRenderer;
Matrix.setIdentityM(fArr, 0);
Matrix.setIdentityM(fArr2, 0);
Matrix.setIdentityM(fArr3, 0);
this.deviceRoll = 3.1415927f;
}
@Override // android.opengl.GLSurfaceView.Renderer
public synchronized void onSurfaceCreated(GL10 gl10, EGLConfig eGLConfig) {
SphericalGLSurfaceView.this.onSurfaceTextureAvailable(this.scene.init());
}
@Override // android.opengl.GLSurfaceView.Renderer
public void onSurfaceChanged(GL10 gl10, int i, int i2) {
GLES20.glViewport(0, 0, i, i2);
float f = i / i2;
Matrix.perspectiveM(this.projectionMatrix, 0, calculateFieldOfViewInYDirection(f), f, 0.1f, 100.0f);
}
@Override // android.opengl.GLSurfaceView.Renderer
public void onDrawFrame(GL10 gl10) {
synchronized (this) {
Matrix.multiplyMM(this.tempMatrix, 0, this.deviceOrientationMatrix, 0, this.touchYawMatrix, 0);
Matrix.multiplyMM(this.viewMatrix, 0, this.touchPitchMatrix, 0, this.tempMatrix, 0);
}
Matrix.multiplyMM(this.viewProjectionMatrix, 0, this.projectionMatrix, 0, this.viewMatrix, 0);
this.scene.drawFrame(this.viewProjectionMatrix, false);
}
@Override // com.google.android.exoplayer2.video.spherical.OrientationListener.Listener
public synchronized void onOrientationChange(float[] fArr, float f) {
float[] fArr2 = this.deviceOrientationMatrix;
System.arraycopy(fArr, 0, fArr2, 0, fArr2.length);
this.deviceRoll = -f;
updatePitchMatrix();
}
public final void updatePitchMatrix() {
Matrix.setRotateM(this.touchPitchMatrix, 0, -this.touchPitch, (float) Math.cos(this.deviceRoll), (float) Math.sin(this.deviceRoll), 0.0f);
}
@Override // com.google.android.exoplayer2.video.spherical.TouchTracker.Listener
public synchronized void onScrollChange(PointF pointF) {
this.touchPitch = pointF.y;
updatePitchMatrix();
Matrix.setRotateM(this.touchYawMatrix, 0, -pointF.x, 0.0f, 1.0f, 0.0f);
}
@Override // com.google.android.exoplayer2.video.spherical.TouchTracker.Listener
public boolean onSingleTapUp(MotionEvent motionEvent) {
return SphericalGLSurfaceView.this.performClick();
}
public final float calculateFieldOfViewInYDirection(float f) {
if (f > 1.0f) {
return (float) (Math.toDegrees(Math.atan(Math.tan(Math.toRadians(45.0d)) / f)) * 2.0d);
}
return 90.0f;
}
}
}

View File

@@ -0,0 +1,70 @@
package com.google.android.exoplayer2.video.spherical;
import android.content.Context;
import android.graphics.PointF;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import com.google.android.exoplayer2.video.spherical.OrientationListener;
/* loaded from: classes2.dex */
public final class TouchTracker extends GestureDetector.SimpleOnGestureListener implements View.OnTouchListener, OrientationListener.Listener {
public final GestureDetector gestureDetector;
public final Listener listener;
public final float pxPerDegrees;
public final PointF previousTouchPointPx = new PointF();
public final PointF accumulatedTouchOffsetDegrees = new PointF();
public volatile float roll = 3.1415927f;
public interface Listener {
void onScrollChange(PointF pointF);
boolean onSingleTapUp(MotionEvent motionEvent);
}
@Override // com.google.android.exoplayer2.video.spherical.OrientationListener.Listener
public void onOrientationChange(float[] fArr, float f) {
this.roll = -f;
}
public TouchTracker(Context context, Listener listener, float f) {
this.listener = listener;
this.pxPerDegrees = f;
this.gestureDetector = new GestureDetector(context, this);
}
@Override // android.view.View.OnTouchListener
public boolean onTouch(View view, MotionEvent motionEvent) {
return this.gestureDetector.onTouchEvent(motionEvent);
}
@Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnGestureListener
public boolean onDown(MotionEvent motionEvent) {
this.previousTouchPointPx.set(motionEvent.getX(), motionEvent.getY());
return true;
}
@Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnGestureListener
public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
float x = (motionEvent2.getX() - this.previousTouchPointPx.x) / this.pxPerDegrees;
float y = motionEvent2.getY();
PointF pointF = this.previousTouchPointPx;
float f3 = (y - pointF.y) / this.pxPerDegrees;
pointF.set(motionEvent2.getX(), motionEvent2.getY());
double d = this.roll;
float cos = (float) Math.cos(d);
float sin = (float) Math.sin(d);
PointF pointF2 = this.accumulatedTouchOffsetDegrees;
pointF2.x -= (cos * x) - (sin * f3);
float f4 = pointF2.y + (sin * x) + (cos * f3);
pointF2.y = f4;
pointF2.y = Math.max(-45.0f, Math.min(45.0f, f4));
this.listener.onScrollChange(this.accumulatedTouchOffsetDegrees);
return true;
}
@Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnGestureListener
public boolean onSingleTapUp(MotionEvent motionEvent) {
return this.listener.onSingleTapUp(motionEvent);
}
}