Tizen 2.1 base
[platform/core/api/media-content.git] / include / media_image.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
19 #ifndef __TIZEN_IMAGE_META_H__
20 #define __TIZEN_IMAGE_META_H__
21
22 #include <media_content_type.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
27
28
29 /**
30  * @addtogroup CAPI_CONTENT_MEDIA_IMAGE_MODULE
31  * @{
32  */
33
34 /**
35  * @brief Clones image metadata.
36  * @details Function copies the image metadata handle from source to destination.
37  *
38  * @remark The destination handle must be released with image_meta_destroy() by you.
39  *
40  * @param [out] dst A destination handle to image metadata
41  * @param [in] src The source handle to image metadata
42  * @return 0 on success, otherwise a negative error value.
43  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
44  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
45  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
46  * @see image_meta_destroy()
47  */
48 int image_meta_clone(image_meta_h *dst, image_meta_h src);
49
50 /**
51  * @brief Destroys image metadata.
52  * @details The function frees all resources related to the image metadata handle. This handle
53  * no longer can be used to perform any operation. A new handle has to
54  * be created before next usage.
55  *
56  * @param [in] image The handle to image metadata
57  * @return 0 on success, otherwise a negative error value.
58  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
59  * @pre Get copy of image_meta handle by calling image_meta_clone()
60  * @see image_meta_clone()
61  */
62 int image_meta_destroy(image_meta_h image);
63
64 /**
65  * @brief Gets the ID of image.
66  *
67  * @param [in] image The handle to image metadata
68  * @param [out] media_id The ID of image
69  * @return 0 on success, otherwise a negative error value.
70  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
71  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
72  */
73 int image_meta_get_media_id(image_meta_h image, char **media_id);
74
75 /**
76  * @brief Gets image's width in pixels.
77  *
78  * @param [in] image The handle to image metadata
79  * @param [out] width The image width in pixels
80  * @return 0 on success, otherwise a negative error value.
81  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
82  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
83  */
84 int image_meta_get_width(image_meta_h image, int *width);
85
86 /**
87  * @brief Gets image's height in pixels.
88  *
89  * @param [in] image The handle to image metadata
90  * @param [out] height The image height in pixels
91  * @return 0 on success, otherwise a negative error value.
92  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
93  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
94  */
95 int image_meta_get_height(image_meta_h image, int *height);
96
97 /**
98  * @brief Gets the image orientation.
99  *
100  * @param [in] image The handle to image metadata
101  * @param [out] orientation The image orientation
102  * @return 0 on success, otherwise a negative error value.
103  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
104  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
105  */
106 int image_meta_get_orientation(image_meta_h image, media_content_orientation_e *orientation);
107
108 /**
109  * @brief Gets the date, when image was created as time_t structure.
110  *
111  * @param [in] image The handle to image metadata
112  * @param [out] date_taken The time, when image was taken (in seconds, since the Epoch)
113  * @return 0 on success, otherwise a negative error value.
114  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
115  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
116  */
117 int image_meta_get_date_taken(image_meta_h image, char **date_taken);
118
119 /**
120  * @brief Sets the image orientation.
121  *
122  * @param [in] image The handle to image metadata
123  * @param [in] orientation The image orientation
124  * @return 0 on success, otherwise a negative error value.
125  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
126  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
127  * @post image_meta_update_to_db()
128  */
129 int image_meta_set_orientation(image_meta_h image, media_content_orientation_e orientation);
130
131 /**
132  * @brief Updates the image to the media database.
133  *
134  * @details The function updates the given image meta in the media database. The function should be called after any change in image attributes, to be updated to the media 
135  * database. For example, after using image_meta_set_orientation() for setting the orientation of the image, image_meta_update_to_db() function should be called so as to update 
136  * the given image attibutes in the media database.
137  *
138  * @param[in] image The handle to image
139  * @return 0 on success, otherwise a negative error value.
140  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
141  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
142  * @pre This function requires opened connection to content service by media_content_connect().
143  * @see media_content_connect()
144  * @see image_meta_set_orientation()
145  *
146  */
147 int image_meta_update_to_db(image_meta_h image);
148
149 /**
150  * @}
151  */
152
153
154 #ifdef __cplusplus
155 }
156 #endif /* __cplusplus */
157
158 #endif /*__TIZEN_IMAGE_META_H__*/