summaryrefslogtreecommitdiff
path: root/include/media_audio.h
blob: 183d1bd252a18f1363fd348b53a64ddc20752e56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
/*
* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


#ifndef __TIZEN_AUDIO_META_H__
#define __TIZEN_AUDIO_META_H__

#include <media_content_type.h>


#ifdef __cplusplus
extern "C" {
#endif

/**
 * @addtogroup CAPI_CONTENT_MEDIA_AUDIO_META_MODULE
 * @{
 *
 * @file audio_meta.h
 * @brief This file contains the audio metadata API and related structure and enumeration. \n
 *        Description of the audio content involves: album, artist, author, genre and description tags. \n
 *        Parameters of the recording are also supported, as: format, bitrate, duration, size etc.
 */


/**
 * @brief Destroys audio metadata.
 *
 * @param [in] audio The handle to audio metadata.
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @pre Get copy of audio metadata handle handle by calling audio_meta_clone()
 * @see audio_meta_clone()
 * @see media_info_get_audio_from_db()
 */
int audio_meta_destroy(audio_meta_h audio);

/**
 * @brief Clones audio metadata.
 * @details Function copies the audio metadata handle handle from source to destination.
 *
 * @remark The destination handle must be released with audio_meta_destroy() by you.
 *
 * @param [out] dst A destination handle to audio metadata
 * @param [in] src The source handle to audio metadata
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
 * @see audio_meta_destroy()
 */
int audio_meta_clone(audio_meta_h *dst, audio_meta_h src);

/**
 * @brief Gets id of audio of given audio metadata.
 *
 * @remarks @a audio id must be released with free() by you.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] media_id The id of the audio
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
 */
int audio_meta_get_media_id(audio_meta_h audio, char **media_id);

/**
 * @brief Gets title of audio of given audio metadata.
 *
 * @remarks @a audio title must be released with free() by you.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] title The title of the audio
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
 */
int audio_meta_get_title(audio_meta_h audio, char **title);

/**
 * @brief Gets name of album of given audio metadata.\n
 * If the value is an empty string, the method returns "Unknown".
 *
 * @remarks @a album_name must be released with free() by you.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] album_name The name of the album
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
 */
int audio_meta_get_album(audio_meta_h audio, char **album_name);

/**
 * @brief Gets name of artist of given audio metadata.\n
 * If the value is an empty string, the method returns "Unknown".
 *
 * @remarks @a artist_name must be released with free() by you.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] artist_name The name of the artist
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
 */
int audio_meta_get_artist(audio_meta_h audio, char **artist_name);

/**
 * @brief Gets name of genre of given audio metadata.\n
 * If the value is an empty string, the method returns "Unknown".
 *
 * @remarks @a genre_name must be released with free() by you.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] genre_name The name of the genre
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
 */
int audio_meta_get_genre(audio_meta_h audio, char **genre_name);

/**
 * @brief Gets name of composer of given audio metadata.\n
 * If the value is an empty string, the method returns "Unknown".
 *
 * @remarks @a author_name must be released with free() by you.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] author_name The name of the author of audio
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
 */
int audio_meta_get_composer(audio_meta_h audio, char **composer_name);

/**
 * @brief Gets year of given audio metadata.\n
 * If the value is an empty string, the method returns "Unknown".
 *
 * @remarks @a year must be released with free() by you.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] year The year of the audio file
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
 */
int audio_meta_get_year(audio_meta_h audio, char **year);

/**
 * @brief Gets recorded date of given audio metadata.
 *
 * @remarks @a recorded date must be released with free() by you.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] recorded_date The recorded date of the audio file
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
 */
int audio_meta_get_recorded_date(audio_meta_h audio, char **recorded_date);

/**
 * @brief Gets copyright notice of given audio metadata.
 *
 * @remarks @a copyright must be released with free() by you.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] copyright The audio copyright notice
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
 */
int audio_meta_get_copyright(audio_meta_h audio, char **copyright);

/**
 * @brief Gets track number of given audio metadata. \n
 * If the value is an empty string, the method returns "Unknown".
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] track_num The audio track number
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 */
int audio_meta_get_track_num(audio_meta_h audio, char **track_num);

/**
 * @brief Gets bitrate of given audio metadata in bitrate per second.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] bit_rate The audio bitrate in bit per second [bps]
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 */
int audio_meta_get_bit_rate(audio_meta_h audio, int *bit_rate);

/**
 * @brief Gets sample rate of given audio metadata.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] sample_rate The audio sample rate[hz]
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 */
int audio_meta_get_sample_rate(audio_meta_h audio, int *sample_rate);

/**
 * @brief Gets channel of given audio metadata.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] channel The channel of audio
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 */
int audio_meta_get_channel(audio_meta_h audio, int *channel);

/**
 * @brief Gets track duration of given audio metadata.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] duration The audio file duration
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 */
int audio_meta_get_duration(audio_meta_h audio, int *duration);

/**
 * @brief Gets number which represents how many times given audio has been played.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] count_played The counter of audio played
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 */
int audio_meta_get_played_count(audio_meta_h audio, int *played_count);

/**
 * @brief Gets the audio's played time parameter.
 * @details Function returns audio's elapsed playback time parameter as period
 * starting from the beginning of the track.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] played_time The elapsed time of the audio
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 */
int audio_meta_get_played_time(audio_meta_h audio, time_t *played_time);

/**
 * @brief Gets the audio's played position parameter.
 * @details Function returns audio's elapsed playback position parameter as period
 * starting from the beginning of the track.
 *
 * @param [in] audio The handle to audio metadata
 * @param [out] played_position The elapsed time of the audio
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 */
int audio_meta_get_played_position(audio_meta_h audio, int *played_position);

/**
 * @brief Sets the played count to audio meta handle.
 *
 * @param [in] audio The handle to audio metadata
 * @param [in] played_count The played count of audio
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @post audio_meta_update_to_db()
 */
int audio_meta_set_played_count(audio_meta_h audio, int played_count);

/**
 * @brief Sets the played time to audio meta handle.
 *
 * @param [in] audio The handle to audio metadata
 * @param [in] played_time The played time of audio
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @post audio_meta_update_to_db() 
 */
int audio_meta_set_played_time(audio_meta_h audio, time_t played_time);

/**
 * @brief Sets the played position to audio meta handle.
 *
 * @param [in] audio The handle to audio metadata
 * @param [in] played_position The played position of audio
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @post audio_meta_update_to_db()
 */
int audio_meta_set_played_position(audio_meta_h audio, int played_position);

/**
 * @brief Updates audio metadata which is modified attributes to the media database.
 *
 * @details The function updates the given audio meta in the media database.\n
 * The function should be called after any change in the attributes, to be updated to the media database.\n
 * For example, after using audio_meta_set_played_count() for changing the count of the played,
 * audio_meta_update_to_db() function should be called so as to update the given the attibutes in the media database.
 *
 * @param [in] audio The handle to audio metadata
 * @return 0 on success, otherwise a negative error value.
 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
 * @pre This function requires opened connection to content service by media_content_connect().
 * @see media_content_connect()
 * @see audio_meta_set_played_count()
 * @see audio_meta_set_played_time()
 * @see audio_meta_set_played_position()
 */
int audio_meta_update_to_db(audio_meta_h audio);

/**
 * @}
 */


#ifdef __cplusplus
}
#endif

#endif /*__TIZEN_AUDIO_META_H__*/