discord-jadx/app/src/main/java/c/o/a/n/u/b.java

164 lines
7.5 KiB
Java

package c.o.a.n.u;
import android.graphics.ImageFormat;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.media.CamcorderProfile;
import android.media.MediaRecorder;
import android.util.Range;
import android.util.Rational;
import android.util.Size;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import c.o.a.c;
import c.o.a.m.e;
import c.o.a.m.f;
import c.o.a.m.h;
import c.o.a.m.j;
import c.o.a.m.m;
import c.o.a.x.a;
import java.util.HashSet;
import java.util.Objects;
/* compiled from: Camera2Options */
@RequiresApi(21)
public class b extends c {
public b(@NonNull CameraManager cameraManager, @NonNull String str, boolean z2, int i) throws CameraAccessException {
f fVar = f.OFF;
if (c.o.a.n.q.b.a == null) {
c.o.a.n.q.b.a = new c.o.a.n.q.b();
}
c.o.a.n.q.b bVar = c.o.a.n.q.b.a;
CameraCharacteristics cameraCharacteristics = cameraManager.getCameraCharacteristics(str);
for (String str2 : cameraManager.getCameraIdList()) {
Integer num = (Integer) cameraManager.getCameraCharacteristics(str2).get(CameraCharacteristics.LENS_FACING);
if (num != null) {
e eVar = (e) bVar.a(c.o.a.n.q.b.b, Integer.valueOf(num.intValue()));
if (eVar != null) {
this.b.add(eVar);
}
}
}
for (int i2 : (int[]) cameraCharacteristics.get(CameraCharacteristics.CONTROL_AWB_AVAILABLE_MODES)) {
m mVar = (m) bVar.a(c.o.a.n.q.b.f1493c, Integer.valueOf(i2));
if (mVar != null) {
this.a.add(mVar);
}
}
this.f1472c.add(fVar);
Boolean bool = (Boolean) cameraCharacteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE);
boolean z3 = true;
if (bool != null && bool.booleanValue()) {
int[] iArr = (int[]) cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES);
for (int i3 : iArr) {
Objects.requireNonNull(bVar);
HashSet hashSet = new HashSet();
if (i3 == 0 || i3 == 1) {
hashSet.add(fVar);
hashSet.add(f.TORCH);
} else {
if (i3 != 2) {
if (i3 == 3) {
hashSet.add(f.ON);
} else if (i3 != 4) {
}
}
hashSet.add(f.AUTO);
}
this.f1472c.addAll(hashSet);
}
}
this.d.add(h.OFF);
for (int i4 : (int[]) cameraCharacteristics.get(CameraCharacteristics.CONTROL_AVAILABLE_SCENE_MODES)) {
h hVar = (h) bVar.a(c.o.a.n.q.b.d, Integer.valueOf(i4));
if (hVar != null) {
this.d.add(hVar);
}
}
Float f = (Float) cameraCharacteristics.get(CameraCharacteristics.SCALER_AVAILABLE_MAX_DIGITAL_ZOOM);
if (f != null) {
this.k = f.floatValue() > 1.0f;
}
Integer num2 = (Integer) cameraCharacteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AF);
Integer num3 = (Integer) cameraCharacteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AE);
Integer num4 = (Integer) cameraCharacteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AWB);
this.o = (num2 != null && num2.intValue() > 0) || (num3 != null && num3.intValue() > 0) || (num4 != null && num4.intValue() > 0);
Range range = (Range) cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_RANGE);
Rational rational = (Rational) cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_STEP);
if (!(range == null || rational == null || rational.floatValue() == 0.0f)) {
this.m = ((float) ((Integer) range.getLower()).intValue()) / rational.floatValue();
this.n = ((float) ((Integer) range.getUpper()).intValue()) / rational.floatValue();
}
this.l = (this.m == 0.0f || this.n == 0.0f) ? false : true;
StreamConfigurationMap streamConfigurationMap = (StreamConfigurationMap) cameraCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
if (streamConfigurationMap != null) {
int[] outputFormats = streamConfigurationMap.getOutputFormats();
int length = outputFormats.length;
int i5 = 0;
while (true) {
if (i5 >= length) {
z3 = false;
break;
} else if (outputFormats[i5] == i) {
break;
} else {
i5++;
}
}
if (z3) {
Size[] outputSizes = streamConfigurationMap.getOutputSizes(i);
for (Size size : outputSizes) {
int height = z2 ? size.getHeight() : size.getWidth();
int width = z2 ? size.getWidth() : size.getHeight();
this.e.add(new c.o.a.x.b(height, width));
this.g.add(a.f(height, width));
}
CamcorderProfile b = c.o.a.r.a.b(str, new c.o.a.x.b(Integer.MAX_VALUE, Integer.MAX_VALUE));
int i6 = b.videoFrameWidth;
int i7 = b.videoFrameHeight;
Size[] outputSizes2 = streamConfigurationMap.getOutputSizes(MediaRecorder.class);
for (Size size2 : outputSizes2) {
if (size2.getWidth() <= i6 && size2.getHeight() <= i7) {
int height2 = z2 ? size2.getHeight() : size2.getWidth();
int width2 = z2 ? size2.getWidth() : size2.getHeight();
this.f.add(new c.o.a.x.b(height2, width2));
this.h.add(a.f(height2, width2));
}
}
Range[] rangeArr = (Range[]) cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);
if (rangeArr != null) {
this.p = Float.MAX_VALUE;
this.q = -3.4028235E38f;
for (Range range2 : rangeArr) {
this.p = Math.min(this.p, (float) ((Integer) range2.getLower()).intValue());
this.q = Math.max(this.q, (float) ((Integer) range2.getUpper()).intValue());
}
} else {
this.p = 0.0f;
this.q = 0.0f;
}
this.i.add(j.JPEG);
int[] iArr2 = (int[]) cameraCharacteristics.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
if (iArr2 != null) {
for (int i8 : iArr2) {
if (i8 == 3) {
this.i.add(j.DNG);
}
}
}
this.j.add(35);
int[] outputFormats2 = streamConfigurationMap.getOutputFormats();
for (int i9 : outputFormats2) {
if (ImageFormat.getBitsPerPixel(i9) > 0) {
this.j.add(Integer.valueOf(i9));
}
}
return;
}
throw new IllegalStateException(c.d.b.a.a.l("Picture format not supported: ", i));
}
throw new RuntimeException("StreamConfigurationMap is null. Should not happen.");
}
}