Updating INI configuration file to work with most cameras.
[profile/ivi/camera.git] / include / camera_utils.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *        http://www.tizenopensource.org/license
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #ifndef __DEF_camera_utils_H_
19 #define __DEF_camera_utils_H_
20
21 #include <sys/vfs.h>
22
23 #include "cam.h"
24
25 typedef unsigned char byte;
26
27
28 typedef enum {
29         CAM_IMG_ROTATION_LEFT = 0,
30         CAM_IMG_ROTATION_RIGHT,
31 } CamRorationAngle;
32
33 gboolean cam_utils_check_battery_warning_low(void);
34 gboolean cam_utils_check_battery_critical_low(void);
35
36
37 int cam_utils_get_battery_level(void);
38
39 gint cam_utils_get_charging_status(void);
40
41 void *cam_utils_YUV422_to_ARGB(byte *frame, int width, int height);
42
43 void *cam_utils_IYUV_to_ARGB(byte *frame, int width, int height);
44
45 gboolean
46 cam_utils_save_to_jpg_file(int storage_id, gchar *filename, void *frame,
47                            int width, int height, GError **error);
48
49 gboolean
50 cam_utils_save_to_jpg_memory(byte **memory, unsigned int *size, void *src_frame,
51                              int width, int height);
52
53 void
54 cam_utils_draw_guide_rectangle(void *data, void *frame, int x_org, int y_org,
55                                int width, int height);
56
57 void cam_utils_convert_YUYV_to_UYVY(unsigned char *dst, unsigned char *src, gint length);       /* fast convert , but lost 1pixel Y data. */
58
59 void cam_utils_convert_UYVY_to_YUYV(char *dst, char *src, gint length);
60
61 #if 1
62 void
63 cam_utils_convert_YUYV_to_YUV420P(unsigned char *pInBuf, unsigned char *pOutBuf,
64                                   int width, int height);
65 #else
66 void
67 cam_utils_convert_YUYV_to_YUV420P(byte *src, byte *dst, gint width,
68                                   gint height);
69 #endif
70
71 void *cam_utils_load_fake_yuv_image();  /* This function load memory address of 640*480 yuyv (16bit) image */
72
73 void *cam_utils_get_fake_yuv_image();
74
75 void cam_utils_free_fake_yuv_image();
76
77 guint64 cam_system_get_remain_rec_time(void *data);
78
79 gint64 cam_system_get_still_count_by_resolution(void *data);
80
81 gint64 cam_get_free_space(const gchar *path);
82
83 gint64 cam_get_capacity_space(const gchar *path);
84
85 void *cam_utils_load_temp_file(gchar *filepath, gint *pfilesize);
86
87 gboolean cam_utils_check_torchlight_status(void *data);
88
89 gboolean cam_utils_check_mmc_for_writing(GError **error);
90
91 gboolean cam_utils_check_mmc_for_inserted_stats(void *data);
92
93 int cam_utils_check_mmc_status(void);
94
95 int cam_utils_get_storage_id_from_filepath(const char *filepath);
96
97 gboolean cam_utils_safety_file_copy(const char *dst, const char *src,
98                                     GError **error);
99
100 gboolean cam_utils_check_wide_resolution(int resol_w, int resol_h);
101
102 gboolean cam_utils_parse_args(int argc, char *argv[], CamExeArgs *args);
103
104 gboolean cam_utils_check_fake_image_exist(const char *fake_image_path);
105
106 int cam_utils_captured_image_select(void *data, const char *file_path);
107
108 gboolean cam_utils_image_rotate(char *src, int src_width, int src_height,
109                                 char *dst, int *dst_width, int *dst_height,
110                                 int degree);
111 gboolean cam_utils_set_guide_rect_color(void *data);
112 /**
113  * @brief       change video stream xy to windos xy
114  *      while target is 0 degree(landscape):the coordinate sytem:
115  *      win     ----------------------------------(width:horizontal)
116  *              -offset -       video           -offset -
117  *              -<--->-<--------------->-<----->-
118  *              -       -                       -       -
119  *height(vertical)----------------------------------
120  * @param[in]   faces           camera_detected_face_s array
121  * @param[in]   count           face count
122  * @param[in]   data            user_data, it should be appdata
123  * @return      void
124  */
125 void cam_utils_set_videos_xy_to_windows_xy(CamVideoRectangle src,
126                                                                 CamVideoRectangle *result,
127                                                                 void *data);
128 /**
129  * @brief       change windos stream xy to video xy
130  *      while target is 0 degree(landscape):the coordinate sytem:
131  *      win     ----------------------------------(width:horizontal)
132  *              -offset -       video           -offset -
133  *              -<--->-<--------------->-<----->-
134  *              -       -                       -       -
135  *height(vertical)----------------------------------
136  * @param[in]   faces           camera_detected_face_s array
137  * @param[in]   count           face count
138  * @param[in]   data            user_data, it should be appdata
139  * @return      void
140  */
141
142 void cam_utils_set_windows_xy_to_videos_xy(CamVideoRectangle src,
143                                                                 CamVideoRectangle *result,
144                                                                 void *data);
145
146
147 #endif                          /* __DEF_camera_utils_H__ */