*/
-#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>
*
* @file media_info_private.h
* @brief This file contains the media info API and related structure and enumeration. \n
-* Description of the audio, video,image content involves: album, artist, album_artist, author, genre and description tags. \n
+* Description of the audio, video,image content involves: album, artist, album_artist, genre and description tags. \n
* Parameters of the recording are also supported, as: format, bitrate, duration, size etc. \n
* Defenitions of media DB fields and tables, operations with media data relating to DB and handling with media filter attributes.
*/
MEDIA_INFO_DESCRIPTION,
MEDIA_INFO_RATING,
MEDIA_INFO_FAVOURITE,
- MEDIA_INFO_AUTHOR,
- MEDIA_INFO_PROVIDER,
- MEDIA_INFO_CONTENT_NAME,
- MEDIA_INFO_CATEGORY,
- MEDIA_INFO_LOCATION_TAG,
- MEDIA_INFO_AGE_RATING,
- MEDIA_INFO_KEYWORD,
MEDIA_INFO_IS_DRM,
MEDIA_INFO_STORAGE_TYPE,
MEDIA_INFO_LONGITUDE,
MEDIA_INFO_BITRATE,
MEDIA_INFO_BITPERSAMPLE,
MEDIA_INFO_DURATION,
- MEDIA_INFO_PLAYED_COUNT,
- MEDIA_INFO_LAST_PLAYED_TIME,
- MEDIA_INFO_LAST_PLAYED_POSITION,
MEDIA_INFO_SAMPLERATE,
MEDIA_INFO_CHANNEL,
- MEDIA_INFO_BURST_ID,
MEDIA_INFO_TIMELINE,
- MEDIA_INFO_WEATHER,
MEDIA_INFO_SYNC_STATUS,
MEDIA_INFO_STORAGE_UUID,
MEDIA_INFO_IS_360,
MEDIA_GROUP_FACE_BY_MEDIA_ID,
} group_list_e;
-typedef enum {
- MEDIA_BATCH_INSERT_NORMAL,
- MEDIA_BATCH_INSERT_BURSTSHOT,
-} media_batch_insert_e;
-
typedef struct _filter_s {
char *storage_id;
char *condition;
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;
media_content_storage_e storage_type;
char *storage_uuid;
- int folder_order;
} media_folder_s;
typedef struct {
int height;
char *date_taken;
char *title;
- char *burst_id;
- char *weather;
char *exposure_time;
double fnumber;
int iso;
int duration;
int width;
int height;
- int played_count;
int rotation;
- time_t played_time;
- int played_position;
} video_meta_s;
typedef struct {
int samplerate;
int channel;
int duration;
- int played_count;
- time_t played_time;
- int played_position;
} audio_meta_s;
typedef struct {
double longitude;
double latitude;
double altitude;
- char *weather;
int rating;
time_t favourite;
char *title;
- char *author;
- char *provider;
- char *content_name;
- char *category;
- char *location_tag;
- char *age_rating;
- char *keyword;
int is_drm;
int storage_type;
- int played_count;
- time_t played_time;
- int played_position;
char *storage_uuid;
int sync_status;
unsigned int request_id;
typedef struct {
char *storage_id;
- char *storage_name;
char *storage_path;
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 */
} 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;
#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"
/* 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"
#define DB_TABLE_ALIAS_FOLDER "f"
-#define DB_TABLE_ALIAS_PLAYLIST "p"
-#define DB_TABLE_ALIAS_PLAYLIST_MAP "pm"
-#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"
#define DB_FIELD_MEDIA_HEIGHT "height"
#define DB_FIELD_MEDIA_DATETAKEN "datetaken"
#define DB_FIELD_MEDIA_ORIENTATION "orientation"
-#define DB_FIELD_MEDIA_BURST_ID "burst_id"
-#define DB_FIELD_MEDIA_PLAYED_COUNT "played_count"
-#define DB_FIELD_MEDIA_LAST_PLAYED_TIME "last_played_time"
-#define DB_FIELD_MEDIA_LAST_PLAYED_POSITION "last_played_position"
#define DB_FIELD_MEDIA_RATING "rating"
#define DB_FIELD_MEDIA_FAVOURITE "favourite"
-#define DB_FIELD_MEDIA_AUTHOR "author"
-#define DB_FIELD_MEDIA_PROVIDER "provider"
-#define DB_FIELD_MEDIA_CONTENT_NAME "content_name"
-#define DB_FIELD_MEDIA_CATEGORY "category"
-#define DB_FIELD_MEDIA_LOCATION_TAG "location_tag"
-#define DB_FIELD_MEDIA_AGE_RATING "age_rating"
-#define DB_FIELD_MEDIA_KEYWORD "keyword"
-#define DB_FIELD_MEDIA_WEATHER "weather"
#define DB_FIELD_MEDIA_IS_DRM "is_drm"
#define DB_FIELD_MEDIA_STORAGE_TYPE "storage_type"
-#define DB_FIELD_MEDIA_EXPOSURE_TIME "exposure_time"
-#define DB_FIELD_MEDIA_FNUMBER "fnumber"
-#define DB_FIELD_MEDIA_ISO "iso"
-#define DB_FIELD_MEDIA_MODEL "model"
+
#define DB_FIELD_MEDIA_FILE_NAME_PINYIN "file_name_pinyin"
#define DB_FIELD_MEDIA_TITLE_PINYIN "title_pinyin"
#define DB_FIELD_MEDIA_ALBUM_PINYIN "album_pinyin"
#define DB_FIELD_MEDIA_COMPOSER_PINYIN "composer_pinyin"
#define DB_FIELD_MEDIA_COPYRIGHT_PINYIN "copyright_pinyin"
#define DB_FIELD_MEDIA_DESCRIPTION_PINYIN "description_pinyin"
-#define DB_FIELD_MEDIA_AUTHOR_PINYIN "author_pinyin"
-#define DB_FIELD_MEDIA_PROVIDER_PINYIN "provider_pinyin"
-#define DB_FIELD_MEDIA_CONTENT_NAME_PINYIN "content_name_pinyin"
-#define DB_FIELD_MEDIA_CATEGORY_PINYIN "category_pinyin"
-#define DB_FIELD_MEDIA_LOCATION_TAG_PINYIN "location_tag_pinyin"
-#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"
/* DB field for folder */
#define DB_FIELD_FOLDER_ID "folder_uuid"
#define DB_FIELD_FOLDER_PATH "path"
#define DB_FIELD_FOLDER_NAME "name"
-#define DB_FIELD_FOLDER_MODIFIED_TIME "modified_time"
#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"
#define DB_FIELD_TAG_NAME "name"
#define DB_FIELD_TAG_MEDIA_COUNT "media_count"
-/* 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"
-#define DB_FIELD_ALBUM_NAME "name"
-#define DB_FIELD_ALBUM_ARTIST "artist"
-
/* DB field for Storage*/
#define DB_FIELD_STORAGE_ID "storage_uuid"
#define DB_FIELD_STORAGE_PATH "storage_path"
-/* DB field for Face */
-#define DB_FIELD_FACE_ID "face_uuid"
-#define DB_FIELD_FACE_TAG "face_tag"
-
/* 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 validity=1"
+#define ALBUM_MEDIA_JOIN DB_TABLE_ALBUM" NATURAL JOIN '%s' WHERE validity=1"
+#define FACE_MEDIA_JOIN "("DB_TABLE_FACE" AS fa INNER JOIN '%s' AS m ON (fa.media_uuid = m.media_uuid)) WHERE validity=1"
/* Get Group List */
-#define SELECT_ALBUM_LIST "SELECT DISTINCT a.album_id, a.name, a.artist, a.album_art FROM "ALBUM_MEDIA_JOIN
+#define SELECT_ALBUM_LIST "SELECT DISTINCT album_id, name, artist, 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.storage_uuid 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 "
/* Get Group Count */
-#define SELECT_ALBUM_COUNT "SELECT COUNT(DISTINCT a.album_id) FROM "ALBUM_MEDIA_JOIN
+#define SELECT_ALBUM_COUNT "SELECT COUNT(DISTINCT album_id) FROM "ALBUM_MEDIA_JOIN
#define SELECT_FOLDER_COUNT "SELECT COUNT(DISTINCT f.folder_uuid) FROM "FOLDER_MEDIA_JOIN
#define SELECT_FOLDER_COUNT_BY_STORAGE_ID SELECT_FOLDER_COUNT"AND f.storage_uuid='%s' "
#define SELECT_TAG_COUNT "SELECT COUNT(DISTINCT tag_id) FROM "DB_VIEW_TAG" WHERE 1 "
#define SELECT_PLAYLIST_COUNT "SELECT COUNT(DISTINCT playlist_id) FROM "DB_VIEW_PLAYLIST" WHERE 1 "
-#define SELECT_BOOKMARK_COUNT "SELECT COUNT(DISTINCT b.bookmark_id) FROM "BOOKMARK_MEDIA_JOIN
+#define SELECT_BOOKMARK_COUNT "SELECT COUNT(*) FROM "BOOKMARK_MEDIA_JOIN
#define SELECT_MEDIA_GROUP_COUNT "SELECT COUNT(*) FROM ("SELECT_MEDIA_GROUP_LIST
/*count(distinct x) count only non-null values, but select distinct X returns include null. so sync the result of count and list, don't use count(distinct x)*/
/* Get Group Info by Group ID*/
#define SELECT_ALBUM_FROM_ALBUM "SELECT * FROM "DB_TABLE_ALBUM" WHERE album_id=%d"
-#define SELECT_FOLDER_FROM_FOLDER "SELECT * FROM "DB_TABLE_FOLDER" WHERE folder_uuid='%s'"
-#define SELECT_FOLDER_BY_PATH "SELECT * FROM "DB_TABLE_FOLDER" WHERE path='%q'"
-#define SELECT_PLAYLIST_FROM_PLAYLIST "SELECT * FROM "DB_TABLE_PLAYLIST" WHERE playlist_id=%d"
-#define SELECT_TAG_FROM_TAG "SELECT * FROM "DB_TABLE_TAG" WHERE tag_id=%d"
-#define SELECT_TAG_BY_NAME "SELECT * FROM "DB_TABLE_TAG" WHERE name='%q'"
+#define SELECT_FOLDER_FROM_FOLDER "SELECT folder_uuid, path, name, storage_type, storage_uuid FROM "DB_TABLE_FOLDER" WHERE folder_uuid='%s'"
+#define SELECT_PLAYLIST_FROM_PLAYLIST "SELECT name, thumbnail_path FROM "DB_TABLE_PLAYLIST" WHERE playlist_id=%d"
+#define SELECT_TAG_FROM_TAG "SELECT name FROM "DB_TABLE_TAG" WHERE tag_id=%d"
+#define SELECT_TAG_BY_NAME "SELECT tag_id FROM "DB_TABLE_TAG" WHERE name='%q'"
/* Tag info*/
#define INSERT_TAG_TO_TAG "INSERT INTO "DB_TABLE_TAG" (name) VALUES (%Q)"
/* Get Media list of Group */
#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"
-
-/*Folder info*/
-#define UPDATE_FOLDER_ORDER "UPDATE "DB_TABLE_FOLDER" SET folder_order=%d WHERE folder_uuid=%Q"
+ rating, favourite, 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, samplerate, channel, \
+ timeline, sync_status, storage_uuid, is_360"
/* Playlist Info */
#define INSERT_PLAYLIST_TO_PLAYLIST "INSERT INTO "DB_TABLE_PLAYLIST" (name) VALUES (%Q)"
#define UPDATE_PLAYLIST_NAME_FROM_PLAYLIST "UPDATE "DB_TABLE_PLAYLIST" SET name='%q' WHERE playlist_id=%d;"
#define UPDATE_PLAYLIST_THUMBNAIL_FROM_PLAYLIST "UPDATE "DB_TABLE_PLAYLIST" SET thumbnail_path='%q' WHERE playlist_id=%d;"
#define SELECT_PLAYLIST_ID_FROM_PLAYLIST "SELECT playlist_id FROM "DB_TABLE_PLAYLIST" WHERE name='%q'"
-#define SELECT_PLAYLIST_ITEM_ID_FROM_PLAYLIST_VIEW "SELECT pm_id, media_uuid FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and media_count>0) "
#define SELECT_PLAYLIST_ITEM_ALL_FROM_PLAYLIST_VIEW "SELECT "MEDIA_INFO_ITEM", pm_id FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and media_count>0) "
#define SELECT_PLAY_ORDER_FROM_PLAYLIST_VIEW "SELECT play_order FROM "DB_VIEW_PLAYLIST" WHERE playlist_id=%d and pm_id=%d"
#define SELECT_MAX_PLAY_ORDER_FROM_PLAYLIST_VIEW "SELECT MAX(play_order) FROM "DB_VIEW_PLAYLIST" WHERE playlist_id=%d"
#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, name) VALUES ('%q', '%d', %Q, %Q)"
+#define INSERT_BOOKMARK_TO_BOOKMARK "INSERT INTO "DB_TABLE_BOOKMARK" (media_uuid, bookmark_marked_time, thumbnail_path, bookmark_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 SELECT_BOOKMARK_LIST "SELECT bookmark_id, b.media_uuid, bookmark_marked_time, b.thumbnail_path, bookmark_name FROM "BOOKMARK_MEDIA_JOIN
+#define SELECT_BOOKMARK_LIST_BY_MEDIA_ID "SELECT bookmark_id, b.media_uuid, bookmark_marked_time, b.thumbnail_path, bookmark_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 bookmark_marked_time=%d"
-#define UPDATE_BOOKMARK_FROM_BOOKMARK "UPDATE "DB_TABLE_BOOKMARK" SET name=%Q WHERE bookmark_id=%d;"
+#define UPDATE_BOOKMARK_FROM_BOOKMARK "UPDATE "DB_TABLE_BOOKMARK" SET bookmark_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 SELECT_MEDIA_ITEM "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1"
#define SELECT_MEDIA_FROM_MEDIA "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND media_uuid='%s'"
#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_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"
/* 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 media_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, 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_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'"
-
-#define DEFAULT_MEDIA_STORAGE_ID "media"
+#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
+#define SELECT_FACE_LIST_BY_MEDIA_ID "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" AND fa.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 media_face_id=%d)"
+#define SELECT_FACE_ID "SELECT media_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"
int _content_query_prepare(sqlite3_stmt **stmt, char *select_query, char *condition_query, char *option_query);
int _content_error_capi(int type, int cotent_error);
int _content_query_sql(char *query_str);
-MediaSvcHandle* _content_get_db_handle(void);
+sqlite3 * _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);
int _media_db_get_storage(filter_h filter, media_storage_cb callback, void *user_data);
int _media_db_get_storage_id_by_media_id(const char *media_id, char *storage_id);
-/**
- * @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);
+
#define FONT_COLOR_RESET "\033[0m"
#define FONT_COLOR_RED "\033[31m"
#define media_content_retv_if(expr, val) do { \
if (expr) { \
- LOGE(FONT_COLOR_RED"[%d]"FONT_COLOR_RESET, 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""FONT_COLOR_RESET, 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""FONT_COLOR_RESET, 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""FONT_COLOR_RESET, 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""FONT_COLOR_RESET, 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_CYAN"[%d]"fmt""FONT_COLOR_RESET, 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_RED"[%d]"fmt""FONT_COLOR_RESET, 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""FONT_COLOR_RESET, 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
#ifdef __cplusplus
}
#endif /* __cplusplus */
-#endif /*__TIZEN_MEDIA_INFO_PRIVATE_H__*/
+#endif /*__TIZEN_CONTENT_MEDIA_INFO_PRIVATE_H__*/