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". \n
107 * Since 3.0, if the media content has no album info, the method returns empty string.
109 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
111 * @remarks You must release @a album using free().
113 * @param[in] audio The audio metadata handle
114 * @param[out] album The album of the audio metadata
116 * @return @c 0 on success,
117 * otherwise a negative error value
119 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
120 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
121 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
122 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
124 int audio_meta_get_album(audio_meta_h audio, char **album);
127 * @brief Gets the artist of the given audio metadata.
128 * @details If the value is an empty string, the method returns "Unknown". \n
129 * Since 3.0, if the media content has no artist info, the method returns empty string.
131 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
133 * @remarks You must release @a artist using free().
135 * @param[in] audio The audio metadata handle
136 * @param[out] artist The artist of the audio metadata
138 * @return @c 0 on success,
139 * otherwise a negative error value
141 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
142 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
143 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
144 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
146 int audio_meta_get_artist(audio_meta_h audio, char **artist);
149 * @brief Gets the album artist of the given audio metadata.
150 * @details If the value is an empty string, the method returns "Unknown". \n
151 * Since 3.0, if the media content has no album artist info, the method returns empty string.
153 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
155 * @remarks You must release @a album_artist using free().
157 * @param[in] audio The audio metadata handle
158 * @param[out] album_artist The album artist of the audio metadata
160 * @return @c 0 on success,
161 * otherwise a negative error value
163 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
164 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
165 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
166 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
168 int audio_meta_get_album_artist(audio_meta_h audio, char **album_artist);
171 * @brief Gets the genre of the given audio metadata.
172 * @details If the value is an empty string, the method returns "Unknown". \n
173 * Since 3.0, if the media content has no genre info, the method returns empty string.
175 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
177 * @remarks You must release @a genre using free().
179 * @param[in] audio The audio metadata handle
180 * @param[out] genre The genre of the audio metadata
182 * @return @c 0 on success,
183 * otherwise a negative error value
185 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
186 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
187 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
188 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
190 int audio_meta_get_genre(audio_meta_h audio, char **genre);
193 * @brief Gets the composer of the given audio metadata.
194 * @details If the value is an empty string, the method returns "Unknown". \n
195 * Since 3.0, if the media content has no composer info, the method returns empty string.
197 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
199 * @remarks You must release @a composer using free().
201 * @param[in] audio The audio metadata handle
202 * @param[out] composer The composer of the audio metadata
204 * @return @c 0 on success,
205 * otherwise a negative error value
207 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
208 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
209 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
210 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
212 int audio_meta_get_composer(audio_meta_h audio, char **composer);
215 * @brief Gets the year of the given audio metadata.
216 * @details If the value is an empty string, the method returns "Unknown". \n
217 * Since 3.0, if the media content has no year info, the method returns empty string.
219 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
221 * @remarks You must release @a year using free().
223 * @param[in] audio The audio metadata handle
224 * @param[out] year The year of the audio metadata
226 * @return @c 0 on success,
227 * otherwise a negative error value
229 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
230 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
231 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
232 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
234 int audio_meta_get_year(audio_meta_h audio, char **year);
237 * @brief Gets the recorded date of the given audio metadata.
238 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
240 * @remarks You must release @a recorded_date using free().
242 * @param[in] audio The audio metadata handle
243 * @param[out] recorded_date The recorded date of the audio metadata
245 * @return @c 0 on success,
246 * otherwise a negative error value
248 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
249 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
250 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
251 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
253 int audio_meta_get_recorded_date(audio_meta_h audio, char **recorded_date);
256 * @brief Gets the copyright notice of the given audio metadata.
257 * @details If the media content has no copyright info, the method returns empty string.
259 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
261 * @remarks You must release @a copyright using free().
263 * @param[in] audio The audio metadata handle
264 * @param[out] copyright The copyright of the audio metadata
266 * @return @c 0 on success,
267 * otherwise a negative error value
269 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
270 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
271 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
272 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
274 int audio_meta_get_copyright(audio_meta_h audio, char **copyright);
277 * @brief Gets the track number of the given audio metadata.
278 * @details If the value is an empty string, the method returns "Unknown". \n
279 * Since 3.0, if the media content has no track info, the method returns empty string.
281 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
283 * @remarks You must release @a track_num using free().
285 * @param[in] audio The audio metadata handle
286 * @param[out] track_num The audio track number of the audio metadata
288 * @return @c 0 on success,
289 * otherwise a negative error value
291 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
292 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
293 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
294 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
296 int audio_meta_get_track_num(audio_meta_h audio, char **track_num);
299 * @brief Gets the bitrate of the given audio metadata in bitrate per second.
300 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
302 * @param[in] audio The audio metadata handle
303 * @param[out] bit_rate The audio bitrate in bit per second [bps]
305 * @return @c 0 on success,
306 * otherwise a negative error value
308 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
309 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
310 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
312 int audio_meta_get_bit_rate(audio_meta_h audio, int *bit_rate);
315 * @brief Gets bit per sample of the given audio metadata.
316 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
318 * @param [in] audio The handle to the audio metadata
319 * @param [out] bitpersample The audio bit per sample
321 * @return @c 0 on success,
322 * otherwise a negative error value
324 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
325 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
326 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
328 int audio_meta_get_bitpersample(audio_meta_h audio, int *bitpersample);
331 * @brief Gets the sample rate of the given audio metadata.
332 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
334 * @param[in] audio The audio metadata handle
335 * @param[out] sample_rate The audio sample rate[hz]
337 * @return @c 0 on success,
338 * otherwise a negative error value
340 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
341 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
342 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
344 int audio_meta_get_sample_rate(audio_meta_h audio, int *sample_rate);
347 * @brief Gets the channel of the given audio metadata.
348 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
350 * @param[in] audio The audio metadata handle
351 * @param[out] channel The channel of the audio
353 * @return @c 0 on success,
354 * otherwise a negative error value
356 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
357 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
358 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
360 int audio_meta_get_channel(audio_meta_h audio, int *channel);
363 * @brief Gets the track duration of the given audio metadata.
364 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
366 * @param[in] audio The audio metadata handle
367 * @param[out] duration The audio file duration
369 * @return @c 0 on success,
370 * otherwise a negative error value
372 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
373 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
374 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
376 int audio_meta_get_duration(audio_meta_h audio, int *duration);
379 * @deprecated Deprecated since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif. \n
380 * This function does not guarantee independence of the played count value between applications. It is recommended that the value is managed by the application.
381 * @brief Gets the number of times the given audio has been played.
382 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
384 * @param[in] audio The audio metadata handle
385 * @param[out] played_count The counter of the audio played
387 * @return @c 0 on success,
388 * otherwise a negative error value
390 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
391 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
392 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
394 int audio_meta_get_played_count(audio_meta_h audio, int *played_count) TIZEN_DEPRECATED_API;
397 * @deprecated Deprecated since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif. \n
398 * This function does not guarantee independence of the played time value between applications. It is recommended that the value is managed by the application.
399 * @brief Gets the last played time parameter of the audio.
401 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
403 * @param[in] audio The audio metadata handle
404 * @param[out] played_time The last played time of the audio
406 * @return @c 0 on success,
407 * otherwise a negative error value
409 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
410 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
411 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
413 int audio_meta_get_played_time(audio_meta_h audio, time_t *played_time) TIZEN_DEPRECATED_API;
416 * @deprecated Deprecated since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif. \n
417 * This function does not guarantee independence of the played position value between applications. It is recommended that the value is managed by the application.
418 * @brief Gets the played position parameter of the audio.
419 * @details This function returns the elapsed playback position parameter of the audio as a period
420 * starting from the beginning of the track.
422 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
424 * @param[in] audio The audio metadata handle
425 * @param[out] played_position The elapsed time of the audio
427 * @return @c 0 on success,
428 * otherwise a negative error value
430 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
431 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
432 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
434 int audio_meta_get_played_position(audio_meta_h audio, int *played_position) TIZEN_DEPRECATED_API;
437 * @deprecated Deprecated since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif. \n
438 * This function does not guarantee independence of the played count value between applications. It is recommended that the value is managed by the application.
439 * @brief Sets the played count of the audio.
440 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
442 * @param[in] audio The audio metadata handle
443 * @param[in] played_count The played count of the audio
445 * @return @c 0 on success,
446 * otherwise a negative error value
448 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
449 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
450 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
452 int audio_meta_set_played_count(audio_meta_h audio, int played_count) TIZEN_DEPRECATED_API;
455 * @deprecated Deprecated since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif. \n
456 * This function does not guarantee independence of the played time value between applications. It is recommended that the value is managed by the application.
457 * @brief Sets the last played time of the audio.
458 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
460 * @param[in] audio The audio metadata handle
461 * @param[in] played_time The last played time of the audio
463 * @return @c 0 on success,
464 * otherwise a negative error value
466 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
467 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
468 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
470 int audio_meta_set_played_time(audio_meta_h audio, time_t played_time) TIZEN_DEPRECATED_API;
473 * @deprecated Deprecated since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif. \n
474 * This function does not guarantee independence of the played position value between applications. It is recommended that the value is managed by the application.
475 * @brief Sets the played position of the audio.
477 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
479 * @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).
481 * @param[in] audio The audio metadata handle
482 * @param[in] played_position The played position of the audio
484 * @return @c 0 on success,
485 * otherwise a negative error value
487 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
488 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
489 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
491 int audio_meta_set_played_position(audio_meta_h audio, int played_position) TIZEN_DEPRECATED_API;
494 * @deprecated Deprecated since 4.0. Related setter functions are deprecated, therefore this function is not needed anymore.
495 * @brief Updates an audio metadata with modified attributes in the media database.
496 * @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
499 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
502 * @privilege %http://tizen.org/privilege/content.write
504 * @remarks Do not call this function in callback function of foreach function like media_info_foreach_media_from_db().
506 * @param[in] audio The audio metadata handle
508 * @return @c 0 on success,
509 * otherwise a negative error value
511 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
512 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
513 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
514 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
515 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
516 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
517 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
518 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
520 * @pre This function requires opened connection to content service by media_content_connect().
522 * @see media_content_connect()
524 int audio_meta_update_to_db(audio_meta_h audio) TIZEN_DEPRECATED_API;
532 #endif /* __cplusplus */
534 #endif /*__TIZEN_AUDIO_META_H__*/