2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __TIZEN_MULTIMEDIA_CAMERA_INTERNAL_H__
18 #define __TIZEN_MULTIMEDIA_CAMERA_INTERNAL_H__
28 * @file camera_internal.h
29 * @brief This file contains the internal Camera API, related structures and enumerations.
34 * @addtogroup CAPI_MEDIA_CAMERA_INTERNAL_MODULE
40 * @brief Enumeration for the auto exposure status of preview frame.
44 CAMERA_STATUS_AUTO_EXPOSURE_NONE, /**< None */
45 CAMERA_STATUS_AUTO_EXPOSURE_UNSTABLE, /**< Unstable */
46 CAMERA_STATUS_AUTO_EXPOSURE_STABLE /**< Stable */
47 } camera_status_auto_exposure_e;
51 * @brief Enumeration for the auto white balance status of preview frame.
55 CAMERA_STATUS_AUTO_WHITE_BALANCE_NONE, /**< None */
56 CAMERA_STATUS_AUTO_WHITE_BALANCE_UNSTABLE, /**< Unstable */
57 CAMERA_STATUS_AUTO_WHITE_BALANCE_STABLE /**< Stable */
58 } camera_status_auto_white_balance_e;
62 * @brief The structure type of the frame meta.
64 * @remarks This is available for specific device only.
66 typedef struct _camera_frame_meta_s {
67 unsigned long long ts_soe;
68 unsigned long long ts_eoe;
69 unsigned long long ts_sof;
70 unsigned long long ts_eof;
71 unsigned long long ts_hal;
72 unsigned long long ts_qmf;
73 unsigned long long ts_gst;
74 unsigned long long td_exp;
75 unsigned long long ts_aux;
76 unsigned long long td_aux;
77 unsigned long long seqnum;
78 unsigned long long flags;
79 } camera_frame_meta_s;
84 * @brief Start the evas rendering.
86 * @param[in] camera The handle to the camera
87 * @return @c 0 on success, otherwise a negative error value
88 * @retval #CAMERA_ERROR_NONE Successful
89 * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
90 * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
91 * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation
92 * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
94 int camera_start_evas_rendering(camera_h camera);
98 * @brief Stop the evas rendering.
100 * @param[in] camera The handle to the camera
101 * @param[in] keep_screen If @c true keep last frame on display, otherwise @c false
102 * @return @c 0 on success, otherwise a negative error value
103 * @retval #CAMERA_ERROR_NONE Successful
104 * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
105 * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
106 * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation
107 * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
109 int camera_stop_evas_rendering(camera_h camera, bool keep_screen);
113 * @brief Sets the ecore wayland video display.
115 * @remarks This function must be called in main thread of the application.
116 * Otherwise, it will return #CAMERA_ERROR_INVALID_OPERATION by internal restriction.
117 * To avoid #CAMERA_ERROR_INVALID_OPERATION in sub thread, ecore_thread_main_loop_begin() and
118 * ecore_thread_main_loop_end() can be used, but deadlock can occur if the main thread is busy.
119 * So, it's not recommended to use them.
120 * @param[in] camera The handle to the camera
121 * @param[in] ecore_wl_window The ecore wayland window handle
122 * @return @c 0 on success,
123 * 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_INVALID_OPERATION Invalid operation
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.
130 * @see camera_start_preview()
131 * @see ecore_thread_main_loop_begin()
132 * @see ecore_thread_main_loop_end()
134 int camera_set_ecore_wl_display(camera_h camera, void *ecore_wl_window);
138 * @brief Creates preview frame from stream data.
140 * @param[in] stream The stream from internal pipeline
141 * @param[in] num_buffer_fd The number of buffer fd
142 * @param[in] buffer_bo_handle The bo handle of buffer
143 * @param[in] data_bo_handle The bo handle of data
144 * @param[out] frame The frame which will be filled
146 void camera_create_preview_frame(void *stream, int num_buffer_fd,
147 void *buffer_bo_handle, void *data_bo_handle, camera_preview_data_s *frame);
151 * @brief Sets the brightness level of flash.
153 * @remarks If the min value is greater than the max value from camera_attr_get_flash_brightness_range(), \n
154 * it means that this feature is not supported.
155 * @param[in] camera The handle to the camera
156 * @param[in] level The brightness level of flash
157 * @return @c 0 on success, otherwise a negative error value
158 * @retval #CAMERA_ERROR_NONE Successful
159 * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
160 * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
161 * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
162 * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
163 * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW.
164 * @see camera_attr_get_flash_brightness()
165 * @see camera_attr_get_flash_brightness_range()
167 int camera_attr_set_flash_brightness(camera_h camera, int level);
171 * @brief Gets the brightness level of flash.
173 * @param[in] camera The handle to the camera
174 * @param[out] level The brightness level of flash
175 * @return @c 0 on success, otherwise a negative error value
176 * @retval #CAMERA_ERROR_NONE Successful
177 * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
178 * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
179 * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
180 * @see camera_attr_set_flash_brightness()
181 * @see camera_attr_get_flash_brightness_range()
183 int camera_attr_get_flash_brightness(camera_h camera, int *level);
187 * @brief Gets the available brightness level of flash.
189 * @remarks If the min value is greater than the max value, it means that this feature is not supported.
190 * @param[in] camera The handle to the camera
191 * @param[out] min The minimum brightness level of flash
192 * @param[out] max The maximum brightness level of flash
193 * @return @c 0 on success, otherwise a negative error value
194 * @retval #CAMERA_ERROR_NONE Successful
195 * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
196 * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
197 * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
198 * @see camera_attr_set_flash_brightness()
199 * @see camera_attr_get_flash_brightness()
201 int camera_attr_get_flash_brightness_range(camera_h camera, int *min, int *max);
205 * @brief Sets device for the extra preview stream.
207 * @param[in] camera The handle to the camera
208 * @param[in] stream_id The id of extra preview stream
209 * @param[in] device The camera type
210 * @return @c 0 on success, otherwise a negative error value
211 * @retval #CAMERA_ERROR_NONE Successful
212 * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
213 * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
214 * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
215 * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
216 * @pre The camera state must be set to #CAMERA_STATE_CREATED.
217 * @see camera_set_extra_preview_cb()
218 * @see camera_unset_extra_preview_cb()
220 int camera_set_extra_preview_device(camera_h camera, int stream_id, camera_device_e device);
224 * @brief Requests codec config data for encoded format.
226 * @param[in] camera The handle to the camera
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_PREVIEW.
234 * @see camera_start_preview()
236 int camera_request_codec_config(camera_h camera);
240 * @brief Gets the timestamp of preview frame in nano second.
242 * @remarks The function should be called in camera_preview_cb() or camera_media_packet_preview_cb(),\n
243 * otherwise, it will return #CAMERA_ERROR_INVALID_OPERATION.
244 * @param[in] camera The handle to the camera
245 * @param[out] timestamp The timestamp of preview frame (in nsec)
246 * @return @c 0 on success, otherwise a negative error value
247 * @retval #CAMERA_ERROR_NONE Successful
248 * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
249 * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
251 int camera_attr_get_preview_frame_timestamp(camera_h camera, unsigned long long *timestamp);
255 * @brief Gets the frame meta of preview frame.
257 * @remarks The function should be called in camera_preview_cb() or camera_media_packet_preview_cb(),\n
258 * otherwise, it will return #CAMERA_ERROR_INVALID_OPERATION.
259 * @param[in] camera The handle to the camera
260 * @param[out] frame_meta The frame meta of preview buffer (in nsec for timestamp)
261 * @return @c 0 on success, otherwise a negative error value
262 * @retval #CAMERA_ERROR_NONE Successful
263 * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
264 * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
266 int camera_attr_get_preview_frame_meta(camera_h camera, camera_frame_meta_s *frame_meta);
270 * @brief Gets the auto exposure status of preview frame.
272 * @remarks The function should be called in camera_preview_cb() or camera_media_packet_preview_cb(),\n
273 * otherwise, it will return #CAMERA_ERROR_INVALID_OPERATION.
274 * @param[in] camera The handle to the camera
275 * @param[out] status The auto exposure status of preview frame
276 * @return @c 0 on success, otherwise a negative error value
277 * @retval #CAMERA_ERROR_NONE Successful
278 * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
279 * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
281 int camera_attr_get_preview_frame_status_auto_exposure(camera_h camera, camera_status_auto_exposure_e *status);
285 * @brief Gets the auto white balance status of preview frame.
287 * @remarks The function should be called in camera_preview_cb() or camera_media_packet_preview_cb(),\n
288 * otherwise, it will return #CAMERA_ERROR_INVALID_OPERATION.
289 * @param[in] camera The handle to the camera
290 * @param[out] status The auto white balance status of preview frame
291 * @return @c 0 on success, otherwise a negative error value
292 * @retval #CAMERA_ERROR_NONE Successful
293 * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
294 * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
296 int camera_attr_get_preview_frame_status_auto_white_balance(camera_h camera, camera_status_auto_white_balance_e *status);
300 * @brief Gets the media packet preview internal callback feature's supported state.
302 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
303 * @param[in] camera The handle to the camera
304 * @return @c true if supported, otherwise @c false
305 * @exception #CAMERA_ERROR_NONE Successful
306 * @exception #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
307 * @exception #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
308 * @exception #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
310 bool camera_is_supported_media_packet_preview_internal_cb(camera_h camera);
314 * @brief Sets a media packet callback function to be invoked once per frame when previewing.
316 * @remarks A @a callback is invoked on the internal thread of the camera.\n
317 * A video frame can be retrieved using a @a callback as a media packet.\n
318 * The callback function holds the same buffer that will be drawn on the display device.\n
319 * So if you change the media packet in a callback, it will be displayed on the device \n
320 * and the media packet is available until it's released by media_packet_unref().
321 * @param[in] camera The handle to the camera
322 * @param[in] callback The callback function to be invoked
323 * @param[in] user_data The user data to be passed to the callback function
324 * @return 0 on success, otherwise a negative error value
325 * @retval #CAMERA_ERROR_NONE Successful
326 * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
327 * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
328 * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
329 * @see camera_start_preview()
330 * @see camera_unset_media_packet_preview_internal_cb()
331 * @see camera_media_packet_preview_cb()
333 int camera_set_media_packet_preview_internal_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data);
337 * @brief Unsets the media packet internal callback function.
339 * @param[in] camera The handle to the camera
340 * @return @c 0 on success, otherwise a negative error value
341 * @retval #CAMERA_ERROR_NONE Successful
342 * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
343 * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
344 * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
345 * @see camera_set_media_packet_preview_internal_cb()
347 int camera_unset_media_packet_preview_internal_cb(camera_h camera);
357 #endif /* __TIZEN_MULTIMEDIA_CAMERA_INTERNAL_H__ */