78 lines
1.7 KiB
Java
78 lines
1.7 KiB
Java
package com.bottle.hp.album.capture.camera;
|
|
|
|
import android.hardware.Camera;
|
|
import android.view.SurfaceHolder;
|
|
import java.io.IOException;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class NativeCamera {
|
|
private Camera a = null;
|
|
private Camera.Parameters b = null;
|
|
|
|
private int i() {
|
|
int numberOfCameras = Camera.getNumberOfCameras();
|
|
for (int i = 0; i < numberOfCameras; i++) {
|
|
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
|
|
Camera.getCameraInfo(i, cameraInfo);
|
|
if (cameraInfo.facing == 0) {
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
public void a(int i) throws RuntimeException {
|
|
this.a = Camera.open(i);
|
|
}
|
|
|
|
public void b(int i) {
|
|
this.a.setDisplayOrientation(i);
|
|
}
|
|
|
|
public Camera c() {
|
|
return this.a;
|
|
}
|
|
|
|
public Camera.Parameters d() {
|
|
if (this.b == null) {
|
|
this.b = this.a.getParameters();
|
|
}
|
|
return this.b;
|
|
}
|
|
|
|
public void e() {
|
|
this.a.release();
|
|
}
|
|
|
|
public void f() {
|
|
this.a.startPreview();
|
|
}
|
|
|
|
public void g() {
|
|
this.a.stopPreview();
|
|
}
|
|
|
|
public void h() {
|
|
this.a.unlock();
|
|
}
|
|
|
|
public void a(SurfaceHolder surfaceHolder) throws IOException {
|
|
this.a.setPreviewDisplay(surfaceHolder);
|
|
}
|
|
|
|
public int b() {
|
|
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
|
|
Camera.getCameraInfo(i(), cameraInfo);
|
|
return cameraInfo.orientation;
|
|
}
|
|
|
|
public void a() {
|
|
this.a.setPreviewCallback(null);
|
|
}
|
|
|
|
public void a(Camera.Parameters parameters) {
|
|
this.b = parameters;
|
|
this.a.setParameters(parameters);
|
|
}
|
|
}
|