Sync to product code
[platform/core/api/media-content.git] / include_product / 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  * @brief This file contains the image metadata API and related functions to proceed with them.
30  *        Functions include cloning and destroying the image metadata, getting image metadata such as width, height, \n
31  *        orientation, date taken, title, burst shot id and updating image to DB.
32  */
33
34 /**
35  * @addtogroup CAPI_CONTENT_MEDIA_IMAGE_MODULE
36  * @{
37  */
38
39
40 /**
41  * @brief Clones the image metadata.
42  * @details The function copies the image metadata handle from a source to destination.
43  *
44  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
45  *
46  * @remarks The destination handle must be released with image_meta_destroy().
47  *
48  * @param[out] dst  The destination handle to the image metadata
49  * @param[in]  src  The source handle to the image metadata
50  *
51  * @return @c 0 on success,
52  *         otherwise a negative error value
53  *
54  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
55  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
56  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
57  *
58  * @see image_meta_destroy()
59  */
60 int image_meta_clone(image_meta_h *dst, image_meta_h src);
61
62 /**
63  * @brief Destroys the image metadata.
64  * @details The function frees all resources related to the image metadata handle. This handle
65  *          no longer can be used to perform any operation. A new handle has to
66  *          be created before next usage.
67  *
68  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
69  *
70  * @param[in] image The image metadata handle
71  *
72  * @return @c 0 on success,
73  *         otherwise a negative error value
74  *
75  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
76  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
77  *
78  * @pre Get a copy of image_meta handle by calling image_meta_clone().
79  *
80  * @see image_meta_clone()
81  */
82 int image_meta_destroy(image_meta_h image);
83
84 /**
85  * @brief Gets the ID of an image.
86  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
87  *
88  * @param[in]  image    The image metadata handle
89  * @param[out] media_id The ID of an image
90  *
91  * @return @c 0 on success,
92  *         otherwise a negative error value
93  *
94  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
95  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
96  */
97 int image_meta_get_media_id(image_meta_h image, char **media_id);
98
99 /**
100  * @brief Gets the image width in pixels.
101  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
102  *
103  * @param[in]  image The image metadata handle
104  * @param[out] width The image width in pixels
105  *
106  * @return @c 0 on success,
107  *         otherwise a negative error value
108  *
109  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
110  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
111  */
112 int image_meta_get_width(image_meta_h image, int *width);
113
114 /**
115  * @brief Gets the image height in pixels.
116  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
117  *
118  * @param[in]  image  The image metadata handle
119  * @param[out] height The image height in pixels
120  *
121  * @return @c 0 on success,
122  *         otherwise a negative error value
123  *
124  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
125  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
126  */
127 int image_meta_get_height(image_meta_h image, int *height);
128
129 /**
130  * @brief Gets the image orientation.
131  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
132  *
133  * @param[in]  image       The image metadata handle
134  * @param[out] orientation The image orientation
135  *
136  * @return @c 0 on success,
137  *         otherwise a negative error value
138  *
139  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
140  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
141  */
142 int image_meta_get_orientation(image_meta_h image, media_content_orientation_e *orientation);
143
144 /**
145  * @brief Gets the image creation time.
146  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
147  *
148  * @param[in]  image      The image metadata handle
149  * @param[out] date_taken The time, when image was taken (in seconds, since the Epoch)
150  *
151  * @return @c 0 on success,
152  *         otherwise a negative error value
153  *
154  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
155  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
156  */
157 int image_meta_get_date_taken(image_meta_h image, char **date_taken);
158
159 /**
160  * @brief Gets the burst shot ID.
161  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
162  *
163  * @remarks You must release @a burst_id using free().
164  *
165  * @param[in]  image    The image metadata handle
166  * @param[out] burst_id The ID of burst shot\ n
167  *                      If @a burst_id is @c NULL, this is not burst shot
168  *
169  * @return @c 0 on success,
170  *         otherwise a negative error value
171  *
172  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
173  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
174  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
175  */
176 int image_meta_get_burst_id(image_meta_h image, char **burst_id);
177
178 /**
179  * @brief Gets the exposure time from exif.
180  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
181  *
182  * @remarks @a exposure time must be released with free() by you.
183  *
184  * @param[in]  image    The image metadata handle
185  * @param[out] exposure_time The value of exposure_time, getting from exif
186  *
187  * @return 0 on success,
188  *         otherwise a negative error value
189  *
190  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
191  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
192  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
193  *
194  */
195 int image_meta_get_exposure_time(image_meta_h image, char **exposure_time);
196
197 /**
198  * @brief Gets the fnumber from exif.
199  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
200  *
201  * @param[in]  image    The image metadata handle
202  * @param[out] fnumber The value of fnumber, getting from exif
203  *
204  * @return 0 on success,
205  *         otherwise a negative error value
206  *
207  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
208  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
209  *
210  */
211 int image_meta_get_fnumber(image_meta_h image, double *fnumber);
212
213 /**
214  * @brief Gets the iso from exif.
215  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
216  *
217  * @param[in]  image    The image metadata handle
218  * @param[out] iso The value of iso, getting from exif
219  *
220  * @return 0 on success,
221  *         otherwise a negative error value
222  *
223  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
224  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
225  *
226  */
227 int image_meta_get_iso(image_meta_h image, int *iso);
228
229 /**
230  * @brief Gets the model from exif.
231  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
232  *
233  * @remarks @a model must be released with free() by you.
234  *
235  * @param[in]  image    The image metadata handle
236  * @param[out] model The value of model, getting from exif
237  *
238  * @return 0 on success,
239  *         otherwise a negative error value
240  *
241  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
242  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
243  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
244  *
245  */
246 int image_meta_get_model(image_meta_h image, char **model);
247
248 /**
249  * @brief Checks whether the media is a burst shot image.
250  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
251  *
252  * @param[in]  image         The image metadata handle
253  * @param[out] is_burst_shot @c true if the media is a burst shot image,
254  *                           otherwise @c false if the media is not a burst shot image
255  *
256  * @return @c 0 on success,
257  *         otherwise a negative error value
258  *
259  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
260  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
261  */
262 int image_meta_is_burst_shot(image_meta_h image, bool *is_burst_shot);
263
264 /**
265  * @deprecated Deprecated since 4.0. This data cannot be saved to the file.
266  * @brief Sets an orientation of the image.
267  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
268  *
269  * @param[in] image       The image metadata handle
270  * @param[in] orientation The image orientation
271  *
272  * @return @c 0 on success,
273  *         otherwise a negative error value
274  *
275  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
276  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
277  */
278 int image_meta_set_orientation(image_meta_h image, media_content_orientation_e orientation) TIZEN_DEPRECATED_API;
279
280 /**
281  * @deprecated Deprecated since 4.0. Related setter functions are deprecated, therefore this function is not needed anymore.
282  * @brief Updates the image to the media database.
283  *
284  * @details The function updates the given image meta in the media database. \n
285  *               The function should be called after any change in image attributes, to be updated to the media database.
286  *
287  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
288  *
289  * @privlevel public
290  * @privilege %http://tizen.org/privilege/content.write
291  *
292  * @remarks Do not call this function in callback function of foreach function like media_info_foreach_media_from_db().
293  *
294  * @param[in] image The handle to the image
295  *
296  * @return @c 0 on success,
297  *         otherwise a negative error value
298  *
299  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
300  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
301  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
302  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
303  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB Operation failed
304  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY           DB Operation busy
305  * @retval #MEDIA_CONTENT_ERROR_NETWORK           Network fail
306  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
307  *
308  * @pre This function requires opened connection to content service by media_content_connect().
309  *
310  * @see media_content_connect()
311  */
312 int image_meta_update_to_db(image_meta_h image) TIZEN_DEPRECATED_API;
313
314 /**
315  * @}
316  */
317
318
319 #ifdef __cplusplus
320 }
321 #endif /* __cplusplus */
322
323 #endif /*__TIZEN_IMAGE_META_H__*/