#include <media_info_private.h>
#include <media_util_private.h>
-
-static attribute_h g_attr_handle = NULL;
-static attribute_h g_alias_attr_handle = NULL;
-static MediaSvcHandle *db_handle = NULL;
+static sqlite3 *db_handle = NULL;
static int ref_count = 0;
static GMutex db_mutex;
-static __thread media_noti_cb_s *g_noti_info = NULL;
static uid_t content_g_uid = 0;
-#if 0
-static int __media_content_create_attr_handle(void);
-static int __media_content_create_alias_attr_handle(void);
-static int __media_content_create_attribute_handle(void);
-#endif
-static int __media_content_create_attribute_handles(void);
-static int __media_content_destroy_attribute_handle(void);
-
-typedef struct {
- char *user_attr;
- char *platform_attr;
- char *platform_alias_attr;
-} media_content_attribute_info_s;
-
-static media_content_attribute_info_s g_content_attrs_info[] = {
- /* Media Info */
- {MEDIA_ID, DB_FIELD_MEDIA_ID, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ID},
- {MEDIA_PATH, DB_FIELD_MEDIA_PATH, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_PATH},
- {MEDIA_DISPLAY_NAME, DB_FIELD_MEDIA_DISPLAY_NAME, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_DISPLAY_NAME},
- {MEDIA_TYPE, DB_FIELD_MEDIA_TYPE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_TYPE},
- {MEDIA_MIME_TYPE, DB_FIELD_MEDIA_MIME_TYPE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_MIME_TYPE},
- {MEDIA_SIZE, DB_FIELD_MEDIA_SIZE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_SIZE},
- {MEDIA_ADDED_TIME, DB_FIELD_MEDIA_ADDED_TIME, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ADDED_TIME},
- {MEDIA_MODIFIED_TIME, DB_FIELD_MEDIA_MODIFIED_TIME, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_MODIFIED_TIME},
- {MEDIA_TIMELINE, DB_FIELD_MEDIA_TIMELINE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_TIMELINE},
- {MEDIA_THUMBNAIL_PATH, DB_FIELD_MEDIA_THUMBNAIL_PATH, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_THUMBNAIL_PATH},
- {MEDIA_TITLE, DB_FIELD_MEDIA_TITLE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_TITLE},
- {MEDIA_ALBUM, DB_FIELD_MEDIA_ALBUM, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ALBUM},
- {MEDIA_ARTIST, DB_FIELD_MEDIA_ARTIST, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ARTIST},
- {MEDIA_ALBUM_ARTIST, DB_FIELD_MEDIA_ALBUM_ARTIST, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ALBUM_ARTIST},
- {MEDIA_GENRE, DB_FIELD_MEDIA_GENRE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_GENRE},
- {MEDIA_COMPOSER, DB_FIELD_MEDIA_COMPOSER, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_COMPOSER},
- {MEDIA_YEAR, DB_FIELD_MEDIA_YEAR, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_YEAR},
- {MEDIA_RECORDED_DATE, DB_FIELD_MEDIA_RECORDED_DATE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_RECORDED_DATE},
- {MEDIA_COPYRIGHT, DB_FIELD_MEDIA_COPYRIGHT, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_COPYRIGHT},
- {MEDIA_TRACK_NUM, DB_FIELD_MEDIA_TRACK_NUM, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_TRACK_NUM},
- {MEDIA_DESCRIPTION, DB_FIELD_MEDIA_DESCRIPTION, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_DESCRIPTION},
- {MEDIA_BITRATE, DB_FIELD_MEDIA_BITRATE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_BITRATE},
- {MEDIA_BITPERSAMPLE, DB_FIELD_MEDIA_BITPERSAMPLE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_BITPERSAMPLE},
- {MEDIA_SAMPLERATE, DB_FIELD_MEDIA_SAMPLERATE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_SAMPLERATE},
- {MEDIA_CHANNEL, DB_FIELD_MEDIA_CHANNEL, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_CHANNEL},
- {MEDIA_DURATION, DB_FIELD_MEDIA_DURATION, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_DURATION},
- {MEDIA_LONGITUDE, DB_FIELD_MEDIA_LONGITUDE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_LONGITUDE},
- {MEDIA_LATITUDE, DB_FIELD_MEDIA_LATITUDE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_LATITUDE},
- {MEDIA_ALTITUDE, DB_FIELD_MEDIA_ALTITUDE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ALTITUDE},
- {MEDIA_WIDTH, DB_FIELD_MEDIA_WIDTH, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_WIDTH},
- {MEDIA_HEIGHT, DB_FIELD_MEDIA_HEIGHT, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_HEIGHT},
- {MEDIA_DATETAKEN, DB_FIELD_MEDIA_DATETAKEN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_DATETAKEN},
- {MEDIA_ORIENTATION, DB_FIELD_MEDIA_ORIENTATION, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ORIENTATION},
- {MEDIA_BURST_ID, DB_FIELD_MEDIA_BURST_ID, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_BURST_ID},
- {MEDIA_PLAYED_COUNT, DB_FIELD_MEDIA_PLAYED_COUNT, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_PLAYED_COUNT},
- {MEDIA_LAST_PLAYED_TIME, DB_FIELD_MEDIA_LAST_PLAYED_TIME, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_LAST_PLAYED_TIME},
- {MEDIA_LAST_PLAYED_POSITION, DB_FIELD_MEDIA_LAST_PLAYED_POSITION, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_LAST_PLAYED_POSITION},
- {MEDIA_RATING, DB_FIELD_MEDIA_RATING, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_RATING},
- {MEDIA_FAVOURITE, DB_FIELD_MEDIA_FAVOURITE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_FAVOURITE},
- {MEDIA_AUTHOR, DB_FIELD_MEDIA_AUTHOR, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_AUTHOR},
- {MEDIA_PROVIDER, DB_FIELD_MEDIA_PROVIDER, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_PROVIDER},
- {MEDIA_CONTENT_NAME, DB_FIELD_MEDIA_CONTENT_NAME, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_CONTENT_NAME},
- {MEDIA_CATEGORY, DB_FIELD_MEDIA_CATEGORY, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_CATEGORY},
- {MEDIA_LOCATION_TAG, DB_FIELD_MEDIA_LOCATION_TAG, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_LOCATION_TAG},
- {MEDIA_AGE_RATING, DB_FIELD_MEDIA_AGE_RATING, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_AGE_RATING},
- {MEDIA_KEYWORD, DB_FIELD_MEDIA_KEYWORD, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_KEYWORD},
- {MEDIA_WEATHER, DB_FIELD_MEDIA_WEATHER, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_WEATHER},
- {MEDIA_IS_DRM, DB_FIELD_MEDIA_IS_DRM, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_IS_DRM},
- {MEDIA_STORAGE_TYPE, DB_FIELD_MEDIA_STORAGE_TYPE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_STORAGE_TYPE},
- {MEDIA_360, DB_FIELD_MEDIA_360, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_360},
-
- /* Pinyin */
- {MEDIA_FILE_NAME_PINYIN, DB_FIELD_MEDIA_FILE_NAME_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_FILE_NAME_PINYIN},
- {MEDIA_TITLE_PINYIN, DB_FIELD_MEDIA_TITLE_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_TITLE_PINYIN},
- {MEDIA_ALBUM_PINYIN, DB_FIELD_MEDIA_ALBUM_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ALBUM_PINYIN},
- {MEDIA_ARTIST_PINYIN, DB_FIELD_MEDIA_ARTIST_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ARTIST_PINYIN},
- {MEDIA_ALBUM_ARTIST_PINYIN, DB_FIELD_MEDIA_ALBUM_ARTIST_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ALBUM_ARTIST_PINYIN},
- {MEDIA_GENRE_PINYIN, DB_FIELD_MEDIA_GENRE_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_GENRE_PINYIN},
- {MEDIA_COMPOSER_PINYIN, DB_FIELD_MEDIA_COMPOSER_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_COMPOSER_PINYIN},
- {MEDIA_COPYRIGHT_PINYIN, DB_FIELD_MEDIA_COPYRIGHT_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_COPYRIGHT_PINYIN},
- {MEDIA_DESCRIPTION_PINYIN, DB_FIELD_MEDIA_DESCRIPTION_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_DESCRIPTION_PINYIN},
- {MEDIA_AUTHOR_PINYIN, DB_FIELD_MEDIA_AUTHOR_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_AUTHOR_PINYIN},
- {MEDIA_PROVIDER_PINYIN, DB_FIELD_MEDIA_PROVIDER_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_PROVIDER_PINYIN},
- {MEDIA_CONTENT_NAME_PINYIN, DB_FIELD_MEDIA_CONTENT_NAME_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_CONTENT_NAME_PINYIN},
- {MEDIA_CATEGORY_PINYIN, DB_FIELD_MEDIA_CATEGORY_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_CATEGORY_PINYIN},
- {MEDIA_LOCATION_TAG_PINYIN, DB_FIELD_MEDIA_LOCATION_TAG_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_LOCATION_TAG_PINYIN},
- {MEDIA_AGE_RATING_PINYIN, DB_FIELD_MEDIA_AGE_RATING_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_AGE_RATING_PINYIN},
- {MEDIA_KEYWORD_PINYIN, DB_FIELD_MEDIA_KEYWORD_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_KEYWORD_PINYIN},
-
- /* Folder */
- {FOLDER_ID, NULL, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_ID},
- {FOLDER_PATH, NULL, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_PATH},
- {FOLDER_NAME, NULL, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_NAME},
- {FOLDER_MODIFIED_TIME, NULL, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_MODIFIED_TIME},
- {FOLDER_STORAGE_TYPE, NULL, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_STORAGE_TYPE},
- {FOLDER_NAME_PINYIN, NULL, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_NAME_PINYIN},
- {FOLDER_ORDER, NULL, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_ORDER},
-
- /* Playlist */
- {MEDIA_PLAYLIST_ID, DB_FIELD_PLAYLIST_ID, NULL},
- {PLAYLIST_NAME, DB_FIELD_PLAYLIST_NAME, DB_TABLE_ALIAS_PLAYLIST"."DB_FIELD_PLAYLIST_NAME},
- {PLAYLIST_MEMBER_ORDER, DB_FIELD_PLAYLIST_MEMBER_ORDER, DB_TABLE_ALIAS_PLAYLIST_MAP"."DB_FIELD_PLAYLIST_MEMBER_ORDER},
-
- /* Playlist View */
- {PLAYLIST_MEDIA_COUNT, DB_FIELD_PLAYLIST_MEDIA_COUNT, NULL},
-
- /* Tag */
- {MEDIA_TAG_ID, DB_FIELD_TAG_ID, NULL},
- {TAG_NAME, DB_FIELD_TAG_NAME, DB_TABLE_ALIAS_TAG"."DB_FIELD_TAG_NAME},
-
- /* Tag View */
- {TAG_MEDIA_COUNT, DB_FIELD_TAG_MEDIA_COUNT, NULL},
-
- /* Bookmark */
- {MEDIA_BOOKMARK_ID, DB_FIELD_BOOKMARK_ID, DB_TABLE_ALIAS_BOOKMARK"."DB_FIELD_BOOKMARK_ID},
- {BOOKMARK_MARKED_TIME, DB_FIELD_BOOKMARK_MARKED_TIME, DB_TABLE_ALIAS_BOOKMARK"."DB_FIELD_BOOKMARK_MARKED_TIME},
- {BOOKMARK_NAME, DB_FIELD_BOOKMARK_NAME, DB_TABLE_ALIAS_BOOKMARK"."DB_FIELD_BOOKMARK_NAME},
-
- /* Storage */
- {MEDIA_STORAGE_ID, DB_FIELD_STORAGE_ID, NULL},
- {MEDIA_STORAGE_PATH, DB_FIELD_STORAGE_PATH, NULL},
-
- /* Face */
- {MEDIA_FACE_ID, DB_FIELD_FACE_ID, DB_TABLE_ALIAS_FACE"."DB_FIELD_FACE_ID},
- {MEDIA_FACE_TAG, DB_FIELD_FACE_TAG, DB_TABLE_ALIAS_FACE"."DB_FIELD_FACE_TAG},
-
-#ifdef _USE_SENIOR_MODE
- {MEDIA_CONTACT, DB_FIELD_MEDIA_CONTACT, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_CONTACT},
- {MEDIA_APP_DATA, DB_FIELD_MEDIA_APP_DATA, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_APP_DATA},
-#endif
-#ifdef _USE_TV_PROFILE
- {MEDIA_FOLDER_ID, DB_FIELD_MEDIA_FOLDER_ID, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_FOLDER_ID},
- {MEDIA_STITCHED_INFO, DB_FIELD_MEDIA_STITCHED_INFO, NULL},
- {MEDIA_MODIFIED_MONTH, DB_FIELD_MEDIA_MODIFIED_MONTH, NULL},
- {MEDIA_MODIFIED_DATE, DB_FIELD_MEDIA_MODIFIED_DATE, NULL},
-
- /* PVR */
- {PVR_DURATION, DB_FIELD_PVR_DURATION, NULL},
- {PVR_TIME_ZONE, DB_FIELD_PVR_TIME_ZONE, NULL},
- {PVR_PTC, DB_FIELD_PVR_PTC, NULL},
- {PVR_MAJOR, DB_FIELD_PVR_MAJOR, NULL},
- {PVR_MINOR, DB_FIELD_PVR_MINOR, NULL},
- {PVR_CHANNEL_TYPE, DB_FIELD_PVR_CHANNEL_TYPE, NULL},
- {PVR_CHANNEL_NAME, DB_FIELD_PVR_CHANNEL_NAME, NULL},
- {PVR_CHANNEL_NUM, DB_FIELD_PVR_CHANNEL_NUM, NULL},
- {PVR_PROGRAM_TITLE, DB_FIELD_PVR_PROGRAM_TITLE, NULL},
- {PVR_PROGRAM_NUM, DB_FIELD_PVR_PROGRAM_NUM, NULL},
- {PVR_PROGRAM_CRID, DB_FIELD_PVR_PROGRAM_CRID, NULL},
- {PVR_GUIDANCE, DB_FIELD_PVR_GUIDANCE, NULL},
- {PVR_SYNOPSIS, DB_FIELD_PVR_SYNOPSIS, NULL},
- {PVR_GENRE, DB_FIELD_PVR_GENRE, NULL},
- {PVR_LANGUAGE, DB_FIELD_PVR_LANGUAGE, NULL},
- {PVR_EMBARGO_TIME, DB_FIELD_PVR_EMBARGO_TIME, NULL},
- {PVR_EXPIRY_TIME, DB_FIELD_PVR_EXPIRY_TIME, NULL},
- {PVR_START_TIME, DB_FIELD_PVR_START_TIME, NULL},
- {PVR_PROGRAM_START_TIME, DB_FIELD_PVR_PROGRAM_START_TIME, NULL},
- {PVR_PROGRAM_END_TIME, DB_FIELD_PVR_PROGRAM_END_TIME, NULL},
- {PVR_PROGRAM_DATE, DB_FIELD_PVR_PROGRAM_DATE, NULL},
- {PVR_PARENTAL_RATING, DB_FIELD_PVR_PARENTAL_RATING, NULL},
- {PVR_TIMER_RECORD, DB_FIELD_PVR_TIMER_RECORD, NULL},
- {PVR_SERIES_RECORD, DB_FIELD_PVR_SERIES_RECORD, NULL},
- {PVR_HD, DB_FIELD_PVR_HD, NULL},
- {PVR_SUBTITLE, DB_FIELD_PVR_SUBTITLE, NULL},
- {PVR_TTX, DB_FIELD_PVR_TTX, NULL},
- {PVR_AD, DB_FIELD_PVR_AD, NULL},
- {PVR_TTX, DB_FIELD_PVR_TTX, NULL},
- {PVR_DATA_SERVICE, DB_FIELD_PVR_DATA_SERVICE, NULL},
- {PVR_CONTENT_LOCK, DB_FIELD_PVR_CONTENT_LOCK, NULL},
- {PVR_CONTENT_WATCH, DB_FIELD_PVR_CONTENT_WATCH, NULL},
- {PVR_CONTENT_HAS_AUDIO_ONLY, DB_FIELD_PVR_HAS_AUDIO_ONLY, NULL},
- {PVR_CONTENT_IS_LOCAL_RECORD, DB_FIELD_PVR_IS_LOCAL_RECORD, NULL},
- {PVR_CONTENT_RESOLUTION, DB_FIELD_PVR_RESOLUTION, NULL},
- {PVR_CONTENT_ASPECTRATIO, DB_FIELD_PVR_ASPECTRATIO, NULL},
- {PVR_MODIFIED_MONTH, DB_FIELD_PVR_MODIFIED_DATE, NULL},
- {PVR_MODIFIED_DATE, DB_FIELD_PVR_MODIFIED_DATE, NULL},
- {PVR_SPORTS_TYPE, DB_FIELD_PVR_SPORTS_TYPE, NULL},
- {PVR_GUIDANCE_LENGTH, DB_FIELD_PVR_GUIDANCE_LENGTH, NULL},
- {PVR_TVMODE, DB_FIELD_PVR_TVMODE, NULL},
- {PVR_PLAY_COUNT, DB_FIELD_PVR_PLAY_COUNT, NULL},
- {PVR_PRIVATE_DATA, DB_FIELD_PVR_PRIVATE_DATA, NULL},
-
- /* UHD */
- {UHD_CONTENT_TITLE, DB_FIELD_UHD_CONTENT_TITLE, NULL},
- {UHD_RELEASE_DATE, DB_FIELD_UHD_RELEASE_DATE, NULL},
- {UHD_SUB_TYPE, DB_FIELD_UHD_SUB_TYPE, NULL},
- {UHD_FILE_NAME, DB_FIELD_UHD_FILE_NAME, NULL},
- {UHD_FOLDER_ID, DB_FIELD_FOLDER_ID, NULL},
- {UHD_PLAYED_COUNT, DB_FIELD_UHD_PLAYED_COUNT, NULL},
-#endif
-};
-
-#if 0
-static int __media_content_create_attr_handle(void)
+sqlite3 * _content_get_db_handle(void)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- ret = _media_filter_attribute_create(&g_attr_handle);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Media Info */
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ID, DB_FIELD_MEDIA_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_PATH, DB_FIELD_MEDIA_PATH);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_DISPLAY_NAME, DB_FIELD_MEDIA_DISPLAY_NAME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_TYPE, DB_FIELD_MEDIA_TYPE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_MIME_TYPE, DB_FIELD_MEDIA_MIME_TYPE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_SIZE, DB_FIELD_MEDIA_SIZE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ADDED_TIME, DB_FIELD_MEDIA_ADDED_TIME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_MODIFIED_TIME, DB_FIELD_MEDIA_MODIFIED_TIME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_TIMELINE, DB_FIELD_MEDIA_TIMELINE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_THUMBNAIL_PATH, DB_FIELD_MEDIA_THUMBNAIL_PATH);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_TITLE, DB_FIELD_MEDIA_TITLE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ALBUM, DB_FIELD_MEDIA_ALBUM);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ARTIST, DB_FIELD_MEDIA_ARTIST);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ALBUM_ARTIST, DB_FIELD_MEDIA_ALBUM_ARTIST);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_GENRE, DB_FIELD_MEDIA_GENRE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_COMPOSER, DB_FIELD_MEDIA_COMPOSER);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_YEAR, DB_FIELD_MEDIA_YEAR);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_RECORDED_DATE, DB_FIELD_MEDIA_RECORDED_DATE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_COPYRIGHT, DB_FIELD_MEDIA_COPYRIGHT);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_TRACK_NUM, DB_FIELD_MEDIA_TRACK_NUM);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_DESCRIPTION, DB_FIELD_MEDIA_DESCRIPTION);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_BITRATE, DB_FIELD_MEDIA_BITRATE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_BITPERSAMPLE, DB_FIELD_MEDIA_BITPERSAMPLE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_SAMPLERATE, DB_FIELD_MEDIA_SAMPLERATE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_CHANNEL, DB_FIELD_MEDIA_CHANNEL);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_DURATION, DB_FIELD_MEDIA_DURATION);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_LONGITUDE, DB_FIELD_MEDIA_LONGITUDE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_LATITUDE, DB_FIELD_MEDIA_LATITUDE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ALTITUDE, DB_FIELD_MEDIA_ALTITUDE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_WIDTH, DB_FIELD_MEDIA_WIDTH);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_HEIGHT, DB_FIELD_MEDIA_HEIGHT);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_DATETAKEN, DB_FIELD_MEDIA_DATETAKEN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ORIENTATION, DB_FIELD_MEDIA_ORIENTATION);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_BURST_ID, DB_FIELD_MEDIA_BURST_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_PLAYED_COUNT, DB_FIELD_MEDIA_PLAYED_COUNT);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_LAST_PLAYED_TIME, DB_FIELD_MEDIA_LAST_PLAYED_TIME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_LAST_PLAYED_POSITION, DB_FIELD_MEDIA_LAST_PLAYED_POSITION);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_RATING, DB_FIELD_MEDIA_RATING);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_FAVOURITE, DB_FIELD_MEDIA_FAVOURITE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_AUTHOR, DB_FIELD_MEDIA_AUTHOR);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_PROVIDER, DB_FIELD_MEDIA_PROVIDER);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_CONTENT_NAME, DB_FIELD_MEDIA_CONTENT_NAME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_CATEGORY, DB_FIELD_MEDIA_CATEGORY);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_LOCATION_TAG, DB_FIELD_MEDIA_LOCATION_TAG);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_AGE_RATING, DB_FIELD_MEDIA_AGE_RATING);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_KEYWORD, DB_FIELD_MEDIA_KEYWORD);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_WEATHER, DB_FIELD_MEDIA_WEATHER);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_IS_DRM, DB_FIELD_MEDIA_IS_DRM);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_STORAGE_TYPE, DB_FIELD_MEDIA_STORAGE_TYPE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_360, DB_FIELD_MEDIA_360);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Pinyin*/
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_FILE_NAME_PINYIN, DB_FIELD_MEDIA_FILE_NAME_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_TITLE_PINYIN, DB_FIELD_MEDIA_TITLE_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ALBUM_PINYIN, DB_FIELD_MEDIA_ALBUM_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ARTIST_PINYIN, DB_FIELD_MEDIA_ARTIST_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_ALBUM_ARTIST_PINYIN, DB_FIELD_MEDIA_ALBUM_ARTIST_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_GENRE_PINYIN, DB_FIELD_MEDIA_GENRE_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_COMPOSER_PINYIN, DB_FIELD_MEDIA_COMPOSER_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_COPYRIGHT_PINYIN, DB_FIELD_MEDIA_COPYRIGHT_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_DESCRIPTION_PINYIN, DB_FIELD_MEDIA_DESCRIPTION_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_AUTHOR_PINYIN, DB_FIELD_MEDIA_AUTHOR_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_PROVIDER_PINYIN, DB_FIELD_MEDIA_PROVIDER_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_CONTENT_NAME_PINYIN, DB_FIELD_MEDIA_CONTENT_NAME_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_CATEGORY_PINYIN, DB_FIELD_MEDIA_CATEGORY_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_LOCATION_TAG_PINYIN, DB_FIELD_MEDIA_LOCATION_TAG_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_AGE_RATING_PINYIN, DB_FIELD_MEDIA_AGE_RATING_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_KEYWORD_PINYIN, DB_FIELD_MEDIA_KEYWORD_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Playlist*/
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_PLAYLIST_ID, DB_FIELD_PLAYLIST_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PLAYLIST_NAME, DB_FIELD_PLAYLIST_NAME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PLAYLIST_MEMBER_ORDER, DB_FIELD_PLAYLIST_MEMBER_ORDER);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Playlist View */
- ret = _media_filter_attribute_add(g_attr_handle, PLAYLIST_MEDIA_COUNT, DB_FIELD_PLAYLIST_MEDIA_COUNT);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Tag*/
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_TAG_ID, DB_FIELD_TAG_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, TAG_NAME, DB_FIELD_TAG_NAME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Tag View */
- ret = _media_filter_attribute_add(g_attr_handle, TAG_MEDIA_COUNT, DB_FIELD_TAG_MEDIA_COUNT);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Bookmark*/
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_BOOKMARK_ID, DB_FIELD_BOOKMARK_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, BOOKMARK_MARKED_TIME, DB_FIELD_BOOKMARK_MARKED_TIME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, BOOKMARK_NAME, DB_FIELD_BOOKMARK_NAME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Storage*/
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_STORAGE_ID, DB_FIELD_STORAGE_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_STORAGE_PATH, DB_FIELD_STORAGE_PATH);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Face */
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_FACE_TAG, DB_FIELD_FACE_TAG);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_FACE_ID, DB_FIELD_FACE_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
-#ifdef _USE_SENIOR_MODE
- if (_media_content_is_support_senior_mode()) {
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_CONTACT, DB_FIELD_MEDIA_CONTACT);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_APP_DATA, DB_FIELD_MEDIA_APP_DATA);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- }
-#endif
-#ifdef _USE_TV_PROFILE
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_FOLDER_ID, DB_FIELD_MEDIA_FOLDER_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_STITCHED_INFO, DB_FIELD_MEDIA_STITCHED_INFO);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_MODIFIED_MONTH, DB_FIELD_MEDIA_MODIFIED_MONTH);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_MODIFIED_DATE, DB_FIELD_MEDIA_MODIFIED_DATE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* PVR*/
- ret = _media_filter_attribute_add(g_attr_handle, PVR_DURATION, DB_FIELD_PVR_DURATION);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_TIME_ZONE, DB_FIELD_PVR_TIME_ZONE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_PTC, DB_FIELD_PVR_PTC);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_MAJOR, DB_FIELD_PVR_MAJOR);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_MINOR, DB_FIELD_PVR_MINOR);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_CHANNEL_TYPE, DB_FIELD_PVR_CHANNEL_TYPE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_CHANNEL_NAME, DB_FIELD_PVR_CHANNEL_NAME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_CHANNEL_NUM, DB_FIELD_PVR_CHANNEL_NUM);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_PROGRAM_TITLE, DB_FIELD_PVR_PROGRAM_TITLE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_PROGRAM_NUM, DB_FIELD_PVR_PROGRAM_NUM);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_PROGRAM_CRID, DB_FIELD_PVR_PROGRAM_CRID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_GUIDANCE, DB_FIELD_PVR_GUIDANCE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_SYNOPSIS, DB_FIELD_PVR_SYNOPSIS);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_GENRE, DB_FIELD_PVR_GENRE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_LANGUAGE, DB_FIELD_PVR_LANGUAGE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_EMBARGO_TIME, DB_FIELD_PVR_EMBARGO_TIME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_EXPIRY_TIME, DB_FIELD_PVR_EXPIRY_TIME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_START_TIME, DB_FIELD_PVR_START_TIME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_PROGRAM_START_TIME, DB_FIELD_PVR_PROGRAM_START_TIME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_PROGRAM_END_TIME, DB_FIELD_PVR_PROGRAM_END_TIME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_PROGRAM_DATE, DB_FIELD_PVR_PROGRAM_DATE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_PARENTAL_RATING, DB_FIELD_PVR_PARENTAL_RATING);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_TIMER_RECORD, DB_FIELD_PVR_TIMER_RECORD);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_SERIES_RECORD, DB_FIELD_PVR_SERIES_RECORD);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_HD, DB_FIELD_PVR_HD);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_SUBTITLE, DB_FIELD_PVR_SUBTITLE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_TTX, DB_FIELD_PVR_TTX);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_AD, DB_FIELD_PVR_AD);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_TTX, DB_FIELD_PVR_TTX);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_DATA_SERVICE, DB_FIELD_PVR_DATA_SERVICE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_CONTENT_LOCK, DB_FIELD_PVR_CONTENT_LOCK);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_CONTENT_WATCH, DB_FIELD_PVR_CONTENT_WATCH);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_CONTENT_HAS_AUDIO_ONLY, DB_FIELD_PVR_HAS_AUDIO_ONLY);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_CONTENT_IS_LOCAL_RECORD, DB_FIELD_PVR_IS_LOCAL_RECORD);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_CONTENT_RESOLUTION, DB_FIELD_PVR_RESOLUTION);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_CONTENT_ASPECTRATIO, DB_FIELD_PVR_ASPECTRATIO);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_MODIFIED_MONTH, DB_FIELD_PVR_MODIFIED_DATE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_MODIFIED_DATE, DB_FIELD_PVR_MODIFIED_DATE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_SPORTS_TYPE, DB_FIELD_PVR_SPORTS_TYPE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_GUIDANCE_LENGTH, DB_FIELD_PVR_GUIDANCE_LENGTH);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_TVMODE, DB_FIELD_PVR_TVMODE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_PLAY_COUNT, DB_FIELD_PVR_PLAY_COUNT);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, PVR_PRIVATE_DATA, DB_FIELD_PVR_PRIVATE_DATA);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* UHD*/
- ret = _media_filter_attribute_add(g_attr_handle, UHD_CONTENT_TITLE, DB_FIELD_UHD_CONTENT_TITLE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, UHD_RELEASE_DATE, DB_FIELD_UHD_RELEASE_DATE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, UHD_SUB_TYPE, DB_FIELD_UHD_SUB_TYPE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, UHD_FILE_NAME, DB_FIELD_UHD_FILE_NAME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, UHD_FOLDER_ID, DB_FIELD_FOLDER_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, UHD_PLAYED_COUNT, DB_FIELD_UHD_PLAYED_COUNT);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-#endif
- return ret;
-}
-
-static int __media_content_create_alias_attr_handle(void)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- ret = _media_filter_attribute_create(&g_alias_attr_handle);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Media Info */
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ID, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_PATH, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_PATH);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_DISPLAY_NAME, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_DISPLAY_NAME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_TYPE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_TYPE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_MIME_TYPE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_MIME_TYPE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_SIZE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_SIZE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ADDED_TIME, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ADDED_TIME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_MODIFIED_TIME, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_MODIFIED_TIME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_TIMELINE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_TIMELINE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-#ifdef _USE_TV_PROFILE
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_FOLDER_ID, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_FOLDER_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-#endif
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_THUMBNAIL_PATH, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_THUMBNAIL_PATH);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_TITLE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_TITLE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ALBUM, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ALBUM);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ARTIST, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ARTIST);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ALBUM_ARTIST, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ALBUM_ARTIST);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_GENRE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_GENRE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_COMPOSER, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_COMPOSER);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_YEAR, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_YEAR);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_RECORDED_DATE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_RECORDED_DATE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_COPYRIGHT, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_COPYRIGHT);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_TRACK_NUM, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_TRACK_NUM);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_DESCRIPTION, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_DESCRIPTION);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_BITRATE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_BITRATE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_BITPERSAMPLE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_BITPERSAMPLE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_SAMPLERATE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_SAMPLERATE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_CHANNEL, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_CHANNEL);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_DURATION, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_DURATION);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_LONGITUDE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_LONGITUDE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_LATITUDE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_LATITUDE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ALTITUDE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ALTITUDE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_WIDTH, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_WIDTH);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_HEIGHT, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_HEIGHT);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_DATETAKEN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_DATETAKEN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ORIENTATION, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ORIENTATION);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_BURST_ID, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_BURST_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_PLAYED_COUNT, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_PLAYED_COUNT);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_LAST_PLAYED_TIME, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_LAST_PLAYED_TIME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_LAST_PLAYED_POSITION, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_LAST_PLAYED_POSITION);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_RATING, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_RATING);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_FAVOURITE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_FAVOURITE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_AUTHOR, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_AUTHOR);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_PROVIDER, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_PROVIDER);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_CONTENT_NAME, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_CONTENT_NAME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_CATEGORY, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_CATEGORY);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_LOCATION_TAG, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_LOCATION_TAG);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_AGE_RATING, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_AGE_RATING);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_KEYWORD, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_KEYWORD);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_WEATHER, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_WEATHER);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_IS_DRM, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_IS_DRM);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_STORAGE_TYPE, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_STORAGE_TYPE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_360, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_360);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
-#ifdef _USE_SENIOR_MODE
- if (_media_content_is_support_senior_mode()) {
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_CONTACT, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_CONTACT);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_APP_DATA, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_APP_DATA);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- }
-#endif
-
- /* Pinyin*/
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_FILE_NAME_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_FILE_NAME_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_TITLE_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_TITLE_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ALBUM_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ALBUM_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ARTIST_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ARTIST_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_ALBUM_ARTIST_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_ALBUM_ARTIST_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_GENRE_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_GENRE_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_COMPOSER_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_COMPOSER_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_COPYRIGHT_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_COPYRIGHT_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_DESCRIPTION_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_DESCRIPTION_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_AUTHOR_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_AUTHOR_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_PROVIDER_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_PROVIDER_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_CONTENT_NAME_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_CONTENT_NAME_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_CATEGORY_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_CATEGORY_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_LOCATION_TAG_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_LOCATION_TAG_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_AGE_RATING_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_AGE_RATING_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, MEDIA_KEYWORD_PINYIN, DB_TABLE_ALIAS_MEDIA"."DB_FIELD_MEDIA_KEYWORD_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Folder */
- ret = _media_filter_attribute_add(g_alias_attr_handle, FOLDER_ID, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, FOLDER_PATH, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_PATH);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, FOLDER_NAME, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_NAME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, FOLDER_MODIFIED_TIME, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_MODIFIED_TIME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, FOLDER_STORAGE_TYPE, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_STORAGE_TYPE);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, FOLDER_NAME_PINYIN, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_NAME_PINYIN);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, FOLDER_ORDER, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_ORDER);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, FOLDER_PARENT_FOLDER_ID, DB_TABLE_ALIAS_FOLDER"."DB_FIELD_FOLDER_PARENT_FOLDER_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Playlist*/
- ret = _media_filter_attribute_add(g_alias_attr_handle, PLAYLIST_NAME, DB_TABLE_ALIAS_PLAYLIST"."DB_FIELD_PLAYLIST_NAME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, PLAYLIST_MEMBER_ORDER, DB_TABLE_ALIAS_PLAYLIST_MAP"."DB_FIELD_PLAYLIST_MEMBER_ORDER);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Tag*/
- ret = _media_filter_attribute_add(g_alias_attr_handle, TAG_NAME, DB_TABLE_ALIAS_TAG"."DB_FIELD_TAG_NAME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Bookmark*/
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_BOOKMARK_ID, DB_TABLE_ALIAS_BOOKMARK"."DB_FIELD_BOOKMARK_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, BOOKMARK_MARKED_TIME, DB_TABLE_ALIAS_BOOKMARK"."DB_FIELD_BOOKMARK_MARKED_TIME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_alias_attr_handle, BOOKMARK_NAME, DB_TABLE_ALIAS_BOOKMARK"."DB_FIELD_BOOKMARK_NAME);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- /* Face */
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_FACE_TAG, DB_TABLE_ALIAS_FACE"."DB_FIELD_FACE_TAG);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_add(g_attr_handle, MEDIA_FACE_ID, DB_TABLE_ALIAS_FACE"."DB_FIELD_FACE_ID);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- return ret;
+ return db_handle;
}
-static int __media_content_create_attribute_handle(void)
+uid_t _content_get_uid(void)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- ret = __media_content_create_attr_handle();
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = __media_content_create_alias_attr_handle();
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- _media_filter_attribute_destory(g_attr_handle);
-
- return ret;
+ if (content_g_uid == 0)
+ return tzplatform_getuid(TZ_USER_NAME);
+ else
+ return content_g_uid;
}
-#endif
-static int __media_content_create_attribute_handles(void)
+int _content_query_prepare(const char *select_query, const char *condition_query, const char *option_query, sqlite3_stmt **stmt)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- int idx = 0;
- int count = 0;
- char *_attr_user = NULL;
- char *_attr_platform = NULL;
- char *_alias_attr_user = NULL;
- char *_alias_attr_platform = NULL;
-
- ret = _media_filter_attribute_create(&g_attr_handle);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = _media_filter_attribute_create(&g_alias_attr_handle);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- goto ERROR;
- }
-
- attribute_s *_attr = (attribute_s*)g_attr_handle;
- attribute_s *_alias_attr = (attribute_s*)g_alias_attr_handle;
-
- count = sizeof(g_content_attrs_info) / sizeof((g_content_attrs_info)[0]);
-
- for (idx = 0; idx < count; idx++) {
- _attr_user = NULL;
- _attr_platform = NULL;
- _alias_attr_user = NULL;
- _alias_attr_platform = NULL;
-
- if (STRING_VALID(g_content_attrs_info[idx].user_attr)) {
- /*attribute*/
- if (STRING_VALID(g_content_attrs_info[idx].platform_attr)) {
- _attr_user = g_strdup(g_content_attrs_info[idx].user_attr);
- _attr_platform = g_strdup(g_content_attrs_info[idx].platform_attr);
-
- if (_attr_user == NULL || _attr_platform == NULL) {
- SAFE_G_FREE(_attr_user);
- SAFE_G_FREE(_attr_platform);
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- ret = MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- goto ERROR;
- }
-
- g_hash_table_insert(_attr->attr_map, _attr_user, _attr_platform);
+ char *query = NULL;
- }
-
- /*alias attribute*/
- if (STRING_VALID(g_content_attrs_info[idx].platform_alias_attr)) {
- _alias_attr_user = g_strdup(g_content_attrs_info[idx].user_attr);
- _alias_attr_platform = g_strdup(g_content_attrs_info[idx].platform_alias_attr);
-
- if (_alias_attr_user == NULL || _alias_attr_platform == NULL) {
- SAFE_G_FREE(_alias_attr_user);
- SAFE_G_FREE(_alias_attr_platform);
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- ret = MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- goto ERROR;
- }
+ media_content_retvm_if(!STRING_VALID(select_query), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid select_query");
- g_hash_table_insert(_alias_attr->attr_map, _alias_attr_user, _alias_attr_platform);
- }
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- goto ERROR;
- }
+ if (STRING_VALID(condition_query)) {
+ if (STRING_VALID(option_query))
+ query = sqlite3_mprintf("%s AND %s %s", select_query, condition_query, option_query);
+ else
+ query = sqlite3_mprintf("%s AND %s", select_query, condition_query);
+ } else {
+ if (STRING_VALID(option_query))
+ query = sqlite3_mprintf("%s %s", select_query, option_query);
+ else
+ query = sqlite3_mprintf("%s", select_query);
}
- return ret;
-
-ERROR:
- media_content_error("Fail media_content_create_attribute_handles");
- __media_content_destroy_attribute_handle();
-
- return ret;
-}
-
-static int __media_content_destroy_attribute_handle(void)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
- ret = _media_filter_attribute_destory(g_attr_handle);
- ret = _media_filter_attribute_destory(g_alias_attr_handle);
-
- g_attr_handle = NULL;
- g_alias_attr_handle = NULL;
+ ret = _content_get_result(query, stmt);
+ SQLITE3_SAFE_FREE(query);
return ret;
}
-attribute_h _content_get_attirbute_handle(void)
-{
- return g_attr_handle;
-}
-
-attribute_h _content_get_alias_attirbute_handle(void)
-{
- return g_alias_attr_handle;
-}
-
-MediaSvcHandle* _content_get_db_handle(void)
-{
- return db_handle;
-}
-
-uid_t _content_get_uid(void)
+int _content_get_result(char *query, sqlite3_stmt **stmt)
{
- if (content_g_uid == 0)
- return tzplatform_getuid(TZ_USER_NAME);
- else
- return content_g_uid;
-}
-
-int _content_query_prepare(sqlite3_stmt **stmt, char *select_query, char *condition_query, char *option_query)
-{
- int len = 0;
int err = MEDIA_CONTENT_ERROR_NONE;
- char query[MAX_QUERY_SIZE] = {0, };
- memset(query, '\0', sizeof(query));
-
- media_content_retvm_if(db_handle == NULL, MEDIA_CONTENT_ERROR_DB_FAILED, "database is not connected");
- media_content_retvm_if(!STRING_VALID(select_query), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid select_query");
- if (!STRING_VALID(condition_query))
- condition_query = (char *)" ";
+ media_content_retvm_if(_content_get_db_handle() == NULL, MEDIA_CONTENT_ERROR_DB_FAILED, "database is not connected");
+ media_content_retvm_if(!STRING_VALID(query), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid query");
- if (!STRING_VALID(option_query))
- option_query = (char *)" ";
+ media_content_sec_debug("Query[%s]", query);
- /*query = sqlite3_mprintf("%s %s %s", select_query, condition_query, option_query);*/
- len = snprintf(query, sizeof(query), "%s %s %s", select_query, condition_query, option_query);
- if (len > 0 && len < sizeof(query))
- query[len] = '\0';
- else if (len >= sizeof(query))
- query[MAX_QUERY_SIZE -1] = '\0';
- else {
- media_content_error("snprintf failed");
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- media_content_sec_debug("Query : [%s]", query);
-
- err = sqlite3_prepare_v2((sqlite3*)db_handle, query, strlen(query), stmt, NULL);
+ err = sqlite3_prepare_v2(_content_get_db_handle(), query, strlen(query), stmt, NULL);
if (err != SQLITE_OK) {
- media_content_error("DB_FAILED(0x%08x) fail to sqlite3_prepare(), %s", MEDIA_CONTENT_ERROR_DB_FAILED, sqlite3_errmsg((sqlite3*)db_handle));
-
- if (err == SQLITE_BUSY) {
- media_content_error(" BUSY ERROR");
+ media_content_error("Failed to sqlite3_prepare_v2[%s]", sqlite3_errmsg(_content_get_db_handle()));
+ if (err == SQLITE_BUSY)
return MEDIA_CONTENT_ERROR_DB_BUSY;
- } else if (err == SQLITE_PERM) {
- media_content_error("PERMISSION EROR");
+ else if (err == SQLITE_PERM)
return MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
- } else {
- media_content_error("OTHER ERROR");
+ else
return MEDIA_CONTENT_ERROR_DB_FAILED;
- }
}
return MEDIA_CONTENT_ERROR_NONE;
char query[MAX_QUERY_SIZE] = {0, };
memset(query, '\0', sizeof(query));
- media_content_retvm_if(db_handle == NULL, MEDIA_CONTENT_ERROR_DB_FAILED, "database is not connected");
+ media_content_retvm_if(_content_get_db_handle() == NULL, MEDIA_CONTENT_ERROR_DB_FAILED, "database is not connected");
media_content_retvm_if(!STRING_VALID(select_query1), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid select_query1");
media_content_retvm_if(!STRING_VALID(select_query2), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid select_query2");
media_content_sec_debug("Query : [%s]", query);
- err = sqlite3_prepare_v2((sqlite3*)db_handle, query, strlen(query), stmt, NULL);
+ err = sqlite3_prepare_v2(_content_get_db_handle(), query, strlen(query), stmt, NULL);
if (err != SQLITE_OK) {
- media_content_error("DB_FAILED(0x%08x) fail to sqlite3_prepare(), %s", MEDIA_CONTENT_ERROR_DB_FAILED, sqlite3_errmsg((sqlite3*)db_handle));
+ media_content_error("DB_FAILED(0x%08x) fail to sqlite3_prepare(), %s", MEDIA_CONTENT_ERROR_DB_FAILED, sqlite3_errmsg(_content_get_db_handle()));
if (err == SQLITE_BUSY) {
media_content_error(" BUSY ERROR");
}
#endif
-int _content_error_capi(int type, int content_error)
+int _content_error_capi(int internal_error)
{
- if (content_error != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("[type : %d] content_error : %d ", type, content_error);
-
- /*Error None*/
- if (content_error == MS_MEDIA_ERR_NONE)
+ if (internal_error == MS_MEDIA_ERR_NONE)
return MEDIA_CONTENT_ERROR_NONE;
- /* Internal operation error*/
- else if ((content_error == MS_MEDIA_ERR_INVALID_PARAMETER) ||
- (content_error == MS_MEDIA_ERR_INVALID_PATH) ||
- (content_error == MS_MEDIA_ERR_THUMB_DUPLICATED_REQUEST))
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ media_content_error("MS Error[%d]", internal_error);
- else if (content_error == MS_MEDIA_ERR_OUT_OF_MEMORY)
+ switch (internal_error) {
+ case MS_MEDIA_ERR_INVALID_PARAMETER:
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ case MS_MEDIA_ERR_OUT_OF_MEMORY:
return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
-
- /* DB operation error*/
- else if (content_error == MS_MEDIA_ERR_DB_BUSY_FAIL)
+ case MS_MEDIA_ERR_DB_BUSY_FAIL:
return MEDIA_CONTENT_ERROR_DB_BUSY;
-
- else if ((content_error <= MS_MEDIA_ERR_DB_CONNECT_FAIL) && (content_error >= MS_MEDIA_ERR_DB_INTERNAL))
+ case MS_MEDIA_ERR_DB_CONSTRAINT_FAIL:
+ case MS_MEDIA_ERR_DB_NO_RECORD:
+ case MS_MEDIA_ERR_DB_CORRUPT:
+ case MS_MEDIA_ERR_DB_FULL_FAIL:
+ case MS_MEDIA_ERR_DB_RESET:
+ case MS_MEDIA_ERR_DB_INTERNAL:
return MEDIA_CONTENT_ERROR_DB_FAILED;
-
- /* IPC operation error*/
- else if ((content_error <= MS_MEDIA_ERR_SOCKET_CONN) && (content_error >= MS_MEDIA_ERR_SOCKET_INTERNAL))
+ case MS_MEDIA_ERR_IPC:
return MEDIA_CONTENT_ERROR_NETWORK;
-
- /* MEDIA SERVER error*/
- else if (content_error == MS_MEDIA_ERR_PERMISSION_DENIED)
+ case MS_MEDIA_ERR_PERMISSION_DENIED:
return MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
-
- /* Thumbnail error*/
- else if ((content_error == MS_MEDIA_ERR_THUMB_TOO_BIG) || (content_error == MS_MEDIA_ERR_THUMB_UNSUPPORTED))
- return MEDIA_CONTENT_ERROR_UNSUPPORTED_CONTENT;
-
- /*ETC*/
- return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
+ case MS_MEDIA_ERR_THUMB_TOO_BIG:
+ case MS_MEDIA_ERR_THUMB_UNSUPPORTED:
+ return MEDIA_CONTENT_ERROR_UNSUPPORTED_CONTENT;
+ default:
+ return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
+ }
}
int _content_query_sql(char *query_str)
int ret = MEDIA_CONTENT_ERROR_NONE;
/*DB will be updated by Media Server.*/
- ret = media_svc_request_update_db(query_str, _content_get_uid());
+ ret = media_db_request_update_db(query_str, _content_get_uid());
- return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ return _content_error_capi(ret);
}
int media_content_connect(void)
if (ref_count == 0) {
if (db_handle == NULL) {
- ret = __media_content_create_attribute_handles();
- if (ret == MEDIA_CONTENT_ERROR_NONE) {
- ret = media_svc_connect(&db_handle, _content_get_uid(), false);
- ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);
- if (ret == MEDIA_CONTENT_ERROR_NONE)
- ref_count++;
- else
- __media_content_destroy_attribute_handle();
-
- } else {
- media_content_error("Internal DB Connection Error");
- }
+ ret = media_db_connect(&db_handle, _content_get_uid(), false);
+ ret = _content_error_capi(ret);
+ if (ret == MEDIA_CONTENT_ERROR_NONE)
+ ref_count++;
} else {
media_content_error("Wrong DB Connection status");
ret = MEDIA_CONTENT_ERROR_DB_FAILED;
int media_content_disconnect(void)
{
- int ret = MEDIA_CONTENT_ERROR_NONE;
-
g_mutex_lock(&db_mutex);
media_content_debug("ref count : %d", ref_count);
- if (ref_count > 0) {
- if (db_handle != NULL) {
- ref_count--;
- } else {
- media_content_error("Wrong DB Handle status");
- ret = MEDIA_CONTENT_ERROR_DB_FAILED;
+
+ if (db_handle && ref_count > 0) {
+ if (--ref_count == 0) {
+ media_db_disconnect(db_handle);
+ db_handle = NULL;
}
} else {
- media_content_error("DB_FAILED(0x%08x) database is not connected", MEDIA_CONTENT_ERROR_DB_FAILED);
+ media_content_error("Database is not connected");
g_mutex_unlock(&db_mutex);
return MEDIA_CONTENT_ERROR_DB_FAILED;
}
- if (ref_count == 0) {
- if (db_handle != NULL) {
- ret = media_svc_disconnect(db_handle);
- ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);
- if (ret == MEDIA_CONTENT_ERROR_NONE) {
- ret = __media_content_destroy_attribute_handle();
- db_handle = NULL;
- } else {
- media_content_error("database disconnect fail");
- ref_count++;
- }
- } else {
- media_content_error("Wrong DB Handle status");
- ret = MEDIA_CONTENT_ERROR_DB_FAILED;
- }
-
- g_mutex_unlock(&db_mutex);
-
- media_content_info("ref count changed to: %d", ref_count);
-
- return ret;
- }
-
g_mutex_unlock(&db_mutex);
media_content_info("ref count changed to: %d", ref_count);
- return ret;
+ return MEDIA_CONTENT_ERROR_NONE;
}
int media_content_scan_file(const char *path)
media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid path");
media_content_sec_debug("Path : %s", path);
+
memset(repl_path, 0, sizeof(repl_path));
ret = _media_content_replace_path(path, repl_path);
media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, _content_get_uid());
if (ret != MS_MEDIA_ERR_NONE) {
media_content_error("media_svc_get_storage_id failed : %d", ret);
- return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ return _content_error_capi(ret);
}
check_file = _media_util_check_file_exist(repl_path);
/* This means this path has to be inserted or refreshed */
folder_path = g_path_get_dirname(repl_path);
ret = _media_util_check_ignore_dir(folder_path, &ignore_dir);
- SAFE_FREE(folder_path);
+ g_free(folder_path);
media_content_retvm_if(ignore_dir == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
+ /* check feature */
+ media_content_retvm_if(!_media_util_check_support_media_type(repl_path), MEDIA_CONTENT_ERROR_NOT_SUPPORTED, "Unsupported media type");
- media_svc_storage_type_e storage_type;
+ ms_user_storage_type_e storage_type;
- ret = media_svc_get_storage_type(repl_path, &storage_type, _content_get_uid());
+ ret = ms_user_get_storage_type(_content_get_uid(), repl_path, &storage_type);
if (ret != MS_MEDIA_ERR_NONE) {
- media_content_sec_error("media_svc_get_storage_type failed : %d (%s)", ret, repl_path);
- return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ media_content_sec_error("ms_user_get_storage_type failed : %d (%s)", ret, repl_path);
+ return _content_error_capi(ret);
}
ret = media_svc_check_item_exist_by_path(_content_get_db_handle(), storage_id, repl_path);
if (ret == MS_MEDIA_ERR_NONE) {
/* Refresh */
- ret = media_svc_refresh_item(_content_get_db_handle(), storage_id, storage_type, repl_path, _content_get_uid());
+ ret = media_svc_refresh_item(_content_get_db_handle(), false, storage_id, storage_type, repl_path, _content_get_uid());
if (ret != MS_MEDIA_ERR_NONE) {
media_content_error("media_svc_refresh_item failed : %d", ret);
- return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ return _content_error_capi(ret);
}
} else if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
media_content_sec_error("media_svc_insert_item_immediately failed : %d (%s)", ret, repl_path);
}
- return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ return _content_error_capi(ret);
}
} else {
media_content_error("media_svc_check_item_exist_by_path failed : %d", ret);
- return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ return _content_error_capi(ret);
}
} else if (check_file == MEDIA_CONTENT_ERROR_PERMISSION_DENIED) {
media_content_error("You have no permission for this file %d", ret);
}
media_content_error("media_svc_delete_item_by_path failed : %d", ret);
- return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ return _content_error_capi(ret);
}
}
- return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ return _content_error_capi(ret);
}
void _media_content_scan_cb(media_request_result_s* result, void *user_data)
int err = -1;
media_content_scan_cb_data *cb_data = user_data;
- err = _content_error_capi(MEDIA_REGISTER_TYPE, result->result);
-#ifdef _USE_TV_PROFILE
+ err = _content_error_capi(result->result);
+#ifdef _USE_TVPD_MODE
if (result->request_type != MEDIA_REQUEST_SCAN_COMPLETE &&
- result->request_type != MEDIA_REQUEST_SCAN_PARTIAL) {
+ result->request_type != MEDIA_REQUEST_SCAN_PARTIAL &&
+ result->request_type != MEDIA_RECURSIVE_START) {
if (cb_data && cb_data->callback) {
media_content_debug("begin:User callback is being called now, result=%d", err);
cb_data->callback(err, cb_data->user_data);
return;
}
-#ifdef _USE_TV_PROFILE
+#ifdef _USE_TVPD_MODE
void _media_content_scan_cb_v2(media_request_result_s* result, void *user_data)
{
int err = -1;
media_content_complete_phase_e complete_phase = -1;
if (!cb_data)
media_content_debug("cb_data is NULL");
- err = _content_error_capi(MEDIA_REGISTER_TYPE, result->result);
+ err = _content_error_capi(result->result);
media_content_debug("result is %d", err);
if (result->request_type == MEDIA_REQUEST_SCAN_PARTIAL)
complete_phase = MEDIA_CONTENT_SCAN_COMPLETE;
else if (result->request_type == MEDIA_REQUEST_EXTRACT_COMPLETE)
complete_phase = MEDIA_CONTENT_EXTRACT_COMPLETE;
+ else if (result->request_type == MEDIA_RECURSIVE_START)
+ complete_phase = MEDIA_CONTENT_RECURSIVE_START;
if (cb_data && cb_data->callback)
cb_data->callback(err, complete_phase, cb_data->user_data);
media_content_debug("run error");
if ((result->request_type != MEDIA_REQUEST_SCAN_COMPLETE) &&
- (result->request_type != MEDIA_REQUEST_SCAN_PARTIAL))
+ (result->request_type != MEDIA_REQUEST_SCAN_PARTIAL) &&
+ (result->request_type != MEDIA_RECURSIVE_START))
SAFE_FREE(cb_data);
return;
}
#endif
-static int __media_content_check_dir(const char *path)
-{
- DIR *dp = NULL;
-
- dp = opendir(path);
- if (dp == NULL) {
- media_content_sec_error("path [%s]", path);
- media_content_stderror("open dir fail");
-
- if (errno == EACCES || errno == EPERM)
- return MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
- else
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- closedir(dp);
-
- return MEDIA_CONTENT_ERROR_NONE;
-}
-
int media_content_scan_folder(const char *path, bool is_recursive, media_scan_completed_cb callback, void *user_data)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
bool ignore_dir = FALSE;
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
char repl_path[MAX_PATH_LEN] = {0, };
- media_svc_storage_type_e storage_type = MEDIA_SVC_STORAGE_MAX;
+ ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
memset(repl_path, 0, sizeof(repl_path));
memset(storage_id, 0x00, sizeof(storage_id));
- ret = __media_content_check_dir(repl_path);
+ ret = _media_content_check_dir(repl_path);
media_content_retvm_if(ret == MEDIA_CONTENT_ERROR_PERMISSION_DENIED, ret, "Permission Denied");
if (ret == MEDIA_CONTENT_ERROR_NONE) {
/* If directory exist check that's ignore directory or not*/
- ret = _media_util_check_ignore_dir(repl_path, &ignore_dir);
- media_content_retvm_if(ignore_dir == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
+ ret = _media_util_check_ignore_dir(repl_path, &ignore_dir);
+ media_content_retvm_if((ignore_dir == TRUE || ret != MEDIA_CONTENT_ERROR_NONE), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
} else {
/* This means this folder has to be deleted */
/* Or, it is real invalid path.. check storage type */
- ret = media_svc_get_storage_type(repl_path, &storage_type, _content_get_uid());
+ ret = ms_user_get_storage_type(_content_get_uid(), repl_path, &storage_type);
if (ret != MS_MEDIA_ERR_NONE) {
- media_content_sec_error("media_svc_get_storage_type failed : %d (%s)", ret, repl_path);
- return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ media_content_sec_error("ms_user_get_storage_type failed : %d (%s)", ret, repl_path);
+ return _content_error_capi(ret);
}
media_content_debug("This path doesn't exists in file system... So will be deleted it from DB");
ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, _content_get_uid());
if (ret != MS_MEDIA_ERR_NONE) {
media_content_error("media_svc_get_storage_id failed : %d", ret);
- return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ return _content_error_capi(ret);
}
media_content_scan_cb_data *cb_data = NULL;
SAFE_FREE(cb_data);
}
- return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
+ return _content_error_capi(ret);
}
-#ifdef _USE_TV_PROFILE
+#ifdef _USE_TVPD_MODE
int media_content_scan_folder_v2(const char *path, bool is_recursive, media_scan_completed_cb_v2 callback, void *user_data)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
ret = _media_util_check_ignore_dir(path, &ignore_dir);
media_content_retvm_if(ignore_dir, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
- ret = __media_content_check_dir(path);
+ ret = _media_content_check_dir(path);
media_content_retvm_if(ret == MEDIA_CONTENT_ERROR_PERMISSION_DENIED, ret, "Permission Denied");
+ media_content_retvm_if(ret == MEDIA_CONTENT_ERROR_INVALID_PARAMETER, ret, "invalid path[%s]", path);
media_content_scan_cb_data_v2* cb_data = NULL;
cb_data = (media_content_scan_cb_data_v2*)malloc(sizeof(media_content_scan_cb_data_v2));
if (ret != MS_MEDIA_ERR_NONE)
media_content_error("media_directory_scanning_async failed : %d", ret);
- return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
+ return _content_error_capi(ret);
}
#endif
if (ret != MS_MEDIA_ERR_NONE)
media_content_error("media_directory_scanning_async failed : %d", ret);
- return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
+ return _content_error_capi(ret);
}
void _media_content_db_update_noti_cb(
char *mime_type,
void *user_data)
{
- int error_value = MEDIA_CONTENT_ERROR_NONE;
-
media_noti_cb_s *_noti_info = (media_noti_cb_s *)user_data;
- if (_noti_info != NULL) {
- if (_noti_info->update_noti_cb)
- _noti_info->update_noti_cb(error_value, pid, item, update_type, content_type, uuid, path, mime_type, _noti_info->user_data);
- }
-
- return;
-}
-
-int media_content_set_db_updated_cb(media_content_db_update_cb callback, void *user_data)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_warn("DEPRECATION WARNING: media_content_set_db_updated_cb() is deprecated and will be removed from next release. Use media_content_add_db_updated_cb() instead.");
-
- media_content_retvm_if(callback == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid callback");
- media_content_retvm_if(g_noti_info != NULL, MEDIA_CONTENT_ERROR_INVALID_OPERATION, "Noti callback is already set");
-
- g_noti_info = (media_noti_cb_s *)calloc(1, sizeof(media_noti_cb_s));
- media_content_retvm_if(g_noti_info == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
-
- g_noti_info->update_noti_cb = callback;
- g_noti_info->user_data = user_data;
-
- ret = media_db_update_subscribe(_media_content_db_update_noti_cb, (void *)g_noti_info);
-
- return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
-}
-
-int media_content_unset_db_updated_cb(void)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_content_warn("DEPRECATION WARNING: media_content_unset_db_updated_cb() is deprecated and will be removed from next release. Use media_content_remove_db_updated_cb() instead.");
-
- SAFE_FREE(g_noti_info);
- ret = media_db_update_unsubscribe();
-
- return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
+ if (_noti_info != NULL && _noti_info->update_noti_cb)
+ _noti_info->update_noti_cb(
+ MEDIA_CONTENT_ERROR_NONE,
+ pid,
+ item,
+ update_type,
+ content_type,
+ uuid,
+ path,
+ mime_type,
+ _noti_info->user_data);
}
int media_content_add_db_updated_cb(media_content_db_update_cb callback, void *user_data, media_content_noti_h *noti_handle)
int ret = MEDIA_CONTENT_ERROR_NONE;
media_noti_cb_s *noti_info = NULL;
- if (noti_handle == NULL) {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
-
- if (callback == NULL) {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ media_content_retvm_if(noti_handle == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "handle is NULL");
+ media_content_retvm_if(callback == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "callback is NULL");
noti_info = (media_noti_cb_s *)calloc(1, sizeof(media_noti_cb_s));
- if (noti_info == NULL) {
- media_content_error("Failed to create noti info");
- return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
- }
+ media_content_retvm_if(noti_info == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "Failed to create noti info");
noti_info->update_noti_cb = callback;
noti_info->user_data = user_data;
ret = media_db_update_subscribe_internal((MediaNotiHandle*)noti_handle, _media_content_db_update_noti_cb, (void *)noti_info);
+ if (ret != MS_MEDIA_ERR_NONE)
+ SAFE_FREE(noti_info);
+
+ return _content_error_capi(ret);
+}
+
+#ifdef TIZEN_FEATURE_COMPATIBILITY
+int media_content_set_db_updated_cb(media_content_db_update_cb callback, void *user_data)
+{
+ media_content_warn("DEPRECATION WARNING: media_content_set_db_updated_cb() is removed from 5.0.");
- return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
+ return MEDIA_CONTENT_ERROR_NONE;
}
+#endif
void __media_content_clear_user_data(void *user_data)
{
ret = media_db_update_unsubscribe_internal((MediaNotiHandle)noti_handle, __media_content_clear_user_data);
- return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
+ return _content_error_capi(ret);
}
-#ifdef _USE_TV_PROFILE
+#ifdef _USE_TVPD_MODE
GMutex* _content_get_db_mutex(void)
{
return &db_mutex;