*
* @since_tizen 3.0
*
- * @remarks The @a face should be released using media_face_destroy().
+ * @remarks The @a face should be released using media_face_destroy(). \n
+ * Since 5.5, this function supports only image type.
*
* @param[in] media_id The media ID
* @param[out] face The media face handle
* %http://tizen.org/privilege/externalstorage
*
* @remarks If you want to destroy the media handle before callback invoked, you must cancel the face detection request by using media_info_cancel_face_detection(). \n
- * If face detection fails, the face_count argument in media_face_detection_completed_cb() will be set to 0.
- * Media items in external storage are not supported, with the exception of MMC items.
+ * If face detection fails, the face_count argument in media_face_detection_completed_cb() will be set to 0. \n
+ * Media items in external storage are not supported, with the exception of MMC items. \n
+ * Since 5.5, if the format is unsupported, this function returns an error and callback will not be invoked.
*
* @param[in] media The handle to the media info
* @param[in] callback The callback function to be invoked when detection is completed
#define INSERT_FACE_TO_FACE "INSERT INTO "DB_TABLE_FACE" (media_uuid, face_rect_x , face_rect_y, face_rect_w, face_rect_h, orientation, media_face_tag) VALUES ('%q', %d, %d, %d, %d, %d, %Q);"
#define UPDATE_FACE_TO_FACE "UPDATE "DB_TABLE_FACE" SET face_rect_x=%d, face_rect_y=%d, face_rect_w=%d, face_rect_h=%d, orientation=%d, media_face_tag=%Q WHERE media_face_id=%d"
#define SELECT_MEDIA_COUNT_FROM_MEDIA_BY_ID "SELECT COUNT(*) FROM "DB_VIEW_MEDIA" WHERE media_uuid='%q' AND validity=1"
+#define SELECT_IMAGE_COUNT_FROM_MEDIA_BY_ID "SELECT COUNT(*) FROM "DB_VIEW_MEDIA" WHERE media_uuid='%q' AND media_type=0 AND validity=1"
#define SELECT_FACE_COUNT "SELECT COUNT(*) FROM "FACE_MEDIA_JOIN
#define SELECT_FACE_COUNT_BY_MEDIA_ID "SELECT COUNT(*) FROM "FACE_MEDIA_JOIN" AND fa.media_uuid='%s'"
#define SELECT_FACE_LIST "SELECT media_face_id, fa.media_uuid, face_rect_x, face_rect_y, face_rect_w, face_rect_h, fa.orientation, media_face_tag FROM "FACE_MEDIA_JOIN
*
* @since_tizen 3.0
*
- * @remarks The @a face should be released using media_face_destroy().
+ * @remarks The @a face should be released using media_face_destroy(). \n
+ * Since 5.5, this function supports only image type.
*
* @param[in] media_id The media ID
* @param[out] face The media face handle
* %http://tizen.org/privilege/externalstorage
*
* @remarks If you want to destroy the media handle before callback invoked, you must cancel the face detection request by using media_info_cancel_face_detection(). \n
- * If face detection fails, the face_count argument in media_face_detection_completed_cb() will be set to 0.
- * Media items in external storage are not supported, with the exception of MMC items.
+ * If face detection fails, the face_count argument in media_face_detection_completed_cb() will be set to 0. \n
+ * Media items in external storage are not supported, with the exception of MMC items. \n
+ * Since 5.5, if the format is unsupported, this function returns an error and callback will not be invoked.
*
* @param[in] media The handle to the media info
* @param[in] callback The callback function to be invoked when detection is completed
#define INSERT_FACE_TO_FACE "INSERT INTO "DB_TABLE_FACE" (media_uuid, face_rect_x , face_rect_y, face_rect_w, face_rect_h, orientation, media_face_tag) VALUES ('%q', %d, %d, %d, %d, %d, %Q);"
#define UPDATE_FACE_TO_FACE "UPDATE "DB_TABLE_FACE" SET face_rect_x=%d, face_rect_y=%d, face_rect_w=%d, face_rect_h=%d, orientation=%d, media_face_tag=%Q WHERE media_face_id=%d"
#define SELECT_MEDIA_COUNT_FROM_MEDIA_BY_ID "SELECT COUNT(*) FROM "DB_VIEW_MEDIA" WHERE media_uuid='%q' AND validity=1"
+#define SELECT_IMAGE_COUNT_FROM_MEDIA_BY_ID "SELECT COUNT(*) FROM "DB_VIEW_MEDIA" WHERE media_uuid='%q' AND media_type=0 AND validity=1"
#define SELECT_FACE_COUNT "SELECT COUNT(*) FROM "FACE_MEDIA_JOIN
#define SELECT_FACE_COUNT_BY_MEDIA_ID "SELECT COUNT(*) FROM "FACE_MEDIA_JOIN" AND fa.media_uuid='%s'"
#define SELECT_FACE_LIST "SELECT media_face_id, fa.media_uuid, face_rect_x, face_rect_y, face_rect_w, face_rect_h, fa.orientation, media_face_tag FROM "FACE_MEDIA_JOIN
media_content_retvm_if(!STRING_VALID(media_id), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid media_id");
- query_str = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_MEDIA_BY_ID, media_id);
+ /* Get image count */
+ query_str = sqlite3_mprintf(SELECT_IMAGE_COUNT_FROM_MEDIA_BY_ID, media_id);
ret = _content_query_prepare(&stmt, query_str, NULL, NULL);
SQLITE3_SAFE_FREE(query_str);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
media_content_retvm_if(face == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid handle");
ret = __media_face_check_media_id(media_id);
- media_content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Not exist media_id");
+ media_content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "media_id does not exist or is not an image");
media_face_s* _face = calloc(1, sizeof(media_face_s));
media_content_retvm_if(_face == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "Out of memory");
}
if (_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path)) {
+ if (g_strcmp0(_media->mime_type, "image/jpeg") != 0 && g_strcmp0(_media->mime_type, "image/png") != 0 && g_strcmp0(_media->mime_type, "image/bmp") != 0) {
+ media_content_error("Unsupported mime type");
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
memset(repl_path, 0, sizeof(repl_path));
ret = _media_content_replace_path(_media->file_path, repl_path);
media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");