Remove unused API & update description
[platform/core/api/media-content.git] / include / media_folder.h
index 38f7899..53cff8f 100755 (executable)
@@ -27,97 +27,154 @@ extern "C" {
 #endif /* __cplusplus */
 
 /**
+ * @file media_folder.h
+ * @brief This file contains API related to all operations with media folder in DB. \n
+ *        These functions include getting the number of folders and media files filtered from DB,  \n
+ *        iterating through media files and folders filtered in the given folder from DB;  \n
+ *        cloning and destroying the media folder, getting its name, ID, absolute path and date \n
+ *        and updating the media folder to the media database.
+ */
+
+/**
  * @addtogroup CAPI_CONTENT_MEDIA_FOLDER_MODULE
  * @{
  */
 
+
 /**
- * @brief Gets the number of folder for the passed @a filter from the media database.
+ * @brief Gets the count of folder for the passed @a filter from the media database.
+ * @since_tizen 2.3
+ *
+ * @param[in]  filter       The handle to filter \n
+ *                          To allow searching over different content types, you should use #filter_h.
+ * @param[out] folder_count The count of the media folder
  *
- * @param[in] filter The handle to filter. \n To allow searching over different content types, you should use @a filter_h.
- * @param[out] folder_count The count of media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @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_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @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_content_connect()
  */
 int media_folder_get_folder_count_from_db(filter_h filter, int *folder_count);
 
 /**
  * @brief Iterates through available media folders with optional @a filter from the media database.
- * @details This function gets media folder handles meeting the given 
- * @a filter. The @a callback function will be invoked for every retrieved
- * folder. If NULL is passed to the @a filter, no filtering is applied.
+ * @details This function gets the media folder meeting the given @a filter.
+ *          The @a callback function will be invoked for every retrieved
+ *          folder. If @c NULL is passed to the @a filter, no filtering is applied.
  *
- * @param[in] filter The handle to media folder filter
- * @param[in] callback The callback function to invoke
+ * @since_tizen 2.3
+ *
+ * @remarks Do not call updating DB fuction like media_folder_update_to_db() in your callback function, your callback function is invoked as inline function.\n
+ *                   So, your callback function is in read state in SQLite. When you are in read state, sometimes you do not update DB. \n
+ *                   We do not recommend you call updating DB function in callback of foreach function.
+ *
+ * @param[in] filter    The handle to the media folder 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 return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @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
- * @pre This function requires opened connection to content service by media_content_connect().
- * @pre A filter handle has to be created by calling media_folder_filter_create()
- * @post This function invokes media_folder_cb()
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
+ * @pre  A filter handle has to be created by calling media_filter_create().
+ * @post This function invokes media_folder_cb().
+ *
  * @see media_content_connect()
- * @see #media_folder_cb
+ * @see media_folder_cb()
  * @see media_filter_create()
  */
 int media_folder_foreach_folder_from_db(filter_h filter, media_folder_cb callback, void *user_data);
 
 /**
- * @brief Gets the number of media files for the passed @a filter in the given @a folder from the media database.
+ * @brief Gets the count of media files for the passed @a filter in the given @a folder from the media database.
+ * @since_tizen 2.3
  *
- * @param[in] folder_id The ID of media folder
- * @param[in] filter The filter of media content
+ * @param[in] folder_id    The ID of the media folder
+ * @param[in] filter       The filter of the media content
  * @param[out] media_count The count of media folder items
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @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_DB_FAILED DB operation failed
+ * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB operation failed
+ * @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_content_connect()
  */
 int media_folder_get_media_count_from_db(const char *folder_id, filter_h filter, int *media_count);
 
 /**
- * @brief Iterates through the media files with optional @a filter in the given @a folder from the media database.
+ * @brief Iterates through the media files with an optional @a filter in the given @a folder from the media database.
  * @details This function gets all media files associated with the given folder and
- * meeting desired filter option and calls registered callback function for
- * every retrieved media item. If NULL is passed to the @a filter, no filtering is applied.
+ *          meeting desired filter option and calls registered callback function for
+ *          every retrieved media item. If @c NULL is passed to the @a filter, no filtering is applied.
+ *
+ * @since_tizen 2.3
  *
- * @param[in] folder_id The ID of media folder
- * @param[in] filter The handle to media info filter
- * @param[in] callback The callback function to invoke
+ * @remarks   Do not call updating DB function like media_info_update_to_db(), media_info_refresh_metadata_to_db(), audio_meta_update_to_db(), image_meta_update_to_db() and video_meta_update_to_db()  in your callback function,
+ *                    your callback function is invoked as inline function. \n
+ *                    So, your callback function is in read state in SQLite. When you are in read state, sometimes you do not update DB. \n
+ *                    We do not recommend you call updating DB function in callback of foreach function.
+ *
+ * @param[in] folder_id The ID of the media folder
+ * @param[in] filter    The handle to the media info 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 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *
+ * @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
- * @pre This function requires opened connection to content service by media_content_connect().
- * @post This function invokes media_info_cb()
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre  This function requires opened connection to content service by media_content_connect().
+ * @post This function invokes media_info_cb().
+ *
  * @see #media_info_cb
  * @see media_content_connect()
- * @see media_folder_filter_create()
+ * @see media_filter_create()
  */
 int media_folder_foreach_media_from_db(const char *folder_id, filter_h filter, media_info_cb callback, void *user_data);
 
 /**
  * @brief Clones the media folder.
  * @details This function copies the media folder handle from a source to
- * destination. There is no media_folder_create() function. The media_folder_h is created internally and available through 
- * media folder foreach function such as media_folder_foreach_folder_from_db(). To use this handle outside of these foreach functions, 
- * use this function.
- * @remark The destination handle must be released with media_folder_destroy() by you.
- * @param[out] dst A destination handle to media folder
- * @param[in] src The source handle to media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ *          destination. There is no media_folder_create() function. The media_folder_h is created internally and available through
+ *          media folder foreach function such as media_folder_foreach_folder_from_db(). To use this handle outside of these foreach functions,
+ *          use this function.
+ *
+ * @since_tizen 2.3
+ *
+ * @remarks The destination handle must be released with media_folder_destroy().
+ *
+ * @param[out] dst The destination handle to the media folder
+ * @param[in]  src The source 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_PERMISSION_DENIED Permission denied
+ *
  * @see media_folder_destroy()
  * @see media_folder_foreach_folder_from_db()
  */
@@ -126,99 +183,135 @@ int media_folder_clone(media_folder_h *dst, media_folder_h src);
 /**
  * @brief Destroys the media folder.
  * @details The function frees all resources related to the folder handle. This handle
- * no longer can be used to perform any operation. A new handle has to
- * be created before the next use.
+ *          no longer can be used to perform any operation. A new handle has to
+ *          be created before the next use.
+ *
+ * @since_tizen 2.3
+ *
+ * @param[in] folder The handle to the media folder
  *
- * @param[in] folder The handle to media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @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 A copy of the media folder handle created by calling media_folder_clone()
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre A copy of the media folder handle created by calling media_folder_clone().
+ *
  * @see media_folder_clone()
  */
 int media_folder_destroy(media_folder_h folder);
 
 /**
- * @brief Gets media folder's ID.
+ * @brief Gets the media folder ID.
+ * @since_tizen 2.3
+ *
+ * @remarks You must release @a folder_id using free().
  *
- * @remarks @a folder_id must be released with free() by you.
+ * @param[in]  folder    The handle to the media folder
+ * @param[out] folder_id The ID of the media folder
  *
- * @param [in] folder The handle to media folder
- * @param [out] folder_id The ID of media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @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_PERMISSION_DENIED Permission denied
  */
 int media_folder_get_folder_id(media_folder_h folder, char **folder_id);
 
 /**
- * @brief Gets the absolute path to the folder.
+ * @brief Gets the absolute path to the media folder.
+ * @since_tizen 2.3
+ *
+ * @remarks You must release @a path using free().
  *
- * @remarks @a path must be released with free() by you.
+ * @param[in]  folder The handle to the media folder
+ * @param[out] path   The path of the media folder
  *
- * @param[in] folder The handle to media folder
- * @param[out] path The path of the media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @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_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
  */
 int media_folder_get_path(media_folder_h folder, char **path);
 
 /**
- * @brief Gets the folder name.
+ * @brief Gets the media folder name.
+ * @since_tizen 2.3
  *
- * @remarks @a folder_name must be released with free() by you.
+ * @remarks You must release @a folder_name using free().
  *
- * @param[in] folder The handle to media folder
+ * @param[in]  folder      The handle to the media folder
  * @param[out] folder_name The name of the media folder
- * @return 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
  *
+ * @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_PERMISSION_DENIED Permission denied
  */
 int media_folder_get_name(media_folder_h folder, char **folder_name);
 
 /**
  * @brief Gets the modified date of the folder.
+ * @since_tizen 2.3
  *
- * @param[in] folder The handle to media 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
+ * @param[in]  folder The handle to the media folder
+ * @param[out] date   The modified date of the 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
  */
 int media_folder_get_modified_time(media_folder_h folder, time_t *date);
 
 /**
  * @brief Gets the folder storage type.
+ * @since_tizen 2.3
  *
- * @param[in] folder The handle to media folder
+ * @param[in]  folder       The handle to the media folder
  * @param[out] storage_type The storage type of the media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
- * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
  *
+ * @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_PERMISSION_DENIED Permission denied
  */
 int media_folder_get_storage_type(media_folder_h folder, media_content_storage_e *storage_type);
 
 /**
  * @brief Gets the media folder from the media database.
  *
- * @details This function creates a new media folder handle from the media database by the given folder_id.
- * media folder will be created, which is filled with folder information.
+ * @details This function creates a new media folder handle from the media database by the given @a folder_id.
+ *          Media folder will be created, which is filled with folder information.
+ * @since_tizen 2.3
+ *
+ * @remarks You must release @a folder using media_folder_destroy().
  *
- * @remarks @a folder must be released with media_folder_destroy() by you.
+ * @param[in]  folder_id The ID of the media folder
+ * @param[out] folder    The media folder handle associated with the folder ID
  *
- * @param[in] folder_id The ID of media folder
- * @param[out] folder The media folder handle associated with the folder ID
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @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_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()
  *
@@ -228,33 +321,49 @@ int media_folder_get_folder_from_db(const char *folder_id, media_folder_h *folde
 /**
  * @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. For example, after using media_folder_set_name() for setting the name of the folder, media_folder_update_to_db() function should be called so as to update 
- * the given folder attibutes in 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. For example, after using media_folder_set_name() for setting the name of the folder, the media_folder_update_to_db() function should be called so as to update
+ *          the given folder attributes in 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
  *
- * @param[in] folder The handle to media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @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_PERMISSION_DENIED Permission denied
+ *
  * @pre This function requires opened connection to content service by media_content_connect().
+ * @pre If you do not set new name of folder by using media_folder_set_name(), your updating function is failed.
+ *
  * @see media_content_connect()
  * @see media_folder_destroy()
  * @see media_folder_set_name()
- *
  */
 int media_folder_update_to_db(media_folder_h folder);
 
 /**
  * @brief Sets the folder name.
+ * @since_tizen 2.3
  *
- * @param[in] folder The handle to media folder
- * @param[in] name The name of the media folder
- * @return 0 on success, otherwise a negative error value.
- * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @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_OUT_OF_MEMORY Out of memory
- * @post media_folder_update_to_db()
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
  *
+ * @post media_folder_update_to_db()
  */
 int media_folder_set_name(media_folder_h folder, const char *name);