summaryrefslogtreecommitdiff
path: root/camerasrc/src/include/camerasrc.h
blob: 2917f290be92502c5bb086f41448a53f6281fd1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
/*
 * camerasrc
 *
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact: Jeongmo Yang <jm80.yang@samsung.com>
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *
 */

#ifndef __CAMERASRC_H__
#define __CAMERASRC_H__

#include <stdint.h> /* to use uint64_t */
#include <camerasrc-error.h>
#include <mm_ta.h>
#ifdef __cplusplus
extern "C" {
#endif

/* GENERAL DEFINITIONS */
/**
 * Type definition of av camera src handle.
 */
typedef void *camsrc_handle_t;


/* ENUMERATION DEFINITIONS */
/*! @enum camerasrc_state_t
 *  @brief Enumeration type for state transition
 */
typedef enum {
    CAMERASRC_STATE_NONE = 0,
    CAMERASRC_STATE_CREATED,
    CAMERASRC_STATE_REALIZED,
    CAMERASRC_STATE_READY,
    CAMERASRC_STATE_PREVIEW,
    CAMERASRC_STATE_STILL,
    CAMERASRC_STATE_VIDEO,
    CAMERASRC_STATE_UNREALIZED,
    CAMERASRC_STATE_DESTROYED,
    CAMERASRC_STATE_AF_IN_PROGRESS,
}camerasrc_state_t;

/*! @enum camerasrc_dev_id_t
 *  @brief Enumeration type for camera device ID
 *
 *  Devices will be managed by this IDs. (Independent with device index of V4L2)
 */
typedef enum {
    CAMERASRC_DEV_ID_PRIMARY,           /**< Higher resolution camera*/
    CAMERASRC_DEV_ID_SECONDARY,         /**< Lower resolution camera*/
    CAMERASRC_DEV_ID_EXTENSION,         /**< reserved for extension*/
    CAMERASRC_DEV_ID_UNKNOWN,           /**< reserved for extension*/
    CAMERASRC_DEV_ID_NUM,               /**< Number of IDs*/
}camerasrc_dev_id_t;

typedef enum {
    CAMERASRC_COLOR_VIOLET = 0,
    CAMERASRC_COLOR_PURPLE,
    CAMERASRC_COLOR_MAGENTA_1,
    CAMERASRC_COLOR_MAGENTA_2,
    CAMERASRC_COLOR_RED_1,
    CAMERASRC_COLOR_RED_2,
    CAMERASRC_COLOR_BROWN,
    CAMERASRC_COLOR_YELLOW,
    CAMERASRC_COLOR_GREEN_1,
    CAMERASRC_COLOR_GREEN_2,
    CAMERASRC_COLOR_GREEN_3,
    CAMERASRC_COLOR_GREEN_4,
    CAMERASRC_COLOR_COBALT_BLUE,
    CAMERASRC_COLOR_CYAN,
    CAMERASRC_COLOR_BLUE_1,
    CAMERASRC_COLOR_BLUE_2,
    CAMERASRC_COLOR_GRAY,
    CAMERASRC_COLOR_NUM,
}camerasrc_color_t;

typedef enum {
    CAMERASRC_PARTCOLOR_MODE_NONE = 0,
    CAMERASRC_PARTCOLOR_MODE_SWAP,
    CAMERASRC_PARTCOLOR_MODE_ACCENT,
    CAMERASRC_PARTCOLOR_MODE_NUM,
}camerasrc_partcolor_mode_t;

/*! @enum camerasrc_ctrl_t
 *  @brief Enumeration type for camera controls
 *
 *  Special control entries for camera effects
 *
 *  @remark Strobo can be controlled by this entry and ::camerasrc_set_strobo_status
 */
typedef enum {
    CAMERASRC_CTRL_BRIGHTNESS = 0,          /**< Brightness control entry*/
    CAMERASRC_CTRL_CONTRAST,                /**< Contrast control entry*/
    CAMERASRC_CTRL_DIGITAL_ZOOM,            /**< Digital zoom control entry*/
    CAMERASRC_CTRL_OPTICAL_ZOOM,            /**< Optical zoom control entry*/
    CAMERASRC_CTRL_WHITE_BALANCE,           /**< White balance control entry*/
    CAMERASRC_CTRL_COLOR_TONE,              /**< Color tone control entry*/
    CAMERASRC_CTRL_PROGRAM_MODE,            /**< Program mode control entry*/
    CAMERASRC_CTRL_FLIP,                    /**< Flip control entry*/
    CAMERASRC_CTRL_PARTCOLOR_SRC,           /**< Partcolor effect source */
    CAMERASRC_CTRL_PARTCOLOR_DST,           /**< Partcolor effect destination */
    CAMERASRC_CTRL_PARTCOLOR_MODE,          /**< Partcolor effect mode */
    CAMERASRC_CTRL_ANTI_HANDSHAKE,          /**< Anti-handshake control, 0:OFF / 1:ON / 2:AUTO / 3:MOVIE */
    CAMERASRC_CTRL_WIDE_DYNAMIC_RANGE,      /**< wide dynamic control, 0:OFF / 1:ON / 2:AUTO */
    CAMERASRC_CTRL_SATURATION,              /**< Saturation value control */
    CAMERASRC_CTRL_SHARPNESS,               /**< Sharpness value control */
    CAMERASRC_CTRL_ISO,                     /**< Sensor sensitivity*/
    CAMERASRC_CTRL_PHOTOMETRY,              /**< Exposure mode*/
    CAMERASRC_CTRL_NUM,                     /**< Number of Controls*/
}camerasrc_ctrl_t;

/*! @enum camerasrc_af_mode_t
 *  @brief AF operation mode
 */
typedef enum {
    CAMERASRC_AF_MODE_AUTO = 0,      /**< Auto Focus */
    CAMERASRC_AF_MODE_MANUAL,        /**< Manual Focus */
    CAMERASRC_AF_MODE_PAN,           /**< Pan Focus */
    CAMERASRC_AF_MODE_TOUCH_AUTO,    /**< Touch Auto Focus */
    CAMERASRC_AF_MODE_CONTINUOUS,    /**< Continuous Focus */
    CAMERASRC_AF_MODE_NUM,           /**< Number of AF modes */
}camerasrc_af_mode_t;

/*! @enum camerasrc_af_scan_range_t
 *  @brief AF scan range
 *  AF scan range
 */
typedef enum {
    CAMERASRC_AF_RANGE_NORMAL = 0,   /**< Scan autofocus in normal range */
    CAMERASRC_AF_RANGE_MACRO,        /**< Scan autofocus in macro range(close distance) */
    CAMERASRC_AF_RANGE_FULL,         /**< Scan autofocus in full range(all range scan, limited by dev spec) */
    CAMERASRC_AF_RANGE_NUM,          /**< Number of AF range types */
}camerasrc_af_scan_range_t;

/*! @enum camerasrc_resol_name_t
 *  @brief Enumeration type of resolution settings based on traditional resolution name
 *  Means pixel order of contents.
 *  @remark In the Grandprix, only YUV422P & RGGB8 is used
 */
typedef enum {
    CAMERASRC_RESOL_QQCIF = 0,          /**< 88 x 72 */
    CAMERASRC_RESOL_QQVGA,              /**< 160 x 120 */
    CAMERASRC_RESOL_QCIF,               /**< 176 x 144 */
    CAMERASRC_RESOL_QVGA,               /**< 320 x 240 */
    CAMERASRC_RESOL_CIF,                /**< 352 x 288 */
    CAMERASRC_RESOL_VGA,                /**< 640 x 480 */
    CAMERASRC_RESOL_WVGA,               /**< 800 x 480 */
    CAMERASRC_RESOL_SVGA,               /**< 800 x 600 */
    CAMERASRC_RESOL_WSXGA,              /**< 1280 x 960 (1M) */
    CAMERASRC_RESOL_UXGA,               /**< 1600 x 1200 (2M) */
    CAMERASRC_RESOL_QXGA,               /**< 2048 x 1536 (3M) */
    CAMERASRC_RESOL_WQSXGA,             /**< 2560 x 1920 (5M) */
    CAMERASRC_RESOL_720P,               /**< 1280 x 720 (720P) */
    CAMERASRC_RESOL_WQVGA,              /**< 400 x 240 */
    CAMERASRC_RESOL_RQVGA,              /**< 240 x 320 */
    CAMERASRC_RESOL_RWQVGA,             /**< 240 x 400 */
    CAMERASRC_RESOL_QVGA_60FPS,         /**< 320 x 240 60FPS(Slow motion I) */
    CAMERASRC_RESOL_QVGA_120FPS,        /**< 320 x 240 60FPS(Slow motion II) */
    CAMERASRC_RESOL_NUM,
}camerasrc_resol_name_t;

/*! @enum camerasrc_pix_format_t
 *  @brief Means order of pixel of contents
 *  Means pixel order of contents.
 *  @remark In the Grandprix, only YUV422P & RGGB8 is used
 */
typedef enum {
    CAMERASRC_PIX_NONE = -1,      /**< Default value or Not supported */
    CAMERASRC_PIX_YUV422P = 0,    /**< Pixel format like YYYYYYYYUUUUVVVV*/
    CAMERASRC_PIX_YUV420P,        /**< Pixel format like YYYYYYYYUUVV*/
    CAMERASRC_PIX_YUV420,         /**< Pixel format like YYYYYYYYUVUV*/
    CAMERASRC_PIX_SN12,           /**< YUV420 (interleaved, non-linear) */
    CAMERASRC_PIX_ST12,           /**< YUV420 (interleaved, tiled, non-linear) */
    CAMERASRC_PIX_YUY2,           /**< YUV 4:2:2 as for UYVY but with different component ordering within the u_int32 macropixel */
    CAMERASRC_PIX_RGGB8,          /**< Raw RGB Pixel format like CCD order, a pixel consists of 8 bits, Actually means JPEG + JPEG image output */
    CAMERASRC_PIX_RGGB10,         /**< Raw RGB Pixel format like CCD order, a pixel consists of 10 bits, Actually means JPEG + YUV image output */
    CAMERASRC_PIX_RGB565,         /**< Raw RGB Pixel format like CCD order, a pixel consists of 10 bits, Actually means JPEG + YUV image output */
    CAMERASRC_PIX_UYVY,           /**< YUV 4:2:2 */
    CAMERASRC_PIX_NV12,           /**< YUV 4:2:0, 8-bit Y plane followed by an interleaved U/V plane with 2x2 subsampling */
    CAMERASRC_PIX_INTERLEAVED,    /**< JPEG/YUYV interleaved data format for zero shutter lag */
    CAMERASRC_PIX_NUM,            /**< Number of pixel formats*/
}camerasrc_pix_format_t;

/*! @enum camerasrc_colorspace_t
 *  @brief Means stored order or compressed status of image.
 *  Means stored order or compressed status of image. supplements of camerasrc_pix_format_t
 *
 *  @note RAW means RGB/YUV pixel data, JPEG means compressed JPG file with marker information(header)
 */
typedef enum {
    CAMERASRC_COL_NONE = -1,    /**< Default value or Not supported */
    CAMERASRC_COL_RAW,          /**< Non-compressed RGB/YUV pixel data*/
    CAMERASRC_COL_JPEG,         /**< Compressed jpg data*/
    CAMERASRC_COL_NUM,          /**< Number of colorspace data*/
}camerasrc_colorspace_t;

/*! @enum camerasrc_auto_focus_status_t
 *  @brief AF status
 *  AF status
 */
typedef enum {
    CAMERASRC_AUTO_FOCUS_STATUS_RELEASED,       /**< AF status released.*/
    CAMERASRC_AUTO_FOCUS_STATUS_ONGOING,        /**< AF in progress*/
    CAMERASRC_AUTO_FOCUS_STATUS_NUM,            /**< Number of AF status*/
}camerasrc_auto_focus_status_t;

/*! @enum camerasrc_auto_focus_cmd_t
 *  @brief AF status
 *  AF status
 */
typedef enum {
    CAMERASRC_AUTO_FOCUS_CMD_NULL,              /**< Null command.*/
    CAMERASRC_AUTO_FOCUS_CMD_START,             /**< Start AF.*/
    CAMERASRC_AUTO_FOCUS_CMD_STOP,              /**< Stop AF.*/
    CAMERASRC_AUTO_FOCUS_CMD_KILL,              /**< Kill AF thread.*/
    CAMERASRC_AUTO_FOCUS_CMD_NUM,               /**< Number of AF command*/
}camerasrc_auto_focus_cmd_t;

/*! @enum camerasrc_auto_focus_result_t
 *  @brief AF status
 *  AF status
 */
typedef enum {
    CAMERASRC_AUTO_FOCUS_RESULT_FOCUSED = 2,    /**< Focused.*/
    CAMERASRC_AUTO_FOCUS_RESULT_FAILED,         /**< AF failed.*/
    CAMERASRC_AUTO_FOCUS_RESULT_NUM,            /**< Number of AF result*/
}camerasrc_auto_focus_result_t;

/*! @enum camerasrc_ae_lock_t
 *  @brief
 */
typedef enum {
    CAMERASRC_AE_LOCK = 0,
    CAMERASRC_AE_UNLOCK,
    CAMERASRC_AE_NUM,
}camerasrc_ae_lock_t;

/*! @enum camerasrc_io_method_t
 *  @brief
 */
typedef enum {
    CAMERASRC_IO_METHOD_READ= 0,
    CAMERASRC_IO_METHOD_MMAP,
    CAMERASRC_IO_METHOD_USRPTR,
    CAMERASRC_IO_METHOD_NUM,
}camerasrc_io_method_t;

/*! @enum camerasrc_buffer_queued_status
 *  @brief
 */
typedef enum {
	CAMERASRC_BUFFER_QUEUED   = 0,
	CAMERASRC_BUFFER_DEQUEUED = 1,
}camerasrc_buffer_queued_status;


/* STRUCTURE DEFINITIONS */

typedef struct _camerasrc_rect_t {
    int x;
    int y;
    int width;
    int height;
} camerasrc_rect_t;

/*! @struct camsrc_frac_t
 *  @brief Time per frame or frame per second will be expressed by this structure
 *  Time per frame or frame per second will be expressed by this structure
 */
typedef struct _camerasrc_frac_t {
    int numerator;              /**< Upper number of fraction*/
    int denominator;            /**< Lower number of fraction*/
} camerasrc_frac_t;

/*! @struct camerasrc_buffer_t
 *  @brief data buffer
 *  Image data buffer
 */
typedef struct _camerasrc_buffer_t {
	unsigned int length;                            /**< Size of stored data*/
	unsigned char* start;                           /**< Start address of data*/
	camerasrc_buffer_queued_status queued_status;   /**< Queued or Dequeued status */
} camerasrc_buffer_t;

/*! @struct camerasrc_usr_buf_t
 *  @brief data buffer set to present usrptr buffer to camsrctem
 *  Image data buffer set
 */
typedef struct {
    camerasrc_buffer_t* present_buffer;
    unsigned int num_buffer;
} camerasrc_usr_buf_t;

/*! @struct camerasrc_dimension_t
 *  @brief For non-regular size resolution
 *  width and height can be set independently
 */
typedef struct _camerasrc_dimension_t {
    int width;
    int height;
} camerasrc_dimension_t;

/*! @union  camerasrc_size_t
 *  @brief Size can be expressed by resolution name(predefined) and dimension(x, y)
 */
typedef union _camerasrc_size_t {
    camerasrc_resol_name_t res;         /**< Predefined resolution name */
    camerasrc_dimension_t dim;          /**< Dimensional expression */
} camerasrc_size_t;

/*! @struct camerasrc_format_t
 *  @brief Format description structure
 *  in/output format description structure just like v4l2_format
 */
typedef struct _camerasrc_format_t {
    camerasrc_size_t img_size;
    camerasrc_size_t thumb_size;        /**< Thumbnail size. Only effective with CAMERASRC_PIX_RGGB8 or CAMERASRC_PIX_RGGB10 */
    camerasrc_pix_format_t pix_format;  /**< pixel order format*/
    int num_planes;                     /**< bytes per a line*/
    int bytesperline;                   /**< bytes per a line*/
    int sizeimage;                      /**< size of whole image*/
    camerasrc_colorspace_t colorspace;  /**< stored status of image*/
    unsigned int quality;               /**< jpeg compress ratio*/
    unsigned int is_highquality_mode;   /**< picture quality is high or normal */
    int rotation;                       /**< Rotation angle of camera input */
} camerasrc_format_t;

typedef struct _camerasrc_ctrl_query_t {
    int support;                        /**<1: support, 0: Not support, -1: extra support(Non v4l2)*/
    int max;                            /**<Integer max value(includes enums)*/
    int min;                            /**<Integer min value(includes enums)*/
}camerasrc_ctrl_query_t;

typedef struct _camerasrc_exif_t {
    /* Dynamic value */
    unsigned int exposure_time_numerator;       /**< Exposure time, given in seconds */
    unsigned int exposure_time_denominator;
    int shutter_speed_numerator;                /**< Shutter speed, given in APEX(Additive System Photographic Exposure) */
    int shutter_speed_denominator;
    int brigtness_numerator;                    /**< Value of brightness, before firing flash, given in APEX value */
    int brightness_denominator;
    unsigned short int iso;                     /**< Sensitivity value of sensor */
    unsigned short int flash;                   /**< Whether flash is fired(1) or not(0) */
    int metering_mode;                          /**< metering mode in EXIF 2.2 */
    int exif_image_width;                       /**< Size of image */
    int exif_image_height;
    int exposure_bias_in_APEX;                  /**< Exposure bias in APEX standard */
    int software_used;                          /**< Firmware S/W version */
    int focal_len_numerator;                    /**< Lens focal length (f = 4.5mm) */
    int focal_len_denominator;
    int aperture_f_num_numerator;               /**< Aperture value (f_num = 2.8) */
    int aperture_f_num_denominator;
    int aperture_in_APEX;                       /**< Aperture value in APEX standard */
    int max_lens_aperture_in_APEX;              /**< Max aperture value in APEX standard */

    /* Fixed value */
    int component_configuration;                /**< color components arrangement (YCbCr = 1230) */
    int colorspace;                             /**< colorspace information (sRGB=1) */
}camerasrc_exif_t;

typedef struct _camerasrc_frame_data_t {
    int          index;
    unsigned int phyAddrY;
    unsigned int phyAddrCbCr;
    unsigned int virAddrY;
    unsigned int virAddrCbCr;
}camerasrc_frame_data_t;

/* JPEG/YUV interleaved data */
#define INTERLEAVED_JPEG_MAX_SIZE               (1024*1024*6)  /* 6 Mbyte */

/* Fixed focal length and aperture f-number */
#define CAMERASRC_PRIMARY_FOCAL_LEGNTH_NUM      397
#define CAMERASRC_PRIMARY_FOCAL_LEGNTH_DENOM    100
#define CAMERASRC_PRIMARY_F_NUMBER_NUM          265
#define CAMERASRC_PRIMARY_F_NUMBER_DENOM        100
#define CAMERASRC_SECONDARY_FOCAL_LEGNTH_NUM    273
#define CAMERASRC_SECONDARY_FOCAL_LEGNTH_DENOM  100
#define CAMERASRC_SECONDARY_F_NUMBER_NUM        28
#define CAMERASRC_SECONDARY_F_NUMBER_DENOM      10

/* For Query functionalities
   For Querying capabilities */
/*! Use static size of structures for querying because of performance
 */

#define MAX_NUM_FMT_DESC        32
#define MAX_NUM_RESOLUTION      32
#define MAX_NUM_AVAILABLE_TPF   16
#define MAX_NUM_AVAILABLE_FPS   16
#define MAX_NUM_CTRL_LIST_INFO  64
#define MAX_NUM_CTRL_MENU       64
#define MAX_SZ_CTRL_NAME_STRING 32
#define MAX_SZ_DEV_NAME_STRING  32

enum{
    CAMERASRC_FCC_USE_NONE              = 0x00000001,
    CAMERASRC_FCC_USE_REC_PREVIEW       = 0x00000010,
    CAMERASRC_FCC_USE_CAP_PREVIEW       = 0x00000100,
    CAMERASRC_FCC_USE_RECORDING         = 0x00001000,
    CAMERASRC_FCC_USE_NORMAL_CAPTURE    = 0x00010000,
    CAMERASRC_FCC_USE_CONT_CAPTURE      = 0x00100000,
    CAMERASRC_FCC_USE_NUM               = 6,
};

/*! @struct camerasrc_tpf_frac_t
 *  @brief For timeperframe as fraction type
 *  Elapse time consumed by one frame, reverse of FPS
 */
typedef struct {
    int num;
    int den;
}camerasrc_tpf_frac_t;

/*! @struct camerasrc_resolution_t
 *  @brief For querying supported resolutions
 */
typedef struct {
    int w;
    int h;

    /* Available time per frame(tpf) as each pixelformat */
    int num_avail_tpf;
    camerasrc_tpf_frac_t tpf[MAX_NUM_AVAILABLE_TPF];
} camerasrc_resolution_t;

/*! @struct camerasrc_fmt_desc_t
 *  @brief For querying supported format type
 */
typedef struct {
    /* fourcc name of each pixelformat */
    unsigned int fcc;
    int fcc_use;

    /* Available resolutions as each pixelformat */
    int num_resolution;
    camerasrc_resolution_t resolutions[MAX_NUM_RESOLUTION];
} camerasrc_fmt_desc_t;

/*! @struct camerasrc_caps_info_t
 *  @brief For querying image input capabilities
 */
typedef struct {
    char dev_name[MAX_SZ_DEV_NAME_STRING];
    camerasrc_dev_id_t input_id;
    int num_fmt_desc;
    camerasrc_fmt_desc_t fmt_desc[MAX_NUM_FMT_DESC];

    int num_preview_resolution;
    int preview_resolution_width[MAX_NUM_RESOLUTION];
    int preview_resolution_height[MAX_NUM_RESOLUTION];

    int num_capture_resolution;
    int capture_resolution_width[MAX_NUM_RESOLUTION];
    int capture_resolution_height[MAX_NUM_RESOLUTION];

    int num_preview_fmt;
    unsigned int preview_fmt[MAX_NUM_FMT_DESC];

    int num_capture_fmt;
    unsigned int capture_fmt[MAX_NUM_FMT_DESC];

    int num_fps;
    camerasrc_frac_t fps[MAX_NUM_AVAILABLE_FPS];
} camerasrc_caps_info_t;

/* For Querying controls */
enum {
    CTRL_TYPE_RANGE = 0,                                        /**< Integer, range type */
    CTRL_TYPE_BOOL,                                             /**< Boolean type, 1 equals positive and 0 is negative */
    CTRL_TYPE_ARRAY,                                            /**< Array type, also called menu type. each integer(enumeration) value can be set */
    CTRL_TYPE_UNKNOWN,                                          /**< Unknown type, for error control */
    CTRL_TYPE_NUM,
};

/*! @struct camerasrc_ctrl_menu_t
 *  @brief For querying menu of specified controls
 */
typedef struct {
    int menu_index;                                             /**< What number is used for accessing this menu */
    char menu_name[MAX_SZ_CTRL_NAME_STRING];                    /**< name of each menu */
}camerasrc_ctrl_menu_t;

/*! @struct camerasrc_ctrl_info_t
 *  @brief For querying controls detail
 */
typedef struct {
    camerasrc_ctrl_t camsrc_ctrl_id;                             /**< camsrc camera control ID for controlling this */
    int v4l2_ctrl_id;                                           /**< v4l2 ctrl id, user not need to use this. see @struct camerasrc_ctrl_t */
    int ctrl_type;                                              /**< Type of this control */
    char ctrl_name[MAX_SZ_CTRL_NAME_STRING];                    /**< Name of this control */
    int min;                                                    /**< minimum value */
    int max;                                                    /**< maximum value */
    int step;                                                   /**< unit of the values */
    int default_val;                                            /**< Default value of the array or range */
    int num_ctrl_menu;                                          /**< In the case of array type control, number of supported menu information */
    camerasrc_ctrl_menu_t ctrl_menu[MAX_NUM_CTRL_MENU];         /**< @struct camerasrc_ctrl_menu_t for detailed each menu information*/
} camerasrc_ctrl_info_t;

/*! @struct camerasrc_ctrl_list_info_t
 *  @brief For querying controls
 */
typedef struct {
    int num_ctrl_list_info;                                     /**< Number of supported controls */
    camerasrc_ctrl_info_t ctrl_info[MAX_NUM_CTRL_LIST_INFO];    /**< @struct camerasrc_ctrl_info_t for each control information */
} camerasrc_ctrl_list_info_t;


/* capabilities field */
#define CAMERASRC_STROBE_CAP_NONE               0x0000  /* No strobe supported */
#define CAMERASRC_STROBE_CAP_OFF                0x0001  /* Always flash off mode */
#define CAMERASRC_STROBE_CAP_ON                 0x0002  /* Always use flash light mode */
#define CAMERASRC_STROBE_CAP_AUTO               0x0004  /* Flashlight works automatic */
#define CAMERASRC_STROBE_CAP_REDEYE             0x0008  /* Red-eye reduction */
#define CAMERASRC_STROBE_CAP_SLOWSYNC           0x0010  /* Slow sync */
#define CAMERASRC_STROBE_CAP_FRONT_CURTAIN      0x0020  /* Front curtain */
#define CAMERASRC_STROBE_CAP_REAR_CURTAIN       0x0040  /* Rear curtain */
#define CAMERASRC_STROBE_CAP_PERMANENT          0x0080  /* keep turned on until turning off */
#define CAMERASRC_STROBE_CAP_EXTERNAL           0x0100  /* use external strobe */

typedef struct _camerasrc_extra_info_t{
    unsigned int strobe_caps;                                   /**< Use above caps field */
    unsigned int detection_caps;                                /**< Just boolean */
    unsigned int reserved[4];
} camerasrc_extra_info_t;
/* END For Query functionalities */

/*! @def CAMERASRC_SET_SIZE_BY_DIMENSION
 *  @brief Utility definitions for setting non-regular size
 */
#define CAMERASRC_SET_SIZE_BY_DIMENSION(format, img_width, img_height) { \
    format.img_size.dim.width = img_width; \
    format.img_size.dim.height = img_height; \
}


