Example usage for android.hardware.camera2 CameraDevice TEMPLATE_VIDEO_SNAPSHOT

List of usage examples for android.hardware.camera2 CameraDevice TEMPLATE_VIDEO_SNAPSHOT

Introduction

In this page you can find the example usage for android.hardware.camera2 CameraDevice TEMPLATE_VIDEO_SNAPSHOT.

Prototype

int TEMPLATE_VIDEO_SNAPSHOT

To view the source code for android.hardware.camera2 CameraDevice TEMPLATE_VIDEO_SNAPSHOT.

Click Source Link

Document

Create a request suitable for still image capture while recording video.

Usage

From source file:com.android.camera.one.v2.OneCameraZslImpl.java

private boolean sendRepeatingBurstCaptureRequest() {
    Log.v(TAG, "sendRepeatingBurstCaptureRequest()");
    try {//from  ww  w.j  a va 2s.c o  m
        CaptureRequest.Builder builder;
        builder = mDevice.createCaptureRequest(CameraDevice.TEMPLATE_VIDEO_SNAPSHOT);
        builder.addTarget(mPreviewSurface);

        if (ZSL_ENABLED) {
            builder.addTarget(mCaptureImageReader.getSurface());
        }

        builder.set(CaptureRequest.CONTROL_MODE, CaptureRequest.CONTROL_MODE_AUTO);
        builder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_VIDEO);
        builder.set(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_IDLE);

        builder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON);
        builder.set(CaptureRequest.FLASH_MODE, CaptureRequest.FLASH_MODE_OFF);

        addRegionsToCaptureRequestBuilder(builder);

        mCaptureSession.setRepeatingRequest(builder.build(), mCaptureManager, mCameraHandler);
        return true;
    } catch (CameraAccessException e) {
        Log.v(TAG, "Could not send repeating burst capture request.", e);
        return false;
    }
}