diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/media_audio.c | 18 | ||||
-rw-r--r-- | src/media_content.c | 10 | ||||
-rw-r--r-- | src/media_info.c | 22 | ||||
-rw-r--r-- | src/media_tag.c | 13 | ||||
-rw-r--r-- | src/media_video.c | 9 |
5 files changed, 32 insertions, 40 deletions
diff --git a/src/media_audio.c b/src/media_audio.c index 0ff78d9..9ec5b4a 100644 --- a/src/media_audio.c +++ b/src/media_audio.c @@ -29,8 +29,6 @@ #define LOG_TAG "TIZEN_N_MEDIACONTENT"
-extern MediaSvcHandle* db_handle;
-
int audio_meta_destroy(audio_meta_h audio)
{
int ret;
@@ -613,7 +611,7 @@ int audio_meta_update_count_played_to_db(audio_meta_h audio,int count) if(_audio != NULL)
{
- ret = audio_svc_update_item_metadata(db_handle,_audio->audio_id,AUDIO_SVC_TRACK_DATA_PLAYED_COUNT,count,-1);
+ ret = audio_svc_update_item_metadata(_content_get_db_handle(),_audio->audio_id,AUDIO_SVC_TRACK_DATA_PLAYED_COUNT,count,-1);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
}
@@ -635,7 +633,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(db_handle,_audio->audio_id,AUDIO_SVC_TRACK_DATA_PLAYED_TIME,time,-1);
+ ret = audio_svc_update_item_metadata(_content_get_db_handle(),_audio->audio_id,AUDIO_SVC_TRACK_DATA_PLAYED_TIME,time,-1);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
}
else
@@ -889,7 +887,7 @@ int audio_playlist_get_media_count_from_db(audio_playlist_h playlist,int* count) if(_playlist != NULL)
{
- ret = audio_svc_count_playlist_item(db_handle,_playlist->playlist_id,NULL,NULL, count);
+ ret = audio_svc_count_playlist_item(_content_get_db_handle(),_playlist->playlist_id,NULL,NULL, count);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
}
@@ -920,7 +918,7 @@ int audio_playlist_insert_to_db(const char* name, audio_playlist_h* playlist) }
- ret = audio_svc_add_playlist(db_handle,name,&playlist_id);
+ ret = audio_svc_add_playlist(_content_get_db_handle(),name,&playlist_id);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
if(ret != MEDIA_CONTENT_ERROR_NONE)
{
@@ -957,7 +955,7 @@ int audio_playlist_delete_from_db(audio_playlist_h playlist) if(_playlist != NULL)
{
- ret = audio_svc_delete_playlist(db_handle,_playlist->playlist_id);
+ ret = audio_svc_delete_playlist(_content_get_db_handle(),_playlist->playlist_id);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
}
@@ -1075,7 +1073,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(db_handle,_playlist->playlist_id,name);
+ ret = audio_svc_update_playlist_name(_content_get_db_handle(),_playlist->playlist_id,name);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
if(ret == MEDIA_CONTENT_ERROR_NONE)
{
@@ -1109,7 +1107,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(db_handle,_playlist->playlist_id,_item->item_id);
+ ret = audio_svc_add_item_to_playlist(_content_get_db_handle(),_playlist->playlist_id,_item->item_id);
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
@@ -1134,7 +1132,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(db_handle,_playlist->playlist_id,_item->item_id);
+ ret = audio_svc_remove_item_from_playlist_by_audio_id(_content_get_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 e23654a..c9c6109 100644 --- a/src/media_content.c +++ b/src/media_content.c @@ -23,7 +23,6 @@ #include <audio-svc-types.h>
#include <visual-svc-types.h>
#include <visual-svc.h>
-#include <media-svc.h>
#include <dlog.h>
@@ -34,11 +33,9 @@ #define LOG_TAG "TIZEN_N_MEDIACONTENT"
-MediaSvcHandle* db_handle = NULL;
+static MediaSvcHandle* db_handle = NULL;
static int ref_count = 0;
-
-
int media_content_connect()
{
int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -90,6 +87,11 @@ int media_content_disconnect() return ret;
}
+MediaSvcHandle* _content_get_db_handle()
+{
+ return db_handle;
+}
+
int _content_query_prepare(sqlite3_stmt** stmt,char* select_query,char* condition_query, char* search_query,char* limit_query,char* order)
{
diff --git a/src/media_info.c b/src/media_info.c index 38054ef..7c55e88 100644 --- a/src/media_info.c +++ b/src/media_info.c @@ -37,8 +37,6 @@ #define LOG_TAG "TIZEN_N_MEDIACONTENT"
-extern MediaSvcHandle* db_handle;
-
#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; "
@@ -59,12 +57,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(db_handle, path, _type);
+ ret = minfo_add_media(_content_get_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(db_handle, path, _type);
+ ret = minfo_add_media(_content_get_db_handle(), path, _type);
ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);
break;
@@ -73,7 +71,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(db_handle, storage_type,path,category);
+ ret = audio_svc_insert_item(_content_get_db_handle(), storage_type,path,category);
}
else
{
@@ -368,16 +366,16 @@ int media_info_update_favorite_to_db(media_info_h media, int favorite) {
if(favorite)
{
- ret = audio_svc_add_item_to_playlist( db_handle, AUDIO_SVC_FAVORITE_LIST_ID, _media->item_id);
+ ret = audio_svc_add_item_to_playlist( _content_get_db_handle(), AUDIO_SVC_FAVORITE_LIST_ID, _media->item_id);
}
else
{
- ret = audio_svc_remove_item_from_playlist_by_audio_id(db_handle, AUDIO_SVC_FAVORITE_LIST_ID, _media->item_id);
+ ret = audio_svc_remove_item_from_playlist_by_audio_id(_content_get_db_handle(), AUDIO_SVC_FAVORITE_LIST_ID, _media->item_id);
}
}
else
{
- ret = minfo_update_media_favorite(db_handle, _media->item_id,favorite);
+ ret = minfo_update_media_favorite(_content_get_db_handle(), _media->item_id,favorite);
}
ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);
if(ret == MEDIA_CONTENT_ERROR_NONE)
@@ -589,12 +587,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(db_handle, _item->item_id,&p_item);
+ p_ret = minfo_get_item_by_id(_content_get_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(db_handle, _item->item_id,&(p_item->meta_info));
+ ret = minfo_get_meta_info(_content_get_db_handle(), _item->item_id,&(p_item->meta_info));
ret = _content_error_capi(MEDIA_CONTENT_TYPE,p_ret);
if( ret != MEDIA_CONTENT_ERROR_NONE)
@@ -666,13 +664,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(db_handle, _item->item_id,&p_item);
+ p_ret = minfo_get_item_by_id(_content_get_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(db_handle, _item->item_id,&(p_item->meta_info));
+ ret = minfo_get_meta_info(_content_get_db_handle(), _item->item_id,&(p_item->meta_info));
ret = _content_error_capi(MEDIA_CONTENT_TYPE,p_ret);
if( ret != MEDIA_CONTENT_ERROR_NONE)
{
diff --git a/src/media_tag.c b/src/media_tag.c index 161d539..856ad25 100644 --- a/src/media_tag.c +++ b/src/media_tag.c @@ -30,9 +30,6 @@ #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)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -176,7 +173,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(db_handle,NULL,tag_name);
+ ret = minfo_add_tag(_content_get_db_handle(),NULL,tag_name);
if(ret == MB_SVC_ERROR_NONE)
{
@@ -202,7 +199,7 @@ int media_tag_delete_from_db(media_tag_h tag) media_tag_s* _tag = (media_tag_s*)tag;
- ret = minfo_delete_tag(db_handle, NULL, _tag->name);
+ ret = minfo_delete_tag(_content_get_db_handle(), NULL, _tag->name);
return _content_error_capi(MEDIA_CONTENT_TYPE,ret);
@@ -236,7 +233,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(db_handle, _item->item_id,_tag->name);
+ ret = minfo_add_tag(_content_get_db_handle(), _item->item_id,_tag->name);
return _content_error_capi(MEDIA_CONTENT_TYPE,ret);
@@ -386,7 +383,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(db_handle,_tag->name,name);
+ ret = minfo_rename_tag(_content_get_db_handle(),_tag->name,name);
if(ret == MB_SVC_ERROR_NONE)
{
@@ -501,7 +498,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(db_handle,media_id, &mitem);
+ ret = minfo_get_item_by_id(_content_get_db_handle(),media_id, &mitem);
if(ret < 0)
{
diff --git a/src/media_video.c b/src/media_video.c index 276f0a4..bdfdc7d 100644 --- a/src/media_video.c +++ b/src/media_video.c @@ -29,9 +29,6 @@ #define LOG_TAG "TIZEN_N_MEDIACONTENT" -extern MediaSvcHandle* db_handle; - - int video_meta_destroy(video_meta_h video) { int ret; @@ -467,7 +464,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(db_handle,_video->video_id,MINFO_VIDEO_META_BOOKMARK_LAST_PLAYED,time_played); + ret = minfo_update_video_meta_info_int(_content_get_db_handle(),_video->video_id,MINFO_VIDEO_META_BOOKMARK_LAST_PLAYED,time_played); ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret); } else @@ -704,7 +701,7 @@ int video_bookmark_insert_to_db(video_meta_h video, time_t time, const char* thu if(_video != NULL) { - ret = minfo_add_bookmark(db_handle,_video->video_id,time,thumbnail_path); + ret = minfo_add_bookmark(_content_get_db_handle(),_video->video_id,time,thumbnail_path); ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret); } else @@ -725,7 +722,7 @@ int video_bookmark_delete_from_db(video_bookmark_h bookmark) if( _bookmark != NULL) { - ret = minfo_delete_bookmark(db_handle,_bookmark->bookmark_id); + ret = minfo_delete_bookmark(_content_get_db_handle(),_bookmark->bookmark_id); ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret); } else |