/* CALLBACK DEFINITIONS */
/*! @typedef camerasrc_callback_t
 *  @brief Called back when auto-focusing returns
 *  This callback will be called when the lens properly auto-focused
 */
typedef int (*camerasrc_callback_t) (camsrc_handle_t handle, int state, void* usr_data);

/* Static variables */
/**
 * Label for camera control. This static variable has a label for each of camerasrc_ctrl_t enumeration.
 * When enumeration of camerasrc_ctrl_t is increased, this variable should be increased, too.
 * This string could be used as a key by user.
 * Reference : camerasrc_ctrl_t, _camerasrc_ctrl_list
 */

static char *camerasrc_ctrl_label[CAMERASRC_CTRL_NUM] =
{
    "brightness",               /**< label for CAMERASRC_CTRL_BRIGHTNESS */
    "contrast",                 /**< label for CAMERASRC_CTRL_CONTRAST */
    "digital zoom",             /**< label for CAMERASRC_CTRL_DIGITAL_ZOOM */
    "optical zoom",             /**< label for CAMERASRC_CTRL_OPTICAL_ZOOM */
    "white balance",            /**< label for CAMERASRC_CTRL_WHITE_BALANCE */
    "color tone",               /**< label for CAMERASRC_CTRL_COLOR_TONE */
    "program mode",             /**< label for CAMERASRC_CTRL_PROGRAM_MODE */
    "flip",                     /**< label for CAMERASRC_CTRL_FLIP */
    "partcolor src",            /**< label for CAMERASRC_CTRL_PARTCOLOR_SRC */
    "partcolor dst",            /**< label for CAMERASRC_CTRL_PARTCOLOR_DST */
    "partcolor mode",           /**< label for CAMERASRC_CTRL_PARTCOLOR_MODE */
    "anti handshake",           /**< label for CAMERASRC_CTRL_ANTI_HANDSHAKE */
    "wide dynamic range",       /**< label for CAMERASRC_CTRL_WIDE_DYNAMIC_RANGE */
    "saturation",               /**< label for CAMERASRC_CTRL_SATURATION */
    "sharpness",                /**< label for CAMERASRC_CTRL_SHARPNESS */
    "iso",                      /**< label for CAMERASRC_CTRL_ISO */
    "photometry",               /**< label for CAMERASRC_CTRL_PHOTOMETRY */
};

