Tizen Native API  7.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 media face handle.
int media_face_destroy (media_face_h face)
 Destroys the media face handle.
int media_face_get_face_id (media_face_h face, char **face_id)
 Gets the face id from the media face handle.
int media_face_get_media_id (media_face_h face, char **media_id)
 Gets the media id from the media 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 media face handle.
int media_face_get_orientation (media_face_h face, media_content_orientation_e *orientation)
 Gets the orientation from the media face handle.
int media_face_get_tag (media_face_h face, char **tag)
 Gets the tag from the media face handle.
int media_face_create (const char *media_id, media_face_h *face)
 Creates the media 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 media face handle.
int media_face_set_orientation (media_face_h face, media_content_orientation_e orientation)
 Sets the orientation of the media face handle.
int media_face_set_tag (media_face_h face, const char *tag)
 Sets the tag of the media 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 id from the media database.
int media_face_get_face_count_from_db (filter_h filter, int *face_count)
 Gets the number of media faces with an optional filter from the media database.
int media_face_foreach_face_from_db (filter_h filter, media_face_cb callback, void *user_data)
 Iterates through the faces with an optional filter 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.

Iterates over a media face list.

Since :
3.0
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 media face handle.

This function copies the media 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 dst should be released using media_face_destroy().
Parameters:
[out]dstThe destination handle to the media face
[in]srcThe source handle to the 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_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 media face handle.

Since :
3.0
Remarks:
The face should be released using media_face_destroy().
Since 5.5, this function supports only image type.
Parameters:
[in]media_idThe media ID
[out]faceThe media 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 id from the media database.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/content.write
Parameters:
[in]face_idThe ID of the 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
MEDIA_CONTENT_ERROR_INVALID_OPERATIONInvalid operation
MEDIA_CONTENT_ERROR_DB_FAILEDDB Operation failed
MEDIA_CONTENT_ERROR_DB_BUSYDB Operation busy
MEDIA_CONTENT_ERROR_NETWORKNetwork fail
Precondition:
This function requires opened connection to content service by media_content_connect().
See also:
media_content_connect()

Destroys the media face handle.

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

Since :
3.0
Parameters:
[in]faceThe media face handle
Returns:
0 on success, otherwise a negative error value.
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
Precondition:
Get copy of media face handle by calling media_face_clone() or Get media face handle by calling media_info_foreach_face_from_db()
See also:
media_face_clone()
int media_face_foreach_face_from_db ( filter_h  filter,
media_face_cb  callback,
void *  user_data 
)

Iterates through the faces with an optional filter from the media database.

This function gets all faces associated with the given filter and calls callback for every retrieved media face. If NULL is passed to the filter, then no filtering is applied.

Since :
4.0
Parameters:
[in]filterThe handle to the media filter
[in]callbackThe callback function to be invoked
[in]user_dataThe user data to be passed to the callback function
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_DB_FAILEDDB Operation failed
MEDIA_CONTENT_ERROR_DB_BUSYDB Operation busy
Precondition:
This function requires opened connection to content service by media_content_connect().
Postcondition:
This function invokes media_face_cb().
See also:
media_content_connect()
media_face_cb()
media_filter_create()
int media_face_get_face_count_from_db ( filter_h  filter,
int *  face_count 
)

Gets the number of media faces with an optional filter from the media database.

Since :
4.0
Parameters:
[in]filterThe handle to the media filter
[out]face_countThe count of the media faces
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_DB_FAILEDDB Operation failed
MEDIA_CONTENT_ERROR_DB_BUSYDB Operation busy
Precondition:
This function requires opened connection to content service by media_content_connect().
See also:
media_content_connect()
media_filter_create()
int media_face_get_face_id ( media_face_h  face,
char **  face_id 
)

Gets the face id from the media face handle.

Since :
3.0
Remarks:
The face_id should be released using free().
Parameters:
[in]faceThe media face handle
[out]face_idThe ID of the media face
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 media face handle.

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

Since :
3.0
Parameters:
[in]faceThe media face handle
[out]rect_xThe x position of the media face
[out]rect_yThe y position of the media face
[out]rect_wThe width of the media face
[out]rect_hThe height of the media face
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 id from the media face handle.

Since :
3.0
Remarks:
The media_id should be released using free().
Parameters:
[in]faceThe media face handle
[out]media_idThe media ID
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 media face handle.

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

Since :
3.0
Parameters:
[in]faceThe media face handle
[out]orientationThe orientation of the media face
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 media face handle.

Since :
3.0
Remarks:
The tag should be released using free().
Parameters:
[in]faceThe media face handle
[out]tagThe tag of the media face
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 face should be released using media_face_destroy().
Parameters:
[in]faceThe media 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
MEDIA_CONTENT_ERROR_INVALID_OPERATIONInvalid operation
MEDIA_CONTENT_ERROR_DB_FAILEDDB Operation failed
MEDIA_CONTENT_ERROR_DB_BUSYDB Operation busy
MEDIA_CONTENT_ERROR_NETWORKNetwork fail
See also:
media_content_connect()
media_face_destroy()
media_face_set_face_rect()
media_face_set_orientation()
media_face_set_tag()
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 media face handle.

Since :
3.0
Parameters:
[in]faceThe media 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
Postcondition:
media_face_insert_to_db()
media_face_update_to_db()

Sets the orientation of the media face handle.

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

Since :
3.0
Parameters:
[in]faceThe media 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
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 media face handle.

Since :
3.0
Parameters:
[in]faceThe media face handle
[in]tagThe tag of the 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_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 media 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
MEDIA_CONTENT_ERROR_INVALID_OPERATIONInvalid operation
MEDIA_CONTENT_ERROR_DB_FAILEDDB Operation failed
MEDIA_CONTENT_ERROR_DB_BUSYDB Operation busy
MEDIA_CONTENT_ERROR_NETWORKNetwork fail
Precondition:
This function requires opened connection to content service by media_content_connect().
See also:
media_content_connect()
media_face_destroy()
media_face_set_face_rect()
media_face_set_orientation()
media_face_set_tag()