[ACR-1226] deprecate function to remove item from db
[platform/core/api/media-content.git] / include_product / media_info_private.h
index e1f79c3..fa9a853 100755 (executable)
@@ -15,8 +15,8 @@
 */
 
 
-#ifndef __TIZEN_MEDIA_INFO_PRIVATE_H__
-#define __TIZEN_MEDIA_INFO_PRIVATE_H__
+#ifndef __TIZEN_CONTENT_MEDIA_INFO_PRIVATE_H__
+#define __TIZEN_CONTENT_MEDIA_INFO_PRIVATE_H__
 
 
 #include <unistd.h>
 #include <glib.h>
 #include <media-svc.h>
 #include <media_content_type.h>
-#include <media_content_internal.h>
 #include <dlog.h>
 #include <media-util.h>
 #include <errno.h>
 #include <tzplatform_config.h>
+#ifdef _USE_TVPD_MODE
+#include <media_content_type_product.h>
+#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -65,15 +67,18 @@ extern "C" {
 #define SQLITE3_FINALIZE(x)    {if (x != NULL) sqlite3_finalize(x); }
 #define SQLITE3_SAFE_FREE(x)   {if (x != NULL) {sqlite3_free(x); x = NULL; } }
 
-#define MEDIA_CONTENT_THUMB_DEFAULT_PATH               tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/thumb_default.png")
 #define MEDIA_CONTENT_INSERT_FILES_PATH                "/tmp"
+#define MEDIA_CONTENT_EMPTY_STRING                     ""
 
 #define MAX_QUERY_SIZE 4096
+#define MAX_PATH_LEN 4096
 #define DEFAULT_QUERY_SIZE 1024
 #define COLLATE_STR_SIZE 32
 #define MEDIA_CONTENT_UUID_SIZE        36
 #define BATCH_REQUEST_MAX 300
 