/* FUNCTION DEFINITIONS */

/**** M A I N    O P E R A T I O N ****/

/**
 * allocate the handle, set initial state & settings
 *
 * @param[in]		phandle ::camsrc_handle_t camerasrc context handle to be created
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t code
 * @see			camerasrc_destroy
 * @note		State transition : [CAMERASRC_STATE_NONE] => [CAMERASRC_STATE_CREATED]
 *			Phase description : Non-running phase
 */
int camerasrc_create(camsrc_handle_t *phandle);

/**
 * proceed fd close, other finalization routines
 *
 * @param[in] handle ::camsrc_handle_t camerasrc context handle
 *
 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t code
 *
 * @see <camerasrc_create>
 *
 * @note State transition : [CAMERASRC_STATE_UNREALIZED] => [CAMERASRC_STATE_DESTROYED]
 *       Phase description : Non-running phase
 */
int camerasrc_destroy(camsrc_handle_t handle);

/**
 * free device context handle, other finalization routines
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t code
 * @see			camerasrc_create
 * @note		State transition : [CAMERASRC_STATE_UNREALIZED] => [CAMERASRC_STATE_DESTROYED]
 *			Phase description : Non-running phase
 */
int camerasrc_close_device(camsrc_handle_t handle);

/**
 * Get the state of camerasrc context handle
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[out]		state  ::camerasrc_state_t camerasrc context current state
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t code
 *
 */
