d7734b2d1fa8fee970d63861ddcd6889d8a7d8d7
[platform/core/api/thumbnail-util.git] / include / thumbnail_util_type.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18 #ifndef __TIZEN_THUMBNAIL_UTIL_TYPE_H__
19 #define __TIZEN_THUMBNAIL_UTIL_TYPE_H__
20
21 #include <time.h>
22 #include <tizen.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
27
28 /**
29  * @file thumbnail_util_type.h
30  * @brief This file contains API related to thumbnail_util enumerations for classes of errors. \n
31  *        Listed APIs are called when extracting thumbnail from media files,  \n
32  */
33
34 /**
35 * @addtogroup CAPI_MEDIA_THUMBNAIL_UTIL_MODULE
36  * @{
37  */
38
39 #define THUMBNAIL_UTIL_ERROR_CLASS                              TIZEN_ERROR_THUMBNAIL_UTIL
40
41 /**
42  * @ingroup CAPI_MEDIA_THUMBNAIL_UTIL_MODULE
43  * @brief Enumeration for a thumbnail util error.
44  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
45  */
46 typedef enum {
47         THUMBNAIL_UTIL_ERROR_NONE                    = TIZEN_ERROR_NONE,                    /**< Successful */
48         THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER       = TIZEN_ERROR_INVALID_PARAMETER,       /**< Invalid parameter */
49         THUMBNAIL_UTIL_ERROR_OUT_OF_MEMORY           = TIZEN_ERROR_OUT_OF_MEMORY,           /**< Out of memory */
50         THUMBNAIL_UTIL_ERROR_INVALID_OPERATION       = TIZEN_ERROR_INVALID_OPERATION,       /**< Invalid Operation */
51         THUMBNAIL_UTIL_ERROR_FILE_NO_SPACE_ON_DEVICE       = TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE, /**< No space left on device */
52         THUMBNAIL_UTIL_ERROR_PERMISSION_DENIED          = TIZEN_ERROR_PERMISSION_DENIED,                  /**< Permission denied */
53         THUMBNAIL_UTIL_ERROR_UNSUPPORTED_CONTENT                = THUMBNAIL_UTIL_ERROR_CLASS | 0x01,    /**< Unsupported Content (Since 4.0) */
54 } thumbnail_util_error_e;
55
56
57 /**
58  * @ingroup CAPI_MEDIA_THUMBNAIL_UTIL_MODULE
59  * @brief The structure type for the thumbnail info handle.
60  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
61  */
62 typedef struct thumbnail_s *thumbnail_h;
63
64
65 /**
66  * @ingroup CAPI_MEDIA_THUMBNAIL_UTIL_MODULE
67  * @brief Called when creating the thumbnail.
68  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
69  * @remarks Color space of the generated thumbnail is BGRA. \n
70  *                  The callback is called in a separate thread(not in the main loop). \n
71  *                  You must release @a thumb_data using free().
72  *
73  * @details This callback is called for completion of generating the thumbnail.
74  *         The following error codes can be delivered. \n
75  *         #MEDIA_CONTENT_ERROR_NONE, \n
76  *         #MEDIA_CONTENT_ERROR_INVALID_PARAMETER, \n
77  *         #MEDIA_CONTENT_ERROR_INVALID_OPERATION, \n
78  *         #MEDIA_CONTENT_ERROR_PERMISSION_DENIED, \n
79  *         #MEDIA_CONTENT_ERROR_UNSUPPORTED_CONTENT
80  *
81  * @param[in] error     The error code
82  * @param[in] request_id       The generated request id by thumbnail extraction request
83  * @param[in] thumb_width    The width of the thumbnail which is generated
84  * @param[in] thumb_height   The height of the thumbnail which is generated
85  * @param[in] thumb_data     The raw data of the thumbnail which is generated
86  * @param[in] thumb_size      The size of the thumbnail which is generated
87  * @param[in] user_data        The user data passed from the thumbnail_util_extract() function
88  *
89  * @pre thumbnail_util_extract()
90  *
91  * @see thumbnail_util_extract()
92  */
93 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);
94
95 /**
96  * @}
97  */
98
99 #ifdef __cplusplus
100 }
101 #endif /* __cplusplus */
102
103
104 #endif /*__TIZEN_THUMBNAIL_UTIL_TYPE_H__*/