+#define EMPTY_STR ""
+
 typedef enum {
        MEDIA_INFO_UUID = 0,
        MEDIA_INFO_PATH,
@@ -131,6 +136,7 @@ typedef enum {
        MEDIA_INFO_SYNC_STATUS,
        MEDIA_INFO_STORAGE_UUID,
        MEDIA_INFO_IS_360,
+       MEDIA_INFO_STITCHED_INFO,
        MEDIA_INFO_EXTRACT_FLAG,
        MEDIA_INFO_MODIFIED_MONTH,
 #ifdef _USE_SENIOR_MODE
@@ -170,6 +176,7 @@ typedef enum {
        MEDIA_GROUP_TAG_BY_MEDIA_ID,
        MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID,
        MEDIA_GROUP_STORAGE,
+       MEDIA_GROUP_FACE,
        MEDIA_GROUP_FACE_BY_MEDIA_ID,
        MEDIA_GROUP_PVR,
        MEDIA_GROUP_UHD,
@@ -189,11 +196,12 @@ typedef struct _filter_s {
        media_content_collation_e order_collate_type;
        int offset;
        int count;
+       bool is_full_condition;
+       bool is_full_order;
 } filter_s;
 
 typedef struct {
        char *folder_id;
-       char *parent_folder_id;
        char *path;
        char *name;
        time_t modified_time;
@@ -213,6 +221,7 @@ typedef struct {
        char *media_id;
        time_t marked_time;
        char *thumbnail_path;
+       char *name;
 } media_bookmark_s;
 
 typedef struct {
@@ -236,7 +245,6 @@ typedef struct {
        char *date_taken;
        char *title;
        char *burst_id;
-       char *weather;
        char *exposure_time;
        double fnumber;
        int iso;
@@ -265,9 +273,7 @@ typedef struct {
        int duration;
        int width;
        int height;
-       int played_count;
-       time_t played_time;
-       int played_position;
+       int rotation;
 } video_meta_s;
 
 typedef struct {
@@ -287,9 +293,6 @@ typedef struct {
        int samplerate;
        int channel;
        int duration;
-       int played_count;
-       time_t played_time;
-       int played_position;
 } audio_meta_s;
 
 typedef struct {
@@ -329,6 +332,7 @@ typedef struct {
        unsigned int request_id;
        unsigned int face_request_id;
        int is_360;
+       int stitched_info;
        int extract_flag;
 #ifdef _USE_SENIOR_MODE
        char* contact;
@@ -356,14 +360,12 @@ typedef struct {
 
 typedef struct {
        char *storage_id;
-       char *storage_name;
        char *storage_path;
-       char *storage_account;
        int storage_type;
 } media_storage_s;
 
 typedef struct {
-       char *face_id;                          /* face uuid */
+       int face_id;                            /* face id */
        char *media_id;                 /* media uuid */
        unsigned int face_rect_x;       /* x position of face */
        unsigned int face_rect_y;       /* y position of face */
@@ -449,7 +451,6 @@ typedef struct {
 } media_thumbnail_cb_s;
 
 typedef struct {
-       media_info_s *handle;
        void *user_data;
        media_face_detection_completed_cb face_completed_cb;
 } media_face_cb_s;
@@ -473,6 +474,10 @@ typedef struct _media_content_cb_data {
        void *user_data;
 } media_content_scan_cb_data;
 
+typedef struct _media_content_scan_cb_data_v2 {
+       media_scan_completed_cb_v2 callback;
+       void *user_data;
+} media_content_scan_cb_data_v2;
 
 /* DB Table */
 #define DB_TABLE_MEDIA                 "media"
@@ -484,7 +489,6 @@ typedef struct _media_content_cb_data {
 #define DB_TABLE_PLAYLIST_MAP  "playlist_map"
 #define DB_TABLE_BOOKMARK              "bookmark"
 #define DB_TABLE_STORAGE               "storage"
-#define DB_TABLE_MEDIA_VIEW    "media_view"
 #define DB_TABLE_FACE                  "face"
 #define DB_TABLE_FACE_SCAN_LIST        "face_scan_list"
 #define DB_TABLE_PVR                           "pvr"
@@ -493,6 +497,7 @@ typedef struct _media_content_cb_data {
 /* DB View */
 #define DB_VIEW_PLAYLIST       "playlist_view"
 #define DB_VIEW_TAG                    "tag_view"
+#define DB_VIEW_MEDIA          "media_view"
 
 /* DB Table Alias */
 #define DB_TABLE_ALIAS_MEDIA                   "m"
@@ -502,6 +507,7 @@ typedef struct _media_content_cb_data {
 #define DB_TABLE_ALIAS_TAG                             "t"
 #define DB_TABLE_ALIAS_BOOKMARK                "b"
 #define DB_TABLE_ALIAS_ALBUM                   "a"
+#define DB_TABLE_ALIAS_FACE                            "fa"
 
 /* DB field for media */
 #define DB_FIELD_MEDIA_ID                                      "media_uuid"
@@ -577,6 +583,7 @@ typedef struct _media_content_cb_data {
 #define DB_FIELD_MEDIA_AGE_RATING_PINYIN                       "age_rating_pinyin"
 #define DB_FIELD_MEDIA_KEYWORD_PINYIN                          "keyword_pinyin"
 #define DB_FIELD_MEDIA_360                                                     "is_360"
+#define DB_FIELD_MEDIA_STITCHED_INFO                           "stitched_info"
 #ifdef _USE_SENIOR_MODE
 #define DB_FIELD_MEDIA_CONTACT                 "contact"
 #define DB_FIELD_MEDIA_APP_DATA                        "app_data"
@@ -590,7 +597,6 @@ typedef struct _media_content_cb_data {
 #define DB_FIELD_FOLDER_STORAGE_TYPE   "storage_type"
 #define DB_FIELD_FOLDER_NAME_PINYIN    "name_pinyin"
 #define DB_FIELD_FOLDER_ORDER                  "folder_order"
-#define DB_FIELD_FOLDER_PARENT_FOLDER_ID       "parent_folder_uuid"
 
 /* DB field for playlist */
 #define DB_FIELD_PLAYLIST_ID                                   "playlist_id"
@@ -606,6 +612,7 @@ typedef struct _media_content_cb_data {
 /* DB field for bookmark */
 #define DB_FIELD_BOOKMARK_ID   "bookmark_id"
 #define DB_FIELD_BOOKMARK_MARKED_TIME  "marked_time"
+#define DB_FIELD_BOOKMARK_NAME "name"
 
 /* DB field for album*/
 #define DB_FIELD_ALBUM_ID                      "album_id"
@@ -617,6 +624,7 @@ typedef struct _media_content_cb_data {
 #define DB_FIELD_STORAGE_PATH          "storage_path"
 
 /* DB field for Face */
+#define DB_FIELD_FACE_ID                               "face_id"
 #define DB_FIELD_FACE_TAG                      "face_tag"
 
 /* DB field for PVR*/
@@ -674,22 +682,20 @@ typedef struct _media_content_cb_data {
 /* DB Query Keyword */
 #define QUERY_KEYWORD_AND "AND"
 #define QUERY_KEYWORD_OR "OR"
-#define QUERY_KEYWORD_ORDER_BY "ORDER BY"
+#define QUERY_KEYWORD_ORDER_BY "ORDER BY "
 #define QUERY_KEYWORD_LIMIT "limit"
 #define QUERY_KEYWORD_DESC "DESC"
 #define QUERY_KEYWORD_SPACE " "
 #define QUERY_KEYWORD_OPEN_BRACKET "("
 #define QUERY_KEYWORD_BRACKET ")"
+#define QUERY_KEYWORD_COLLATE "COLLATE "
 
 /* DB TABLE JOIN */
 /*#define FOLDER_MEDIA_JOIN                                    "("DB_TABLE_FOLDER" AS f LEFT OUTER JOIN '%s' AS m ON f.folder_uuid=m.folder_uuid AND m.validity=1) WHERE f.storage_uuid IN (SELECT storage_uuid FROM "DB_TABLE_STORAGE" WHERE validity=1) " */
 #define FOLDER_MEDIA_JOIN                                      "("DB_TABLE_FOLDER" AS f LEFT OUTER JOIN '%s' AS m ON f.folder_uuid=m.folder_uuid AND m.validity=1) WHERE f.validity=1 "
-#define BOOKMARK_MEDIA_JOIN                            "("DB_TABLE_BOOKMARK" AS b INNER JOIN '%s' AS m \
-                                                                                       ON (b.media_uuid = m.media_uuid)) WHERE m.validity=1"
-#define ALBUM_MEDIA_JOIN                                       "("DB_TABLE_ALBUM" AS a INNER JOIN '%s' AS m \
-                                                                                       ON (a.album_id = m.album_id)) WHERE m.validity=1"
-#define FACE_MEDIA_JOIN                                                "("DB_TABLE_FACE" AS fa INNER JOIN '%s' AS m \
-                                                                                               ON (fa.media_uuid = m.media_uuid)) WHERE m.validity=1"
+#define BOOKMARK_MEDIA_JOIN                            "("DB_TABLE_BOOKMARK" AS b INNER JOIN '%s' AS m ON (b.media_uuid = m.media_uuid)) WHERE m.validity=1"
+#define ALBUM_MEDIA_JOIN                                       "("DB_TABLE_ALBUM" AS a INNER JOIN '%s' AS m ON (a.album_id = m.album_id)) WHERE m.validity=1"
+#define FACE_MEDIA_JOIN                                                "("DB_TABLE_FACE" AS fa INNER JOIN '%s' AS m ON (fa.media_uuid = m.media_uuid)) WHERE m.validity=1"
 
 /* Get Group info */
 #define SELECT_MEDIA_GROUP_AND_COUNT           "SELECT %s, COUNT(*) FROM '%s' WHERE validity=1 "
@@ -698,7 +704,7 @@ typedef struct _media_content_cb_data {
 #define SELECT_ALBUM_LIST                      "SELECT DISTINCT a.album_id, a.name, a.artist, a.album_art FROM "ALBUM_MEDIA_JOIN
 #define SELECT_MEDIA_GROUP_LIST        "SELECT DISTINCT %s FROM '%s' WHERE validity=1 "
 
-#define SELECT_FOLDER_LIST                     "SELECT DISTINCT f.folder_uuid, f.path, f.name, f.storage_type, f.modified_time, f.storage_uuid, f.folder_order, f.parent_folder_uuid FROM "FOLDER_MEDIA_JOIN
+#define SELECT_FOLDER_LIST                     "SELECT DISTINCT f.folder_uuid, f.path, f.name, f.storage_type, f.modified_time, f.storage_uuid, f.folder_order FROM "FOLDER_MEDIA_JOIN
 #define SELECT_FOLDER_LIST_BY_STORAGE_ID       SELECT_FOLDER_LIST"AND f.storage_uuid='%s' "
 #define SELECT_TAG_LIST                                "SELECT DISTINCT tag_id, name FROM "DB_VIEW_TAG" WHERE 1 "
 #define SELECT_PLAYLIST_LIST                   "SELECT DISTINCT playlist_id, name, p_thumbnail_path FROM "DB_VIEW_PLAYLIST" WHERE 1 "
@@ -742,14 +748,15 @@ typedef struct _media_content_cb_data {
 /* Get Media list of Group */
 #ifdef _USE_SENIOR_MODE
 #define MEDIA_INFO_ITEM "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, thumbnail_path, description, \
-                                                       rating, favourite, author, provider, content_name, category, location_tag, age_rating, keyword, is_drm, storage_type, longitude, latitude, altitude, exposure_time, fnumber, iso, model, width, height, datetaken, orientation, title, album, artist, album_artist, genre, composer, year, recorded_date, copyright, track_num, bitrate, bitpersample, duration, played_count, last_played_time, last_played_position, samplerate, channel, burst_id, timeline, weather, sync_status, storage_uuid, is_360, extract_flag, modified_date, contact, app_data"
+                                                       rating, favourite, author, provider, content_name, category, location_tag, age_rating, keyword, is_drm, storage_type, longitude, latitude, altitude, exposure_time, fnumber, iso, model, width, height, datetaken, orientation, title, album, artist, album_artist, genre, composer, year, recorded_date, copyright, track_num, bitrate, bitpersample, duration, played_count, last_played_time, last_played_position, samplerate, channel, burst_id, timeline, weather, sync_status, storage_uuid, is_360, stitched_info, extract_flag, modified_date, contact, app_data"
 #else
 #define MEDIA_INFO_ITEM "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, thumbnail_path, description, \
-                                                       rating, favourite, author, provider, content_name, category, location_tag, age_rating, keyword, is_drm, storage_type, longitude, latitude, altitude, exposure_time, fnumber, iso, model, width, height, datetaken, orientation, title, album, artist, album_artist, genre, composer, year, recorded_date, copyright, track_num, bitrate, bitpersample, duration, played_count, last_played_time, last_played_position, samplerate, channel, burst_id, timeline, weather, sync_status, storage_uuid, is_360, extract_flag, modified_date"
+                                                       rating, favourite, author, provider, content_name, category, location_tag, age_rating, keyword, is_drm, storage_type, longitude, latitude, altitude, exposure_time, fnumber, iso, model, width, height, datetaken, orientation, title, album, artist, album_artist, genre, composer, year, recorded_date, copyright, track_num, bitrate, bitpersample, duration, played_count, last_played_time, last_played_position, samplerate, channel, burst_id, timeline, weather, sync_status, storage_uuid, is_360, stitched_info, extract_flag, modified_date"
 #endif
 
 /*Folder info*/
 #define UPDATE_FOLDER_ORDER                                    "UPDATE "DB_TABLE_FOLDER" SET folder_order=%d WHERE folder_uuid=%Q"
+#define SELECT_FOLDER_ID_BY_PATH                               "SELECT folder_uuid FROM "DB_TABLE_FOLDER" WHERE path = '%s'"
 
 /* Playlist Info */
 #define INSERT_PLAYLIST_TO_PLAYLIST                                            "INSERT INTO "DB_TABLE_PLAYLIST" (name) VALUES (%Q)"
@@ -764,13 +771,16 @@ typedef struct _media_content_cb_data {
 #define UPDATE_PLAYLIST_ORDER_FROM_PLAYLIST_MAP                "UPDATE "DB_TABLE_PLAYLIST_MAP" SET play_order=%d WHERE playlist_id=%d AND _id=%d;"
 
 /* Bookmark */
-#define INSERT_BOOKMARK_TO_BOOKMARK                    "INSERT INTO "DB_TABLE_BOOKMARK" (media_uuid, marked_time, thumbnail_path) VALUES ('%q', '%d', %Q)"
+#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_BY_MEDIA_ID                       "SELECT b.bookmark_id, b.media_uuid, b.marked_time, b.thumbnail_path 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 UPDATE_BOOKMARK_FROM_BOOKMARK          "UPDATE "DB_TABLE_BOOKMARK" SET name=%Q WHERE bookmark_id=%d;"
 
 /* Update Meta*/
-#define UPDATE_AV_META_FROM_MEDIA      "UPDATE '%s' SET played_count=%d, last_played_time=%d, last_played_position=%d WHERE media_uuid='%q'"
-#define UPDATE_IMAGE_META_FROM_MEDIA   "UPDATE '%s' SET orientation=%d, weather=%Q WHERE media_uuid='%q'"
+#define UPDATE_IMAGE_META_FROM_MEDIA   "UPDATE '%s' SET orientation=%d WHERE media_uuid='%q'"
 
 #define UPDATE_VIDEO_MM_DATA_FROM_MEDIA                "UPDATE '%s' SET bitrate=%d, duration=%d, width=%d, height=%d WHERE media_uuid='%q'"
 #define UPDATE_AUDIO_MM_DATA_FROM_MEDIA                "UPDATE '%s' SET duration=%d, bitrate=%d, bitpersample=%d, samplerate=%d, channel=%d WHERE media_uuid='%q'"
@@ -789,28 +799,36 @@ typedef struct _media_content_cb_data {
 #define SELECT_MEDIA_FROM_STORAGE              "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND storage_uuid='%s'"
 #define SELECT_MEDIA_FROM_TAG                          "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE media_uuid IN (SELECT media_uuid FROM "DB_TABLE_TAG_MAP" WHERE tag_id=%d) AND validity=1"
 #define SELECT_MEDIA_FROM_PLAYLIST             "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE media_uuid IN (SELECT media_uuid FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d) AND validity=1"
-#define SELECT_MEDIA_PATH_BY_ID                        "SELECT path FROM "DB_TABLE_MEDIA_VIEW" WHERE media_uuid='%q'"
-#define SELECT_MEDIA_STORAGE_ID_BY_ID          "SELECT storage_uuid FROM "DB_TABLE_MEDIA_VIEW" WHERE media_uuid='%q'"
+#define SELECT_MEDIA_PATH_BY_ID                        "SELECT path FROM "DB_VIEW_MEDIA" WHERE media_uuid='%q'"
+#define SELECT_MEDIA_STORAGE_ID_BY_ID          "SELECT storage_uuid FROM "DB_VIEW_MEDIA" WHERE media_uuid='%q'"
 
 /* Delete */
-#define DELETE_MEDIA_FROM_MEDIA_BATCH  "DELETE FROM  '%s' WHERE %s"
+#define DELETE_MEDIA_FROM_MEDIA_BATCH  "DELETE FROM  '%s' WHERE %s AND storage_type = %d"
 #define DELETE_PLAYLIST_FROM_PLAYLIST          "DELETE FROM "DB_TABLE_PLAYLIST" WHERE playlist_id=%d"
 #define DELETE_TAG_FROM_TAG                            "DELETE FROM "DB_TABLE_TAG" WHERE tag_id=%d"
 #define DELETE_BOOKMARK_FROM_BOOKMARK  "DELETE FROM "DB_TABLE_BOOKMARK" WHERE bookmark_id=%d"
 
+/*For batch remove*/
+#define SELECT_STORAGE_BY_FILTER       "SELECT DISTINCT storage_uuid, storage_type FROM "DB_VIEW_MEDIA" WHERE %s"
+#define SELECT_THUMBNAIL_BY_FILTER     "SELECT DISTINCT thumbnail_path FROM '%s' WHERE %s AND storage_type = %d"
+
 /* Storage*/
 #define SELECT_STORAGE_COUNT                           "SELECT COUNT(*) FROM "DB_TABLE_STORAGE" WHERE validity=1"
-#define SELECT_STORAGE_LIST                                    "SELECT * FROM "DB_TABLE_STORAGE" WHERE validity=1"
-#define SELECT_STORAGE_INFO_FROM_STORAGE       "SELECT * FROM "DB_TABLE_STORAGE" WHERE validity=1 AND storage_uuid='%s'"
+#define SELECT_STORAGE_LIST                                    "SELECT storage_uuid, storage_path, storage_type FROM "DB_TABLE_STORAGE" WHERE validity=1"
+#define SELECT_STORAGE_INFO_FROM_STORAGE       "SELECT storage_uuid, storage_path, storage_type FROM "DB_TABLE_STORAGE" WHERE validity=1 AND storage_uuid='%s'"
 
 /* Face */
-#define DELETE_FACE_FROM_FACE                  "DELETE FROM "DB_TABLE_FACE" WHERE face_uuid='%q'"
-#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 DELETE_FACE_FROM_FACE                  "DELETE FROM "DB_TABLE_FACE" WHERE face_id=%d"
+#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, 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, face_tag=%Q WHERE 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_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_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'"
+#define SELECT_FACE_LIST                                               "SELECT fa.face_id, 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_id, 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_VIEW_MEDIA" media_uuid='%s'"
+#define UPDATE_MEDIA_INFO_IN_FACE_SCAN_LIST    "UPDATE "DB_TABLE_FACE_SCAN_LIST" SET modified_time = 0 WHERE media_uuid IN (SELECT media_uuid FROM "DB_TABLE_FACE" WHERE face_id=%d)"
+#define SELECT_FACE_ID                 "SELECT face_id FROM "DB_TABLE_FACE" WHERE media_uuid='%q' AND face_rect_x=%d AND face_rect_y=%d AND face_rect_w=%d AND face_rect_h=%d AND orientation=%d"
 
 #define DEFAULT_MEDIA_STORAGE_ID                       "media"
 
@@ -865,6 +883,7 @@ int _content_query_prepare(sqlite3_stmt **stmt, char *select_query, char *condit
 int _content_error_capi(int type, int cotent_error);
 int _content_query_sql(char *query_str);
 MediaSvcHandle* _content_get_db_handle(void);
+uid_t _content_get_uid(void);
 attribute_h _content_get_attirbute_handle(void);
 attribute_h _content_get_alias_attirbute_handle(void);
 int _media_info_get_media_info_from_db(const char *path, const char *storage_id, media_info_h media);
@@ -900,94 +919,12 @@ int _media_db_get_pvr_group_item(const char *group_name, filter_h filter, media_
 int _media_db_get_uhd(filter_h filter, media_uhd_cb callback, void *user_data);
 void _media_uhd_item_get_detail(sqlite3_stmt* stmt, media_uhd_h uhd);
 
-/**
- * @internal
- * @brief Creates a media filter attribute handle.
- * @details This function creates a media filter attribute handle. The handle can be
- * used to convert to attributes of database from attributes of user.
- * @remarks The @a handle must be released with media_filter_attribute_destory() by you.
- * @param[out] filter A handle to media filter attribute
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
- * @see media_filter_attribute_destory()
- *
- */
 int _media_filter_attribute_create(attribute_h *attr);
-
-/**
- * @internal
- * @brief Add the attributes to the handle.
- * @details This function add the attribute to handle.
- * @param[in] filter The handle to media filter attribute
- * @param[in] user_attr The user attribute
- * @param[in] platform_attr The platform attribute
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
- * @see media_filter_attribute_remove()
- *
- */
 int _media_filter_attribute_add(attribute_h atrr, const char *user_attr, const char *platform_attr);
-
-/**
- * @internal
- * @brief Destroys a media filter attribute handle.
- * @details The function frees all resources related to the media filter attribute handle. The filter attribute
- * handle no longer can be used to perform any operation. A new handle
- * has to be created before the next usage.
- *
- * @param[in] filter The handle to media filter attribute
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
- * @see media_filter_create()
- *
- */
 int _media_filter_attribute_destory(attribute_h attr);
-
-/**
- * @internal
- * @brief Replace to platform attributes from user attributes.
- * @details This function replace to platform attributes from user attributes to generate the WHERE clause
- * @param[in] filter The handle to media filter attribute
- * @param[in] user_attr The user attribute
- * @param[in] platform_attr The platform attribute
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
- * @see media_filter_attribute_create()
- * @see media_filter_attribute_destory()
- *
- */
-int _media_filter_attribute_generate(attribute_h attr, char *condition, media_content_collation_e collate_type, char **generated_condition);
-
-
-/**
- * @internal
- * @brief Replace to platform attributes from user attributes.
- * @details This function replace to platform attributes from user attributes to generate the WHERE clause
- * @param[in] filter The handle to media filter attribute
- * @param[in] attr The attribute
- * @param[in] generated_option The handle to generated option
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_CONTENT_ERROR_DB_FAILED Filed DB
- * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
- * @see media_filter_attribute_create()
- * @see media_filter_attribute_destory()
- *
- */
-
+int _media_filter_attribute_generate(attribute_h attr, filter_h filter, char **generated_condition);
 int _media_filter_attribute_option_generate(attribute_h attr, filter_h filter, char **generated_option);
+int _media_filter_attribute_option_generate_with_full_query(attribute_h attr, filter_h filter, char **generated_option);
 
 GMutex* _content_get_db_mutex(void);
 
@@ -1005,58 +942,58 @@ GMutex* _content_get_db_mutex(void);
 
 #define media_content_retv_if(expr, val) do { \
                        if (expr) { \
-                               LOGE(FONT_COLOR_RED"[%d]", media_content_gettid());    \
+                               LOGE(FONT_COLOR_RED"[%ld]"FONT_COLOR_RESET, media_content_gettid());    \
                                return (val); \
                        } \
                } while (0)
 
 #define media_content_retvm_if(expr, val, fmt, arg...) do { \
                        if (expr) { \
-                               LOGE(FONT_COLOR_RED"[%d]"fmt"", media_content_gettid(), ##arg);     \
+                               LOGE(FONT_COLOR_RED"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
                                return (val); \
                        } \
                } while (0)
 
 #define media_content_warn(fmt, arg...) do { \
-                       LOGW(FONT_COLOR_GREEN"[%d]"fmt"", media_content_gettid(), ##arg);     \
+                       LOGW(FONT_COLOR_GREEN"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
                } while (0)
 
 #define media_content_debug(fmt, arg...) do { \
-                       LOGD(FONT_COLOR_RESET"[%d]"fmt"", media_content_gettid(), ##arg);     \
+                       LOGD(FONT_COLOR_RESET"[%ld]"fmt"", media_content_gettid(), ##arg);     \
                } while (0)
 
 #define media_content_info(fmt, arg...) do { \
-                       LOGI(FONT_COLOR_GREEN"[%d]"fmt"", media_content_gettid(), ##arg);     \
+                       LOGI(FONT_COLOR_GREEN"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
                } while (0)
 
 #define media_content_error(fmt, arg...) do { \
-                       LOGE(FONT_COLOR_RED"[%d]"fmt"", media_content_gettid(), ##arg);     \
+                       LOGE(FONT_COLOR_RED"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
                } while (0)
 
 #define media_content_debug_func() do { \
-                       LOGD(FONT_COLOR_RESET"[%d]", media_content_gettid());     \
+                       LOGD(FONT_COLOR_RESET"[%ld]", media_content_gettid());     \
                } while (0)
 
 #define media_content_sec_debug(fmt, arg...) do { \
-                       SECURE_LOGD(FONT_COLOR_RESET"[%d]"fmt"", media_content_gettid(), ##arg);     \
+                       SECURE_LOGD(FONT_COLOR_CYAN"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
                } while (0)
 
 #define media_content_sec_warn(fmt, arg...) do { \
-                       SECURE_LOGW(FONT_COLOR_GREEN"[%d]"fmt"", media_content_gettid(), ##arg);     \
+                       SECURE_LOGW(FONT_COLOR_RED"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
                } while (0)
 
 #define media_content_sec_error(fmt, arg...) do { \
-                       SECURE_LOGE(FONT_COLOR_RED"[%d]"fmt"", media_content_gettid(), ##arg);     \
+                       SECURE_LOGE(FONT_COLOR_RED"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg);     \
                } while (0)
 
 #define ERR_BUF_LENGTH 256
 #define media_content_stderror(fmt) do { \
                        char media_content_stderror_buf[ERR_BUF_LENGTH] = {0, }; \
                        strerror_r(errno, media_content_stderror_buf, ERR_BUF_LENGTH);  \
-                       LOGE(FONT_COLOR_RED fmt" : STANDARD ERROR [%s]", media_content_stderror_buf); \
+                       LOGE(FONT_COLOR_RED fmt" : STANDARD ERROR [%s]"FONT_COLOR_RESET, media_content_stderror_buf); \
                } while (0)
 
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
-#endif /*__TIZEN_MEDIA_INFO_PRIVATE_H__*/
+#endif /*__TIZEN_CONTENT_MEDIA_INFO_PRIVATE_H__*/