int camerasrc_get_state(camsrc_handle_t handle, camerasrc_state_t* state);

/**
 * Allocate the device context handle, open device node and do the miscellaneous settings
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @return		Success on ::camerasrc_handle_t or returns NULL code, and displays debug message
 * @see			camerasrc_unrealize
 * @note		State transition : [CAMERASRC_STATE_CREATED] => [CAMERASRC_STATE_REALIZED]
 *			Phase description : Non-running phase
 *			device name can be dependent on kernel module
 */
int camerasrc_realize(camsrc_handle_t handle);

/**
 * Deallocate the device structure of buffers, close device
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @return		Success on ::camerasrc_handle_t or returns NULL code, and displays debug message
 * @see			camerasrc_realize
 * @note		State transition : [CAMERASRC_STATE_READY] => [CAMERASRC_STATE_UNREALIZED]
 *			Phase description : Transit to Non-running phase
 */
int camerasrc_unrealize(camsrc_handle_t handle);

/**
 * Prepare Handle to be ready to capture
 * Can change settings like below at this state
 * - camera device ID setting
 * - color format setting
 * - image size setting
 * - image storing method
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @return		Success on ::camerasrc_handle_t or returns NULL code, and displays debug message
 * @see			camerasrc_stop
 * @note		State transition : [CAMERASRC_STATE_REALIZED] => [CAMERASRC_STATE_READY]
 *			Phase description : Running phase
 */
