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.params.SessionConfiguration; 23 import android.hardware.camera2.utils.SubmitInfo; 24 import android.view.Surface; 25 26 /** @hide */ 27 interface ICameraDeviceUser 28 { disconnect()29 void disconnect(); 30 31 const int NO_IN_FLIGHT_REPEATING_FRAMES = -1; 32 submitRequest(in CaptureRequest request, boolean streaming)33 SubmitInfo submitRequest(in CaptureRequest request, boolean streaming); submitRequestList(in CaptureRequest[] requestList, boolean streaming)34 SubmitInfo submitRequestList(in CaptureRequest[] requestList, boolean streaming); 35 36 /** 37 * Cancel the repeating request specified by requestId 38 * Returns the frame number of the last frame that will be produced from this 39 * repeating request, or NO_IN_FLIGHT_REPEATING_FRAMES if no frames were produced 40 * by this repeating request. 41 * 42 * Repeating request may be stopped by camera device due to an error. Canceling a stopped 43 * repeating request will trigger ERROR_ILLEGAL_ARGUMENT. 44 */ cancelRequest(int requestId)45 long cancelRequest(int requestId); 46 47 /** 48 * Begin the device configuration. 49 * 50 * <p> 51 * beginConfigure must be called before any call to deleteStream, createStream, 52 * or endConfigure. It is not valid to call this when the device is not idle. 53 * <p> 54 */ beginConfigure()55 void beginConfigure(); 56 57 /** 58 * The standard operating mode for a camera device; all API guarantees are in force 59 */ 60 const int NORMAL_MODE = 0; 61 62 /** 63 * High-speed recording mode; only two outputs targeting preview and video recording may be 64 * used, and requests must be batched. 65 */ 66 const int CONSTRAINED_HIGH_SPEED_MODE = 1; 67 68 /** 69 * Start of custom vendor modes 70 */ 71 const int VENDOR_MODE_START = 0x8000; 72 73 /** 74 * End the device configuration. 75 * 76 * <p> 77 * endConfigure must be called after stream configuration is complete (i.e. after 78 * a call to beginConfigure and subsequent createStream/deleteStream calls). This 79 * must be called before any requests can be submitted. 80 * <p> 81 * @param operatingMode The kind of session to create; either NORMAL_MODE or 82 * CONSTRAINED_HIGH_SPEED_MODE. Must be a non-negative value. 83 * @param sessionParams Session wide camera parameters 84 */ endConfigure(int operatingMode, in CameraMetadataNative sessionParams)85 void endConfigure(int operatingMode, in CameraMetadataNative sessionParams); 86 87 /** 88 * Check whether a particular session configuration has camera device 89 * support. 90 * 91 * @param sessionConfiguration Specific session configuration to be verified. 92 * @return true - in case the stream combination is supported. 93 * false - in case there is no device support. 94 */ isSessionConfigurationSupported(in SessionConfiguration sessionConfiguration)95 boolean isSessionConfigurationSupported(in SessionConfiguration sessionConfiguration); 96 deleteStream(int streamId)97 void deleteStream(int streamId); 98 99 /** 100 * Create an output stream 101 * 102 * <p>Create an output stream based on the given output configuration</p> 103 * 104 * @param outputConfiguration size, format, and other parameters for the stream 105 * @return new stream ID 106 */ createStream(in OutputConfiguration outputConfiguration)107 int createStream(in OutputConfiguration outputConfiguration); 108 109 /** 110 * Create an input stream 111 * 112 * <p>Create an input stream of width, height, and format</p> 113 * 114 * @param width Width of the input buffers 115 * @param height Height of the input buffers 116 * @param format Format of the input buffers. One of HAL_PIXEL_FORMAT_*. 117 * 118 * @return new stream ID 119 */ createInputStream(int width, int height, int format)120 int createInputStream(int width, int height, int format); 121 122 /** 123 * Get the surface of the input stream. 124 * 125 * <p>It's valid to call this method only after a stream configuration is completed 126 * successfully and the stream configuration includes a input stream.</p> 127 * 128 * @param surface An output argument for the surface of the input stream buffer queue. 129 */ getInputSurface()130 Surface getInputSurface(); 131 132 // Keep in sync with public API in 133 // frameworks/base/core/java/android/hardware/camera2/CameraDevice.java 134 const int TEMPLATE_PREVIEW = 1; 135 const int TEMPLATE_STILL_CAPTURE = 2; 136 const int TEMPLATE_RECORD = 3; 137 const int TEMPLATE_VIDEO_SNAPSHOT = 4; 138 const int TEMPLATE_ZERO_SHUTTER_LAG = 5; 139 const int TEMPLATE_MANUAL = 6; 140 createDefaultRequest(int templateId)141 CameraMetadataNative createDefaultRequest(int templateId); 142 getCameraInfo()143 CameraMetadataNative getCameraInfo(); 144 waitUntilIdle()145 void waitUntilIdle(); 146 flush()147 long flush(); 148 prepare(int streamId)149 void prepare(int streamId); 150 tearDown(int streamId)151 void tearDown(int streamId); 152 prepare2(int maxCount, int streamId)153 void prepare2(int maxCount, int streamId); 154 updateOutputConfiguration(int streamId, in OutputConfiguration outputConfiguration)155 void updateOutputConfiguration(int streamId, in OutputConfiguration outputConfiguration); 156 finalizeOutputConfigurations(int streamId, in OutputConfiguration outputConfiguration)157 void finalizeOutputConfigurations(int streamId, in OutputConfiguration outputConfiguration); 158 } 159