/**
+ * @deprecated Deprecated since 5.0.
* @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
* @brief Called when creating a thumbnail image.
* @details This callback is called for completion of generating the thumbnail image.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @remarks The @a path should be released using free(). \n
- * If the thumbnail extraction for the given media has not been requested yet, this function returns NULL. To create a thumbnail, you should use media_info_create_thumbnail() function. \n
- * Since 3.0, this function returns an empty string if media_info_create_thumbnail() has failed to create a thumbnail for the given media.
+ * If the thumbnail extraction for the given media has not been requested yet, this function returns NULL. \n
+ * To create a thumbnail, you should use media_info_generate_thumbnail() function. \n
+ * This function returns an empty string if media_info_generate_thumbnail() has failed to create a thumbnail for the given media.
*
* @param[in] media The handle to the media info
* @param[out] path The thumbnail path
int media_info_move_to_db(media_info_h media, const char* dst_path);
/**
+ * @deprecated Deprecated since 5.0. Use media_info_generate_thumbnail() instead.
* @brief Creates a thumbnail file for the given media, asynchronously.
* @details This function creates an thumbnail file for given media item and calls @a callback for completion of creating the thumbnail.
* If a thumbnail already exists for the given media, then the path of thumbnail will be returned in callback function. \n
*
* @see media_content_connect()
*/
-int media_info_create_thumbnail(media_info_h media, media_thumbnail_completed_cb callback, void *user_data);
+int media_info_create_thumbnail(media_info_h media, media_thumbnail_completed_cb callback, void *user_data) TIZEN_DEPRECATED_API;
/**
+ * @deprecated Deprecated since 5.0.
* @brief Cancels the creation of thumbnail file for the given media.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @pre This function requires opened connection to content service by media_content_connect().
* @see media_content_connect()
*/
-int media_info_cancel_thumbnail(media_info_h media);
+int media_info_cancel_thumbnail(media_info_h media) TIZEN_DEPRECATED_API;
+
+/**
+ * @brief Generates a thumbnail file for the given media, synchronously.
+ *
+ * @since_tizen 5.0
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. \n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n
+ * Items in external storage are not supported, with the exception of MMC.
+ *
+ * @param[in] 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_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_info_get_thumbnail_path()
+ */
+int media_info_generate_thumbnail(media_info_h media);
/**
* @ingroup CAPI_CONTENT_MEDIA_FACE_DETECTION_MODULE
/**
+ * @deprecated Deprecated since 5.0.
* @ingroup CAPI_CONTENT_MEDIA_INFO_MODULE
* @brief Called when creating a thumbnail image.
* @details This callback is called for completion of generating the thumbnail image.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @remarks The @a path should be released using free(). \n
- * If the thumbnail extraction for the given media has not been requested yet, this function returns NULL. To create a thumbnail, you should use media_info_create_thumbnail() function. \n
- * Since 3.0, this function returns an empty string if media_info_create_thumbnail() has failed to create a thumbnail for the given media.
+ * If the thumbnail extraction for the given media has not been requested yet, this function returns NULL. \n
+ * To create a thumbnail, you should use media_info_generate_thumbnail() function. \n
+ * This function returns an empty string if media_info_generate_thumbnail() has failed to create a thumbnail for the given media.
*
* @param[in] media The handle to the media info
* @param[out] path The thumbnail path
int media_info_move_to_db(media_info_h media, const char* dst_path);
/**
+ * @deprecated Deprecated since 5.0. Use media_info_generate_thumbnail() instead.
* @brief Creates a thumbnail file for the given media, asynchronously.
* @details This function creates an thumbnail file for given media item and calls @a callback for completion of creating the thumbnail.
* If a thumbnail already exists for the given media, then the path of thumbnail will be returned in callback function. \n
*
* @see media_content_connect()
*/
-int media_info_create_thumbnail(media_info_h media, media_thumbnail_completed_cb callback, void *user_data);
+int media_info_create_thumbnail(media_info_h media, media_thumbnail_completed_cb callback, void *user_data) TIZEN_DEPRECATED_API;
/**
+ * @deprecated Deprecated since 5.0.
* @brief Cancels the creation of thumbnail file for the given media.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @pre This function requires opened connection to content service by media_content_connect().
* @see media_content_connect()
*/
-int media_info_cancel_thumbnail(media_info_h media);
+int media_info_cancel_thumbnail(media_info_h media) TIZEN_DEPRECATED_API;
+
+/**
+ * @brief Generates a thumbnail file for the given media, synchronously.
+ *
+ * @since_tizen 5.0
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/content.write
+ *
+ * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. \n
+ * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n
+ * Items in external storage are not supported, with the exception of MMC.
+ *
+ * @param[in] 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_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_info_get_thumbnail_path()
+ */
+int media_info_generate_thumbnail(media_info_h media);
/**
* @ingroup CAPI_CONTENT_MEDIA_FACE_DETECTION_MODULE
int media_info_create_thumbnail(media_info_h media, media_thumbnail_completed_cb callback, void *user_data)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_content_warn("DEPRECATION WARNING: media_info_create_thumbnail() is deprecated and will be removed from next release. Use media_info_generate_thumbnail() instead.");
static unsigned int req_id = 0;
char repl_path[MAX_PATH_LEN] = {0, };
media_info_s *_media = (media_info_s*)media;
return ret;
}
+int media_info_generate_thumbnail(media_info_h media)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ char repl_path[MAX_PATH_LEN] = {0, };
+ char *thumb_path = NULL;
+ media_info_s *_media = (media_info_s*)media;
+
+ if (_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path)) {
+ /* Already exists */
+ if (STRING_VALID(_media->thumbnail_path))
+ return MEDIA_CONTENT_ERROR_NONE;
+
+ memset(repl_path, 0, sizeof(repl_path));
+ ret = _media_content_replace_path(_media->file_path, repl_path);
+ media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
+
+ ret = media_svc_create_thumbnail(repl_path, _media->media_type, _content_get_uid(), &thumb_path);
+ ret = _content_error_capi(MEDIA_THUMBNAIL_TYPE, ret);
+ if (ret == MEDIA_CONTENT_ERROR_UNSUPPORTED_CONTENT)
+ return ret;
+
+ /* thumb_path is not NULL except #MEDIA_CONTENT_ERROR_UNSUPPORTED_CONTENT */
+ _media->thumbnail_path = g_strdup(thumb_path);
+ SAFE_FREE(thumb_path);
+ if (_media->thumbnail_path == NULL)
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ } else {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+
int media_info_cancel_thumbnail(media_info_h media)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_content_warn("DEPRECATION WARNING: media_info_cancel_thumbnail() is deprecated and will be removed from next release.");
media_info_s *_media = (media_info_s*)media;
if (_media != NULL && STRING_VALID(_media->media_id) && _media->request_id > 0) {