107 lines
3.3 KiB
Java
107 lines
3.3 KiB
Java
package c.o.a.v;
|
|
|
|
import android.hardware.Camera;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.exifinterface.media.ExifInterface;
|
|
import c.o.a.l;
|
|
import c.o.a.n.v.e;
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.IOException;
|
|
/* compiled from: Full1PictureRecorder */
|
|
public class a extends c {
|
|
public final Camera m;
|
|
public final c.o.a.n.b n;
|
|
|
|
/* compiled from: Full1PictureRecorder */
|
|
/* renamed from: c.o.a.v.a$a reason: collision with other inner class name */
|
|
public class C0168a implements Camera.ShutterCallback {
|
|
public C0168a() {
|
|
}
|
|
|
|
@Override // android.hardware.Camera.ShutterCallback
|
|
public void onShutter() {
|
|
c.l.a(1, "take(): got onShutter callback.");
|
|
a.this.a(true);
|
|
}
|
|
}
|
|
|
|
/* compiled from: Full1PictureRecorder */
|
|
public class b implements Camera.PictureCallback {
|
|
public b() {
|
|
}
|
|
|
|
@Override // android.hardware.Camera.PictureCallback
|
|
public void onPictureTaken(byte[] bArr, Camera camera) {
|
|
int i;
|
|
c.l.a(1, "take(): got picture callback.");
|
|
try {
|
|
switch (new ExifInterface(new ByteArrayInputStream(bArr)).getAttributeInt("Orientation", 1)) {
|
|
case 3:
|
|
case 4:
|
|
i = 180;
|
|
break;
|
|
case 5:
|
|
case 6:
|
|
i = 90;
|
|
break;
|
|
case 7:
|
|
case 8:
|
|
i = 270;
|
|
break;
|
|
default:
|
|
i = 0;
|
|
break;
|
|
}
|
|
} catch (IOException unused) {
|
|
}
|
|
l.a aVar = a.this.i;
|
|
aVar.f = bArr;
|
|
aVar.f1473c = i;
|
|
c.l.a(1, "take(): starting preview again. ", Thread.currentThread());
|
|
if (a.this.n.m.f.f(e.PREVIEW)) {
|
|
camera.setPreviewCallbackWithBuffer(a.this.n);
|
|
c.o.a.x.b C = a.this.n.C(c.o.a.n.t.b.SENSOR);
|
|
if (C != null) {
|
|
c.o.a.p.a l1 = a.this.n.l1();
|
|
c.o.a.n.b bVar = a.this.n;
|
|
l1.e(bVar.t, C, bVar.K);
|
|
camera.startPreview();
|
|
} else {
|
|
throw new IllegalStateException("Preview stream size should never be null here.");
|
|
}
|
|
}
|
|
a.this.b();
|
|
}
|
|
}
|
|
|
|
public a(@NonNull l.a aVar, @NonNull c.o.a.n.b bVar, @NonNull Camera camera) {
|
|
super(aVar, bVar);
|
|
this.n = bVar;
|
|
this.m = camera;
|
|
Camera.Parameters parameters = camera.getParameters();
|
|
parameters.setRotation(this.i.f1473c);
|
|
camera.setParameters(parameters);
|
|
}
|
|
|
|
@Override // c.o.a.v.d
|
|
public void b() {
|
|
c.l.a(1, "dispatching result. Thread:", Thread.currentThread());
|
|
super.b();
|
|
}
|
|
|
|
@Override // c.o.a.v.d
|
|
public void c() {
|
|
c.o.a.b bVar = c.l;
|
|
bVar.a(1, "take() called.");
|
|
this.m.setPreviewCallbackWithBuffer(null);
|
|
this.n.l1().d();
|
|
try {
|
|
this.m.takePicture(new C0168a(), null, null, new b());
|
|
bVar.a(1, "take() returned.");
|
|
} catch (Exception e) {
|
|
this.k = e;
|
|
b();
|
|
}
|
|
}
|
|
}
|