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 #ifndef __TIZEN_AUDIO_META_H__
19 #define __TIZEN_AUDIO_META_H__
21 #include <media_content_type.h>
30 * @brief This file contains the audio metadata API and related structure and enumeration. \n
31 * Description of the audio content involves: album, artist, album_artist, author, genre and description tags. \n
32 * Parameters of the recording are also supported such as format, bitrate, duration, size etc.
36 * @addtogroup CAPI_CONTENT_MEDIA_AUDIO_META_MODULE
42 * @brief Destroys the audio metadata.
45 * @param[in] audio The audio metadata handle
47 * @return @c 0 on success,
48 * otherwise a negative error value
50 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
51 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
52 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
54 * @pre Get a copy of audio metadata handle handle by calling audio_meta_clone().
56 * @see audio_meta_clone()
58 int audio_meta_destroy(audio_meta_h audio);
61 * @brief Clones the audio metadata.
62 * @details This function copies the audio metadata handle from source to destination.
66 * @remarks The destination handle must be released using audio_meta_destroy().
68 * @param[out] dst The destination handle to audio metadata
69 * @param[in] src The source handle to the audio metadata
71 * @return @c 0 on success,
72 * otherwise a negative error value
74 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
75 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
76 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
77 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
79 * @see audio_meta_destroy()
81 int audio_meta_clone(audio_meta_h *dst, audio_meta_h src);
84 * @brief Gets the audio ID of the given audio metadata.
87 * @remarks You must release @a media_id using free().
89 * @param[in] audio The audio metadata handle
90 * @param[out] media_id The ID of the audio
92 * @return @c 0 on success,
93 * otherwise a negative error value
95 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
96 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
97 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
98 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
100 int audio_meta_get_media_id(audio_meta_h audio, char **media_id);
103 * @brief Gets the album name of the given audio metadata.
104 * @details If the value is an empty string, the method returns "Unknown".
108 * @remarks You must release @a album_name using free().
110 * @param[in] audio The audio metadata handle
111 * @param[out] album_name The name of the album
113 * @return @c 0 on success,
114 * otherwise a negative error value
116 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
117 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
118 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
119 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
121 int audio_meta_get_album(audio_meta_h audio, char **album_name);
124 * @brief Gets the artist name of the given audio metadata.
125 * @details If the value is an empty string, the method returns "Unknown".
129 * @remarks You must release @a artist_name using free().
131 * @param[in] audio The audio metadata handle
132 * @param[out] artist_name The name of the artist
134 * @return @c 0 on success,
135 * otherwise a negative error value
137 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
138 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
139 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
140 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
142 int audio_meta_get_artist(audio_meta_h audio, char **artist_name);
145 * @brief Gets name of album_artist of given audio metadata.\n
146 * If the value is an empty string, the method returns "Unknown".
148 * @remarks @a album_artist_name must be released with free() by you.
150 * @param [in] audio The handle to audio metadata
151 * @param [out] album_artist_name The name of the album_artist
152 * @return 0 on success, otherwise a negative error value.
153 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
154 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
155 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
157 int audio_meta_get_album_artist(audio_meta_h audio, char **album_artist_name);
160 * @brief Gets the genre name of the given audio metadata.
161 * @details If the value is an empty string, the method returns "Unknown".
165 * @remarks You must release @a genre_name using free().
167 * @param[in] audio The audio metadata handle
168 * @param[out] genre_name The name of the genre
170 * @return @c 0 on success,
171 * otherwise a negative error value
173 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
174 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
175 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
176 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
178 int audio_meta_get_genre(audio_meta_h audio, char **genre_name);
181 * @brief Gets the composer name of the given audio metadata.
182 * @details If the value is an empty string, the method returns "Unknown".
186 * @remarks You must release @a author_name using free().
188 * @param[in] audio The audio metadata handle
189 * @param[out] composer_name The name of the author of the audio
191 * @return @c 0 on success,
192 * otherwise a negative error value
194 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
195 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
196 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
197 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
199 int audio_meta_get_composer(audio_meta_h audio, char **composer_name);
202 * @brief Gets the year of the given audio metadata.
203 * @details If the value is an empty string, the method returns "Unknown".
207 * @remarks You must release @a year using free().
209 * @param[in] audio The audio metadata handle
210 * @param[out] year The year of the audio file
212 * @return @c 0 on success,
213 * otherwise a negative error value
215 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
216 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
217 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
218 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
220 int audio_meta_get_year(audio_meta_h audio, char **year);
223 * @brief Gets the recorded date of the given audio metadata.
226 * @remarks You must release @a recorded_date using free().
228 * @param[in] audio The audio metadata handle
229 * @param[out] recorded_date The recorded date of the audio file
231 * @return @c 0 on success,
232 * otherwise a negative error value
234 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
235 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
236 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
237 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
239 int audio_meta_get_recorded_date(audio_meta_h audio, char **recorded_date);
242 * @brief Gets the copyright notice of the given audio metadata.
245 * @remarks You must release @a copyright using free().
247 * @param[in] audio The audio metadata handle
248 * @param[out] copyright The audio copyright notice
250 * @return @c 0 on success,
251 * otherwise a negative error value
253 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
254 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
255 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
256 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
258 int audio_meta_get_copyright(audio_meta_h audio, char **copyright);
261 * @brief Gets the track number of the given audio metadata.
262 * @details If the value is an empty string, the method returns "Unknown".
266 * @param[in] audio The audio metadata handle
267 * @param[out] track_num The audio track number
269 * @return @c 0 on success,
270 * otherwise a negative error value
272 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
273 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
274 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
276 int audio_meta_get_track_num(audio_meta_h audio, char **track_num);
279 * @brief Gets the bitrate of the given audio metadata in bitrate per second.
282 * @param[in] audio The audio metadata handle
283 * @param[out] bit_rate The audio bitrate in bit per second [bps]
285 * @return @c 0 on success,
286 * otherwise a negative error value
288 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
289 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
290 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
292 int audio_meta_get_bit_rate(audio_meta_h audio, int *bit_rate);
295 * @brief Gets bit per sample of the given audio metadata.
298 * @param [in] audio The handle to the audio metadata
299 * @param [out] bitpersample The audio bit per sample
301 * @return @c 0 on success,
302 * otherwise a negative error value
304 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
305 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
306 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
309 int audio_meta_get_bitpersample(audio_meta_h audio, int *bitpersample);
312 * @brief Gets the sample rate of the given audio metadata.
315 * @param[in] audio The audio metadata handle
316 * @param[out] sample_rate The audio sample rate[hz]
318 * @return @c 0 on success,
319 * otherwise a negative error value
321 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
322 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
323 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
325 int audio_meta_get_sample_rate(audio_meta_h audio, int *sample_rate);
328 * @brief Gets the channel of the given audio metadata.
331 * @param[in] audio The audio metadata handle
332 * @param[out] channel The channel of the audio
334 * @return @c 0 on success,
335 * otherwise a negative error value
337 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
338 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
339 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
341 int audio_meta_get_channel(audio_meta_h audio, int *channel);
344 * @brief Gets the track duration of the given audio metadata.
347 * @param[in] audio The audio metadata handle
348 * @param[out] duration The audio file duration
350 * @return @c 0 on success,
351 * otherwise a negative error value
353 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
354 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
355 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
357 int audio_meta_get_duration(audio_meta_h audio, int *duration);
360 * @brief Gets the number of times the given audio has been played.
363 * @param[in] audio The audio metadata handle
364 * @param[out] played_count The counter of the audio played
366 * @return @c 0 on success,
367 * otherwise a negative error value
369 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
370 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
371 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
373 int audio_meta_get_played_count(audio_meta_h audio, int *played_count);
376 * @brief Gets the played time parameter of an audio.
377 * @details This function returns audio's elapsed playback time parameter as a period
378 * starting from the beginning of the track.
382 * @param[in] audio The audio metadata handle
383 * @param[out] played_time The elapsed time of the audio
385 * @return @c 0 on success,
386 * otherwise a negative error value
388 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
389 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
390 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
392 int audio_meta_get_played_time(audio_meta_h audio, time_t *played_time);
395 * @brief Gets the played position parameter of an audio.
396 * @details This function returns audio's elapsed playback position parameter as a period
397 * starting from the beginning of the track.
401 * @param[in] audio The audio metadata handle
402 * @param[out] played_position The elapsed time of the audio
404 * @return @c 0 on success,
405 * otherwise a negative error value
407 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
408 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
409 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
411 int audio_meta_get_played_position(audio_meta_h audio, int *played_position);
414 * @brief Sets the played count to an audio meta handle.
417 * @param[in] audio The audio metadata handle
418 * @param[in] played_count The played count of the audio
420 * @return @c 0 on success,
421 * otherwise a negative error value
423 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
424 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
425 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
427 * @post audio_meta_update_to_db().
429 int audio_meta_set_played_count(audio_meta_h audio, int played_count);
432 * @brief Sets the played time to an audio meta handle.
435 * @param[in] audio The audio metadata handle
436 * @param[in] played_time The played time of the audio
438 * @return @c 0 on success,
439 * otherwise a negative error value
441 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
442 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
443 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
445 * @post audio_meta_update_to_db().
447 int audio_meta_set_played_time(audio_meta_h audio, time_t played_time);
450 * @brief Sets the played position to an audio meta handle.
453 * @param[in] audio The audio metadata handle
454 * @param[in] played_position The played position of the audio
456 * @return @c 0 on success,
457 * otherwise a negative error value
459 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
460 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
461 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
463 * @post audio_meta_update_to_db().
465 int audio_meta_set_played_position(audio_meta_h audio, int played_position);
468 * @brief Updates an audio metadata with modified attributes in the media database.
469 * @details The function updates the given audio meta in the media database.
473 * @privilege %http://tizen.org/privilege/content.write
475 * @remarks The function should be called after any change in the attributes, to update the media database.
476 * For example, after using audio_meta_set_played_count() for changing the count of the played, the
477 * audio_meta_update_to_db() function should be called to update the given attributes in the media database. \n
478 * Do not call this function in callback function of foreach function like media_info_foreach_media_from_db().
480 * @param[in] audio The audio metadata handle
482 * @return @c 0 on success,
483 * otherwise a negative error value
485 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
486 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
487 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
489 * @pre This function requires opened connection to content service by media_content_connect().
491 * @see media_content_connect()
492 * @see audio_meta_set_played_count()
493 * @see audio_meta_set_played_time()
494 * @see audio_meta_set_played_position()
496 int audio_meta_update_to_db(audio_meta_h audio);
507 #endif /*__TIZEN_AUDIO_META_H__*/