Tizen Native API  3.0

The Media Face Information API provides functions to manage the face information in the image files.

Required Header

#include <media_content.h>

Overview

The Face Information API provides functions to manage the face information such as face id, face coordinates in the image files.

Functions

int media_face_clone (media_face_h *dst, media_face_h src)
 Clones the face handle.
int media_face_destroy (media_face_h face)
 Destroys the face handle.
int media_face_get_face_id (media_face_h face, char **face_id)
 Gets the face id from the face handle.
int media_face_get_media_id (media_face_h face, char **media_id)
 Gets the media uuid from the face handle.
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)
 Gets the face's rectangle from the face handle.
int media_face_get_orientation (media_face_h face, media_content_orientation_e *orientation)
 Gets the orientation from the face handle.
int media_face_get_tag (media_face_h face, char **tag)
 Gets the tag from the face handle.
int media_face_create (const char *media_id, media_face_h *face)
 Creates the face handle.
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)
 Sets the face rectangle of the face handle.
int media_face_set_orientation (media_face_h face, media_content_orientation_e orientation)
 Sets the orientation of the face handle.
int media_face_set_tag (media_face_h face, const char *tag)
 Sets the tag of the face handle.
int media_face_insert_to_db (media_face_h face)
 Inserts a new face in the media database.
int media_face_update_to_db (media_face_h face)
 Updates the face details to the media database.
int media_face_delete_from_db (const char *face_id)
 Deletes the face with given face uuid from the media database.

Typedefs

typedef void * media_face_h
 The structure type for the Media face handle.
typedef bool(* media_face_cb )(media_face_h face, void *user_data)
 Called for every face in the obtained list of face.

Typedef Documentation

typedef bool(* media_face_cb)(media_face_h face, void *user_data)

Called for every face in the obtained list of face.

Since :
3.0

Iterates over a media face list.

Remarks:
You should not destroy face returned by this function.
The callback is called in the main loop.
Parameters:
[in]faceThe handle of the media face
[in]user_dataThe user data passed from the foreach function
Returns:
true to continue with the next iteration of the loop, otherwise false to break out of the loop
Precondition:
media_info_foreach_face_from_db() will invoke this function.
See also:
media_info_foreach_face_from_db()
typedef void* media_face_h

The structure type for the Media face handle.

Since :
3.0

Function Documentation

int media_face_clone ( media_face_h dst,
media_face_h  src 
)

Clones the face handle.

This function copies the face handle from a source to destination. There is no media_face_create() function. The media_face_h is created internally and available through media face foreach function such as media_face_foreach_face_from_db(). To use this handle outside of these foreach functions, use this function.

Since :
3.0
Remarks:
The destination handle must be released with media_event_destroy() by you.
Parameters:
[in]srcThe source face handle
[out]dstA destination face handle
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
See also:
media_face_destroy()
media_face_foreach_face_from_db()
int media_face_create ( const char *  media_id,
media_face_h face 
)

Creates the face handle.

Since :
3.0
Parameters:
[in]media_idThe media uuid to create the face handle
[out]faceThe face handle
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
See also:
media_face_destroy()
int media_face_delete_from_db ( const char *  face_id)

Deletes the face with given face uuid from the media database.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/content.write
Parameters:
[in]face_idThe id of media face
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
This function requires opened connection to content service by media_content_connect().
See also:
media_content_connect()

Destroys the face handle.

Function frees all resources related to face handle. This handle no longer can be used to perform any operation. New handle has to be created before next usage.

Since :
3.0
Parameters:
[in]faceThe face handle
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
See also:
media_face_clone()
Precondition:
Get copy of face handle by calling media_face_clone() or Get face handle by calling media_info_foreach_face_from_db()
int media_face_get_face_id ( media_face_h  face,
char **  face_id 
)

Gets the face id from the face handle.

Since :
3.0
Remarks:
You must release face_id using free().
Parameters:
[in]faceThe face handle
[out]face_idThe uuid of the face handle
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
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 
)

Gets the face's rectangle from the face handle.

This API can get the face's rectangle information. returned rectangle information includes the orientation value.

Since :
3.0
Parameters:
[in]faceThe face handle
[out]rect_xThe x position of face of the face handle
[out]rect_yThe y position of face of the face handle
[out]rect_wThe width of face of the face handle
[out]rect_hThe height of face of the face handle
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
int media_face_get_media_id ( media_face_h  face,
char **  media_id 
)

Gets the media uuid from the face handle.

Since :
3.0
Remarks:
You must release media_id using free().
Parameters:
[in]faceThe face handle
[out]media_idThe media uuid of the face handle
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter

Gets the orientation from the face handle.

This API can get the orientation value from the original image.

Since :
3.0
Parameters:
[in]faceThe face handle
[out]orientationThe orientation of the face handle
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
int media_face_get_tag ( media_face_h  face,
char **  tag 
)

Gets the tag from the face handle.

Since :
3.0
Remarks:
You must release tag using free().
Parameters:
[in]faceThe face handle
[out]tagThe tag of the face handle
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter

Inserts a new face in the media database.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/content.write
Remarks:
The created tag handle must be released using media_tag_destroy().
Parameters:
[in]faceThe face handle
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
See also:
media_content_connect()
media_face_destroy()
media_face_set_xxx()
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 
)

Sets the face rectangle of the face handle.

Since :
3.0
Parameters:
[in]faceThe face handle
[in]rect_xThe integer to set as a position x of face rectangle
[in]rect_yThe integer to set as a position y of face rectangle
[in]rect_wThe integer to set as a width of face rectangle
[in]rect_hThe integer to set as a height of face rectangle
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
Postcondition:
media_face_insert_to_db()
media_face_update_to_db()

Sets the orientation of the face handle.

This API may set the value of the original image orientation.

Since :
3.0
Parameters:
[in]faceThe face handle
[in]orientationThe integer to set as an orientation
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
Postcondition:
media_face_insert_to_db()
media_face_update_to_db()
int media_face_set_tag ( media_face_h  face,
const char *  tag 
)

Sets the tag of the face handle.

Since :
3.0
Parameters:
[in]faceThe face handle
[in]tagThe tag of the face handle
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
Postcondition:
media_face_insert_to_db()
media_face_update_to_db()

Updates the face details to the media database.

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 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 the given face attributes in the media database.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/content.write
Parameters:
[in]faceThe face handle to update
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
This function requires opened connection to content service by media_content_connect().
See also:
media_content_connect()
media_face_destroy()
media_face_set_xxx()