1 /*
2  * Copyright (C) 2015 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 /**
18  * @addtogroup Camera
19  * @{
20  */
21 
22 /**
23  * @file NdkCameraDevice.h
24  */
25 
26 /*
27  * This file defines an NDK API.
28  * Do not remove methods.
29  * Do not change method signatures.
30  * Do not change the value of constants.
31  * Do not change the size of any of the classes defined in here.
32  * Do not reference types that are not part of the NDK.
33  * Do not #include files that aren't part of the NDK.
34  */
35 #include <sys/cdefs.h>
36 
37 #include "NdkCameraError.h"
38 #include "NdkCaptureRequest.h"
39 #include "NdkCameraCaptureSession.h"
40 #include "NdkCameraWindowType.h"
41 
42 #ifndef _NDK_CAMERA_DEVICE_H
43 #define _NDK_CAMERA_DEVICE_H
44 
45 __BEGIN_DECLS
46 
47 /**
48  * ACameraDevice is opaque type that provides access to a camera device.
49  *
50  * A pointer can be obtained using {@link ACameraManager_openCamera} method.
51  */
52 typedef struct ACameraDevice ACameraDevice;
53 
54 /**
55  * Struct to hold list of camera device Ids. This can refer to either the Ids
56  * of connected camera devices returned from {@link ACameraManager_getCameraIdList},
57  * or the physical camera Ids passed into
58  * {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
59  */
60 typedef struct ACameraIdList {
61     int numCameras;          ///< Number of camera device Ids
62     const char** cameraIds;  ///< list of camera device Ids
63 } ACameraIdList;
64 
65 /// Enum for ACameraDevice_ErrorStateCallback error code
66 enum {
67     /**
68      * The camera device is in use already.
69      */
70     ERROR_CAMERA_IN_USE = 1,
71 
72     /**
73      * The system-wide limit for number of open cameras or camera resources has
74      * been reached, and more camera devices cannot be opened until previous
75      * instances are closed.
76      */
77     ERROR_MAX_CAMERAS_IN_USE = 2,
78 
79     /**
80      * The camera is disabled due to a device policy, and cannot be opened.
81      */
82     ERROR_CAMERA_DISABLED = 3,
83 
84     /**
85      * The camera device has encountered a fatal error.
86      * <p>The camera device needs to be re-opened to be used again.</p>
87      */
88     ERROR_CAMERA_DEVICE = 4,
89 
90     /**
91      * The camera service has encountered a fatal error.
92      * <p>The Android device may need to be shut down and restarted to restore
93      * camera function, or there may be a persistent hardware problem.
94      * An attempt at recovery may be possible by closing the
95      * CameraDevice and the CameraManager, and trying to acquire all resources
96      * again from scratch.</p>
97      */
98     ERROR_CAMERA_SERVICE = 5
99 };
100 
101 /**
102  * Camera device state callbacks to be used in {@link ACameraDevice_StateCallbacks}.
103  *
104  * @param context The optional context in {@link ACameraDevice_StateCallbacks} will be
105  *                passed to this callback.
106  * @param device The {@link ACameraDevice} that is being disconnected.
107  */
108 typedef void (*ACameraDevice_StateCallback)(void* context, ACameraDevice* device);
109 
110 /**
111  * Camera device error state callbacks to be used in {@link ACameraDevice_StateCallbacks}.
112  *
113  * @param context The optional context in {@link ACameraDevice_StateCallbacks} will be
114  *                passed to this callback.
115  * @param device The {@link ACameraDevice} that is being disconnected.
116  * @param error The error code describes the cause of this error callback. See the following
117  *              links for more detail.
118  *
119  * @see ERROR_CAMERA_IN_USE
120  * @see ERROR_MAX_CAMERAS_IN_USE
121  * @see ERROR_CAMERA_DISABLED
122  * @see ERROR_CAMERA_DEVICE
123  * @see ERROR_CAMERA_SERVICE
124  */
125 typedef void (*ACameraDevice_ErrorStateCallback)(void* context, ACameraDevice* device, int error);
126 
127 /**
128  * Client access priorities changed callbacks to be used in {@link ACameraDevice_StateCallbacks}
129  * when camera is opened in shared mode.
130  *
131  * @param context The optional context in {@link ACameraDevice_StateCallbacks} will be passed to
132  *                this callback.
133  * @param device The {@link ACameraDevice} whose access priorities has been changed.
134  * @param isPrimaryClient whether the client is primary client.
135  */
136 typedef void (*ACameraDevice_ClientSharedAccessPriorityChangedCallback)(void* context,
137         ACameraDevice* device, bool isPrimaryClient);
138 
139 /**
140  * Applications' callbacks for camera device state changes, register with
141  * {@link ACameraManager_openCamera}.
142  */
143 typedef struct ACameraDevice_StateCallbacks {
144     /// optional application context.
145     void*                             context;
146 
147     /**
148      * The function is  called when a camera device is no longer available for use.
149      *
150      * <p>Any attempt to call API methods on this ACameraDevice will return
151      * {@link ACAMERA_ERROR_CAMERA_DISCONNECTED}. The disconnection could be due to a
152      * change in security policy or permissions; the physical disconnection
153      * of a removable camera device; or the camera being needed for a
154      * higher-priority camera API client.</p>
155      *
156      * <p>Application should clean up the camera with {@link ACameraDevice_close} after
157      * this happens, as it is not recoverable until the camera can be opened
158      * again.</p>
159      *
160      */
161     ACameraDevice_StateCallback       onDisconnected;
162 
163     /**
164      * The function called when a camera device has encountered a serious error.
165      *
166      * <p>This indicates a failure of the camera device or camera service in some way.
167      * Any attempt to call API methods on this ACameraDevice in the future will return
168      * {@link ACAMERA_ERROR_CAMERA_DISCONNECTED}.</p>
169      *
170      * <p>There may still be capture completion or camera stream callbacks that will be called
171      * after this error is received.</p>
172      *
173      * <p>Application should clean up the camera with {@link ACameraDevice_close} after this
174      * happens. Further attempts at recovery are error-code specific.</p>
175      *
176      */
177     ACameraDevice_ErrorStateCallback  onError;
178 
179     /**
180      * Notify registered clients about client shared access priority changes when the camera device
181      * has been opened in shared mode.
182      *
183      * If the client priority changes from secondary to primary, then it can now
184      * create capture request and change the capture request parameters. If client priority
185      * changes from primary to secondary, that implies that another higher priority client is also
186      * accessing the camera in shared mode and is now the primary client.
187      */
188     ACameraDevice_ClientSharedAccessPriorityChangedCallback onClientSharedAccessPriorityChanged;
189 } ACameraDevice_StateCallbacks;
190 
191 /**
192  * For backward compatiblity.
193  */
194 typedef ACameraDevice_StateCallbacks ACameraDevice_stateCallbacks;
195 
196 /**
197  * Close the connection and free this ACameraDevice synchronously. Access to the ACameraDevice
198  * after calling this method will cause a crash.
199  *
200  * <p>After this call, all calls to the active ACameraCaptureSession associated to this
201  * ACameraDevice will return {@link ACAMERA_ERROR_SESSION_CLOSED} except for calls to
202  * {@link ACameraCaptureSession_close}.</p>
203  *
204  * <p>This method will stop all repeating captures sent via
205  * {@link ACameraCaptureSession_setRepeatingRequest} and block until all capture requests sent via
206  * {@link ACameraCaptureSession_capture} is complete. Once the method returns, the camera device
207  * will be removed from memory and access to the closed camera device pointer will cause a crash.</p>
208  *
209  * @param device the camera device to be closed
210  *
211  * @return <ul>
212  *         <li>{@link ACAMERA_OK} if the method call succeeds.</li>
213  *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if device is NULL.</li></ul>
214  */
215 camera_status_t ACameraDevice_close(ACameraDevice* device) __INTRODUCED_IN(24);
216 
217 /**
218  * Return the camera id associated with this camera device.
219  *
220  * @param device the camera device to be closed
221  *
222  * @return camera ID string. The returned string is managed by framework and should not be
223  * delete/free by the application. Also the returned string must not be used after the device
224  * has been closed.
225  */
226 const char* ACameraDevice_getId(const ACameraDevice* device) __INTRODUCED_IN(24);
227 
228 /**
229  * Capture request pre-defined template types, used in {@link ACameraDevice_createCaptureRequest}
230  * and {@link ACameraDevice_createCaptureRequest_withPhysicalIds}.
231  */
232 typedef enum {
233     /**
234      * Create a request suitable for a camera preview window. Specifically, this
235      * means that high frame rate is given priority over the highest-quality
236      * post-processing. These requests would normally be used with the
237      * {@link ACameraCaptureSession_setRepeatingRequest} method.
238      * This template is guaranteed to be supported on all camera devices.
239      *
240      * @see ACameraDevice_createCaptureRequest
241      */
242     TEMPLATE_PREVIEW = 1,
243 
244     /**
245      * Create a request suitable for still image capture. Specifically, this
246      * means prioritizing image quality over frame rate. These requests would
247      * commonly be used with the {@link ACameraCaptureSession_capture} method.
248      * This template is guaranteed to be supported on all camera devices.
249      *
250      * @see ACameraDevice_createCaptureRequest
251      */
252     TEMPLATE_STILL_CAPTURE = 2,
253 
254     /**
255      * Create a request suitable for video recording. Specifically, this means
256      * that a stable frame rate is used, and post-processing is set for
257      * recording quality. These requests would commonly be used with the
258      * {@link ACameraCaptureSession_setRepeatingRequest} method.
259      * This template is guaranteed to be supported on all camera devices.
260      *
261      * @see ACameraDevice_createCaptureRequest
262      */
263     TEMPLATE_RECORD = 3,
264 
265     /**
266      * Create a request suitable for still image capture while recording
267      * video. Specifically, this means maximizing image quality without
268      * disrupting the ongoing recording. These requests would commonly be used
269      * with the {@link ACameraCaptureSession_capture} method while a request based on
270      * {@link TEMPLATE_RECORD} is is in use with {@link ACameraCaptureSession_setRepeatingRequest}.
271      * This template is guaranteed to be supported on all camera devices.
272      *
273      * @see ACameraDevice_createCaptureRequest
274      */
275     TEMPLATE_VIDEO_SNAPSHOT = 4,
276 
277     /**
278      * Create a request suitable for zero shutter lag still capture. This means
279      * means maximizing image quality without compromising preview frame rate.
280      * AE/AWB/AF should be on auto mode.
281      *
282      * @see ACameraDevice_createCaptureRequest
283      */
284     TEMPLATE_ZERO_SHUTTER_LAG = 5,
285 
286     /**
287      * A basic template for direct application control of capture
288      * parameters. All automatic control is disabled (auto-exposure, auto-white
289      * balance, auto-focus), and post-processing parameters are set to preview
290      * quality. The manual capture parameters (exposure, sensitivity, and so on)
291      * are set to reasonable defaults, but should be overriden by the
292      * application depending on the intended use case.
293      * This template is guaranteed to be supported on camera devices that support the
294      * {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR} capability.
295      *
296      * @see ACameraDevice_createCaptureRequest
297      */
298     TEMPLATE_MANUAL = 6,
299 
300 } ACameraDevice_request_template;
301 
302 /**
303  * Create a ACaptureRequest for capturing images, initialized with template
304  * for a target use case.
305  *
306  * <p>The settings are chosen to be the best options for this camera device,
307  * so it is not recommended to reuse the same request for a different camera device.</p>
308  *
309  * @param device the camera device of interest
310  * @param templateId the type of capture request to be created.
311  *        See {@link ACameraDevice_request_template}.
312  * @param request the output request will be stored here if the method call succeeds.
313  *
314  * @return <ul>
315  *         <li>{@link ACAMERA_OK} if the method call succeeds. The created capture request will be
316  *                                filled in request argument.</li>
317  *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if device or request is NULL, templateId
318  *                                is undefined or camera device does not support requested template.
319  *                                </li>
320  *         <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed.</li>
321  *         <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error.</li>
322  *         <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error.</li>
323  *         <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
324  *
325  * @see TEMPLATE_PREVIEW
326  * @see TEMPLATE_RECORD
327  * @see TEMPLATE_STILL_CAPTURE
328  * @see TEMPLATE_VIDEO_SNAPSHOT
329  * @see TEMPLATE_MANUAL
330  */
331 camera_status_t ACameraDevice_createCaptureRequest(
332         const ACameraDevice* device, ACameraDevice_request_template templateId,
333         /*out*/ACaptureRequest** request) __INTRODUCED_IN(24);
334 
335 /**
336  * Opaque object for CaptureSessionOutput container, use
337  * {@link ACaptureSessionOutputContainer_create} to create an instance.
338  */
339 typedef struct ACaptureSessionOutputContainer ACaptureSessionOutputContainer;
340 
341 
342 /**
343  * Create a capture session output container.
344  *
345  * <p>The container is used in {@link ACameraDevice_createCaptureSession} method to create a capture
346  * session. Use {@link ACaptureSessionOutputContainer_free} to free the container and its memory
347  * after application no longer needs the ACaptureSessionOutputContainer.</p>
348  *
349  * @param container the output {@link ACaptureSessionOutputContainer} will be stored here if the
350  *                  method call succeeds.
351  *
352  * @return <ul>
353  *         <li>{@link ACAMERA_OK} if the method call succeeds. The created container will be
354  *                                filled in container argument.</li>
355  *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if container is NULL.</li></ul>
356  */
357 camera_status_t ACaptureSessionOutputContainer_create(
358         /*out*/ACaptureSessionOutputContainer** container) __INTRODUCED_IN(24);
359 
360 /**
361  * Free a capture session output container.
362  *
363  * @param container the {@link ACaptureSessionOutputContainer} to be freed.
364  *
365  * @see ACaptureSessionOutputContainer_create
366  */
367 void            ACaptureSessionOutputContainer_free(ACaptureSessionOutputContainer* container)
368         __INTRODUCED_IN(24);
369 
370 /**
371  * Create a ACaptureSessionOutput object.
372  *
373  * <p>The ACaptureSessionOutput is used in {@link ACaptureSessionOutputContainer_add} method to add
374  * an output {@link ANativeWindow} to ACaptureSessionOutputContainer. Use
375  * {@link ACaptureSessionOutput_free} to free the object and its memory after application no longer
376  * needs the {@link ACaptureSessionOutput}.</p>
377  *
378  * @param anw the {@link ANativeWindow} to be associated with the {@link ACaptureSessionOutput}
379  * @param output the output {@link ACaptureSessionOutput} will be stored here if the
380  *                  method call succeeds.
381  *
382  * @return <ul>
383  *         <li>{@link ACAMERA_OK} if the method call succeeds. The created container will be
384  *                                filled in the output argument.</li>
385  *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if anw or output is NULL.</li></ul>
386  *
387  * @see ACaptureSessionOutputContainer_add
388  */
389 camera_status_t ACaptureSessionOutput_create(
390         ANativeWindow* anw, /*out*/ACaptureSessionOutput** output) __INTRODUCED_IN(24);
391 
392 /**
393  * Free a ACaptureSessionOutput object.
394  *
395  * @param output the {@link ACaptureSessionOutput} to be freed.
396  *
397  * @see ACaptureSessionOutput_create
398  */
399 void            ACaptureSessionOutput_free(ACaptureSessionOutput* output) __INTRODUCED_IN(24);
400 
401 /**
402  * Add an {@link ACaptureSessionOutput} object to {@link ACaptureSessionOutputContainer}.
403  *
404  * @param container the {@link ACaptureSessionOutputContainer} of interest.
405  * @param output the output {@link ACaptureSessionOutput} to be added to container.
406  *
407  * @return <ul>
408  *         <li>{@link ACAMERA_OK} if the method call succeeds.</li>
409  *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if container or output is NULL.</li></ul>
410  */
411 camera_status_t ACaptureSessionOutputContainer_add(
412         ACaptureSessionOutputContainer* container, const ACaptureSessionOutput* output)
413         __INTRODUCED_IN(24);
414 
415 /**
416  * Remove an {@link ACaptureSessionOutput} object from {@link ACaptureSessionOutputContainer}.
417  *
418  * <p>This method has no effect if the ACaptureSessionOutput does not exist in
419  * ACaptureSessionOutputContainer.</p>
420  *
421  * @param container the {@link ACaptureSessionOutputContainer} of interest.
422  * @param output the output {@link ACaptureSessionOutput} to be removed from container.
423  *
424  * @return <ul>
425  *         <li>{@link ACAMERA_OK} if the method call succeeds.</li>
426  *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if container or output is NULL.</li></ul>
427  */
428 camera_status_t ACaptureSessionOutputContainer_remove(
429         ACaptureSessionOutputContainer* container, const ACaptureSessionOutput* output)
430         __INTRODUCED_IN(24);
431 
432 /**
433  * Create a new camera capture session by providing the target output set of {@link ANativeWindow}
434  * to the camera device.
435  *
436  * <p>If there is a preexisting session, the previous session will be closed
437  * automatically. However, app still needs to call {@link ACameraCaptureSession_close} on previous
438  * session. Otherwise the resources held by previous session will NOT be freed.</p>
439  *
440  * <p>The active capture session determines the set of potential output {@link ANativeWindow}s for
441  * the camera device for each capture request. A given request may use all
442  * or only some of the outputs. Once the ACameraCaptureSession is created, requests can be
443  * submitted with {@link ACameraCaptureSession_capture} or
444  * {@link ACameraCaptureSession_setRepeatingRequest}.</p>
445  *
446  * <p>Often the {@link ANativeWindow} used with this method can be obtained from a <a href=
447  * "http://developer.android.com/reference/android/view/Surface.html">Surface</a> java object by
448  * {@link ANativeWindow_fromSurface} NDK method. Surfaces or ANativeWindow suitable for inclusion as a camera
449  * output can be created for various use cases and targets:</p>
450  *
451  * <ul>
452  *
453  * <li>For drawing to a
454  *   <a href="http://developer.android.com/reference/android/view/SurfaceView.html">SurfaceView</a>:
455  *   Once the SurfaceView's Surface is created, set the size
456  *   of the Surface with
457  *   <a href="http://developer.android.com/reference/android/view/SurfaceHolder.html#setFixedSize(int, int)">
458  *    android.view.SurfaceHolder\#setFixedSize</a> to be one of the PRIVATE output sizes
459  *   returned by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}
460  *   and then obtain the Surface by calling <a href=
461  *   "http://developer.android.com/reference/android/view/SurfaceHolder.html#getSurface()">
462  *   android.view.SurfaceHolder\#getSurface</a>. If the size is not set by the application, it will
463  *   be rounded to the nearest supported size less than 1080p, by the camera device.</li>
464  *
465  * <li>For accessing through an OpenGL texture via a <a href=
466  *   "http://developer.android.com/reference/android/graphics/SurfaceTexture.html">SurfaceTexture</a>:
467  *   Set the size of the SurfaceTexture with <a href=
468  *   "http://developer.android.com/reference/android/graphics/SurfaceTexture.html#setDefaultBufferSize(int, int)">
469  *   setDefaultBufferSize</a> to be one of the PRIVATE output sizes
470  *   returned by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}
471  *   before creating a Surface from the SurfaceTexture with <a href=
472  *   "http://developer.android.com/reference/android/view/Surface.html#Surface(android.graphics.SurfaceTexture)">
473  *   Surface\#Surface(SurfaceTexture)</a>. If the size is not set by the application, it will be
474  *   set to be the smallest supported size less than 1080p, by the camera device.</li>
475  *
476  * <li>For recording with <a href=
477  *     "http://developer.android.com/reference/android/media/MediaCodec.html">
478  *     MediaCodec</a>: Call
479  *   <a href=
480  *     "http://developer.android.com/reference/android/media/MediaCodec.html#createInputSurface()">
481  *     android.media.MediaCodec\#createInputSurface</a> after configuring
482  *   the media codec to use one of the PRIVATE output sizes
483  *   returned by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}.
484  *   </li>
485  *
486  * <li>For recording with <a href=
487  *    "http://developer.android.com/reference/android/media/MediaRecorder.html">
488  *    MediaRecorder</a>: Call
489  *   <a href="http://developer.android.com/reference/android/media/MediaRecorder.html#getSurface()">
490  *    android.media.MediaRecorder\#getSurface</a> after configuring the media recorder to use
491  *   one of the PRIVATE output sizes returned by
492  *   {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}, or configuring it to use one of the supported
493  *   <a href="http://developer.android.com/reference/android/media/CamcorderProfile.html">
494  *    CamcorderProfiles</a>.</li>
495  *
496  * <li>For access to RAW, uncompressed YUV, or compressed JPEG data in the application: Create an
497  *   {@link AImageReader} object using the {@link AImageReader_new} method with one of the supported
498  *   output formats given by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}. Then obtain a
499  *   ANativeWindow from it with {@link AImageReader_getWindow}.
500  *   If the AImageReader size is not set to a supported size, it will be rounded to a supported
501  *   size less than 1080p by the camera device.
502  *   </li>
503  *
504  * </ul>
505  *
506  * <p>The camera device will query each ANativeWindow's size and formats upon this
507  * call, so they must be set to a valid setting at this time.</p>
508  *
509  * <p>It can take several hundred milliseconds for the session's configuration to complete,
510  * since camera hardware may need to be powered on or reconfigured.</p>
511  *
512  * <p>If a prior ACameraCaptureSession already exists when this method is called, the previous
513  * session will no longer be able to accept new capture requests and will be closed. Any
514  * in-progress capture requests made on the prior session will be completed before it's closed.
515  * To minimize the transition time,
516  * the ACameraCaptureSession_abortCaptures method can be used to discard the remaining
517  * requests for the prior capture session before a new one is created. Note that once the new
518  * session is created, the old one can no longer have its captures aborted.</p>
519  *
520  * <p>Using larger resolution outputs, or more outputs, can result in slower
521  * output rate from the device.</p>
522  *
523  * <p>Configuring a session with an empty list will close the current session, if
524  * any. This can be used to release the current session's target surfaces for another use.</p>
525  *
526  * <p>While any of the sizes from {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS} can be used when
527  * a single output stream is configured, a given camera device may not be able to support all
528  * combination of sizes, formats, and targets when multiple outputs are configured at once.  The
529  * tables below list the maximum guaranteed resolutions for combinations of streams and targets,
530  * given the capabilities of the camera device.</p>
531  *
532  * <p>If an application tries to create a session using a set of targets that exceed the limits
533  * described in the below tables, one of three possibilities may occur. First, the session may
534  * be successfully created and work normally. Second, the session may be successfully created,
535  * but the camera device won't meet the frame rate guarantees as described in
536  * {@link ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS}. Or third, if the output set
537  * cannot be used at all, session creation will fail entirely, with
538  * {@link ACAMERA_ERROR_STREAM_CONFIGURE_FAIL} being returned.</p>
539  *
540  * <p>For the type column `PRIV` refers to output format {@link AIMAGE_FORMAT_PRIVATE},
541  * `YUV` refers to output format {@link AIMAGE_FORMAT_YUV_420_888},
542  * `JPEG` refers to output format {@link AIMAGE_FORMAT_JPEG},
543  * and `RAW` refers to output format {@link AIMAGE_FORMAT_RAW16}
544  *
545  *
546  * <p>For the maximum size column, `PREVIEW` refers to the best size match to the
547  * device's screen resolution, or to 1080p `(1920x1080)`, whichever is
548  * smaller. `RECORD` refers to the camera device's maximum supported recording resolution,
549  * as determined by <a href="http://developer.android.com/reference/android/media/CamcorderProfile.html">
550  * android.media.CamcorderProfiles</a>. And `MAXIMUM` refers to the
551  * camera device's maximum output resolution for that format or target from
552  * {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}.</p>
553  *
554  * <p>To use these tables, determine the number and the formats/targets of outputs needed, and
555  * find the row(s) of the table with those targets. The sizes indicate the maximum set of sizes
556  * that can be used; it is guaranteed that for those targets, the listed sizes and anything
557  * smaller from the list given by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS} can be
558  * successfully used to create a session.  For example, if a row indicates that a 8 megapixel
559  * (MP) YUV_420_888 output can be used together with a 2 MP `PRIV` output, then a session
560  * can be created with targets `[8 MP YUV, 2 MP PRIV]` or targets `[2 MP YUV, 2 MP PRIV]`;
561  * but a session with targets `[8 MP YUV, 4 MP PRIV]`, targets `[4 MP YUV, 4 MP PRIV]`,
562  * or targets `[8 MP PRIV, 2 MP YUV]` would not be guaranteed to work, unless
563  * some other row of the table lists such a combination.</p>
564  *
565  * <p>Legacy devices ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL}
566  * `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY LEGACY}) support at
567  * least the following stream combinations:
568  *
569  * <table>
570  * <tr><th colspan="7">LEGACY-level guaranteed configurations</th></tr>
571  * <tr> <th colspan="2" id="rb">Target 1</th> <th colspan="2" id="rb">Target 2</th>  <th colspan="2" id="rb">Target 3</th> <th rowspan="2">Sample use case(s)</th> </tr>
572  * <tr> <th>Type</th><th id="rb">Max size</th> <th>Type</th><th id="rb">Max size</th> <th>Type</th><th id="rb">Max size</th></tr>
573  * <tr> <td>`PRIV`</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td colspan="2" id="rb"></td> <td>Simple preview, GPU video processing, or no-preview video recording.</td> </tr>
574  * <tr> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td colspan="2" id="rb"></td> <td>No-viewfinder still image capture.</td> </tr>
575  * <tr> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td colspan="2" id="rb"></td> <td>In-application video/image processing.</td> </tr>
576  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td>Standard still imaging.</td> </tr>
577  * <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td>In-app processing plus still capture.</td> </tr>
578  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td colspan="2" id="rb"></td> <td>Standard recording.</td> </tr>
579  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td colspan="2" id="rb"></td> <td>Preview plus in-app processing.</td> </tr>
580  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td>Still capture plus in-app processing.</td> </tr>
581  * </table><br>
582  * </p>
583  *
584  * <p>Limited-level ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL}
585  * `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED}) devices
586  * support at least the following stream combinations in addition to those for
587  * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY LEGACY} devices:
588  *
589  * <table>
590  * <tr><th colspan="7">LIMITED-level additional guaranteed configurations</th></tr>
591  * <tr><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th colspan="2" id="rb">Target 3</th> <th rowspan="2">Sample use case(s)</th> </tr>
592  * <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th></tr>
593  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`RECORD `</td> <td colspan="2" id="rb"></td> <td>High-resolution video recording with preview.</td> </tr>
594  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`RECORD `</td> <td colspan="2" id="rb"></td> <td>High-resolution in-app video processing with preview.</td> </tr>
595  * <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`RECORD `</td> <td colspan="2" id="rb"></td> <td>Two-input in-app video processing.</td> </tr>
596  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`RECORD `</td> <td>`JPEG`</td><td id="rb">`RECORD `</td> <td>High-resolution recording with video snapshot.</td> </tr>
597  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`RECORD `</td> <td>`JPEG`</td><td id="rb">`RECORD `</td> <td>High-resolution in-app processing with video snapshot.</td> </tr>
598  * <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td>Two-input in-app processing with still capture.</td> </tr>
599  * </table><br>
600  * </p>
601  *
602  * <p>FULL-level ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL}
603  * `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL FULL}) devices
604  * support at least the following stream combinations in addition to those for
605  * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED} devices:
606  *
607  * <table>
608  * <tr><th colspan="7">FULL-level additional guaranteed configurations</th></tr>
609  * <tr><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th colspan="2" id="rb">Target 3</th> <th rowspan="2">Sample use case(s)</th> </tr>
610  * <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th> </tr>
611  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td>Maximum-resolution GPU processing with preview.</td> </tr>
612  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td>Maximum-resolution in-app processing with preview.</td> </tr>
613  * <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td>Maximum-resolution two-input in-app processing.</td> </tr>
614  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td>Video recording with maximum-size video snapshot</td> </tr>
615  * <tr> <td>`YUV `</td><td id="rb">`640x480`</td> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td>Standard video recording plus maximum-resolution in-app processing.</td> </tr>
616  * <tr> <td>`YUV `</td><td id="rb">`640x480`</td> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td>Preview plus two-input maximum-resolution in-app processing.</td> </tr>
617  * </table><br>
618  * </p>
619  *
620  * <p>RAW-capability ({@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES} includes
621  * {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}) devices additionally support
622  * at least the following stream combinations on both
623  * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL FULL} and
624  * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED} devices:
625  *
626  * <table>
627  * <tr><th colspan="7">RAW-capability additional guaranteed configurations</th></tr>
628  * <tr><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th colspan="2" id="rb">Target 3</th> <th rowspan="2">Sample use case(s)</th> </tr>
629  * <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th> </tr>
630  * <tr> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td colspan="2" id="rb"></td> <td>No-preview DNG capture.</td> </tr>
631  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td>Standard DNG capture.</td> </tr>
632  * <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td colspan="2" id="rb"></td> <td>In-app processing plus DNG capture.</td> </tr>
633  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td>Video recording with DNG capture.</td> </tr>
634  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td>Preview with in-app processing and DNG capture.</td> </tr>
635  * <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td>Two-input in-app processing plus DNG capture.</td> </tr>
636  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td>Still capture with simultaneous JPEG and DNG.</td> </tr>
637  * <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td>`RAW `</td><td id="rb">`MAXIMUM`</td> <td>In-app processing with simultaneous JPEG and DNG.</td> </tr>
638  * </table><br>
639  * </p>
640  *
641  * <p>BURST-capability ({@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES} includes
642  * {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE BURST_CAPTURE}) devices
643  * support at least the below stream combinations in addition to those for
644  * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED} devices. Note that all
645  * FULL-level devices support the BURST capability, and the below list is a strict subset of the
646  * list for FULL-level devices, so this table is only relevant for LIMITED-level devices that
647  * support the BURST_CAPTURE capability.
648  *
649  * <table>
650  * <tr><th colspan="5">BURST-capability additional guaranteed configurations</th></tr>
651  * <tr><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th rowspan="2">Sample use case(s)</th> </tr>
652  * <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th> </tr>
653  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`MAXIMUM`</td> <td>Maximum-resolution GPU processing with preview.</td> </tr>
654  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td>Maximum-resolution in-app processing with preview.</td> </tr>
655  * <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td>Maximum-resolution two-input in-app processing.</td> </tr>
656  * </table><br>
657  * </p>
658  *
659  * <p>LEVEL-3 ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL}
660  * `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_3 LEVEL_3})
661  * support at least the following stream combinations in addition to the combinations for
662  * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL FULL} and for
663  * RAW capability ({@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES} includes
664  * {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}):
665  *
666  * <table>
667  * <tr><th colspan="11">LEVEL-3 additional guaranteed configurations</th></tr>
668  * <tr><th colspan="2" id="rb">Target 1</th><th colspan="2" id="rb">Target 2</th><th colspan="2" id="rb">Target 3</th><th colspan="2" id="rb">Target 4</th><th rowspan="2">Sample use case(s)</th> </tr>
669  * <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th> </tr>
670  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`640x480`</td> <td>`YUV`</td><td id="rb">`MAXIMUM`</td> <td>`RAW`</td><td id="rb">`MAXIMUM`</td> <td>In-app viewfinder analysis with dynamic selection of output format.</td> </tr>
671  * <tr> <td>`PRIV`</td><td id="rb">`PREVIEW`</td> <td>`PRIV`</td><td id="rb">`640x480`</td> <td>`JPEG`</td><td id="rb">`MAXIMUM`</td> <td>`RAW`</td><td id="rb">`MAXIMUM`</td> <td>In-app viewfinder analysis with dynamic selection of output format.</td> </tr>
672  * </table><br>
673  * </p>
674  *
675  * <p>Since the capabilities of camera devices vary greatly, a given camera device may support
676  * target combinations with sizes outside of these guarantees, but this can only be tested for
677  * by attempting to create a session with such targets.</p>
678  *
679  * <p>Exception on 176x144 (QCIF) resolution:
680  * Camera devices usually have a fixed capability for downscaling from larger resolution to
681  * smaller, and the QCIF resolution sometimes cannot be fully supported due to this
682  * limitation on devices with high-resolution image sensors. Therefore, trying to configure a
683  * QCIF resolution stream together with any other stream larger than 1920x1080 resolution
684  * (either width or height) might not be supported, and capture session creation will fail if it
685  * is not.</p>
686  *
687  * @param device the camera device of interest.
688  * @param outputs the {@link ACaptureSessionOutputContainer} describes all output streams.
689  * @param callbacks the {@link ACameraCaptureSession_stateCallbacks capture session state callbacks}.
690  * @param session the created {@link ACameraCaptureSession} will be filled here if the method call
691  *        succeeds.
692  *
693  * @return <ul>
694  *         <li>{@link ACAMERA_OK} if the method call succeeds. The created capture session will be
695  *                                filled in session argument.</li>
696  *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if any of device, outputs, callbacks or
697  *                                session is NULL or if the outputs does not match the predefined
698  *                                shared session configuration when camera is opened in shared mode.
699  *                                </li>
700  *         <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed.</li>
701  *         <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error.</li>
702  *         <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error.</li>
703  *         <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
704  */
705 camera_status_t ACameraDevice_createCaptureSession(
706         ACameraDevice* device,
707         const ACaptureSessionOutputContainer*       outputs,
708         const ACameraCaptureSession_stateCallbacks* callbacks,
709         /*out*/ACameraCaptureSession** session) __INTRODUCED_IN(24);
710 
711 /**
712  * Create a shared ACaptureSessionOutput object.
713  *
714  * <p>The ACaptureSessionOutput is used in {@link ACaptureSessionOutputContainer_add} method to add
715  * an output {@link ANativeWindow} to ACaptureSessionOutputContainer. Use
716  * {@link ACaptureSessionOutput_free} to free the object and its memory after application no longer
717  * needs the {@link ACaptureSessionOutput}. A shared ACaptureSessionOutput can be further modified
718  * via {@link ACaptureSessionSharedOutput_add} or {@link ACaptureSessionSharedOutput_remove} and
719  * must be updated via {@link ACameraCaptureSession_updateSharedOutput}.</p>
720  *
721  * @param anw the {@link ANativeWindow} to be associated with the {@link ACaptureSessionOutput}
722  * @param output the output {@link ACaptureSessionOutput} will be stored here if the
723  *                  method call succeeds.
724  *
725  * @return <ul>
726  *         <li>{@link ACAMERA_OK} if the method call succeeds. The created container will be
727  *                                filled in the output argument.</li>
728  *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if anw or output is NULL.</li></ul>
729  *
730  * @see ACaptureSessionOutputContainer_add
731  */
732 camera_status_t ACaptureSessionSharedOutput_create(
733         ANativeWindow* anw, /*out*/ACaptureSessionOutput** output) __INTRODUCED_IN(28);
734 
735 /**
736  * Add a native window to shared ACaptureSessionOutput.
737  *
738  * The ACaptureSessionOutput must be created via {@link ACaptureSessionSharedOutput_create}.
739  *
740  * @param output  the shared ACaptureSessionOutput to be extended.
741  * @param anw The new native window.
742  *
743  * @return <ul>
744  *         <li>{@link ACAMERA_OK} if the method call succeeds.</li>
745  *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if anw or output is NULL; or output is not
746  *             shared see {@link ACaptureSessionSharedOutput_create}; or anw matches with the native
747  *             window associated with ACaptureSessionOutput; or anw is already present inside
748  *             ACaptureSessionOutput.</li></ul>
749  */
750 camera_status_t ACaptureSessionSharedOutput_add(ACaptureSessionOutput *output,
751         ANativeWindow *anw) __INTRODUCED_IN(28);
752 
753 /**
754  * Remove a native window from shared ACaptureSessionOutput.
755  *
756  * @param output the {@link ACaptureSessionOutput} to be modified.
757  * @param anw The native window to be removed.
758  *
759  * @return <ul>
760  *         <li>{@link ACAMERA_OK} if the method call succeeds.</li>
761  *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if anw or output is NULL; or output is not
762  *             shared see {@link ACaptureSessionSharedOutput_create}; or anw matches with the native
763  *             window associated with ACaptureSessionOutput; or anw is not present inside
764  *             ACaptureSessionOutput.</li></ul>
765  */
766 camera_status_t ACaptureSessionSharedOutput_remove(ACaptureSessionOutput *output,
767         ANativeWindow* anw) __INTRODUCED_IN(28);
768 
769 /**
770  * Create a new camera capture session similar to {@link ACameraDevice_createCaptureSession}. This
771  * function allows clients to pass additional session parameters during session initialization. For
772  * further information about session parameters see {@link ACAMERA_REQUEST_AVAILABLE_SESSION_KEYS}.
773  *
774  * @param device the camera device of interest.
775  * @param outputs the {@link ACaptureSessionOutputContainer} describes all output streams.
776  * @param sessionParameters An optional capture request that contains the initial values of session
777  *                          parameters advertised in
778  *                          {@link ACAMERA_REQUEST_AVAILABLE_SESSION_KEYS}.
779  * @param callbacks the {@link ACameraCaptureSession_stateCallbacks}
780  *                  capture session state callbacks.
781  * @param session the created {@link ACameraCaptureSession} will be filled here if the method call
782  *                succeeds.
783  *
784  * @return <ul>
785  *         <li>{@link ACAMERA_OK} if the method call succeeds. The created capture session will be
786  *                                filled in session argument.</li>
787  *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if any of device, outputs, callbacks or
788  *                                session is NULL.</li>
789  *         <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed.</li>
790  *         <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error.</li>
791  *         <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error.
792  *         </li>
793  *         <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
794  */
795 camera_status_t ACameraDevice_createCaptureSessionWithSessionParameters(
796         ACameraDevice* device,
797         const ACaptureSessionOutputContainer* outputs,
798         const ACaptureRequest* sessionParameters,
799         const ACameraCaptureSession_stateCallbacks* callbacks,
800         /*out*/ACameraCaptureSession** session) __INTRODUCED_IN(28);
801 
802 /**
803  * Create a ACaptureSessionOutput object used for streaming from a physical
804  * camera as part of a logical camera device.
805  *
806  * <p>The ACaptureSessionOutput is used in {@link ACaptureSessionOutputContainer_add} method to add
807  * an output {@link ANativeWindow} to ACaptureSessionOutputContainer. Use
808  * {@link ACaptureSessionOutput_free} to free the object and its memory after application no longer
809  * needs the {@link ACaptureSessionOutput}.</p>
810  *
811  * @param anw the {@link ANativeWindow} to be associated with the {@link ACaptureSessionOutput}
812  * @param physicalId the Id of the physical camera this output is associated
813  *                  with.
814  * @param output the output {@link ACaptureSessionOutput} will be stored here if the
815  *                  method call succeeds.
816  *
817  * @return <ul>
818  *         <li>{@link ACAMERA_OK} if the method call succeeds. The created container will be
819  *                                filled in the output argument.</li>
820  *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if anw, physicalId or output is NULL.</li></ul>
821  *
822  * @see ACaptureSessionOutputContainer_add
823  */
824 camera_status_t ACaptureSessionPhysicalOutput_create(
825         ANativeWindow* anw, const char* physicalId,
826         /*out*/ACaptureSessionOutput** output) __INTRODUCED_IN(29);
827 
828 /**
829  * Create a logical multi-camera ACaptureRequest for capturing images, initialized with template
830  * for a target use case, with the ability to specify physical camera settings.
831  *
832  * <p>The settings are chosen to be the best options for this camera device,
833  * so it is not recommended to reuse the same request for a different camera device.</p>
834  *
835  * <p>Note that for all keys in physical camera settings, only the keys
836  * advertised in ACAMERA_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS are
837  * applicable. All other keys are ignored by the camera device.</p>
838  *
839  * @param device the camera device of interest
840  * @param templateId the type of capture request to be created.
841  *        See {@link ACameraDevice_request_template}.
842  * @param physicalIdList The list of physical camera Ids that can be used to
843  *        customize the request for a specific physical camera.
844  * @param request the output request will be stored here if the method call succeeds.
845  *
846  * @return <ul>
847  *         <li>{@link ACAMERA_OK} if the method call succeeds. The created capture request will be
848  *                                filled in request argument.</li>
849  *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if device, physicalIdList, or request is
850  *                                NULL, templateId is undefined or camera device does not support
851  *                                requested template, or if some Ids in physicalIdList isn't a
852  *                                valid physical camera backing the current camera device.</li>
853  *         <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed.</li>
854  *         <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error.</li>
855  *         <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error.</li>
856  *         <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
857  *
858  * @see TEMPLATE_PREVIEW
859  * @see TEMPLATE_RECORD
860  * @see TEMPLATE_STILL_CAPTURE
861  * @see TEMPLATE_VIDEO_SNAPSHOT
862  * @see TEMPLATE_MANUAL
863  */
864 camera_status_t ACameraDevice_createCaptureRequest_withPhysicalIds(
865         const ACameraDevice* device, ACameraDevice_request_template templateId,
866         const ACameraIdList* physicalIdList,
867         /*out*/ACaptureRequest** request) __INTRODUCED_IN(29);
868 
869 /**
870  * Check whether a particular {@link ACaptureSessionOutputContainer} is supported by
871  * the camera device.
872  *
873  * <p>This method performs a runtime check of a given {@link
874  * ACaptureSessionOutputContainer}. The result confirms whether or not the
875  * passed CaptureSession outputs can be successfully used to create a camera
876  * capture session using {@link ACameraDevice_createCaptureSession}.</p>
877  *
878  * <p>This method can be called at any point before, during and after active
879  * capture session. It must not impact normal camera behavior in any way and
880  * must complete significantly faster than creating a capture session.</p>
881  *
882  * <p>Although this method is faster than creating a new capture session, it is not intended
883  * to be used for exploring the entire space of supported stream combinations.</p>
884  *
885  * @param device the camera device of interest
886  * @param sessionOutputContainer the {@link ACaptureSessionOutputContainer} of
887  *                               interest.
888  *
889  * @return <ul>
890  *         <li>{@link ACAMERA_OK} if the given {@link ACaptureSessionOutputContainer}
891  *                                is supported by the camera device.</li>
892  *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if device, or sessionOutputContainer
893  *                                                     is NULL.</li>
894  *         <li>{@link ACAMERA_ERROR_STREAM_CONFIGURE_FAIL} if the given
895  *                                                         {@link ACaptureSessionOutputContainer}
896  *                                                         is not supported by
897  *                                                         the camera
898  *                                                         device.</li>
899  *        <li>{@link ACAMERA_ERROR_UNSUPPORTED_OPERATION} if the query operation is not
900  *                                                        supported by the camera device.</li>
901  *        </ul>
902  */
903 camera_status_t ACameraDevice_isSessionConfigurationSupported(
904         const ACameraDevice* device,
905         const ACaptureSessionOutputContainer* sessionOutputContainer) __INTRODUCED_IN(29);
906 
907 __END_DECLS
908 
909 #endif /* _NDK_CAMERA_DEVICE_H */
910 
911 /** @} */
912