2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include <media_info_private.h>
20 int audio_meta_destroy(audio_meta_h audio)
22 audio_meta_s *_audio = (audio_meta_s*)audio;
24 content_retip_if_fail(audio);
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);
33 g_free(_audio->recorded_date);
34 g_free(_audio->copyright);
35 g_free(_audio->track_num);
38 return MEDIA_CONTENT_ERROR_NONE;
41 int audio_meta_clone(audio_meta_h *dst, audio_meta_h src)
43 audio_meta_s *_src = (audio_meta_s*)src;
45 content_retip_if_fail(dst);
46 content_retip_if_fail(src);
48 audio_meta_s *_dst = g_new0(audio_meta_s, 1);
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;
66 *dst = (audio_meta_h)_dst;
68 return MEDIA_CONTENT_ERROR_NONE;
71 int audio_meta_get_media_id(audio_meta_h audio, char **media_id)
73 audio_meta_s *_audio = (audio_meta_s*)audio;
75 content_retip_if_fail(audio);
76 content_retip_if_fail(media_id);
78 *media_id = g_strdup(_audio->media_id);
80 return MEDIA_CONTENT_ERROR_NONE;
83 int audio_meta_get_album(audio_meta_h audio, char **album)
85 audio_meta_s *_audio = (audio_meta_s*)audio;
87 content_retip_if_fail(audio);
88 content_retip_if_fail(album);
90 /*album can be empty string*/
91 *album = g_strdup(_audio->album);
93 return MEDIA_CONTENT_ERROR_NONE;
96 int audio_meta_get_artist(audio_meta_h audio, char **artist)
98 audio_meta_s *_audio = (audio_meta_s*)audio;
100 content_retip_if_fail(audio);
101 content_retip_if_fail(artist);
103 /*artist can be empty string*/
104 *artist = g_strdup(_audio->artist);
106 return MEDIA_CONTENT_ERROR_NONE;
109 int audio_meta_get_album_artist(audio_meta_h audio, char **album_artist)
111 audio_meta_s *_audio = (audio_meta_s*)audio;
113 content_retip_if_fail(audio);
114 content_retip_if_fail(album_artist);
116 /*album_artist can be empty string*/
117 *album_artist = g_strdup(_audio->album_artist);
119 return MEDIA_CONTENT_ERROR_NONE;
122 int audio_meta_get_genre(audio_meta_h audio, char **genre)
124 audio_meta_s *_audio = (audio_meta_s*)audio;
126 content_retip_if_fail(audio);
127 content_retip_if_fail(genre);
129 /*genre can be empty string*/
130 *genre = g_strdup(_audio->genre);
132 return MEDIA_CONTENT_ERROR_NONE;
135 int audio_meta_get_year(audio_meta_h audio, char **year)
137 audio_meta_s *_audio = (audio_meta_s*)audio;
139 content_retip_if_fail(audio);
140 content_retip_if_fail(year);
142 /*year can be empty string*/
143 *year = g_strdup(_audio->year);
145 return MEDIA_CONTENT_ERROR_NONE;
148 int audio_meta_get_track_num(audio_meta_h audio, char **track_num)
150 audio_meta_s *_audio = (audio_meta_s*)audio;
152 content_retip_if_fail(audio);
153 content_retip_if_fail(track_num);
155 /*track_num can be empty string*/
156 *track_num = g_strdup(_audio->track_num);
158 return MEDIA_CONTENT_ERROR_NONE;
161 int audio_meta_get_composer(audio_meta_h audio, char **composer)
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;
166 content_retip_if_fail(audio);
167 content_retip_if_fail(composer);
169 /*composer can be empty string*/
170 *composer = g_strdup(_audio->composer);
172 return MEDIA_CONTENT_ERROR_NONE;
175 int audio_meta_get_recorded_date(audio_meta_h audio, char **recorded_date)
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;
180 content_retip_if_fail(audio);
181 content_retip_if_fail(recorded_date);
183 *recorded_date = g_strdup(_audio->recorded_date);
185 return MEDIA_CONTENT_ERROR_NONE;
188 int audio_meta_get_copyright(audio_meta_h audio, char **copyright)
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;
193 content_retip_if_fail(audio);
194 content_retip_if_fail(copyright);
196 /*copyright can be empty string*/
197 *copyright = g_strdup(_audio->copyright);
199 return MEDIA_CONTENT_ERROR_NONE;
202 int audio_meta_get_bit_rate(audio_meta_h audio, int *bit_rate)
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;
207 content_retip_if_fail(audio);
208 content_retip_if_fail(bit_rate);
210 *bit_rate = _audio->bitrate;
212 return MEDIA_CONTENT_ERROR_NONE;
215 int audio_meta_get_bitpersample(audio_meta_h audio, int *bitpersample)
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;
220 content_retip_if_fail(audio);
221 content_retip_if_fail(bitpersample);
223 *bitpersample = _audio->bitpersample;
225 return MEDIA_CONTENT_ERROR_NONE;
228 int audio_meta_get_sample_rate(audio_meta_h audio, int *sample_rate)
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;
233 content_retip_if_fail(audio);
234 content_retip_if_fail(sample_rate);
236 *sample_rate = _audio->samplerate;
238 return MEDIA_CONTENT_ERROR_NONE;
241 int audio_meta_get_channel(audio_meta_h audio, int *channel)
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;
246 content_retip_if_fail(audio);
247 content_retip_if_fail(channel);
249 *channel = _audio->channel;
251 return MEDIA_CONTENT_ERROR_NONE;
254 int audio_meta_get_duration(audio_meta_h audio, int *duration)
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;
259 content_retip_if_fail(audio);
260 content_retip_if_fail(duration);
262 *duration = _audio->duration;
264 return MEDIA_CONTENT_ERROR_NONE;