[ACR-408] Add API for face(Add description and return type)
[platform/core/api/media-content.git] / include / media_face.h
1 /*
2 * Copyright (c) 2014 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_MEDIA_IMAGE_FACE_H__
18 #define __TIZEN_MEDIA_IMAGE_FACE_H__
19
20 #include <media_content_type.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
25
26 /**
27  * @file media_face.h
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.
32  */
33
34 /**
35  * @addtogroup CAPI_CONTENT_MEDIA_FACE_MODULE
36  * @{
37  */
38
39 /**
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,
44  * use this function.
45  *
46  * @since_tizen 3.0
47  * @remark The destination handle must be released with media_event_destroy() by you.
48  *
49  * @param [in] src The source face handle
50  * @param [out] dst A destination face handle
51  *
52  * @return 0 on success, otherwise a negative error value.
53  *
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
57  *
58  * @see media_face_destroy()
59  * @see media_face_foreach_face_from_db()
60  */
61 int media_face_clone(media_face_h *dst, media_face_h src);
62
63 /**
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.
68  *
69  * @since_tizen 3.0
70  *
71  * @param [in] face The face handle
72  *
73  * @return 0 on success, otherwise a negative error value.
74  *
75  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
76  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
77  *
78  * @see media_face_clone()
79  *
80  * @pre Get copy of face handle by calling media_face_clone() or Get face handle by calling media_info_foreach_face_from_db()
81  *
82  */
83 int media_face_destroy(media_face_h face);
84
85 /**
86  * @brief Gets the face id from the face handle.
87  *
88  * @since_tizen 3.0
89  *
90  * @param [in] face The face handle
91  * @param [out] face_id The uuid of the face handle
92  *
93  * @return 0 on success, otherwise a negative error value.
94  *
95  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
96  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
97  */
98 int media_face_get_face_id(media_face_h face, char **face_id);
99
100 /**
101  * @brief Gets the media uuid from the face handle.
102  *
103  * @since_tizen 3.0
104  *
105  * @param [in] face The face handle
106  * @param [out] media_id The media uuid of the face handle
107  *
108  * @return 0 on success, otherwise a negative error value.
109  *
110  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
111  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
112  */
113 int media_face_get_media_id(media_face_h face, char **media_id);
114
115  /**
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.
118  *
119  * @since_tizen 3.0
120  *
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
126  *
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
130  */
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);
132
133 /**
134  * @brief Gets the orientation from the face handle.
135  * @details This API can get the orientation value from the original image.
136  *
137  * @since_tizen 3.0
138  *
139  * @param [in] face The face handle
140  * @param [out] orientation The orientation of the face handle
141  *
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
145  */
146 int media_face_get_orientation(media_face_h face, media_content_orientation_e *orientation);
147
148 /**
149  * @brief Gets the tag from the face handle.
150  *
151  * @since_tizen 3.0
152  *
153  * @param [in] face The face handle
154  * @param [out] tag The tag of the face handle
155  *
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
159  */
160 int media_face_get_tag(media_face_h face, char **tag);
161
162 /**
163  * @brief Creates the face handle.
164  *
165  * @since_tizen 3.0
166  *
167  * @param [out] face The face handle
168  *
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
172  *
173  * @see media_face_destroy()
174  */
175 int media_face_create(const char *media_id, media_face_h *face);
176
177 /**
178  * @brief Sets the face rectangle of the face handle
179  *
180  * @since_tizen 3.0
181  *
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
187  *
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
192  *
193  * @post media_face_insert_to_db()
194  * @post media_face_update_to_db()
195  *
196  */
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);
198
199 /**
200  * @brief Sets the orientation of the face handle
201  * @details This API may set the value of the original image orientation.
202  *
203  * @since_tizen 3.0
204  *
205  * @param[in] face The face handle
206  * @param[in] orientation The integer to set as an orientation
207  *
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
212  *
213  * @post media_face_insert_to_db()
214  * @post media_face_update_to_db()
215  *
216  */
217 int media_face_set_orientation(media_face_h face, media_content_orientation_e orientation);
218
219 /**
220  * @brief Sets the tag of the face handle.
221  *
222  * @since_tizen 3.0
223  *
224  * @param [in] face The face handle
225  * @param [in] tag The tag of the face handle
226  *
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
231  *
232  * @post media_face_insert_to_db()
233  * @post media_face_update_to_db()
234  */
235 int media_face_set_tag(media_face_h face, const char *tag);
236
237 /**
238  * @brief Inserts a new face in the media database.
239  * @since_tizen 3.0
240  *
241  * @privlevel public
242  * @privilege %http://tizen.org/privilege/content.write
243  *
244  * @remarks The created tag handle must be released using media_tag_destroy().
245  *
246  * @param [in] face The face handle
247  *
248  * @return 0 on success, otherwise a negative error value.
249  *
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
254  *
255  * @see media_content_connect()
256  * @see media_face_destroy()
257  * @see media_face_set_xxx()
258  */
259 int media_face_insert_to_db(media_face_h face);
260
261 /**
262  * @brief Updates the face details to the media database.
263  *
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.
267  * @since_tizen 3.0
268  *
269  * @privlevel public
270  * @privilege %http://tizen.org/privilege/content.write
271  *
272  * @param[in] face The face handle to update
273  *
274  * @return 0 on success, otherwise a negative error value.
275  *
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
279  *
280  * @pre This function requires opened connection to content service by media_content_connect().
281  *
282  * @see media_content_connect()
283  * @see media_face_destroy()
284  * @see media_face_set_xxx()
285  *
286  */
287 int media_face_update_to_db(media_face_h face);
288
289 /**
290  * @brief Deletes the face with given face uuid from the media database.
291  *
292  * @since_tizen 3.0
293  *
294  * @privlevel public
295  * @privilege %http://tizen.org/privilege/content.write
296  *
297  * @param [in] face_id The id of media face
298  *
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
303  *
304  * @pre This function requires opened connection to content service by media_content_connect().
305  * @see media_content_connect()
306  *
307  */
308 int media_face_delete_from_db(const char *face_id);
309
310 /**
311  * @}
312  */
313
314 #ifdef __cplusplus
315 }
316 #endif /* __cplusplus */
317
318 #endif /* __TIZEN_MEDIA_IMAGE_FACE_H__ */