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

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

Introduction

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

Prototype

public final int[] getOutputFormats() 

Source Link

Document

Get the image format output formats in this stream configuration.

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  w w w . ja  v a 2 s  .  co  m
                }
            }
        }
    }
    mapObj.put("availableStreamConfigurations", cfgArray);
    return mapObj;
}