Example usage for android.hardware.camera2.params StreamConfigurationMap getOutputMinFrameDuration

List of usage examples for android.hardware.camera2.params StreamConfigurationMap getOutputMinFrameDuration

Introduction

In this page you can find the example usage for android.hardware.camera2.params StreamConfigurationMap getOutputMinFrameDuration.

Prototype

public <T> long getOutputMinFrameDuration(final Class<T> klass, final Size size) 

Source Link

Document

Get the minimum CaptureRequest#SENSOR_FRAME_DURATION frame duration for the class/size combination (in nanoseconds).

Usage

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

@SuppressWarnings("unchecked")
private static Object serializeStreamConfigurationMap(StreamConfigurationMap map)
        throws org.json.JSONException {
    // TODO: Serialize the rest of the StreamConfigurationMap fields.
    JSONObject mapObj = new JSONObject();
    JSONArray cfgArray = new JSONArray();
    int fmts[] = map.getOutputFormats();
    if (fmts != null) {
        for (int fi = 0; fi < Array.getLength(fmts); fi++) {
            Size sizes[] = map.getOutputSizes(fmts[fi]);
            if (sizes != null) {
                for (int si = 0; si < Array.getLength(sizes); si++) {
                    JSONObject obj = new JSONObject();
                    obj.put("format", fmts[fi]);
                    obj.put("width", sizes[si].getWidth());
                    obj.put("height", sizes[si].getHeight());
                    obj.put("input", false);
                    obj.put("minFrameDuration", map.getOutputMinFrameDuration(fmts[fi], sizes[si]));
                    cfgArray.put(obj);/*from   ww  w.ja v a 2  s  . c  o  m*/
                }
            }
        }
    }
    mapObj.put("availableStreamConfigurations", cfgArray);
    return mapObj;
}