| ARX 1.0 The next-generation open source augmented reality toolkit.

Loading...
Searching...
No Matches
videoAndroidPrivate.h
Go to the documentation of this file.
1/*
2 * videoAndroidPrivate.h
3 * artoolkitX
4 *
5 * This file is part of artoolkitX.
6 *
7 * artoolkitX is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * artoolkitX is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with artoolkitX. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * As a special exception, the copyright holders of this library give you
21 * permission to link this library with independent modules to produce an
22 * executable, regardless of the license terms of these independent modules, and to
23 * copy and distribute the resulting executable under terms of your choice,
24 * provided that you also meet, for each linked independent module, the terms and
25 * conditions of the license of that module. An independent module is a module
26 * which is neither derived from nor based on this library. If you modify this
27 * library, you may extend this exception to your version of the library, but you
28 * are not obligated to do so. If you do not wish to do so, delete this exception
29 * statement from your version.
30 *
31 * Copyright 2018 Realmax, Inc.
32 * Copyright 2015-2016 Daqri, LLC.
33 * Copyright 2012-2015 ARToolworks, Inc.
34 *
35 * Author(s): Philip Lamb
36 *
37 */
38
39#ifndef AR_VIDEO_ANDROID_PRIVATE_H
40#define AR_VIDEO_ANDROID_PRIVATE_H
41
42#include <ARX/ARVideo/video.h>
43#include <pthread.h>
44#include <stdbool.h>
45#include <stdint.h>
46#include <camera/NdkCameraDevice.h>
47#include <camera/NdkCameraError.h>
48#include <camera/NdkCameraManager.h>
49#include <camera/NdkCameraMetadataTags.h>
50#include <media/NdkImageReader.h>
51
52#ifdef __cplusplus
53 extern "C" {
54#endif
55
56 typedef enum {
57 ARVideoAndroidCameraCaptureSessionState_READY = 0, // session is ready
58 ARVideoAndroidCameraCaptureSessionState_ACTIVE, // session is busy
59 ARVideoAndroidCameraCaptureSessionState_CLOSED, // session is closed(by itself or a new session evicts)
60 ARVideoAndroidCameraCaptureSessionState_MAX_STATE
61} ARVideoAndroidCameraCaptureSessionState;
62
63 struct _AR2VideoParamAndroidT {
64 char *device_id;
65 int camera_index; // 0 = first camera, 1 = second etc.
66 int width;
67 int height;
68 AR_PIXEL_FORMAT pixelFormat;
69 int convertToRGBA;
70 float focalLength; // metres.
71 void (*cparamSearchCallback)(const ARParam *, void *);
72 void *cparamSearchUserdata;
73 AR2VideoBufferT buffer;
74 bool native;
75 bool capturing; // Between capStart and capStop.
76 pthread_mutex_t frameLock; // Protects: buffer, capturing.
77 void (*callback)(void *);
78 void *userdata;
79 int position;
80 volatile bool cameraReady_;
81 bool cameraAvailable_;
82 ACameraManager* cameraMgr_;
83 ACameraDevice* cameraDevice_;
84 ACameraManager_AvailabilityCallbacks cameraAvailabilityCallbacks;
85 int64_t exposureTime_;
86 int64_t exposureRangeMin_;
87 int64_t exposureRangeMax_;
88 int32_t sensitivity_;
89 int32_t sensitivityRangeMin_;
90 int32_t sensitivityRangeMax_;
91 int32_t sensorRotation_;
92 AImageReader* imageReader_;
93 ANativeWindow* imageReaderNativeWindow_;
94 AImage* imageCheckedOutDownstream;
95 AImage* imageReady;
96 ACaptureSessionOutput* captureSessionOutput_;
97 ACameraOutputTarget* captureRequestTarget_;
98 ACaptureRequest* captureRequest_;
99 ACaptureSessionOutputContainer* captureSessionOutputContainer_;
100 ACameraCaptureSession* captureSession_;
101 ARVideoAndroidCameraCaptureSessionState cameraCaptureSessionState;
102 int captureRequestSessionSequenceId_;
103};
104
105#ifdef __cplusplus
106}
107#endif
108#endif // AR_VIDEO_ANDROID_PRIVATE_H
_AR2VideoParamAndroidT
Definition: videoAndroidPrivate.h:63
_AR2VideoParamAndroidT::captureRequest_
ACaptureRequest * captureRequest_
Definition: videoAndroidPrivate.h:98
_AR2VideoParamAndroidT::convertToRGBA
int convertToRGBA
Definition: videoAndroidPrivate.h:69
_AR2VideoParamAndroidT::position
int position
Definition: videoAndroidPrivate.h:79
_AR2VideoParamAndroidT::cameraReady_
volatile bool cameraReady_
Definition: videoAndroidPrivate.h:80
_AR2VideoParamAndroidT::userdata
void * userdata
Definition: videoAndroidPrivate.h:78
_AR2VideoParamAndroidT::pixelFormat
AR_PIXEL_FORMAT pixelFormat
Definition: videoAndroidPrivate.h:68
_AR2VideoParamAndroidT::native
bool native
Definition: videoAndroidPrivate.h:74
_AR2VideoParamAndroidT::imageCheckedOutDownstream
AImage * imageCheckedOutDownstream
Definition: videoAndroidPrivate.h:94
_AR2VideoParamAndroidT::exposureRangeMax_
int64_t exposureRangeMax_
Definition: videoAndroidPrivate.h:87
_AR2VideoParamAndroidT::sensitivityRangeMax_
int32_t sensitivityRangeMax_
Definition: videoAndroidPrivate.h:90
_AR2VideoParamAndroidT::frameLock
pthread_mutex_t frameLock
Definition: videoAndroidPrivate.h:76
_AR2VideoParamAndroidT::captureSessionOutputContainer_
ACaptureSessionOutputContainer * captureSessionOutputContainer_
Definition: videoAndroidPrivate.h:99
_AR2VideoParamAndroidT::sensitivityRangeMin_
int32_t sensitivityRangeMin_
Definition: videoAndroidPrivate.h:89
_AR2VideoParamAndroidT::capturing
bool capturing
Definition: videoAndroidPrivate.h:75
_AR2VideoParamAndroidT::cparamSearchUserdata
void * cparamSearchUserdata
Definition: videoAndroidPrivate.h:72
_AR2VideoParamAndroidT::cameraDevice_
ACameraDevice * cameraDevice_
Definition: videoAndroidPrivate.h:83
_AR2VideoParamAndroidT::cparamSearchCallback
void(* cparamSearchCallback)(const ARParam *, void *)
Definition: videoAndroidPrivate.h:71
_AR2VideoParamAndroidT::captureRequestTarget_
ACameraOutputTarget * captureRequestTarget_
Definition: videoAndroidPrivate.h:97
_AR2VideoParamAndroidT::width
int width
Definition: videoAndroidPrivate.h:66
_AR2VideoParamAndroidT::exposureTime_
int64_t exposureTime_
Definition: videoAndroidPrivate.h:85
_AR2VideoParamAndroidT::cameraCaptureSessionState
ARVideoAndroidCameraCaptureSessionState cameraCaptureSessionState
Definition: videoAndroidPrivate.h:101
_AR2VideoParamAndroidT::imageReader_
AImageReader * imageReader_
Definition: videoAndroidPrivate.h:92
_AR2VideoParamAndroidT::captureRequestSessionSequenceId_
int captureRequestSessionSequenceId_
Definition: videoAndroidPrivate.h:102
_AR2VideoParamAndroidT::device_id
char * device_id
Definition: videoAndroidPrivate.h:64
_AR2VideoParamAndroidT::cameraAvailabilityCallbacks
ACameraManager_AvailabilityCallbacks cameraAvailabilityCallbacks
Definition: videoAndroidPrivate.h:84
_AR2VideoParamAndroidT::height
int height
Definition: videoAndroidPrivate.h:67
_AR2VideoParamAndroidT::cameraMgr_
ACameraManager * cameraMgr_
Definition: videoAndroidPrivate.h:82
_AR2VideoParamAndroidT::exposureRangeMin_
int64_t exposureRangeMin_
Definition: videoAndroidPrivate.h:86
_AR2VideoParamAndroidT::sensorRotation_
int32_t sensorRotation_
Definition: videoAndroidPrivate.h:91
_AR2VideoParamAndroidT::camera_index
int camera_index
Definition: videoAndroidPrivate.h:65
_AR2VideoParamAndroidT::cameraAvailable_
bool cameraAvailable_
Definition: videoAndroidPrivate.h:81
_AR2VideoParamAndroidT::imageReady
AImage * imageReady
Definition: videoAndroidPrivate.h:95
_AR2VideoParamAndroidT::focalLength
float focalLength
Definition: videoAndroidPrivate.h:70
_AR2VideoParamAndroidT::imageReaderNativeWindow_
ANativeWindow * imageReaderNativeWindow_
Definition: videoAndroidPrivate.h:93
_AR2VideoParamAndroidT::captureSessionOutput_
ACaptureSessionOutput * captureSessionOutput_
Definition: videoAndroidPrivate.h:96
_AR2VideoParamAndroidT::captureSession_
ACameraCaptureSession * captureSession_
Definition: videoAndroidPrivate.h:100
_AR2VideoParamAndroidT::callback
void(* callback)(void *)
Definition: videoAndroidPrivate.h:77
_AR2VideoParamAndroidT::sensitivity_
int32_t sensitivity_
Definition: videoAndroidPrivate.h:88
_AR2VideoParamAndroidT::buffer
AR2VideoBufferT buffer
Definition: videoAndroidPrivate.h:73
AR2VideoBufferT
A structure which carries information about a video frame retrieved by the video library.
Definition: ar.h:148
ARParam
Structure holding camera parameters, including image size, projection matrix and lens distortion para...
Definition: param.h:99
video.h
ARVideoAndroidCameraCaptureSessionState
ARVideoAndroidCameraCaptureSessionState
Definition: videoAndroidPrivate.h:56
ARVideoAndroidCameraCaptureSessionState_ACTIVE
@ ARVideoAndroidCameraCaptureSessionState_ACTIVE
Definition: videoAndroidPrivate.h:58
ARVideoAndroidCameraCaptureSessionState_CLOSED
@ ARVideoAndroidCameraCaptureSessionState_CLOSED
Definition: videoAndroidPrivate.h:59
ARVideoAndroidCameraCaptureSessionState_READY
@ ARVideoAndroidCameraCaptureSessionState_READY
Definition: videoAndroidPrivate.h:57
ARVideoAndroidCameraCaptureSessionState_MAX_STATE
@ ARVideoAndroidCameraCaptureSessionState_MAX_STATE
Definition: videoAndroidPrivate.h:60