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 2.4. [Use media_info_get_played_count() instead]
380 * @brief Gets the number of times the given audio has been played.
381 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
383 * @param[in] audio The audio metadata handle
384 * @param[out] played_count The counter of the audio played
386 * @return @c 0 on success,
387 * otherwise a negative error value
389 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
390 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
391 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
393 int audio_meta_get_played_count(audio_meta_h audio, int *played_count);
396 * @deprecated Deprecated since 2.4. [Use media_info_get_played_time() instead]
397 * @brief Gets the last played time parameter of the audio.
399 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
401 * @param[in] audio The audio metadata handle
402 * @param[out] played_time The last played 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_time(audio_meta_h audio, time_t *played_time);
414 * @deprecated Deprecated since 2.4.
415 * @brief Gets the played position parameter of the audio.
416 * @details This function returns the elapsed playback position parameter of the audio as a period
417 * starting from the beginning of the track.
419 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
421 * @param[in] audio The audio metadata handle
422 * @param[out] played_position The elapsed time of the audio
424 * @return @c 0 on success,
425 * otherwise a negative error value
427 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
428 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
429 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
431 int audio_meta_get_played_position(audio_meta_h audio, int *played_position);
434 * @deprecated Deprecated since 2.4. [Use media_info_increase_played_count() instead]
435 * @brief Sets the played count of the audio.
436 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
438 * @param[in] audio The audio metadata handle
439 * @param[in] played_count The played count of the audio
441 * @return @c 0 on success,
442 * otherwise a negative error value
444 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
445 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
446 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
448 * @post audio_meta_update_to_db().
450 int audio_meta_set_played_count(audio_meta_h audio, int played_count);
453 * @deprecated Deprecated since 2.4. [Use media_info_set_played_time() instead]
454 * @brief Sets the last played time of the audio.
455 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
457 * @param[in] audio The audio metadata handle
458 * @param[in] played_time The last played time of the audio
460 * @return @c 0 on success,
461 * otherwise a negative error value
463 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
464 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
465 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
467 * @post audio_meta_update_to_db().
469 int audio_meta_set_played_time(audio_meta_h audio, time_t played_time);
472 * @deprecated Deprecated since 2.4.
473 * @brief Sets the played position of the audio.
475 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
477 * @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).
479 * @param[in] audio The audio metadata handle
480 * @param[in] played_position The played position of the audio
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 * @post audio_meta_update_to_db().
491 int audio_meta_set_played_position(audio_meta_h audio, int played_position);
494 * @brief Updates an audio metadata with modified attributes in the media database.
495 * @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
496 * 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.
498 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
501 * @privilege %http://tizen.org/privilege/content.write
503 * @remarks Do not call this function in callback function of foreach function like media_info_foreach_media_from_db().
505 * @param[in] audio The audio metadata handle
507 * @return @c 0 on success,
508 * otherwise a negative error value
510 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
511 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
512 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
513 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
514 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
515 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
516 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
517 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
519 * @pre This function requires opened connection to content service by media_content_connect().
521 * @see media_content_connect()
522 * @see audio_meta_set_played_time()
523 * @see audio_meta_set_played_count()
524 * @see audio_meta_set_played_position()
526 int audio_meta_update_to_db(audio_meta_h audio);
534 #endif /* __cplusplus */
536 #endif /*__TIZEN_AUDIO_META_H__*/