1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.hardware.camera2; 18 19 import android.hardware.camera2.CaptureRequest; 20 import android.hardware.camera2.impl.CameraMetadataNative; 21 import android.hardware.camera2.params.OutputConfiguration; 22 import android.hardware.camera2.utils.SubmitInfo; 23 import android.view.Surface; 24 25 /** @hide */ 26 interface ICameraDeviceUser 27 { disconnect()28 void disconnect(); 29 30 const int NO_IN_FLIGHT_REPEATING_FRAMES = -1; 31 submitRequest(in CaptureRequest request, boolean streaming)32 SubmitInfo submitRequest(in CaptureRequest request, boolean streaming); submitRequestList(in CaptureRequest[] requestList, boolean streaming)33 SubmitInfo submitRequestList(in CaptureRequest[] requestList, boolean streaming); 34 35 /** 36 * Cancel the repeating request specified by requestId 37 * Returns the frame number of the last frame that will be produced from this 38 * repeating request, or NO_IN_FLIGHT_REPEATING_FRAMES if no frames were produced 39 * by this repeating request. 40 * 41 * Repeating request may be stopped by camera device due to an error. Canceling a stopped 42 * repeating request will trigger ERROR_ILLEGAL_ARGUMENT. 43 */ cancelRequest(int requestId)44 long cancelRequest(int requestId); 45 46 /** 47 * Begin the device configuration. 48 * 49 * <p> 50 * beginConfigure must be called before any call to deleteStream, createStream, 51 * or endConfigure. It is not valid to call this when the device is not idle. 52 * <p> 53 */ beginConfigure()54 void beginConfigure(); 55 56 /** 57 * The standard operating mode for a camera device; all API guarantees are in force 58 */ 59 const int NORMAL_MODE = 0; 60 61 /** 62 * High-speed recording mode; only two outputs targeting preview and video recording may be 63 * used, and requests must be batched. 64 */ 65 const int CONSTRAINED_HIGH_SPEED_MODE = 1; 66 67 /** 68 * Start of custom vendor modes 69 */ 70 const int VENDOR_MODE_START = 0x8000; 71 72 /** 73 * End the device configuration. 74 * 75 * <p> 76 * endConfigure must be called after stream configuration is complete (i.e. after 77 * a call to beginConfigure and subsequent createStream/deleteStream calls). This 78 * must be called before any requests can be submitted. 79 * <p> 80 * @param operatingMode The kind of session to create; either NORMAL_MODE or 81 * CONSTRAINED_HIGH_SPEED_MODE. Must be a non-negative value. 82 */ endConfigure(int operatingMode)83 void endConfigure(int operatingMode); 84 deleteStream(int streamId)85 void deleteStream(int streamId); 86 87 /** 88 * Create an output stream 89 * 90 * <p>Create an output stream based on the given output configuration</p> 91 * 92 * @param outputConfiguration size, format, and other parameters for the stream 93 * @return new stream ID 94 */ createStream(in OutputConfiguration outputConfiguration)95 int createStream(in OutputConfiguration outputConfiguration); 96 97 /** 98 * Create an input stream 99 * 100 * <p>Create an input stream of width, height, and format</p> 101 * 102 * @param width Width of the input buffers 103 * @param height Height of the input buffers 104 * @param format Format of the input buffers. One of HAL_PIXEL_FORMAT_*. 105 * 106 * @return new stream ID 107 */ createInputStream(int width, int height, int format)108 int createInputStream(int width, int height, int format); 109 110 /** 111 * Get the surface of the input stream. 112 * 113 * <p>It's valid to call this method only after a stream configuration is completed 114 * successfully and the stream configuration includes a input stream.</p> 115 * 116 * @param surface An output argument for the surface of the input stream buffer queue. 117 */ getInputSurface()118 Surface getInputSurface(); 119 120 // Keep in sync with public API in 121 // frameworks/base/core/java/android/hardware/camera2/CameraDevice.java 122 const int TEMPLATE_PREVIEW = 1; 123 const int TEMPLATE_STILL_CAPTURE = 2; 124 const int TEMPLATE_RECORD = 3; 125 const int TEMPLATE_VIDEO_SNAPSHOT = 4; 126 const int TEMPLATE_ZERO_SHUTTER_LAG = 5; 127 const int TEMPLATE_MANUAL = 6; 128 createDefaultRequest(int templateId)129 CameraMetadataNative createDefaultRequest(int templateId); 130 getCameraInfo()131 CameraMetadataNative getCameraInfo(); 132 waitUntilIdle()133 void waitUntilIdle(); 134 flush()135 long flush(); 136 prepare(int streamId)137 void prepare(int streamId); 138 tearDown(int streamId)139 void tearDown(int streamId); 140 prepare2(int maxCount, int streamId)141 void prepare2(int maxCount, int streamId); 142 finalizeOutputConfigurations(int streamId, in OutputConfiguration outputConfiguration)143 void finalizeOutputConfigurations(int streamId, in OutputConfiguration outputConfiguration); 144 } 145