Fix batch remove API
[platform/core/api/media-content.git] / include_product / 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 will be managed by DB. To insert face information, you should use media_face_insert_to_db() \n
31  *             or media_info_start_face_detection() API. 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  * @remarks You must release @a face_id using free().
91  *
92  * @param [in] face The face handle
93  * @param [out] face_id The uuid of the face handle
94  *
95  * @return 0 on success, otherwise a negative error value.
96  *
97  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
98  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
99  */
100 int media_face_get_face_id(media_face_h face, char **face_id);
101
102 /**
103  * @brief Gets the media uuid from the face handle.
104  *
105  * @since_tizen 3.0
106  *
107  * @remarks You must release @a media_id using free().
108  *
109  * @param [in] face The face handle
110  * @param [out] media_id The media uuid of the face handle
111  *
112  * @return 0 on success, otherwise a negative error value.
113  *
114  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
115  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
116  */
117 int media_face_get_media_id(media_face_h face, char **media_id);
118
119  /**
120  * @brief Gets the face's rectangle from the face handle.
121  * @details This API can get the face's rectangle information. returned rectangle information includes the orientation value.
122  *
123  * @since_tizen 3.0
124  *
125  * @param [in] face The face handle
126  * @param [out] rect_x The x position of face of the face handle
127  * @param [out] rect_y The y position of face of the face handle
128  * @param [out] rect_w The width of face of the face handle
129  * @param [out] rect_h The height of face of the face handle
130  *
131  * @return 0 on success, otherwise a negative error value.
132  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
133  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
134  */
135 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);
136
137 /**
138  * @brief Gets the orientation from the face handle.
139  * @details This API can get the orientation value from the original image.
140  *
141  * @since_tizen 3.0
142  *
143  * @param [in] face The face handle
144  * @param [out] orientation The orientation of the face handle
145  *
146  * @return 0 on success, otherwise a negative error value.
147  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
148  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
149  */
150 int media_face_get_orientation(media_face_h face, media_content_orientation_e *orientation);
151
152 /**
153  * @brief Gets the tag from the face handle.
154  *
155  * @since_tizen 3.0
156  *
157  * @remarks You must release @a tag using free().
158  *
159  * @param [in] face The face handle
160  * @param [out] tag The tag of the face handle
161  *
162  * @return 0 on success, otherwise a negative error value.
163  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
164  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
165  */
166 int media_face_get_tag(media_face_h face, char **tag);
167
168 /**
169  * @brief Creates the face handle.
170  *
171  * @since_tizen 3.0
172  *
173  * @param [in] media_id The media uuid to create the face handle
174  * @param [out] face The face handle
175  *
176  * @return 0 on success, otherwise a negative error value.
177  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
178  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
179  *
180  * @see media_face_destroy()
181  */
182 int media_face_create(const char *media_id, media_face_h *face);
183
184 /**
185  * @brief Sets the face rectangle of the face handle
186  *
187  * @since_tizen 3.0
188  *
189  * @param[in] face The face handle
190  * @param[in] rect_x The integer to set as a position x of face rectangle
191  * @param[in] rect_y The integer to set as a position y of face rectangle
192  * @param[in] rect_w The integer to set as a width  of face rectangle
193  * @param[in] rect_h The integer to set as a height of face rectangle
194  *
195  * @return 0 on success, otherwise a negative error value.
196  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
197  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
198  *
199  * @post media_face_insert_to_db()
200  * @post media_face_update_to_db()
201  *
202  */
203 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);
204
205 /**
206  * @brief Sets the orientation of the face handle
207  * @details This API may set the value of the original image orientation.
208  *
209  * @since_tizen 3.0
210  *
211  * @param[in] face The face handle
212  * @param[in] orientation The integer to set as an orientation
213  *
214  * @return 0 on success, otherwise a negative error value.
215  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
216  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
217  *
218  * @post media_face_insert_to_db()
219  * @post media_face_update_to_db()
220  *
221  */
222 int media_face_set_orientation(media_face_h face, media_content_orientation_e orientation);
223
224 /**
225  * @brief Sets the tag of the face handle.
226  *
227  * @since_tizen 3.0
228  *
229  * @param [in] face The face handle
230  * @param [in] tag The tag of the face handle
231  *
232  * @return 0 on success, otherwise a negative error value.
233  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
234  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
235  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
236  *
237  * @post media_face_insert_to_db()
238  * @post media_face_update_to_db()
239  */
240 int media_face_set_tag(media_face_h face, const char *tag);
241
242 /**
243  * @brief Inserts a new face in the media database.
244  * @since_tizen 3.0
245  *
246  * @privlevel public
247  * @privilege %http://tizen.org/privilege/content.write
248  *
249  * @remarks The created tag handle must be released using media_tag_destroy().
250  *
251  * @param [in] face The face handle
252  *
253  * @return 0 on success, otherwise a negative error value.
254  *
255  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
256  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
257  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
258  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
259  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
260  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB Operation failed
261  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY           DB Operation busy
262  * @retval #MEDIA_CONTENT_ERROR_NETWORK           Network fail
263  *
264  * @see media_content_connect()
265  * @see media_face_destroy()
266  * @see media_face_set_xxx()
267  */
268 int media_face_insert_to_db(media_face_h face);
269
270 /**
271  * @brief Updates the face details to the media database.
272  *
273  * @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
274  * 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
275  * the given face attributes in the media database.
276  * @since_tizen 3.0
277  *
278  * @privlevel public
279  * @privilege %http://tizen.org/privilege/content.write
280  *
281  * @param[in] face The face handle to update
282  *
283  * @return 0 on success, otherwise a negative error value.
284  *
285  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
286  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
287  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
288  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
289  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB Operation failed
290  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY           DB Operation busy
291  * @retval #MEDIA_CONTENT_ERROR_NETWORK           Network fail
292  *
293  * @pre This function requires opened connection to content service by media_content_connect().
294  *
295  * @see media_content_connect()
296  * @see media_face_destroy()
297  * @see media_face_set_xxx()
298  *
299  */
300 int media_face_update_to_db(media_face_h face);
301
302 /**
303  * @brief Deletes the face with given face uuid from the media database.
304  *
305  * @since_tizen 3.0
306  *
307  * @privlevel public
308  * @privilege %http://tizen.org/privilege/content.write
309  *
310  * @param [in] face_id The id of media face
311  *
312  * @return 0 on success, otherwise a negative error value.
313  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
314  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
315  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
316  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
317  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB Operation failed
318  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY           DB Operation busy
319  * @retval #MEDIA_CONTENT_ERROR_NETWORK           Network fail
320  *
321  * @pre This function requires opened connection to content service by media_content_connect().
322  * @see media_content_connect()
323  *
324  */
325 int media_face_delete_from_db(const char *face_id);
326
327 /**
328  * @brief Gets the number of media faces with an optional filter from the media database.
329  * @since_tizen 4.0
330  *
331  * @param[in]  filter      The handle to the face filter
332  * @param[out] face_count  The count of the media faces
333  *
334  * @return @c 0 on success,
335  *         otherwise a negative error value
336  *
337  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
338  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
339  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB Operation failed
340  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY           DB Operation busy
341  *
342  * @pre This function requires opened connection to content service by media_content_connect().
343  *
344  * @see media_content_connect()
345  * @see media_filter_create()
346  */
347 int media_face_get_face_count_from_db(filter_h filter, int *face_count);
348
349 /**
350  * @brief Iterates through the faces with an optional filter from the media database.
351  * @details This function gets all faces associated with the given filter and calls @a callback for every retrieved media face.
352  *          If @c NULL is passed to the @a filter, then no filtering is applied.
353  * @since_tizen 4.0
354  *
355  * @param[in] filter     The handle to the face filter
356  * @param[in] callback   The callback function to be invoked
357  * @param[in] user_data  The user data to be passed to the callback function
358  *
359  * @return @c 0 on success,
360  *         otherwise a negative error value
361  *
362  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
363  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
364  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
365  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB Operation failed
366  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY           DB Operation busy
367  *
368  * @pre This function requires opened connection to content service by media_content_connect().
369  * @post This function invokes media_face_cb().
370  *
371  * @see media_content_connect()
372  * @see media_face_cb()
373  * @see media_filter_create()
374  */
375 int media_face_foreach_face_from_db(filter_h filter, media_face_cb callback, void *user_data);
376
377 /**
378  * @}
379  */
380
381 #ifdef __cplusplus
382 }
383 #endif /* __cplusplus */
384
385 #endif /* __TIZEN_MEDIA_IMAGE_FACE_H__ */