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 <ARX/ARUtil/android.h> // PROP_VALUE_MAX
47#include <camera/NdkCameraDevice.h>
48#include <camera/NdkCameraError.h>
49#include <camera/NdkCameraManager.h>
50#include <camera/NdkCameraMetadataTags.h>
51#include <media/NdkImageReader.h>
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57typedef enum {
64 ARVideoAndroidIncomingPixelFormat_MONO // Not official Android.
66
67typedef enum {
70 ARVideoAndroidCameraCaptureSessionState_CLOSED, // session is closed(by itself or a new session evicts)
73
75 char device_id[PROP_VALUE_MAX*3+2]; // From <sys/system_properties.h>. 3 properties plus separators.
76 int camera_index; // 0 = first camera, 1 = second etc.
77 int width;
78 int height;
79 AR_PIXEL_FORMAT pixelFormat;
81 float focal_length; // metres.
82 void (*cparamSearchCallback)(const ARParam *, void *);
85 bool native;
86 bool capturing; // Between capStart and capStop.
87 pthread_mutex_t frameLock; // Protects: capturing, pushInited, pushNewFrameReady.
88 void (*callback)(void *);
89 void *userdata;
90 // Pushed-video-only fields.
91 int camera_face; // 0 = camera is rear facing, 1 = camera is front facing.
92 bool pushInited; // videoPushInit called.
93 pthread_cond_t pushInitedCond; // At least one frame received.
94 bool pushNewFrameReady; // New frame ready since last arVideoGetImage.
96 // Native-only fields:
98 volatile bool cameraReady_;
100 ACameraManager* cameraMgr_;
101 ACameraDevice* cameraDevice_;
102 ACameraManager_AvailabilityCallbacks cameraAvailabilityCallbacks;
110 AImageReader* imageReader_;
113 AImage* imageReady;
114 ACaptureSessionOutput* captureSessionOutput_;
115 ACameraOutputTarget* captureRequestTarget_;
116 ACaptureRequest* captureRequest_;
117 ACaptureSessionOutputContainer* captureSessionOutputContainer_;
118 ACameraCaptureSession* captureSession_;
121};
122
123#ifdef __cplusplus
124}
125#endif
126#endif // AR_VIDEO_ANDROID_PRIVATE_H
Definition: videoAndroidPrivate.h:74
ACaptureRequest * captureRequest_
Definition: videoAndroidPrivate.h:116
int convertToRGBA
Definition: videoAndroidPrivate.h:80
int position
Definition: videoAndroidPrivate.h:97
volatile bool cameraReady_
Definition: videoAndroidPrivate.h:98
void * userdata
Definition: videoAndroidPrivate.h:89
AR_PIXEL_FORMAT pixelFormat
Definition: videoAndroidPrivate.h:79
bool native
Definition: videoAndroidPrivate.h:85
AImage * imageCheckedOutDownstream
Definition: videoAndroidPrivate.h:112
int64_t exposureRangeMax_
Definition: videoAndroidPrivate.h:105
int32_t sensitivityRangeMax_
Definition: videoAndroidPrivate.h:108
pthread_mutex_t frameLock
Definition: videoAndroidPrivate.h:87
ACaptureSessionOutputContainer * captureSessionOutputContainer_
Definition: videoAndroidPrivate.h:117
int32_t sensitivityRangeMin_
Definition: videoAndroidPrivate.h:107
bool capturing
Definition: videoAndroidPrivate.h:86
void * cparamSearchUserdata
Definition: videoAndroidPrivate.h:83
bool pushInited
Definition: videoAndroidPrivate.h:92
ARVideoAndroidIncomingPixelFormat androidIncomingPixelFormat
Definition: videoAndroidPrivate.h:95
ACameraDevice * cameraDevice_
Definition: videoAndroidPrivate.h:101
void(* cparamSearchCallback)(const ARParam *, void *)
Definition: videoAndroidPrivate.h:82
float focal_length
Definition: videoAndroidPrivate.h:81
ACameraOutputTarget * captureRequestTarget_
Definition: videoAndroidPrivate.h:115
int width
Definition: videoAndroidPrivate.h:77
int64_t exposureTime_
Definition: videoAndroidPrivate.h:103
ARVideoAndroidCameraCaptureSessionState cameraCaptureSessionState
Definition: videoAndroidPrivate.h:119
AImageReader * imageReader_
Definition: videoAndroidPrivate.h:110
int captureRequestSessionSequenceId_
Definition: videoAndroidPrivate.h:120
char device_id[PROP_VALUE_MAX *3+2]
Definition: videoAndroidPrivate.h:75
ACameraManager_AvailabilityCallbacks cameraAvailabilityCallbacks
Definition: videoAndroidPrivate.h:102
int height
Definition: videoAndroidPrivate.h:78
ACameraManager * cameraMgr_
Definition: videoAndroidPrivate.h:100
bool pushNewFrameReady
Definition: videoAndroidPrivate.h:94
int64_t exposureRangeMin_
Definition: videoAndroidPrivate.h:104
pthread_cond_t pushInitedCond
Definition: videoAndroidPrivate.h:93
int32_t sensorRotation_
Definition: videoAndroidPrivate.h:109
int camera_index
Definition: videoAndroidPrivate.h:76
int camera_face
Definition: videoAndroidPrivate.h:91
bool cameraAvailable_
Definition: videoAndroidPrivate.h:99
AImage * imageReady
Definition: videoAndroidPrivate.h:113
ANativeWindow * imageReaderNativeWindow_
Definition: videoAndroidPrivate.h:111
ACaptureSessionOutput * captureSessionOutput_
Definition: videoAndroidPrivate.h:114
ACameraCaptureSession * captureSession_
Definition: videoAndroidPrivate.h:118
void(* callback)(void *)
Definition: videoAndroidPrivate.h:88
int32_t sensitivity_
Definition: videoAndroidPrivate.h:106
AR2VideoBufferT buffer
Definition: videoAndroidPrivate.h:84
A structure which carries information about a video frame retrieved by the video library.
Definition: ar.h:148
Structure holding camera parameters, including image size, projection matrix and lens distortion para...
Definition: param.h:99
ARVideoAndroidIncomingPixelFormat
Definition: videoAndroidPrivate.h:57
@ ARVideoAndroidIncomingPixelFormat_RGB_565
Definition: videoAndroidPrivate.h:62
@ ARVideoAndroidIncomingPixelFormat_UNKNOWN
Definition: videoAndroidPrivate.h:58
@ ARVideoAndroidIncomingPixelFormat_YUV_420_888
Definition: videoAndroidPrivate.h:63
@ ARVideoAndroidIncomingPixelFormat_NV12
Definition: videoAndroidPrivate.h:60
@ ARVideoAndroidIncomingPixelFormat_NV21
Definition: videoAndroidPrivate.h:59
@ ARVideoAndroidIncomingPixelFormat_RGBA
Definition: videoAndroidPrivate.h:61
@ ARVideoAndroidIncomingPixelFormat_MONO
Definition: videoAndroidPrivate.h:64
ARVideoAndroidCameraCaptureSessionState
Definition: videoAndroidPrivate.h:67
@ ARVideoAndroidCameraCaptureSessionState_ACTIVE
Definition: videoAndroidPrivate.h:69
@ ARVideoAndroidCameraCaptureSessionState_CLOSED
Definition: videoAndroidPrivate.h:70
@ ARVideoAndroidCameraCaptureSessionState_READY
Definition: videoAndroidPrivate.h:68
@ ARVideoAndroidCameraCaptureSessionState_MAX_STATE
Definition: videoAndroidPrivate.h:71