blob: b3367c7cc8b2f916bf8edd81380fe05b00cc77f7 [file] [log] [blame]
Yin-Chia Yeh0dea57f2015-12-09 16:46:07 -08001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * This file defines an NDK API.
19 * Do not remove methods.
20 * Do not change method signatures.
21 * Do not change the value of constants.
22 * Do not change the size of any of the classes defined in here.
23 * Do not reference types that are not part of the NDK.
24 * Do not #include files that aren't part of the NDK.
25 */
26#include "NdkCameraError.h"
27#include "NdkCameraMetadata.h"
28
29#ifndef _NDK_CAMERA_CAPTURE_SESSION_H
30#define _NDK_CAMERA_CAPTURE_SESSION_H
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36typedef struct ACameraCaptureSession ACameraCaptureSession;
37
38typedef void (*ACameraCaptureSession_stateCallback)(void* context, ACameraCaptureSession *session);
39
40typedef struct ACameraCaptureSession_stateCallbacks {
41 void* context;
42 ACameraCaptureSession_stateCallback onConfigured;
43 ACameraCaptureSession_stateCallback onConfigureFailed;
44 ACameraCaptureSession_stateCallback onClosed;
45 ACameraCaptureSession_stateCallback onReady;
46 ACameraCaptureSession_stateCallback onActive;
47} ACameraCaptureSession_stateCallbacks;
48
49typedef struct ACameraCaptureFailure {
50 uint32_t frameNumber;
51 int reason;
52 int sequenceId;
53 int wasImageCaptured;
54} ACameraCaptureFailure;
55
56typedef void (*ACameraCaptureSession_captureCallback_start)(
57 void* context, ACameraCaptureSession* session,
58 ACaptureRequest* request, long timestamp);
59
60typedef void (*ACameraCaptureSession_captureCallback_result)(
61 void* context, ACameraCaptureSession* session,
62 ACaptureRequest* request, ACameraMetadata* result);
63
64typedef void (*ACameraCaptureSession_captureCallback_failed)(
65 void* context, ACameraCaptureSession* session,
66 ACaptureRequest* request, ACameraCaptureFailure* failure);
67
68typedef void (*ACameraCaptureSession_captureCallback_sequenceEnd)(
69 void* context, ACameraCaptureSession* session,
70 int sequenceId, long frameNumber);
71
72typedef struct ACameraCaptureSession_captureCallbacks {
73 void* context;
74 ACameraCaptureSession_captureCallback_start onCaptureStarted;
75 ACameraCaptureSession_captureCallback_result onCaptureProgressed;
76 ACameraCaptureSession_captureCallback_result onCaptureCompleted;
77 ACameraCaptureSession_captureCallback_failed onCaptureFailed;
78 ACameraCaptureSession_captureCallback_sequenceEnd onCaptureSequenceCompleted;
79 ACameraCaptureSession_captureCallback_sequenceEnd onCaptureSequenceAborted;
80} ACameraCaptureSession_captureCallbacks;
81
82/*
83 * Close capture session
84 */
85camera_status_t ACameraCaptureSession_close(ACameraCaptureSession*);
86
87struct ACameraDevice;
88typedef struct ACameraDevice ACameraDevice;
89
90/**
91 * Get the camera device associated with this capture session
92 */
93camera_status_t ACameraCaptureSession_getDevice(
94 ACameraCaptureSession*, ACameraDevice** device);
95
96/**
97 * Send capture request(s)
98 */
99camera_status_t ACameraCaptureSession_capture(
100 ACameraCaptureSession*, /*optional*/ACameraCaptureSession_captureCallbacks*,
101 int numRequests, const ACaptureRequest* requests);
102
103/**
104 * Send repeating capture request(s)
105 */
106camera_status_t ACameraCaptureSession_setRepeatingRequest(
107 ACameraCaptureSession*, /*optional*/ACameraCaptureSession_captureCallbacks*,
108 int numRequests, const ACaptureRequest* requests);
109
110/**
111 * Stop repeating capture request(s)
112 */
113camera_status_t ACameraCaptureSession_stopRepeating(ACameraCaptureSession*);
114
115/**
116 * Stop all capture requests as soon as possible
117 */
118camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession*);
119
120
121#ifdef __cplusplus
122} // extern "C"
123#endif
124
125#endif // _NDK_CAMERA_CAPTURE_SESSION_H