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;
23 content_retvm_if(_audio == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Audio handle is null");
25 g_free(_audio->media_id);
26 g_free(_audio->album);
27 g_free(_audio->artist);
28 g_free(_audio->album_artist);
29 g_free(_audio->genre);
30 g_free(_audio->composer);
32 g_free(_audio->recorded_date);
33 g_free(_audio->copyright);
34 g_free(_audio->track_num);
37 return MEDIA_CONTENT_ERROR_NONE;
40 int audio_meta_clone(audio_meta_h *dst, audio_meta_h src)
42 audio_meta_s *_src = (audio_meta_s*)src;
44 content_retip_if_fail(dst);
45 content_retip_if_fail(src);
47 audio_meta_s *_dst = g_new0(audio_meta_s, 1);
49 _dst->media_id = g_strdup(_src->media_id);
50 _dst->album = g_strdup(_src->album);
51 _dst->artist = g_strdup(_src->artist);
52 _dst->album_artist = g_strdup(_src->album_artist);
53 _dst->genre = g_strdup(_src->genre);
54 _dst->composer = g_strdup(_src->composer);
55 _dst->year = g_strdup(_src->year);
56 _dst->recorded_date = g_strdup(_src->recorded_date);
57 _dst->copyright = g_strdup(_src->copyright);
58 _dst->track_num = g_strdup(_src->track_num);
59 _dst->bitrate = _src->bitrate;
60 _dst->bitpersample = _src->bitpersample;
61 _dst->samplerate = _src->samplerate;
62 _dst->channel = _src->channel;
63 _dst->duration = _src->duration;
65 *dst = (audio_meta_h)_dst;
67 return MEDIA_CONTENT_ERROR_NONE;
70 int audio_meta_get_media_id(audio_meta_h audio, char **media_id)
72 audio_meta_s *_audio = (audio_meta_s*)audio;
74 content_retip_if_fail(audio);
75 content_retip_if_fail(media_id);
77 *media_id = g_strdup(_audio->media_id);
79 return MEDIA_CONTENT_ERROR_NONE;
82 int audio_meta_get_album(audio_meta_h audio, char **album)
84 audio_meta_s *_audio = (audio_meta_s*)audio;
86 content_retip_if_fail(audio);
87 content_retip_if_fail(album);
89 /*album can be empty string*/
90 *album = g_strdup(_audio->album);
92 return MEDIA_CONTENT_ERROR_NONE;
95 int audio_meta_get_artist(audio_meta_h audio, char **artist)
97 audio_meta_s *_audio = (audio_meta_s*)audio;
99 content_retip_if_fail(audio);
100 content_retip_if_fail(artist);
102 /*artist can be empty string*/
103 *artist = g_strdup(_audio->artist);
105 return MEDIA_CONTENT_ERROR_NONE;
108 int audio_meta_get_album_artist(audio_meta_h audio, char **album_artist)
110 audio_meta_s *_audio = (audio_meta_s*)audio;
112 content_retip_if_fail(audio);
113 content_retip_if_fail(album_artist);
115 /*album_artist can be empty string*/
116 *album_artist = g_strdup(_audio->album_artist);
118 return MEDIA_CONTENT_ERROR_NONE;
121 int audio_meta_get_genre(audio_meta_h audio, char **genre)
123 audio_meta_s *_audio = (audio_meta_s*)audio;
125 content_retip_if_fail(audio);
126 content_retip_if_fail(genre);
128 /*genre can be empty string*/
129 *genre = g_strdup(_audio->genre);
131 return MEDIA_CONTENT_ERROR_NONE;
134 int audio_meta_get_composer(audio_meta_h audio, char **composer)
136 audio_meta_s *_audio = (audio_meta_s*)audio;
138 content_retip_if_fail(audio);
139 content_retip_if_fail(composer);
141 /*composer can be empty string*/
142 *composer = g_strdup(_audio->composer);
144 return MEDIA_CONTENT_ERROR_NONE;
147 int audio_meta_get_year(audio_meta_h audio, char **year)
149 audio_meta_s *_audio = (audio_meta_s*)audio;
151 content_retip_if_fail(audio);
152 content_retip_if_fail(year);
154 /*year can be empty string*/
155 *year = g_strdup(_audio->year);
157 return MEDIA_CONTENT_ERROR_NONE;
160 int audio_meta_get_recorded_date(audio_meta_h audio, char **recorded_date)
162 audio_meta_s *_audio = (audio_meta_s*)audio;
164 content_retip_if_fail(audio);
165 content_retip_if_fail(recorded_date);
167 *recorded_date = g_strdup(_audio->recorded_date);
169 return MEDIA_CONTENT_ERROR_NONE;
172 int audio_meta_get_copyright(audio_meta_h audio, char **copyright)
174 audio_meta_s *_audio = (audio_meta_s*)audio;
176 content_retip_if_fail(audio);
177 content_retip_if_fail(copyright);
179 /*copyright can be empty string*/
180 *copyright = g_strdup(_audio->copyright);
182 return MEDIA_CONTENT_ERROR_NONE;
185 int audio_meta_get_track_num(audio_meta_h audio, char **track_num)
187 audio_meta_s *_audio = (audio_meta_s*)audio;
189 content_retip_if_fail(audio);
190 content_retip_if_fail(track_num);
192 /*track_num can be empty string*/
193 *track_num = g_strdup(_audio->track_num);
195 return MEDIA_CONTENT_ERROR_NONE;
198 int audio_meta_get_bit_rate(audio_meta_h audio, int *bit_rate)
200 audio_meta_s *_audio = (audio_meta_s*)audio;
201 content_retvm_if(!_audio || !bit_rate, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
203 *bit_rate = _audio->bitrate;
205 return MEDIA_CONTENT_ERROR_NONE;
208 int audio_meta_get_bitpersample(audio_meta_h audio, int *bitpersample)
210 audio_meta_s *_audio = (audio_meta_s*)audio;
211 content_retvm_if(!_audio || !bitpersample, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
213 *bitpersample = _audio->bitpersample;
215 return MEDIA_CONTENT_ERROR_NONE;
218 int audio_meta_get_sample_rate(audio_meta_h audio, int *sample_rate)
220 audio_meta_s *_audio = (audio_meta_s*)audio;
221 content_retvm_if(!_audio || !sample_rate, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
223 *sample_rate = _audio->samplerate;
225 return MEDIA_CONTENT_ERROR_NONE;
228 int audio_meta_get_channel(audio_meta_h audio, int *channel)
230 audio_meta_s *_audio = (audio_meta_s*)audio;
231 content_retvm_if(!_audio || !channel, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
233 *channel = _audio->channel;
235 return MEDIA_CONTENT_ERROR_NONE;
238 int audio_meta_get_duration(audio_meta_h audio, int *duration)
240 audio_meta_s *_audio = (audio_meta_s*)audio;
241 content_retvm_if(!_audio || !duration, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid parameter");
243 *duration = _audio->duration;
245 return MEDIA_CONTENT_ERROR_NONE;
248 #ifdef TIZEN_FEATURE_COMPATIBILITY
249 int audio_meta_get_played_time(audio_meta_h audio, time_t* played_time)
251 content_warn("DEPRECATION WARNING: audio_meta_get_played_time() is removed from 5.5.");
253 return MEDIA_CONTENT_ERROR_NONE;
256 int audio_meta_get_played_count(audio_meta_h audio, int *played_count)
258 content_warn("DEPRECATION WARNING: audio_meta_get_played_count() is removed from 5.5.");
260 return MEDIA_CONTENT_ERROR_NONE;
263 int audio_meta_set_played_count(audio_meta_h audio, int played_count)
265 content_warn("DEPRECATION WARNING: audio_meta_set_played_count() is removed from 5.5.");
267 return MEDIA_CONTENT_ERROR_NONE;
270 int audio_meta_set_played_time(audio_meta_h audio, time_t played_time)
272 content_warn("DEPRECATION WARNING: audio_meta_set_played_time() is removed from 5.5.");
274 return MEDIA_CONTENT_ERROR_NONE;
277 int audio_meta_update_to_db(audio_meta_h audio)
279 content_warn("DEPRECATION WARNING: audio_meta_update_to_db() is removed from 5.5.");
281 return MEDIA_CONTENT_ERROR_NONE;