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>
25 #endif /* __cplusplus */
29 * @brief This file contains the audio metadata API and related functions to proceed with audio metadata. \n
30 * Description of the audio content involves: album, artist, album_artist, author, genre and description tags. \n
31 * Parameters of the recording are also supported such as format, bitrate, duration, size etc.
35 * @addtogroup CAPI_CONTENT_MEDIA_AUDIO_META_MODULE
40 * @brief Clones the audio metadata.
41 * @details This function copies the audio metadata handle from a source to destination.
43 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
45 * @remarks You must release the destination handle using audio_meta_destroy().
47 * @param[out] dst The destination handle to the audio metadata
48 * @param[in] src The source handle to the audio metadata
50 * @return @c 0 on success,
51 * otherwise a negative error value
53 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
54 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
55 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
56 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
58 * @see audio_meta_destroy()
60 int audio_meta_clone(audio_meta_h *dst, audio_meta_h src);
63 * @brief Destroys the audio metadata.
64 * @details This function frees all resources related to the audio metadata handle. This handle
65 * no longer can be used to perform any operation. A new handle has to
66 * be created before the next use.
68 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
70 * @param[in] audio The audio metadata handle
72 * @return @c 0 on success,
73 * otherwise a negative error value
75 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
76 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
77 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
79 * @pre Get a copy of audio metadata handle handle by calling audio_meta_clone().
81 * @see audio_meta_clone()
83 int audio_meta_destroy(audio_meta_h audio);
86 * @brief Gets the ID of the media of the given audio metadata.
87 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
89 * @remarks You must release @a media_id using free().
91 * @param[in] audio The audio metadata handle
92 * @param[out] media_id The ID of the audio
94 * @return @c 0 on success,
95 * otherwise a negative error value
97 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
98 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
99 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
100 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
102 int audio_meta_get_media_id(audio_meta_h audio, char **media_id);
105 * @brief Gets the album of the given audio metadata.
106 * @details If the value is an empty string, the method returns "Unknown".
108 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
110 * @remarks You must release @a album using free().
112 * @param[in] audio The audio metadata handle
113 * @param[out] album The album of the audio metadata
115 * @return @c 0 on success,
116 * otherwise a negative error value
118 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
119 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
120 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
121 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
123 int audio_meta_get_album(audio_meta_h audio, char **album);
126 * @brief Gets the artist of the given audio metadata.
127 * @details If the value is an empty string, the method returns "Unknown".
129 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
131 * @remarks You must release @a artist using free().
133 * @param[in] audio The audio metadata handle
134 * @param[out] artist The artist of the audio metadata
136 * @return @c 0 on success,
137 * otherwise a negative error value
139 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
140 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
141 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
142 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
144 int audio_meta_get_artist(audio_meta_h audio, char **artist);
147 * @brief Gets the album artist of the given audio metadata.
148 * @details If the value is an empty string, the method returns "Unknown".
150 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
152 * @remarks You must release @a album_artist using free().
154 * @param[in] audio The audio metadata handle
155 * @param[out] album_artist The album artist of the audio metadata
157 * @return @c 0 on success,
158 * otherwise a negative error value
160 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
161 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
162 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
163 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
165 int audio_meta_get_album_artist(audio_meta_h audio, char **album_artist);
168 * @brief Gets the genre of the given audio metadata.
169 * @details If the value is an empty string, the method returns "Unknown".
171 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
173 * @remarks You must release @a genre using free().
175 * @param[in] audio The audio metadata handle
176 * @param[out] genre The genre of the audio metadata
178 * @return @c 0 on success,
179 * otherwise a negative error value
181 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
182 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
183 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
184 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
186 int audio_meta_get_genre(audio_meta_h audio, char **genre);
189 * @brief Gets the composer of the given audio metadata.
190 * @details If the value is an empty string, the method returns "Unknown".
192 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
194 * @remarks You must release @a composer using free().
196 * @param[in] audio The audio metadata handle
197 * @param[out] composer The composer of the audio metadata
199 * @return @c 0 on success,
200 * otherwise a negative error value
202 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
203 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
204 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
205 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
207 int audio_meta_get_composer(audio_meta_h audio, char **composer);
210 * @brief Gets the year of the given audio metadata.
211 * @details If the value is an empty string, the method returns "Unknown".
213 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
215 * @remarks You must release @a year using free().
217 * @param[in] audio The audio metadata handle
218 * @param[out] year The year of the audio metadata
220 * @return @c 0 on success,
221 * otherwise a negative error value
223 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
224 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
225 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
226 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
228 int audio_meta_get_year(audio_meta_h audio, char **year);
231 * @brief Gets the recorded date of the given audio metadata.
232 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
234 * @remarks You must release @a recorded_date using free().
236 * @param[in] audio The audio metadata handle
237 * @param[out] recorded_date The recorded date of the audio metadata
239 * @return @c 0 on success,
240 * otherwise a negative error value
242 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
243 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
244 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
245 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
247 int audio_meta_get_recorded_date(audio_meta_h audio, char **recorded_date);
250 * @brief Gets the copyright notice of the given audio metadata.
251 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
253 * @remarks You must release @a copyright using free().
255 * @param[in] audio The audio metadata handle
256 * @param[out] copyright The copyright of the audio metadata
258 * @return @c 0 on success,
259 * otherwise a negative error value
261 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
262 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
263 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
264 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
266 int audio_meta_get_copyright(audio_meta_h audio, char **copyright);
269 * @brief Gets the track number of the given audio metadata.
270 * @details If the value is an empty string, the method returns "Unknown".
272 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
274 * @remarks You must release @a track_num using free().
276 * @param[in] audio The audio metadata handle
277 * @param[out] track_num The audio track number of the audio metadata
279 * @return @c 0 on success,
280 * otherwise a negative error value
282 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
283 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
284 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
285 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
287 int audio_meta_get_track_num(audio_meta_h audio, char **track_num);
290 * @brief Gets the bitrate of the given audio metadata in bitrate per second.
291 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
293 * @param[in] audio The audio metadata handle
294 * @param[out] bit_rate The audio bitrate in bit per second [bps]
296 * @return @c 0 on success,
297 * otherwise a negative error value
299 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
300 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
301 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
303 int audio_meta_get_bit_rate(audio_meta_h audio, int *bit_rate);
306 * @brief Gets bit per sample of the given audio metadata.
307 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
309 * @param [in] audio The handle to the audio metadata
310 * @param [out] bitpersample The audio bit per sample
312 * @return @c 0 on success,
313 * otherwise a negative error value
315 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
316 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
317 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
319 int audio_meta_get_bitpersample(audio_meta_h audio, int *bitpersample);
322 * @brief Gets the sample rate of the given audio metadata.
323 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
325 * @param[in] audio The audio metadata handle
326 * @param[out] sample_rate The audio sample rate[hz]
328 * @return @c 0 on success,
329 * otherwise a negative error value
331 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
332 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
333 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
335 int audio_meta_get_sample_rate(audio_meta_h audio, int *sample_rate);
338 * @brief Gets the channel of the given audio metadata.
339 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
341 * @param[in] audio The audio metadata handle
342 * @param[out] channel The channel of the audio
344 * @return @c 0 on success,
345 * otherwise a negative error value
347 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
348 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
349 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
351 int audio_meta_get_channel(audio_meta_h audio, int *channel);
354 * @brief Gets the track duration of the given audio metadata.
355 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
357 * @param[in] audio The audio metadata handle
358 * @param[out] duration The audio file duration
360 * @return @c 0 on success,
361 * otherwise a negative error value
363 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
364 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
365 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
367 int audio_meta_get_duration(audio_meta_h audio, int *duration);
370 * @deprecated Deprecated since 2.4. [Use media_info_get_played_count() instead]
371 * @brief Gets the number of times the given audio has been played.
372 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
374 * @param[in] audio The audio metadata handle
375 * @param[out] played_count The counter of the audio played
377 * @return @c 0 on success,
378 * otherwise a negative error value
380 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
381 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
382 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
384 int audio_meta_get_played_count(audio_meta_h audio, int *played_count);
387 * @deprecated Deprecated since 2.4. [Use media_info_get_played_time() instead]
388 * @brief Gets the last played time parameter of the audio.
390 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
392 * @param[in] audio The audio metadata handle
393 * @param[out] played_time The last played time of the audio
395 * @return @c 0 on success,
396 * otherwise a negative error value
398 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
399 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
400 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
402 int audio_meta_get_played_time(audio_meta_h audio, time_t *played_time);
405 * @deprecated Deprecated since 2.4.
406 * @brief Gets the played position parameter of the audio.
407 * @details This function returns the elapsed playback position parameter of the audio as a period
408 * starting from the beginning of the track.
410 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
412 * @param[in] audio The audio metadata handle
413 * @param[out] played_position The elapsed time of the audio
415 * @return @c 0 on success,
416 * otherwise a negative error value
418 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
419 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
420 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
422 int audio_meta_get_played_position(audio_meta_h audio, int *played_position);
425 * @deprecated Deprecated since 2.4. [Use media_info_increase_played_count() instead]
426 * @brief Sets the played count of the audio.
427 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
429 * @param[in] audio The audio metadata handle
430 * @param[in] played_count The played count of the audio
432 * @return @c 0 on success,
433 * otherwise a negative error value
435 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
436 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
437 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
439 * @post audio_meta_update_to_db().
441 int audio_meta_set_played_count(audio_meta_h audio, int played_count);
444 * @deprecated Deprecated since 2.4. [Use media_info_set_played_time() instead]
445 * @brief Sets the last played time of the audio.
446 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
448 * @param[in] audio The audio metadata handle
449 * @param[in] played_time The last played time of the audio
451 * @return @c 0 on success,
452 * otherwise a negative error value
454 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
455 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
456 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
458 * @post audio_meta_update_to_db().
460 int audio_meta_set_played_time(audio_meta_h audio, time_t played_time);
463 * @deprecated Deprecated since 2.4.
464 * @brief Sets the played position of the audio.
466 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
468 * @remarks It is NOT recommended to use this attribute for your application-specific purpose because this attribute can be overwritten by other applications (even 0).
470 * @param[in] audio The audio metadata handle
471 * @param[in] played_position The played position of the audio
473 * @return @c 0 on success,
474 * otherwise a negative error value
476 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
477 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
478 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
480 * @post audio_meta_update_to_db().
482 int audio_meta_set_played_position(audio_meta_h audio, int played_position);
485 * @brief Updates an audio metadata with modified attributes in the media database.
486 * @details The function updates the given audio meta in the media database. The function should be called after any change in audio attributes, to be updated to the media
487 * database. For example, for setting the played time using audio_meta_get_played_time(), after that the audio_meta_update_to_db() function should be called to update media database.
489 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
492 * @privilege %http://tizen.org/privilege/content.write
494 * @remarks Do not call this function in callback function of foreach function like media_info_foreach_media_from_db().
496 * @param[in] audio The audio metadata handle
498 * @return @c 0 on success,
499 * otherwise a negative error value
501 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
502 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
503 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
504 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
505 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
506 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
507 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
508 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
510 * @pre This function requires opened connection to content service by media_content_connect().
512 * @see media_content_connect()
513 * @see audio_meta_set_played_time()
514 * @see audio_meta_set_played_count()
515 * @see audio_meta_set_played_position()
517 int audio_meta_update_to_db(audio_meta_h audio);
525 #endif /* __cplusplus */
527 #endif /*__TIZEN_AUDIO_META_H__*/