Java 类android.hardware.camera2.CameraCaptureSession 实例源码

项目:android-robocar    文件:CaptureCallback.java   
@Override
public void onCaptureFailed(@NonNull CameraCaptureSession session,
                            @NonNull CaptureRequest request,
                            @NonNull CaptureFailure failure) {
  super.onCaptureFailed(session, request, failure);
  this.session = null;
  switch (failure.getReason()) {
    case CaptureFailure.REASON_ERROR:
      Timber.e("Capture failed: REASON_ERROR");
      break;
    case CaptureFailure.REASON_FLUSHED:
      Timber.e("Capture failed: REASON_FLUSHED");
      break;
    default:
      Timber.e("Capture failed: UNKNOWN");
      break;
  }
}
项目:hella-renderscript    文件:CameraOps.java   
/**
 * Set a repeating burst request.
 */
public void setRepeatingBurst(final List<CaptureRequest> requests,
        final CameraCaptureSession.CaptureCallback listener, final Handler handler) {
    mCameraHandler.post(() -> {
        try {
            mCameraSession.setRepeatingBurst(requests, listener, handler);
        } catch (CameraAccessException e) {
            String errorMessage = mErrorDisplayer.getErrorString(e);
            mErrorDisplayer.showErrorDialog(errorMessage);
        }
    });
}
项目:Camera2Vision    文件:Camera2Source.java   
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, @NonNull TotalCaptureResult result) {
    if(request.getTag() == ("FOCUS_TAG")) {
        //The focus trigger is complete!
        //Resume repeating request, clear AF trigger.
        mAutoFocusCallback.onAutoFocus(true);
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, null);
        mPreviewRequestBuilder.setTag("");
        mPreviewRequest = mPreviewRequestBuilder.build();
        try {
            mCaptureSession.setRepeatingRequest(mPreviewRequest, mCaptureCallback, mBackgroundHandler);
        } catch(CameraAccessException ex) {
            Log.d(TAG, "AUTO FOCUS FAILURE: "+ex);
        }
    } else {
        process(result);
    }
}
项目:BWS-Android    文件:CameraHelper.java   
/**
 * does setup the repeating capture request for taking images for the preview
 */
@VisibleForTesting
void setupCaptureRequestForPreview(@NonNull CameraCaptureSession previewSession, @NonNull CameraDevice camera,
                                   @NonNull List<Surface> surfaces) {
    try {
        CaptureRequest.Builder previewRequestBuilder = camera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
        for (Surface surface : surfaces) {
            previewRequestBuilder.addTarget(surface);
        }
        previewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);

        previewSession.setRepeatingRequest(previewRequestBuilder.build(), null, null);

    } catch (CameraAccessException | IllegalStateException e) {
        throw new CameraException(e);
    }
}
项目:BWS-Android    文件:FacialRecognitionFragment.java   
/**
 * connects a new camera preview session to the UI
 */
