summaryrefslogtreecommitdiff
path: root/src/media_image.c
blob: 592a2a33a599efd2455c6d58d69c64831e03c5ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


#include <media_info_private.h>

int image_meta_destroy(image_meta_h image)
{
	image_meta_s *_image = (image_meta_s*)image;

	content_retip_if_fail(image);

	g_free(_image->media_id);
	g_free(_image->date_taken);
	g_free(_image->exposure_time);
	g_free(_image->model);
	g_free(_image);

	return MEDIA_CONTENT_ERROR_NONE;
}

int image_meta_clone(image_meta_h *dst, image_meta_h src)
{
	image_meta_s *_src = (image_meta_s*)src;

	content_retip_if_fail(dst);
	content_retip_if_fail(src);

	image_meta_s *_dst = g_new0(image_meta_s, 1);

	_dst->media_id = g_strdup(_src->media_id);
	_dst->date_taken = g_strdup(_src->date_taken);
	_dst->exposure_time = g_strdup(_src->exposure_time);
	_dst->model = g_strdup(_src->model);
	_dst->fnumber = _src->fnumber;
	_dst->iso = _src->iso;
	_dst->width = _src->width;
	_dst->height = _src->height;
	_dst->orientation = _src->orientation;

	*dst = (image_meta_h)_dst;

	return MEDIA_CONTENT_ERROR_NONE;
}

int image_meta_get_media_id(image_meta_h image, char **media_id)
{
	image_meta_s *_image = (image_meta_s*)image;

	content_retip_if_fail(image);
	content_retip_if_fail(media_id);

	*media_id = g_strdup(_image->media_id);

	return MEDIA_CONTENT_ERROR_NONE;
}

int image_meta_get_width(image_meta_h image, int *width)
{
	image_meta_s *_image = (image_meta_s*)image;

	content_retip_if_fail(image);
	content_retip_if_fail(width);

	*width = _image->width;

	return MEDIA_CONTENT_ERROR_NONE;
}
int image_meta_get_height(image_meta_h image, int *height)
{
	image_meta_s *_image = (image_meta_s*)image;

	content_retip_if_fail(image);
	content_retip_if_fail(height);

	*height = _image->height;

	return MEDIA_CONTENT_ERROR_NONE;
}

int image_meta_get_orientation(image_meta_h image, media_content_orientation_e* orientation)
{
	image_meta_s *_image = (image_meta_s*)image;

	content_retip_if_fail(image);
	content_retip_if_fail(orientation);

	*orientation = _image->orientation;

	return MEDIA_CONTENT_ERROR_NONE;
}

int image_meta_get_date_taken(image_meta_h image, char **date_taken)
{
	image_meta_s *_image = (image_meta_s*)image;

	content_retip_if_fail(image);
	content_retip_if_fail(date_taken);

	*date_taken = g_strdup(_image->date_taken);

	return MEDIA_CONTENT_ERROR_NONE;
}
// LCOV_EXCL_START
int image_meta_get_exposure_time(image_meta_h image, char **exposure_time)
{
	content_warn("DEPRECATION WARNING: image_meta_get_exposure_time() is deprecated and will be removed from next release.");
	image_meta_s *_image = (image_meta_s*)image;

	content_retip_if_fail(image);
	content_retip_if_fail(exposure_time);

	*exposure_time = g_strdup(_image->exposure_time);

	return MEDIA_CONTENT_ERROR_NONE;
}

int image_meta_get_fnumber(image_meta_h image, double *fnumber)
{
	content_warn("DEPRECATION WARNING: image_meta_get_fnumber() is deprecated and will be removed from next release.");
	image_meta_s *_image = (image_meta_s*)image;

	content_retip_if_fail(image);
	content_retip_if_fail(fnumber);

	*fnumber = _image->fnumber;

	return MEDIA_CONTENT_ERROR_NONE;
}

int image_meta_get_iso(image_meta_h image, int *iso)
{
	content_warn("DEPRECATION WARNING: image_meta_get_iso() is deprecated and will be removed from next release.");
	image_meta_s *_image = (image_meta_s*)image;

	content_retip_if_fail(image);
	content_retip_if_fail(iso);

	*iso = _image->iso;

	return MEDIA_CONTENT_ERROR_NONE;
}

int image_meta_get_model(image_meta_h image, char **model)
{
	content_warn("DEPRECATION WARNING: image_meta_get_model() is deprecated and will be removed from next release.");
	image_meta_s *_image = (image_meta_s*)image;

	content_retip_if_fail(image);
	content_retip_if_fail(model);

	*model = g_strdup(_image->model);

	return MEDIA_CONTENT_ERROR_NONE;
}
// LCOV_EXCL_STOP