Add new internal API to set device for extra preview
[platform/core/api/camera.git] / include / camera_internal.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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 #ifndef __TIZEN_MULTIMEDIA_CAMERA_INTERNAL_H__
18 #define __TIZEN_MULTIMEDIA_CAMERA_INTERNAL_H__
19
20 #include <camera.h>
21 #include <mm_types.h>
22 #include <mm_camcorder.h>
23 #include <tbm_surface_internal.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 /**
30  * @file camera_internal.h
31  * @brief This file contains the internal Camera API, related structures and enumerations.
32  * @since_tizen 3.0
33  */
34
35 /**
36  * @addtogroup CAPI_MEDIA_CAMERA_INTERNAL_MODULE
37  * @{
38  */
39
40 #define CAMERA_DEVICE_MAX        ((CAMERA_DEVICE_CAMERA9 + 1) * 2)
41
42 typedef struct _camera_device_list_s {
43         unsigned int count;
44         camera_device_s device[CAMERA_DEVICE_MAX];
45 } camera_device_list_s;
46
47
48 /**
49  * @internal
50  * @brief Start the evas rendering.
51  * @since_tizen 3.0
52  * @param[in] camera The handle to the camera
53  * @return @c 0 on success, otherwise a negative error value
54  * @retval #CAMERA_ERROR_NONE Successful
55  * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
56  * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
57  * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation
58  * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
59  */
60 int camera_start_evas_rendering(camera_h camera);
61
62 /**
63  * @internal
64  * @brief Stop the evas rendering.
65  * @since_tizen 3.0
66  * @param[in] camera The handle to the camera
67  * @param[in] keep_screen If @c true keep last frame on display, otherwise @c false
68  * @return @c 0 on success, otherwise a negative error value
69  * @retval #CAMERA_ERROR_NONE Successful
70  * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
71  * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
72  * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation
73  * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
74  */
75 int camera_stop_evas_rendering(camera_h camera, bool keep_screen);
76
77 /**
78  * @internal
79  * @brief Sets the ecore wayland video display.
80  * @since_tizen 6.0
81  * @remarks This function must be called in main thread of the application.
82  *          Otherwise, it will return #CAMERA_ERROR_INVALID_OPERATION by internal restriction.
83  *          To avoid #CAMERA_ERROR_INVALID_OPERATION in sub thread, ecore_thread_main_loop_begin() and
84  *          ecore_thread_main_loop_end() can be used, but deadlock can occur if the main thread is busy.
85  *          So, it's not recommended to use them.
86  * @param[in] camera The handle to the camera
87  * @param[in] ecore_wl_window The ecore wayland window handle
88  * @return @c 0 on success,
89  *         otherwise a negative error value
90  * @retval #CAMERA_ERROR_NONE Successful
91  * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
92  * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
93  * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation
94  * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
95  * @pre The camera state must be set to #CAMERA_STATE_CREATED.
96  * @see camera_start_preview()
97  * @see ecore_thread_main_loop_begin()
98  * @see ecore_thread_main_loop_end()
99  */
100 int camera_set_ecore_wl_display(camera_h camera, void *ecore_wl_window);
101
102 /**
103  * @internal
104  * @brief Creates preview frame from stream data.
105  * @since_tizen 6.0
106  * @param[in] stream The stream from internal pipeline
107  * @param[in] num_buffer_fd The number of buffer fd
108  * @param[in] buffer_bo_handle The bo handle of buffer
109  * @param[in] data_bo_handle The bo handle of data
110  * @param[out] frame The frame which will be filled
111  */
112 void camera_create_preview_frame(MMCamcorderVideoStreamDataType *stream, int num_buffer_fd,
113         tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame);
114
115 /**
116  * @internal
117  * @brief Sets the brightness level of flash.
118  * @since_tizen 6.5
119  * @remarks If the min value is greater than the max value from camera_attr_get_flash_brightness_range(), \n
120  *          it means that this feature is not supported.
121  * @param[in] camera The handle to the camera
122  * @param[in] level The brightness level of flash
123  * @return @c 0 on success, otherwise a negative error value
124  * @retval #CAMERA_ERROR_NONE Successful
125  * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
126  * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
127  * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
128  * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
129  * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW.
130  * @see camera_attr_get_flash_brightness()
131  * @see camera_attr_get_flash_brightness_range()
132  */
133 int camera_attr_set_flash_brightness(camera_h camera, int level);
134
135 /**
136  * @internal
137  * @brief Gets the brightness level of flash.
138  * @since_tizen 6.5
139  * @param[in]  camera The handle to the camera
140  * @param[out] level  The brightness level of flash
141  * @return @c 0 on success, otherwise a negative error value
142  * @retval #CAMERA_ERROR_NONE Successful
143  * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
144  * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
145  * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
146  * @see camera_attr_set_flash_brightness()
147  * @see camera_attr_get_flash_brightness_range()
148  */
149 int camera_attr_get_flash_brightness(camera_h camera, int *level);
150
151 /**
152  * @internal
153  * @brief Gets the available brightness level of flash.
154  * @since_tizen 6.5
155  * @remarks If the min value is greater than the max value, it means that this feature is not supported.
156  * @param[in]  camera The handle to the camera
157  * @param[out] min    The minimum brightness level of flash
158  * @param[out] max    The maximum brightness level of flash
159  * @return @c 0 on success, otherwise a negative error value
160  * @retval #CAMERA_ERROR_NONE Successful
161  * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
162  * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
163  * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
164  * @see camera_attr_set_flash_brightness()
165  * @see camera_attr_get_flash_brightness()
166  */
167 int camera_attr_get_flash_brightness_range(camera_h camera, int *min, int *max);
168
169 /**
170  * @internal
171  * @brief Sets the manual focus level.
172  * @since_tizen 6.5
173  * @remarks The auto focusing will be stopped when camera_attr_set_focus_level() is called.
174  * @param[in] camera The handle to the camera
175  * @param[in] level The manual focus level
176  * @return @c 0 on success, otherwise a negative error value
177  * @retval #CAMERA_ERROR_NONE Successful
178  * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
179  * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
180  * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
181  * @see camera_attr_get_focus_level()
182  * @see camera_attr_get_focus_level_range()
183  */
184 int camera_attr_set_focus_level(camera_h camera, int level);
185
186 /**
187  * @internal
188  * @brief Gets the manual focus level.
189  * @since_tizen 6.5
190  * @param[in] camera The handle to the camera
191  * @param[out] level The manual focus level
192  * @return @c 0 on success, otherwise a negative error value
193  * @retval #CAMERA_ERROR_NONE Successful
194  * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
195  * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
196  * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
197  * @see camera_attr_set_focus_level()
198  * @see camera_attr_get_focus_level_range()
199  */
200 int camera_attr_get_focus_level(camera_h camera, int *level);
201
202 /**
203  * @internal
204  * @brief Gets lower limit and upper limit for manual focus level.
205  * @since_tizen 6.5
206  * @remarks If the min value is greater than the max value, it means that this feature is not supported.
207  * @param[in] camera The handle to the camera
208  * @param[out] min The lower limit for manual focus level
209  * @param[out] max The upper limit for manual focus level
210  * @return @c 0 on success, otherwise a negative error value
211  * @retval #CAMERA_ERROR_NONE Successful
212  * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
213  * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
214  * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
215  * @see camera_attr_set_focus_level()
216  * @see camera_attr_get_focus_level()
217  */
218 int camera_attr_get_focus_level_range(camera_h camera, int *min, int *max);
219
220 /**
221  * @internal
222  * @brief Sets device for the extra preview stream.
223  * @since_tizen 7.0
224  * @param[in] camera       The handle to the camera
225  * @param[in] stream_id    The id of extra preview stream
226  * @param[in] device       The camera type
227  * @return @c 0 on success, otherwise a negative error value
228  * @retval #CAMERA_ERROR_NONE Successful
229  * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
230  * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
231  * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
232  * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
233  * @pre The camera state must be set to #CAMERA_STATE_CREATED.
234  * @see camera_set_extra_preview_cb()
235  * @see camera_unset_extra_preview_cb()
236  */
237 int camera_set_extra_preview_device(camera_h camera, int stream_id, camera_device_e device);
238
239 /**
240  * @}
241  */
242 #ifdef __cplusplus
243 }
244 #endif
245
246 #endif /* __TIZEN_MULTIMEDIA_CAMERA_INTERNAL_H__ */