10dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh/*
20dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * Copyright (C) 2015 The Android Open Source Project
30dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh *
40dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * Licensed under the Apache License, Version 2.0 (the "License");
50dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * you may not use this file except in compliance with the License.
60dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * You may obtain a copy of the License at
70dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh *
80dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh *      http://www.apache.org/licenses/LICENSE-2.0
90dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh *
100dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * Unless required by applicable law or agreed to in writing, software
110dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * distributed under the License is distributed on an "AS IS" BASIS,
120dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
130dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * See the License for the specific language governing permissions and
140dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * limitations under the License.
150dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh */
160dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
173e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
183e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @addtogroup Camera
193e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @{
203e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
213e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
223e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
233e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @file NdkCameraDevice.h
243e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
253e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
260dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh/*
270dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * This file defines an NDK API.
280dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * Do not remove methods.
290dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * Do not change method signatures.
300dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * Do not change the value of constants.
310dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * Do not change the size of any of the classes defined in here.
320dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * Do not reference types that are not part of the NDK.
330dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh * Do not #include files that aren't part of the NDK.
340dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh */
35d7973ba37cea1a9638ded23041c69774ae8cebbcDan Albert#include <sys/cdefs.h>
360dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
370dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#include <android/native_window.h>
380dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#include "NdkCameraError.h"
390dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#include "NdkCaptureRequest.h"
400dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#include "NdkCameraCaptureSession.h"
410dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
420dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#ifndef _NDK_CAMERA_DEVICE_H
430dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#define _NDK_CAMERA_DEVICE_H
440dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
45d7973ba37cea1a9638ded23041c69774ae8cebbcDan Albert__BEGIN_DECLS
46d7973ba37cea1a9638ded23041c69774ae8cebbcDan Albert
47d7973ba37cea1a9638ded23041c69774ae8cebbcDan Albert#if __ANDROID_API__ >= 24
480dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
493e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
503e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * ACameraDevice is opaque type that provides access to a camera device.
513e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
523e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * A pointer can be obtained using {@link ACameraManager_openCamera} method.
533e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
540dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef struct ACameraDevice ACameraDevice;
550dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
563e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/// Enum for ACameraDevice_ErrorStateCallback error code
573e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yehenum {
583e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
593e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * The camera device is in use already.
603e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
613e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    ERROR_CAMERA_IN_USE = 1,
623e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
633e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
643e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * The system-wide limit for number of open cameras or camera resources has
653e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * been reached, and more camera devices cannot be opened until previous
663e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * instances are closed.
673e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
683e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    ERROR_MAX_CAMERAS_IN_USE = 2,
693e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
703e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
713e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * The camera is disabled due to a device policy, and cannot be opened.
723e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
733e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    ERROR_CAMERA_DISABLED = 3,
743e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
753e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
763e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * The camera device has encountered a fatal error.
773e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>The camera device needs to be re-opened to be used again.</p>
783e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
793e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    ERROR_CAMERA_DEVICE = 4,
803e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
813e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
823e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * The camera service has encountered a fatal error.
833e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>The Android device may need to be shut down and restarted to restore
843e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * camera function, or there may be a persistent hardware problem.
853e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * An attempt at recovery may be possible by closing the
863e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * CameraDevice and the CameraManager, and trying to acquire all resources
873e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * again from scratch.</p>
883e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
893e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    ERROR_CAMERA_SERVICE = 5
903e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh};
913e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
923e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
93be9b8bc0b52bd149cc75f64f1c53a6e43af9faedYin-Chia Yeh * Camera device state callbacks to be used in {@link ACameraDevice_StateCallbacks}.
943e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
95be9b8bc0b52bd149cc75f64f1c53a6e43af9faedYin-Chia Yeh * @param context The optional context in {@link ACameraDevice_StateCallbacks} will be
963e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                passed to this callback.
973e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param device The {@link ACameraDevice} that is being disconnected.
983e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
990dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef void (*ACameraDevice_StateCallback)(void* context, ACameraDevice* device);
1003e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
1013e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
102be9b8bc0b52bd149cc75f64f1c53a6e43af9faedYin-Chia Yeh * Camera device error state callbacks to be used in {@link ACameraDevice_StateCallbacks}.
1033e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
104be9b8bc0b52bd149cc75f64f1c53a6e43af9faedYin-Chia Yeh * @param context The optional context in {@link ACameraDevice_StateCallbacks} will be
1053e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                passed to this callback.
1063e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param device The {@link ACameraDevice} that is being disconnected.
1073e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param error The error code describes the cause of this error callback. See the folowing
1083e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *              links for more detail.
1093e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
1103e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @see ERROR_CAMERA_IN_USE
1113e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @see ERROR_MAX_CAMERAS_IN_USE
1123e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @see ERROR_CAMERA_DISABLED
1133e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @see ERROR_CAMERA_DEVICE
1143e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @see ERROR_CAMERA_SERVICE
1153e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
1160dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef void (*ACameraDevice_ErrorStateCallback)(void* context, ACameraDevice* device, int error);
1170dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
1180dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef struct ACameraDevice_StateCallbacks {
1193e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /// optional application context.
1200dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh    void*                             context;
1213e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
1223e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
1233e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * The function is  called when a camera device is no longer available for use.
1243e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
1253e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>Any attempt to call API methods on this ACameraDevice will return
1263e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link ACAMERA_ERROR_CAMERA_DISCONNECTED}. The disconnection could be due to a
1273e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * change in security policy or permissions; the physical disconnection
1283e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * of a removable camera device; or the camera being needed for a
1293e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * higher-priority camera API client.</p>
1303e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
1313e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>Application should clean up the camera with {@link ACameraDevice_close} after
1323e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * this happens, as it is not recoverable until the camera can be opened
1333e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * again.</p>
1343e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
1353e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
1363e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    ACameraDevice_StateCallback       onDisconnected;
1373e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
1383e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
1393e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * The function called when a camera device has encountered a serious error.
1403e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
1413e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>This indicates a failure of the camera device or camera service in some way.
1423e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * Any attempt to call API methods on this ACameraDevice in the future will return
1433e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link ACAMERA_ERROR_CAMERA_DISCONNECTED}.</p>
1443e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
1453e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>There may still be capture completion or camera stream callbacks that will be called
1463e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * after this error is received.</p>
1473e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
1483e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>Application should clean up the camera with {@link ACameraDevice_close} after this
1493e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * happens. Further attempts at recovery are error-code specific.</p>
1503e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
1513e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
1523e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    ACameraDevice_ErrorStateCallback  onError;
153be9b8bc0b52bd149cc75f64f1c53a6e43af9faedYin-Chia Yeh} ACameraDevice_StateCallbacks;
1540dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
1550dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh/**
1564846b9048bc711dc77ec7ead69e76273fed008e5Yin-Chia Yeh * For backward compatiblity.
1574846b9048bc711dc77ec7ead69e76273fed008e5Yin-Chia Yeh */
1584846b9048bc711dc77ec7ead69e76273fed008e5Yin-Chia Yehtypedef ACameraDevice_StateCallbacks ACameraDevice_stateCallbacks;
1594846b9048bc711dc77ec7ead69e76273fed008e5Yin-Chia Yeh
1604846b9048bc711dc77ec7ead69e76273fed008e5Yin-Chia Yeh/**
1613e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Close the connection and free this ACameraDevice synchronously. Access to the ACameraDevice
1623e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * after calling this method will cause a crash.
1633e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
1643e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>After this call, all calls to the active ACameraCaptureSession associated to this
1653e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * ACameraDevice will return {@link ACAMERA_ERROR_SESSION_CLOSED} except for calls to
1663e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACameraCaptureSession_close}.</p>
1673e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
1683e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>This method will stop all repeating captures sent via
1693e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACameraCaptureSession_setRepeatingRequest} and block until all capture requests sent via
1703e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACameraCaptureSession_capture} is complete. Once the method returns, the camera device
1713e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * will be removed from memory and access to the closed camera device pointer will cause a crash.</p>
1723e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
1733e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param device the camera device to be closed
1743e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
1753e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @return <ul>
1763e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_OK} if the method call succeeds.</li>
1773e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if device is NULL.</li></ul>
1780dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh */
1793e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yehcamera_status_t ACameraDevice_close(ACameraDevice* device);
1800dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
1810dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh/**
1823e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Return the camera id associated with this camera device.
1833e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
1843e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param device the camera device to be closed
1853e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
1863e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @return camera ID string. The returned string is managed by framework and should not be
1873e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * delete/free by the application. Also the returned string must not be used after the device
1883e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * has been closed.
1890dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh */
1903e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yehconst char* ACameraDevice_getId(const ACameraDevice* device);
1910dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
1920dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef enum {
1933e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
1943e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * Create a request suitable for a camera preview window. Specifically, this
1953e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * means that high frame rate is given priority over the highest-quality
1963e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * post-processing. These requests would normally be used with the
1973e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link ACameraCaptureSession_setRepeatingRequest} method.
1983e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This template is guaranteed to be supported on all camera devices.
1993e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2003e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * @see ACameraDevice_createCaptureRequest
2013e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
2020dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh    TEMPLATE_PREVIEW = 1,
2033e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
2043e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
2053e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * Create a request suitable for still image capture. Specifically, this
2063e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * means prioritizing image quality over frame rate. These requests would
2073e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * commonly be used with the {@link ACameraCaptureSession_capture} method.
2083e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This template is guaranteed to be supported on all camera devices.
2093e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2103e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * @see ACameraDevice_createCaptureRequest
2113e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
2123e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    TEMPLATE_STILL_CAPTURE = 2,
2133e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
2143e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
2153e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * Create a request suitable for video recording. Specifically, this means
2163e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * that a stable frame rate is used, and post-processing is set for
2173e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * recording quality. These requests would commonly be used with the
2183e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link ACameraCaptureSession_setRepeatingRequest} method.
2193e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This template is guaranteed to be supported on all camera devices.
2203e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2213e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * @see ACameraDevice_createCaptureRequest
2223e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
2233e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    TEMPLATE_RECORD = 3,
2243e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
2253e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
2263e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * Create a request suitable for still image capture while recording
2273e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * video. Specifically, this means maximizing image quality without
2283e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * disrupting the ongoing recording. These requests would commonly be used
2293e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * with the {@link ACameraCaptureSession_capture} method while a request based on
2303e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link TEMPLATE_RECORD} is is in use with {@link ACameraCaptureSession_setRepeatingRequest}.
2313e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This template is guaranteed to be supported on all camera devices.
2323e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2333e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * @see ACameraDevice_createCaptureRequest
2343e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
2353e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    TEMPLATE_VIDEO_SNAPSHOT = 4,
2363e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
2373e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
2383e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * Create a request suitable for zero shutter lag still capture. This means
2393e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * means maximizing image quality without compromising preview frame rate.
2403e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * AE/AWB/AF should be on auto mode.
2413e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2423e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * @see ACameraDevice_createCaptureRequest
2433e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
2443e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    TEMPLATE_ZERO_SHUTTER_LAG = 5,
2453e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
2463e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
2473e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * A basic template for direct application control of capture
2483e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * parameters. All automatic control is disabled (auto-exposure, auto-white
2493e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * balance, auto-focus), and post-processing parameters are set to preview
2503e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * quality. The manual capture parameters (exposure, sensitivity, and so on)
2513e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * are set to reasonable defaults, but should be overriden by the
2523e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * application depending on the intended use case.
2533e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This template is guaranteed to be supported on camera devices that support the
2543e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR} capability.
2553e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2563e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * @see ACameraDevice_createCaptureRequest
2573e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
2583e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    TEMPLATE_MANUAL = 6,
259aa3cced06116c0160f5e84ed70f88e8cc8a2bc29Eino-Ville Talvala
2600dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh} ACameraDevice_request_template;
2610dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
2620dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh/**
2633e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Create a ACaptureRequest for capturing images, initialized with template
2643e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * for a target use case.
2653e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
2663e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>The settings are chosen to be the best options for this camera device,
2673e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * so it is not recommended to reuse the same request for a different camera device.</p>
2683e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
2693e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param device the camera device of interest
2703e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param templateId the type of capture request to be created.
2713e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *        See {@link ACameraDevice_request_template}.
2723e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param request the output request will be stored here if the method call succeeds.
2733e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
2743e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @return <ul>
2753e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_OK} if the method call succeeds. The created capture request will be
2763e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                                filled in request argument.</li>
277a22528a9fac1763810d21b899e1b8c7977ea224cYin-Chia Yeh *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if device or request is NULL, templateId
278a22528a9fac1763810d21b899e1b8c7977ea224cYin-Chia Yeh *                                is undefined or camera device does not support requested template.
279a22528a9fac1763810d21b899e1b8c7977ea224cYin-Chia Yeh *                                </li>
2803e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed.</li>
2813e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error.</li>
2823e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error.</li>
2833e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
2843e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
2853e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @see TEMPLATE_PREVIEW
2863e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @see TEMPLATE_RECORD
2873e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @see TEMPLATE_STILL_CAPTURE
2883e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @see TEMPLATE_VIDEO_SNAPSHOT
2893e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @see TEMPLATE_MANUAL
2900dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh */
2910dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehcamera_status_t ACameraDevice_createCaptureRequest(
2923e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh        const ACameraDevice* device, ACameraDevice_request_template templateId,
2933e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh        /*out*/ACaptureRequest** request);
2943e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
2950dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
2960dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef struct ACaptureSessionOutputContainer ACaptureSessionOutputContainer;
2970dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
2980dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef struct ACaptureSessionOutput ACaptureSessionOutput;
2990dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
3003e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
3013e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Create a capture session output container.
3023e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3033e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>The container is used in {@link ACameraDevice_createCaptureSession} method to create a capture
3043e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * session. Use {@link ACaptureSessionOutputContainer_free} to free the container and its memory
3053e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * after application no longer needs the ACaptureSessionOutputContainer.</p>
3063e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3073e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param container the output {@link ACaptureSessionOutputContainer} will be stored here if the
3083e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                  method call succeeds.
3093e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3103e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @return <ul>
3113e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_OK} if the method call succeeds. The created container will be
3123e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                                filled in container argument.</li>
3133e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if container is NULL.</li></ul>
3143e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
3153e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yehcamera_status_t ACaptureSessionOutputContainer_create(
3163e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh        /*out*/ACaptureSessionOutputContainer** container);
3173e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
3183e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
3193e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Free a capture session output container.
3203e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3213e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param container the {@link ACaptureSessionOutputContainer} to be freed.
3223e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3233e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @see ACaptureSessionOutputContainer_create
3243e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
3253e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yehvoid            ACaptureSessionOutputContainer_free(ACaptureSessionOutputContainer* container);
3263e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
3273e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
3283e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Create a ACaptureSessionOutput object.
3293e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3303e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>The ACaptureSessionOutput is used in {@link ACaptureSessionOutputContainer_add} method to add
3313e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * an output {@link ANativeWindow} to ACaptureSessionOutputContainer. Use
3323e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACaptureSessionOutput_free} to free the object and its memory after application no longer
3333e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * needs the {@link ACaptureSessionOutput}.</p>
3343e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3353e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param anw the {@link ANativeWindow} to be associated with the {@link ACaptureSessionOutput}
3363e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param output the output {@link ACaptureSessionOutput} will be stored here if the
3373e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                  method call succeeds.
3383e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3393e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @return <ul>
3403e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_OK} if the method call succeeds. The created container will be
3413e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                                filled in the output argument.</li>
3423e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if anw or output is NULL.</li></ul>
3433e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3443e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @see ACaptureSessionOutputContainer_add
3453e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
3463e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yehcamera_status_t ACaptureSessionOutput_create(
3473e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh        ANativeWindow* anw, /*out*/ACaptureSessionOutput** output);
3480dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
3493e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
3503e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Free a ACaptureSessionOutput object.
3513e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3523e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param output the {@link ACaptureSessionOutput} to be freed.
3533e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3543e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @see ACaptureSessionOutput_create
3553e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
3563e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yehvoid            ACaptureSessionOutput_free(ACaptureSessionOutput* output);
3570dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
3583e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
3593e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Add an {@link ACaptureSessionOutput} object to {@link ACaptureSessionOutputContainer}.
3603e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3613e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param container the {@link ACaptureSessionOutputContainer} of interest.
3623e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param output the output {@link ACaptureSessionOutput} to be added to container.
3633e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3643e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @return <ul>
3653e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_OK} if the method call succeeds.</li>
3663e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if container or output is NULL.</li></ul>
3673e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
3680dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehcamera_status_t ACaptureSessionOutputContainer_add(
3693e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh        ACaptureSessionOutputContainer* container, const ACaptureSessionOutput* output);
3703e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
3713e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
3723e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Remove an {@link ACaptureSessionOutput} object from {@link ACaptureSessionOutputContainer}.
3733e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3743e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>This method has no effect if the ACaptureSessionOutput does not exist in
3753e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * ACaptureSessionOutputContainer.</p>
3763e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3773e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param container the {@link ACaptureSessionOutputContainer} of interest.
3783e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param output the output {@link ACaptureSessionOutput} to be removed from container.
3793e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3803e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @return <ul>
3813e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_OK} if the method call succeeds.</li>
3823e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if container or output is NULL.</li></ul>
3833e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
3840dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehcamera_status_t ACaptureSessionOutputContainer_remove(
3853e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh        ACaptureSessionOutputContainer* container, const ACaptureSessionOutput* output);
3860dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
3873e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
3883e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Create a new camera capture session by providing the target output set of {@link ANativeWindow}
3893e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * to the camera device.
3903e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3913e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>If there is a preexisting session, the previous session will be closed
3923e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * automatically. However, app still needs to call {@link ACameraCaptureSession_close} on previous
3933e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * session. Otherwise the resources held by previous session will NOT be freed.</p>
3943e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3953e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>The active capture session determines the set of potential output {@link ANativeWindow}s for
3963e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * the camera device for each capture request. A given request may use all
3973e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * or only some of the outputs. Once the ACameraCaptureSession is created, requests can be
3983e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * submitted with {@link ACameraCaptureSession_capture} or
3993e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACameraCaptureSession_setRepeatingRequest}.</p>
4003e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4013e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>Often the {@link ANativeWindow} used with this method can be obtained from a <a href=
4023e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * "http://developer.android.com/reference/android/view/Surface.html">Surface</a> java object by
4033e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ANativeWindow_fromSurface} NDK method. Surfaces or ANativeWindow suitable for inclusion as a camera
4043e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * output can be created for various use cases and targets:</p>
4053e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4063e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <ul>
4073e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4083e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <li>For drawing to a
4093e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   <a href="http://developer.android.com/reference/android/view/SurfaceView.html">SurfaceView</a>:
4103e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   Once the SurfaceView's Surface is created, set the size
4113e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   of the Surface with
4123e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   <a href="http://developer.android.com/reference/android/view/SurfaceHolder.html#setFixedSize(int, int)">
4133e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *    android.view.SurfaceHolder\#setFixedSize</a> to be one of the PRIVATE output sizes
4143e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   returned by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}
4153e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   and then obtain the Surface by calling <a href=
4163e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   "http://developer.android.com/reference/android/view/SurfaceHolder.html#getSurface()">
4173e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   android.view.SurfaceHolder\#getSurface</a>. If the size is not set by the application, it will
4183e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   be rounded to the nearest supported size less than 1080p, by the camera device.</li>
4193e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4203e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <li>For accessing through an OpenGL texture via a <a href=
4213e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   "http://developer.android.com/reference/android/graphics/SurfaceTexture.html">SurfaceTexture</a>:
4223e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   Set the size of the SurfaceTexture with <a href=
4233e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   "http://developer.android.com/reference/android/graphics/SurfaceTexture.html#setDefaultBufferSize(int, int)">
4243e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   setDefaultBufferSize</a> to be one of the PRIVATE output sizes
4253e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   returned by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}
4263e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   before creating a Surface from the SurfaceTexture with <a href=
4273e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   "http://developer.android.com/reference/android/view/Surface.html#Surface(android.graphics.SurfaceTexture)">
4283e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   Surface\#Surface(SurfaceTextrue)</a>. If the size is not set by the application, it will be set to be the
4293e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   smallest supported size less than 1080p, by the camera device.</li>
4303e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4313e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <li>For recording with <a href=
4323e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *     "http://developer.android.com/reference/android/media/MediaCodec.html">
4333e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *     MediaCodec</a>: Call
4343e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   <a href=
4353e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *     "http://developer.android.com/reference/android/media/MediaCodec.html#createInputSurface()">
4363e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *     android.media.MediaCodec\#createInputSurface</a> after configuring
4373e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   the media codec to use one of the PRIVATE output sizes
4383e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   returned by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}.
4393e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   </li>
4403e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4413e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <li>For recording with <a href=
4423e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *    "http://developer.android.com/reference/android/media/MediaRecorder.html">
4433e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *    MediaRecorder</a>: Call
4443e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   <a href="http://developer.android.com/reference/android/media/MediaRecorder.html#getSurface()">
4453e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *    android.media.MediaRecorder\#getSurface</a> after configuring the media recorder to use
4463e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   one of the PRIVATE output sizes returned by
4473e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}, or configuring it to use one of the supported
4483e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   <a href="http://developer.android.com/reference/android/media/CamcorderProfile.html">
4493e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *    CamcorderProfiles</a>.</li>
4503e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4513e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <li>For efficient YUV processing with <a href=
4523e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   "http://developer.android.com/reference/android/renderscript/package-summary.html">
4533e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   RenderScript</a>:
4543e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   Create a RenderScript
4553e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   <a href="http://developer.android.com/reference/android/renderscript/Allocation.html">
4563e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   Allocation</a> with a supported YUV
4573e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   type, the IO_INPUT flag, and one of the YUV output sizes returned by
4583e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS},
4593e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   Then obtain the Surface with
4603e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   <a href="http://developer.android.com/reference/android/renderscript/Allocation.html#getSurface()">
4613e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   Allocation#getSurface}</a>.</li>
4623e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4633e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <li>For access to RAW, uncompressed YUV, or compressed JPEG data in the application: Create an
4643e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   {@link AImageReader} object using the {@link AImageReader_new} method with one of the supported
4653e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   output formats given by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}. Then obtain a
4663e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   ANativeWindow from it with {@link AImageReader_getWindow}.
4673e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   If the AImageReader size is not set to a supported size, it will be rounded to a supported
4683e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   size less than 1080p by the camera device.
4693e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *   </li>
4703e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4713e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * </ul>
4723e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4733e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>The camera device will query each ANativeWindow's size and formats upon this
4743e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * call, so they must be set to a valid setting at this time.</p>
4753e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4763e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>It can take several hundred milliseconds for the session's configuration to complete,
4773e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * since camera hardware may need to be powered on or reconfigured.</p>
4783e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4793e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>If a prior ACameraCaptureSession already exists when this method is called, the previous
4803e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * session will no longer be able to accept new capture requests and will be closed. Any
4813e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * in-progress capture requests made on the prior session will be completed before it's closed.
4823e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * To minimize the transition time,
4833e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * the ACameraCaptureSession_abortCaptures method can be used to discard the remaining
4843e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * requests for the prior capture session before a new one is created. Note that once the new
4853e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * session is created, the old one can no longer have its captures aborted.</p>
4863e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4873e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>Using larger resolution outputs, or more outputs, can result in slower
4883e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * output rate from the device.</p>
4893e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4903e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>Configuring a session with an empty list will close the current session, if
4913e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * any. This can be used to release the current session's target surfaces for another use.</p>
4923e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4933e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>While any of the sizes from {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS} can be used when
4943e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * a single output stream is configured, a given camera device may not be able to support all
4953e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * combination of sizes, formats, and targets when multiple outputs are configured at once.  The
4963e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * tables below list the maximum guaranteed resolutions for combinations of streams and targets,
4973e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * given the capabilities of the camera device.</p>
4983e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4993e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>If an application tries to create a session using a set of targets that exceed the limits
5003e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * described in the below tables, one of three possibilities may occur. First, the session may
5013e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * be successfully created and work normally. Second, the session may be successfully created,
5023e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * but the camera device won't meet the frame rate guarantees as described in
5033e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACAMERA_SCALER_AVAILABLE_MIN_FRAME_DURATIONS}. Or third, if the output set
5043e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * cannot be used at all, session creation will fail entirely, with
5053e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACAMERA_ERROR_STREAM_CONFIGURE_FAIL} being returned.</p>
5063e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5073e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>For the type column `PRIV` refers to output format {@link AIMAGE_FORMAT_PRIVATE},
5083e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * `YUV` refers to output format {@link AIMAGE_FORMAT_YUV_420_888},
5093e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * `JPEG` refers to output format {@link AIMAGE_FORMAT_JPEG},
5103e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * and `RAW` refers to output format {@link AIMAGE_FORMAT_RAW16}
5113e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5123e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5133e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>For the maximum size column, `PREVIEW` refers to the best size match to the
5143e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * device's screen resolution, or to 1080p `(1920x1080)`, whichever is
5153e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * smaller. `RECORD` refers to the camera device's maximum supported recording resolution,
5163e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * as determined by <a href="http://developer.android.com/reference/android/media/CamcorderProfile.html">
5173e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * android.media.CamcorderProfiles</a>. And `MAXIMUM` refers to the
5183e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * camera device's maximum output resolution for that format or target from
5193e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS}.</p>
5203e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5213e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>To use these tables, determine the number and the formats/targets of outputs needed, and
5223e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * find the row(s) of the table with those targets. The sizes indicate the maximum set of sizes
5233e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * that can be used; it is guaranteed that for those targets, the listed sizes and anything
5243e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * smaller from the list given by {@link ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS} can be
5253e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * successfully used to create a session.  For example, if a row indicates that a 8 megapixel
5263e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * (MP) YUV_420_888 output can be used together with a 2 MP `PRIV` output, then a session
5273e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * can be created with targets `[8 MP YUV, 2 MP PRIV]` or targets `[2 MP YUV, 2 MP PRIV]`;
5283e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * but a session with targets `[8 MP YUV, 4 MP PRIV]`, targets `[4 MP YUV, 4 MP PRIV]`,
5293e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * or targets `[8 MP PRIV, 2 MP YUV]` would not be guaranteed to work, unless
5303e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * some other row of the table lists such a combination.</p>
5313e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5323e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>Legacy devices ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL}
5333e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY LEGACY}) support at
5343e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * least the following stream combinations:
5353e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5363e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <table>
5373e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <tr><th colspan="7">LEGACY-level guaranteed configurations</th></tr>
5383e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5393e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5403e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5413e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5423e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5433e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5443e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5453e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5463e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5473e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5483e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * </table><br>
5493e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * </p>
5503e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5513e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>Limited-level ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL}
5523e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED}) devices
5533e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * support at least the following stream combinations in addition to those for
5543e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY LEGACY} devices:
5553e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5563e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <table>
5573e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <tr><th colspan="7">LIMITED-level additional guaranteed configurations</th></tr>
5583e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5593e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5603e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5613e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5623e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5633e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5643e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5653e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5663e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * </table><br>
5673e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * </p>
5683e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5693e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>FULL-level ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL}
5703e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL FULL}) devices
5713e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * support at least the following stream combinations in addition to those for
5723e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED} devices:
5733e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5743e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <table>
5753e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <tr><th colspan="7">FULL-level additional guaranteed configurations</th></tr>
5763e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5773e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5783e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5793e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5803e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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 processsing.</td> </tr>
5813e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5823e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5833e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5843e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * </table><br>
5853e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * </p>
5863e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5873e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>RAW-capability ({@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES} includes
5883e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}) devices additionally support
5893e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * at least the following stream combinations on both
5903e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL FULL} and
5913e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED} devices:
5923e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5933e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <table>
5943e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <tr><th colspan="7">RAW-capability additional guaranteed configurations</th></tr>
5953e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5963e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5973e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5983e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
5993e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
6003e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
6013e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
6023e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
6033e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
6043e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
6053e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * </table><br>
6063e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * </p>
6073e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
6083e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>BURST-capability ({@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES} includes
6093e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE BURST_CAPTURE}) devices
6103e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * support at least the below stream combinations in addition to those for
6113e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED LIMITED} devices. Note that all
6123e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * FULL-level devices support the BURST capability, and the below list is a strict subset of the
6133e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * list for FULL-level devices, so this table is only relevant for LIMITED-level devices that
6143e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * support the BURST_CAPTURE capability.
6153e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
6163e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <table>
6173e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <tr><th colspan="5">BURST-capability additional guaranteed configurations</th></tr>
6183e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
6193e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <tr><th>Type</th><th id="rb">Max size</th><th>Type</th><th id="rb">Max size</th> </tr>
6203e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
6213e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
6223e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <tr> <td>`YUV `</td><td id="rb">`PREVIEW`</td> <td>`YUV `</td><td id="rb">`MAXIMUM`</td> <td>Maximum-resolution two-input in-app processsing.</td> </tr>
6233e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * </table><br>
6243e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * </p>
6253e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
6263e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>LEVEL-3 ({@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL}
6273e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * `== `{@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_3 LEVEL_3})
6283e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * support at least the following stream combinations in addition to the combinations for
6293e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACAMERA_INFO_SUPPORTED_HARDWARE_LEVEL_FULL FULL} and for
6303e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * RAW capability ({@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES} includes
6313e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_RAW RAW}):
6323e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
6333e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <table>
6343e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <tr><th colspan="11">LEVEL-3 additional guaranteed configurations</th></tr>
6353e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
6363e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
6373e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
6383e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <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>
6393e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * </table><br>
6403e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * </p>
6413e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
6423e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>Since the capabilities of camera devices vary greatly, a given camera device may support
6433e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * target combinations with sizes outside of these guarantees, but this can only be tested for
6443e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * by attempting to create a session with such targets.</p>
6453e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
6463e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param device the camera device of interest.
6473e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param outputs the {@link ACaptureSessionOutputContainer} describes all output streams.
6483e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param callbacks the {@link ACameraCaptureSession_stateCallbacks capture session state callbacks}.
6493e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param session the created {@link ACameraCaptureSession} will be filled here if the method call
6503e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *        succeeds.
6513e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
6523e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @return <ul>
6533e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_OK} if the method call succeeds. The created capture session will be
6543e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                                filled in session argument.</li>
6553e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if any of device, outputs, callbacks or
6563e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                                session is NULL.</li>
6573e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed.</li>
6583e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error.</li>
6593e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error.</li>
6603e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
661ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh */
6620dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehcamera_status_t ACameraDevice_createCaptureSession(
6633e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh        ACameraDevice* device,
6640dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh        const ACaptureSessionOutputContainer*       outputs,
665ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh        const ACameraCaptureSession_stateCallbacks* callbacks,
666ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh        /*out*/ACameraCaptureSession** session);
6670dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
668d7973ba37cea1a9638ded23041c69774ae8cebbcDan Albert#endif /* __ANDROID_API__ >= 24 */
669d7973ba37cea1a9638ded23041c69774ae8cebbcDan Albert
67040ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev#if __ANDROID_API__ >= 28
67140ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev
67240ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev/**
67340ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * Create a shared ACaptureSessionOutput object.
67440ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *
67540ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * <p>The ACaptureSessionOutput is used in {@link ACaptureSessionOutputContainer_add} method to add
67640ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * an output {@link ANativeWindow} to ACaptureSessionOutputContainer. Use
67740ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * {@link ACaptureSessionOutput_free} to free the object and its memory after application no longer
67840ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * needs the {@link ACaptureSessionOutput}. A shared ACaptureSessionOutput can be further modified
67940ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * via {@link ACaptureSessionSharedOutput_add} or {@link ACaptureSessionSharedOutput_remove} and
68040ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * must be updated via {@link ACameraCaptureSession_updateSharedOutput}.</p>
68140ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *
68240ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * @param anw the {@link ANativeWindow} to be associated with the {@link ACaptureSessionOutput}
68340ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * @param output the output {@link ACaptureSessionOutput} will be stored here if the
68440ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *                  method call succeeds.
68540ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *
68640ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * @return <ul>
68740ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *         <li>{@link ACAMERA_OK} if the method call succeeds. The created container will be
68840ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *                                filled in the output argument.</li>
68940ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if anw or output is NULL.</li></ul>
69040ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *
69140ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * @see ACaptureSessionOutputContainer_add
69240ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev */
69340ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peevcamera_status_t ACaptureSessionSharedOutput_create(
69440ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev        ANativeWindow* anw, /*out*/ACaptureSessionOutput** output);
69540ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev
69640ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev/**
69740ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * Add a native window to shared ACaptureSessionOutput.
69840ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *
69940ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * The ACaptureSessionOutput must be created via {@link ACaptureSessionSharedOutput_create}.
70040ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *
70140ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * @param output  the shared ACaptureSessionOutput to be extended.
70240ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * @param anw The new native window.
70340ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *
70440ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * @return <ul>
70540ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *         <li>{@link ACAMERA_OK} if the method call succeeds.</li>
70640ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if anw or output is NULL; or output is not
70740ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *             shared see {@link ACaptureSessionSharedOutput_create}; or anw matches with the native
70840ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *             window associated with ACaptureSessionOutput; or anw is already present inside
70940ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *             ACaptureSessionOutput.</li></ul>
71040ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev */
71140ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peevcamera_status_t ACaptureSessionSharedOutput_add(ACaptureSessionOutput *output, ANativeWindow *anw);
71240ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev
71340ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev/**
71440ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * Remove a native window from shared ACaptureSessionOutput.
71540ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *
71640ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * @param output the {@link ACaptureSessionOutput} to be modified.
71740ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * @param anw The native window to be removed.
71840ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *
71940ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev * @return <ul>
72040ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *         <li>{@link ACAMERA_OK} if the method call succeeds.</li>
72140ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if anw or output is NULL; or output is not
72240ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *             shared see {@link ACaptureSessionSharedOutput_create}; or anw matches with the native
72340ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *             window associated with ACaptureSessionOutput; or anw is not present inside
72440ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev *             ACaptureSessionOutput.</li></ul>
72540ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev */
72640ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peevcamera_status_t ACaptureSessionSharedOutput_remove(ACaptureSessionOutput *output,
72740ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev        ANativeWindow* anw);
72840ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev
7295fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev/**
7305fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev * Create a new camera capture session similar to {@link ACameraDevice_createCaptureSession}. This
7315fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev * function allows clients to pass additional session parameters during session initialization. For
7325fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev * further information about session parameters see {@link ACAMERA_REQUEST_AVAILABLE_SESSION_KEYS}.
7335fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *
7345fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev * @param device the camera device of interest.
7355fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev * @param outputs the {@link ACaptureSessionOutputContainer} describes all output streams.
7365fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev * @param sessionParameters An optional capture request that contains the initial values of session
7375fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *                          parameters advertised in
7385fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *                          {@link ACAMERA_REQUEST_AVAILABLE_SESSION_KEYS}.
7395fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev * @param callbacks the {@link ACameraCaptureSession_stateCallbacks}
7405fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *                  capture session state callbacks.
7415fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev * @param session the created {@link ACameraCaptureSession} will be filled here if the method call
7425fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *                succeeds.
7435fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *
7445fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev * @return <ul>
7455fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *         <li>{@link ACAMERA_OK} if the method call succeeds. The created capture session will be
7465fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *                                filled in session argument.</li>
7475fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if any of device, outputs, callbacks or
7485fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *                                session is NULL.</li>
7495fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *         <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed.</li>
7505fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *         <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error.</li>
7515fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *         <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error.
7525fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *         </li>
7535fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev *         <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
7545fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev */
7555fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peevcamera_status_t ACameraDevice_createCaptureSessionWithSessionParameters(
7565fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev        ACameraDevice* device,
7575fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev        const ACaptureSessionOutputContainer* outputs,
7585fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev        const ACaptureRequest* sessionParameters,
7595fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev        const ACameraCaptureSession_stateCallbacks* callbacks,
7605fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev        /*out*/ACameraCaptureSession** session);
7615fbe0ba24d88910e68610add74fd1e1b94d282b5Emilian Peev
76240ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev#endif /* __ANDROID_API__ >= 28 */
76340ead60d7163c2d5577099d49f11da7afa6124d1Emilian Peev
764d7973ba37cea1a9638ded23041c69774ae8cebbcDan Albert__END_DECLS
7650dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
766d7973ba37cea1a9638ded23041c69774ae8cebbcDan Albert#endif /* _NDK_CAMERA_DEVICE_H */
7673e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
7683e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/** @} */
769