modify DB schema.
[platform/core/api/media-content.git] / src / media_audio.c
index 61b9aa7..baf0291 100755 (executable)
@@ -29,6 +29,7 @@ int audio_meta_destroy(audio_meta_h audio)
                SAFE_FREE(_audio->title);
                SAFE_FREE(_audio->album);
                SAFE_FREE(_audio->artist);
+               SAFE_FREE(_audio->album_artist);
                SAFE_FREE(_audio->genre);
                SAFE_FREE(_audio->composer);
                SAFE_FREE(_audio->year);
@@ -108,6 +109,17 @@ int audio_meta_clone(audio_meta_h *dst, audio_meta_h src)
                        }
                }
 
+               if(STRING_VALID(_src->album_artist))
+               {
+                       _dst->album_artist = strdup(_src->album_artist);
+                       if(_dst->album_artist == NULL)
+                       {
+                               audio_meta_destroy((audio_meta_h)_dst);
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+
                if(STRING_VALID(_src->genre))
                {
                        _dst->genre = strdup(_src->genre);
@@ -175,6 +187,7 @@ int audio_meta_clone(audio_meta_h *dst, audio_meta_h src)
                }
 
                _dst->bitrate = _src->bitrate;
+               _dst->bitpersample = _src->bitpersample;
                _dst->samplerate = _src->samplerate;
                _dst->channel = _src->channel;
                _dst->duration = _src->duration;
@@ -289,6 +302,38 @@ int audio_meta_get_artist(audio_meta_h audio, char **artist_name)
        return ret;
 }
 
+int audio_meta_get_album_artist(audio_meta_h audio, char **album_artist_name)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       audio_meta_s *_audio = (audio_meta_s*)audio;
+
+       if(_audio)
+       {
+               if(STRING_VALID(_audio->album_artist))
+               {
+                       *album_artist_name = strdup(_audio->album_artist);
+                       if(*album_artist_name == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+               else
+               {
+                       *album_artist_name = NULL;
+               }
+               ret = MEDIA_CONTENT_ERROR_NONE;
+
+       }
+       else
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return ret;
+}
+
 int audio_meta_get_genre(audio_meta_h audio, char **genre_name)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -494,6 +539,25 @@ int audio_meta_get_bit_rate(audio_meta_h audio, int *bit_rate)
        return ret;
 }
 
+int audio_meta_get_bitpersample(audio_meta_h audio, int *bitpersample)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       audio_meta_s *_audio = (audio_meta_s*)audio;
+
+       if(_audio && bitpersample)
+       {
+               *bitpersample = _audio->bitpersample;
+               ret = MEDIA_CONTENT_ERROR_NONE;
+       }
+       else
+       {
+               media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       return ret;
+}
+
 int audio_meta_get_sample_rate(audio_meta_h audio, int *sample_rate)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;