From 7fb1aa9853a42bbfc78b86b86f3b1c5caabfd09c Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Fri, 4 Apr 2025 13:17:19 +0900 Subject: [PATCH] Remove unused product APIs Removed unused product APIs: int media_info_delete_from_db(const char *media_id); int media_info_get_media_info_by_path_from_db(const char* path, media_info_h* media); int media_folder_set_name(media_folder_h folder, const char *name); int media_folder_update_to_db(media_folder_h folder); Change-Id: I2c138e5dabf9433d8e55de713ba38ab4f75c1c5f Signed-off-by: Minje Ahn --- include_product/media_content_product.h | 298 +--------------------- include_product/media_info_private.h | 1 - packaging/capi-content-media-content.spec | 2 +- src/media_folder.c | 52 ---- src/media_info.c | 64 ----- 5 files changed, 6 insertions(+), 411 deletions(-) diff --git a/include_product/media_content_product.h b/include_product/media_content_product.h index cbe3877..28d91dc 100644 --- a/include_product/media_content_product.h +++ b/include_product/media_content_product.h @@ -24,324 +24,36 @@ extern "C" { #endif /* __cplusplus */ /********** media_content **********/ - int media_content_scan_folder_v2(const char *path, bool is_recursive, media_scan_completed_cb_v2 callback, void *user_data); /********** media_info **********/ - -int media_info_delete_from_db(const char *media_id); - -/** - * @brief Gets the extract_flag of media info. - * @since_tizen 2.3 - * - * @remarks You must release @a title using free(). - * - * @param[in] media The media info handle - * @param[out] extract_flag The extract_flag of the media info - * - * @return @c 0 on success, - * otherwise a negative error value - * - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied - */ int media_info_get_extract_flag(media_info_h media, int *extract_flag); int media_info_get_stitched_state(media_info_h media, int *type_360); -/** - * @brief Gets the content's played position parameter. - * @details Function returns content's elapsed playback position parameter as period - * starting from the beginning of the track. - * - * @param[in] media The handle to media info - * @param[out] played_position The elapsed time of the content - * @return 0 on success, otherwise a negative error value. - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int media_info_get_played_position(media_info_h media, int *played_position); -/** - * @brief Gets the played count to content meta handle. - * - * @param[in] media The handle to media info - * @param[out] played_count The played count of content - * @return 0 on success, otherwise a negative error value. - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - */ +int media_info_get_played_position(media_info_h media, int *played_position); int media_info_get_played_count(media_info_h media, int *played_count); - -/** - * @brief Sets the played count to content meta handle. - * - * @param[in] media The handle to media info - * @param[in] played_count The played count of content - * @return 0 on success, otherwise a negative error value. - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - * @post media_info_update_to_db() - */ -int media_info_set_played_count(media_info_h media, int played_count); - -/** - * @brief Sets the played position to content meta handle. - * - * @param[in] media The handle to media info - * @param[in] played_position The played position of content - * @return 0 on success, otherwise a negative error value. - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - * @post media_info_update_to_db() - */ -int media_info_set_played_position(media_info_h media, int played_position); - -/** - * @brief Gets the content's played time. - * @details Gets the latest played(opened) time of the content. - * - * @param[in] media The handle to the media info - * @param[out] played_time The elapsed time of the content - * - * @return 0 on success, - * otherwise a negative error value - * - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - */ int media_info_get_played_time(media_info_h media, time_t *played_time); -/** - * @brief Sets the played time to content meta handle. - * @details You can set the latest played(opened) time of the content file. the latest played time to be set the current time on the system. - * - * @param[in] media The handle to the media info - * - * @return 0 on success, - * otherwise a negative error value - * - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @post media_info_update_to_db() - */ +int media_info_set_played_position(media_info_h media, int played_position); +int media_info_set_played_count(media_info_h media, int played_count); int media_info_set_played_time(media_info_h media); - -int media_info_get_media_info_by_path_from_db(const char* path, media_info_h* media); - - /********** media_folder **********/ int media_folder_get_scan_status(const char *storage_uuid, char* path, media_folder_scan_status_e *scan_status); -int media_folder_reset_scan_status(const char *storage_uuid, const char* path); - -/** - * @brief Sets the folder name. - * @since_tizen 2.3 - * - * @param[in] folder The handle to the media folder - * @param[in] name The name of the media folder - * - * @return @c 0 on success, - * otherwise a negative error value - * - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation - * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory - */ -int media_folder_set_name(media_folder_h folder, const char *name); - -/** - * @brief Updates the media folder to the media database. - * - * @details The function updates the given media folder in the media database. The function should be called after any change in folder attributes, to be updated to the media - * database. - * - * @since_tizen 2.3 - * - * @privlevel public - * @privilege %http://tizen.org/privilege/content.write - * - * @param[in] folder The handle to the media folder - * - * @return @c 0 on success, - * otherwise a negative error value - * - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory - * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation - * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed - * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy - * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail - * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied - * - * @pre This function requires opened connection to content service by media_content_connect(). - * - * @see media_content_connect() - * @see media_folder_destroy() - */ -int media_folder_update_to_db(media_folder_h folder); +int media_folder_reset_scan_status(const char *storage_uuid, const char* path);\ /********** media_group **********/ - - /** - * @brief Iterates through the media group with optional @a filter from the media database. - * @details This function gets the names and counts of media group meeting the given filter. - * The callback function will be invoked for every retrieved media group. - * If NULL is passed to the filter, no filtering is applied. - * - * @param[in] filter The handle to media filter - * @param[in] group The type of media group - * @param[in] callback The callback function to invoke - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - * @pre This function requires opened connection to content service by media_content_connect(). - * @post This function invokes media_group_cb(). - * @see #media_group_and_count_cb - * @see media_content_connect() - * @see media_filter_create() - */ int media_group_foreach_group_and_count_from_db(filter_h filter, media_group_e group, media_group_and_count_cb callback, void *user_data); - /********** media_storage **********/ - -/** - * @brief Gets the storage scan status of media storage. - * @since_tizen 2.4 - * - * @param[in] storage The media storage handle - * @param[out] scan_status The storage type of the media storage - * - * @return @c 0 on success, - * otherwise a negative error value - * - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - */ int media_storage_get_scan_status(const char *storage_uuid, media_storage_scan_status_e *scan_status); - -/** - * @brief Iterates through media storage from the media database. - * @details This function gets all media storage handles meeting the given @a filter. - * The @a callback function will be invoked for every retrieved media storage. - * If @c NULL is passed to the @a filter, then no filtering is applied. - * - * @since_tizen 2.4 - * - * @param[in] filter The handle to the media filter - * @param[in] callback The callback function to be invoked - * @param[in] user_data The user data to be passed to the callback function - * - * @return @c 0 on success, - * otherwise a negative error value - * - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory - * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed - * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy - * - * @pre This function requires opened connection to content service by media_content_connect(). - * @post This function invokes media_storage_destroy(). - * - * @see media_content_connect() - * @see media_storage_destroy() - */ int media_storage_foreach_storage_from_db(filter_h filter, media_storage_cb callback, void *user_data); - -/** - * @brief Destroys media storage handle. - * @details The function frees all resources related to the media storage handle. This handle - * can no longer be used to perform any operations. New media storage handle has to - * be created before the next usage. - * - * @since_tizen 2.4 - * - * @param[in] storage The media storage handle - * - * @return @c 0 on success, - * otherwise a negative error value - * - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @pre Get copy of media_storage_h handle by calling media_storage_clone(). - * - * @see media_storage_clone() - */ int media_storage_destroy(media_storage_h storage); - -/** - * @brief Clones the media storage handle. - * - * @details This function copies the media storage handle from a source to the destination. - * There is no media_storage_create() function. The media_storage_h is created internally and - * available through media storage foreach function such as media_storage_foreach_storage_from_db(). - * To use this handle outside of these foreach functions, use this function. - * - * @since_tizen 2.4 - * - * @remarks The @a dst should be released using media_storage_destroy(). - * - * @param[out] dst The destination handle to the media storage - * @param[in] src The source handle to the media storage - * - * @return @c 0 on success, - * otherwise a negative error value - * - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see media_storage_destroy() - * @see media_storage_foreach_storage_from_db() - * @see media_storage_get_storage_info_from_db() - */ int media_storage_clone(media_storage_h *dst, media_storage_h src); - -/** - * @brief Gets the storage id of media storage. - * @since_tizen 2.4 - * - * @remarks The @a storage_id should be released using free(). - * - * @param[in] storage The media storage handle - * @param[out] storage_id The ID of the media storage - * - * @return @c 0 on success, - * otherwise a negative error value - * - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory - */ int media_storage_get_id(media_storage_h storage, char **storage_id); - -/** - * @brief Gets the storage path of media storage. - * @since_tizen 2.4 - * - * @remarks The @a storage_path should be released using free(). - * - * @param[in] storage The media storage handle - * @param[out] storage_path The storage path of the media storage - * - * @return @c 0 on success, - * otherwise a negative error value - * - * @retval #MEDIA_CONTENT_ERROR_NONE Successful - * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory - */ int media_storage_get_path(media_storage_h storage, char **storage_path); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/include_product/media_info_private.h b/include_product/media_info_private.h index debd02c..fcfdc4e 100644 --- a/include_product/media_info_private.h +++ b/include_product/media_info_private.h @@ -464,7 +464,6 @@ typedef struct _media_content_scan_cb_data_v2 { #define SELECT_MEDIA_FROM_TAG_BY_STORAGE_ID SELECT_MEDIA_FROM_TAG" AND storage_uuid='%s'" #define SELECT_MEDIA_FROM_PLAYLIST "SELECT "MEDIA_INFO_ITEM" FROM "DB_TABLE_MEDIA" WHERE media_id IN (SELECT media_id FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d) AND validity=1" #define SELECT_MEDIA_FROM_PLAYLIST_BY_STORAGE_ID SELECT_MEDIA_FROM_PLAYLIST" AND storage_uuid='%s'" -#define SELECT_MEDIA_PATH_BY_ID "SELECT media_path FROM "DB_TABLE_MEDIA" WHERE media_id='%q'" #define SELECT_MEDIA_STORAGE_ID_BY_ID "SELECT storage_uuid FROM "DB_TABLE_MEDIA" WHERE media_id='%q'" /* Delete */ diff --git a/packaging/capi-content-media-content.spec b/packaging/capi-content-media-content.spec index 634fbc9..fac5a3e 100644 --- a/packaging/capi-content-media-content.spec +++ b/packaging/capi-content-media-content.spec @@ -1,6 +1,6 @@ Name: capi-content-media-content Summary: A Media content library in Tizen Native API -Version: 0.6.6 +Version: 0.6.7 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/media_folder.c b/src/media_folder.c index bf510c9..6764341 100644 --- a/src/media_folder.c +++ b/src/media_folder.c @@ -19,8 +19,6 @@ #include #ifdef _USE_TVPD_MODE #include - -static char *g_src_path = NULL; #endif int media_folder_get_folder_count_from_db(filter_h filter, int *folder_count) @@ -202,56 +200,6 @@ int media_folder_get_folder_from_db(const char *folder_id, media_folder_h *folde return ret; } #ifdef _USE_TVPD_MODE -int media_folder_update_to_db(media_folder_h folder) -{ - int ret = MEDIA_CONTENT_ERROR_NONE; - content_warn("DEPRECATION WARNING: media_folder_update_to_db() is deprecated and will be removed from next release."); - media_folder_s *_folder = (media_folder_s*)folder; - - content_retip_if_fail(folder); - content_retip_if_fail(STRING_VALID(_folder->folder_id)); - - if (!g_src_path) - return ret; - - ret = media_svc_rename_folder(_content_get_db_handle(), _folder->storage_uuid, g_src_path, _folder->path, _content_get_uid()); - g_free(g_src_path); - g_src_path = NULL; - - return _content_error_capi(ret); -} - -int media_folder_set_name(media_folder_h folder, const char *name) -{ - int ret = MEDIA_CONTENT_ERROR_NONE; - content_warn("DEPRECATION WARNING: media_folder_set_name() is deprecated and will be removed from next release."); - media_folder_s *_folder = (media_folder_s*)folder; - char *parent_folder_path = NULL; - - content_retip_if_fail(folder); - content_retip_if_fail(STRING_VALID(name)); - content_retip_if_fail(name[0] != '.'); - content_retip_if_fail(STRING_VALID(_folder->path)); - content_retip_if_fail(STRING_VALID(_folder->name)); - - // Change name.. - g_free(_folder->name); - _folder->name = g_strdup(name); - - // Change path.. - g_free(g_src_path); - g_src_path = g_strdup(_folder->path); - g_free(_folder->path); - - parent_folder_path = g_path_get_dirname(g_src_path); - _folder->path = g_strdup_printf("%s/%s", parent_folder_path, name); - g_free(parent_folder_path); - - content_sec_debug("Old[%s] New[%s]", g_src_path, _folder->path); - - return ret; -} - int media_folder_get_scan_status(const char *storage_uuid, char* path, media_folder_scan_status_e *scan_status) { int ret = MEDIA_CONTENT_ERROR_NONE; diff --git a/src/media_info.c b/src/media_info.c index 363ce69..f82127c 100644 --- a/src/media_info.c +++ b/src/media_info.c @@ -323,70 +323,6 @@ int media_info_insert_batch_to_db(const char **path_array, unsigned int array_le return __media_info_insert_batch(path_array, array_length, completed_cb, user_data); } -#ifdef _USE_TVPD_MODE -int media_info_get_media_info_by_path_from_db(const char* path, media_info_h* media) -{ - int ret = MEDIA_CONTENT_ERROR_NONE; - - content_retip_if_fail(STRING_VALID(path)); - content_retip_if_fail(media); - - media_info_s *_media = g_new0(media_info_s, 1); - - ret = _media_info_get_media_info_from_db(path, (media_info_h)_media); - *media = (media_info_h)_media; - - return ret; -} - -static int __media_info_get_media_path_by_id_from_db(const char *media_id, char **path) -{ - int ret = MEDIA_CONTENT_ERROR_NONE; - sqlite3_stmt *stmt = NULL; - char *select_query = NULL; - - content_retip_if_fail(STRING_VALID(media_id)); - - select_query = sqlite3_mprintf(SELECT_MEDIA_PATH_BY_ID, media_id); - - ret = _content_get_result(select_query, &stmt); - sqlite3_free(select_query); - content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret); - - if (sqlite3_step(stmt) == SQLITE_ROW) { - *path = g_strdup((const char *)sqlite3_column_text(stmt, 0)); - } else { - content_error("There's no media with this ID : %s", media_id); - *path = NULL; - ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER; - } - - sqlite3_finalize(stmt); - - return ret; -} - -int media_info_delete_from_db(const char *media_id) -{ - int ret = MEDIA_CONTENT_ERROR_NONE; - char *path = NULL; - - content_retip_if_fail(STRING_VALID(media_id)); - - ret = __media_info_get_media_path_by_id_from_db(media_id, &path); - if (ret != MEDIA_CONTENT_ERROR_NONE) { - content_error("__media_info_get_media_path_by_id_from_db failed : %d", ret); - g_free(path); - return ret; - } - - ret = media_svc_delete_item_by_path(_content_get_db_handle(), path, _content_get_uid()); - g_free(path); - - return _content_error_capi(ret); -} -#endif - int media_info_destroy(media_info_h media) { media_info_s *_media = (media_info_s*)media; -- 2.34.1