what-the-bank/sources/com/scb/phone/view/camera/CameraSource.java

266 lines
9.6 KiB
Java

package com.scb.phone.view.camera;
import android.content.Context;
import android.graphics.ImageFormat;
import android.hardware.Camera;
import com.google.android.gms.common.images.Size;
import com.scb.phone.view.camera.CameraSource;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.Map;
import org.bouncycastle.crypto.tls.CipherSuite;
/* loaded from: classes5.dex */
public final class CameraSource {
Map<byte[], ByteBuffer> a;
public Camera b;
Context c;
public final Object d;
public Camera.AutoFocusCallback e;
public String f;
public String g;
public int h;
Size i;
public Sts j;
public float k;
private Thread m;
public int n;
/* renamed from: o, reason: collision with root package name */
public int f8013o;
/* loaded from: classes5.dex */
public interface LWm {
void b(int i, int i2, byte[] bArr);
}
/* loaded from: classes5.dex */
public static class IeS {
public CameraSource a;
public LWm b;
public IeS(Context context, LWm lWm) {
CameraSource cameraSource = new CameraSource((byte) 0);
this.a = cameraSource;
if (context == null) {
throw new IllegalArgumentException("No context supplied.");
}
cameraSource.c = context;
this.b = lWm;
}
}
/* JADX WARN: Removed duplicated region for block: B:103:0x017c A[Catch: all -> 0x023a, TryCatch #0 {, blocks: (B:4:0x0005, B:9:0x000b, B:10:0x0011, B:12:0x0018, B:18:0x0026, B:19:0x0043, B:21:0x0049, B:22:0x005a, B:24:0x0060, B:27:0x007a, B:33:0x0083, B:35:0x008a, B:36:0x008e, B:38:0x0094, B:40:0x00a3, B:41:0x00ac, B:43:0x00b2, B:52:0x00d4, B:53:0x00ec, B:55:0x00f3, B:64:0x0112, B:66:0x0118, B:67:0x0123, B:76:0x0166, B:78:0x0172, B:79:0x0184, B:81:0x018e, B:83:0x019a, B:84:0x019f, B:86:0x01a9, B:88:0x01af, B:90:0x01bb, B:91:0x01c0, B:92:0x020f, B:95:0x0217, B:96:0x0218, B:101:0x0220, B:102:0x0221, B:103:0x017c, B:107:0x0222, B:108:0x0229, B:109:0x022a, B:110:0x0231, B:111:0x0232, B:112:0x0239, B:14:0x0020, B:94:0x0210), top: B:3:0x0005, inners: #1 }] */
/* JADX WARN: Removed duplicated region for block: B:78:0x0172 A[Catch: all -> 0x023a, TryCatch #0 {, blocks: (B:4:0x0005, B:9:0x000b, B:10:0x0011, B:12:0x0018, B:18:0x0026, B:19:0x0043, B:21:0x0049, B:22:0x005a, B:24:0x0060, B:27:0x007a, B:33:0x0083, B:35:0x008a, B:36:0x008e, B:38:0x0094, B:40:0x00a3, B:41:0x00ac, B:43:0x00b2, B:52:0x00d4, B:53:0x00ec, B:55:0x00f3, B:64:0x0112, B:66:0x0118, B:67:0x0123, B:76:0x0166, B:78:0x0172, B:79:0x0184, B:81:0x018e, B:83:0x019a, B:84:0x019f, B:86:0x01a9, B:88:0x01af, B:90:0x01bb, B:91:0x01c0, B:92:0x020f, B:95:0x0217, B:96:0x0218, B:101:0x0220, B:102:0x0221, B:103:0x017c, B:107:0x0222, B:108:0x0229, B:109:0x022a, B:110:0x0231, B:111:0x0232, B:112:0x0239, B:14:0x0020, B:94:0x0210), top: B:3:0x0005, inners: #1 }] */
/* JADX WARN: Removed duplicated region for block: B:93:0x0210 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final com.scb.phone.view.camera.CameraSource aoc_(android.view.SurfaceHolder r17) throws java.io.IOException {
/*
Method dump skipped, instructions count: 573
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.scb.phone.view.camera.CameraSource.aoc_(android.view.SurfaceHolder):com.scb.phone.view.camera.CameraSource");
}
public static int e(int i) {
int i2 = 300 / 2;
return Math.abs(i) + CipherSuite.TLS_RSA_WITH_SEED_CBC_SHA > 1000 ? i > 0 ? 850 : -850 : i - 150;
}
public final void d() {
synchronized (this.d) {
Sts sts = this.j;
synchronized (sts.b) {
sts.a = false;
sts.b.notifyAll();
}
Thread thread = this.m;
if (thread != null) {
try {
thread.join();
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
}
this.m = null;
}
this.a.clear();
Camera camera = this.b;
if (camera != null) {
camera.stopPreview();
this.b.setPreviewCallbackWithBuffer(null);
try {
this.b.setPreviewTexture(null);
} catch (Exception unused2) {
}
this.b.release();
this.b = null;
}
}
}
public final boolean b(String str) {
synchronized (this.d) {
Camera camera = this.b;
if (camera != null) {
Camera.Parameters parameters = camera.getParameters();
if (parameters.getSupportedFlashModes().contains(str)) {
parameters.setFlashMode(str);
this.b.setParameters(parameters);
this.g = str;
return true;
}
}
return false;
}
}
private CameraSource() {
this.d = new Object();
this.h = 0;
this.k = 30.0f;
this.n = 1024;
this.f8013o = 768;
this.f = null;
this.g = null;
this.a = new HashMap();
this.e = new Camera.AutoFocusCallback(this) { // from class: o.eAe
private CameraSource a;
@Override // android.hardware.Camera.AutoFocusCallback
public final void onAutoFocus(boolean z, Camera camera) {
CameraSource cameraSource = this.a;
if (z) {
cameraSource.b.cancelAutoFocus();
}
}
{
this.a = this;
}
};
}
/* loaded from: classes5.dex */
static class RVV {
Size a;
Size c;
public RVV(Camera.Size size, Camera.Size size2) {
this.c = new Size(size.width, size.height);
if (size2 != null) {
this.a = new Size(size2.width, size2.height);
}
}
}
private byte[] d(Size size) {
byte[] bArr = new byte[((int) Math.ceil(((size.getHeight() * size.getWidth()) * ImageFormat.getBitsPerPixel(17)) / 8.0d)) + 1];
ByteBuffer wrap = ByteBuffer.wrap(bArr);
if (!wrap.hasArray() || wrap.array() != bArr) {
throw new IllegalStateException("Failed to create valid buffer for camera source.");
}
this.a.put(bArr, wrap);
return bArr;
}
/* loaded from: classes5.dex */
class HBt implements Camera.PreviewCallback {
private CameraSource b;
private HBt(CameraSource cameraSource) {
this.b = cameraSource;
}
@Override // android.hardware.Camera.PreviewCallback
public final void onPreviewFrame(byte[] bArr, Camera camera) {
Sts sts = this.b.j;
synchronized (sts.b) {
ByteBuffer byteBuffer = sts.e;
if (byteBuffer != null) {
camera.addCallbackBuffer(byteBuffer.array());
sts.e = null;
}
if (sts.f.a.containsKey(bArr)) {
sts.d++;
sts.e = sts.f.a.get(bArr);
sts.c = bArr;
sts.b.notifyAll();
}
}
}
/* synthetic */ HBt(CameraSource cameraSource, byte b) {
this(cameraSource);
}
}
/* loaded from: classes5.dex */
public class Sts implements Runnable {
byte[] c;
ByteBuffer e;
final CameraSource f;
private LWm i;
final Object b = new Object();
boolean a = true;
int d = 0;
public Sts(CameraSource cameraSource, LWm lWm) {
this.f = cameraSource;
this.i = lWm;
}
@Override // java.lang.Runnable
public final void run() {
boolean z;
int width;
int height;
byte[] bArr;
ByteBuffer byteBuffer;
while (true) {
synchronized (this.b) {
while (true) {
z = this.a;
if (!z || this.e != null) {
break;
}
try {
this.b.wait();
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
return;
}
}
if (!z) {
return;
}
width = this.f.i.getWidth();
height = this.f.i.getHeight();
bArr = this.c;
byteBuffer = this.e;
this.e = null;
}
this.i.b(width, height, bArr);
this.f.b.addCallbackBuffer(byteBuffer.array());
}
}
}
/* loaded from: classes5.dex */
public class CameraSourceException extends RuntimeException {
private CameraSource e;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public CameraSourceException(CameraSource cameraSource, String str) {
super(str);
this.e = cameraSource;
}
}
/* synthetic */ CameraSource(byte b) {
this();
}
}