[ACR-1811] Deprecate underutilized fields
[platform/core/api/media-content.git] / src / media_audio.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 audio_meta_destroy(audio_meta_h audio)
21 {
22         audio_meta_s *_audio = (audio_meta_s*)audio;
23
24         content_retip_if_fail(audio);
25
26         g_free(_audio->media_id);
27         g_free(_audio->album);
28         g_free(_audio->artist);
29         g_free(_audio->album_artist);
30         g_free(_audio->genre);
31         g_free(_audio->composer);
32         g_free(_audio->year);
33         g_free(_audio->recorded_date);
34         g_free(_audio->copyright);
35         g_free(_audio->track_num);
36         g_free(_audio);
37
38         return MEDIA_CONTENT_ERROR_NONE;
39 }
40
41 int audio_meta_clone(audio_meta_h *dst, audio_meta_h src)
42 {
43         audio_meta_s *_src = (audio_meta_s*)src;
44
45         content_retip_if_fail(dst);
46         content_retip_if_fail(src);
47
48         audio_meta_s *_dst = g_new0(audio_meta_s, 1);
49
50         _dst->media_id = g_strdup(_src->media_id);
51         _dst->album = g_strdup(_src->album);
52         _dst->artist = g_strdup(_src->artist);
53         _dst->album_artist = g_strdup(_src->album_artist);
54         _dst->genre = g_strdup(_src->genre);
55         _dst->composer = g_strdup(_src->composer);
56         _dst->year = g_strdup(_src->year);
57         _dst->recorded_date = g_strdup(_src->recorded_date);
58         _dst->copyright = g_strdup(_src->copyright);
59         _dst->track_num = g_strdup(_src->track_num);
60         _dst->bitrate = _src->bitrate;
61         _dst->bitpersample = _src->bitpersample;
62         _dst->samplerate = _src->samplerate;
63         _dst->channel = _src->channel;
64         _dst->duration = _src->duration;
65
66         *dst = (audio_meta_h)_dst;
67
68         return MEDIA_CONTENT_ERROR_NONE;
69 }
70
71 int audio_meta_get_media_id(audio_meta_h audio, char **media_id)
72 {
73         audio_meta_s *_audio = (audio_meta_s*)audio;
74
75         content_retip_if_fail(audio);
76         content_retip_if_fail(media_id);
77
78         *media_id = g_strdup(_audio->media_id);
79
80         return MEDIA_CONTENT_ERROR_NONE;
81 }
82
83 int audio_meta_get_album(audio_meta_h audio, char **album)
84 {
85         audio_meta_s *_audio = (audio_meta_s*)audio;
86
87         content_retip_if_fail(audio);
88         content_retip_if_fail(album);
89
90         /*album can be empty string*/
91         *album = g_strdup(_audio->album);
92
93         return MEDIA_CONTENT_ERROR_NONE;
94 }
95
96 int audio_meta_get_artist(audio_meta_h audio, char **artist)
97 {
98         audio_meta_s *_audio = (audio_meta_s*)audio;
99
100         content_retip_if_fail(audio);
101         content_retip_if_fail(artist);
102
103         /*artist can be empty string*/
104         *artist = g_strdup(_audio->artist);
105
106         return MEDIA_CONTENT_ERROR_NONE;
107 }
108
109 int audio_meta_get_album_artist(audio_meta_h audio, char **album_artist)
110 {
111         audio_meta_s *_audio = (audio_meta_s*)audio;
112
113         content_retip_if_fail(audio);
114         content_retip_if_fail(album_artist);
115
116         /*album_artist can be empty string*/
117         *album_artist = g_strdup(_audio->album_artist);
118
119         return MEDIA_CONTENT_ERROR_NONE;
120 }
121
122 int audio_meta_get_genre(audio_meta_h audio, char **genre)
123 {
124         audio_meta_s *_audio = (audio_meta_s*)audio;
125
126         content_retip_if_fail(audio);
127         content_retip_if_fail(genre);
128
129         /*genre can be empty string*/
130         *genre = g_strdup(_audio->genre);
131
132         return MEDIA_CONTENT_ERROR_NONE;
133 }
134
135 int audio_meta_get_year(audio_meta_h audio, char **year)
136 {
137         audio_meta_s *_audio = (audio_meta_s*)audio;
138
139         content_retip_if_fail(audio);
140         content_retip_if_fail(year);
141
142         /*year can be empty string*/
143         *year = g_strdup(_audio->year);
144
145         return MEDIA_CONTENT_ERROR_NONE;
146 }
147
148 int audio_meta_get_track_num(audio_meta_h audio, char **track_num)
149 {
150         audio_meta_s *_audio = (audio_meta_s*)audio;
151
152         content_retip_if_fail(audio);
153         content_retip_if_fail(track_num);
154
155         /*track_num can be empty string*/
156         *track_num = g_strdup(_audio->track_num);
157
158         return MEDIA_CONTENT_ERROR_NONE;
159 }
160 // LCOV_EXCL_START
161 int audio_meta_get_composer(audio_meta_h audio, char **composer)
162 {
163         content_warn("DEPRECATION WARNING: audio_meta_get_composer() is deprecated and will be removed from next release.");
164         audio_meta_s *_audio = (audio_meta_s*)audio;
165
166         content_retip_if_fail(audio);
167         content_retip_if_fail(composer);
168
169         /*composer can be empty string*/
170         *composer = g_strdup(_audio->composer);
171
172         return MEDIA_CONTENT_ERROR_NONE;
173 }
174
175 int audio_meta_get_recorded_date(audio_meta_h audio, char **recorded_date)
176 {
177         content_warn("DEPRECATION WARNING: audio_meta_get_recorded_date() is deprecated and will be removed from next release.");
178         audio_meta_s *_audio = (audio_meta_s*)audio;
179
180         content_retip_if_fail(audio);
181         content_retip_if_fail(recorded_date);
182
183         *recorded_date = g_strdup(_audio->recorded_date);
184
185         return MEDIA_CONTENT_ERROR_NONE;
186 }
187
188 int audio_meta_get_copyright(audio_meta_h audio, char **copyright)
189 {
190         content_warn("DEPRECATION WARNING: audio_meta_get_copyright() is deprecated and will be removed from next release.");
191         audio_meta_s *_audio = (audio_meta_s*)audio;
192
193         content_retip_if_fail(audio);
194         content_retip_if_fail(copyright);
195
196         /*copyright can be empty string*/
197         *copyright = g_strdup(_audio->copyright);
198
199         return MEDIA_CONTENT_ERROR_NONE;
200 }
201
202 int audio_meta_get_bit_rate(audio_meta_h audio, int *bit_rate)
203 {
204         content_warn("DEPRECATION WARNING: audio_meta_get_bit_rate() is deprecated and will be removed from next release.");
205         audio_meta_s *_audio = (audio_meta_s*)audio;
206
207         content_retip_if_fail(audio);
208         content_retip_if_fail(bit_rate);
209
210         *bit_rate = _audio->bitrate;
211
212         return MEDIA_CONTENT_ERROR_NONE;
213 }
214
215 int audio_meta_get_bitpersample(audio_meta_h audio, int *bitpersample)
216 {
217         content_warn("DEPRECATION WARNING: audio_meta_get_bitpersample() is deprecated and will be removed from next release.");
218         audio_meta_s *_audio = (audio_meta_s*)audio;
219
220         content_retip_if_fail(audio);
221         content_retip_if_fail(bitpersample);
222
223         *bitpersample = _audio->bitpersample;
224
225         return MEDIA_CONTENT_ERROR_NONE;
226 }
227
228 int audio_meta_get_sample_rate(audio_meta_h audio, int *sample_rate)
229 {
230         content_warn("DEPRECATION WARNING: audio_meta_get_sample_rate() is deprecated and will be removed from next release.");
231         audio_meta_s *_audio = (audio_meta_s*)audio;
232
233         content_retip_if_fail(audio);
234         content_retip_if_fail(sample_rate);
235
236         *sample_rate = _audio->samplerate;
237
238         return MEDIA_CONTENT_ERROR_NONE;
239 }
240
241 int audio_meta_get_channel(audio_meta_h audio, int *channel)
242 {
243         content_warn("DEPRECATION WARNING: audio_meta_get_channel() is deprecated and will be removed from next release.");
244         audio_meta_s *_audio = (audio_meta_s*)audio;
245
246         content_retip_if_fail(audio);
247         content_retip_if_fail(channel);
248
249         *channel = _audio->channel;
250
251         return MEDIA_CONTENT_ERROR_NONE;
252 }
253
254 int audio_meta_get_duration(audio_meta_h audio, int *duration)
255 {
256         content_warn("DEPRECATION WARNING: audio_meta_get_duration() is deprecated and will be removed from next release.");
257         audio_meta_s *_audio = (audio_meta_s*)audio;
258
259         content_retip_if_fail(audio);
260         content_retip_if_fail(duration);
261
262         *duration = _audio->duration;
263
264         return MEDIA_CONTENT_ERROR_NONE;
265 }
266 // LCOV_EXCL_STOP