e3f8788c558cbd02af223c6732478715e90600d6
[platform/core/api/media-content.git] / src / media_image.c
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 #include <media_info_private.h>
19
20 int image_meta_destroy(image_meta_h image)
21 {
22         image_meta_s *_image = (image_meta_s*)image;
23
24         content_retip_if_fail(image);
25
26         g_free(_image->media_id);
27         g_free(_image->date_taken);
28         g_free(_image->exposure_time);
29         g_free(_image->model);
30         g_free(_image);
31
32         return MEDIA_CONTENT_ERROR_NONE;
33 }
34
35 int image_meta_clone(image_meta_h *dst, image_meta_h src)
36 {
37         image_meta_s *_src = (image_meta_s*)src;
38
39         content_retip_if_fail(dst);
40         content_retip_if_fail(src);
41
42         image_meta_s *_dst = g_new0(image_meta_s, 1);
43
44         _dst->media_id = g_strdup(_src->media_id);
45         _dst->date_taken = g_strdup(_src->date_taken);
46         _dst->exposure_time = g_strdup(_src->exposure_time);
47         _dst->model = g_strdup(_src->model);
48         _dst->fnumber = _src->fnumber;
49         _dst->iso = _src->iso;
50         _dst->width = _src->width;
51         _dst->height = _src->height;
52         _dst->orientation = _src->orientation;
53
54         *dst = (image_meta_h)_dst;
55
56         return MEDIA_CONTENT_ERROR_NONE;
57 }
58
59 int image_meta_get_media_id(image_meta_h image, char **media_id)
60 {
61         image_meta_s *_image = (image_meta_s*)image;
62
63         content_retip_if_fail(image);
64         content_retip_if_fail(media_id);
65
66         *media_id = g_strdup(_image->media_id);
67
68         return MEDIA_CONTENT_ERROR_NONE;
69 }
70
71 int image_meta_get_width(image_meta_h image, int *width)
72 {
73         image_meta_s *_image = (image_meta_s*)image;
74
75         content_retip_if_fail(image);
76         content_retip_if_fail(width);
77
78         *width = _image->width;
79
80         return MEDIA_CONTENT_ERROR_NONE;
81 }
82 int image_meta_get_height(image_meta_h image, int *height)
83 {
84         image_meta_s *_image = (image_meta_s*)image;
85
86         content_retip_if_fail(image);
87         content_retip_if_fail(height);
88
89         *height = _image->height;
90
91         return MEDIA_CONTENT_ERROR_NONE;
92 }
93
94 int image_meta_get_orientation(image_meta_h image, media_content_orientation_e* orientation)
95 {
96         image_meta_s *_image = (image_meta_s*)image;
97
98         content_retip_if_fail(image);
99         content_retip_if_fail(orientation);
100
101         *orientation = _image->orientation;
102
103         return MEDIA_CONTENT_ERROR_NONE;
104 }
105
106 int image_meta_get_date_taken(image_meta_h image, char **date_taken)
107 {
108         image_meta_s *_image = (image_meta_s*)image;
109
110         content_retip_if_fail(image);
111         content_retip_if_fail(date_taken);
112
113         *date_taken = g_strdup(_image->date_taken);
114
115         return MEDIA_CONTENT_ERROR_NONE;
116 }
117
118 int image_meta_get_exposure_time(image_meta_h image, char **exposure_time)
119 {
120         content_warn("DEPRECATION WARNING: image_meta_get_exposure_time() is deprecated and will be removed from next release.");
121         image_meta_s *_image = (image_meta_s*)image;
122
123         content_retip_if_fail(image);
124         content_retip_if_fail(exposure_time);
125
126         *exposure_time = g_strdup(_image->exposure_time);
127
128         return MEDIA_CONTENT_ERROR_NONE;
129 }
130
131 int image_meta_get_fnumber(image_meta_h image, double *fnumber)
132 {
133         content_warn("DEPRECATION WARNING: image_meta_get_fnumber() is deprecated and will be removed from next release.");
134         image_meta_s *_image = (image_meta_s*)image;
135
136         content_retip_if_fail(image);
137         content_retip_if_fail(fnumber);
138
139         *fnumber = _image->fnumber;
140
141         return MEDIA_CONTENT_ERROR_NONE;
142 }
143
144 int image_meta_get_iso(image_meta_h image, int *iso)
145 {
146         content_warn("DEPRECATION WARNING: image_meta_get_iso() is deprecated and will be removed from next release.");
147         image_meta_s *_image = (image_meta_s*)image;
148
149         content_retip_if_fail(image);
150         content_retip_if_fail(iso);
151
152         *iso = _image->iso;
153
154         return MEDIA_CONTENT_ERROR_NONE;
155 }
156
157 int image_meta_get_model(image_meta_h image, char **model)
158 {
159         content_warn("DEPRECATION WARNING: image_meta_get_model() is deprecated and will be removed from next release.");
160         image_meta_s *_image = (image_meta_s*)image;
161
162         content_retip_if_fail(image);
163         content_retip_if_fail(model);
164
165         *model = g_strdup(_image->model);
166
167         return MEDIA_CONTENT_ERROR_NONE;
168 }