android.hardware.camera2.CameraCaptureSession.CaptureCallback Java Examples
The following examples show how to use
android.hardware.camera2.CameraCaptureSession.CaptureCallback.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImageMetadataSynchronizer.java From libsoftwaresync with Apache License 2.0 | 6 votes |
/** Initialize captureCallback with a function that just calls handleCaptureCompleted(). */ private void createCaptureCallback() { captureCallback = new CaptureCallback() { @Override public void onCaptureCompleted( CameraCaptureSession session, CaptureRequest request, TotalCaptureResult result) { if (closed) { return; } synchronized (ImageMetadataSynchronizer.this) { handleCaptureResultLocked(result); } } }; }
Example #2
Source File: Camera2CaptureCallbackSplitter.java From Camera2 with Apache License 2.0 | 5 votes |
/** * @param recipients The listeners to notify. Any {@code null} passed here * will be completely ignored. */ public Camera2CaptureCallbackSplitter(CaptureCallback... recipients) { for (CaptureCallback listener : recipients) { if (listener != null) { mRecipients.add(listener); } } }
Example #3
Source File: Camera2CaptureCallbackSplitter.java From Camera2 with Apache License 2.0 | 5 votes |
@Override public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request, TotalCaptureResult result) { for (CaptureCallback target : mRecipients) { target.onCaptureCompleted(session, request, result); } }
Example #4
Source File: Camera2CaptureCallbackSplitter.java From Camera2 with Apache License 2.0 | 5 votes |
@Override public void onCaptureFailed(CameraCaptureSession session, CaptureRequest request, CaptureFailure failure) { for (CaptureCallback target : mRecipients) { target.onCaptureFailed(session, request, failure); } }
Example #5
Source File: Camera2CaptureCallbackSplitter.java From Camera2 with Apache License 2.0 | 5 votes |
@Override public void onCaptureProgressed(CameraCaptureSession session, CaptureRequest request, CaptureResult partialResult) { for (CaptureCallback target : mRecipients) { target.onCaptureProgressed(session, request, partialResult); } }
Example #6
Source File: Camera2CaptureCallbackSplitter.java From Camera2 with Apache License 2.0 | 5 votes |
@Override public void onCaptureSequenceCompleted(CameraCaptureSession session, int sequenceId, long frameNumber) { for (CaptureCallback target : mRecipients) { target.onCaptureSequenceCompleted(session, sequenceId, frameNumber); } }
Example #7
Source File: Camera2CaptureCallbackSplitter.java From Camera2 with Apache License 2.0 | 5 votes |
@Override public void onCaptureStarted(CameraCaptureSession session, CaptureRequest request, long timestamp, long frameNumber) { for (CaptureCallback target : mRecipients) { target.onCaptureStarted(session, request, timestamp, frameNumber); } }
Example #8
Source File: Camera2UtilsTest.java From Camera2 with Apache License 2.0 | 5 votes |
@Test public void captureListenerSplitter() { CaptureCallback firstBackingListener = mock(CaptureCallback.class); CaptureCallback secondBackingListener = mock(CaptureCallback.class); captureListenerSplitterAllCallbacksReceived( new Camera2CaptureCallbackSplitter(firstBackingListener, secondBackingListener), firstBackingListener, secondBackingListener); }
Example #9
Source File: Camera2UtilsTest.java From Camera2 with Apache License 2.0 | 5 votes |
@Test public void captureListenerSplitterValidAndNull() { CaptureCallback onlyRealBackingListener = mock(CaptureCallback.class); captureListenerSplitterAllCallbacksReceived( new Camera2CaptureCallbackSplitter(null, onlyRealBackingListener), onlyRealBackingListener); }
Example #10
Source File: CameraController.java From libsoftwaresync with Apache License 2.0 | 4 votes |
public CaptureCallback getSynchronizerCaptureCallback() { return imageMetadataSynchronizer.getCaptureCallback(); }
Example #11
Source File: Camera2CaptureCallbackForwarder.java From Camera2 with Apache License 2.0 | 4 votes |
public Camera2CaptureCallbackForwarder(CaptureCallback listener, Handler handler) { mListener = listener; mHandler = handler; }
Example #12
Source File: Camera2CaptureCallbackSplitter.java From Camera2 with Apache License 2.0 | 4 votes |
@Override public void onCaptureSequenceAborted(CameraCaptureSession session, int sequenceId) { for (CaptureCallback target : mRecipients) { target.onCaptureSequenceAborted(session, sequenceId); } }
Example #13
Source File: Camera2UtilsTest.java From Camera2 with Apache License 2.0 | 4 votes |
@Test public void captureListenerSplitterNoNpe() { captureListenerSplitterAllCallbacksReceived( new Camera2CaptureCallbackSplitter((CaptureCallback) null)); }
Example #14
Source File: Camera2Handler.java From Augendiagnose with GNU General Public License v2.0 | 4 votes |
/** * Capture a still picture. This method should be called when we get a response in * {@link #mCaptureCallback} from both {@link #lockFocus()}. */ private void captureStillPicture() { mState = CameraState.STATE_TAKING_PICTURE; try { if (null == mActivity || null == mCameraDevice || null == mCaptureSession) { return; } // This is the CaptureRequest.Builder that we use to take a picture. final CaptureRequest.Builder captureBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE); captureBuilder.addTarget(mImageReader.getSurface()); // Use the same AE and AF modes as the preview. captureBuilder.set(CaptureRequest.CONTROL_AF_MODE, mCurrentFocusMode); captureBuilder.set(CaptureRequest.FLASH_MODE, mCurrentFlashMode); captureBuilder.set(CaptureRequest.CONTROL_AE_MODE, mCurrentAutoExposureMode); captureBuilder.set(CaptureRequest.LENS_FOCUS_DISTANCE, mMinimalFocalDistance * mCurrentRelativeFocalDistance); captureBuilder.set(CaptureRequest.SCALER_CROP_REGION, getCroppingRect(mCurrentRelativeZoom)); if (mMaximalFocalLength > 0) { captureBuilder.set(CaptureRequest.LENS_FOCAL_LENGTH, mMaximalFocalLength); } captureBuilder.set(CaptureRequest.NOISE_REDUCTION_MODE, mNoiseReductionMode); captureBuilder.set(CaptureRequest.EDGE_MODE, mEdgeMode); captureBuilder.set(CaptureRequest.LENS_OPTICAL_STABILIZATION_MODE, mOpticalStabilizationMode); mCaptureSession.stopRepeating(); mCameraCallback.onTakingPicture(); mCaptureSession.capture(captureBuilder.build(), new CaptureCallback() { @Override public void onCaptureCompleted(@NonNull final CameraCaptureSession session, @NonNull final CaptureRequest request, @NonNull final TotalCaptureResult result) { mState = CameraState.STATE_PICTURE_TAKEN; unlockFocus(); } }, null); } catch (CameraAccessException | IllegalStateException e) { mCameraCallback.onCameraError("Failed to capture picture", "cap1", e); } }
Example #15
Source File: ImageMetadataSynchronizer.java From libsoftwaresync with Apache License 2.0 | 2 votes |
/** * CaptureCallback used by camera2 to deliver TotalCaptureResult's. Either directly pass this * callback to CameraCaptureSession.capture(), or if the client receives CaptureCallbacks on a * separate path, forward the onCaptureProgressed(), onCaptureCompleted(), onCaptureFailed() etc, * here. */ public CaptureCallback getCaptureCallback() { return captureCallback; }