private void connectPreview() {
    try {
        setupPreviewSizeAndImageReader();
        cameraHelper.startCameraPreview(openCamera, binding.preview, previewSize, getDeviceOrientation(),
                getRelativeDisplayRotation(), imageReader, new Consumer<CameraCaptureSession>() {
                    @Override
                    public void accept(CameraCaptureSession cameraCaptureSession) {
                        openPreviewSession = cameraCaptureSession;
                    }
                });
    } catch (CameraException e) {
        cleanup();
        logErrorAndFinish("connectPreview failed: %s", e.getMessage());
    }
}
项目:CameraFragment    文件:Camera2Manager.java   
private void updatePreview(CameraCaptureSession cameraCaptureSession) {
    if (null == cameraDevice) {
        return;
    }
    captureSession = cameraCaptureSession;

    setFlashModeAndBuildPreviewRequest(configurationProvider.getFlashMode());
}
项目:CameraFragment    文件:Camera2Manager.java   
private void captureStillPicture() {
    try {
        if (null == cameraDevice) {
            return;
        }
        final CaptureRequest.Builder captureBuilder =
                cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
        captureBuilder.addTarget(imageReader.getSurface());

        captureBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
        captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getPhotoOrientation(configurationProvider.getSensorPosition()));

        CameraCaptureSession.CaptureCallback CaptureCallback = new CameraCaptureSession.CaptureCallback() {
            @Override
            public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                           @NonNull CaptureRequest request,
                                           @NonNull TotalCaptureResult result) {
                Log.d(TAG, "onCaptureCompleted: ");
            }
        };

        captureSession.stopRepeating();
        captureSession.capture(captureBuilder.build(), CaptureCallback, null);

    } catch (CameraAccessException e) {
        Log.e(TAG, "Error during capturing picture");
    }
}
项目:SIGHT-For-the-Blind    文件:CameraHandler.java   
@Override
public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {
    // The camera is already closed
    if (mCameraDevice == null) {
        return;
    }
    // When the session is ready, we start capture.
    mCaptureSession = cameraCaptureSession;
    triggerImageCapture();
}
项目:android-camera2-secret-picture-taker    文件:PictureCapturingServiceImpl.java   
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request,
                               @NonNull TotalCaptureResult result) {
    super.onCaptureCompleted(session, request, result);
    if (picturesTaken.lastEntry() != null) {
        capturingListener.onCaptureDone(picturesTaken.lastEntry().getKey(), picturesTaken.lastEntry().getValue());
        Log.i(TAG, "done taking picture from camera " + cameraDevice.getId());
    }
    closeCamera();
}
项目:SIGHT-For-the-Blind    文件:CameraHandler.java   
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                               @NonNull CaptureRequest request,
                               @NonNull TotalCaptureResult result) {
    session.close();
    mCaptureSession = null;
    Log.d(TAG, "CaptureSession closed");
}
项目:Android-Code-Demos    文件:Camera2BasicFragment.java   
/**
 * Capture a still picture. This method should be called when we get a response in
 * {@link #mCaptureCallback} from both {@link #lockFocus()}.
 */