int camerasrc_start(camsrc_handle_t handle);

/**
 * Present user buffer to camerasrc and force to use that buffer.
 * After calling this API, all core routine of camerasrc camera will use
 * User pointer method for managing buffers.
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[in]		present_buf ::camerasrc_usr_buf_t Buffer set to present to camerasrc
 * @param[in]		io_method ::camerasrc_io_method_t Enum type represent to IO method
 * @return Success on ::camsrc_handle_t or returns NULL code, and displays debug message
 * @see			camerasrc_io_method_t
 *
 */
int camerasrc_present_usr_buffer(camsrc_handle_t handle, camerasrc_usr_buf_t* present_buf, camerasrc_io_method_t io_method);

/**
 * Get total number of buffer which managed in camerasrc currently.
 * If this called, it will return default number of buffer in MMAP mode.
 * but use this API after calling ::camerasrc_present_usr_buffer , It will
 * return User specfied buffer number.
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[in]		num_buffer Number of buffer that's managed in camerasrc currently
 * @return		Success on ::camsrc_handle_t or returns NULL code, and displays debug message
 * @see			camerasrc_io_method_t
 *
 */
int camerasrc_get_num_buffer(camsrc_handle_t handle, unsigned int* num_buffer);

/**
 * Get Input/Output method which is used when access camera driver
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[in]		io_method ::camerasrc_io_method_t method enum value
 * @return		Success on ::camsrc_handle_t or returns NULL code, and displays debug message
 * @see			camerasrc_io_method_t
 *
 */
int camerasrc_get_io_method(camsrc_handle_t handle, camerasrc_io_method_t* io_method);

/**
 * Inner ring buffer start refreshing. refresh process occurs asynchronously, and
 * ::camerasrc_wait_frame_available function can anounce when it is available.
 *
 * Camera is grabbing High quality, maybe low speed frame(dependent on device)
 * - Cant approach the [AF] state
 * - preview frames arent always automatically fed. If not, must request repeatedly
 * - If device supports continuous focusing, it can be enabled at this state in case
 *   of multishot.
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		State transition : [CAMERASRC_STATE_READY] => [CAMERASRC_STATE_STILL]
 *			Phase description : Running phase
 */
int camerasrc_start_still_stream(camsrc_handle_t handle);

/**
 * Inner ring buffer start refreshing. refresh process occurs asynchronously, and
 * ::camerasrc_wait_frame_available function can anounce when it is available.
 *
 * Camera is grabbing low quality, high speed frame
 * - Can attempt the [AF] state only at this state
 * - preview frames are always automatically fed
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		State transition : [CAMERASRC_STATE_READY] => [CAMERASRC_STATE_PREVIEW]
 *			Phase description : Running phase
 */
int camerasrc_start_preview_stream(camsrc_handle_t handle);

/**
 * Stop frame refreshing. Ring buffers don't be refreshed any more
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @return		Success on ::camerasrc_handle_t or returns NULL code, and displays debug message
 * @see			camerasrc_stop
 * @note		State transition : [CAMERASRC_STATE_STILL/PREVIEW/VIDEO] => [CAMERASRC_STATE_READY]
 *			Phase description : Running phase
 */
int camerasrc_stop_stream(camsrc_handle_t handle);

/**
 * Query image buffer size. buffer allocation guide function.
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[out]		main_img_size main image maximum size
 * @param[out]		thm_img_size thumb nail image maximum size
 * @return		Success on ::camsrc_handle_t or returns NULL code, and displays debug message
 *
 */
int camerasrc_query_img_buf_size(camsrc_handle_t handle, unsigned int* main_img_size, unsigned int* thm_img_size);

/**
 * non-busy waiting function for image frame available
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[in]		timeout main image maximum size
 * @return		Success on ::camsrc_handle_t or returns NULL code, and displays debug message
 *
 */
int camerasrc_wait_frame_available(camsrc_handle_t handle, long int timeout);

/**
 * Check emp shock status
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[out]		check_val
 * @return Success on ::camsrc_handle_t or returns NULL code, and displays debug message
 *
 */
int camerasrc_check_esd_shock(camsrc_handle_t *handle, int *check_val);

/**
 * Queue(in user space, almost same with free buffer) buffer to dev's ring buffer
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @param[in]		buffer ::camerasrc_buffer_t buffer
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 *
 */
int camerasrc_queue_buffer(camsrc_handle_t handle, int buf_index, camerasrc_buffer_t *buffer);

/**
 * Dequeue(Pop) buffer from v4l2 driver to usr space.
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[out]		buf_index main buffer index number to be dequeued.
 * @param[out]		buffer main image buffer
 * @param[out]		thm_buffer thumbnail image buffer
 * @return		Success on ::camsrc_handle_t or returns NULL code, and displays debug message
 *
 */
int camerasrc_dequeue_buffer(camsrc_handle_t handle, int *buf_index, camerasrc_buffer_t *buffer, camerasrc_buffer_t *thm_buffer);

/**
 * Read frame from camera device.
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[out]		buffer ::camerasrc_buffer_t main image buffer to be get.
 * @param[out]		thm_buffer ::camerasrc_buffer_t thumbnail image buffer to be get.
 * @param[out]		buffer_index ::int v4l2 buffer index.
 * @note		if thm_buffer is NULL, thumbnail image will be discarded
 *
 */
int camerasrc_read_frame(camsrc_handle_t handle, camerasrc_buffer_t *main_img_buffer, camerasrc_buffer_t *thm_img_buffer, int *buffer_index);

/**
 * Get screennail buffer
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[out]		scrnl_buf ::camerasrc_buffer_t screennail buffer to be gotten
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 */
int camerasrc_get_screennail_buffer(camsrc_handle_t handle, camerasrc_buffer_t *scrnl_buf);

