*/
-#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 <media_content_type.h>
#include <dlog.h>
#include <media-util.h>
+#include <errno.h>
#include <tzplatform_config.h>
#ifdef __cplusplus
*
* @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.
*/
#define SAFE_STRLCPY(dst, src, n) ((g_strlcpy(dst, src, n) < n) ? TRUE : FALSE)
#define SAFE_STRLCAT(dst, src, n) g_strlcat(dst, src, n);
-#define SAFE_FREE(src) {if(src) {free(src); src = NULL;}}
+#define SAFE_FREE(src) {if (src) {free(src); src = NULL; } }
+#define SAFE_G_FREE(src) {if (src) {g_free(src); src = NULL; } }
#define STRING_VALID(str) ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
-#define SQLITE3_FINALIZE(x) {if(x != NULL) {sqlite3_finalize(x);}}
+#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_PATH_PHONE MEDIA_ROOT_PATH_INTERNAL /**< File path prefix of files stored in phone */
-#define MEDIA_CONTENT_PATH_MMC MEDIA_ROOT_PATH_SDCARD /**< File path prefix of files stored in mmc card */
-#define MEDIA_CONTENT_THUMB_DEFAULT_PATH tzplatform_mkpath(TZ_SYS_DATA, "file-manager-service/.thumb/thumb_default.png")
-#define MEDIA_CONTENT_INSERT_FILES_PATH tzplatform_mkpath(TZ_USER_DATA, "file-manager-service/")
+#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,
+ MEDIA_INFO_FILE_NAME,
+ MEDIA_INFO_TYPE,
+ MEDIA_INFO_MIME_TYPE,
+ MEDIA_INFO_SIZE,
+ MEDIA_INFO_ADDED_TIME,
+ MEDIA_INFO_MODIFIED_TIME,
+ MEDIA_INFO_THUMBNAIL_PATH,
+ MEDIA_INFO_DESCRIPTION,
+ MEDIA_INFO_RATING,
+ MEDIA_INFO_FAVOURITE,
+ MEDIA_INFO_IS_DRM,
+ MEDIA_INFO_STORAGE_TYPE,
+ MEDIA_INFO_LONGITUDE,
+ MEDIA_INFO_LATITUDE,
+ MEDIA_INFO_ALTITUDE,
+ MEDIA_INFO_EXPOSURE_TIME,
+ MEDIA_INFO_FNUMBER,
+ MEDIA_INFO_ISO,
+ MEDIA_INFO_MODEL,
+ MEDIA_INFO_WIDTH,
+ MEDIA_INFO_HEIGHT,
+ MEDIA_INFO_DATETAKEN,
+ MEDIA_INFO_ORIENTATION,
+ MEDIA_INFO_TITLE,
+ MEDIA_INFO_ALBUM,
+ MEDIA_INFO_ARTIST,
+ MEDIA_INFO_ALBUM_ARTIST,
+ MEDIA_INFO_GENRE,
+ MEDIA_INFO_COMPOSER,
+ MEDIA_INFO_YEAR,
+ MEDIA_INFO_RECORDED_DATE,
+ MEDIA_INFO_COPYRIGHT,
+ MEDIA_INFO_TRACK_NUM,
+ MEDIA_INFO_BITRATE,
+ MEDIA_INFO_BITPERSAMPLE,
+ MEDIA_INFO_DURATION,
+ MEDIA_INFO_SAMPLERATE,
+ MEDIA_INFO_CHANNEL,
+ MEDIA_INFO_TIMELINE,
+ MEDIA_INFO_SYNC_STATUS,
+ MEDIA_INFO_STORAGE_UUID,
+ MEDIA_INFO_IS_360,
+ MEDIA_INFO_ITEM_MAX,
+} media_info_item_e;
+
typedef enum {
MEDIA_CONTENT_TYPE = 0,
MEDIA_THUMBNAIL_TYPE,
MEDIA_GROUP_BOOKMARK,
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;
-typedef enum {
- MEDIA_BATCH_INSERT_NORMAL,
- MEDIA_BATCH_INSERT_BURSTSHOT,
-} media_batch_insert_e;
-
-typedef struct _filter_s
-{
+typedef struct _filter_s {
+ char *storage_id;
char *condition;
char *order_keyword;
media_content_order_e order_type;
media_content_collation_e order_collate_type;
int offset;
int count;
-}filter_s;
+ bool is_full_condition;
+ bool is_full_order;
+} filter_s;
-typedef struct
-{
- char *folder_id; //image id, audio id, video id
+typedef struct {
+ char *folder_id;
char *path;
char *name;
- time_t modified_time;
media_content_storage_e storage_type;
-}media_folder_s;
+ char *storage_uuid;
+} media_folder_s;
-typedef struct
-{
+typedef struct {
int tag_id;
char *name;
-}media_tag_s;
+ GList *item_list;
+} media_tag_s;
-typedef struct
-{
+typedef struct {
int bookmark_id;
char *media_id;
time_t marked_time;
char *thumbnail_path;
-}media_bookmark_s;
+ char *name;
+} media_bookmark_s;
-typedef struct
-{
+typedef struct {
int album_id;
char *name;
char *artist;
char *album_art_path;
-}media_album_s;
+} media_album_s;
-typedef struct
-{
- int playlist_id; //playlist id
- char *name; // playlist name
- char *thumbnail_path; //playlist thumbnail path
-}media_playlist_s;
+typedef struct {
+ int playlist_id;
+ char *name;
+ char *thumbnail_path;
+ GList *item_list;
+} media_playlist_s;
-typedef struct
-{
+typedef struct {
char *media_id;
int width;
int height;
char *date_taken;
char *title;
- char *burst_id;
- char *weather;
+ char *exposure_time;
+ double fnumber;
+ int iso;
+ char *model;
media_content_orientation_e orientation;
-}image_meta_s;
+} image_meta_s;
-typedef struct
-{
+typedef struct {
char *media_id;
char *title;
char *album;
int duration;
int width;
int height;
- int played_count;
- time_t played_time;
- int played_position;
-}video_meta_s;
+ int rotation;
+} video_meta_s;
-typedef struct
-{
+typedef struct {
char *media_id;
char *title;
char *album;
int samplerate;
int channel;
int duration;
- int played_count;
- time_t played_time;
- int played_position;
-}audio_meta_s;
-
-typedef struct
-{
- char *media_id; //image id, audio id, video id
+} audio_meta_s;
+
+typedef struct {
+ char *media_id;
char *file_path;
char *display_name;
media_content_type_e media_type;
double longitude;
double latitude;
double altitude;
- char *weather;
int rating;
- int favourite;
+ 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;
+ char *storage_uuid;
int sync_status;
+ unsigned int request_id;
+ unsigned int face_request_id;
+ int is_360;
image_meta_s *image_meta;
video_meta_s *video_meta;
audio_meta_s *audio_meta;
-}media_info_s;
-
-typedef struct
-{
- char *media_id; // media_uuid
- int function; // Add, remove, modify
- char *tag_name; // tag_name
-}media_tag_item_s;
-
-typedef struct
-{
- char *media_id; // media_uuid
- int function; // Add, remove, modify
- char *playlist_name; // playlist_name
- char *thumbnail_path; //playlist thumbnail path
- int playlist_member_id; // playlist unique id of media. Same content which has same media_id can be added to Playlist
- int play_order; //play_order
-}media_playlist_item_s;
-
-typedef struct _attribute_map_s
-{
+} media_info_s;
+
+typedef struct {
+ char *media_id;
+ int function;
+ char *tag_name;
+} media_tag_item_s;
+
+typedef struct {
+ char *media_id;
+ int function;
+ char *playlist_name;
+ char *thumbnail_path;
+ int playlist_member_id;
+ int play_order;
+} media_playlist_item_s;
+
+typedef struct {
+ char *storage_id;
+ char *storage_path;
+ int storage_type;
+} media_storage_s;
+
+typedef struct {
+ 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 */
+ unsigned int face_rect_w; /* width of face */
+ unsigned int face_rect_h; /* height of face */
+ int orientation; /* orientation */
+ char *face_tag; /* face tag */
+} media_face_s;
+
+typedef struct _attribute_map_s {
GHashTable *attr_map;
-}attribute_s;
+} attribute_s;
-typedef struct
-{
+typedef struct {
media_info_s *handle;
void *user_data;
media_thumbnail_completed_cb thumbnail_completed_cb;
-}media_thumbnail_cb_s;
+} media_thumbnail_cb_s;
-typedef struct
-{
+typedef struct {
+ void *user_data;
+ media_face_detection_completed_cb face_completed_cb;
+} media_face_cb_s;
+
+typedef struct {
media_insert_completed_cb insert_completed_cb;
char *insert_list_path;
void *user_data;
} media_insert_cb_s;
-typedef struct
-{
+typedef struct {
media_content_db_update_cb update_noti_cb;
void *user_data;
} media_noti_cb_s;
#define DB_TABLE_PLAYLIST "playlist"
#define DB_TABLE_PLAYLIST_MAP "playlist_map"
#define DB_TABLE_BOOKMARK "bookmark"
+#define DB_TABLE_STORAGE "storage"
+#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"
/* 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_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_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"
-
-/* 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 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 UPDATE_SQL "UPDATE %s SET %s WHERE %s"
+#define QUERY_KEYWORD_COLLATE "COLLATE "
/* DB TABLE JOIN */
-#define SELECT_EMPTY_PLAYLIST "SELECT playlist_id, name FROM "DB_TABLE_PLAYLIST" WHERE playlist_id NOT IN (select playlist_id from "DB_TABLE_PLAYLIST_MAP")"
-#define SELECT_EMPTY_TAG "SELECT tag_id, name FROM "DB_TABLE_TAG" WHERE tag_id NOT IN (SELECT tag_id FROM "DB_TABLE_TAG_MAP")"
-#define FOLDER_MEDIA_JOIN "("DB_TABLE_FOLDER" AS f INNER JOIN "DB_TABLE_MEDIA" AS m ON f.folder_uuid=m.folder_uuid) WHERE m.validity=1"
-#define PLAYLISTMAP_MEDIA_JOIN "("DB_TABLE_PLAYLIST_MAP" AS pm INNER JOIN "DB_TABLE_MEDIA" AS m \
- ON (pm.media_uuid = m.media_uuid)) WHERE m.validity=1"
-#define SELECT_PLAYLIST_FROM_PLAYLIST_PLAYLISTMAP_MEDIA_JOIN "SELECT DISTINCT p.playlist_id, p.name FROM "DB_TABLE_PLAYLIST" AS p INNER JOIN "DB_TABLE_PLAYLIST_MAP" AS pm INNER JOIN "DB_TABLE_MEDIA" AS m \
- ON (p.playlist_id=pm.playlist_id AND pm.media_uuid = m.media_uuid) WHERE m.validity=1"
-#define SELECT_TAG_FROM_TAG_TAGMAP_MEDIA_JOIN "SELECT DISTINCT t.tag_id, t.name FROM "DB_TABLE_TAG" AS t INNER JOIN "DB_TABLE_MEDIA" AS m INNER JOIN "DB_TABLE_TAG_MAP" AS tm \
- ON (tm.media_uuid = m.media_uuid and tm.tag_id=t.tag_id) WHERE m.validity=1"
-#define BOOKMARK_MEDIA_JOIN "("DB_TABLE_BOOKMARK" AS b INNER JOIN "DB_TABLE_MEDIA" AS m \
- ON (b.media_uuid = m.media_uuid)) WHERE m.validity=1"
-#define ALBUM_MEDIA_JOIN "("DB_TABLE_ALBUM" AS a INNER JOIN "DB_TABLE_MEDIA" AS m \
- ON (a.album_id = m.album_id)) WHERE m.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 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_ARTIST_LIST "SELECT DISTINCT artist FROM "DB_TABLE_MEDIA" WHERE validity=1"
-#define SELECT_GENRE_LIST "SELECT DISTINCT genre FROM "DB_TABLE_MEDIA" WHERE validity=1"
-#define SELECT_COMPOSER_LIST "SELECT DISTINCT composer FROM "DB_TABLE_MEDIA" WHERE validity=1 "
-#define SELECT_YEAR_LIST "SELECT DISTINCT year FROM "DB_TABLE_MEDIA" WHERE validity=1 "
-#define SELECT_MEDIA_GROUP_LIST "SELECT DISTINCT %s FROM "DB_TABLE_MEDIA" WHERE validity=1 "
-
-#define SELECT_FOLDER_LIST "SELECT DISTINCT f.folder_uuid, f.path, f.name, f.storage_type, f.modified_time FROM "FOLDER_MEDIA_JOIN
-//#define SELECT_TAG_LIST SELECT_EMPTY_TAG" UNION "SELECT_TAG_FROM_TAG_TAGMAP_MEDIA_JOIN
-//#define SELECT_PLAYLIST_LIST SELECT_EMPTY_PLAYLIST" UNION "SELECT_PLAYLIST_FROM_PLAYLIST_PLAYLISTMAP_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.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, thumbnail_path FROM "DB_VIEW_PLAYLIST" WHERE 1 "
-#define SELECT_BOOKMARK_LIST "SELECT DISTINCT b.bookmark_id, b.media_uuid, b.marked_time, b.thumbnail_path FROM "BOOKMARK_MEDIA_JOIN
+#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_ARTIST_COUNT "SELECT COUNT(DISTINCT artist) FROM "DB_TABLE_MEDIA" WHERE validity=1"
-#define SELECT_GENRE_COUNT "SELECT COUNT(DISTINCT genre) FROM "DB_TABLE_MEDIA" WHERE validity=1"
-#define SELECT_COMPOSER_COUNT "SELECT COUNT(DISTINCT composer) FROM "DB_TABLE_MEDIA" WHERE validity=1"
-#define SELECT_YEAR_COUNT "SELECT COUNT(DISTINCT year) FROM "DB_TABLE_MEDIA" WHERE validity=1"
+#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_TAG_COUNT "SELECT COUNT(*) FROM ("SELECT_TAG_LIST
-//#define SELECT_PLAYLIST_COUNT "SELECT COUNT(*) FROM ("SELECT_PLAYLIST_LIST
+#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 Media Count of Group */
-#define SELECT_MEDIA_COUNT_FROM_MEDIA "SELECT COUNT(*) FROM ("SELECT_MEDIA_ITEM //to apply limit condition. "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1"
-#define SELECT_MEDIA_COUNT_FROM_MEDIA_SIMPLE "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 "
-#define SELECT_MEDIA_COUNT_FROM_ALBUM "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND album_id='%d'"
-#define SELECT_MEDIA_COUNT_FROM_ARTIST "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND artist='%q'"
-#define SELECT_MEDIA_COUNT_FROM_GENRE "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND genre='%q'"
-#define SELECT_MEDIA_COUNT_FROM_COMPOSER "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND composer='%q'"
-#define SELECT_MEDIA_COUNT_FROM_YEAR "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND year='%q'"
-#define SELECT_MEDIA_COUNT_FROM_GROUP "SELECT COUNT(*) FROM ("SELECT_MEDIA_FROM_GROUP //to apply limit condition.
-#define SELECT_MEDIA_COUNT_FROM_GROUP_NULL "SELECT COUNT(*) FROM ("SELECT_MEDIA_FROM_GROUP_NULL //to apply limit condition.
-#define SELECT_MEDIA_COUNT_FROM_FOLDER "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1 AND folder_uuid='%q'"
-//#define SELECT_MEDIA_COUNT_FROM_TAG "SELECT COUNT(*) FROM "DB_TABLE_TAG_MAP" WHERE tag_id=%d AND media_uuid IN (SELECT media_uuid FROM "DB_TABLE_MEDIA" WHERE validity=1"
-//#define SELECT_MEDIA_COUNT_FROM_PLAYLIST "SELECT COUNT(*) FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d AND media_uuid IN (SELECT media_uuid FROM "DB_TABLE_MEDIA" WHERE validity=1"
+#define SELECT_MEDIA_COUNT_FROM_MEDIA "SELECT COUNT(*) FROM ("SELECT_MEDIA_ITEM /*to apply limit condition. "SELECT COUNT(*) FROM "DB_TABLE_MEDIA" WHERE validity=1" */
+#define SELECT_MEDIA_COUNT_FROM_MEDIA_SIMPLE "SELECT COUNT(*) FROM '%s' WHERE validity=1 "
+#define SELECT_MEDIA_COUNT_FROM_ALBUM "SELECT COUNT(*) FROM '%s' WHERE validity=1 AND album_id='%d'"
+#define SELECT_MEDIA_COUNT_FROM_GROUP "SELECT COUNT(*) FROM ("SELECT_MEDIA_FROM_GROUP /*to apply limit condition. */
+#define SELECT_MEDIA_COUNT_FROM_GROUP_NULL "SELECT COUNT(*) FROM ("SELECT_MEDIA_FROM_GROUP_NULL /* to apply limit condition. */
+#define SELECT_MEDIA_COUNT_FROM_FOLDER "SELECT COUNT(*) FROM '%s' WHERE validity=1 AND folder_uuid='%q'"
+#define SELECT_MEDIA_COUNT_FROM_STORAGE "SELECT COUNT(*) FROM '%s' WHERE validity=1 AND storage_uuid='%q'"
#define SELECT_MEDIA_COUNT_FROM_TAG "SELECT COUNT(*) FROM "DB_VIEW_TAG" WHERE (tag_id=%d AND media_count>0) "
-#define SELECT_MEDIA_COUNT_FROM_PLAYLIST "SELECT COUNT(*) FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and media_count>0) "
+#define SELECT_MEDIA_COUNT_FROM_PLAYLIST "SELECT COUNT(*) FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and media_count>0) "
/* 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)"
-#define REMOVE_TAG_ITEM_FROM_TAG_MAP "DELETE FROM "DB_TABLE_TAG_MAP" WHERE tag_id=%d AND media_uuid='%q'"
-#define UPDATE_TAG_NAME_FROM_TAG "UPDATE "DB_TABLE_TAG" SET name='%q' WHERE tag_id=%d"
-//#define SELECT_TAG_COUNT_BY_MEDIA_ID "SELECT COUNT(*) FROM "DB_TABLE_TAG" WHERE tag_id IN (SELECT tag_id FROM "DB_TABLE_TAG_MAP" WHERE media_uuid = '%q')"
-//#define SELECT_TAG_LIST_BY_MEDIA_ID "SELECT * FROM "DB_TABLE_TAG" WHERE tag_id IN (SELECT tag_id FROM "DB_TABLE_TAG_MAP" WHERE media_uuid = '%s')"
-#define SELECT_TAG_COUNT_BY_MEDIA_ID "SELECT COUNT(*) FROM "DB_VIEW_TAG" WHERE media_uuid = '%q'"
+#define REMOVE_TAG_ITEM_FROM_TAG_MAP "DELETE FROM "DB_TABLE_TAG_MAP" WHERE tag_id=%d AND media_uuid='%q';"
+#define UPDATE_TAG_NAME_FROM_TAG "UPDATE "DB_TABLE_TAG" SET name='%q' WHERE tag_id=%d;"
+#define SELECT_TAG_COUNT_BY_MEDIA_ID "SELECT COUNT(*) FROM "DB_VIEW_TAG" WHERE media_uuid = '%s'"
#define SELECT_TAG_LIST_BY_MEDIA_ID "SELECT tag_id, name FROM "DB_VIEW_TAG" WHERE media_uuid = '%s'"
/* 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, 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"
+ 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 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_MAP "SELECT pm._id, pm.media_uuid FROM "PLAYLISTMAP_MEDIA_JOIN" AND pm.playlist_id=%d"
-#define SELECT_PLAYLIST_ITEM_ID_FROM_PLAYLIST_VIEW "SELECT pm_id, media_uuid FROM "DB_VIEW_PLAYLIST" WHERE playlist_id=%d "
-
-//#define SELECT_PLAY_ORDER_FROM_PLAYLIST_MAP "SELECT play_order FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d and _id=%d"
+#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_MAP "SELECT MAX(play_order) FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d"
#define SELECT_MAX_PLAY_ORDER_FROM_PLAYLIST_VIEW "SELECT MAX(play_order) FROM "DB_VIEW_PLAYLIST" WHERE playlist_id=%d"
-#define REMOVE_PLAYLIST_ITEM_FROM_PLAYLIST_MAP "DELETE FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d AND _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"
+#define REMOVE_PLAYLIST_ITEM_FROM_PLAYLIST_MAP "DELETE FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d AND _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) VALUES ('%q', '%d', %Q)"
-#define SELECT_BOOKMARK_COUNT_BY_MEDIA_ID "SELECT COUNT(*) FROM "DB_TABLE_BOOKMARK" WHERE media_uuid='%q'"
-#define SELECT_BOOKMARK_LIST_BY_MEDIA_ID "SELECT * FROM "DB_TABLE_BOOKMARK" WHERE media_uuid='%q'"
-#define SELECT_BOOKMARK_LIST_BY_MEDIA_ID_USUAL "SELECT * FROM "DB_TABLE_BOOKMARK" WHERE media_uuid='%s'"
-
-/* Get Meta */
-#define MEDIA_AV_META "media_uuid, title, album, artist, genre, composer, year, recorded_date, copyright, track_num, bitrate, duration, played_count, last_played_time, last_played_position"
-#define MEDIA_IMAGE_META "media_uuid, width, height, datetaken, orientation"
-#define SELECT_IMAGE_FROM_MEDIA "SELECT "MEDIA_IMAGE_META" FROM "DB_TABLE_MEDIA" WHERE media_uuid='%s'"
-#define SELECT_AUDIO_FROM_MEDIA "SELECT "MEDIA_AV_META", samplerate, channel FROM "DB_TABLE_MEDIA" WHERE media_uuid='%s'"
-#define SELECT_VIDEO_FROM_MEDIA "SELECT "MEDIA_AV_META", width, height FROM "DB_TABLE_MEDIA" WHERE media_uuid='%s'"
+#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 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 bookmark_name=%Q WHERE bookmark_id=%d;"
/* Update Meta*/
-#define UPDATE_AV_META_FROM_MEDIA "UPDATE "DB_TABLE_MEDIA" SET played_count=%d, last_played_time=%d, last_played_position=%d WHERE media_uuid='%q'"
-#define UPDATE_IMAGE_META_FROM_MEDIA "UPDATE "DB_TABLE_MEDIA" SET orientation=%d, weather=%Q WHERE media_uuid='%q'"
-
-#define SELECT_MEDIA_ITEM "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1"
-#define SELECT_MEDIA_FROM_MEDIA "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND media_uuid='%s'"
-#define SELECT_MEDIA_BY_PATH "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND path='%q'"
-#define SELECT_MEDIA_FROM_ALBUM "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND album_id=%d"
-#define SELECT_MEDIA_FROM_GROUP "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND %s='%q'"
-#define SELECT_MEDIA_FROM_GROUP_NULL "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND %s IS NULL"
-#define SELECT_MEDIA_FROM_FOLDER "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE validity=1 AND folder_uuid='%q'"
-#define SELECT_MEDIA_FROM_TAG "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" 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 "DB_TABLE_MEDIA" 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" 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_BY_PATH "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND path='%q'"
+#define SELECT_MEDIA_FROM_ALBUM "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND album_id=%d"
+#define SELECT_MEDIA_FROM_GROUP "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND %s='%q'"
+#define SELECT_MEDIA_FROM_GROUP_NULL "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND %s IS NULL"
+#define SELECT_MEDIA_FROM_FOLDER "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND folder_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_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 "DELETE FROM "DB_TABLE_MEDIA" WHERE media_uuid='%q'"
-#define DELETE_MEDIA_FROM_MEDIA_BATCH "DELETE FROM "DB_TABLE_MEDIA" WHERE %s"
-#define DELETE_FOLDER_FROM_FOLDER "DELETE FROM "DB_TABLE_FOLDER" WHERE folder_uuid='%q'"
-#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"
-
+#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 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 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 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"
-/**
- *@internal
- */
int _content_query_prepare(sqlite3_stmt **stmt, char *select_query, char *condition_query, char *option_query);
-
-/**
- *@internal
- */
int _content_error_capi(int type, int cotent_error);
-
-/**
- *@internal
- */
int _content_query_sql(char *query_str);
-
-/**
- *@internal
- */
-MediaSvcHandle* _content_get_db_handle(void);
-
-/**
- *@internal
- */
+sqlite3 * _content_get_db_handle(void);
+uid_t _content_get_uid(void);
attribute_h _content_get_attirbute_handle(void);
-
-/**
- *@internal
- */
attribute_h _content_get_alias_attirbute_handle(void);
-
-/**
- *@internal
- */
+int _media_info_get_media_info_from_db(const char *path, const char *storage_id, media_info_h media);
void _media_info_item_get_detail(sqlite3_stmt *stmt, media_info_h media);
-
-/**
- *@internal
- */
int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *group_count);
-
-/**
- *@internal
- */
int _media_db_get_media_group_count(media_group_e group, filter_h filter, int *group_count);
-
-/**
- *@internal
- */
int _media_db_get_media_group(media_group_e group, filter_h filter, media_group_cb callback, void *user_data);
-
-/**
- *@internal
- */
int _media_db_get_album(filter_h filter, media_album_cb callback, void *user_data);
-
-/**
- *@internal
- */
int _media_db_get_folder(filter_h filter, media_folder_cb callback, void *user_data);
-
-/**
- *@internal
- */
int _media_db_get_playlist(filter_h filter, media_playlist_cb callback, void *user_data);
-
-/**
- *@internal
- */
int _media_db_get_playlist_item(int playlist_id, filter_h filter, playlist_member_cb callback, void *user_data);
-
-/**
- *@internal
- */
int _media_db_get_tag(const char *media_id, filter_h filter, media_tag_cb callback, void *user_data);
-
-/**
- *@internal
- */
int _media_db_get_bookmark(const char *media_id, filter_h filter, media_bookmark_cb callback, void *user_data);
-
-/**
- *@internal
- */
+int _media_db_get_face(const char *media_id, filter_h filter, media_face_cb callback, void *user_data);
int _media_db_get_group_item_count_by_id(int group_id, filter_h filter, group_list_e group_type, int *item_count);
-
-/**
- *@internal
- */
int _media_db_get_group_item_count(const char *group_name, filter_h filter, group_list_e group_type, int *item_count);
-
-/**
- *@internal
- */
int _media_db_get_group_item_by_id(int group_id, filter_h filter, media_info_cb callback, void *user_data, group_list_e group_type);
-
-/**
- *@internal
- */
int _media_db_get_group_item(const char *group_name, filter_h filter, media_info_cb callback, void *user_data, group_list_e group_type);
+int _media_db_get_media_group_item_count(const char *group_name, filter_h filter, media_group_e group, int *item_count);
+int _media_db_get_media_group_item(const char *group_name, filter_h filter, media_group_e group, media_info_cb callback, void *user_data);
+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
- */
-int _media_db_get_media_group_item_count(const char *group_name, media_group_e group, filter_h filter, int *item_count);
-
-/**
- *@internal
- */
-int _media_db_get_media_group_item(const char *group_name, media_group_e group, filter_h filter, media_info_cb callback, void *user_data);
-
-/**
- * @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, char *user_attr, 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_add(attribute_h atrr, const char *user_attr, const char *platform_attr);
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_gettid() syscall(__NR_gettid)
#define media_content_retv_if(expr, val) do { \
- if(expr) { \
- LOGE(FONT_COLOR_RED"[%d]", media_content_gettid()); \
+ if (expr) { \
+ 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"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg); \
+ return (val); \
+ } \
+ } while (0)
+
+#define media_content_warn(fmt, arg...) do { \
+ 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 { \
- LOGD(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_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"[%ld]"fmt""FONT_COLOR_RESET, media_content_gettid(), ##arg); \
+ } while (0)
+
+#define media_content_sec_error(fmt, arg...) do { \
+ 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]"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__*/