MEDIA_GROUP_TAG_BY_MEDIA_ID,
MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID,
MEDIA_GROUP_STORAGE,
+ MEDIA_GROUP_FACE,
MEDIA_GROUP_FACE_BY_MEDIA_ID,
} group_list_e;
/* Bookmark */
#define INSERT_BOOKMARK_TO_BOOKMARK "INSERT INTO "DB_TABLE_BOOKMARK" (media_uuid, marked_time, thumbnail_path, name) VALUES ('%q', '%d', %Q, %Q)"
#define SELECT_BOOKMARK_COUNT_BY_MEDIA_ID "SELECT COUNT(*) FROM "BOOKMARK_MEDIA_JOIN" AND b.media_uuid='%s'"
+#define SELECT_BOOKMARK_LIST "SELECT b.bookmark_id, b.media_uuid, b.marked_time, b.thumbnail_path, b.name FROM "BOOKMARK_MEDIA_JOIN
#define SELECT_BOOKMARK_LIST_BY_MEDIA_ID "SELECT b.bookmark_id, b.media_uuid, b.marked_time, b.thumbnail_path, b.name FROM "BOOKMARK_MEDIA_JOIN" AND b.media_uuid='%s'"
#define SELECT_BOOKMARK_ID_FROM_BOOKMARK "SELECT bookmark_id FROM "DB_TABLE_BOOKMARK" WHERE media_uuid='%s' AND marked_time=%d"
#define INSERT_FACE_TO_FACE "INSERT INTO "DB_TABLE_FACE" (face_uuid, media_uuid, face_rect_x , face_rect_y, face_rect_w, face_rect_h, orientation, face_tag) VALUES ('%q', '%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, face_tag=%Q WHERE face_uuid='%q'"
#define SELECT_MEDIA_COUNT_FROM_MEDIA_BY_ID "SELECT COUNT(*) FROM "DB_TABLE_MEDIA_VIEW" WHERE media_uuid='%q' 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 fa.face_uuid, fa.media_uuid, fa.face_rect_x, fa.face_rect_y, fa.face_rect_w, fa.face_rect_h, fa.orientation, fa.face_tag FROM "FACE_MEDIA_JOIN
#define SELECT_FACE_LIST_BY_MEDIA_ID "SELECT fa.face_uuid, fa.media_uuid, fa.face_rect_x, fa.face_rect_y, fa.face_rect_w, fa.face_rect_h, fa.orientation, fa.face_tag FROM "FACE_MEDIA_JOIN" AND fa.media_uuid='%s'"
#define SELECT_FACE_PATH_FROM_MEDIA "SELECT path FROM "DB_TABLE_MEDIA_VIEW" media_uuid='%s'"
case MEDIA_GROUP_NONE:
case MEDIA_GROUP_TAG_BY_MEDIA_ID:
case MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID:
+ case MEDIA_GROUP_FACE_BY_MEDIA_ID:
{
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
}
break;
+ case MEDIA_GROUP_FACE:
+ attr = _content_get_alias_attirbute_handle();
+
+ if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
+ snprintf(select_query, sizeof(select_query), SELECT_FACE_COUNT, _filter->storage_id);
+ else
+ snprintf(select_query, sizeof(select_query), SELECT_FACE_COUNT, DB_TABLE_MEDIA_VIEW);
+ break;
#ifdef _USE_TV_PROFILE
case MEDIA_GROUP_PVR:
case MEDIA_GROUP_UHD:
attribute_h attr = NULL;
filter_s *_filter = (filter_s*)filter;
- attr = _content_get_attirbute_handle();
+ attr = _content_get_alias_attirbute_handle();
memset(select_query, 0x00, sizeof(select_query));
- if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
- snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST_BY_MEDIA_ID, _filter->storage_id, media_id);
- else
- snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST_BY_MEDIA_ID, DB_TABLE_MEDIA_VIEW, media_id);
+ if (STRING_VALID(media_id)) { //get bookmark by media_id
+ if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
+ snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST_BY_MEDIA_ID, _filter->storage_id, media_id);
+ else
+ snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST_BY_MEDIA_ID, DB_TABLE_MEDIA_VIEW, media_id);
+ } else {
+ if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
+ snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST, _filter->storage_id);
+ else
+ snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST, DB_TABLE_MEDIA_VIEW);
+ }
ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
attribute_h attr = NULL;
filter_s *_filter = (filter_s*)filter;
- attr = _content_get_attirbute_handle();
+ attr = _content_get_alias_attirbute_handle();
memset(select_query, 0x00, sizeof(select_query));
- if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
- snprintf(select_query, sizeof(select_query), SELECT_FACE_LIST_BY_MEDIA_ID, _filter->storage_id, media_id);
- else
- snprintf(select_query, sizeof(select_query), SELECT_FACE_LIST_BY_MEDIA_ID, DB_TABLE_MEDIA_VIEW, media_id);
+ if (STRING_VALID(media_id)) { //get face by media_id
+ if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
+ snprintf(select_query, sizeof(select_query), SELECT_FACE_LIST_BY_MEDIA_ID, _filter->storage_id, media_id);
+ else
+ snprintf(select_query, sizeof(select_query), SELECT_FACE_LIST_BY_MEDIA_ID, DB_TABLE_MEDIA_VIEW, media_id);
+ } else {
+ if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
+ snprintf(select_query, sizeof(select_query), SELECT_FACE_LIST, _filter->storage_id);
+ else
+ snprintf(select_query, sizeof(select_query), SELECT_FACE_LIST, DB_TABLE_MEDIA_VIEW);
+ }
ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
return ret;
}
+
+int media_face_get_face_count_from_db(filter_h filter, int *face_count)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ if (face_count == NULL) {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = _media_db_get_group_count(filter, MEDIA_GROUP_FACE, face_count);
+
+ return ret;
+}
+
+int media_face_foreach_face_from_db(filter_h filter, media_face_cb callback, void *user_data)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ media_content_retvm_if(callback == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid paramter");
+
+ ret = _media_db_get_face(NULL, filter, callback, user_data);
+
+ return ret;
+}