Example usage for android.hardware.camera2 CameraDevice createCaptureRequest

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

Introduction

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

Prototype

@NonNull
public abstract CaptureRequest.Builder createCaptureRequest(@RequestTemplate int templateType)
        throws CameraAccessException;

Source Link

Document

Create a CaptureRequest.Builder for new capture requests, initialized with template for a target use case.

Usage

From source file:com.android.camera2.its.ItsSerializer.java

@SuppressWarnings("unchecked")
public static List<CaptureRequest.Builder> deserializeRequestList(CameraDevice device, JSONObject jsonObjTop)
        throws ItsException {
    try {/*from  w  ww  . j  a v  a 2  s.  com*/
        List<CaptureRequest.Builder> requests = null;
        JSONArray jsonReqs = jsonObjTop.getJSONArray("captureRequests");
        requests = new LinkedList<CaptureRequest.Builder>();
        for (int i = 0; i < jsonReqs.length(); i++) {
            CaptureRequest.Builder templateReq = device
                    .createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
            requests.add(deserialize(templateReq, jsonReqs.getJSONObject(i)));
        }
        return requests;
    } catch (org.json.JSONException e) {
        throw new ItsException("JSON error: ", e);
    } catch (android.hardware.camera2.CameraAccessException e) {
        throw new ItsException("Access error: ", e);
    }
}