1 /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
2  *
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are
5  * met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above
9  *       copyright notice, this list of conditions and the following
10  *       disclaimer in the documentation and/or other materials provided
11  *       with the distribution.
12  *     * Neither the name of The Linux Foundation nor the names of its
13  *       contributors may be used to endorse or promote products derived
14  *       from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  */
29 
30 #ifndef __MM_QCAMERA_APP_H__
31 #define __MM_QCAMERA_APP_H__
32 
33 // System dependencies
34 #include <pthread.h>
35 #include <linux/msm_ion.h>
36 #include <linux/msm_mdp.h>
37 
38 // Camera dependencies
39 #include "mm_camera_interface.h"
40 #include "mm_jpeg_interface.h"
41 #include "mm_qcamera_socket.h"
42 
43 #define MM_QCAMERA_APP_INTERATION 1
44 
45 #define MM_APP_MAX_DUMP_FRAME_NUM 1000
46 
47 #define PREVIEW_BUF_NUM 7
48 #define SNAPSHOT_BUF_NUM 10
49 #define VIDEO_BUF_NUM 7
50 #define ISP_PIX_BUF_NUM 9
51 #define STATS_BUF_NUM 4
52 #define RDI_BUF_NUM 8
53 #define CAPTURE_BUF_NUM 5
54 
55 #define DEFAULT_PREVIEW_FORMAT    CAM_FORMAT_YUV_420_NV21
56 #define DEFAULT_PREVIEW_WIDTH     1280
57 #define DEFAULT_PREVIEW_HEIGHT    960
58 #define DEFAULT_PREVIEW_PADDING   CAM_PAD_TO_WORD
59 #define DEFAULT_VIDEO_FORMAT      CAM_FORMAT_YUV_420_NV12
60 #define DEFAULT_VIDEO_WIDTH       800
61 #define DEFAULT_VIDEO_HEIGHT      480
62 #define DEFAULT_VIDEO_PADDING     CAM_PAD_TO_2K
63 #define DEFAULT_SNAPSHOT_FORMAT   CAM_FORMAT_YUV_420_NV21
64 #define DEFAULT_RAW_FORMAT        CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GBRG
65 
66 #define DEFAULT_SNAPSHOT_WIDTH    4160
67 #define DEFAULT_SNAPSHOT_HEIGHT   3120
68 #define DEFAULT_SNAPSHOT_PADDING  CAM_PAD_TO_WORD
69 
70 #define DEFAULT_OV_FORMAT         MDP_Y_CRCB_H2V2
71 #define DEFAULT_OV_FORMAT_BPP     3/2
72 #define DEFAULT_CAMERA_FORMAT_BPP 3/2
73 #define FB_PATH                   "/dev/graphics/fb0"
74 #define BACKLIGHT_CONTROL         "/sys/class/leds/lcd-backlight/brightness"
75 #define BACKLIGHT_LEVEL           "205"
76 
77 #define ENABLE_REPROCESSING       1
78 
79 #define QCAMERA_DUMP_FRM_PREVIEW  1
80 
81 #define INVALID_KEY_PRESS 0
82 #define BASE_OFFSET  ('Z' - 'A' + 1)
83 #define BASE_OFFSET_NUM  ('Z' - 'A' + 2)
84 
85 #ifndef TRUE
86 #define TRUE 1
87 #endif
88 
89 #ifndef FALSE
90 #define FALSE 0
91 #endif
92 
93 typedef enum {
94     TUNE_CMD_INIT,
95     TUNE_CMD_GET_LIST,
96     TUNE_CMD_GET_PARAMS,
97     TUNE_CMD_SET_PARAMS,
98     TUNE_CMD_MISC,
99     TUNE_CMD_DEINIT,
100 } mm_camera_tune_cmd_t;
101 
102 typedef enum {
103     TUNE_PREVCMD_INIT,
104     TUNE_PREVCMD_SETDIM,
105     TUNE_PREVCMD_GETINFO,
106     TUNE_PREVCMD_GETCHUNKSIZE,
107     TUNE_PREVCMD_GETFRAME,
108     TUNE_PREVCMD_UNSUPPORTED,
109     TUNE_PREVCMD_DEINIT,
110 } mm_camera_tune_prevcmd_t;
111 
112 typedef void (*cam_stream_user_cb) (mm_camera_buf_def_t *frame);
113 typedef void (*prev_callback) (mm_camera_buf_def_t *preview_frame);
114 
115 
116 typedef struct {
117   char *send_buf;
118   uint32_t send_len;
119   void *next;
120 } eztune_prevcmd_rsp;
121 
122 typedef struct {
123     int (*command_process) (void *recv, mm_camera_tune_cmd_t cmd,
124       void *param, char *send_buf, uint32_t send_len);
125     int (*prevcommand_process) (void *recv, mm_camera_tune_prevcmd_t cmd,
126       void *param, char **send_buf, uint32_t *send_len);
127     void (*prevframe_callback) (mm_camera_buf_def_t *preview_frame);
128 } mm_camera_tune_func_t;
129 
130 typedef struct {
131     mm_camera_tune_func_t *func_tbl;
132     void *lib_handle;
133 }mm_camera_tuning_lib_params_t;
134 
135 typedef enum {
136     MM_CAMERA_OK,
137     MM_CAMERA_E_GENERAL,
138     MM_CAMERA_E_NO_MEMORY,
139     MM_CAMERA_E_NOT_SUPPORTED,
140     MM_CAMERA_E_INVALID_INPUT,
141     MM_CAMERA_E_INVALID_OPERATION, /* 5 */
142     MM_CAMERA_E_ENCODE,
143     MM_CAMERA_E_BUFFER_REG,
144     MM_CAMERA_E_PMEM_ALLOC,
145     MM_CAMERA_E_CAPTURE_FAILED,
146     MM_CAMERA_E_CAPTURE_TIMEOUT, /* 10 */
147 } mm_camera_status_type_t;
148 
149 typedef enum {
150     MM_CHANNEL_TYPE_ZSL,      /* preview, and snapshot main */
151     MM_CHANNEL_TYPE_CAPTURE,  /* snapshot main, and postview */
152     MM_CHANNEL_TYPE_PREVIEW,  /* preview only */
153     MM_CHANNEL_TYPE_SNAPSHOT, /* snapshot main only */
154     MM_CHANNEL_TYPE_VIDEO,    /* video only */
155     MM_CHANNEL_TYPE_RDI,      /* rdi only */
156     MM_CHANNEL_TYPE_REPROCESS,/* offline reprocess */
157     MM_CHANNEL_TYPE_MAX
158 } mm_camera_channel_type_t;
159 
160 typedef struct {
161     int                     fd;
162     int                     main_ion_fd;
163     ion_user_handle_t       handle;
164     size_t                  size;
165     parm_buffer_t          *data;
166 } mm_camera_app_meminfo_t;
167 
168 typedef struct {
169     mm_camera_buf_def_t buf;
170     mm_camera_app_meminfo_t mem_info;
171 } mm_camera_app_buf_t;
172 
173 typedef struct {
174     uint32_t s_id;
175     mm_camera_stream_config_t s_config;
176     cam_frame_len_offset_t offset;
177     uint8_t num_of_bufs;
178     uint32_t multipleOf;
179     mm_camera_app_buf_t s_bufs[MM_CAMERA_MAX_NUM_FRAMES];
180     mm_camera_app_buf_t s_info_buf;
181 } mm_camera_stream_t;
182 
183 typedef struct {
184     uint32_t ch_id;
185     uint8_t num_streams;
186     mm_camera_stream_t streams[MAX_STREAM_NUM_IN_BUNDLE];
187 } mm_camera_channel_t;
188 
189 typedef void (*release_data_fn)(void* data, void *user_data);
190 
191 typedef struct {
192     struct cam_list list;
193     void* data;
194 } camera_q_node;
195 
196 typedef struct {
197     camera_q_node m_head;
198     int m_size;
199     pthread_mutex_t m_lock;
200     release_data_fn m_dataFn;
201     void * m_userData;
202 } mm_camera_queue_t;
203 
204 typedef struct {
205     uint16_t user_input_display_width;
206     uint16_t user_input_display_height;
207 } USER_INPUT_DISPLAY_T;
208 
209 typedef struct {
210     mm_camera_vtbl_t *cam;
211     uint8_t num_channels;
212     mm_camera_channel_t channels[MM_CHANNEL_TYPE_MAX];
213     mm_jpeg_ops_t jpeg_ops;
214     uint32_t jpeg_hdl;
215     mm_camera_app_buf_t cap_buf;
216     mm_camera_app_buf_t parm_buf;
217 
218     uint32_t current_jpeg_sess_id;
219     mm_camera_super_buf_t* current_job_frames;
220     uint32_t current_job_id;
221     mm_camera_app_buf_t jpeg_buf;
222 
223     int fb_fd;
224     struct fb_var_screeninfo vinfo;
225     struct mdp_overlay data_overlay;
226     uint32_t slice_size;
227     uint32_t buffer_width, buffer_height;
228     uint32_t buffer_size;
229     cam_format_t buffer_format;
230     uint32_t frame_size;
231     uint32_t frame_count;
232     int encodeJpeg;
233     int zsl_enabled;
234     int8_t focus_supported;
235     cam_stream_user_cb user_preview_cb;
236     cam_stream_user_cb user_metadata_cb;
237     parm_buffer_t *params_buffer;
238     USER_INPUT_DISPLAY_T preview_resolution;
239 
240     //Reprocess params&stream
241     int8_t enable_reproc;
242     int32_t reproc_sharpness;
243     cam_denoise_param_t reproc_wnr;
244     int8_t enable_CAC;
245     int8_t enable_EZTune;
246     int8_t enable_ir;
247     int8_t enable_shdr;
248     int32_t flip_mode;
249     mm_camera_queue_t pp_frames;
250     mm_camera_stream_t *reproc_stream;
251     metadata_buffer_t *metadata;
252     mm_jpeg_exif_params_t mExifParams;
253     int8_t is_chromatix_reload;
254 } mm_camera_test_obj_t;
255 
256 typedef struct {
257   void *ptr;
258   void* ptr_jpeg;
259 
260   uint8_t (*get_num_of_cameras) ();
261   int32_t (*mm_camera_open) (uint8_t camera_idx, mm_camera_vtbl_t **camera_vtbl);
262   uint32_t (*jpeg_open)(mm_jpeg_ops_t *ops, mm_jpeg_mpo_ops_t *mpo_ops,
263                    mm_dimension picture_size,
264                    cam_jpeg_metadata_t *jpeg_metadata);
265 
266 } hal_interface_lib_t;
267 
268 typedef struct {
269     uint8_t num_cameras;
270     hal_interface_lib_t hal_lib;
271 } mm_camera_app_t;
272 
273 typedef struct {
274     uint32_t width;
275     uint32_t height;
276     int isZSL;
277 } mm_camera_lib_snapshot_params;
278 
279 typedef enum {
280     MM_CAMERA_LIB_NO_ACTION = 0,
281     MM_CAMERA_LIB_RAW_CAPTURE,
282     MM_CAMERA_LIB_JPEG_CAPTURE,
283     MM_CAMERA_LIB_SET_FOCUS_MODE,
284     MM_CAMERA_LIB_DO_AF,
285     MM_CAMERA_LIB_CANCEL_AF,
286     MM_CAMERA_LIB_LOCK_AE,
287     MM_CAMERA_LIB_UNLOCK_AE,
288     MM_CAMERA_LIB_LOCK_AWB,
289     MM_CAMERA_LIB_UNLOCK_AWB,
290     MM_CAMERA_LIB_GET_CHROMATIX,
291     MM_CAMERA_LIB_SET_RELOAD_CHROMATIX,
292     MM_CAMERA_LIB_GET_AFTUNE,
293     MM_CAMERA_LIB_SET_RELOAD_AFTUNE,
294     MM_CAMERA_LIB_SET_AUTOFOCUS_TUNING,
295     MM_CAMERA_LIB_ZSL_ENABLE,
296     MM_CAMERA_LIB_EV,
297     MM_CAMERA_LIB_ANTIBANDING,
298     MM_CAMERA_LIB_FLIP,
299     MM_CAMERA_LIB_SET_VFE_COMMAND,
300     MM_CAMERA_LIB_SET_POSTPROC_COMMAND,
301     MM_CAMERA_LIB_SET_3A_COMMAND,
302     MM_CAMERA_LIB_AEC_ENABLE,
303     MM_CAMERA_LIB_AEC_DISABLE,
304     MM_CAMERA_LIB_AF_ENABLE,
305     MM_CAMERA_LIB_AF_DISABLE,
306     MM_CAMERA_LIB_AWB_ENABLE,
307     MM_CAMERA_LIB_AWB_DISABLE,
308     MM_CAMERA_LIB_AEC_FORCE_LC,
309     MM_CAMERA_LIB_AEC_FORCE_GAIN,
310     MM_CAMERA_LIB_AEC_FORCE_EXP,
311     MM_CAMERA_LIB_AEC_FORCE_SNAP_LC,
312     MM_CAMERA_LIB_AEC_FORCE_SNAP_GAIN,
313     MM_CAMERA_LIB_AEC_FORCE_SNAP_EXP,
314     MM_CAMERA_LIB_WB,
315     MM_CAMERA_LIB_MN_WB,
316     MM_CAMERA_LIB_EXPOSURE_METERING,
317     MM_CAMERA_LIB_BRIGHTNESS,
318     MM_CAMERA_LIB_CONTRAST,
319     MM_CAMERA_LIB_SATURATION,
320     MM_CAMERA_LIB_SHARPNESS,
321     MM_CAMERA_LIB_ISO,
322     MM_CAMERA_LIB_ZOOM,
323     MM_CAMERA_LIB_BESTSHOT,
324     MM_CAMERA_LIB_FLASH,
325     MM_CAMERA_LIB_FPS_RANGE,
326     MM_CAMERA_LIB_WNR_ENABLE,
327     MM_CAMERA_LIB_SET_TINTLESS,
328     MM_CAMERA_LIB_EZTUNE_ENABLE,
329     MM_CAMERA_LIB_IRMODE,
330     MM_CAMERA_LIB_SHDR_MODE,
331     MM_CAMERA_LIB_SPL_EFFECT,
332 } mm_camera_lib_commands;
333 
334 typedef struct {
335     int32_t stream_width, stream_height;
336     cam_focus_mode_type af_mode;
337 } mm_camera_lib_params;
338 
339 typedef struct {
340   tuneserver_protocol_t *proto;
341   int clientsocket_id;
342   prserver_protocol_t *pr_proto;
343   int pr_clientsocket_id;
344   mm_camera_tuning_lib_params_t tuning_params;
345 } tuningserver_t;
346 
347 typedef struct {
348     mm_camera_app_t app_ctx;
349     mm_camera_test_obj_t test_obj;
350     mm_camera_lib_params current_params;
351     int stream_running;
352     tuningserver_t tsctrl;
353 } mm_camera_lib_ctx;
354 
355 typedef mm_camera_lib_ctx mm_camera_lib_handle;
356 
357 typedef int (*mm_app_test_t) (mm_camera_app_t *cam_apps);
358 typedef struct {
359     mm_app_test_t f;
360     int r;
361 } mm_app_tc_t;
362 
363 extern int mm_app_unit_test_entry(mm_camera_app_t *cam_app);
364 extern int mm_app_dual_test_entry(mm_camera_app_t *cam_app);
365 extern int setmetainfoCommand(mm_camera_test_obj_t *test_obj,
366                               cam_stream_size_info_t *value);
367 
368 extern void mm_app_dump_frame(mm_camera_buf_def_t *frame,
369                               char *name,
370                               char *ext,
371                               uint32_t frame_idx);
372 extern void mm_app_dump_jpeg_frame(const void * data,
373                                    size_t size,
374                                    char* name,
375                                    char* ext,
376                                    uint32_t index);
377 extern int mm_camera_app_timedwait(uint8_t seconds);
378 extern int mm_camera_app_wait();
379 extern void mm_camera_app_done();
380 extern int mm_app_alloc_bufs(mm_camera_app_buf_t* app_bufs,
381                              cam_frame_len_offset_t *frame_offset_info,
382                              uint8_t num_bufs,
383                              uint8_t is_streambuf,
384                              size_t multipleOf);
385 extern int mm_app_release_bufs(uint8_t num_bufs,
386                                mm_camera_app_buf_t* app_bufs);
387 extern int mm_app_stream_initbuf(cam_frame_len_offset_t *frame_offset_info,
388                                  uint8_t *num_bufs,
389                                  uint8_t **initial_reg_flag,
390                                  mm_camera_buf_def_t **bufs,
391                                  mm_camera_map_unmap_ops_tbl_t *ops_tbl,
392                                  void *user_data);
393 extern int32_t mm_app_stream_deinitbuf(mm_camera_map_unmap_ops_tbl_t *ops_tbl,
394                                        void *user_data);
395 extern int mm_app_cache_ops(mm_camera_app_meminfo_t *mem_info, int cmd);
396 extern int32_t mm_app_stream_clean_invalidate_buf(uint32_t index, void *user_data);
397 extern int32_t mm_app_stream_invalidate_buf(uint32_t index, void *user_data);
398 extern int32_t mm_app_stream_clean_buf(uint32_t index, void *user_data);
399 
400 extern int mm_app_open(mm_camera_app_t *cam_app,
401                        int cam_id,
402                        mm_camera_test_obj_t *test_obj);
403 extern int mm_app_close(mm_camera_test_obj_t *test_obj);
404 extern mm_camera_channel_t * mm_app_add_channel(
405                                          mm_camera_test_obj_t *test_obj,
406                                          mm_camera_channel_type_t ch_type,
407                                          mm_camera_channel_attr_t *attr,
408                                          mm_camera_buf_notify_t channel_cb,
409                                          void *userdata);
410 extern int mm_app_del_channel(mm_camera_test_obj_t *test_obj,
411                               mm_camera_channel_t *channel);
412 extern mm_camera_stream_t * mm_app_add_stream(mm_camera_test_obj_t *test_obj,
413                                               mm_camera_channel_t *channel);
414 extern int mm_app_del_stream(mm_camera_test_obj_t *test_obj,
415                              mm_camera_channel_t *channel,
416                              mm_camera_stream_t *stream);
417 extern int mm_app_config_stream(mm_camera_test_obj_t *test_obj,
418                                 mm_camera_channel_t *channel,
419                                 mm_camera_stream_t *stream,
420                                 mm_camera_stream_config_t *config);
421 extern int mm_app_start_channel(mm_camera_test_obj_t *test_obj,
422                                 mm_camera_channel_t *channel);
423 extern int mm_app_stop_channel(mm_camera_test_obj_t *test_obj,
424                                mm_camera_channel_t *channel);
425 extern mm_camera_channel_t *mm_app_get_channel_by_type(
426                                     mm_camera_test_obj_t *test_obj,
427                                     mm_camera_channel_type_t ch_type);
428 
429 extern int mm_app_start_preview(mm_camera_test_obj_t *test_obj);
430 extern int mm_app_stop_preview(mm_camera_test_obj_t *test_obj);
431 extern int mm_app_start_preview_zsl(mm_camera_test_obj_t *test_obj);
432 extern int mm_app_stop_preview_zsl(mm_camera_test_obj_t *test_obj);
433 extern mm_camera_channel_t * mm_app_add_preview_channel(
434                                 mm_camera_test_obj_t *test_obj);
435 extern mm_camera_stream_t * mm_app_add_raw_stream(mm_camera_test_obj_t *test_obj,
436                                                 mm_camera_channel_t *channel,
437                                                 mm_camera_buf_notify_t stream_cb,
438                                                 void *userdata,
439                                                 uint8_t num_bufs,
440                                                 uint8_t num_burst);
441 extern int mm_app_stop_and_del_channel(mm_camera_test_obj_t *test_obj,
442                                        mm_camera_channel_t *channel);
443 extern mm_camera_channel_t * mm_app_add_snapshot_channel(
444                                                mm_camera_test_obj_t *test_obj);
445 extern mm_camera_stream_t * mm_app_add_snapshot_stream(
446                                                 mm_camera_test_obj_t *test_obj,
447                                                 mm_camera_channel_t *channel,
448                                                 mm_camera_buf_notify_t stream_cb,
449                                                 void *userdata,
450                                                 uint8_t num_bufs,
451                                                 uint8_t num_burst);
452 extern mm_camera_stream_t * mm_app_add_metadata_stream(mm_camera_test_obj_t *test_obj,
453                                                mm_camera_channel_t *channel,
454                                                mm_camera_buf_notify_t stream_cb,
455                                                void *userdata,
456                                                uint8_t num_bufs);
457 extern int mm_app_start_record_preview(mm_camera_test_obj_t *test_obj, mm_camera_lib_snapshot_params *dim);
458 extern int mm_app_stop_record_preview(mm_camera_test_obj_t *test_obj);
459 extern int mm_app_start_record(mm_camera_test_obj_t *test_obj);
460 extern int mm_app_stop_record(mm_camera_test_obj_t *test_obj);
461 extern int mm_app_start_live_snapshot(mm_camera_test_obj_t *test_obj);
462 extern int mm_app_stop_live_snapshot(mm_camera_test_obj_t *test_obj);
463 extern int mm_app_start_capture(mm_camera_test_obj_t *test_obj,
464                                 uint8_t num_snapshots);
465 extern int mm_app_stop_capture(mm_camera_test_obj_t *test_obj);
466 extern int mm_app_start_capture_raw(mm_camera_test_obj_t *test_obj,
467                                     uint8_t num_snapshots);
468 extern int mm_app_stop_capture_raw(mm_camera_test_obj_t *test_obj);
469 extern int mm_app_start_rdi(mm_camera_test_obj_t *test_obj, uint8_t num_burst);
470 extern int mm_app_stop_rdi(mm_camera_test_obj_t *test_obj);
471 extern int mm_app_initialize_fb(mm_camera_test_obj_t *test_obj);
472 extern int mm_app_close_fb(mm_camera_test_obj_t *test_obj);
473 extern int mm_app_fb_write(mm_camera_test_obj_t *test_obj, char *buffer);
474 extern int mm_app_overlay_display(mm_camera_test_obj_t *test_obj, int bufferFd);
475 extern int mm_app_allocate_ion_memory(mm_camera_app_buf_t *buf, unsigned int ion_type);
476 extern int mm_app_deallocate_ion_memory(mm_camera_app_buf_t *buf);
477 extern int mm_app_set_params(mm_camera_test_obj_t *test_obj,
478                       cam_intf_parm_type_t param_type,
479                       int32_t value);
480 extern int mm_app_set_preview_fps_range(mm_camera_test_obj_t *test_obj,
481                         cam_fps_range_t *fpsRange);
482 extern int mm_app_set_face_detection(mm_camera_test_obj_t *test_obj,
483                         cam_fd_set_parm_t *fd_set_parm);
484 extern int mm_app_set_metadata_usercb(mm_camera_test_obj_t *test_obj,
485                       cam_stream_user_cb usercb);
486 extern int mm_app_set_face_detection(mm_camera_test_obj_t *test_obj,
487         cam_fd_set_parm_t *fd_set_parm);
488 extern int mm_app_set_flash_mode(mm_camera_test_obj_t *test_obj,
489         cam_flash_mode_t flashMode);
490 
491 /* JIG camera lib interface */
492 
493 int mm_camera_lib_open(mm_camera_lib_handle *handle, int cam_id);
494 int mm_camera_lib_get_caps(mm_camera_lib_handle *handle,
495                            cam_capability_t *caps);
496 int mm_camera_lib_start_stream(mm_camera_lib_handle *handle);
497 int mm_camera_lib_send_command(mm_camera_lib_handle *handle,
498                                mm_camera_lib_commands cmd,
499                                void *data, void *out_data);
500 int mm_camera_lib_stop_stream(mm_camera_lib_handle *handle);
501 int mm_camera_lib_number_of_cameras(mm_camera_lib_handle *handle);
502 int mm_camera_lib_close(mm_camera_lib_handle *handle);
503 int32_t mm_camera_load_tuninglibrary(
504   mm_camera_tuning_lib_params_t *tuning_param);
505 int mm_camera_lib_set_preview_usercb(
506   mm_camera_lib_handle *handle, cam_stream_user_cb cb);
507 //
508 
509 int mm_app_start_regression_test(int run_tc);
510 int mm_app_load_hal(mm_camera_app_t *my_cam_app);
511 
512 extern int createEncodingSession(mm_camera_test_obj_t *test_obj,
513                           mm_camera_stream_t *m_stream,
514                           mm_camera_buf_def_t *m_frame);
515 extern int encodeData(mm_camera_test_obj_t *test_obj, mm_camera_super_buf_t* recvd_frame,
516                mm_camera_stream_t *m_stream);
517 extern int mm_app_take_picture(mm_camera_test_obj_t *test_obj, uint8_t);
518 
519 extern mm_camera_channel_t * mm_app_add_reprocess_channel(mm_camera_test_obj_t *test_obj,
520                                                    mm_camera_stream_t *source_stream);
521 extern int mm_app_start_reprocess(mm_camera_test_obj_t *test_obj);
522 extern int mm_app_stop_reprocess(mm_camera_test_obj_t *test_obj);
523 extern int mm_app_do_reprocess(mm_camera_test_obj_t *test_obj,
524         mm_camera_buf_def_t *frame,
525         uint32_t meta_idx,
526         mm_camera_super_buf_t *super_buf,
527         mm_camera_stream_t *src_meta);
528 extern void mm_app_release_ppinput(void *data, void *user_data);
529 
530 extern int mm_camera_queue_init(mm_camera_queue_t *queue,
531                          release_data_fn data_rel_fn,
532                          void *user_data);
533 extern int mm_qcamera_queue_release(mm_camera_queue_t *queue);
534 extern int mm_qcamera_queue_isempty(mm_camera_queue_t *queue);
535 extern int mm_qcamera_queue_enqueue(mm_camera_queue_t *queue, void *data);
536 extern void* mm_qcamera_queue_dequeue(mm_camera_queue_t *queue,
537                                       int bFromHead);
538 extern void mm_qcamera_queue_flush(mm_camera_queue_t *queue);
539 
540 #endif /* __MM_QCAMERA_APP_H__ */
541 
542 
543 
544 
545 
546 
547 
548 
549 
550