/**
 * Set autofocus callback. ::camerasrc_callback_t type defined function can be set
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @param[in]		cb ::camerasrc_callback_t callback after focusing over
 * @param[in]		use_data ::void * user data pointer that will be passed to callback
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		Callback function can be set on READY or REALIZED state
 *
 */
int camerasrc_set_focused_callback(camsrc_handle_t handle, camerasrc_callback_t cb, void *usr_data);

/**
 * Set autofocusing area. autofocusing will be performed refer this rect of the preview
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[in]		rect ::camerasrc_rect_t rectangle area for auto focusing
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 */
int camerasrc_set_autofocusing_area(camsrc_handle_t handle, camerasrc_rect_t* rect);

/**
 * Get autofocusing area.
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[out]		rect ::camerasrc_rect_t rectangle area for auto focusing
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 */
int camerasrc_get_autofocusing_area(camsrc_handle_t handle, camerasrc_rect_t* rect);

/**
 * Start auto focusing with ::camerasrc_af_mode. After ::interval time, call the callback
 * function with ::camerasrc_af_status value.
 * Auto-focus is in progress. Cant return preview state
 * before time-out, success, call camerasrc_autofocus_stop
 * - If focused, focus status will be locked at preview state
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @param[in]		af_mode Auto focusing operation mode see ::camerasrc_af_mode
 * @param[in]		interval interval time in millisecond
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		State transition : [CAMERASRC_STATE_PREVIEW] => [CAMERASRC_STATE_AF_IN_PROGRESS]
 *			Phase description : Running phase
 */
int camerasrc_start_autofocusing(camsrc_handle_t handle);

/**
 * Stop auto focusing
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		State transition : [CAMERASRC_STATE_AF_IN_PROGRESS] => [CAMERASRC_STATE_PREVIEW]
 *			Phase description : Running phase
 */
int camerasrc_stop_autofocusing(camsrc_handle_t handle);

/**
 * Release auto focusing
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		State transition : [CAMERASRC_STATE_AF_IN_PROGRESS] => [CAMERASRC_STATE_PREVIEW]
 *			Phase description : Running phase
 */
int camerasrc_release_autofocusing(camsrc_handle_t handle);

/**
 * Initialize auto focusing mode to specified focal length
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[in]		af_mode ::camerasrc_af_mode_t Auto focusing mode
 * @param[in]		af_range ::camerasrc_af_scan_range_t Auto focusing range
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 */
int camerasrc_init_autofocusing_mode(camsrc_handle_t handle, camerasrc_af_mode_t af_mode, camerasrc_af_scan_range_t af_range);

/**
 * Get current auto focusing mode
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[out]		af_mode ::camerasrc_af_mode_t Auto focusing mode
 * @param[out]		af_range ::camerasrc_af_scan_range_t Auto focusing range
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 */
int camerasrc_get_autofocusing_mode(camsrc_handle_t handle, camerasrc_af_mode_t* af_mode, camerasrc_af_scan_range_t* af_range);

/**
 * Get current auto focusing status
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[out]		af_status ::camerasrc_auto_focus_status_t Auto focusing status
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 *
 */
int camerasrc_get_autofocusing_status(camsrc_handle_t handle, camerasrc_auto_focus_status_t* af_status);
/**** M I S C E L L A N E O U S    O P E R A T I O N ****/

/**** I N P U T ( C A M D E V I C E )    O P E R A T I O N ****/

/**
 * Get input camera ID just like ioctl (fd, VIDIOC_G_INPUT, &index)
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @param[out]		id Camera ID currently set
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		This function is only effective at CAMERASRC_PHASE_RUNNING
 */
int camerasrc_get_input(camsrc_handle_t handle, camerasrc_dev_id_t* camera_id);

/**
 * Set input camera ID just like ioctl (fd, VIDIOC_S_INPUT, &index)
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @param[out]		camera_id Camera ID currently set
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		This function is only effective at CAMERASRC_STATE_READY
 *			If you use set_input(), handle will be initiated.
 */
int camerasrc_set_input(camsrc_handle_t handle, camerasrc_dev_id_t camera_id);


/**** E F F E C T    C O N T R O L    O P E R A T I O N ****/

/**
 * Check support controls with ::camerasrc_ctrl_t ID
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[in]		ctrl_id control ID to be checked
 * @param[out]		ctrl_info control information to be got
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 */
int camerasrc_query_control(camsrc_handle_t handle, camerasrc_ctrl_t ctrl_id, camerasrc_ctrl_info_t* ctrl_info);

/**
 * Check support controls with ::camerasrc_ctrl_t ID
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[in]		ctrl_id control ID to be checked
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 */
int camerasrc_support_control(camsrc_handle_t handle, camerasrc_ctrl_t ctrl_id);

/**
 * Start facedetection
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		State transition : [CAMERASRC_STATE_AF_IN_PROGRESS] => [CAMERASRC_STATE_PREVIEW]
 *			Phase description : Running phase
 */
int camerasrc_start_facedetection(camsrc_handle_t handle);

/**
 * Stop face detection
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		State transition : [CAMERASRC_STATE_AF_IN_PROGRESS] => [CAMERASRC_STATE_PREVIEW]
 *			Phase description : Running phase
 */
int camerasrc_stop_facedetection(camsrc_handle_t handle);

/**
 * Get face detection status
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[out]		is_detecting whether it is detecting or not
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		State transition : [CAMERASRC_STATE_AF_IN_PROGRESS] => [CAMERASRC_STATE_PREVIEW]
 *			Phase description : Running phase
 */
int camerasrc_get_facedetection(camsrc_handle_t handle, int* is_detecting);

/**
 * Control miscellaneous settings through ::camerasrc_ctrl_t IDs
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[in]		ctrl_id control ID to be checked
 * @param[in]		value value to be set
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		This function is only effective at CAMERASRC_STATE_READY
 */
int camerasrc_set_control(camsrc_handle_t handle, camerasrc_ctrl_t ctrl_id, int value);

/**
 * Get the value of miscellaneous settings through ::camerasrc_ctrl_t IDs
 *
 * @param[in]		handle ::camsrc_handle_t camerasrc context handle
 * @param[in]		ctrl_id control ID to be checked
 * @param[out]		value value to be stored
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		This function is only effective at CAMERASRC_STATE_READY
 */
int camerasrc_get_control(camsrc_handle_t handle, camerasrc_ctrl_t ctrl_id, int* value);

/**** O U T P U T    C O N T R O L    O P E R A T I O N ****/

/**
 * Control frame refresh rate setting
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @param[in]		frac ::camsrc_frac_t time per frame
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		This function is only effective at CAMERASRC_STATE_READY
 */
int camerasrc_set_timeperframe(camsrc_handle_t handle, camerasrc_frac_t* frac);

/**
 * Set output format of camera device just like ioctl VIDIOC_S_FMT
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @param[in]		fmt ::camerasrc_format_t output format description to be set
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		This function is only effective at CAMERASRC_STATE_READY.
 *			device dependent function.
 */
int camerasrc_set_format(camsrc_handle_t handle, camerasrc_format_t* fmt);

/**
 * Get output format of camera device just like ioctl VIDIOC_G_FMT
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @param[in]		fmt ::camerasrc_format_t output format description to be set
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		This function is only effective at CAMERASRC_PHASE_RUNNING
 */
int camerasrc_get_format(camsrc_handle_t handle, camerasrc_format_t* fmt);

/**
 * Try output format of camera device just like ioctl VIDIOC_TRY_FMT
 * In this function, it doesn't change any format, only just try. just test
 * the combinations of format setting
 *
 * @param[in]		handle ::camerasrc_handle_t camerasrc context handle
 * @param[in]		fmt ::camerasrc_format_t output format description to be set
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 * @note		This function is only effective at CAMERASRC_STATE_READY.
 *			device dependent function.
 */
