From 415059bb2150d3c60d32c2ef325c4aeefc503fb2 Mon Sep 17 00:00:00 2001 From: Ravi Kiran K N Date: Wed, 20 Sep 2017 10:21:24 +0530 Subject: [PATCH] Add comments Change-Id: I3be952d23fe562dfd1f43a591a5d5efcb57c4959 Signed-off-by: Ravi Kiran K N --- src/common/mp-util-media-service.c | 264 ++++++++++++++++++++++++++++++++++++- 1 file changed, 261 insertions(+), 3 deletions(-) diff --git a/src/common/mp-util-media-service.c b/src/common/mp-util-media-service.c index 0e40710..307eb70 100644 --- a/src/common/mp-util-media-service.c +++ b/src/common/mp-util-media-service.c @@ -72,6 +72,12 @@ bool mp_util_svc_is_3gp_file(char *szFileUri) return nRet; } +/** +* Iterate callback function to get media item +* @param pVideoItem : media info +* @param pUserData : folder item +* @return result +*/ static bool mp_util_svc_iterate_for_get_video_item_cb(media_info_h pVideoItem, void *pUserData) @@ -89,6 +95,12 @@ static bool mp_util_svc_iterate_for_get_video_item_cb(media_info_h return FALSE; } +/** +* Iterate callback function to get media item +* @param pMediaItem : media info +* @param pUserData : folder item +* @return result +*/ static bool mp_util_svc_iterate_for_video_item_list_view_cb(media_info_h pMediaItem, void @@ -145,6 +157,13 @@ static bool mp_util_svc_iterate_for_video_item_list_view_cb(media_info_h return TRUE; } + +/** +* Iterate callback function to get media item +* @param pMediaItem : media info +* @param pUserData : media item +* @return result +*/ static bool mp_util_svc_iterate_cb(media_info_h pMediaItem, void *pUserData) { @@ -167,6 +186,12 @@ static bool mp_util_svc_iterate_cb(media_info_h pMediaItem, return TRUE; } +/** +* Iterate callback function to get media item +* @param pFolderItem : media info +* @param pUserData : folder item +* @return result +*/ static bool mp_util_svc_iterate_for_get_folder_cb(media_folder_h pFolderItem, void *pUserData) @@ -187,6 +212,12 @@ static bool mp_util_svc_iterate_for_get_folder_cb(media_folder_h return TRUE; } +/** +* callback function to compare and sort folders +* @param pFolder1 : media folder +* @param pFolder2 : media folder +* @return result +*/ static int mp_util_svc_sort_for_folder_list_cb(const void *pFolder1, const void *pFolder2) { @@ -219,6 +250,12 @@ static int mp_util_svc_sort_for_folder_list_cb(const void *pFolder1, return nRet; } +/** +* iterate callback function for folders list items +* @param pFolderItem : media folder +* @param pUserData : folder item +* @return result +*/ static bool mp_util_svc_iterate_for_folder_list_cb(media_folder_h pFolderItem, void *pUserData) @@ -235,6 +272,12 @@ static bool mp_util_svc_iterate_for_folder_list_cb(media_folder_h return TRUE; } +/** +* iterate callback function for personal folders list items +* @param pFolderItem : media folder +* @param pUserData : folder item +* @return result +*/ static bool mp_util_svc_iterate_for_personal_folder_list_cb(media_folder_h pFolderItem, void @@ -278,6 +321,9 @@ static bool mp_util_svc_iterate_for_personal_folder_list_cb(media_folder_h // External function // +/** +* Connect to media content +*/ void mp_util_svc_init_session(void) { if (media_content_connect() != MEDIA_CONTENT_ERROR_NONE) { @@ -287,6 +333,9 @@ void mp_util_svc_init_session(void) } } +/** +* Disconnect from media content +*/ void mp_util_svc_finish_session(void) { @@ -300,6 +349,10 @@ void mp_util_svc_finish_session(void) return; } +/** +* Free video items list +* @return result +*/ bool mp_util_svc_destory_video_item_list(void) { if (!VideoItemList) { @@ -319,6 +372,13 @@ bool mp_util_svc_destory_video_item_list(void) return TRUE; } +/** +* Get list of videos from folder +* @param szFolderPath : string +* @param nSortType : sort type +* @param nItemType : list view type +* @return result +*/ bool mp_util_svc_extract_video_list_from_folder(char *szFolderPath, int nSortType, int nItemType) @@ -501,6 +561,12 @@ bool mp_util_svc_extract_video_list_from_folder(char *szFolderPath, return TRUE; } +/** +* Get thumbnail for folder +* @param nVideoFolderIndex : folder index +* @param nSortType : sort type +* @return thumbnail path +*/ char *mp_util_get_folder_thumbnail(int nVideoFolderIndex, int nSortType) { if (!VideoFolderList) { @@ -617,6 +683,12 @@ char *mp_util_get_folder_thumbnail(int nVideoFolderIndex, int nSortType) return szThumbnailPath; } +/** +* Get video list by item type +* @param nSortType : sort type +* @param nItemType : list view type +* @return result +*/ bool mp_util_svc_extract_video_list_by_item_type(int nSortType, int nItemType) { @@ -752,7 +824,12 @@ bool mp_util_svc_extract_video_list_by_item_type(int nSortType, return TRUE; } - +/** +* Get display name of video items +* @param keyword : keyword to match +* @param index_list : resulting list +* @return result +*/ bool mp_util_svc_index_list_for_search_view(const char *keyword, void **index_list) { @@ -793,6 +870,9 @@ bool mp_util_svc_index_list_for_search_view(const char *keyword, return TRUE; } +/** +* Free video list +*/ void mp_util_svc_destory_video_list(void) { @@ -815,6 +895,11 @@ void mp_util_svc_destory_video_list(void) nNumberOfVideoItemByType = 0; } +/** +* Remove item from video list +* @param nVideoItemIndex : index to remove +* @return result +*/ bool mp_util_svc_remove_item_by_list_index(int nVideoItemIndex) { @@ -848,6 +933,12 @@ bool mp_util_svc_remove_item_by_list_index(int nVideoItemIndex) return TRUE; } + +/** +* Remove item from db +* @param nVideoItemIndex : index to remove +* @return result +*/ bool mp_util_svc_remove_item_from_db_by_list_index(int nVideoItemIndex) { @@ -878,6 +969,13 @@ bool mp_util_svc_remove_item_from_db_by_list_index(int nVideoItemIndex) return TRUE; } +/** +* Get ID of the video item with specified url +* @param szPath : path of video +* @param szVideoID : resulting ID +* @return result +*/ + bool mp_util_svc_get_video_id_by_video_url(const char *szPath, char **szVideoID) { @@ -938,6 +1036,11 @@ bool mp_util_svc_get_video_id_by_video_url(const char *szPath, return bRet; } +/** +* Get last played time of a video +* @param szPath : path of video +* @return last played time +*/ unsigned int mp_util_svc_get_video_last_play_time_by_video_url(const char *szPath) { @@ -998,6 +1101,11 @@ unsigned int mp_util_svc_get_video_last_play_time_by_video_url(const char return (unsigned int) nLastPlayedTime; } +/** +* Get thumbnail of the video with specified url +* @param szMediaUri : path of video +* @return thumbnail path +*/ char *mp_util_svc_get_video_Thumbnail_by_video_url(const char *szMediaUri) { if (!szMediaUri) { @@ -1051,6 +1159,13 @@ char *mp_util_svc_get_video_Thumbnail_by_video_url(const char *szMediaUri) return szThumbnailPath; } +/** +* Set last played time of video with specified url +* @param szMediaUri : path of video +* @param nPosition : last played time +* @return +*/ + void mp_util_svc_set_video_last_played_time_by_url(char *szMediaUri, unsigned int nPosition) { @@ -1118,6 +1233,11 @@ void mp_util_svc_set_video_last_played_time_by_url(char *szMediaUri, } +/** +* Get video path +* @param nVideoItemIndex : index of the video +* @return path of the video +*/ char *mp_util_svc_get_video_url(const int nVideoItemIndex) { if (!VideoItemList) { @@ -1145,6 +1265,11 @@ char *mp_util_svc_get_video_url(const int nVideoItemIndex) return szVideoItemFilePath; } +/** +* Get video thumbnail +* @param nVideoItemIndex : index of the video +* @return path of the video thumbnail +*/ char *mp_util_svc_get_video_thumbnail(const int nVideoItemIndex) { if (!VideoItemList) { @@ -1174,6 +1299,12 @@ char *mp_util_svc_get_video_thumbnail(const int nVideoItemIndex) return szVideoItemThumbnailPath; } + +/** +* Get video title +* @param nVideoItemIndex : index of the video +* @return title of the video +*/ char *mp_util_svc_get_video_title(const int nVideoItemIndex) { if (!VideoItemList) { @@ -1195,6 +1326,11 @@ char *mp_util_svc_get_video_title(const int nVideoItemIndex) return szTitle; } +/** +* Get video duration +* @param nVideoItemIndex : index of the video +* @return duration of the video +*/ int mp_util_svc_get_video_duration_time(const int nVideoItemIndex) { if (!VideoItemList) { @@ -1229,6 +1365,11 @@ int mp_util_svc_get_video_duration_time(const int nVideoItemIndex) return nDurationTime; } +/** +* Get last played position +* @param nVideoItemIndex : index of the video +* @return last played position +*/ int mp_util_svc_get_video_last_played_pos(const int nVideoItemIndex) { if (!VideoItemList) { @@ -1256,6 +1397,11 @@ int mp_util_svc_get_video_last_played_pos(const int nVideoItemIndex) return (int) nLastPlayedTime; } +/** +* Get video item size +* @param nVideoItemIndex : index of the video +* @return video file size +*/ unsigned long long mp_util_svc_get_video_item_size(const int nVideoItemIndex) { @@ -1281,6 +1427,11 @@ unsigned long long mp_util_svc_get_video_item_size(const int } +/** +* Get video item width +* @param nVideoItemIndex : index of the video +* @return video width +*/ int mp_util_svc_get_video_item_width(const int nVideoItemIndex) { if (!VideoItemList) { @@ -1311,6 +1462,11 @@ int mp_util_svc_get_video_item_width(const int nVideoItemIndex) return nWidth; } +/** +* Get video item height +* @param nVideoItemIndex : index of the video +* @return video height +*/ int mp_util_svc_get_video_item_height(const int nVideoItemIndex) { if (!VideoItemList) { @@ -1341,6 +1497,11 @@ int mp_util_svc_get_video_item_height(const int nVideoItemIndex) return nHeight; } +/** +* Get video item modified time +* @param nVideoItemIndex : index of the video +* @return modified time string +*/ char *mp_util_svc_get_video_item_modified_time(const int nVideoItemIndex) { if (!VideoItemList) { @@ -1372,6 +1533,10 @@ char *mp_util_svc_get_video_item_modified_time(const int nVideoItemIndex) return NULL; } +/** +* Get video list size +* @return video list size +*/ int mp_util_svc_get_video_list_size_for_checking_index(void) { if (!VideoItemList) { @@ -1382,12 +1547,22 @@ int mp_util_svc_get_video_list_size_for_checking_index(void) return (int) eina_list_count(VideoItemList); } +/** +* Get video items size by type +* @return video items size +*/ int mp_util_svc_get_number_of_video_item_by_type(void) { return nNumberOfVideoItemByType; } +/** +* Get video folder list from db by type +* @param nSortType : sort type +* @param nItemType : list view type +* @return result +*/ bool mp_util_svc_extract_video_folder_list_by_type(int nSortType, int nItemType) { @@ -1447,6 +1622,12 @@ bool mp_util_svc_extract_video_folder_list_by_type(int nSortType, return TRUE; } +/** +* Get personal video folder list +* @param nSortType : sort type +* @param bPersonal : true/false +* @return result +*/ bool mp_util_svc_extract_personal_video_folder_list(int nSortType, bool bPersonal) { @@ -1490,7 +1671,10 @@ bool mp_util_svc_extract_personal_video_folder_list(int nSortType, return TRUE; } - +/** +* Free video folder list +* @return result +*/ bool mp_util_svc_destory_video_folder_list(void) { if (!VideoFolderList) { @@ -1510,6 +1694,10 @@ bool mp_util_svc_destory_video_folder_list(void) return TRUE; } +/** +* Get video folder size +* @return result +*/ int mp_util_svc_get_video_folder_size(void) { if (!VideoFolderList) { @@ -1524,6 +1712,11 @@ int mp_util_svc_get_video_folder_size(void) return 0; } +/** +* Get Video folder name +* @param nVideoFolderIndex : index of the folder +* @return folder name +*/ char *mp_util_svc_get_video_folder_name(int nVideoFolderIndex) { if (!VideoFolderList) { @@ -1552,6 +1745,12 @@ char *mp_util_svc_get_video_folder_name(int nVideoFolderIndex) return NULL; } +/** +* Get Video folder url +* @param nVideoFolderIndex : index of the folder +* @return folder url string +*/ + char *mp_util_svc_get_video_folder_url(int nVideoFolderIndex) { if (!VideoFolderList) { @@ -1580,6 +1779,11 @@ char *mp_util_svc_get_video_folder_url(int nVideoFolderIndex) return NULL; } +/** +* Get Video folder id +* @param nVideoFolderIndex : index of the folder +* @return folder id string +*/ char *mp_util_svc_get_video_folder_id(int nVideoFolderIndex) { if (!VideoFolderList) { @@ -1608,6 +1812,13 @@ char *mp_util_svc_get_video_folder_id(int nVideoFolderIndex) return NULL; } +/** +* Assing thumbnail update callback function +* @param nVideoItemIndex : index of the video +* @param pUserCallbackFunc : callback function to register +* @param pUserData : user data for callback argument +* @return folder name +*/ void mp_util_svc_register_thumbnail_update_func(int nVideoItemIndex, void *pUserCallbackFunc, void *pUserData) @@ -1634,6 +1845,10 @@ void mp_util_svc_register_thumbnail_update_func(int nVideoItemIndex, } } +/** +* Cancel thumbnail update +* @param nVideoItemIndex : index of the video +*/ void mp_util_svc_cancel_thumbnail_update(int nVideoItemIndex) { VideoLogInfo("nVideoItemIndex : %d", nVideoItemIndex); @@ -1659,6 +1874,10 @@ void mp_util_svc_cancel_thumbnail_update(int nVideoItemIndex) } } +/** +* Update thumbnail info to DB +* @param nVideoItemIndex : index of the video +*/ void mp_util_svc_update_thumbnail_info(const int nVideoItemIndex) { if (!VideoItemList) { @@ -1763,6 +1982,11 @@ void mp_util_svc_update_thumbnail_info(const int nVideoItemIndex) } } +/** +* Get Video item ID +* @param nVideoItemIndex : index of the video +* @return video id string +*/ char *mp_util_svc_get_video_id_by_index(const int nVideoItemIndex) { if (!VideoItemList) { @@ -1789,6 +2013,12 @@ char *mp_util_svc_get_video_id_by_index(const int nVideoItemIndex) return szMediaId; } +/** +* Get folder storage of the video folder +* @param nVideoFolderIndex : index of the video folder +* @return storage type +*/ + MpMediaStorageType mp_util_svc_get_folder_storage(const int nVideoFolderIndex) { @@ -1823,6 +2053,11 @@ MpMediaStorageType mp_util_svc_get_folder_storage(const int } +/** +* Get folder storage of the video +* @param nVideoItemIndex : index of the video +* @return storage type +*/ MpMediaStorageType mp_util_svc_get_video_storage(const int nVideoItemIndex) { MpMediaStorageType storage_local = MP_MEDIA_TYPE_STORAGE_UNKNOWN; @@ -1842,12 +2077,28 @@ MpMediaStorageType mp_util_svc_get_video_storage(const int nVideoItemIndex) return storage_local; } +/** +* Is cloud storage +* @param nVideoItemIndex : index of the video +* @return true/false +*/ bool mp_util_svc_is_cloud_storage(const int nVideoItemIndex) { VideoLogInfo("disable cloud module."); return FALSE; } +/** +* Callback function for DB update +* @param nError : error code from content +* @param nPid : process ID +* @param nUpdateItem : file or directory +* @param nMediaType : type of the media (video/image) +* @param szUuid : ID of the media +* @param szPath : path of the media +* @param szMimeType : Mime type of the media +* @param pUserData : user data +*/ void mp_util_svc_update_database_cb(media_content_error_e nError, int nPid, media_content_db_update_item_type_e nUpdateItem, @@ -1902,6 +2153,11 @@ void mp_util_svc_update_database_cb(media_content_error_e nError, int nPid, } +/** +* Register Callback function for DB update +* @param pUpdateDbCbFunc : callback function +* @return result +*/ bool mp_util_svc_set_update_db_cb_func(UpdateDatabaseCbFunc pUpdateDbCbFunc) { @@ -1923,6 +2179,9 @@ bool mp_util_svc_set_update_db_cb_func(UpdateDatabaseCbFunc } +/** +* unregister Callback function for DB update +*/ void mp_util_svc_unset_update_db_cb_func(void) { @@ -1935,7 +2194,6 @@ void mp_util_svc_unset_update_db_cb_func(void) /////////////////////////////////////////////////////// // For livebox list - static bool mp_util_svc_iterate_for_last_played_video_item_cb(media_info_h pMediaItem, void -- 2.7.4