1#ifndef CAMERA_TEST_H
2#define CAMERA_TEST_H
3
4#define PRINTOVER(arg...)     ALOGD(#arg)
5#define LOG_FUNCTION_NAME         ALOGD("%d: %s() ENTER", __LINE__, __FUNCTION__);
6#define LOG_FUNCTION_NAME_EXIT    ALOGD("%d: %s() EXIT", __LINE__, __FUNCTION__);
7#define KEY_GBCE            "gbce"
8#define KEY_GLBCE           "glbce"
9#define KEY_CAMERA          "camera-index"
10#define KEY_SATURATION      "saturation"
11#define KEY_BRIGHTNESS      "brightness"
12#define KEY_BURST           "burst-capture"
13#define KEY_EXPOSURE        "exposure"
14#define KEY_CONTRAST        "contrast"
15#define KEY_SHARPNESS       "sharpness"
16#define KEY_ISO             "iso"
17#define KEY_CAF             "caf"
18#define KEY_MODE            "mode"
19#define KEY_VNF             "vnf"
20#define KEY_VSTAB           "vstab"
21#define KEY_COMPENSATION    "exposure-compensation"
22
23#define KEY_IPP             "ipp"
24
25#define KEY_BUFF_STARV      "buff-starvation"
26#define KEY_METERING_MODE   "meter-mode"
27#define KEY_AUTOCONVERGENCE "auto-convergence"
28#define KEY_MANUALCONVERGENCE_VALUES "manual-convergence-values"
29#define AUTOCONVERGENCE_MODE_MANUAL "mode-manual"
30#define KEY_EXP_BRACKETING_RANGE "exp-bracketing-range"
31#define KEY_TEMP_BRACKETING "temporal-bracketing"
32#define KEY_TEMP_BRACKETING_POS "temporal-bracketing-range-positive"
33#define KEY_TEMP_BRACKETING_NEG "temporal-bracketing-range-negative"
34#define KEY_MEASUREMENT "measurement"
35#define KEY_S3D2D_PREVIEW_MODE "s3d2d-preview"
36#define KEY_STEREO_CAMERA "s3d-supported"
37#define KEY_EXIF_MODEL "exif-model"
38#define KEY_EXIF_MAKE "exif-make"
39
40#define KEY_AUTO_EXPOSURE_LOCK "auto-exposure-lock"
41#define KEY_AUTO_WHITEBALANCE_LOCK "auto-whitebalance-lock"
42
43#define SDCARD_PATH "/sdcard/"
44
45#define MAX_BURST   15
46#define BURST_INC     5
47#define TEMP_BRACKETING_MAX_RANGE 4
48
49#define MEDIASERVER_DUMP "procmem -w $(ps | grep mediaserver | grep -Eo '[0-9]+' | head -n 1) | grep \"\\(Name\\|libcamera.so\\|libOMX\\|libomxcameraadapter.so\\|librcm.so\\|libnotify.so\\|libipcutils.so\\|libipc.so\\|libsysmgr.so\\|TOTAL\\)\""
50#define MEMORY_DUMP "procrank -u"
51#define KEY_METERING_MODE   "meter-mode"
52
53#define TEST_FOCUS_AREA "(0,0,1000,1000,300),(-1000,-1000,1000,1000,300),(0,0,0,0,0)"
54
55#define COMPENSATION_OFFSET 20
56#define DELIMITER           "|"
57
58#define MAX_PREVIEW_SURFACE_WIDTH   800
59#define MAX_PREVIEW_SURFACE_HEIGHT  480
60
61#define MODEL "camera_test"
62#define MAKE "camera_test"
63
64#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
65
66namespace android {
67    class CameraHandler: public CameraListener {
68        public:
69            virtual void notify(int32_t msgType, int32_t ext1, int32_t ext2);
70            virtual void postData(int32_t msgType,
71                                  const sp<IMemory>& dataPtr,
72                                  camera_frame_metadata_t *metadata);
73
74            virtual void postDataTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr);
75    };
76
77};
78
79using namespace android;
80
81char * get_cycle_cmd(const char *aSrc);
82int execute_functional_script(char *script);
83status_t dump_mem_status();
84int openCamera();
85int closeCamera();
86void initDefaults();
87int startPreview();
88void stopPreview();
89int startRecording();
90int stopRecording();
91int closeRecorder();
92int openRecorder();
93int configureRecorder();
94void printSupportedParams();
95char *load_script(char *config);
96int start_logging(char *config, int &pid);
97int stop_logging(int &pid);
98int execute_error_script(char *script);
99
100typedef struct pixel_format_t {
101    int32_t pixelFormatDesc;
102    const char *pixformat;
103}pixel_format;
104
105typedef struct output_format_t {
106    output_format type;
107    const char *desc;
108} outformat;
109
110typedef struct preview_size_t {
111    int width, height;
112    const char *desc;
113} preview_size;
114
115typedef struct Vcapture_size_t {
116    int width, height;
117    const char *desc;
118} Vcapture_size;
119
120typedef struct capture_Size_t {
121    int width, height;
122    const char *name;
123} capture_Size;
124
125typedef struct video_Codecs_t {
126    video_encoder type;
127    const char *desc;
128} video_Codecs;
129
130typedef struct audio_Codecs_t {
131    audio_encoder type;
132    const char *desc;
133} audio_Codecs;
134
135typedef struct V_bitRate_t {
136    uint32_t bit_rate;
137    const char *desc;
138} V_bitRate;
139
140typedef struct zoom_t {
141    int idx;
142    const char *zoom_description;
143} Zoom;
144
145typedef struct fps_ranges_t {
146    const char *range;
147    const char *rangeDescription;
148} fps_ranges;
149
150typedef struct fpsConst_Ranges_t {
151    const char *range;
152    const char *rangeDescription;
153    int constFramerate;
154} fpsConst_Ranges;
155
156typedef struct fpsConst_RangesSec_t {
157    const char *range;
158    const char *rangeDescription;
159    int constFramerate;
160} fpsConst_RangesSec;
161
162#endif
163