• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.ICameraDeviceCallbacks;
21 import android.hardware.camera2.ICameraOfflineSession;
22 import android.hardware.camera2.impl.CameraMetadataNative;
23 import android.hardware.camera2.params.OutputConfiguration;
24 import android.hardware.camera2.params.SessionConfiguration;
25 import android.hardware.camera2.utils.SubmitInfo;
26 import android.view.Surface;
27 
28 /** @hide */
29 interface ICameraDeviceUser
30 {
disconnect()31     void disconnect();
32 
33     const int NO_IN_FLIGHT_REPEATING_FRAMES = -1;
34 
submitRequest(in CaptureRequest request, boolean streaming)35     SubmitInfo submitRequest(in CaptureRequest request, boolean streaming);
submitRequestList(in CaptureRequest[] requestList, boolean streaming)36     SubmitInfo submitRequestList(in CaptureRequest[] requestList, boolean streaming);
37 
38     /**
39      * Cancel the repeating request specified by requestId
40      * Returns the frame number of the last frame that will be produced from this
41      * repeating request, or NO_IN_FLIGHT_REPEATING_FRAMES if no frames were produced
42      * by this repeating request.
43      *
44      * Repeating request may be stopped by camera device due to an error. Canceling a stopped
45      * repeating request will trigger ERROR_ILLEGAL_ARGUMENT.
46      */
cancelRequest(int requestId)47     long cancelRequest(int requestId);
48 
49     /**
50      * Begin the device configuration.
51      *
52      * <p>
53      * beginConfigure must be called before any call to deleteStream, createStream,
54      * or endConfigure.  It is not valid to call this when the device is not idle.
55      * <p>
56      */
beginConfigure()57     void beginConfigure();
58 
59     /**
60      * The standard operating mode for a camera device; all API guarantees are in force
61      */
62     const int NORMAL_MODE = 0;
63 
64     /**
65      * High-speed recording mode; only two outputs targeting preview and video recording may be
66      * used, and requests must be batched.
67      */
68     const int CONSTRAINED_HIGH_SPEED_MODE = 1;
69 
70     /**
71      * Start of custom vendor modes
72      */
73     const int VENDOR_MODE_START = 0x8000;
74 
75     /**
76      * End the device configuration.
77      *
78      * <p>
79      * endConfigure must be called after stream configuration is complete (i.e. after
80      * a call to beginConfigure and subsequent createStream/deleteStream calls).  This
81      * must be called before any requests can be submitted.
82      * <p>
83      * @param operatingMode The kind of session to create; either NORMAL_MODE or
84      *     CONSTRAINED_HIGH_SPEED_MODE. Must be a non-negative value.
85      * @param sessionParams Session wide camera parameters
86      * @param startTimeMs The timestamp of session creation start, measured by
87      *                    SystemClock.uptimeMillis.
88      * @return a list of stream ids that can be used in offline mode via "switchToOffline"
89      */
endConfigure(int operatingMode, in CameraMetadataNative sessionParams, long startTimeMs)90     int[] endConfigure(int operatingMode, in CameraMetadataNative sessionParams, long startTimeMs);
91 
92     /**
93       * Check whether a particular session configuration has camera device
94       * support.
95       *
96       * @param sessionConfiguration Specific session configuration to be verified.
97       * @return true  - in case the stream combination is supported.
98       *         false - in case there is no device support.
99       */
isSessionConfigurationSupported(in SessionConfiguration sessionConfiguration)100     boolean isSessionConfigurationSupported(in SessionConfiguration sessionConfiguration);
101 
deleteStream(int streamId)102     void deleteStream(int streamId);
103 
104     /**
105      * Create an output stream
106      *
107      * <p>Create an output stream based on the given output configuration</p>
108      *
109      * @param outputConfiguration size, format, and other parameters for the stream
110      * @return new stream ID
111      */
createStream(in OutputConfiguration outputConfiguration)112     int createStream(in OutputConfiguration outputConfiguration);
113 
114     /**
115      * Create an input stream
116      *
117      * <p>Create an input stream of width, height, and format</p>
118      *
119      * @param width Width of the input buffers
120      * @param height Height of the input buffers
121      * @param format Format of the input buffers. One of HAL_PIXEL_FORMAT_*.
122      * @param isMultiResolution Whether the input stream supports variable resolution image.
123      *
124      * @return new stream ID
125      */
createInputStream(int width, int height, int format, boolean isMultiResolution)126     int createInputStream(int width, int height, int format, boolean isMultiResolution);
127 
128     /**
129      * Get the surface of the input stream.
130      *
131      * <p>It's valid to call this method only after a stream configuration is completed
132      * successfully and the stream configuration includes a input stream.</p>
133      *
134      * @param surface An output argument for the surface of the input stream buffer queue.
135      */
getInputSurface()136     Surface getInputSurface();
137 
138     // Keep in sync with public API in
139     // frameworks/base/core/java/android/hardware/camera2/CameraDevice.java
140     const int TEMPLATE_PREVIEW = 1;
141     const int TEMPLATE_STILL_CAPTURE = 2;
142     const int TEMPLATE_RECORD = 3;
143     const int TEMPLATE_VIDEO_SNAPSHOT = 4;
144     const int TEMPLATE_ZERO_SHUTTER_LAG = 5;
145     const int TEMPLATE_MANUAL = 6;
146 
createDefaultRequest(int templateId)147     CameraMetadataNative createDefaultRequest(int templateId);
148 
getCameraInfo()149     CameraMetadataNative getCameraInfo();
150 
waitUntilIdle()151     void waitUntilIdle();
152 
flush()153     long flush();
154 
prepare(int streamId)155     void prepare(int streamId);
156 
tearDown(int streamId)157     void tearDown(int streamId);
158 
prepare2(int maxCount, int streamId)159     void prepare2(int maxCount, int streamId);
160 
updateOutputConfiguration(int streamId, in OutputConfiguration outputConfiguration)161     void updateOutputConfiguration(int streamId, in OutputConfiguration outputConfiguration);
162 
finalizeOutputConfigurations(int streamId, in OutputConfiguration outputConfiguration)163     void finalizeOutputConfigurations(int streamId, in OutputConfiguration outputConfiguration);
164 
165 
166     // Keep in sync with public API in
167     // frameworks/base/core/java/android/hardware/camera2/CameraDevice.java
168     const int AUDIO_RESTRICTION_NONE = 0;
169     const int AUDIO_RESTRICTION_VIBRATION = 1;
170     const int AUDIO_RESTRICTION_VIBRATION_SOUND = 3;
171 
172     /**
173       * Set audio restriction mode for this camera device.
174       *
175       * @param mode the audio restriction mode ID as above
176       *
177       */
setCameraAudioRestriction(int mode)178     void setCameraAudioRestriction(int mode);
179 
180     /**
181       * Get global audio restriction mode for all camera clients.
182       *
183       * @return the currently applied system-wide audio restriction mode
184       */
getGlobalAudioRestriction()185     int getGlobalAudioRestriction();
186 
187     /**
188      * Offline processing main entry point
189      *
190      * @param callbacks Object that will receive callbacks from offline session
191      * @param offlineOutputIds The ID of streams that needs to be preserved in offline session
192      *
193      * @return Offline session object.
194      */
switchToOffline(in ICameraDeviceCallbacks callbacks, in int[] offlineOutputIds)195     ICameraOfflineSession switchToOffline(in ICameraDeviceCallbacks callbacks,
196             in int[] offlineOutputIds);
197 }
198