private void captureStillPicture() {
    try {
        final Activity activity = getActivity();
        if (null == activity || null == mCameraDevice) {
            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,
                CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
        setAutoFlash(captureBuilder);

        // Orientation
        int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
        captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(rotation));

        CameraCaptureSession.CaptureCallback CaptureCallback
                = new CameraCaptureSession.CaptureCallback() {

            @Override
            public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                           @NonNull CaptureRequest request,
                                           @NonNull TotalCaptureResult result) {
                showToast("Saved: " + mFile);
                Log.d(TAG, mFile.toString());
                unlockFocus();
            }
        };

        mCaptureSession.stopRepeating();
        mCaptureSession.capture(captureBuilder.build(), CaptureCallback, null);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
项目:Android-Code-Demos    文件:MyCamera2Fragment.java   
@Override
public void onConfigured(CameraCaptureSession session) {
    Log.d(TAG, "mSessionPreviewStateCallback onConfigured");
    mSession = session;
    try {
        mPreviewBuilder.set(CaptureRequest.CONTROL_AF_MODE,
                CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
        mPreviewBuilder.set(CaptureRequest.CONTROL_AE_MODE,
                CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
        session.setRepeatingRequest(mPreviewBuilder.build(), mSessionCaptureCallback, mHandler);
    } catch (CameraAccessException e) {
        e.printStackTrace();
        Log.e(TAG, "set preview builder failed." + e.getMessage());
    }
}
项目:Android-Code-Demos    文件:MyCamera2Fragment.java   
@Override
public void onCaptureProgressed(CameraCaptureSession session, CaptureRequest request,
                                CaptureResult partialResult) {
    Log.d(TAG, "mSessionCaptureCallback,  onCaptureProgressed");
    mSession = session;
    checkState(partialResult);
}
项目:CameraKitView    文件:Camera2Fragment.java   
/**
     * Capture a still picture. This method should be called when we get a response in
     * {@link #mCaptureCallback} from both {@link #lockFocus()}.
     */
    private void captureStillPicture() {
        try {
            removeCaptureMessage();
            final Activity activity = getActivity();
            if (null == activity || null == mCameraDevice) {
                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,
//                CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
//            updateAutoFocus();
            updateFlash(captureBuilder);

            // Orientation
            int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
            captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(rotation));

            CameraCaptureSession.CaptureCallback CaptureCallback
                = new CameraCaptureSession.CaptureCallback() {

                @Override
                public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                               @NonNull CaptureRequest request,
                                               @NonNull TotalCaptureResult result) {
                    unlockFocus();
                }
            };

            mPreviewSession.stopRepeating();
            mPreviewSession.capture(captureBuilder.build(), CaptureCallback, mBackgroundHandler);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }
项目:android-robocar    文件:CaptureCallback.java   
@Override
public void onCaptureStarted(@NonNull CameraCaptureSession session,
                             @NonNull CaptureRequest request, long timestamp, long frameNumber) {
  super.onCaptureStarted(session, request, timestamp, frameNumber);
  Timber.d("Capture started.");
  this.session = session;
}
项目:hella-renderscript    文件:CameraOps.java   
/**
 * Set a repeating request.
 */
public void setRepeatingRequest(final CaptureRequest request,
        final CameraCaptureSession.CaptureCallback listener, final Handler handler) {
    mCameraHandler.post(() -> {
        try {
            mCameraSession.setRepeatingRequest(request, listener, handler);
        } catch (CameraAccessException e) {
            String errorMessage = mErrorDisplayer.getErrorString(e);
            mErrorDisplayer.showErrorDialog(errorMessage);
        }
    });
}
项目:hella-renderscript    文件:CameraOps.java   
@Override
public void onConfigured(CameraCaptureSession session) {
    mCameraSession = session;
    mReadyHandler.post(() -> {
        // This can happen when the screen is turned off and turned back on.
        if (null == mCameraDevice) {
            return;
        }

        mReadyListener.onCameraReady();
    });

}
项目:androidthings-imageclassifier    文件:CameraHandler.java   
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                               @NonNull CaptureRequest request,
                               @NonNull TotalCaptureResult result) {
    session.close();
    mCaptureSession = null;
    Log.d(TAG, "CaptureSession closed");
}
项目:androidthings-imageclassifier    文件:CameraHandler.java   
@Override
public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {
    // The camera is already closed
    if (mCameraDevice == null) {
        return;
    }
    // When the session is ready, we start capture.
    mCaptureSession = cameraCaptureSession;
    triggerImageCapture();
}
项目:androidthings-imageclassifier    文件:CameraHandler.java   
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                               @NonNull CaptureRequest request,
                               @NonNull TotalCaptureResult result) {
    session.close();
    mCaptureSession = null;
    Log.d(TAG, "CaptureSession closed");
}
项目:androidthings-imageclassifier    文件:CameraHandler.java   
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                               @NonNull CaptureRequest request,
                               @NonNull TotalCaptureResult result) {
    session.close();
    mCaptureSession = null;
    Log.d(TAG, "CaptureSession closed");
}
项目:JinsMemeBRIDGE-Android    文件:Camera2BasicFragment.java   
/**
 * Capture a still picture. This method should be called when we get a response in
 * {@link #mCaptureCallback} from both {@link #lockFocus()}.
 */
