2 * Copyright (c) 2014 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_MEDIA_IMAGE_FACE_H__
18 #define __TIZEN_MEDIA_IMAGE_FACE_H__
20 #include <media_content_type.h>
24 #endif /* __cplusplus */
28 * @brief This file contains the media face API and related to all operations with the face information of the image in Media DB. \n
29 * Functions include cloning and destroying the face handler, getting face information such as face id, face coordinates in file, \n
30 * face tag. Face information detected and managed by DB automatically when image contents scanning. \n
31 * And you can insert,update,delete face information manually.
35 * @addtogroup CAPI_CONTENT_MEDIA_FACE_MODULE
40 * @brief Clones the face handle.
41 * @details This function copies the face handle from a source to
42 * destination. There is no media_face_create() function. The media_face_h is created internally and available through
43 * media face foreach function such as media_face_foreach_face_from_db(). To use this handle outside of these foreach functions,
47 * @remark The destination handle must be released with media_event_destroy() by you.
49 * @param [in] src The source face handle
50 * @param [out] dst A destination face handle
52 * @return 0 on success, otherwise a negative error value.
54 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
55 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
56 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
58 * @see media_face_destroy()
59 * @see media_face_foreach_face_from_db()
61 int media_face_clone(media_face_h *dst, media_face_h src);
64 * @brief Destroys the face handle.
65 * @details Function frees all resources related to face handle. This
66 * handle no longer can be used to perform any operation. New handle has to
67 * be created before next usage.
71 * @param [in] face The face handle
73 * @return 0 on success, otherwise a negative error value.
75 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
76 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
78 * @see media_face_clone()
80 * @pre Get copy of face handle by calling media_face_clone() or Get face handle by calling media_info_foreach_face_from_db()
83 int media_face_destroy(media_face_h face);
86 * @brief Gets the face id from the face handle.
90 * @param [in] face The face handle
91 * @param [out] face_id The uuid of the face handle
93 * @return 0 on success, otherwise a negative error value.
95 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
96 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
98 int media_face_get_face_id(media_face_h face, char **face_id);
101 * @brief Gets the media uuid from the face handle.
105 * @param [in] face The face handle
106 * @param [out] media_id The media uuid of the face handle
108 * @return 0 on success, otherwise a negative error value.
110 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
111 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
113 int media_face_get_media_id(media_face_h face, char **media_id);
116 * @brief Gets the face's rectangle from the face handle.
117 * @details This API can get the face's rectangle information. returned rectangle information includes the orientation value.
121 * @param [in] face The face handle
122 * @param [out] rect_x The x position of face of the face handle
123 * @param [out] rect_y The y position of face of the face handle
124 * @param [out] rect_w The width of face of the face handle
125 * @param [out] rect_h The height of face of the face handle
127 * @return 0 on success, otherwise a negative error value.
128 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
129 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
131 int media_face_get_face_rect(media_face_h face, unsigned int *rect_x, unsigned int *rect_y, unsigned int *rect_w, unsigned int *rect_h);
134 * @brief Gets the orientation from the face handle.
135 * @details This API can get the orientation value from the original image.
139 * @param [in] face The face handle
140 * @param [out] orientation The orientation of the face handle
142 * @return 0 on success, otherwise a negative error value.
143 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
144 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
146 int media_face_get_orientation(media_face_h face, media_content_orientation_e *orientation);
149 * @brief Gets the tag from the face handle.
153 * @param [in] face The face handle
154 * @param [out] tag The tag of the face handle
156 * @return 0 on success, otherwise a negative error value.
157 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
158 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
160 int media_face_get_tag(media_face_h face, char **tag);
163 * @brief Creates the face handle.
167 * @param [out] face The face handle
169 * @return 0 on success, otherwise a negative error value.
170 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
171 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
173 * @see media_face_destroy()
175 int media_face_create(const char *media_id, media_face_h *face);
178 * @brief Sets the face rectangle of the face handle
182 * @param[in] face The face handle
183 * @param[in] rect_x The integer to set as a position x of face rectangle
184 * @param[in] rect_y The integer to set as a position y of face rectangle
185 * @param[in] rect_w The integer to set as a width of face rectangle
186 * @param[in] rect_h The integer to set as a height of face rectangle
188 * @return 0 on success, otherwise a negative error value.
189 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
190 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
191 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
193 * @post media_face_insert_to_db()
194 * @post media_face_update_to_db()
197 int media_face_set_face_rect(media_face_h face, unsigned int rect_x, unsigned int rect_y, unsigned int rect_w, unsigned int rect_h);
200 * @brief Sets the orientation of the face handle
201 * @details This API may set the value of the original image orientation.
205 * @param[in] face The face handle
206 * @param[in] orientation The integer to set as an orientation
208 * @return 0 on success, otherwise a negative error value.
209 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
210 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
211 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
213 * @post media_face_insert_to_db()
214 * @post media_face_update_to_db()
217 int media_face_set_orientation(media_face_h face, media_content_orientation_e orientation);
220 * @brief Sets the tag of the face handle.
224 * @param [in] face The face handle
225 * @param [in] tag The tag of the face handle
227 * @return 0 on success, otherwise a negative error value.
228 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
229 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
230 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
232 * @post media_face_insert_to_db()
233 * @post media_face_update_to_db()
235 int media_face_set_tag(media_face_h face, const char *tag);
238 * @brief Inserts a new face in the media database.
242 * @privilege %http://tizen.org/privilege/content.write
244 * @remarks The created tag handle must be released using media_tag_destroy().
246 * @param [in] face The face handle
248 * @return 0 on success, otherwise a negative error value.
250 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
251 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
252 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
253 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
255 * @see media_content_connect()
256 * @see media_face_destroy()
257 * @see media_face_set_xxx()
259 int media_face_insert_to_db(media_face_h face);
262 * @brief Updates the face details to the media database.
264 * @details The function updates the given media face in the media database. The function should be called after any change in face, to be updated to the media
265 * database. For example, after using media_face_set_orientation() for setting the orientation of the face, media_face_update_to_db() function should be called so as to update
266 * the given face attibutes in the media database.
270 * @privilege %http://tizen.org/privilege/content.write
272 * @param[in] face The face handle to update
274 * @return 0 on success, otherwise a negative error value.
276 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
277 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
278 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
280 * @pre This function requires opened connection to content service by media_content_connect().
282 * @see media_content_connect()
283 * @see media_face_destroy()
284 * @see media_face_set_xxx()
287 int media_face_update_to_db(media_face_h face);
290 * @brief Deletes the face with given face uuid from the media database.
295 * @privilege %http://tizen.org/privilege/content.write
297 * @param [in] face_id The id of media face
299 * @return 0 on success, otherwise a negative error value.
300 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
301 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
302 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
304 * @pre This function requires opened connection to content service by media_content_connect().
305 * @see media_content_connect()
308 int media_face_delete_from_db(const char *face_id);
316 #endif /* __cplusplus */
318 #endif /* __TIZEN_MEDIA_IMAGE_FACE_H__ */