int media_info_get_media_from_db(const char *media_id, media_info_h *media);
/**
+ * @brief Gets the media info from the media database using path.
+ *
+ * @details This function creates a new media handle filled with information from the database by the given @a media_path.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks The @a media should be released using media_info_destroy().\n
+ * If you want to access only internal storage by using this function, you should add privilege %http://tizen.org/privilege/mediastorage. \n
+ * If you want to access only external storage by using this function, you should add privilege %http://tizen.org/privilege/externalstorage. \n
+ * If you want to access storages of both types, you must add all privileges. \n
+ *
+ * @param[in] media_path The media path
+ * @param[out] media The handle to the media info
+ *
+ * @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
+ * @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_info_destroy()
+ */
+int media_info_get_media_from_db_by_path(const char *media_path, media_info_h *media);
+
+/**
* @brief Sets the favorite of media info.
* @details This function can mark favorite of the media. If set to @c true, this function record the time of the change moment. \n
* So, If you use it in order parameter, you can sort the order of the time was a favorite. \n
int media_info_get_media_from_db(const char *media_id, media_info_h *media);
/**
+ * @brief Gets the media info from the media database using path.
+ *
+ * @details This function creates a new media handle filled with information from the database by the given @a media_path.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks The @a media should be released using media_info_destroy().\n
+ * If you want to access only internal storage by using this function, you should add privilege %http://tizen.org/privilege/mediastorage. \n
+ * If you want to access only external storage by using this function, you should add privilege %http://tizen.org/privilege/externalstorage. \n
+ * If you want to access storages of both types, you must add all privileges. \n
+ *
+ * @param[in] media_path The media path
+ * @param[out] media The handle to the media info
+ *
+ * @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
+ * @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_info_destroy()
+ */
+int media_info_get_media_from_db_by_path(const char *media_path, media_info_h *media);
+
+/**
* @brief Sets the favorite of media info.
* @details This function can mark favorite of the media. If set to @c true, this function record the time of the change moment. \n
* So, If you use it in order parameter, you can sort the order of the time was a favorite. \n
Name: capi-content-media-content
Summary: A Media content library in Tizen Native API
-Version: 0.4.13
+Version: 0.4.14
Release: 0
Group: Multimedia/API
License: Apache-2.0
return ret;
}
+int media_info_get_media_from_db_by_path(const char *path, media_info_h *media)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_info_s *_media = NULL;
+
+ content_retip_if_fail(STRING_VALID(path));
+ content_retip_if_fail(media);
+ ret = _media_util_check_file_exist(path);
+ content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "_media_util_check_file_exist failed : %d", ret);
+
+#ifdef _USE_TVPD_MODE
+ char storage_id[MEDIA_CONTENT_UUID_SIZE + 1] = {0, };
+
+ ret = media_svc_get_storage_id(_content_get_db_handle(), path, storage_id, _content_get_uid());
+ if (ret != MS_MEDIA_ERR_NONE) {
+ content_error("media_svc_get_storage_id failed : %d", ret);
+ return _content_error_capi(ret);
+ }
+#endif
+
+ _media = g_new0(media_info_s, 1);
+
+#ifdef _USE_TVPD_MODE
+ ret = _media_info_get_media_info_from_db(path, STRING_VALID(storage_id) ? storage_id : DB_TABLE_MEDIA, (media_info_h)_media);
+#else
+ ret = _media_info_get_media_info_from_db(path, (media_info_h)_media);
+#endif
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ g_free(_media);
+ _media = NULL;
+ }
+
+ *media = (media_info_h)_media;
+
+ return ret;
+}
+
int media_info_set_favorite(media_info_h media, bool favorite)
{
media_info_s *_media = (media_info_s*)media;
{
int ret = MEDIA_CONTENT_ERROR_NONE;
char repl_path[MAX_PATH_LEN] = {0, };
- media_info_s *_info = NULL;\r
+ media_info_s *_info = NULL;
#ifdef _USE_TVPD_MODE
char storage_id[MEDIA_CONTENT_UUID_SIZE + 1] = {0, };
#endif