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 INVALID_KEY_PRESS 0
80 #define BASE_OFFSET  ('Z' - 'A' + 1)
81 #define BASE_OFFSET_NUM  ('Z' - 'A' + 2)
82 
83 #ifndef TRUE
84 #define TRUE 1
85 #endif
86 
87 #ifndef FALSE
88 #define FALSE 0
89 #endif
90 
91 typedef enum {
92     TUNE_CMD_INIT,
93     TUNE_CMD_GET_LIST,
94     TUNE_CMD_GET_PARAMS,
95     TUNE_CMD_SET_PARAMS,
96     TUNE_CMD_MISC,
97     TUNE_CMD_DEINIT,
98 } mm_camera_tune_cmd_t;
99 
100 typedef enum {
101     TUNE_PREVCMD_INIT,
102     TUNE_PREVCMD_SETDIM,
103     TUNE_PREVCMD_GETINFO,
104     TUNE_PREVCMD_GETCHUNKSIZE,
105     TUNE_PREVCMD_GETFRAME,
106     TUNE_PREVCMD_UNSUPPORTED,
107     TUNE_PREVCMD_DEINIT,
108 } mm_camera_tune_prevcmd_t;
109 
110 typedef void (*cam_stream_user_cb) (mm_camera_buf_def_t *frame);
111 typedef void (*prev_callback) (mm_camera_buf_def_t *preview_frame);
112 
113 
114 typedef struct {
115   char *send_buf;
116   uint32_t send_len;
117   void *next;
118 } eztune_prevcmd_rsp;
119 
120 typedef struct {
121     int (*command_process) (void *recv, mm_camera_tune_cmd_t cmd,
122       void *param, char *send_buf, uint32_t send_len);
123     int (*prevcommand_process) (void *recv, mm_camera_tune_prevcmd_t cmd,
124       void *param, char **send_buf, uint32_t *send_len);
125     void (*prevframe_callback) (mm_camera_buf_def_t *preview_frame);
126 } mm_camera_tune_func_t;
127 
128 typedef struct {
129     mm_camera_tune_func_t *func_tbl;
130     void *lib_handle;
131 }mm_camera_tuning_lib_params_t;
132 
133 typedef enum {
134     MM_CAMERA_OK,
135     MM_CAMERA_E_GENERAL,
136     MM_CAMERA_E_NO_MEMORY,
137     MM_CAMERA_E_NOT_SUPPORTED,
138     MM_CAMERA_E_INVALID_INPUT,
139     MM_CAMERA_E_INVALID_OPERATION, /* 5 */
140     MM_CAMERA_E_ENCODE,
141     MM_CAMERA_E_BUFFER_REG,
142     MM_CAMERA_E_PMEM_ALLOC,
143     MM_CAMERA_E_CAPTURE_FAILED,
144     MM_CAMERA_E_CAPTURE_TIMEOUT, /* 10 */
145 } mm_camera_status_type_t;
146 
147 typedef enum {
148     MM_CHANNEL_TYPE_ZSL,      /* preview, and snapshot main */
149     MM_CHANNEL_TYPE_CAPTURE,  /* snapshot main, and postview */
150     MM_CHANNEL_TYPE_PREVIEW,  /* preview only */
151     MM_CHANNEL_TYPE_SNAPSHOT, /* snapshot main only */
152     MM_CHANNEL_TYPE_VIDEO,    /* video only */
153     MM_CHANNEL_TYPE_RDI,      /* rdi only */
154     MM_CHANNEL_TYPE_REPROCESS,/* offline reprocess */
155     MM_CHANNEL_TYPE_MAX
156 } mm_camera_channel_type_t;
157 
158 typedef struct {
159     int                     fd;
160     int                     main_ion_fd;
161     ion_user_handle_t       handle;
162     size_t                  size;
163     parm_buffer_t          *data;
164 } mm_camera_app_meminfo_t;
165 
166 typedef struct {
167     mm_camera_buf_def_t buf;
168     mm_camera_app_meminfo_t mem_info;
169 } mm_camera_app_buf_t;
170 
171 typedef struct {
172     uint32_t s_id;
173     mm_camera_stream_config_t s_config;
174     cam_frame_len_offset_t offset;
175     uint8_t num_of_bufs;
176     uint32_t multipleOf;
177     mm_camera_app_buf_t s_bufs[MM_CAMERA_MAX_NUM_FRAMES];
178     mm_camera_app_buf_t s_info_buf;
179 } mm_camera_stream_t;
180 
181 typedef struct {
182     uint32_t ch_id;
183     uint8_t num_streams;
184     mm_camera_stream_t streams[MAX_STREAM_NUM_IN_BUNDLE];
185 } mm_camera_channel_t;
186 
187 typedef void (*release_data_fn)(void* data, void *user_data);
188 
189 typedef struct {
190     struct cam_list list;
191     void* data;
192 } camera_q_node;
193 
194 typedef struct {
195     camera_q_node m_head;
196     int m_size;
197     pthread_mutex_t m_lock;
198     release_data_fn m_dataFn;
199     void * m_userData;
200 } mm_camera_queue_t;
201 
202 typedef struct {
203     uint16_t user_input_display_width;
204     uint16_t user_input_display_height;
205 } USER_INPUT_DISPLAY_T;
206 
207 typedef struct {
208     mm_camera_vtbl_t *cam;
209     uint8_t num_channels;
210     mm_camera_channel_t channels[MM_CHANNEL_TYPE_MAX];
211     mm_jpeg_ops_t jpeg_ops;
212     uint32_t jpeg_hdl;
213     mm_camera_app_buf_t cap_buf;
214     mm_camera_app_buf_t parm_buf;
215 
216     uint32_t current_jpeg_sess_id;
217     mm_camera_super_buf_t* current_job_frames;
218     uint32_t current_job_id;
219     mm_camera_app_buf_t jpeg_buf;
220 
221     int fb_fd;
222     struct fb_var_screeninfo vinfo;
223     struct mdp_overlay data_overlay;
224     uint32_t slice_size;
225     uint32_t buffer_width, buffer_height;
226     uint32_t buffer_size;
227     cam_format_t buffer_format;
228     uint32_t frame_size;
229     uint32_t frame_count;
230     int encodeJpeg;
231     int zsl_enabled;
232     int8_t focus_supported;
233     cam_stream_user_cb user_preview_cb;
234     cam_stream_user_cb user_metadata_cb;
235     parm_buffer_t *params_buffer;
236     USER_INPUT_DISPLAY_T preview_resolution;
237 
238     //Reprocess params&stream
239     int8_t enable_reproc;
240     int32_t reproc_sharpness;
241     cam_denoise_param_t reproc_wnr;
242     int8_t enable_CAC;
243     mm_camera_queue_t pp_frames;
244     mm_camera_stream_t *reproc_stream;
245     metadata_buffer_t *metadata;
246     int8_t is_chromatix_reload;
247 } mm_camera_test_obj_t;
248 
249 typedef struct {
250   void *ptr;
251   void* ptr_jpeg;
252 
253   uint8_t (*get_num_of_cameras) ();
254   int32_t (*mm_camera_open) (uint8_t camera_idx, mm_camera_vtbl_t **camera_vtbl);
255   uint32_t (*jpeg_open)(mm_jpeg_ops_t *ops, mm_jpeg_mpo_ops_t *mpo_ops,
256                    mm_dimension picture_size,
257                    cam_jpeg_metadata_t *jpeg_metadata);
258 
259 } hal_interface_lib_t;
260 
261 typedef struct {
262     uint8_t num_cameras;
263     hal_interface_lib_t hal_lib;
264 } mm_camera_app_t;
265 
266 typedef struct {
267     uint32_t width;
268     uint32_t height;
269 } mm_camera_lib_snapshot_params;
270 
271 typedef enum {
272     MM_CAMERA_LIB_NO_ACTION = 0,
273     MM_CAMERA_LIB_RAW_CAPTURE,
274     MM_CAMERA_LIB_JPEG_CAPTURE,
275     MM_CAMERA_LIB_SET_FOCUS_MODE,
276     MM_CAMERA_LIB_DO_AF,
277     MM_CAMERA_LIB_CANCEL_AF,
278     MM_CAMERA_LIB_LOCK_AE,
279     MM_CAMERA_LIB_UNLOCK_AE,
280     MM_CAMERA_LIB_LOCK_AWB,
281     MM_CAMERA_LIB_UNLOCK_AWB,
282     MM_CAMERA_LIB_GET_CHROMATIX,
283     MM_CAMERA_LIB_SET_RELOAD_CHROMATIX,
284     MM_CAMERA_LIB_GET_AFTUNE,
285     MM_CAMERA_LIB_SET_RELOAD_AFTUNE,
286     MM_CAMERA_LIB_SET_AUTOFOCUS_TUNING,
287     MM_CAMERA_LIB_ZSL_ENABLE,
288     MM_CAMERA_LIB_EV,
289     MM_CAMERA_LIB_ANTIBANDING,
290     MM_CAMERA_LIB_SET_VFE_COMMAND,
291     MM_CAMERA_LIB_SET_POSTPROC_COMMAND,
292     MM_CAMERA_LIB_SET_3A_COMMAND,
293     MM_CAMERA_LIB_AEC_ENABLE,
294     MM_CAMERA_LIB_AEC_DISABLE,
295     MM_CAMERA_LIB_AF_ENABLE,
296     MM_CAMERA_LIB_AF_DISABLE,
297     MM_CAMERA_LIB_AWB_ENABLE,
298     MM_CAMERA_LIB_AWB_DISABLE,
299     MM_CAMERA_LIB_AEC_FORCE_LC,
300     MM_CAMERA_LIB_AEC_FORCE_GAIN,
301     MM_CAMERA_LIB_AEC_FORCE_EXP,
302     MM_CAMERA_LIB_AEC_FORCE_SNAP_LC,
303     MM_CAMERA_LIB_AEC_FORCE_SNAP_GAIN,
304     MM_CAMERA_LIB_AEC_FORCE_SNAP_EXP,
305     MM_CAMERA_LIB_WB,
306     MM_CAMERA_LIB_EXPOSURE_METERING,
307     MM_CAMERA_LIB_BRIGHTNESS,
308     MM_CAMERA_LIB_CONTRAST,
309     MM_CAMERA_LIB_SATURATION,
310     MM_CAMERA_LIB_SHARPNESS,
311     MM_CAMERA_LIB_ISO,
312     MM_CAMERA_LIB_ZOOM,
313     MM_CAMERA_LIB_BESTSHOT,
314     MM_CAMERA_LIB_FLASH,
315     MM_CAMERA_LIB_FPS_RANGE,
316     MM_CAMERA_LIB_WNR_ENABLE,
317     MM_CAMERA_LIB_SET_TINTLESS,
318 } mm_camera_lib_commands;
319 
320 typedef struct {
321     int32_t stream_width, stream_height;
322     cam_focus_mode_type af_mode;
323 } mm_camera_lib_params;
324 
325 typedef struct {
326   tuneserver_protocol_t *proto;
327   int clientsocket_id;
328   prserver_protocol_t *pr_proto;
329   int pr_clientsocket_id;
330   mm_camera_tuning_lib_params_t tuning_params;
331 } tuningserver_t;
332 
333 typedef struct {
334     mm_camera_app_t app_ctx;
335     mm_camera_test_obj_t test_obj;
336     mm_camera_lib_params current_params;
337     int stream_running;
338     tuningserver_t tsctrl;
339 } mm_camera_lib_ctx;
340 
341 typedef mm_camera_lib_ctx mm_camera_lib_handle;
342 
343 typedef int (*mm_app_test_t) (mm_camera_app_t *cam_apps);
344 typedef struct {
345     mm_app_test_t f;
346     int r;
347 } mm_app_tc_t;
348 
349 extern int mm_app_unit_test_entry(mm_camera_app_t *cam_app);
350 extern int mm_app_dual_test_entry(mm_camera_app_t *cam_app);
351 extern int setmetainfoCommand(mm_camera_test_obj_t *test_obj,
352                               cam_stream_size_info_t *value);
353 
354 extern void mm_app_dump_frame(mm_camera_buf_def_t *frame,
355                               char *name,
356                               char *ext,
357                               uint32_t frame_idx);
358 extern void mm_app_dump_jpeg_frame(const void * data,
359                                    size_t size,
360                                    char* name,
361                                    char* ext,
362                                    uint32_t index);
363 extern int mm_camera_app_timedwait(uint8_t seconds);
364 extern int mm_camera_app_wait();
365 extern void mm_camera_app_done();
366 extern int mm_app_alloc_bufs(mm_camera_app_buf_t* app_bufs,
367                              cam_frame_len_offset_t *frame_offset_info,
368                              uint8_t num_bufs,
369                              uint8_t is_streambuf,
370                              size_t multipleOf);
371 extern int mm_app_release_bufs(uint8_t num_bufs,
372                                mm_camera_app_buf_t* app_bufs);
373 extern int mm_app_stream_initbuf(cam_frame_len_offset_t *frame_offset_info,
374                                  uint8_t *num_bufs,
375                                  uint8_t **initial_reg_flag,
376                                  mm_camera_buf_def_t **bufs,
377                                  mm_camera_map_unmap_ops_tbl_t *ops_tbl,
378                                  void *user_data);
379 extern int32_t mm_app_stream_deinitbuf(mm_camera_map_unmap_ops_tbl_t *ops_tbl,
380                                        void *user_data);
381 extern int mm_app_cache_ops(mm_camera_app_meminfo_t *mem_info, int cmd);
382 extern int32_t mm_app_stream_clean_invalidate_buf(uint32_t index, void *user_data);
383 extern int32_t mm_app_stream_invalidate_buf(uint32_t index, void *user_data);
384 extern int mm_app_open(mm_camera_app_t *cam_app,
385                        int cam_id,
386                        mm_camera_test_obj_t *test_obj);
387 extern int mm_app_close(mm_camera_test_obj_t *test_obj);
388 extern mm_camera_channel_t * mm_app_add_channel(
389                                          mm_camera_test_obj_t *test_obj,
390                                          mm_camera_channel_type_t ch_type,
391                                          mm_camera_channel_attr_t *attr,
392                                          mm_camera_buf_notify_t channel_cb,
393                                          void *userdata);
394 extern int mm_app_del_channel(mm_camera_test_obj_t *test_obj,
395                               mm_camera_channel_t *channel);
396 extern mm_camera_stream_t * mm_app_add_stream(mm_camera_test_obj_t *test_obj,
397                                               mm_camera_channel_t *channel);
398 extern int mm_app_del_stream(mm_camera_test_obj_t *test_obj,
399                              mm_camera_channel_t *channel,
400                              mm_camera_stream_t *stream);
401 extern int mm_app_config_stream(mm_camera_test_obj_t *test_obj,
402                                 mm_camera_channel_t *channel,
403                                 mm_camera_stream_t *stream,
404                                 mm_camera_stream_config_t *config);
405 extern int mm_app_start_channel(mm_camera_test_obj_t *test_obj,
406                                 mm_camera_channel_t *channel);
407 extern int mm_app_stop_channel(mm_camera_test_obj_t *test_obj,
408                                mm_camera_channel_t *channel);
409 extern mm_camera_channel_t *mm_app_get_channel_by_type(
410                                     mm_camera_test_obj_t *test_obj,
411                                     mm_camera_channel_type_t ch_type);
412 
413 extern int mm_app_start_preview(mm_camera_test_obj_t *test_obj);
414 extern int mm_app_stop_preview(mm_camera_test_obj_t *test_obj);
415 extern int mm_app_start_preview_zsl(mm_camera_test_obj_t *test_obj);
416 extern int mm_app_stop_preview_zsl(mm_camera_test_obj_t *test_obj);
417 extern mm_camera_channel_t * mm_app_add_preview_channel(
418                                 mm_camera_test_obj_t *test_obj);
419 extern mm_camera_stream_t * mm_app_add_raw_stream(mm_camera_test_obj_t *test_obj,
420                                                 mm_camera_channel_t *channel,
421                                                 mm_camera_buf_notify_t stream_cb,
422                                                 void *userdata,
423                                                 uint8_t num_bufs,
424                                                 uint8_t num_burst);
425 extern int mm_app_stop_and_del_channel(mm_camera_test_obj_t *test_obj,
426                                        mm_camera_channel_t *channel);
427 extern mm_camera_channel_t * mm_app_add_snapshot_channel(
428                                                mm_camera_test_obj_t *test_obj);
429 extern mm_camera_stream_t * mm_app_add_snapshot_stream(
430                                                 mm_camera_test_obj_t *test_obj,
431                                                 mm_camera_channel_t *channel,
432                                                 mm_camera_buf_notify_t stream_cb,
433                                                 void *userdata,
434                                                 uint8_t num_bufs,
435                                                 uint8_t num_burst);
436 extern mm_camera_stream_t * mm_app_add_metadata_stream(mm_camera_test_obj_t *test_obj,
437                                                mm_camera_channel_t *channel,
438                                                mm_camera_buf_notify_t stream_cb,
439                                                void *userdata,
440                                                uint8_t num_bufs);
441 extern int mm_app_start_record_preview(mm_camera_test_obj_t *test_obj);
442 extern int mm_app_stop_record_preview(mm_camera_test_obj_t *test_obj);
443 extern int mm_app_start_record(mm_camera_test_obj_t *test_obj);
444 extern int mm_app_stop_record(mm_camera_test_obj_t *test_obj);
445 extern int mm_app_start_live_snapshot(mm_camera_test_obj_t *test_obj);
446 extern int mm_app_stop_live_snapshot(mm_camera_test_obj_t *test_obj);
447 extern int mm_app_start_capture(mm_camera_test_obj_t *test_obj,
448                                 uint8_t num_snapshots);
449 extern int mm_app_stop_capture(mm_camera_test_obj_t *test_obj);
450 extern int mm_app_start_capture_raw(mm_camera_test_obj_t *test_obj,
451                                     uint8_t num_snapshots);
452 extern int mm_app_stop_capture_raw(mm_camera_test_obj_t *test_obj);
453 extern int mm_app_start_rdi(mm_camera_test_obj_t *test_obj, uint8_t num_burst);
454 extern int mm_app_stop_rdi(mm_camera_test_obj_t *test_obj);
455 extern int mm_app_initialize_fb(mm_camera_test_obj_t *test_obj);
456 extern int mm_app_close_fb(mm_camera_test_obj_t *test_obj);
457 extern int mm_app_fb_write(mm_camera_test_obj_t *test_obj, char *buffer);
458 extern int mm_app_overlay_display(mm_camera_test_obj_t *test_obj, int bufferFd);
459 extern int mm_app_allocate_ion_memory(mm_camera_app_buf_t *buf, unsigned int ion_type);
460 extern int mm_app_deallocate_ion_memory(mm_camera_app_buf_t *buf);
461 extern int mm_app_set_params(mm_camera_test_obj_t *test_obj,
462                       cam_intf_parm_type_t param_type,
463                       int32_t value);
464 extern int mm_app_set_preview_fps_range(mm_camera_test_obj_t *test_obj,
465                         cam_fps_range_t *fpsRange);
466 extern int mm_app_set_face_detection(mm_camera_test_obj_t *test_obj,
467                         cam_fd_set_parm_t *fd_set_parm);
468 extern int mm_app_set_metadata_usercb(mm_camera_test_obj_t *test_obj,
469                       cam_stream_user_cb usercb);
470 extern int mm_app_set_face_detection(mm_camera_test_obj_t *test_obj,
471         cam_fd_set_parm_t *fd_set_parm);
472 extern int mm_app_set_flash_mode(mm_camera_test_obj_t *test_obj,
473         cam_flash_mode_t flashMode);
474 
475 /* JIG camera lib interface */
476 
477 int mm_camera_lib_open(mm_camera_lib_handle *handle, int cam_id);
478 int mm_camera_lib_get_caps(mm_camera_lib_handle *handle,
479                            cam_capability_t *caps);
480 int mm_camera_lib_start_stream(mm_camera_lib_handle *handle);
481 int mm_camera_lib_send_command(mm_camera_lib_handle *handle,
482                                mm_camera_lib_commands cmd,
483                                void *data, void *out_data);
484 int mm_camera_lib_stop_stream(mm_camera_lib_handle *handle);
485 int mm_camera_lib_number_of_cameras(mm_camera_lib_handle *handle);
486 int mm_camera_lib_close(mm_camera_lib_handle *handle);
487 int32_t mm_camera_load_tuninglibrary(
488   mm_camera_tuning_lib_params_t *tuning_param);
489 int mm_camera_lib_set_preview_usercb(
490   mm_camera_lib_handle *handle, cam_stream_user_cb cb);
491 //
492 
493 int mm_app_start_regression_test(int run_tc);
494 int mm_app_load_hal(mm_camera_app_t *my_cam_app);
495 
496 extern int createEncodingSession(mm_camera_test_obj_t *test_obj,
497                           mm_camera_stream_t *m_stream,
498                           mm_camera_buf_def_t *m_frame);
499 extern int encodeData(mm_camera_test_obj_t *test_obj, mm_camera_super_buf_t* recvd_frame,
500                mm_camera_stream_t *m_stream);
501 extern int mm_app_take_picture(mm_camera_test_obj_t *test_obj, uint8_t);
502 
503 extern mm_camera_channel_t * mm_app_add_reprocess_channel(mm_camera_test_obj_t *test_obj,
504                                                    mm_camera_stream_t *source_stream);
505 extern int mm_app_start_reprocess(mm_camera_test_obj_t *test_obj);
506 extern int mm_app_stop_reprocess(mm_camera_test_obj_t *test_obj);
507 extern int mm_app_do_reprocess(mm_camera_test_obj_t *test_obj,
508         mm_camera_buf_def_t *frame,
509         uint32_t meta_idx,
510         mm_camera_super_buf_t *super_buf,
511         mm_camera_stream_t *src_meta);
512 extern void mm_app_release_ppinput(void *data, void *user_data);
513 
514 extern int mm_camera_queue_init(mm_camera_queue_t *queue,
515                          release_data_fn data_rel_fn,
516                          void *user_data);
517 extern int mm_qcamera_queue_release(mm_camera_queue_t *queue);
518 extern int mm_qcamera_queue_isempty(mm_camera_queue_t *queue);
519 extern int mm_qcamera_queue_enqueue(mm_camera_queue_t *queue, void *data);
520 extern void* mm_qcamera_queue_dequeue(mm_camera_queue_t *queue,
521                                       int bFromHead);
522 extern void mm_qcamera_queue_flush(mm_camera_queue_t *queue);
523 
524 #endif /* __MM_QCAMERA_APP_H__ */
525 
526 
527 
528 
529 
530 
531 
532 
533 
534