diff options
-rw-r--r-- | debian/changelog | 8 | ||||
-rwxr-xr-x | include/media_content_type.h | 22 | ||||
-rw-r--r-- | include/media_folder.h | 4 | ||||
-rw-r--r-- | include/media_info.h | 2 | ||||
-rw-r--r-- | include/media_info_private.h | 17 | ||||
-rw-r--r-- | include/media_video.h | 2 | ||||
-rw-r--r-- | src/media_audio.c | 22 | ||||
-rw-r--r-- | src/media_content.c | 53 | ||||
-rw-r--r-- | src/media_filter.c | 8 | ||||
-rw-r--r-- | src/media_folder.c | 6 | ||||
-rw-r--r-- | src/media_image.c | 8 | ||||
-rw-r--r-- | src/media_info.c | 43 | ||||
-rw-r--r-- | src/media_tag.c | 19 | ||||
-rw-r--r-- | src/media_video.c | 17 |
14 files changed, 122 insertions, 109 deletions
diff --git a/debian/changelog b/debian/changelog index 374db7c..9749d11 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +capi-content-media-content (0.1.0-13) unstable; urgency=low + + * changed the query + * Git: api/media-content + * Tag: capi-content-media-content_0.1.0-13 + + -- Dongyoung Kim <dydot1.kim@samsung.com> Fri, 10 Feb 2012 16:27:25 +0900 + capi-content-media-content (0.1.0-10) unstable; urgency=low * Update the version. diff --git a/include/media_content_type.h b/include/media_content_type.h index 7849214..3907703 100755 --- a/include/media_content_type.h +++ b/include/media_content_type.h @@ -55,8 +55,8 @@ typedef enum */
typedef enum
{
- MEDIA_CONTENT_STORAGE_INTERNAL = 0x01 << 0, /**< The device's internal storage */
- MEDIA_CONTENT_STORAGE_EXTERNAL = 0x01 << 1, /**< The device's external storage */
+ MEDIA_CONTENT_STORAGE_INTERNAL, /**< The device's internal storage */
+ MEDIA_CONTENT_STORAGE_EXTERNAL, /**< The device's external storage */
//MEDIA_CONTENT_STORAGE_WEB = 0x01<< 2,
} media_content_storage_e;
@@ -132,7 +132,7 @@ typedef enum typedef enum
{
MEDIA_FOLDER_SEARCH_NONE = 0x00, /**< No Search */
- MEDIA_FOLDER_SEARCH_BY_FOLDER_NAME = 0x01 << 0, /**< The searchabe type folder name */
+ MEDIA_FOLDER_SEARCH_BY_FOLDER_NAME = 0x01 << 0, /**< The searchable type folder name */
}media_folder_search_type_e;
/**
@@ -142,11 +142,11 @@ typedef enum typedef enum
{
MEDIA_AUDIO_SEARCH_NONE = 0x00, /**< No Search */
- MEDIA_AUDIO_SEARCH_BY_PLAYLIST = 0x01 << 0, /**< The searchabe type of playlist */
- MEDIA_AUDIO_SEARCH_BY_ARTIST = 0x01 << 1, /**< The searchabe type of artist */
- MEDIA_AUDIO_SEARCH_BY_ALBUM = 0x01 << 2, /**< The searchabe type of album */
- MEDIA_AUDIO_SEARCH_BY_AUTHOR = 0x01 << 3, /**< The searchabe type of author */
- MEDIA_AUDIO_SEARCH_BY_GENRE = 0x01 << 4, /**< The searchabe type of genre */
+ MEDIA_AUDIO_SEARCH_BY_PLAYLIST = 0x01 << 0, /**< The searchable type of playlist */
+ MEDIA_AUDIO_SEARCH_BY_ARTIST = 0x01 << 1, /**< The searchable type of artist */
+ MEDIA_AUDIO_SEARCH_BY_ALBUM = 0x01 << 2, /**< The searchable type of album */
+ MEDIA_AUDIO_SEARCH_BY_AUTHOR = 0x01 << 3, /**< The searchable type of author */
+ MEDIA_AUDIO_SEARCH_BY_GENRE = 0x01 << 4, /**< The searchable type of genre */
}media_audio_search_type_e;
/**
@@ -156,7 +156,7 @@ typedef enum typedef enum
{
MEDIA_TAG_SEARCH_NONE = 0x00, /**< No Search */
- MEDIA_TAG_SEARCH_BY_TAG_NAME = 0x01 << 0, /**< The searchabe type folder name */
+ MEDIA_TAG_SEARCH_BY_TAG_NAME = 0x01 << 0, /**< The searchable type folder name */
}media_tag_search_type_e;
@@ -165,7 +165,7 @@ typedef enum /**
* @ingroup CAPI_CONTENT_MEDIA_FILTER_INFO_MODULE
- * @brief The handle to media infon filter.
+ * @brief The handle to media info filter.
*/
typedef struct media_info_filter_s* media_info_filter_h;
@@ -294,7 +294,7 @@ typedef bool (*media_folder_cb)(media_folder_h folder, void *user_data); *
* @remarks To use the @a media outside this function, copy the handle with #media_info_clone() function.
*
- * @param[in] media The hande to media info
+ * @param[in] media The handle to media info
* @param[in] user_data The user data passed from the foreach function
* @return true to continue with the next iteration of the loop,
* @return false to break out of the loop.
diff --git a/include/media_folder.h b/include/media_folder.h index e1f48bb..6aeb01f 100644 --- a/include/media_folder.h +++ b/include/media_folder.h @@ -169,10 +169,10 @@ int media_folder_get_name(media_folder_h folder, char **folder_name); int media_folder_get_storage_type(media_folder_h folder, media_content_storage_e *storage_type);
/**
- * @brief Gets the modifed date of the folder.
+ * @brief Gets the modified date of the folder.
*
* @param[in] folder The handle to media folder
- * @param[out] date The modifed date of folder
+ * @param[out] date The modified date of folder
* @return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
diff --git a/include/media_info.h b/include/media_info.h index a8faa91..7eb999e 100644 --- a/include/media_info.h +++ b/include/media_info.h @@ -104,7 +104,7 @@ int media_info_clone(media_info_h* dst, media_info_h src); /** * @brief Destroys the media info. - * @details The function frees all resources related to the meida info handle. This handle + * @details The function frees all resources related to the media info handle. This handle * no longer can be used to perform any operation. New media info handle has to * be created before next usage. * diff --git a/include/media_info_private.h b/include/media_info_private.h index 758d60b..e078acc 100644 --- a/include/media_info_private.h +++ b/include/media_info_private.h @@ -237,6 +237,7 @@ typedef struct #define QUERY_KEYWORD_SPACE " " #define DB_FIELD_FOLDER_UID "folder_uuid" #define DB_FILED_DISPLAY_NAME "display_name" +#define DB_FILED_DATE_MODIFIED "date_modified" #define DB_FILED_MODIFIED_DATE "modified_date" #define DB_FILED_NAME "name" #define DB_FIELD_THUMBNAIL_PATH "thumbnail_path" @@ -246,25 +247,25 @@ typedef struct #define DB_FIELD_ADDED_TIME "added_time" #define SELECT_MEDIA_ITEM "select item_id, file_path, display_name, thumbnail, date_modified,content_type, favourite from item_view where 1" -#define SELECT_ALL_FOLDER "select uuid, path, name, storage_type,modified_date from (select uuid, path, folder_name as name, storage_type,modified_date from visual_folder where valid=1 union select _id, path, folder_name as name, storage_type,modified_date from audio_folder) where 1" +#define SELECT_ALL_FOLDER "select folder_uuid, path, name, storage_type,modified_date from (select folder_uuid, path, folder_name as name, storage_type,modified_date from visual_folder where valid=1 union select audio_uuid, path, folder_name as name, storage_type,modified_date from audio_folder) where 1" #define SELECT_COUNT_ITEM "select count(*) from item_view where 1" #define SELECT_TAG_LIST "select _id, tag_name from visual_tag where 1" -#define SELECT_MEDIA_FROM_TAG "SELECT t._id, tm.media_uuid, m.display_name as display_name, modified_date from ( select _id, tag_name from visual_tag WHERE tag_name='%s' ORDER BY tag_name ASC ) t, ( select media_uuid, tag_id from visual_tag_map ) tm, ( select uuid, folder_uuid, display_name, modified_date from visual_media) m, ( select uuid, lock_status from visual_folder where valid=1 ) f where tm.tag_id = t._id and m.uuid = tm.media_uuid and m.folder_uuid = f.uuid and f.lock_status=0 " +#define SELECT_MEDIA_FROM_TAG "SELECT t._id, tm.visual_uuid, m.display_name as display_name, modified_date from ( select _id, tag_name from visual_tag WHERE tag_name='%s' ORDER BY tag_name ASC ) t, ( select visual_uuid, tag_id from visual_tag_map ) tm, ( select visual_uuid, folder_uuid, display_name, modified_date from visual_media) m, ( select folder_uuid, lock_status from visual_folder where valid=1 ) f where tm.tag_id = t._id and m.visual_uuid = tm.visual_uuid and m.folder_uuid = f.folder_uuid and f.lock_status=0 " #define SELECT_PLAYLIST "select _id,name from audio_playlists where 1" -#define SELECT_MEDIA_FROM_PLAYLIST "select item_id, file_path, display_name, thumbnail, date_modified,content_type, favourite from item_view where 1 and content_type=3 and item_id IN (select audio_id from audio_playlists_map where playlist_id=%d)" +#define SELECT_MEDIA_FROM_PLAYLIST "select item_id, file_path, display_name, thumbnail, date_modified,content_type, favourite from item_view where 1 and content_type=3 and item_id IN (select audio_uuid from audio_playlists_map where playlist_id=%d)" #define SELECT_GENRE_LIST "select distinct genre as name from audio_media where valid=1" -#define SELECT_MEDIA_FROM_GENRE "select audio_id ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_id from audio_media where valid=1 and genre='%s'" +#define SELECT_MEDIA_FROM_GENRE "select audio_uuid ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_uuid from audio_media where valid=1 and genre='%s'" #define SELECT_MEDIA_COUNT_FROM_GENRE "select count(*) from audio_media where valid=1 and genre='%s'" #define SELECT_ALBUM_LIST "select distinct album as name from audio_media where valid=1 " -#define SELECT_MEDIA_FROM_ALBUM "select audio_id ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_id from audio_media where valid=1 and album='%s'" +#define SELECT_MEDIA_FROM_ALBUM "select audio_uuid ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_uuid from audio_media where valid=1 and album='%s'" #define SELECT_MEDIA_COUNT_FROM_ALBUM "select count(*) from audio_media where valid=1 and genre='%s'" #define SELECT_AUTHOR_LIST "select distinct author as name from audio_media where valid=1 " -#define SELECT_MEDIA_FROM_AUTHOR "select audio_id ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_id from audio_media where valid=1 and author='%s'" +#define SELECT_MEDIA_FROM_AUTHOR "select audio_uuid ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_uuid from audio_media where valid=1 and author='%s'" #define SELECT_MEDIA_COUNT_FROM_AUTHOR "select count(*) from audio_media where valid=1 and genre='%s'" #define SELECT_MEDIA_ARTIST_LIST "select distinct artist as name from audio_media where valid=1" -#define SELECT_MEDIA_FROM_ARTIST "select audio_id ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_id from audio_media where valid=1 and artist='%s'" +#define SELECT_MEDIA_FROM_ARTIST "select audio_uuid ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_uuid from audio_media where valid=1 and artist='%s'" #define SELECT_MEDIA_COUNT_FROM_ARTIST "select count(*) from audio_media where valid=1 and genre='%s'" -#define SELECT_BOOKMARK_FROM_VIDEO "select _id,media_uuid,marked_time,thumbnail_path from video_bookmark where media_uuid='%s' " +#define SELECT_BOOKMARK_FROM_VIDEO "select _id,visual_uuid,marked_time,thumbnail_path from video_bookmark where visual_uuid='%s' " /** diff --git a/include/media_video.h b/include/media_video.h index 2fc4021..70d21e0 100644 --- a/include/media_video.h +++ b/include/media_video.h @@ -262,7 +262,7 @@ int video_meta_update_time_played_to_db(video_meta_h video, int time_played); * @details This function gets all video bookmarks associated with the given folder and meeting desired filter option and calls registered callback function for every retrieved item. If NULL is passed to the @a filter, no filtering is applied. * @remarks Only start position and offset details of filter can be set, - * beacuse searching by bookmark name information is not supported. + * because searching by bookmark name information is not supported. * * @param [in] video The handle to video metadata * @param [in] filter The handle to video bookmark filter diff --git a/src/media_audio.c b/src/media_audio.c index db6ee70..0ff78d9 100644 --- a/src/media_audio.c +++ b/src/media_audio.c @@ -16,9 +16,7 @@ #include <media_content.h>
-#include <media-info-error.h>
-#include <media-svc-error.h>
-#include <media-info.h>
+#include <media-svc.h>
#include <audio-svc.h>
#include <audio-svc-error.h>
#include <media_info_private.h>
@@ -31,7 +29,7 @@ #define LOG_TAG "TIZEN_N_MEDIACONTENT"
-
+extern MediaSvcHandle* db_handle;
int audio_meta_destroy(audio_meta_h audio)
{
@@ -615,7 +613,7 @@ int audio_meta_update_count_played_to_db(audio_meta_h audio,int count) if(_audio != NULL)
{
- ret = audio_svc_update_item_metadata(_audio->audio_id,AUDIO_SVC_TRACK_DATA_PLAYED_COUNT,count,-1);
+ ret = audio_svc_update_item_metadata(db_handle,_audio->audio_id,AUDIO_SVC_TRACK_DATA_PLAYED_COUNT,count,-1);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
}
@@ -637,7 +635,7 @@ int audio_meta_update_time_played_to_db(audio_meta_h audio,time_t time) if(_audio != NULL)
{
- ret = audio_svc_update_item_metadata(_audio->audio_id,AUDIO_SVC_TRACK_DATA_PLAYED_TIME,time,-1);
+ ret = audio_svc_update_item_metadata(db_handle,_audio->audio_id,AUDIO_SVC_TRACK_DATA_PLAYED_TIME,time,-1);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
}
else
@@ -891,7 +889,7 @@ int audio_playlist_get_media_count_from_db(audio_playlist_h playlist,int* count) if(_playlist != NULL)
{
- ret = audio_svc_count_playlist_item(_playlist->playlist_id,NULL,NULL, count);
+ ret = audio_svc_count_playlist_item(db_handle,_playlist->playlist_id,NULL,NULL, count);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
}
@@ -922,7 +920,7 @@ int audio_playlist_insert_to_db(const char* name, audio_playlist_h* playlist) }
- ret = audio_svc_add_playlist(name,&playlist_id);
+ ret = audio_svc_add_playlist(db_handle,name,&playlist_id);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
if(ret != MEDIA_CONTENT_ERROR_NONE)
{
@@ -959,7 +957,7 @@ int audio_playlist_delete_from_db(audio_playlist_h playlist) if(_playlist != NULL)
{
- ret = audio_svc_delete_playlist(_playlist->playlist_id);
+ ret = audio_svc_delete_playlist(db_handle,_playlist->playlist_id);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
}
@@ -1077,7 +1075,7 @@ int audio_playlist_update_name_to_db(audio_playlist_h playlist,const char* name) if(_playlist != NULL && name != NULL)
{
- ret = audio_svc_update_playlist_name(_playlist->playlist_id,name);
+ ret = audio_svc_update_playlist_name(db_handle,_playlist->playlist_id,name);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
if(ret == MEDIA_CONTENT_ERROR_NONE)
{
@@ -1111,7 +1109,7 @@ int audio_playlist_add_media_to_db(audio_playlist_h playlist, media_info_h item) if(_playlist != NULL && _item != NULL && _item->media_type == 4)
{
- ret = audio_svc_add_item_to_playlist(_playlist->playlist_id,_item->item_id);
+ ret = audio_svc_add_item_to_playlist(db_handle,_playlist->playlist_id,_item->item_id);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
@@ -1136,7 +1134,7 @@ int audio_playlist_remove_media_from_db(audio_playlist_h playlist, media_info_h if(_playlist != NULL && _item != NULL && _item->media_type == 4)
{
- ret = audio_svc_remove_item_from_playlist_by_audio_id(_playlist->playlist_id,_item->item_id);
+ ret = audio_svc_remove_item_from_playlist_by_audio_id(db_handle,_playlist->playlist_id,_item->item_id);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
}
diff --git a/src/media_content.c b/src/media_content.c index 5f6dfad..e23654a 100644 --- a/src/media_content.c +++ b/src/media_content.c @@ -21,11 +21,9 @@ #include <audio-svc.h>
#include <audio-svc-error.h>
#include <audio-svc-types.h>
-#include <media-info-error.h>
-#include <media-svc-error.h>
-#include <minfo-types.h>
-#include <minfo-api.h>
-#include <media-info.h>
+#include <visual-svc-types.h>
+#include <visual-svc.h>
+#include <media-svc.h>
#include <dlog.h>
@@ -36,23 +34,27 @@ #define LOG_TAG "TIZEN_N_MEDIACONTENT"
-static sqlite3* db_handle;
-
+MediaSvcHandle* db_handle = NULL;
+static int ref_count = 0;
int media_content_connect()
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- int _ret;
- _ret = mediainfo_connect_db_with_handle(&db_handle);
- ret = _content_error_capi(MEDIA_CONTENT_TYPE,_ret);
- if( ret == MEDIA_CONTENT_ERROR_NONE)
+ if(ref_count == 0)
+ {
+ if(db_handle == NULL)
{
- _ret = mediainfo_open();
- ret = _content_error_capi(MEDIA_CONTENT_TYPE,_ret);
+ ret = media_svc_connect(&db_handle);
}
+
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
+ }
+
+ ref_count++;
+
return ret;
}
@@ -60,20 +62,31 @@ int media_content_connect() int media_content_disconnect()
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- int _ret;
+ if(ref_count > 0)
+ {
+ ref_count--;
+ }
+ else
+ {
+ LOGE("[%s]DB_FAILED(0x%08x) database is not connected", __FUNCTION__, MEDIA_CONTENT_ERROR_DB_FAILED);
+ return MEDIA_CONTENT_ERROR_DB_FAILED;
+ }
+
+ if(ref_count == 0)
+ {
if(db_handle != NULL)
{
- _ret = mediainfo_disconnect_db_with_handle(db_handle);
- ret = _content_error_capi(MEDIA_CONTENT_TYPE,_ret);
+ ret = media_svc_disconnect(db_handle);
+ ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
if( ret == MEDIA_CONTENT_ERROR_NONE)
{
- _ret = mediainfo_close();
- ret = _content_error_capi(MEDIA_CONTENT_TYPE,_ret);
db_handle = NULL;
}
}
+ }
+
return ret;
}
@@ -121,9 +134,9 @@ int _content_query_prepare(sqlite3_stmt** stmt,char* select_query,char* conditio snprintf(query,len_query,"%s %s %s %s %s",select_query,condition_query,search_query,order,limit_query );
LOGV("[%s]Query : %s",__func__,query);
- if( sqlite3_prepare(db_handle, query, strlen(query),stmt, NULL) != SQLITE_OK )
+ if( sqlite3_prepare((sqlite3*)db_handle, query, strlen(query),stmt, NULL) != SQLITE_OK )
{
- LOGE("[%s]DB_FAILED(0x%08x) fail to sqlite3_prepare(), %s", __FUNCTION__, MEDIA_CONTENT_ERROR_DB_FAILED,sqlite3_errmsg(db_handle));
+ LOGE("[%s]DB_FAILED(0x%08x) fail to sqlite3_prepare(), %s", __FUNCTION__, MEDIA_CONTENT_ERROR_DB_FAILED,sqlite3_errmsg((sqlite3*)db_handle));
exit(1);
}
free(query);
diff --git a/src/media_filter.c b/src/media_filter.c index 2995884..e975741 100644 --- a/src/media_filter.c +++ b/src/media_filter.c @@ -20,11 +20,9 @@ #include <audio-svc.h>
#include <audio-svc-error.h>
#include <audio-svc-types.h>
-#include <media-info-error.h>
-#include <media-svc-error.h>
-#include <minfo-types.h>
-#include <minfo-api.h>
-#include <media-info.h>
+#include <visual-svc-types.h>
+#include <visual-svc.h>
+#include <media-svc.h>
#include <dlog.h>
diff --git a/src/media_folder.c b/src/media_folder.c index 2b85b3c..ab0fa79 100644 --- a/src/media_folder.c +++ b/src/media_folder.c @@ -21,10 +21,8 @@ #include <audio-svc.h>
#include <audio-svc-error.h>
#include <audio-svc-types.h>
-#include <media-info-error.h>
-#include <media-svc-error.h>
-#include <minfo-types.h>
-#include <minfo-api.h>
+#include <visual-svc-types.h>
+#include <visual-svc.h>
#include <dlog.h>
diff --git a/src/media_image.c b/src/media_image.c index 347b941..1a7a006 100644 --- a/src/media_image.c +++ b/src/media_image.c @@ -19,11 +19,9 @@ #include <media_image.h> #include <media_content.h> #include <media_info_private.h> -#include <media-info-error.h> -#include <media-svc-error.h> -#include <minfo-types.h> -#include <minfo-api.h> -#include <media-info.h> +#include <visual-svc-types.h> +#include <visual-svc.h> +#include <media-svc.h> #include <dlog.h> diff --git a/src/media_info.c b/src/media_info.c index 8dcb895..5ac4178 100644 --- a/src/media_info.c +++ b/src/media_info.c @@ -17,17 +17,14 @@ #include <media_content.h>
#include <media_info_private.h>
-#include <media-info-error.h>
-#include <media-svc-error.h>
-#include <media-info.h>
+#include <media-svc.h>
#include <audio-svc.h>
#include <audio-svc-error.h>
#include <audio-svc-types.h>
-#include <media-svc-error.h>
-#include <minfo-types.h>
-#include <minfo-api.h>
-#include <media-info.h>
+#include <visual-svc-error.h>
+#include <visual-svc-types.h>
+#include <visual-svc.h>
#include <drm-service.h>
#include <aul.h>
@@ -40,9 +37,11 @@ #define LOG_TAG "TIZEN_N_MEDIACONTENT"
+extern MediaSvcHandle* db_handle;
-#define SELECT_AUDIO_FROM_MEDIA "select audio_id,genre,album,artist,author,year,copyright,description,format,bitrate,track_num,duration,rating,played_count,last_played_time,added_time,size,category from audio_media where audio_id='%s' "
-#define SELECT_TAG_LIST_FROM_MEDIA "select t._id, t.tag_name from (select _id, tag_name from visual_tag ORDER BY tag_name ASC ) t, ( select media_uuid, tag_id from visual_tag_map where media_uuid='%s' ) tm, ( select uuid, folder_uuid from visual_media) m, ( select uuid, lock_status from visual_folder where valid=1 ) f where tm.tag_id = t._id and m.uuid = tm.media_uuid and m.folder_uuid = f.uuid and f.lock_status=0; "
+
+#define SELECT_AUDIO_FROM_MEDIA "select audio_uuid,genre,album,artist,author,year,copyright,description,format,bitrate,track_num,duration,rating,played_count,last_played_time,added_time,size,category from audio_media where audio_uuid='%s' "
+#define SELECT_TAG_LIST_FROM_MEDIA "select t._id, t.tag_name from (select _id, tag_name from visual_tag ORDER BY tag_name ASC ) t, ( select visual_uuid, tag_id from visual_tag_map where visual_uuid='%s' ) tm, ( select visual_uuid, folder_uuid from visual_media) m, ( select folder_uuid, lock_status from visual_folder where valid=1 ) f where tm.tag_id = t._id and m.visual_uuid = tm.visual_uuid and m.folder_uuid = f.folder_uuid and f.lock_status=0; "
int media_info_insert_to_db(media_content_type_e type,const char* path)
{
@@ -60,12 +59,12 @@ int media_info_insert_to_db(media_content_type_e type,const char* path) {
case MEDIA_CONTENT_TYPE_IMAGE:
_type = MINFO_ITEM_IMAGE;
- ret = minfo_add_media(path, _type);
+ ret = minfo_add_media(db_handle, path, _type);
ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);
break;
case MEDIA_CONTENT_TYPE_VIDEO:
_type = MINFO_ITEM_VIDEO;
- ret = minfo_add_media(path, _type);
+ ret = minfo_add_media(db_handle, path, _type);
ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);
break;
@@ -74,7 +73,7 @@ int media_info_insert_to_db(media_content_type_e type,const char* path) ret = _content_get_audio_category(path,&category);
if(ret >= 0)
{
- ret = audio_svc_insert_item(storage_type,path,category);
+ ret = audio_svc_insert_item(db_handle, storage_type,path,category);
}
else
{
@@ -369,16 +368,16 @@ int media_info_update_favorite_to_db(media_info_h media, int favorite) {
if(favorite)
{
- ret = audio_svc_add_item_to_playlist( AUDIO_SVC_FAVORITE_LIST_ID, _media->item_id);
+ ret = audio_svc_add_item_to_playlist( db_handle, AUDIO_SVC_FAVORITE_LIST_ID, _media->item_id);
}
else
{
- ret = audio_svc_remove_item_from_playlist_by_audio_id(AUDIO_SVC_FAVORITE_LIST_ID, _media->item_id);
+ ret = audio_svc_remove_item_from_playlist_by_audio_id(db_handle, AUDIO_SVC_FAVORITE_LIST_ID, _media->item_id);
}
}
else
{
- ret = minfo_update_media_favorite(_media->item_id,favorite);
+ ret = minfo_update_media_favorite(db_handle, _media->item_id,favorite);
}
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
}
@@ -516,11 +515,11 @@ int media_info_foreach_media_from_db(media_info_filter_h filter,media_info_cb ca }
else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)
{
- snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE);
+ snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_DATE_MODIFIED);
}
else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)
{
- snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE,QUERY_KEYWORD_DESC);
+ snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_DATE_MODIFIED,QUERY_KEYWORD_DESC);
}
@@ -586,12 +585,12 @@ int media_info_get_image_from_db(media_info_h item, image_meta_h* image) return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
}
- p_ret = minfo_get_item_by_id(_item->item_id,&p_item);
+ p_ret = minfo_get_item_by_id(db_handle, _item->item_id,&p_item);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,p_ret);
if( (ret == MEDIA_CONTENT_ERROR_NONE) && ( p_item != NULL))
{
- ret = minfo_get_meta_info(_item->item_id,&(p_item->meta_info));
+ ret = minfo_get_meta_info(db_handle, _item->item_id,&(p_item->meta_info));
ret = _content_error_capi(MEDIA_CONTENT_TYPE,p_ret);
if( ret != MEDIA_CONTENT_ERROR_NONE)
@@ -663,13 +662,13 @@ int media_info_get_video_from_db(media_info_h item, video_meta_h* video) return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
}
- p_ret = minfo_get_item_by_id(_item->item_id,&p_item);
+ p_ret = minfo_get_item_by_id(db_handle, _item->item_id,&p_item);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,p_ret);
if( (ret == MEDIA_CONTENT_ERROR_NONE) && ( p_item != NULL))
{
- ret = minfo_get_meta_info(_item->item_id,&(p_item->meta_info));
+ ret = minfo_get_meta_info(db_handle, _item->item_id,&(p_item->meta_info));
ret = _content_error_capi(MEDIA_CONTENT_TYPE,p_ret);
if( ret != MEDIA_CONTENT_ERROR_NONE)
{
@@ -1005,7 +1004,7 @@ int _content_get_audio_category(const char* file_full_path,int* category) *category = FEX_CATEGORY_MUSIC;
*category = *category | FEX_CATEGORY_DRM;
}
- else //check music file in soun files.
+ else //check music file in sound files.
{
int prefix_len = strlen(content_category[0].content_type);
diff --git a/src/media_tag.c b/src/media_tag.c index c8d1850..161d539 100644 --- a/src/media_tag.c +++ b/src/media_tag.c @@ -20,10 +20,8 @@ #include <audio-svc.h>
#include <audio-svc-error.h>
#include <audio-svc-types.h>
-#include <media-info-error.h>
-#include <media-svc-error.h>
-#include <minfo-types.h>
-#include <minfo-api.h>
+#include <visual-svc-types.h>
+#include <visual-svc.h>
#include <dlog.h>
#ifdef LOG_TAG
@@ -32,6 +30,7 @@ #define LOG_TAG "TIZEN_N_MEDIACONTENT"
+extern MediaSvcHandle* db_handle;
int media_tag_foreach_tag_from_db(media_tag_filter_h filter, media_tag_cb callback,void* user_data)
@@ -177,7 +176,7 @@ int media_tag_insert_to_db(const char* tag_name,media_tag_h* tag) return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
}
- ret = minfo_add_tag(NULL,tag_name);
+ ret = minfo_add_tag(db_handle,NULL,tag_name);
if(ret == MB_SVC_ERROR_NONE)
{
@@ -203,7 +202,7 @@ int media_tag_delete_from_db(media_tag_h tag) media_tag_s* _tag = (media_tag_s*)tag;
- ret = minfo_delete_tag(NULL, _tag->name);
+ ret = minfo_delete_tag(db_handle, NULL, _tag->name);
return _content_error_capi(MEDIA_CONTENT_TYPE,ret);
@@ -237,7 +236,7 @@ int media_tag_add_media_to_db(media_tag_h tag,media_info_h media) return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
}
- ret = minfo_add_tag(_item->item_id,_tag->name);
+ ret = minfo_add_tag(db_handle, _item->item_id,_tag->name);
return _content_error_capi(MEDIA_CONTENT_TYPE,ret);
@@ -269,7 +268,7 @@ int media_tag_remove_media_from_db(media_tag_h tag,media_info_h media) return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
}
- query_string = sqlite3_mprintf("DELETE FROM visual_tag_map WHERE media_id=%s and tag_name=%d",
+ query_string = sqlite3_mprintf("DELETE FROM visual_tag_map WHERE visual_uuid=%s and tag_name=%d",
_item->item_id, _tag->name);
@@ -387,7 +386,7 @@ int media_tag_update_name_to_db(media_tag_h tag, const char* name) return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
}
- ret = minfo_rename_tag(_tag->name,name);
+ ret = minfo_rename_tag(db_handle,_tag->name,name);
if(ret == MB_SVC_ERROR_NONE)
{
@@ -502,7 +501,7 @@ int media_tag_foreach_media_from_db(media_tag_h tag,media_info_filter_h filter, }
memset(_item,0x00,sizeof(media_info_s));
media_id = (char*)sqlite3_column_text(stmt, 1);
- ret = minfo_get_item_by_id(media_id, &mitem);
+ ret = minfo_get_item_by_id(db_handle,media_id, &mitem);
if(ret < 0)
{
diff --git a/src/media_video.c b/src/media_video.c index b8bc8c3..276f0a4 100644 --- a/src/media_video.c +++ b/src/media_video.c @@ -16,11 +16,10 @@ #include <media_content.h> #include <media_info_private.h> -#include <media-info-error.h> -#include <media-svc-error.h> -#include <minfo-types.h> -#include <minfo-api.h> -#include <media-info.h> +#include <visual-svc-error.h> +#include <visual-svc-types.h> +#include <visual-svc.h> +#include <media-svc.h> #include <dlog.h> @@ -30,6 +29,8 @@ #define LOG_TAG "TIZEN_N_MEDIACONTENT" +extern MediaSvcHandle* db_handle; + int video_meta_destroy(video_meta_h video) { @@ -466,7 +467,7 @@ int video_meta_update_time_played_to_db(video_meta_h video, int time_played) if(_video != NULL ) { - ret = minfo_update_video_meta_info_int(_video->video_id,MINFO_VIDEO_META_BOOKMARK_LAST_PLAYED,time_played); + ret = minfo_update_video_meta_info_int(db_handle,_video->video_id,MINFO_VIDEO_META_BOOKMARK_LAST_PLAYED,time_played); ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret); } else @@ -703,7 +704,7 @@ int video_bookmark_insert_to_db(video_meta_h video, time_t time, const char* thu if(_video != NULL) { - ret = minfo_add_bookmark(_video->video_id,time,thumbnail_path); + ret = minfo_add_bookmark(db_handle,_video->video_id,time,thumbnail_path); ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret); } else @@ -724,7 +725,7 @@ int video_bookmark_delete_from_db(video_bookmark_h bookmark) if( _bookmark != NULL) { - ret = minfo_delete_bookmark(_bookmark->bookmark_id); + ret = minfo_delete_bookmark(db_handle,_bookmark->bookmark_id); ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret); } else |