mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-12-01 10:13:24 +01:00
62 lines
3.2 KiB
Java
62 lines
3.2 KiB
Java
package androidx.camera.camera2.internal;
|
|
|
|
import android.hardware.camera2.CameraCaptureSession;
|
|
import android.hardware.camera2.CaptureFailure;
|
|
import android.hardware.camera2.CaptureRequest;
|
|
import android.hardware.camera2.TotalCaptureResult;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.camera.core.impl.CameraCaptureCallback;
|
|
import androidx.camera.core.impl.CameraCaptureFailure;
|
|
import androidx.camera.core.impl.CaptureConfig;
|
|
import androidx.camera.core.impl.TagBundle;
|
|
import androidx.core.util.Preconditions;
|
|
import rx.Single$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes.dex */
|
|
final class CaptureCallbackAdapter extends CameraCaptureSession.CaptureCallback {
|
|
private final CameraCaptureCallback mCameraCaptureCallback;
|
|
|
|
public CaptureCallbackAdapter(CameraCaptureCallback cameraCaptureCallback) {
|
|
if (cameraCaptureCallback != null) {
|
|
this.mCameraCaptureCallback = cameraCaptureCallback;
|
|
} else {
|
|
Single$$ExternalSyntheticBUOutline0.m$1("cameraCaptureCallback is null");
|
|
throw null;
|
|
}
|
|
}
|
|
|
|
private int getCaptureConfigId(CaptureRequest captureRequest) {
|
|
Integer num;
|
|
if ((captureRequest.getTag() instanceof TagBundle) && (num = (Integer) ((TagBundle) captureRequest.getTag()).getTag(CaptureConfig.CAPTURE_CONFIG_ID_TAG_KEY)) != null) {
|
|
return num.intValue();
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
@Override // android.hardware.camera2.CameraCaptureSession.CaptureCallback
|
|
public void onCaptureCompleted(@NonNull CameraCaptureSession cameraCaptureSession, @NonNull CaptureRequest captureRequest, @NonNull TotalCaptureResult totalCaptureResult) {
|
|
TagBundle emptyBundle;
|
|
super.onCaptureCompleted(cameraCaptureSession, captureRequest, totalCaptureResult);
|
|
Object tag = captureRequest.getTag();
|
|
if (tag != null) {
|
|
Preconditions.checkArgument(tag instanceof TagBundle, "The tagBundle object from the CaptureResult is not a TagBundle object.");
|
|
emptyBundle = (TagBundle) tag;
|
|
} else {
|
|
emptyBundle = TagBundle.emptyBundle();
|
|
}
|
|
this.mCameraCaptureCallback.onCaptureCompleted(getCaptureConfigId(captureRequest), new Camera2CameraCaptureResult(emptyBundle, totalCaptureResult));
|
|
}
|
|
|
|
@Override // android.hardware.camera2.CameraCaptureSession.CaptureCallback
|
|
public void onCaptureFailed(@NonNull CameraCaptureSession cameraCaptureSession, @NonNull CaptureRequest captureRequest, @NonNull CaptureFailure captureFailure) {
|
|
super.onCaptureFailed(cameraCaptureSession, captureRequest, captureFailure);
|
|
this.mCameraCaptureCallback.onCaptureFailed(getCaptureConfigId(captureRequest), new CameraCaptureFailure(CameraCaptureFailure.Reason.ERROR));
|
|
}
|
|
|
|
@Override // android.hardware.camera2.CameraCaptureSession.CaptureCallback
|
|
public void onCaptureStarted(@NonNull CameraCaptureSession cameraCaptureSession, @NonNull CaptureRequest captureRequest, long j, long j2) {
|
|
super.onCaptureStarted(cameraCaptureSession, captureRequest, j, j2);
|
|
this.mCameraCaptureCallback.onCaptureStarted(getCaptureConfigId(captureRequest));
|
|
}
|
|
}
|