Add new api media_info_get_title tizen_2.1 accepted/tizen/20130520.100703 submit/tizen/20130517.044647 submit/tizen_2.1/20130514.051921
authorHyunjun Ko <zzoon.ko@samsung.com>
Mon, 6 May 2013 09:40:07 +0000 (18:40 +0900)
committerHyunjun Ko <zzoon.ko@samsung.com>
Mon, 6 May 2013 10:06:45 +0000 (19:06 +0900)
Change-Id: Ieb8fe91548aae541d91e7303006cbc5286b3ec51

include/media_info.h
include/media_info_private.h
packaging/capi-content-media-content.spec
src/media_info.c

index b074100..2cfc92f 100755 (executable)
@@ -551,6 +551,21 @@ int media_info_get_provider(media_info_h media, char **provider);
 int media_info_get_content_name(media_info_h media, char **content_name);
 
 /**
+ * @brief Gets the title to media info.
+ *
+ * @remarks @a title must be released with free() by you.
+ *
+ * @param[in] media The handle to media info
+ * @param[out] title The title of media info
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #MEDIA_CONTENT_ERROR_NONE Successful
+ * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ */
+int media_info_get_title(media_info_h media, char **title);
+
+/**
  * @brief Gets the provider to media info.
  *
  * @remarks @a category must be released with free() by you.
index 0b914fb..9a2e76d 100755 (executable)
@@ -224,6 +224,7 @@ typedef struct
        double altitude;
        int rating;
        int favourite;
+       char *title;
        char *author;
        char *provider;
        char *content_name;
index 8ed0bce..d9b29bc 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-content-media-content
 Summary:    A Media content library in SLP C API
-Version: 0.2.57
+Version: 0.2.58
 Release:    0
 Group:      System/Libraries
 License:    Apache License, Version 2.0
index 4c35217..55feff3 100755 (executable)
@@ -247,6 +247,9 @@ void _media_info_item_get_detail(sqlite3_stmt* stmt, media_info_h media)
        _media->latitude = (double)sqlite3_column_double(stmt, 22);
        _media->altitude = (double)sqlite3_column_double(stmt, 23);
 
+       if(STRING_VALID((const char *)sqlite3_column_text(stmt, 28)))
+               _media->title = strdup((const char *)sqlite3_column_text(stmt, 28));
+
        if(_media->media_type == MEDIA_CONTENT_TYPE_IMAGE) {
                _media->image_meta = (image_meta_s *)calloc(1, sizeof(image_meta_s));
                if(_media->image_meta) {
@@ -672,6 +675,7 @@ int media_info_destroy(media_info_h media)
                SAFE_FREE(_media->location_tag);
                SAFE_FREE(_media->age_rating);
                SAFE_FREE(_media->keyword);
+               SAFE_FREE(_media->title);
 
                if(_media->image_meta) {
                        SAFE_FREE(_media->image_meta->media_id);
@@ -796,6 +800,16 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                        }
                }
+               if(STRING_VALID(_src->title))
+               {
+                       _dst->title = strdup(_src->title);
+                       if(_dst->title == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               media_info_destroy((media_info_h)_dst);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
                if(STRING_VALID(_src->author))
                {
                        _dst->author = strdup(_src->author);
@@ -1726,6 +1740,37 @@ int media_info_get_thumbnail_path(media_info_h media, char **path)
        return ret;
 }
 
+int media_info_get_title(media_info_h media, char **title)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_info_s *_media = (media_info_s*)media;
+
+       if(_media && title)
+       {
+               if(STRING_VALID(_media->title))
+               {
+                       *title = strdup(_media->title);
+                       if(*title == NULL)
+                       {
+                               media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+                               return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+               else
+               {
+                       *title = 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 media_info_get_description(media_info_h media, char **description)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;