[go: nahoru, domu]

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 NdkCameraCaptureSession.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 */
35e081c59aeb309f5d91b99c433fc252e4570d4db8Yin-Chia Yeh#include <android/native_window.h>
360dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#include "NdkCameraError.h"
370dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#include "NdkCameraMetadata.h"
380dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
390dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#ifndef _NDK_CAMERA_CAPTURE_SESSION_H
400dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#define _NDK_CAMERA_CAPTURE_SESSION_H
410dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
420dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#ifdef __cplusplus
430dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehextern "C" {
440dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#endif
450dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
463e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
473e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * ACameraCaptureSession is an opaque type that manages frame captures of a camera device.
483e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
493e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * A pointer can be obtained using {@link ACameraDevice_createCaptureSession} method.
503e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
510dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef struct ACameraCaptureSession ACameraCaptureSession;
520dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
533e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
543e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * The definition of camera capture session state callback.
553e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
563e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param context The optional application context provided by user in
573e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                {@link ACameraCaptureSession_stateCallbacks}.
583e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param session The camera capture session whose state is changing.
593e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
600dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef void (*ACameraCaptureSession_stateCallback)(void* context, ACameraCaptureSession *session);
610dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
620dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef struct ACameraCaptureSession_stateCallbacks {
633e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /// optional application context.
640dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh    void*                               context;
653e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
663e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
673e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This callback is called when the session is closed and deleted from memory.
683e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
693e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>A session is closed when {@link ACameraCaptureSession_close} is called, a new session
703e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * is created by the parent camera device,
713e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * or when the parent camera device is closed (either by the user closing the device,
723e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * or due to a camera device disconnection or fatal error).</p>
733e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
743e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>Once this callback is called, all access to this ACameraCaptureSession object will cause
753e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * a crash.</p>
763e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
773e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    ACameraCaptureSession_stateCallback onClosed;
783e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
793e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
803e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This callback is called every time the session has no more capture requests to process.
813e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
823e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>This callback will be invoked any time the session finishes processing
833e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * all of its active capture requests, and no repeating request or burst is set up.</p>
843e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
850dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh    ACameraCaptureSession_stateCallback onReady;
863e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
873e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
883e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This callback is called when the session starts actively processing capture requests.
893e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
903e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>If the session runs out of capture requests to process and calls {@link onReady},
913e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * then this callback will be invoked again once new requests are submitted for capture.</p>
923e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
930dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh    ACameraCaptureSession_stateCallback onActive;
940dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh} ACameraCaptureSession_stateCallbacks;
950dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
963e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/// Enum for describing error reason in {@link ACameraCaptureFailure}
97ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yehenum {
983e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
993e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * The capture session has dropped this frame due to an
1003e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link ACameraCaptureSession_abortCaptures} call.
1013e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
102ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh    CAPTURE_FAILURE_REASON_FLUSHED = 0,
1033e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
1043e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
1053e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * The capture session has dropped this frame due to an error in the framework.
1063e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
107ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh    CAPTURE_FAILURE_REASON_ERROR
108ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh};
109ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh
1103e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/// Struct to describe a capture failure
1110dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef struct ACameraCaptureFailure {
1123e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
1133e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * The frame number associated with this failed capture.
1143e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
1153e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>Whenever a request has been processed, regardless of failed capture or success,
1163e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * it gets a unique frame number assigned to its future result/failed capture.</p>
1173e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
1183e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>This value monotonically increments, starting with 0,
1193e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * for every new result or failure; and the scope is the lifetime of the
1203e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link ACameraDevice}.</p>
1213e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
122ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh    int64_t frameNumber;
1233e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
1243e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
1253e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * Determine why the request was dropped, whether due to an error or to a user
1263e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * action.
1273e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
1283e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * @see CAPTURE_FAILURE_REASON_ERROR
1293e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * @see CAPTURE_FAILURE_REASON_FLUSHED
1303e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
131ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh    int     reason;
1323e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
1333e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
1343e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * The sequence ID for this failed capture that was returned by the
1353e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link ACameraCaptureSession_capture} or {@link ACameraCaptureSession_setRepeatingRequest}.
1363e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
1373e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>The sequence ID is a unique monotonically increasing value starting from 0,
1383e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * incremented every time a new group of requests is submitted to the ACameraDevice.</p>
1393e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
140ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh    int     sequenceId;
1413e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
1423e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
1433e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * Determine if the image was captured from the camera.
1443e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
1453e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>If the image was not captured, no image buffers will be available.
1463e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * If the image was captured, then image buffers may be available.</p>
1473e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
1483e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
149ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh    bool    wasImageCaptured;
1500dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh} ACameraCaptureFailure;
1510dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
1523e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
1533e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * The definition of camera capture start callback.
1543e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
1553e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param context The optional application context provided by user in
1563e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                {@link ACameraCaptureSession_captureCallbacks}.
1573e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param session The camera capture session of interest.
1583e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param request The capture request that is starting. Note that this pointer points to a copy of
1593e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                capture request sent by application, so the address is different to what
1603e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                application sent but the content will match. This request will be freed by
1613e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                framework immediately after this callback returns.
1623e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param timestamp The timestamp when the capture is started. This timestmap will match
1633e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                  {@link ACAMERA_SENSOR_TIMESTAMP} of the {@link ACameraMetadata} in
1643e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                  {@link ACameraCaptureSession_captureCallbacks#onCaptureCompleted} callback.
1653e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
1660dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef void (*ACameraCaptureSession_captureCallback_start)(
1670dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh        void* context, ACameraCaptureSession* session,
168ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh        const ACaptureRequest* request, int64_t timestamp);
1690dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
1703e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
1713e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * The definition of camera capture progress/result callback.
1723e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
1733e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param context The optional application context provided by user in
1743e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                {@link ACameraCaptureSession_captureCallbacks}.
1753e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param session The camera capture session of interest.
1763e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param request The capture request of interest. Note that this pointer points to a copy of
1773e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                capture request sent by application, so the address is different to what
1783e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                application sent but the content will match. This request will be freed by
1793e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                framework immediately after this callback returns.
1801d0955cb5257a59f0ae435fefe26c05af4f4fbb6Yin-Chia Yeh * @param result The capture result metadata reported by camera device. The memory is managed by
1811d0955cb5257a59f0ae435fefe26c05af4f4fbb6Yin-Chia Yeh *                camera framework. Do not access this pointer after this callback returns.
1823e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
1830dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef void (*ACameraCaptureSession_captureCallback_result)(
1840dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh        void* context, ACameraCaptureSession* session,
185ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh        ACaptureRequest* request, const ACameraMetadata* result);
1860dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
1873e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
1883e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * The definition of camera capture failure callback.
1893e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
1903e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param context The optional application context provided by user in
1913e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                {@link ACameraCaptureSession_captureCallbacks}.
1923e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param session The camera capture session of interest.
1933e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param request The capture request of interest. Note that this pointer points to a copy of
1943e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                capture request sent by application, so the address is different to what
1953e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                application sent but the content will match. This request will be freed by
1963e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                framework immediately after this callback returns.
1971d0955cb5257a59f0ae435fefe26c05af4f4fbb6Yin-Chia Yeh * @param failure The {@link ACameraCaptureFailure} desribes the capture failure. The memory is
1981d0955cb5257a59f0ae435fefe26c05af4f4fbb6Yin-Chia Yeh *                managed by camera framework. Do not access this pointer after this callback
1991d0955cb5257a59f0ae435fefe26c05af4f4fbb6Yin-Chia Yeh *                returns.
2003e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
2010dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef void (*ACameraCaptureSession_captureCallback_failed)(
2020dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh        void* context, ACameraCaptureSession* session,
2030dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh        ACaptureRequest* request, ACameraCaptureFailure* failure);
2040dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
2053e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
2063e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * The definition of camera sequence end callback.
2073e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
2083e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param context The optional application context provided by user in
2093e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                {@link ACameraCaptureSession_captureCallbacks}.
2103e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param session The camera capture session of interest.
2113e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param sequenceId The capture sequence ID of the finished sequence.
2123e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param frameNumber The frame number of the last frame of this sequence.
2133e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
2140dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef void (*ACameraCaptureSession_captureCallback_sequenceEnd)(
2150dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh        void* context, ACameraCaptureSession* session,
216ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh        int sequenceId, int64_t frameNumber);
217ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh
2183e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
2193e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * The definition of camera sequence aborted callback.
2203e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
2213e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param context The optional application context provided by user in
2223e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                {@link ACameraCaptureSession_captureCallbacks}.
2233e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param session The camera capture session of interest.
2243e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param sequenceId The capture sequence ID of the aborted sequence.
2253e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
226ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yehtypedef void (*ACameraCaptureSession_captureCallback_sequenceAbort)(
227ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh        void* context, ACameraCaptureSession* session,
228ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh        int sequenceId);
2290dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
2303e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
2313e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * The definition of camera buffer lost callback.
2323e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
2333e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param context The optional application context provided by user in
2343e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                {@link ACameraCaptureSession_captureCallbacks}.
2353e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param session The camera capture session of interest.
2363e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param request The capture request of interest. Note that this pointer points to a copy of
2373e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                capture request sent by application, so the address is different to what
2383e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                application sent but the content will match. This request will be freed by
2393e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                framework immediately after this callback returns.
2403e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param window The {@link ANativeWindow} that the lost buffer would have been sent to.
2413e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param frameNumber The frame number of the lost buffer.
2423e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh */
243e081c59aeb309f5d91b99c433fc252e4570d4db8Yin-Chia Yehtypedef void (*ACameraCaptureSession_captureCallback_bufferLost)(
244e081c59aeb309f5d91b99c433fc252e4570d4db8Yin-Chia Yeh        void* context, ACameraCaptureSession* session,
245e081c59aeb309f5d91b99c433fc252e4570d4db8Yin-Chia Yeh        ACaptureRequest* request, ANativeWindow* window, int64_t frameNumber);
246e081c59aeb309f5d91b99c433fc252e4570d4db8Yin-Chia Yeh
2470dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef struct ACameraCaptureSession_captureCallbacks {
2483e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /// optional application context.
2493e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    void*                                               context;
2503e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
2513e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
2523e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This callback is called when the camera device has started capturing
2533e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * the output image for the request, at the beginning of image exposure.
2543e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2553e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>This callback is invoked right as
2563e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * the capture of a frame begins, so it is the most appropriate time
2573e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * for playing a shutter sound, or triggering UI indicators of capture.</p>
2583e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2593e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>The request that is being used for this capture is provided, along
2603e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * with the actual timestamp for the start of exposure.
2613e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This timestamp matches the timestamps that will be
2623e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * included in {@link ACAMERA_SENSOR_TIMESTAMP} of the {@link ACameraMetadata} in
2633e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link onCaptureCompleted} callback,
2643e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * and in the buffers sent to each output ANativeWindow. These buffer
2653e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * timestamps are accessible through, for example,
2663e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link AImage_getTimestamp} or
2673e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <a href="http://developer.android.com/reference/android/graphics/SurfaceTexture.html#getTimestamp()">
2683e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * android.graphics.SurfaceTexture#getTimestamp()</a>.</p>
2693e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2703e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>Note that the ACaptureRequest pointer in the callback will not match what application has
2713e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * submitted, but the contents the ACaptureRequest will match what application submitted.</p>
2723e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2733e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
274ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh    ACameraCaptureSession_captureCallback_start         onCaptureStarted;
2753e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
2763e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
2773e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This callback is called when an image capture makes partial forward progress; some
2783e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * (but not all) results from an image capture are available.
2793e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2803e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>The result provided here will contain some subset of the fields of
2813e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * a full result. Multiple {@link onCaptureProgressed} calls may happen per
2823e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * capture; a given result field will only be present in one partial
2833e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * capture at most. The final {@link onCaptureCompleted} call will always
2843e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * contain all the fields (in particular, the union of all the fields of all
2853e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * the partial results composing the total result).</p>
2863e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2873e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>For each request, some result data might be available earlier than others. The typical
2883e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * delay between each partial result (per request) is a single frame interval.
2893e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * For performance-oriented use-cases, applications should query the metadata they need
2903e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * to make forward progress from the partial results and avoid waiting for the completed
2913e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * result.</p>
2923e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2933e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>For a particular request, {@link onCaptureProgressed} may happen before or after
2943e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link onCaptureStarted}.</p>
2953e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2963e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>Each request will generate at least `1` partial results, and at most
2973e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link ACAMERA_REQUEST_PARTIAL_RESULT_COUNT} partial results.</p>
2983e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
2993e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>Depending on the request settings, the number of partial results per request
3003e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * will vary, although typically the partial count could be the same as long as the
3013e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * camera device subsystems enabled stay the same.</p>
3023e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
3033e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>Note that the ACaptureRequest pointer in the callback will not match what application has
3043e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * submitted, but the contents the ACaptureRequest will match what application submitted.</p>
3053e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
306ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh    ACameraCaptureSession_captureCallback_result        onCaptureProgressed;
3073e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
3083e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
3093e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This callback is called when an image capture has fully completed and all the
3103e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * result metadata is available.
3113e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
3123e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>This callback will always fire after the last {@link onCaptureProgressed};
3133e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * in other words, no more partial results will be delivered once the completed result
3143e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * is available.</p>
3153e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
3163e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>For performance-intensive use-cases where latency is a factor, consider
3173e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * using {@link onCaptureProgressed} instead.</p>
3183e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
3193e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>Note that the ACaptureRequest pointer in the callback will not match what application has
3203e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * submitted, but the contents the ACaptureRequest will match what application submitted.</p>
3213e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
322ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh    ACameraCaptureSession_captureCallback_result        onCaptureCompleted;
3233e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
3243e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
3253e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This callback is called instead of {@link onCaptureCompleted} when the
3263e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * camera device failed to produce a capture result for the
3273e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * request.
3283e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
3293e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>Other requests are unaffected, and some or all image buffers from
3303e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * the capture may have been pushed to their respective output
3313e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * streams.</p>
3323e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
3333e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>Note that the ACaptureRequest pointer in the callback will not match what application has
3343e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * submitted, but the contents the ACaptureRequest will match what application submitted.</p>
3353e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
3363e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * @see ACameraCaptureFailure
3373e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
338ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh    ACameraCaptureSession_captureCallback_failed        onCaptureFailed;
3393e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
3403e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
3413e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This callback is called independently of the others in {@link ACameraCaptureSession_captureCallbacks},
3423e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * when a capture sequence finishes and all capture result
3433e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * or capture failure for it have been returned via this {@link ACameraCaptureSession_captureCallbacks}.
3443e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
3453e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>In total, there will be at least one result/failure returned by this listener
3463e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * before this callback is invoked. If the capture sequence is aborted before any
3473e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * requests have been processed, {@link onCaptureSequenceAborted} is invoked instead.</p>
3483e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
349ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh    ACameraCaptureSession_captureCallback_sequenceEnd   onCaptureSequenceCompleted;
3503e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
3513e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
3523e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This callback is called independently of the others in {@link ACameraCaptureSession_captureCallbacks},
3533e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * when a capture sequence aborts before any capture result
3543e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * or capture failure for it have been returned via this {@link ACameraCaptureSession_captureCallbacks}.
3553e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
3563e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>Due to the asynchronous nature of the camera device, not all submitted captures
3573e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * are immediately processed. It is possible to clear out the pending requests
3583e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * by a variety of operations such as {@link ACameraCaptureSession_stopRepeating} or
3593e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link ACameraCaptureSession_abortCaptures}. When such an event happens,
3603e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link onCaptureSequenceCompleted} will not be called.</p>
3613e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
362ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh    ACameraCaptureSession_captureCallback_sequenceAbort onCaptureSequenceAborted;
3633e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
3643e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh    /**
3653e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * This callback is called if a single buffer for a capture could not be sent to its
3663e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * destination ANativeWindow.
3673e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
3683e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>If the whole capture failed, then {@link onCaptureFailed} will be called instead. If
3693e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * some but not all buffers were captured but the result metadata will not be available,
3703e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * then onCaptureFailed will be invoked with {@link ACameraCaptureFailure#wasImageCaptured}
3713e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * returning true, along with one or more calls to {@link onCaptureBufferLost} for the
3723e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * failed outputs.</p>
3733e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
3743e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * <p>Note that the ACaptureRequest pointer in the callback will not match what application has
3753e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * submitted, but the contents the ACaptureRequest will match what application submitted.
3763e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * The ANativeWindow pointer will always match what application submitted in
3773e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     * {@link ACameraDevice_createCaptureSession}</p>
3783e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     *
3793e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh     */
380e081c59aeb309f5d91b99c433fc252e4570d4db8Yin-Chia Yeh    ACameraCaptureSession_captureCallback_bufferLost    onCaptureBufferLost;
3810dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh} ACameraCaptureSession_captureCallbacks;
3820dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
383ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yehenum {
384ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh    CAPTURE_SEQUENCE_ID_NONE = -1
385ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh};
386ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh
3873e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/**
3883e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Close this capture session.
3893e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3903e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>Closing a session frees up the target output Surfaces of the session for reuse with either
3913e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * a new session, or to other APIs that can draw to Surfaces.</p>
3923e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
3933e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>Note that creating a new capture session with {@link ACameraDevice_createCaptureSession}
3943e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * will close any existing capture session automatically, and call the older session listener's
3953e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACameraCaptureSession_stateCallbacks#onClosed} callback. Using
3963e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACameraDevice_createCaptureSession} directly without closing is the recommended approach
3973e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * for quickly switching to a new session, since unchanged target outputs can be reused more
3983e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * efficiently.</p>
3993e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4003e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>After a session is closed and before {@link ACameraCaptureSession_stateCallbacks#onClosed}
4013e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * is called, all methods invoked on the session will return {@link ACAMERA_ERROR_SESSION_CLOSED},
4023e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * and any repeating requests are stopped (as if {@link ACameraCaptureSession_stopRepeating} was
4033e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * called). However, any in-progress capture requests submitted to the session will be completed as
4043e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * normal; once all captures have completed and the session has been torn down,
4053e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACameraCaptureSession_stateCallbacks#onClosed} callback will be called and the seesion
4063e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * will be removed from memory.</p>
4073e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4083e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>Closing a session is idempotent; closing more than once has no effect.</p>
4093e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4103e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param session the capture session of interest
4110dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh */
4123e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yehvoid ACameraCaptureSession_close(ACameraCaptureSession* session);
4130dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
4140dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehstruct ACameraDevice;
4150dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehtypedef struct ACameraDevice ACameraDevice;
4160dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
4170dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh/**
4183e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Get the ACameraDevice pointer associated with this capture session in the device argument
4193e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * if the method succeeds.
4203e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4213e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param session the capture session of interest
4223e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param device the {@link ACameraDevice} associated with session. Will be set to NULL
4233e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *        if the session is closed or this method fails.
4243e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @return <ul><li>
4253e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *             {@link ACAMERA_OK} if the method call succeeds. The {@link ACameraDevice}
4263e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *                                will be stored in device argument</li>
4273e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if session or device is NULL</li>
4283e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed</li>
4293e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons</li></ul>
4303e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4310dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh */
4320dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehcamera_status_t ACameraCaptureSession_getDevice(
4333e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh        ACameraCaptureSession* session, /*out*/ACameraDevice** device);
4340dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
4350dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh/**
4363e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Submit an array of requests to be captured in sequence as a burst in the minimum of time possible.
4373e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4383e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>The burst will be captured in the minimum amount of time possible, and will not be
4393e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * interleaved with requests submitted by other capture or repeat calls.</p>
4403e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4413e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>Each capture produces one {@link ACameraMetadata} as a capture result and image buffers for
4423e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * one or more target {@link ANativeWindow}s. The target ANativeWindows (set with
4433e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACaptureRequest_addTarget}) must be a subset of the ANativeWindow provided when
4443e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * this capture session was created.</p>
4453e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4463e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param session the capture session of interest
4473e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param callbacks the {@link ACameraCaptureSession_captureCallbacks} to be associated this capture
4483e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *        sequence. No capture callback will be fired if this is set to NULL.
4493e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param numRequests number of requests in requests argument. Must be at least 1.
4503e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param requests an array of {@link ACaptureRequest} to be captured. Length must be at least
4513e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *        numRequests.
4523e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param captureSequenceId the capture sequence ID associated with this capture method invocation
4533e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *        will be stored here if this argument is not NULL and the method call succeeds.
4543e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *        When this argument is set to NULL, the capture sequence ID will not be returned.
4553e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4563e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @return <ul><li>
4573e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *             {@link ACAMERA_OK} if the method succeeds. captureSequenceId will be filled
4583e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *             if it is not NULL.</li>
4593e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if session or requests is NULL, or
4603e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *             if numRequests < 1</li>
4613e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed</li>
4623e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed</li>
4633e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error</li>
4643e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error</li>
4653e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons</li></ul>
4660dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh */
4670dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehcamera_status_t ACameraCaptureSession_capture(
4683e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh        ACameraCaptureSession* session,
4693e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh        /*optional*/ACameraCaptureSession_captureCallbacks* callbacks,
470ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh        int numRequests, ACaptureRequest** requests,
471ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh        /*optional*/int* captureSequenceId);
4720dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
4730dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh/**
4743e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Request endlessly repeating capture of a sequence of images by this capture session.
4753e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4763e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>With this method, the camera device will continually capture images,
4773e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * cycling through the settings in the provided list of
4783e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACaptureRequest}, at the maximum rate possible.</p>
4793e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4803e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>If a request is submitted through {@link ACameraCaptureSession_capture},
4813e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * the current repetition of the request list will be
4823e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * completed before the higher-priority request is handled. This guarantees
4833e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * that the application always receives a complete repeat burst captured in
4843e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * minimal time, instead of bursts interleaved with higher-priority
4853e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * captures, or incomplete captures.</p>
4863e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4873e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>Repeating burst requests are a simple way for an application to
4883e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * maintain a preview or other continuous stream of frames where each
4893e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * request is different in a predicatable way, without having to continually
4903e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * submit requests through {@link ACameraCaptureSession_capture}.</p>
4913e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4923e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>To stop the repeating capture, call {@link ACameraCaptureSession_stopRepeating}. Any
4933e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * ongoing burst will still be completed, however. Calling
4943e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACameraCaptureSession_abortCaptures} will also clear the request.</p>
4953e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
4963e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>Calling this method will replace a previously-set repeating requests
4973e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * set up by this method, although any in-progress burst will be completed before the new repeat
4983e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * burst will be used.</p>
4993e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5003e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param session the capture session of interest
5013e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param callbacks the {@link ACameraCaptureSession_captureCallbacks} to be associated with this
5023e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *        capture sequence. No capture callback will be fired if callbacks is set to NULL.
5033e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param numRequests number of requests in requests array. Must be at least 1.
5043e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param requests an array of {@link ACaptureRequest} to be captured. Length must be at least
5053e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *        numRequests.
5063e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param captureSequenceId the capture sequence ID associated with this capture method invocation
5073e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *        will be stored here if this argument is not NULL and the method call succeeds.
5083e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *        When this argument is set to NULL, the capture sequence ID will not be returned.
5093e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5103e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @return <ul><li>
5113e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *             {@link ACAMERA_OK} if the method succeeds. captureSequenceId will be filled
5123e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *             if it is not NULL.</li>
5133e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if session or requests is NULL, or
5143e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *             if numRequests < 1</li>
5153e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed</li>
5163e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed</li>
5173e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error</li>
5183e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error</li>
5193e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for  some other reasons</li></ul>
5200dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh */
5210dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yehcamera_status_t ACameraCaptureSession_setRepeatingRequest(
5223e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh        ACameraCaptureSession* session,
5233e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh        /*optional*/ACameraCaptureSession_captureCallbacks* callbacks,
524ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh        int numRequests, ACaptureRequest** requests,
525ead9146f844ee194a4f4244ba8ae1a3aece12b63Yin-Chia Yeh        /*optional*/int* captureSequenceId);
5260dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
5270dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh/**
5283e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Cancel any ongoing repeating capture set by {@link ACameraCaptureSession_setRepeatingRequest}.
5293e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Has no effect on requests submitted through {@link ACameraCaptureSession_capture}.
5303e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5313e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>Any currently in-flight captures will still complete, as will any burst that is
5323e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * mid-capture. To ensure that the device has finished processing all of its capture requests
5333e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * and is in ready state, wait for the {@link ACameraCaptureSession_stateCallbacks#onReady} callback
5343e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * after calling this method.</p>
5353e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5363e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param session the capture session of interest
5373e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5383e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @return <ul><li>
5393e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *             {@link ACAMERA_OK} if the method succeeds. captureSequenceId will be filled
5403e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *             if it is not NULL.</li>
5413e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if session is NULL.</li>
5423e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed</li>
5433e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed</li>
5443e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error</li>
5453e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error</li>
5463e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons</li></ul>
5470dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh */
5483e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yehcamera_status_t ACameraCaptureSession_stopRepeating(ACameraCaptureSession* session);
5490dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
5500dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh/**
5513e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * Discard all captures currently pending and in-progress as fast as possible.
5523e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5533e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>The camera device will discard all of its current work as fast as possible. Some in-flight
5543e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * captures may complete successfully and call
5553e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACameraCaptureSession_captureCallbacks#onCaptureCompleted},
5563e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * while others will trigger their {@link ACameraCaptureSession_captureCallbacks#onCaptureFailed}
5573e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * callbacks. If a repeating request list is set, it will be cleared.</p>
5583e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5593e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>This method is the fastest way to switch the camera device to a new session with
5603e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACameraDevice_createCaptureSession}, at the cost of discarding in-progress
5613e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * work. It must be called before the new session is created. Once all pending requests are
5623e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * either completed or thrown away, the {@link ACameraCaptureSession_stateCallbacks#onReady}
5633e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * callback will be called, if the session has not been closed. Otherwise, the
5643e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * {@link ACameraCaptureSession_stateCallbacks#onClosed}
5653e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * callback will be fired when a new session is created by the camera device and the previous
5663e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * session is being removed from memory.</p>
5673e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5683e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>Cancelling will introduce at least a brief pause in the stream of data from the camera
5693e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * device, since once the camera device is emptied, the first new request has to make it through
5703e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * the entire camera pipeline before new output buffers are produced.</p>
5713e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5723e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * <p>This means that using ACameraCaptureSession_abortCaptures to simply remove pending requests is
5733e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * not recommended; it's best used for quickly switching output configurations, or for cancelling
5743e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * long in-progress requests (such as a multi-second capture).</p>
5753e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5763e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @param session the capture session of interest
5773e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *
5783e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh * @return <ul><li>
5793e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *             {@link ACAMERA_OK} if the method succeeds. captureSequenceId will be filled
5803e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *             if it is not NULL.</li>
5813e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if session is NULL.</li>
5823e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_SESSION_CLOSED} if the capture session has been closed</li>
5833e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_DISCONNECTED} if the camera device is closed</li>
5843e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_DEVICE} if the camera device encounters fatal error</li>
5853e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error</li>
5863e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh *         <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons</li></ul>
5870dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh */
5883e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yehcamera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession* session);
5890dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
5900dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
5910dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#ifdef __cplusplus
5920dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh} // extern "C"
5930dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#endif
5940dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh
5950dea57fd9fc4b2ccaab97d9477359fbd5a626f5cYin-Chia Yeh#endif // _NDK_CAMERA_CAPTURE_SESSION_H
5963e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh
5973e49be17d8c8c53f50bb0d39affbbc36f6a12488Yin-Chia Yeh/** @} */
598