int camerasrc_try_format(camsrc_handle_t handle, camerasrc_format_t* fmt);

/**
 * Get virtual/physical address of data frame
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[in]		ae_lock ::camerasrc_ae_lock_t Auto exposure lock/unlock
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_get_frame_data(camsrc_handle_t handle, camerasrc_frame_data_t * data);

/****  S H U T T E R   S P E E D   &   A P E R T U R E   M O D U L A T I O N  ****/
/**
 * Get exif string to be combined with jpg image from camerasrc
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[out]		exif_string exif information string
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_get_exif_info(camsrc_handle_t handle, camerasrc_exif_t* exif_struct);

/**
 * Check whether camera device is opened
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @return		0 when camera is not opened else return non-zero value.
 */
 int camerasrc_device_is_open(camsrc_handle_t handle);

/**
 * Set the camera device file decriptor

 * @param[in]		handle ::camsrc_handle_t handle
 * @param[in]		videofd ::file descriptor of camera device
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 */
int camerasrc_set_videofd(camsrc_handle_t handle,int videofd);

/**
 * Set AF behaviour after capturing

 * @param[in]		handle ::camsrc_handle_t handle
 * @param[in]		hold_af ::whether holding af after capturing
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 */
int camerasrc_set_af_hold_after_capture(camsrc_handle_t handle, int hold_af);

/**
 * Set Sensor mode to camera driver

 * @param[in]		handle ::camsrc_handle_t handle
 * @param[in]		sensor_mode ::int mode
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 */
int camerasrc_set_sensor_mode(camsrc_handle_t handle, int mode);

/**
 * Set vflip to camera driver

 * @param[in]		handle ::camsrc_handle_t handle
 * @param[in]		vflip ::int vflip
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 */
int camerasrc_set_vflip(camsrc_handle_t handle, int vflip);

/**
 * Set hflip to camera driver

 * @param[in]		handle ::camsrc_handle_t handle
 * @param[in]		hflip ::int hflip
 * @return		Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
 */
int camerasrc_set_hflip(camsrc_handle_t handle, int hflip);

/* W I L L   B E   D E P R E C A T E D */

/*! @enum camerasrc_colortone_t
 *  @brief Enumeration type for camera colortone
 *
 *  Colortone entries for camera effects. This can be used with CAMERASRC_CTRL_COLOR_TONE
 *  This values are defined for utility. It's dependent on the device/camera module.
 */
typedef enum {
    CAMERASRC_COLORTONE_NONE = 0,
    CAMERASRC_COLORTONE_NEGATIVE,
    CAMERASRC_COLORTONE_SOLARIZATION_1,
    CAMERASRC_COLORTONE_SOLARIZATION_2,
    CAMERASRC_COLORTONE_SOLARIZATION_3,
    CAMERASRC_COLORTONE_SOLARIZATION_4,
    CAMERASRC_COLORTONE_EMBOSS,
    CAMERASRC_COLORTONE_OUTLINE,
    CAMERASRC_COLORTONE_AQUA,
    CAMERASRC_COLORTONE_SEPHIA,
    CAMERASRC_COLORTONE_GRAY,
    CAMERASRC_COLORTONE_B_N_W,
    CAMERASRC_COLORTONE_RED,
    CAMERASRC_COLORTONE_GREEN,
    CAMERASRC_COLORTONE_BLUE,
    CAMERASRC_COLORTONE_ANTIQUE,
    CAMERASRC_COLORTONE_SKETCH1,
    CAMERASRC_COLORTONE_SKETCH2,
    CAMERASRC_COLORTONE_SKETCH3,
    CAMERASRC_COLORTONE_SKETCH4,
    CAMERASRC_COLORTONE_NUM,
}camerasrc_colortone_t;

/*! @enum camerasrc_program_mode_t
 *  @brief Enumeration type for preset program mode
 *
 *  WRITEME
 */
typedef enum {
    CAMERASRC_PROGRAM_MODE_NORMAL = 0,
    CAMERASRC_PROGRAM_MODE_PORTRAIT,
    CAMERASRC_PROGRAM_MODE_LANDSCAPE,
    CAMERASRC_PROGRAM_MODE_SPORTS,
    CAMERASRC_PROGRAM_MODE_PARTY_N_INDOOR,
    CAMERASRC_PROGRAM_MODE_BEACH_N_INDOOR,
    CAMERASRC_PROGRAM_MODE_SUNSET,
    CAMERASRC_PROGRAM_MODE_DUSK_N_DAWN,
    CAMERASRC_PROGRAM_MODE_FALL_COLOR,
    CAMERASRC_PROGRAM_MODE_NIGHT_SCENE,
    CAMERASRC_PROGRAM_MODE_FIREWORK,
    CAMERASRC_PROGRAM_MODE_TEXT,
    CAMERASRC_PROGRAM_MODE_SHOW_WINDOW,
    CAMERASRC_PROGRAM_MODE_CANDLE_LIGHT,
    CAMERASRC_PROGRAM_MODE_BACK_LIGHT,
    CAMERASRC_PROGRAM_MODE_NUM,
}camerasrc_program_mode_t;

/*! @enum camerasrc_whitebalance_t
 *  @brief Enumeration type for preset whitebalance
 *
 *  WRITEME
 */
typedef enum {
    CAMERASRC_WHITEBALANCE_AUTO = 0,
    CAMERASRC_WHITEBALANCE_INCANDESCENT,
    CAMERASRC_WHITEBALANCE_FLUORESCENT,
    CAMERASRC_WHITEBALANCE_DAYLIGHT,
    CAMERASRC_WHITEBALANCE_CLOUDY,
    CAMERASRC_WHITEBALANCE_SHADE,
    CAMERASRC_WHITEBALANCE_HORIZON,
    CAMERASRC_WHITEBALANCE_FLASH,
    CAMERASRC_WHITEBALANCE_CUSTOM,
    CAMERASRC_WHITEBALANCE_NUM,
}camerasrc_whitebalance_t;

/**
 * Enumerations for flip.
 */
typedef enum {
    CAMERASRC_FILP_NONE = 0,            /**< Not flipped */
    CAMERASRC_FILP_VERTICAL,            /**< Flip vertically */
    CAMERASRC_FILP_HORIZONTAL,          /**< Flip horizontally */
    CAMERASRC_FILP_NUM,                 /**< Number of flip status */
}camerasrc_flip_t;

/*! @enum camerasrc_strobo_status_t
 *  @brief strobo status
 *  strobo status
 */
typedef enum {
    CAMERASRC_STROBO_STATUS_BANNED = 0, /**< strobo off*/
    CAMERASRC_STROBO_STATUS_FORCE_ON,   /**< strobo on.*/
    CAMERASRC_STROBO_STATUS_AUTO,       /**< control strobo automatically*/
    CAMERASRC_STROBO_STATUS_MOVIE_ON,   /**< control strobo automatically*/
    CAMERASRC_STROBO_STATUS_NUM,        /**< Number of AF status*/
}camerasrc_strobo_status_t;
/*! @enum camerasrc_strobe_mode_t
 *  @brief strobe mode
 *  strobe mode
 */
typedef enum {
    CAMERASRC_STROBE_MODE_OFF = 1,      /**< off */
    CAMERASRC_STROBE_MODE_AUTO,         /**< auto */
    CAMERASRC_STROBE_MODE_ON,           /**< on */
    CAMERASRC_STROBE_MODE_PERMANENT,    /**< permanent */
    CAMERASRC_STROBE_MODE_NUM,          /**< Number of strobe mode */
}camerasrc_strobe_mode_t;