private void captureStillPicture() {
    try {
        final Activity activity = getActivity();
        if (null == activity || null == mCameraDevice) {
            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,
                CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
        setAutoFlash(captureBuilder);

        // Orientation
        int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
        captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(rotation));

        CameraCaptureSession.CaptureCallback CaptureCallback
                = new CameraCaptureSession.CaptureCallback() {

            @Override
            public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                           @NonNull CaptureRequest request,
                                           @NonNull TotalCaptureResult result) {
                unlockFocus();
            }
        };

        mCaptureSession.stopRepeating();
        mCaptureSession.capture(captureBuilder.build(), CaptureCallback, null);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
项目:android-Camera2Basic-master    文件:Camera2BasicFragment.java   
/**
 * Capture a still picture. This method should be called when we get a response in
 * {@link #mCaptureCallback} from both {@link #lockFocus()}.
 */
private void captureStillPicture() {
    try {
        final Activity activity = getActivity();
        if (null == activity || null == mCameraDevice) {
            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,
                CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
        setAutoFlash(captureBuilder);

        // Orientation
        int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
        captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(rotation));

        CameraCaptureSession.CaptureCallback CaptureCallback
                = new CameraCaptureSession.CaptureCallback() {

            @Override
            public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                           @NonNull CaptureRequest request,
                                           @NonNull TotalCaptureResult result) {
                showToast("Saved: " + mFile);
                Log.d(TAG, mFile.toString());
                unlockFocus();
            }
        };

        mCaptureSession.stopRepeating();
        mCaptureSession.capture(captureBuilder.build(), CaptureCallback, null);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
项目:Camera2Vision    文件:Camera2Source.java   
/**
 * Capture a still picture. This method should be called when we get a response in
 * {@link #mCaptureCallback} from both {@link #lockFocus()}.
 */
private void captureStillPicture() {
    try {
        if (null == mCameraDevice) {
            return;
        }
        if(mShutterCallback != null) {
            mShutterCallback.onShutter();
        }
        // This is the CaptureRequest.Builder that we use to take a picture.
        final CaptureRequest.Builder captureBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
        captureBuilder.addTarget(mImageReaderStill.getSurface());

        // Use the same AE and AF modes as the preview.
        captureBuilder.set(CaptureRequest.CONTROL_AF_MODE, mFocusMode);
        if(mFlashSupported) {
            captureBuilder.set(CaptureRequest.CONTROL_AE_MODE, mFlashMode);
        }

        // Orientation
        captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(mDisplayOrientation));

        CameraCaptureSession.CaptureCallback CaptureCallback = new CameraCaptureSession.CaptureCallback() {

            @Override
            public void onCaptureCompleted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, @NonNull TotalCaptureResult result) {
                unlockFocus();
            }
        };

        mCaptureSession.stopRepeating();
        mCaptureSession.capture(captureBuilder.build(), CaptureCallback, null);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
项目:Croprotector    文件:Shoot_fragment.java   
@Override
public void onConfigured(CameraCaptureSession cameraCaptureSession) {
    try {
        mCameraSession = cameraCaptureSession;
        cameraCaptureSession.setRepeatingRequest(mPreViewBuilder.build(), null, mHandler);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
项目:Ocr-android    文件:CameraPreview.java   
/**
 * 拍摄静态图片
 */
private void captureStillPicture() {
    if (null == mCameraDevice) {
        return;
    }
    try {
        final CaptureRequest.Builder captureBuilder =
                mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
        captureBuilder.addTarget(mImageReader.getSurface());
        captureBuilder.set(CaptureRequest.CONTROL_AF_MODE,
                CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
        setAutoFlash(captureBuilder);
        // 方向
        int rotation = getDisplayRotation();
        captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(rotation));
        CameraCaptureSession.CaptureCallback captureCallback
                = new CameraCaptureSession.CaptureCallback() {

            @Override
            public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                           @NonNull CaptureRequest request,
                                           @NonNull TotalCaptureResult result) {
                unlockFocus();
                if (mCapturePictureListener != null) {
                    mCapturePictureListener.onCapture(mFile);
                }
            }
        };
        mCaptureSession.stopRepeating();
        mCaptureSession.abortCaptures();
        mCaptureSession.capture(captureBuilder.build(), captureCallback, null);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
项目:sample-tensorflow-imageclassifier    文件:CameraHandler.java   
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                               @NonNull CaptureRequest request,
                               @NonNull TotalCaptureResult result) {
    session.close();
    mCaptureSession = null;
    Log.d(TAG, "CaptureSession closed");
}
项目:OkayCamera-Android    文件:Camera2RawFragment.java   
@Override
public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request,
                               TotalCaptureResult result) {
    int requestId = (int) request.getTag();
    ImageSaver.ImageSaverBuilder jpegBuilder;
    ImageSaver.ImageSaverBuilder rawBuilder;
    StringBuilder sb = new StringBuilder();

    // Look up the ImageSaverBuilder for this request and update it with the CaptureResult
    synchronized (mCameraStateLock) {
        jpegBuilder = mJpegResultQueue.get(requestId);
        rawBuilder = mRawResultQueue.get(requestId);

        if (jpegBuilder != null) {
            jpegBuilder.setResult(result);
            sb.append("Saving JPEG as: ");
            sb.append(jpegBuilder.getSaveLocation());
        }
        if (rawBuilder != null) {
            rawBuilder.setResult(result);
            if (jpegBuilder != null) sb.append(", ");
            sb.append("Saving RAW as: ");
            sb.append(rawBuilder.getSaveLocation());
        }

        // If we have all the results necessary, save the image to a file in the background.
        handleCompletionLocked(requestId, jpegBuilder, mJpegResultQueue);
        handleCompletionLocked(requestId, rawBuilder, mRawResultQueue);

        finishedCaptureLocked();
    }

    showToast(sb.toString());
}
项目:OkayCamera-Android    文件:Camera2RawFragment.java   
@Override
public void onCaptureFailed(CameraCaptureSession session, CaptureRequest request,
                            CaptureFailure failure) {
    int requestId = (int) request.getTag();
    synchronized (mCameraStateLock) {
        mJpegResultQueue.remove(requestId);
        mRawResultQueue.remove(requestId);
        finishedCaptureLocked();
    }
    showToast("Capture failed!");
}
项目:mao-android    文件:Camera2Fragment.java   
@Override
public void onConfigured(CameraCaptureSession session) {
    try {
        //session.capture(mPreviewBuilder.build(), mSessionCaptureCallback, mHandler);
        session.setRepeatingRequest(mPreviewBuilder.build(), mSessionCaptureCallback, mHandler);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
项目:CameraKitView    文件:Camera2.java   
/**
     * Capture a still picture. This method should be called when we get a response in
     * {@link #mCaptureCallback} from both {@link #lockFocus()}.
     */
    private void captureStillPicture() {
        try {
            removeCaptureMessage();
            // 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,
//                CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
//            updateAutoFocus();
            updateFlash(captureBuilder);

            // Orientation
            int rotation = mWindowManager.getDefaultDisplay().getRotation();
            captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(rotation));

            CameraCaptureSession.CaptureCallback CaptureCallback
                = new CameraCaptureSession.CaptureCallback() {

                @Override
                public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                               @NonNull CaptureRequest request,
                                               @NonNull TotalCaptureResult result) {
                    unlockFocus();
                }
            };

            mPreviewSession.stopRepeating();
            mPreviewSession.capture(captureBuilder.build(), CaptureCallback, mBackgroundHandler);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }
项目:androidthings-kuman-sm9    文件:Camera.java   
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                               @NonNull CaptureRequest request,
                               @NonNull TotalCaptureResult result) {
    session.close();
    mCaptureSession = null;
    Timber.d("CaptureSession closed");
}
项目:android-things-drawbot    文件:CameraHandler.java   
@Override
public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {
    // The camera is already closed
    if (mCameraDevice == null) {
        return;
    }
    // When the session is ready, we start capture.
    mCaptureSession = cameraCaptureSession;
    triggerImageCapture();
}
项目:android-things-drawbot    文件:CameraHandler.java   
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                               @NonNull CaptureRequest request,
                               @NonNull TotalCaptureResult result) {
    session.close();
    mCaptureSession = null;
    Log.d(TAG, "CaptureSession closed");
}
项目:robo-car    文件:PiCameraDriver.java   
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                               @NonNull CaptureRequest request,
                               @NonNull TotalCaptureResult result) {
    //noinspection ConstantConditions
    if (session != null) {
        session.close();
        mCaptureSession = null;
    }
}
项目:EZFilter    文件:Camera2Input.java   
@Override
public void onConfigured(CameraCaptureSession session) {
    mCameraCaptureSession = session;
    try {
        // 自动对焦
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
        // 自动闪光灯
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
        CaptureRequest previewRequest = mPreviewRequestBuilder.build();
        session.setRepeatingRequest(previewRequest, null, mPreviewHandler);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
项目:opencv-documentscanner-android    文件:Camera2BasicFragment.java   
@Override
public void onCaptureProgressed(@NonNull CameraCaptureSession session,
                                @NonNull CaptureRequest request,
                                @NonNull CaptureResult partialResult) {
    process(partialResult);
}
项目:face-landmark-android    文件:CameraUtils.java   
@Override
public void onCaptureCompleted(
        @NonNull final CameraCaptureSession session,
        @NonNull final CaptureRequest request,
        @NonNull final TotalCaptureResult result) {}
项目:ImageClassify    文件:CameraConnectionFragment.java   
@Override
public void onCaptureProgressed(
    final CameraCaptureSession session,
    final CaptureRequest request,
    final CaptureResult partialResult) {}
项目:TK_1701    文件:Camera2.java   
@Override
public void onConfigured(@NonNull CameraCaptureSession session) {
    mPreviewSession = session;
    updatePreview();
}