|
|
|
@ -139,10 +139,10 @@ public abstract class CameraEngine implements |
|
|
|
|
private static final String TAG = CameraEngine.class.getSimpleName(); |
|
|
|
|
private static final CameraLogger LOG = CameraLogger.create(TAG); |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("WeakerAccess") |
|
|
|
|
@SuppressWarnings({"WeakerAccess", "unused"}) |
|
|
|
|
public static final int STATE_STOPPING = CameraEngineStep.STATE_STOPPING; |
|
|
|
|
public static final int STATE_STOPPED = CameraEngineStep.STATE_STOPPED; |
|
|
|
|
@SuppressWarnings("WeakerAccess") |
|
|
|
|
@SuppressWarnings({"WeakerAccess", "unused"}) |
|
|
|
|
public static final int STATE_STARTING = CameraEngineStep.STATE_STARTING; |
|
|
|
|
public static final int STATE_STARTED = CameraEngineStep.STATE_STARTED; |
|
|
|
|
|
|
|
|
@ -150,48 +150,47 @@ public abstract class CameraEngine implements |
|
|
|
|
public static final int REF_VIEW = 1; |
|
|
|
|
public static final int REF_OUTPUT = 2; |
|
|
|
|
|
|
|
|
|
protected final Callback mCallback; |
|
|
|
|
private final FrameManager mFrameManager; |
|
|
|
|
protected CameraPreview mPreview; |
|
|
|
|
protected WorkerHandler mHandler; |
|
|
|
|
// Need to be protected
|
|
|
|
|
@SuppressWarnings("WeakerAccess") protected WorkerHandler mHandler; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected final Callback mCallback; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected CameraPreview mPreview; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected CameraOptions mCameraOptions; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected Mapper mMapper; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected PictureRecorder mPictureRecorder; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected VideoRecorder mVideoRecorder; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected Size mCaptureSize; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected Size mPreviewStreamSize; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected Facing mFacing; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected Flash mFlash; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected WhiteBalance mWhiteBalance; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected VideoCodec mVideoCodec; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected Hdr mHdr; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected Location mLocation; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected float mZoomValue; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected float mExposureCorrectionValue; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected boolean mPlaySounds; |
|
|
|
|
@SuppressWarnings("WeakerAccess") protected int mSensorOffset; |
|
|
|
|
|
|
|
|
|
// Can be private
|
|
|
|
|
@VisibleForTesting Handler mCrashHandler; |
|
|
|
|
|
|
|
|
|
protected Facing mFacing; |
|
|
|
|
protected Flash mFlash; |
|
|
|
|
protected WhiteBalance mWhiteBalance; |
|
|
|
|
protected VideoCodec mVideoCodec; |
|
|
|
|
protected Mode mMode; |
|
|
|
|
protected Hdr mHdr; |
|
|
|
|
protected Location mLocation; |
|
|
|
|
protected Audio mAudio; |
|
|
|
|
protected float mZoomValue; |
|
|
|
|
protected float mExposureCorrectionValue; |
|
|
|
|
protected boolean mPlaySounds; |
|
|
|
|
protected boolean mHasFrameProcessors; |
|
|
|
|
|
|
|
|
|
private final FrameManager mFrameManager; |
|
|
|
|
@Nullable private SizeSelector mPreviewStreamSizeSelector; |
|
|
|
|
private SizeSelector mPictureSizeSelector; |
|
|
|
|
private SizeSelector mVideoSizeSelector; |
|
|
|
|
|
|
|
|
|
@VisibleForTesting int mSnapshotMaxWidth = Integer.MAX_VALUE; // in REF_VIEW for consistency with SizeSelectors
|
|
|
|
|
@VisibleForTesting int mSnapshotMaxHeight = Integer.MAX_VALUE; // in REF_VIEW for consistency with SizeSelectors
|
|
|
|
|
|
|
|
|
|
protected CameraOptions mCameraOptions; |
|
|
|
|
protected Mapper mMapper; |
|
|
|
|
protected PictureRecorder mPictureRecorder; |
|
|
|
|
protected VideoRecorder mVideoRecorder; |
|
|
|
|
protected long mVideoMaxSize; |
|
|
|
|
protected int mVideoMaxDuration; |
|
|
|
|
protected int mVideoBitRate; |
|
|
|
|
protected int mAudioBitRate; |
|
|
|
|
protected Size mCaptureSize; |
|
|
|
|
protected Size mPreviewStreamSize; |
|
|
|
|
protected long mAutoFocusResetDelayMillis; |
|
|
|
|
|
|
|
|
|
protected int mSensorOffset; |
|
|
|
|
protected int mDisplayOffset; |
|
|
|
|
protected int mDeviceOrientation; |
|
|
|
|
|
|
|
|
|
private Mode mMode; |
|
|
|
|
private Audio mAudio; |
|
|
|
|
private long mVideoMaxSize; |
|
|
|
|
private int mVideoMaxDuration; |
|
|
|
|
private int mVideoBitRate; |
|
|
|
|
private int mAudioBitRate; |
|
|
|
|
private boolean mHasFrameProcessors; |
|
|
|
|
private long mAutoFocusResetDelayMillis; |
|
|
|
|
private int mSnapshotMaxWidth = Integer.MAX_VALUE; // in REF_VIEW for consistency with SizeSelectors
|
|
|
|
|
private int mSnapshotMaxHeight = Integer.MAX_VALUE; // in REF_VIEW for consistency with SizeSelectors
|
|
|
|
|
private int mDisplayOffset; |
|
|
|
|
private int mDeviceOrientation; |
|
|
|
|
|
|
|
|
|
// Steps
|
|
|
|
|
private final CameraEngineStep.Callback mStepCallback = new CameraEngineStep.Callback() { |
|
|
|
|
@Override @NonNull public Executor getExecutor() { return mHandler.getExecutor(); } |
|
|
|
|
@Override public void handleException(@NonNull Exception exception) { |
|
|
|
@ -203,24 +202,17 @@ public abstract class CameraEngine implements |
|
|
|
|
private CameraEngineStep mPreviewStep = new CameraEngineStep("preview", mStepCallback); |
|
|
|
|
private CameraEngineStep mAllStep = new CameraEngineStep("all", mStepCallback); |
|
|
|
|
|
|
|
|
|
// Used for testing.
|
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) |
|
|
|
|
Op<Void> mZoomOp = new Op<>(); |
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) |
|
|
|
|
Op<Void> mExposureCorrectionOp = new Op<>(); |
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) |
|
|
|
|
Op<Void> mFlashOp = new Op<>(); |
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) |
|
|
|
|
Op<Void> mWhiteBalanceOp = new Op<>(); |
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) |
|
|
|
|
Op<Void> mHdrOp = new Op<>(); |
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) |
|
|
|
|
Op<Void> mLocationOp = new Op<>(); |
|
|
|
|
// Ops used for testing.
|
|
|
|
|
@VisibleForTesting Op<Void> mStartVideoOp = new Op<>(); |
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) |
|
|
|
|
Op<Void> mPlaySoundsOp = new Op<>(); |
|
|
|
|
|
|
|
|
|
protected CameraEngine(Callback callback) { |
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) Op<Void> mZoomOp = new Op<>(); |
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) Op<Void> mExposureCorrectionOp = new Op<>(); |
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) Op<Void> mFlashOp = new Op<>(); |
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) Op<Void> mWhiteBalanceOp = new Op<>(); |
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) Op<Void> mHdrOp = new Op<>(); |
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) Op<Void> mLocationOp = new Op<>(); |
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) Op<Void> mPlaySoundsOp = new Op<>(); |
|
|
|
|
|
|
|
|
|
protected CameraEngine(@NonNull Callback callback) { |
|
|
|
|
mCallback = callback; |
|
|
|
|
mCrashHandler = new Handler(Looper.getMainLooper()); |
|
|
|
|
mHandler = WorkerHandler.get("CameraViewEngine"); |
|
|
|
@ -320,7 +312,7 @@ public abstract class CameraEngine implements |
|
|
|
|
return mBindStep.getState(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unused") |
|
|
|
|
@SuppressWarnings({"unused", "WeakerAccess"}) |
|
|
|
|
public final int getPreviewState() { |
|
|
|
|
return mPreviewStep.getState(); |
|
|
|
|
} |
|
|
|
@ -674,6 +666,7 @@ public abstract class CameraEngine implements |
|
|
|
|
try { |
|
|
|
|
boolean success = latch.await(3, TimeUnit.SECONDS); |
|
|
|
|
if (!success) { |
|
|
|
|
// TODO seems like this is always the case?
|
|
|
|
|
LOG.e("Probably some deadlock in destroy.", |
|
|
|
|
"Current thread:", Thread.currentThread(), |
|
|
|
|
"Handler thread: ", mHandler.getThread()); |
|
|
|
@ -790,13 +783,18 @@ public abstract class CameraEngine implements |
|
|
|
|
|
|
|
|
|
//endregion
|
|
|
|
|
|
|
|
|
|
//region final setters
|
|
|
|
|
//region Final setters and getters
|
|
|
|
|
|
|
|
|
|
// This is called before start() and never again.
|
|
|
|
|
public final void setDisplayOffset(int displayOffset) { |
|
|
|
|
mDisplayOffset = displayOffset; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("WeakerAccess") |
|
|
|
|
public final int getDisplayOffset() { |
|
|
|
|
return mDisplayOffset; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// This can be called multiple times.
|
|
|
|
|
public final void setDeviceOrientation(int deviceOrientation) { |
|
|
|
|
mDeviceOrientation = deviceOrientation; |
|
|
|
@ -806,44 +804,89 @@ public abstract class CameraEngine implements |
|
|
|
|
mPreviewStreamSizeSelector = selector; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
|
public final SizeSelector getPreviewStreamSizeSelector() { |
|
|
|
|
return mPreviewStreamSizeSelector; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final void setPictureSizeSelector(@NonNull SizeSelector selector) { |
|
|
|
|
mPictureSizeSelector = selector; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final SizeSelector getPictureSizeSelector() { |
|
|
|
|
return mPictureSizeSelector; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final void setVideoSizeSelector(@NonNull SizeSelector selector) { |
|
|
|
|
mVideoSizeSelector = selector; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final SizeSelector getVideoSizeSelector() { |
|
|
|
|
return mVideoSizeSelector; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final void setVideoMaxSize(long videoMaxSizeBytes) { |
|
|
|
|
mVideoMaxSize = videoMaxSizeBytes; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final long getVideoMaxSize() { |
|
|
|
|
return mVideoMaxSize; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final void setVideoMaxDuration(int videoMaxDurationMillis) { |
|
|
|
|
mVideoMaxDuration = videoMaxDurationMillis; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final int getVideoMaxDuration() { |
|
|
|
|
return mVideoMaxDuration; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final void setVideoCodec(@NonNull VideoCodec codec) { |
|
|
|
|
mVideoCodec = codec; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final VideoCodec getVideoCodec() { |
|
|
|
|
return mVideoCodec; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final void setVideoBitRate(int videoBitRate) { |
|
|
|
|
mVideoBitRate = videoBitRate; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final int getVideoBitRate() { |
|
|
|
|
return mVideoBitRate; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final void setAudioBitRate(int audioBitRate) { |
|
|
|
|
mAudioBitRate = audioBitRate; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final int getAudioBitRate() { |
|
|
|
|
return mAudioBitRate; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final void setSnapshotMaxWidth(int maxWidth) { |
|
|
|
|
mSnapshotMaxWidth = maxWidth; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public int getSnapshotMaxWidth() { |
|
|
|
|
return mSnapshotMaxWidth; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final void setSnapshotMaxHeight(int maxHeight) { |
|
|
|
|
mSnapshotMaxHeight = maxHeight; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public int getSnapshotMaxHeight() { |
|
|
|
|
return mSnapshotMaxHeight; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final void setAutoFocusResetDelay(long delayMillis) { mAutoFocusResetDelayMillis = delayMillis; } |
|
|
|
|
|
|
|
|
|
public final long getAutoFocusResetDelay() { return mAutoFocusResetDelayMillis; } |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Sets a new facing value. This will restart the session (if there's any) |
|
|
|
|
* so that we can open the new facing camera. |
|
|
|
@ -867,6 +910,11 @@ public abstract class CameraEngine implements |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final Facing getFacing() { |
|
|
|
|
return mFacing; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Sets a new audio value that will be used for video recordings. |
|
|
|
|
* @param audio desired audio |
|
|
|
@ -881,6 +929,11 @@ public abstract class CameraEngine implements |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final Audio getAudio() { |
|
|
|
|
return mAudio; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Sets the desired mode (either picture or video). |
|
|
|
|
* @param mode desired mode. |
|
|
|
@ -899,6 +952,64 @@ public abstract class CameraEngine implements |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final Mode getMode() { |
|
|
|
|
return mMode; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final FrameManager getFrameManager() { |
|
|
|
|
return mFrameManager; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
|
public final CameraOptions getCameraOptions() { |
|
|
|
|
return mCameraOptions; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final Flash getFlash() { |
|
|
|
|
return mFlash; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final WhiteBalance getWhiteBalance() { |
|
|
|
|
return mWhiteBalance; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final Hdr getHdr() { |
|
|
|
|
return mHdr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
|
public final Location getLocation() { |
|
|
|
|
return mLocation; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final float getZoomValue() { |
|
|
|
|
return mZoomValue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final float getExposureCorrectionValue() { |
|
|
|
|
return mExposureCorrectionValue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@CallSuper |
|
|
|
|
public void setHasFrameProcessors(boolean hasFrameProcessors) { |
|
|
|
|
mHasFrameProcessors = hasFrameProcessors; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("WeakerAccess") |
|
|
|
|
public final boolean hasFrameProcessors() { |
|
|
|
|
return mHasFrameProcessors; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("WeakerAccess") |
|
|
|
|
protected final boolean shouldResetAutoFocus() { |
|
|
|
|
return mAutoFocusResetDelayMillis > 0 && mAutoFocusResetDelayMillis != Long.MAX_VALUE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//endregion
|
|
|
|
|
|
|
|
|
|
//region Abstract setters and APIs
|
|
|
|
@ -945,12 +1056,14 @@ public abstract class CameraEngine implements |
|
|
|
|
|
|
|
|
|
public abstract void setPlaySounds(boolean playSounds); |
|
|
|
|
|
|
|
|
|
public abstract void setHasFrameProcessors(boolean hasFrameProcessors); |
|
|
|
|
|
|
|
|
|
//endregion
|
|
|
|
|
|
|
|
|
|
//region picture and video control
|
|
|
|
|
|
|
|
|
|
public final boolean isTakingPicture() { |
|
|
|
|
return mPictureRecorder != null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* not final for tests */ |
|
|
|
|
public void takePicture(final @NonNull PictureResult.Stub stub) { |
|
|
|
|
LOG.v("takePicture", "scheduling"); |
|
|
|
@ -970,7 +1083,7 @@ public abstract class CameraEngine implements |
|
|
|
|
onTakePicture(stub); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* The snapshot size is the {@link #getPreviewStreamSize(int)}, but cropped based on the |
|
|
|
@ -1014,6 +1127,10 @@ public abstract class CameraEngine implements |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final boolean isTakingVideo() { |
|
|
|
|
return mVideoRecorder != null && mVideoRecorder.isRecording(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final void takeVideo(final @NonNull VideoResult.Stub stub, final @NonNull File file) { |
|
|
|
|
LOG.v("takeVideo", "scheduling"); |
|
|
|
|
mHandler.run(new Runnable() { |
|
|
|
@ -1110,120 +1227,6 @@ public abstract class CameraEngine implements |
|
|
|
|
|
|
|
|
|
//endregion
|
|
|
|
|
|
|
|
|
|
//region final getters
|
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final FrameManager getFrameManager() { |
|
|
|
|
return mFrameManager; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
|
public final CameraOptions getCameraOptions() { |
|
|
|
|
return mCameraOptions; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final Facing getFacing() { |
|
|
|
|
return mFacing; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final Flash getFlash() { |
|
|
|
|
return mFlash; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final WhiteBalance getWhiteBalance() { |
|
|
|
|
return mWhiteBalance; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final VideoCodec getVideoCodec() { |
|
|
|
|
return mVideoCodec; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final int getVideoBitRate() { |
|
|
|
|
return mVideoBitRate; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final long getVideoMaxSize() { |
|
|
|
|
return mVideoMaxSize; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final int getVideoMaxDuration() { |
|
|
|
|
return mVideoMaxDuration; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final Mode getMode() { |
|
|
|
|
return mMode; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final Hdr getHdr() { |
|
|
|
|
return mHdr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
|
public final Location getLocation() { |
|
|
|
|
return mLocation; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NonNull |
|
|
|
|
public final Audio getAudio() { |
|
|
|
|
return mAudio; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final int getAudioBitRate() { |
|
|
|
|
return mAudioBitRate; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unused") |
|
|
|
|
@Nullable |
|
|
|
|
@VisibleForTesting |
|
|
|
|
final SizeSelector getPreviewStreamSizeSelector() { |
|
|
|
|
return mPreviewStreamSizeSelector; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unused") |
|
|
|
|
@NonNull |
|
|
|
|
public final SizeSelector getPictureSizeSelector() { |
|
|
|
|
return mPictureSizeSelector; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unused") |
|
|
|
|
@NonNull |
|
|
|
|
public final SizeSelector getVideoSizeSelector() { |
|
|
|
|
return mVideoSizeSelector; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final float getZoomValue() { |
|
|
|
|
return mZoomValue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final float getExposureCorrectionValue() { |
|
|
|
|
return mExposureCorrectionValue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final boolean isTakingVideo() { |
|
|
|
|
return mVideoRecorder != null && mVideoRecorder.isRecording(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final boolean isTakingPicture() { |
|
|
|
|
return mPictureRecorder != null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public final long getAutoFocusResetDelay() { return mAutoFocusResetDelayMillis; } |
|
|
|
|
|
|
|
|
|
public boolean getHasFrameProcessors() { |
|
|
|
|
return mHasFrameProcessors; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//endregion
|
|
|
|
|
|
|
|
|
|
final boolean shouldResetAutoFocus() { |
|
|
|
|
return mAutoFocusResetDelayMillis > 0 && mAutoFocusResetDelayMillis != Long.MAX_VALUE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//region Orientation utils
|
|
|
|
|
|
|
|
|
|
private int computeSensorToViewOffset() { |
|
|
|
|