Tizen Native API
3.0
|
The Thumbnail Util API provides functions for creating the thumbnail from an input media file.
Required Header
#include <thumbnail_util.h>
Overview
The Thumbnail Util API allows you to create the thumbnail from a media file. To extract a thumbnail(thumbnail_util_extract()), create/destory the handle(thumbnail_util_create()/thumbnail_util_destroy). To set the path, width and height for extracting, and cancel thumbnail_util_cancel().
Functions | |
int | thumbnail_util_create (thumbnail_h *thumb) |
Creates thumbnail info handle. | |
int | thumbnail_util_extract (thumbnail_h thumb, thumbnail_extracted_cb callback, void *user_data, char **request_id) |
Extracts the thumbnail for the given media, asynchronously. | |
int | thumbnail_util_set_path (thumbnail_h thumb, const char *path) |
Sets the path of original media file. | |
int | thumbnail_util_set_size (thumbnail_h thumb, int width, int height) |
Sets the size of thumbnail to be extracted. | |
int | thumbnail_util_cancel (thumbnail_h thumb, const char *request_id) |
Cancels the thumbnail extraction request for the given media. | |
int | thumbnail_util_cancel_all (thumbnail_h thumb) |
Cancels all thumbnail extraction requests associated with the given thumbnail info handle. | |
int | thumbnail_util_destroy (thumbnail_h thumb) |
Destroys thumbnail info handle. | |
Typedefs | |
typedef struct thumbnail_s * | thumbnail_h |
The structure type for the thumbnail info handle. | |
typedef void(* | thumbnail_extracted_cb )(thumbnail_util_error_e error, const char *request_id, int thumb_width, int thumb_height, unsigned char *thumb_data, int thumb_size, void *user_data) |
Called when creating the thumbnail. |
Typedef Documentation
typedef void(* thumbnail_extracted_cb)(thumbnail_util_error_e error, const char *request_id, int thumb_width, int thumb_height, unsigned char *thumb_data, int thumb_size, void *user_data) |
Called when creating the thumbnail.
- Since :
- 3.0
- Remarks:
- Color space of the generated thumbnail is BGRA.
The callback is called in a separate thread(not in the main loop).
You must release thumb_data using free().
This callback is called for completion of generating the thumbnail.
- Parameters:
-
[in] error The error code [in] request_id The generated request id by thumbnail extraction request [in] thumb_width The width of the thumbnail which is generated [in] thumb_height The height of the thumbnail which is generated [in] thumb_data The raw data of the thumbnail which is generated [in] thumb_size The size of the thumbnail which is generated [in] user_data The user data passed from the thumbnail_util_extract() fuction
- Precondition:
- thumbnail_util_extract()
- See also:
- thumbnail_util_extract()
typedef struct thumbnail_s* thumbnail_h |
The structure type for the thumbnail info handle.
- Since :
- 3.0
Enumeration Type Documentation
Enumeration for a thumbnail util error.
- Since :
- 3.0
- Enumerator:
Function Documentation
int thumbnail_util_cancel | ( | thumbnail_h | thumb, |
const char * | request_id | ||
) |
Cancels the thumbnail extraction request for the given media.
- Since :
- 3.0
- Remarks:
- If there is no item you want to cancel, this API return MEDIA_CONTENT_ERROR_INVALID_OPERATION
- Parameters:
-
[in] thumb The media thumbnail info handle [in] request_id The generated request id by thumbnail extraction request
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
THUMBNAIL_UTIL_ERROR_NONE Successful THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter THUMBNAIL_UTIL_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- Create a thumbnail info handle by calling thumbnail_util_create().
int thumbnail_util_cancel_all | ( | thumbnail_h | thumb | ) |
Cancels all thumbnail extraction requests associated with the given thumbnail info handle.
- Since :
- 3.0
- Remarks:
- If there is no item you want to cancel, this API return MEDIA_CONTENT_ERROR_INVALID_OPERATION
- Parameters:
-
[in] thumb The media thumbnail info handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
THUMBNAIL_UTIL_ERROR_NONE Successful THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter THUMBNAIL_UTIL_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- Create a thumbnail info handle by calling thumbnail_util_create().
int thumbnail_util_create | ( | thumbnail_h * | thumb | ) |
Creates thumbnail info handle.
- Since :
- 3.0
- Remarks:
- You must release thumb info using thumbnail_util_destroy().
- Parameters:
-
[in] thumb The handle to thumbnail info
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
THUMBNAIL_UTIL_ERROR_NONE Successful THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter THUMBNAIL_UTIL_ERROR_OUT_OF_MEMORY Not enough memory is available THUMBNAIL_UTIL_ERROR_PERMISSION_DENIED Permission denied
- Postcondition:
- Created handle should be released using thumbnail_util_destroy() API.
int thumbnail_util_destroy | ( | thumbnail_h | thumb | ) |
Destroys thumbnail info handle.
The function frees all resources related to the thumbnail info handle. This handle can no longer be used to perform any operation. New thumbnail info handle has to be created before the next usage.
- Since :
- 3.0
- Parameters:
-
[in] thumb The thumbnail info handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
THUMBNAIL_UTIL_ERROR_NONE Successful THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter THUMBNAIL_UTIL_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- Create a thumbnail info handle by calling thumbnail_util_create().
int thumbnail_util_extract | ( | thumbnail_h | thumb, |
thumbnail_extracted_cb | callback, | ||
void * | user_data, | ||
char ** | request_id | ||
) |
Extracts the thumbnail for the given media, asynchronously.
This function extracts the thumbnail for given media item and calls registered callback function for completion of extracting the thumbnail.
- Since :
- 3.0
- Remarks:
- You must release request_id using free().
http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.
http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
If you don't set the size, the thumbnail size will be set default size. Default size is 320x240.
Color space of the generated thumbnail is BGRA.
Since 3.0, http://tizen.org/privilege/content.write privilege is not required.
- Parameters:
-
[in] thumb The thumbnail info handle [in] callback The callback function to be invoked [in] user_data The user data to be passed to the callback function [out] request_id The request id for the thumbnail extraction request
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
THUMBNAIL_UTIL_ERROR_NONE Successful THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter THUMBNAIL_UTIL_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- Create a thumbnail info handle by calling thumbnail_util_create().
The content path that you want to generate thumbnail must be set by calling thumbnail_util_set_path().
- Postcondition:
- Thumbnail extraction result except canceled is provided by thumbnail_extracted_cb.
int thumbnail_util_set_path | ( | thumbnail_h | thumb, |
const char * | path | ||
) |
Sets the path of original media file.
- Since :
- 3.0
- Parameters:
-
[in] thumb The thumbnail info handle [in] path The path of the original media file
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
THUMBNAIL_UTIL_ERROR_NONE Successful THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter THUMBNAIL_UTIL_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- Create a thumbnail info handle by calling thumbnail_util_create().
- See also:
- Set the thumbnail size you want by calling thumbnail_util_size().
- Postcondition:
- Extract the thumbnail by calling thumbnail_util_extract().
int thumbnail_util_set_size | ( | thumbnail_h | thumb, |
int | width, | ||
int | height | ||
) |
Sets the size of thumbnail to be extracted.
- Since :
- 3.0
- Remarks:
- If you don't set the size, the thumbnail size will be set default size. Default size is 320x240.
If the set width is not a multiple of 8, it can be changed by inner process. the width will be a multiple of 8 greater than the set value.
- Parameters:
-
[in] thumb The thumbnail info handle [in] width The width of the thumbnail [in] height The height of the thumbnail
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
THUMBNAIL_UTIL_ERROR_NONE Successful THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter THUMBNAIL_UTIL_ERROR_PERMISSION_DENIED Permission denied
- Precondition:
- Create a thumbnail info handle by calling thumbnail_util_create().
- Postcondition:
- Extract the thumbnail by calling thumbnail_util_extract().