/*! @enum camerasrc_ae_mode_t
 *  @brief Auto exposure mode
 *  Auto exposure operation mode
 */
typedef enum {
    CAMERASRC_AE_MODE_OFF = 0,
    CAMERASRC_AE_MODE_ALL,
    CAMERASRC_AE_MODE_CENTER_WEIGHTED_AVR_1,
    CAMERASRC_AE_MODE_CENTER_WEIGHTED_AVR_2,
    CAMERASRC_AE_MODE_CENTER_WEIGHTED_AVR_3,
    CAMERASRC_AE_MODE_SPOT_1,
    CAMERASRC_AE_MODE_SPOT_2,
    CAMERASRC_AE_MODE_CUSTOM_1,
    CAMERASRC_AE_MODE_CUSTOM_2,
} camerasrc_ae_mode_t;

/*! @enum camerasrc_iso_t
 *  @brief Reserved iso number in definition
 *  Traditionally predefined ISO values
 */
typedef enum {
    CAMERASRC_ISO_AUTO = 0,
    CAMERASRC_ISO_50,
    CAMERASRC_ISO_100,
    CAMERASRC_ISO_200,
    CAMERASRC_ISO_400,
    CAMERASRC_ISO_800,
    CAMERASRC_ISO_1600,
    CAMERASRC_ISO_3200,
} camerasrc_iso_t;

/*! @enum camerasrc_sensor_mode_t
 *  @brief Sensor mode in driver
 *  Sensor mode
 */
typedef enum {
    CAMERASRC_SENSOR_MODE_CAMERA = 0,
    CAMERASRC_SENSOR_MODE_MOVIE,
} camerasrc_sensor_mode_t;

/*! @def CAMERASRC_SET_SIZE_BY_PRESET_RESOLUTION
 *  @brief Utility definitions for setting regular size with ::camerasrc_resol_name_t
 */
#define CAMERASRC_SET_SIZE_BY_PRESET_RESOLUTION(format, resolution) { \
    memset(&(format.img_size), 0, sizeof(camerasrc_size_t)); \
    format.img_size.res = resolution; \
}

/**
 * Set the mode of strobe
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[in]		mode ::camerasrc_strobe_mode_t mode of strobe
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_set_strobe_mode(camsrc_handle_t handle, camerasrc_strobe_mode_t mode);

/**
 * Get the mode of strobe
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[out]		mode ::camerasrc_strobe_mode_t mode of strobe
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_get_strobe_mode(camsrc_handle_t handle, camerasrc_strobe_mode_t* mode);

/**
 * Set the mode of auto-exposure processing
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[in]		ae_mode ::camerasrc_ae_mode_t AE mode to be set
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_set_exposure_mode(camsrc_handle_t handle, camerasrc_ae_mode_t ae_mode);

/**
 * Get the mode of auto-exposure processing
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[out]		ae_mode ::camerasrc_ae_mode_t AE mode to be got
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_get_exposure_mode(camsrc_handle_t handle, camerasrc_ae_mode_t* ae_mode);

/**
 * Set the shutter speed
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[in]		frac ::camerasrc_frac_t shutter speed to be set
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_set_shutter_speed(camsrc_handle_t handle, camerasrc_frac_t frac);

/**
 * Get the shutter speed
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[out]		frac ::camerasrc_frac_t shutter speed to be got
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_get_shutter_speed(camsrc_handle_t handle, camerasrc_frac_t* frac);

/**
 * Set the exposure value
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[in]		frac ::camerasrc_frac_t exposure value to be set
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_set_exposure_value(camsrc_handle_t handle, camerasrc_frac_t frac);

/**
 * Get the exposure value
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[out]		frac ::camerasrc_frac_t exposure value to be got
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_get_exposure_value(camsrc_handle_t handle, camerasrc_frac_t* frac);

/**
 * Check whether supports exif embed in jpg or not
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[out]		support_exif ::if supports, returns 1 or 0
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_support_embed_exif(camsrc_handle_t handle, int* support_exif);

/**
 * Check whether supports jpeg encoding inside camera driver
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[out]		support_jpeg_encoding ::if supports, returns 1. If not, return 0
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_support_jpeg_encoding(camsrc_handle_t handle, int* support_jpeg_encoding);



/* For Query functionalities */
/**
 * Query basic device info of device
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[out]		camerasrc_caps_info_t device information structure
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_read_basic_dev_info(camerasrc_dev_id_t dev_id, camerasrc_caps_info_t* caps_info);

/**
 * Query miscellaneous device info(effect, WB, preset values, etc.) of device
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[out]		camerasrc_ctrl_list_info_t device capabilities structure
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_read_misc_dev_info(camerasrc_dev_id_t dev_id, camerasrc_ctrl_list_info_t* ctrl_info);

/**
 * Query extra device info(face detection, strobe, etc.) of device
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[out]		camerasrc_extra_info_t device capabilities structure
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_read_extra_dev_info(camerasrc_dev_id_t dev_id, camerasrc_extra_info_t* extra_info);

/**
 * Record miscellaneous device info(effect, WB, preset values, etc.) of device
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[in]		camerasrc_ctrl_list_info_t device capabilities structure
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_write_basic_dev_info(camsrc_handle_t handle, camerasrc_caps_info_t* caps_info);

/**
 * Record miscellaneous device info(effect, WB, preset values, etc.) of device
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[in]		camerasrc_ctrl_list_info_t device capabilities structure
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_write_misc_dev_info(camsrc_handle_t handle, camerasrc_ctrl_list_info_t* ctrl_info);

/**
 * Record extra device info(face detection, strobe, etc.) of device
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[out]		camerasrc_extra_info_t device capabilities structure
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_write_extra_dev_info(camsrc_handle_t handle, camerasrc_extra_info_t* extra_info);

/**
 * Query to device driver about basic device info
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[out]		camerasrc_ctrl_list_info_t device capabilities structure
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_query_basic_dev_info(camsrc_handle_t handle, camerasrc_caps_info_t* caps_info);

/**
 * Query to device driver about miscellaneous device info(effect, WB, preset values, etc.) of device
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[out]		camerasrc_ctrl_list_info_t device capabilities structure
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_query_misc_dev_info(camsrc_handle_t handle, camerasrc_ctrl_list_info_t* ctrl_list_info);
int camerasrc_query_misc_dev_ctrl_info(camsrc_handle_t handle, camerasrc_ctrl_t ctrl_id, camerasrc_ctrl_info_t* ctrl_info);

/**
 * Query to device driver about extra device info(face detection, strobe, etc.) of device
 *
 * @param[in]		handle ::camsrc_handle_t handle
 * @param[out]		camerasrc_extra_info_t device capabilities structure
 * @return		Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
 */
int camerasrc_query_extra_dev_info(camsrc_handle_t handle, camerasrc_extra_info_t* extra_info);

/**
 * Dump functions for debugging
 */
int camerasrc_dump_basic_dev_info(camsrc_handle_t handle, camerasrc_caps_info_t* caps_info);
int camerasrc_dump_misc_dev_info(camsrc_handle_t handle, camerasrc_ctrl_list_info_t* ctrl_list_info);
int camerasrc_dump_extra_dev_info(camsrc_handle_t handle, camerasrc_extra_info_t* extra_info);
/* END For Query functionalities */

#ifdef __cplusplus
}
#endif

#endif /*__CAMERASRC_H__*/