Remove unused API & update description
[platform/core/api/media-content.git] / src / media_audio.c
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17
18 #include <media_info_private.h>
19
20
21 int audio_meta_destroy(audio_meta_h audio)
22 {
23         int ret = MEDIA_CONTENT_ERROR_NONE;
24         audio_meta_s *_audio = (audio_meta_s*)audio;
25
26         if(_audio)
27         {
28                 SAFE_FREE(_audio->media_id);
29                 SAFE_FREE(_audio->title);
30                 SAFE_FREE(_audio->album);
31                 SAFE_FREE(_audio->artist);
32                 SAFE_FREE(_audio->genre);
33                 SAFE_FREE(_audio->composer);
34                 SAFE_FREE(_audio->year);
35                 SAFE_FREE(_audio->recorded_date);
36                 SAFE_FREE(_audio->copyright);
37                 SAFE_FREE(_audio->track_num);
38                 SAFE_FREE(_audio);
39
40                 ret = MEDIA_CONTENT_ERROR_NONE;
41         }
42         else
43         {
44                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
45                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
46         }
47
48         return ret;
49 }
50
51 int audio_meta_clone(audio_meta_h *dst, audio_meta_h src)
52 {
53         int ret = MEDIA_CONTENT_ERROR_NONE;
54         audio_meta_s *_src = (audio_meta_s*)src;
55
56         if(_src != NULL)
57         {
58                 audio_meta_s *_dst = (audio_meta_s*)calloc(1, sizeof(audio_meta_s));
59
60                 if(_dst == NULL)
61                 {
62
63                         media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
64                         return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
65                 }
66
67                 if(STRING_VALID(_src->media_id))
68                 {
69                         _dst->media_id = strdup(_src->media_id);
70                         if(_dst->media_id == NULL)
71                         {
72                                 audio_meta_destroy((audio_meta_h)_dst);
73                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
74                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
75                         }
76                 }
77
78                 if(STRING_VALID(_src->title))
79                 {
80                         _dst->title = strdup(_src->title);
81                         if(_dst->title == NULL)
82                         {
83                                 audio_meta_destroy((audio_meta_h)_dst);
84                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
85                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
86                         }
87                 }
88
89                 if(STRING_VALID(_src->album))
90                 {
91                         _dst->album = strdup(_src->album);
92                         if(_dst->album == NULL)
93                         {
94                                 audio_meta_destroy((audio_meta_h)_dst);
95                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
96                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
97                         }
98                 }
99
100                 if(STRING_VALID(_src->artist))
101                 {
102                         _dst->artist = strdup(_src->artist);
103                         if(_dst->artist == NULL)
104                         {
105                                 audio_meta_destroy((audio_meta_h)_dst);
106                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
107                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
108                         }
109                 }
110
111                 if(STRING_VALID(_src->genre))
112                 {
113                         _dst->genre = strdup(_src->genre);
114                         if(_dst->genre == NULL)
115                         {
116                                 audio_meta_destroy((audio_meta_h)_dst);
117                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
118                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
119                         }
120                 }
121
122                 if(STRING_VALID(_src->composer))
123                 {
124                         _dst->composer = strdup(_src->composer);
125                         if(_dst->composer == NULL)
126                         {
127                                 audio_meta_destroy((audio_meta_h)_dst);
128                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
129                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
130                         }
131                 }
132
133                 if(STRING_VALID(_src->year))
134                 {
135                         _dst->year = strdup(_src->year);
136                         if(_dst->year == NULL)
137                         {
138                                 audio_meta_destroy((audio_meta_h)_dst);
139                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
140                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
141                         }
142                 }
143
144                 if(STRING_VALID(_src->recorded_date))
145                 {
146                         _dst->recorded_date = strdup(_src->recorded_date);
147                         if(_dst->recorded_date == NULL)
148                         {
149                                 audio_meta_destroy((audio_meta_h)_dst);
150                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
151                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
152                         }
153                 }
154
155                 if(STRING_VALID(_src->copyright))
156                 {
157                         _dst->copyright = strdup(_src->copyright);
158                         if(_dst->copyright == NULL)
159                         {
160                                 audio_meta_destroy((audio_meta_h)_dst);
161                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
162                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
163                         }
164                 }
165
166                 if(STRING_VALID(_src->track_num))
167                 {
168                         _dst->track_num = strdup(_src->track_num);
169                         if(_dst->track_num == NULL)
170                         {
171                                 audio_meta_destroy((audio_meta_h)_dst);
172                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
173                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
174                         }
175                 }
176
177                 _dst->bitrate = _src->bitrate;
178                 _dst->samplerate = _src->samplerate;
179                 _dst->channel = _src->channel;
180                 _dst->duration = _src->duration;
181                 _dst->played_count = _src->played_count;
182                 _dst->played_time = _src->played_time;
183                 _dst->played_position = _src->played_position;
184
185                 *dst = (audio_meta_h)_dst;
186
187                 ret = MEDIA_CONTENT_ERROR_NONE;
188         }
189         else
190         {
191                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
192                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
193         }
194
195         return ret;
196 }
197
198 int audio_meta_get_media_id(audio_meta_h audio, char **media_id)
199 {
200         int ret = MEDIA_CONTENT_ERROR_NONE;
201         audio_meta_s *_audio = (audio_meta_s*)audio;
202         if(_audio)
203         {
204                 if(STRING_VALID(_audio->media_id))
205                 {
206                         *media_id = strdup(_audio->media_id);
207                         if(*media_id == NULL)
208                         {
209                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
210                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
211                         }
212                 }
213                 else
214                 {
215                         *media_id = NULL;
216                 }
217                 ret = MEDIA_CONTENT_ERROR_NONE;
218
219         }
220         else
221         {
222                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
223                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
224         }
225
226         return ret;
227 }
228
229 int audio_meta_get_album(audio_meta_h audio, char **album_name)
230 {
231         int ret = MEDIA_CONTENT_ERROR_NONE;
232         audio_meta_s *_audio = (audio_meta_s*)audio;
233         if(_audio)
234         {
235                 if(STRING_VALID(_audio->album))
236                 {
237                         *album_name = strdup(_audio->album);
238                         if(*album_name == NULL)
239                         {
240                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
241                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
242                         }
243                 }
244                 else
245                 {
246                         *album_name = NULL;
247                 }
248                 ret = MEDIA_CONTENT_ERROR_NONE;
249
250         }
251         else
252         {
253                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
254                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
255         }
256
257         return ret;
258 }
259
260 int audio_meta_get_artist(audio_meta_h audio, char **artist_name)
261 {
262         int ret = MEDIA_CONTENT_ERROR_NONE;
263         audio_meta_s *_audio = (audio_meta_s*)audio;
264
265         if(_audio)
266         {
267                 if(STRING_VALID(_audio->artist))
268                 {
269                         *artist_name = strdup(_audio->artist);
270                         if(*artist_name == NULL)
271                         {
272                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
273                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
274                         }
275                 }
276                 else
277                 {
278                         *artist_name = NULL;
279                 }
280                 ret = MEDIA_CONTENT_ERROR_NONE;
281
282         }
283         else
284         {
285                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
286                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
287         }
288
289         return ret;
290 }
291
292 int audio_meta_get_genre(audio_meta_h audio, char **genre_name)
293 {
294         int ret = MEDIA_CONTENT_ERROR_NONE;
295         audio_meta_s *_audio = (audio_meta_s*)audio;
296         if(_audio)
297         {
298                 if(STRING_VALID(_audio->genre))
299                 {
300                         *genre_name = strdup(_audio->genre);
301                         if(*genre_name == NULL)
302                         {
303                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
304                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
305                         }
306                 }
307                 else
308                 {
309                         *genre_name = NULL;
310                 }
311
312                 ret = MEDIA_CONTENT_ERROR_NONE;
313         }
314         else
315         {
316                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
317                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
318         }
319
320         return ret;
321 }
322
323 int audio_meta_get_composer(audio_meta_h audio, char **composer_name)
324 {
325         int ret = MEDIA_CONTENT_ERROR_NONE;
326         audio_meta_s *_audio = (audio_meta_s*)audio;
327         if(_audio)
328         {
329                 if(STRING_VALID(_audio->composer))
330                 {
331                         *composer_name = strdup(_audio->composer);
332                         if(*composer_name == NULL)
333                         {
334                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
335                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
336                         }
337                 }
338                 else
339                 {
340                         *composer_name = NULL;
341                 }
342
343                 ret = MEDIA_CONTENT_ERROR_NONE;
344         }
345         else
346         {
347                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
348                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
349         }
350
351         return ret;
352 }
353
354 int audio_meta_get_year(audio_meta_h audio, char **year)
355 {
356         int ret = MEDIA_CONTENT_ERROR_NONE;
357         audio_meta_s *_audio = (audio_meta_s*)audio;
358         if(_audio)
359         {
360                 if(STRING_VALID(_audio->year))
361                 {
362                         *year = strdup(_audio->year);
363                         if(*year == NULL)
364                         {
365                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
366                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
367                         }
368                 }
369                 else
370                 {
371                         *year = NULL;
372                 }
373
374                 ret = MEDIA_CONTENT_ERROR_NONE;
375         }
376         else
377         {
378                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
379                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
380         }
381
382         return ret;
383 }
384
385 int audio_meta_get_recorded_date(audio_meta_h audio, char **recorded_date)
386 {
387         int ret = MEDIA_CONTENT_ERROR_NONE;
388         audio_meta_s *_audio = (audio_meta_s*)audio;
389         if(_audio)
390         {
391                 if(STRING_VALID(_audio->recorded_date))
392                 {
393                         *recorded_date = strdup(_audio->recorded_date);
394                         if(*recorded_date == NULL)
395                         {
396                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
397                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
398                         }
399                 }
400                 else
401                 {
402                         *recorded_date = NULL;
403                 }
404
405                 ret = MEDIA_CONTENT_ERROR_NONE;
406         }
407         else
408         {
409                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
410                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
411         }
412
413         return ret;
414 }
415
416 int audio_meta_get_copyright(audio_meta_h audio, char **copyright)
417 {
418         int ret = MEDIA_CONTENT_ERROR_NONE;
419         audio_meta_s *_audio = (audio_meta_s*)audio;
420         if(_audio)
421         {
422                 if(STRING_VALID(_audio->copyright))
423                 {
424                         *copyright = strdup(_audio->copyright);
425                         if(*copyright == NULL)
426                         {
427                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
428                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
429                         }
430                 }
431                 else
432                 {
433                         *copyright = NULL;
434                 }
435
436                 ret = MEDIA_CONTENT_ERROR_NONE;
437         }
438         else
439         {
440                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
441                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
442         }
443
444         return ret;
445 }
446
447 int audio_meta_get_track_num(audio_meta_h audio, char **track_num)
448 {
449         int ret = MEDIA_CONTENT_ERROR_NONE;
450         audio_meta_s *_audio = (audio_meta_s*)audio;
451         if(_audio)
452         {
453                 if(STRING_VALID(_audio->track_num))
454                 {
455                         *track_num = strdup(_audio->track_num);
456                         if(*track_num == NULL)
457                         {
458                                 media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
459                                 return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
460                         }
461                 }
462                 else
463                 {
464                         *track_num = NULL;
465                 }
466
467                 ret = MEDIA_CONTENT_ERROR_NONE;
468         }
469         else
470         {
471                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
472                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
473         }
474
475         return ret;
476 }
477
478 int audio_meta_get_bit_rate(audio_meta_h audio, int *bit_rate)
479 {
480         int ret = MEDIA_CONTENT_ERROR_NONE;
481         audio_meta_s *_audio = (audio_meta_s*)audio;
482
483         if(_audio && bit_rate)
484         {
485                 *bit_rate = _audio->bitrate;
486                 ret = MEDIA_CONTENT_ERROR_NONE;
487         }
488         else
489         {
490                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
491                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
492         }
493
494         return ret;
495 }
496
497 int audio_meta_get_sample_rate(audio_meta_h audio, int *sample_rate)
498 {
499         int ret = MEDIA_CONTENT_ERROR_NONE;
500         audio_meta_s *_audio = (audio_meta_s*)audio;
501
502         if(_audio && sample_rate)
503         {
504                 *sample_rate = _audio->samplerate;
505                 ret = MEDIA_CONTENT_ERROR_NONE;
506         }
507         else
508         {
509                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
510                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
511         }
512
513         return ret;
514 }
515
516 int audio_meta_get_channel(audio_meta_h audio, int *channel)
517 {
518         int ret = MEDIA_CONTENT_ERROR_NONE;
519         audio_meta_s *_audio = (audio_meta_s*)audio;
520
521         if(_audio && channel)
522         {
523                 *channel = _audio->channel;
524                 ret = MEDIA_CONTENT_ERROR_NONE;
525         }
526         else
527         {
528                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
529                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
530         }
531
532         return ret;
533 }
534
535 int audio_meta_get_duration(audio_meta_h audio, int *duration)
536 {
537         int ret = MEDIA_CONTENT_ERROR_NONE;
538         audio_meta_s *_audio = (audio_meta_s*)audio;
539
540         if(_audio)
541         {
542                 *duration = _audio->duration;
543                 ret = MEDIA_CONTENT_ERROR_NONE;
544         }
545         else
546         {
547                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
548                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
549         }
550
551         return ret;
552 }
553
554 int audio_meta_get_played_count(audio_meta_h audio, int *played_count)
555 {
556         int ret = MEDIA_CONTENT_ERROR_NONE;
557         audio_meta_s *_audio = (audio_meta_s*)audio;
558
559         if(_audio)
560         {
561                 *played_count = _audio->played_count;
562                 ret = MEDIA_CONTENT_ERROR_NONE;
563         }
564         else
565         {
566                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
567                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
568         }
569
570         return ret;
571 }
572
573 int audio_meta_get_played_time(audio_meta_h audio, time_t* played_time)
574 {
575         int ret = MEDIA_CONTENT_ERROR_NONE;
576         audio_meta_s *_audio = (audio_meta_s*)audio;
577
578         if(_audio)
579         {
580                 *played_time = _audio->played_time;
581                 ret = MEDIA_CONTENT_ERROR_NONE;
582         }
583         else
584         {
585                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
586                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
587         }
588
589         return ret;
590 }
591
592 int audio_meta_get_played_position(audio_meta_h audio, int *played_position)
593 {
594         int ret = MEDIA_CONTENT_ERROR_NONE;
595         audio_meta_s *_audio = (audio_meta_s*)audio;
596
597         if(_audio)
598         {
599                 *played_position = _audio->played_position;
600                 ret = MEDIA_CONTENT_ERROR_NONE;
601         }
602         else
603         {
604                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
605                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
606         }
607
608         return ret;
609 }
610
611 int audio_meta_set_played_count(audio_meta_h audio, int played_count)
612 {
613         int ret = MEDIA_CONTENT_ERROR_NONE;
614
615         audio_meta_s *_audio = (audio_meta_s*)audio;
616
617         if((_audio != NULL) && (played_count >= 0))
618         {
619                 _audio->played_count = played_count;
620         }
621         else
622         {
623                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
624                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
625         }
626
627         return ret;
628 }
629
630 int audio_meta_set_played_time(audio_meta_h audio, time_t played_time)
631 {
632         int ret = MEDIA_CONTENT_ERROR_NONE;
633
634         audio_meta_s *_audio = (audio_meta_s*)audio;
635
636         if((_audio != NULL) && (played_time >= 0))
637         {
638                 _audio->played_time = played_time;
639         }
640         else
641         {
642                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
643                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
644         }
645
646         return ret;
647 }
648
649 int audio_meta_set_played_position(audio_meta_h audio, int played_position)
650 {
651         int ret = MEDIA_CONTENT_ERROR_NONE;
652         audio_meta_s *_audio = (audio_meta_s*)audio;
653
654         if((_audio != NULL) && (played_position >= 0))
655         {
656                 _audio->played_position = played_position;
657         }
658         else
659         {
660                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
661                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
662         }
663
664         return ret;
665 }
666
667 int audio_meta_update_to_db(audio_meta_h audio)
668 {
669         int ret = MEDIA_CONTENT_ERROR_NONE;
670         audio_meta_s *_audio = (audio_meta_s*)audio;
671         char *sql = NULL;
672
673         if(_audio != NULL && STRING_VALID(_audio->media_id))
674         {
675                 sql = sqlite3_mprintf(UPDATE_AV_META_FROM_MEDIA, _audio->played_count, _audio->played_time, _audio->played_position, _audio->media_id);
676                 ret = _content_query_sql(sql);
677                 sqlite3_free(sql);
678         }
679         else
680         {
681                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
682                 ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
683         }
684
685         return ret;
686 }