Remove default setting function 68/226868/7 accepted/tizen/unified/20200311.130942 submit/tizen/20200310.032628
authorMinje Ahn <minje.ahn@samsung.com>
Fri, 6 Mar 2020 05:12:15 +0000 (14:12 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Mon, 9 Mar 2020 06:13:10 +0000 (15:13 +0900)
1. To fix memory leak
2. To fix the behavior of updating metadata

Change-Id: I3b6e870788ee3af4f561107beb41bd5eb72226e1
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
src/common/media-svc-util.c
src/common/media-svc.c
src/include/common/media-svc-util.h

index 09ec4a9..02dbfef 100644 (file)
@@ -280,7 +280,7 @@ static int __media_svc_get_exif_info(ExifData *ed, char *buf, int *i_value, doub
        return MS_MEDIA_ERR_NONE;
 }
 
-time_t __media_svc_get_timeline_from_str(const char *timstr)
+static time_t __media_svc_get_timeline_from_str(const char *timstr)
 {
        struct tm t;
        time_t modified_t = 0;
@@ -732,65 +732,6 @@ int _media_svc_get_file_time(const char *full_path)
        return statbuf.st_mtime;
 }
 
-int _media_svc_set_default_value(media_svc_content_info_s *content_info, bool refresh)
-{
-       /* Set default GPS value before extracting meta information */
-       content_info->media_meta.longitude = MEDIA_SVC_DEFAULT_GPS_VALUE;
-       content_info->media_meta.latitude = MEDIA_SVC_DEFAULT_GPS_VALUE;
-       content_info->media_meta.altitude = MEDIA_SVC_DEFAULT_GPS_VALUE;
-
-       /* Set filename to title for all media */
-       char *title = NULL;
-       title = __media_svc_get_title_from_filepath(content_info->path);
-       if (title) {
-               content_info->media_meta.title = g_strdup(title);
-               SAFE_FREE(title);
-               media_svc_retv_del_if(content_info->media_meta.title == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
-       } else {
-               media_svc_error("Can't extract title");
-               content_info->media_meta.title = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
-               media_svc_retv_del_if(content_info->media_meta.title == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
-       }
-
-       /* Set default value before extracting meta information */
-       content_info->media_meta.description = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
-       media_svc_retv_del_if(content_info->media_meta.description == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
-
-       content_info->media_meta.copyright = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
-       media_svc_retv_del_if(content_info->media_meta.copyright == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
-
-       content_info->media_meta.track_num = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
-       media_svc_retv_del_if(content_info->media_meta.track_num == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
-
-       content_info->media_meta.album = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
-       media_svc_retv_del_if(content_info->media_meta.album == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
-
-       content_info->media_meta.artist = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
-       media_svc_retv_del_if(content_info->media_meta.artist == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
-
-       content_info->media_meta.album_artist = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
-       media_svc_retv_del_if(content_info->media_meta.album_artist == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
-
-       content_info->media_meta.genre = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
-       media_svc_retv_del_if(content_info->media_meta.genre == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
-
-       content_info->media_meta.composer = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
-       media_svc_retv_del_if(content_info->media_meta.composer == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
-
-       content_info->media_meta.year = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
-       media_svc_retv_del_if(content_info->media_meta.year == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
-
-       if (refresh) {
-               media_svc_debug("refresh");
-               return MS_MEDIA_ERR_NONE;
-       }
-
-       content_info->favourate = 0;
-       content_info->media_meta.rating = 0;
-
-       return MS_MEDIA_ERR_NONE;
-}
-
 int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, bool refresh)
 {
        int ret = MS_MEDIA_ERR_NONE;
@@ -815,8 +756,6 @@ int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char
                media_svc_stderror("stat failed");
        }
 
-       _media_svc_set_default_value(content_info, refresh);
-
        /* refresh is TRUE when file modified. so only modified_time and size are changed*/
        if (refresh) {
                media_svc_debug("refresh");
@@ -969,6 +908,38 @@ ERROR:
        return 0;
 }
 
+static char * __media_svc_get_title(MMHandleType tag, const char *path)
+{
+       int ret = FILEINFO_ERROR_NONE;
+       char *p = NULL;
+       int size = 0;
+       char *title = NULL;
+
+       if (tag) {
+               ret = mm_file_get_attrs(tag, MM_FILE_TAG_TITLE, &p, &size, NULL);
+               if (ret == FILEINFO_ERROR_NONE && size > 0) {
+                       while(p && isspace(*p))
+                               p++;
+
+                       return g_strdup(p);
+               }
+       }
+
+       title = __media_svc_get_title_from_filepath(path);
+       if (title)
+               return title;
+
+       media_svc_error("Can't extract title");
+
+       return g_strdup(MEDIA_SVC_TAG_UNKNOWN);
+}
+
+char * _media_svc_get_title_by_path(const char *path)
+{
+       /* No MMHandleType in media-svc.c */
+       return __media_svc_get_title(NULL, path);
+}
+
 int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info)
 {
        double value = 0.0;
@@ -988,6 +959,7 @@ int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info)
        media_svc_retvm_if(!STRING_VALID(content_info->path), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid path");
 
        path = content_info->path;
+       content_info->media_meta.title = __media_svc_get_title(NULL, path);
 
        /* Load an ExifData object from an EXIF file */
        ed = exif_data_new_from_file(path);
@@ -1001,12 +973,17 @@ int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info)
 
        content_info->media_meta.latitude = MEDIA_SVC_DEFAULT_GPS_VALUE;
        content_info->media_meta.longitude = MEDIA_SVC_DEFAULT_GPS_VALUE;
-       content_info->media_meta.description = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
-       content_info->media_meta.fnumber = 0.0;
-       content_info->media_meta.iso = 0;
-       content_info->media_meta.orientation = 0;
-       content_info->media_meta.width = 0;
-       content_info->media_meta.height = 0;
+       content_info->media_meta.altitude = MEDIA_SVC_DEFAULT_GPS_VALUE;
+
+       /* Not used. But to preserved the behavior, set MEDIA_SVC_TAG_UNKNOWN. */
+       content_info->media_meta.album = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
+       content_info->media_meta.artist = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
+       content_info->media_meta.album_artist = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
+       content_info->media_meta.genre = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
+       content_info->media_meta.composer = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
+       content_info->media_meta.year = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
+       content_info->media_meta.copyright = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
+       content_info->media_meta.track_num = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
 
        memset(buf, 0x00, sizeof(buf));
        if (__media_svc_get_exif_gps_double(ed, &value, EXIF_TAG_GPS_LATITUDE) == MS_MEDIA_ERR_NONE) {
@@ -1029,10 +1006,11 @@ int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info)
 
        memset(buf, 0x00, sizeof(buf));
        if (__media_svc_get_exif_info(ed, buf, NULL, NULL, EXIF_TAG_IMAGE_DESCRIPTION) == MS_MEDIA_ERR_NONE) {
-               if (strlen(buf) > 0) {
-                       SAFE_FREE(content_info->media_meta.description);
+               if (strlen(buf) > 0)
                        content_info->media_meta.description = g_strdup(buf);
-               }
+               else
+                       content_info->media_meta.description = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
+
        }
 
        memset(buf, 0x00, sizeof(buf));
@@ -1073,16 +1051,12 @@ int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info)
        }
 
        /* Get fnumber value from exif. */
-       if (__media_svc_get_exif_info(ed, NULL, NULL, &fnumber, EXIF_TAG_FNUMBER) == MS_MEDIA_ERR_NONE) {
-               if (fnumber > 0.0)
-                       content_info->media_meta.fnumber = fnumber;
-       }
+       if (__media_svc_get_exif_info(ed, NULL, NULL, &fnumber, EXIF_TAG_FNUMBER) == MS_MEDIA_ERR_NONE)
+               content_info->media_meta.fnumber = fnumber;
 
        /* Get iso value from exif. */
-       if (__media_svc_get_exif_info(ed, NULL, &iso, NULL, EXIF_TAG_ISO_SPEED_RATINGS) == MS_MEDIA_ERR_NONE) {
-               if (iso > 0)
-                       content_info->media_meta.iso = iso;
-       }
+       if (__media_svc_get_exif_info(ed, NULL, &iso, NULL, EXIF_TAG_ISO_SPEED_RATINGS) == MS_MEDIA_ERR_NONE)
+               content_info->media_meta.iso = iso;
 
        memset(buf, 0x00, sizeof(buf));
        /* Get model value from exif. */
@@ -1131,55 +1105,40 @@ GET_WIDTH_HEIGHT:
        return MS_MEDIA_ERR_NONE;
 }
 
+static char * __media_svc_get_tag_str_value(MMHandleType tag, const char *tag_name)
+{
+       int ret = FILEINFO_ERROR_NONE;
+       char *p = NULL;
+       int size = 0;
+
+       ret = mm_file_get_attrs(tag, tag_name, &p, &size, NULL);
+       if (ret == FILEINFO_ERROR_NONE && size > 0)
+               return g_strdup(p);
+
+       return g_strdup(MEDIA_SVC_TAG_UNKNOWN);
+}
+
 int _media_svc_extract_music_metadata_for_update(media_svc_content_info_s *content_info, const char *path)
 {
        MMHandleType tag = 0;
-       char *p = NULL;
-       int size = -1;
        int mmf_error = FILEINFO_ERROR_NONE;
 
        content_info->path = g_strdup(path);
 
        mmf_error = mm_file_create_tag_attrs(&tag, content_info->path);
-       if (mmf_error != FILEINFO_ERROR_NONE)
-               return MS_MEDIA_ERR_INTERNAL;
-
-       mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_ALBUM, &p, &size, NULL);
-       if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-               content_info->media_meta.album = g_strdup(p);
-
-       mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_ARTIST, &p, &size, NULL);
-       if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-               content_info->media_meta.artist = g_strdup(p);
-
-       mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_ALBUM_ARTIST, &p, &size, NULL);
-       if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-               content_info->media_meta.album_artist = g_strdup(p);
-
-       mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_GENRE, &p, &size, NULL);
-       if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-               content_info->media_meta.genre = g_strdup(p);
-
-       mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_TITLE, &p, &size, NULL);
-       if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
-               while(p && isspace(*p))
-                       p++;
-
-               content_info->media_meta.title = g_strdup(p);
+       if (mmf_error == FILEINFO_ERROR_NONE) {
+               content_info->media_meta.title = __media_svc_get_title(tag, content_info->path);
+               content_info->media_meta.album = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_ALBUM);
+               content_info->media_meta.artist = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_ARTIST);
+               content_info->media_meta.album_artist = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_ALBUM_ARTIST);
+               content_info->media_meta.genre = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_GENRE);
+               content_info->media_meta.description = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_DESCRIPTION);
+               content_info->media_meta.composer = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_AUTHOR);
+               content_info->media_meta.copyright = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_COPYRIGHT);
+       } else {
+               content_info->media_meta.title = __media_svc_get_title(NULL, content_info->path);
        }
 
-       mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_DESCRIPTION, &p, &size, NULL);
-       if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-               content_info->media_meta.description = g_strdup(p);
-
-       mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_AUTHOR, &p, &size, NULL);
-       if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-               content_info->media_meta.composer = g_strdup(p);
-
-       mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_COPYRIGHT, &p, &size, NULL);
-       if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-               content_info->media_meta.copyright = g_strdup(p);
-
        mm_file_destroy_tag_attrs(tag);
 
        return MS_MEDIA_ERR_NONE;
@@ -1195,41 +1154,22 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc
        int mmf_error = FILEINFO_ERROR_NONE;
        int album_id = 0;
        int ret = MS_MEDIA_ERR_NONE;
+       int convert_value = 0;
        int cdis_value = 0;
 
        /*Get Content Tag attribute ===========*/
        mmf_error = mm_file_create_tag_attrs(&tag, content_info->path);
 
        if (mmf_error == FILEINFO_ERROR_NONE) {
-               mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_ALBUM, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-                       content_info->media_meta.album = g_strdup(p);
-
-               mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_ARTIST, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-                       content_info->media_meta.artist = g_strdup(p);
-
-               mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_ALBUM_ARTIST, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-                       content_info->media_meta.album_artist = g_strdup(p);
-
-               mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_GENRE, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-                       content_info->media_meta.genre = g_strdup(p);
-
-               mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_TITLE, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
-                       while(p && isspace(*p))
-                               p++;
-
-                       content_info->media_meta.title = g_strdup(p);
-               }
-
-               mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_DESCRIPTION, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-                       content_info->media_meta.description = g_strdup(p);
-
-               mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_SPHERICAL, &content_info->media_meta.is_360, NULL);
+               content_info->media_meta.title = __media_svc_get_title(tag, content_info->path);
+               content_info->media_meta.album = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_ALBUM);
+               content_info->media_meta.artist = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_ARTIST);
+               content_info->media_meta.album_artist = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_ALBUM_ARTIST);
+               content_info->media_meta.genre = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_GENRE);
+               content_info->media_meta.description = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_DESCRIPTION);
+               content_info->media_meta.composer = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_AUTHOR);
+               content_info->media_meta.copyright = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_COPYRIGHT);
+               content_info->media_meta.track_num = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_TRACK_NUM);
 
                mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_RECDATE, &p, &size, NULL);
                if ((mmf_error == FILEINFO_ERROR_NONE) && (size > 0)) {
@@ -1259,51 +1199,34 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc
                        }
                }
 
-               mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_AUTHOR, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-                       content_info->media_meta.composer = g_strdup(p);
-
-               mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_COPYRIGHT, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-                       content_info->media_meta.copyright = g_strdup(p);
-
-               mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_TRACK_NUM, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
-                       content_info->media_meta.track_num = g_strdup(p);
-
                mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_DATE, &p, &size, NULL);
                if (mmf_error == FILEINFO_ERROR_NONE && size == 4) {
-                       int year = 0;
-                       if ((p != NULL) && (__media_svc_safe_atoi(p, &year) == MS_MEDIA_ERR_NONE))
+                       if (__media_svc_safe_atoi(p, &convert_value) == MS_MEDIA_ERR_NONE)
                                content_info->media_meta.year = g_strdup(p);
-                       else
-                               media_svc_debug("Wrong Year Information [%s]", p);
                }
 
+               if (!content_info->media_meta.year)
+                               content_info->media_meta.year = g_strdup(MEDIA_SVC_TAG_UNKNOWN);
+
                mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_RATING, &p, &size, NULL);
                if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
-                       int rate = 0;
-                       if ((p != NULL) && (__media_svc_safe_atoi(p, &rate) == MS_MEDIA_ERR_NONE))
-                               content_info->media_meta.rating = rate;
+                       if (__media_svc_safe_atoi(p, &convert_value) == MS_MEDIA_ERR_NONE)
+                               content_info->media_meta.rating = convert_value;
                } else {
                        content_info->media_meta.rating = 0;
                }
 
+               mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_SPHERICAL, &content_info->media_meta.is_360, NULL);
+
                /*Do not extract artwork for the USB Storage content*/
                if (content_info->storage_type != MS_USER_STORAGE_EXTERNAL_USB) {
                        mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_ARTWORK, &image, &size, NULL);
-                       if (mmf_error != FILEINFO_ERROR_NONE) {
+                       if (mmf_error != FILEINFO_ERROR_NONE)
                                media_svc_error("fail to get tag artwork - err(%x)", mmf_error);
-                       } else {
-                               /*media_svc_debug("artwork size1 [%d]", size); */
-                       }
 
                        mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_ARTWORK_SIZE, &size, NULL);
-                       if (mmf_error != FILEINFO_ERROR_NONE) {
+                       if (mmf_error != FILEINFO_ERROR_NONE)
                                media_svc_error("fail to get artwork size - err(%x)", mmf_error);
-                       } else {
-                               /*media_svc_debug("artwork size2 [%d]", size); */
-                       }
 
                        if (image != NULL && size > 0) {
                                char thumb_path[MEDIA_SVC_PATHNAME_SIZE] = "\0";
@@ -1359,6 +1282,10 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc
                        content_info->album_id = album_id;
                }
 
+               content_info->media_meta.longitude = MEDIA_SVC_DEFAULT_GPS_VALUE;
+               content_info->media_meta.latitude = MEDIA_SVC_DEFAULT_GPS_VALUE;
+               content_info->media_meta.altitude = MEDIA_SVC_DEFAULT_GPS_VALUE;
+
                if (content_info->media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO) {
                        double longitude = 0.0;
                        double latitude = 0.0;
@@ -1392,6 +1319,7 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc
                if (mmf_error != FILEINFO_ERROR_NONE)
                        media_svc_error("fail to free tag attr - err(%x)", mmf_error);
        }       else {
+               content_info->media_meta.title = __media_svc_get_title(NULL, content_info->path);
                content_info->album_id = album_id;
        }
 
index 7356232..8ddf47d 100755 (executable)
@@ -244,7 +244,8 @@ int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, ms_user_
                ret = _media_svc_extract_media_metadata(handle, true, &content_info, uid);
                break;
        default:
-               media_svc_debug("Do nothing[%d]", content_info.media_type);
+               /* The 'TITLE' should always be filled in */
+               content_info.media_meta.title = _media_svc_get_title_by_path(content_info.path);
                break;
        }
 
@@ -309,7 +310,8 @@ int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, m
                ret = _media_svc_extract_media_metadata(handle, false, &content_info, uid);
                break;
        default:
-               media_svc_debug("Do nothing[%d]", content_info.media_type);
+               /* The 'TITLE' should always be filled in */
+               content_info.media_meta.title = _media_svc_get_title_by_path(content_info.path);
                break;
        }
 
@@ -528,7 +530,8 @@ int media_svc_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_
                ret = _media_svc_extract_media_metadata(handle, is_direct, &content_info, uid);
                break;
        default:
-               media_svc_debug("Do nothing[%d]", content_info.media_type);
+               /* The 'TITLE' should always be filled in */
+               content_info.media_meta.title = _media_svc_get_title_by_path(content_info.path);
                break;
        }
 
index e4d6586..28e0580 100755 (executable)
@@ -120,15 +120,14 @@ typedef enum {
        MEDIA_SVC_MEDIA_TYPE_OTHER      = 4,    /**< Not media Content*/
 } media_svc_media_type_e;
 
-char *_media_info_generate_uuid(void);
+char * _media_info_generate_uuid(void);
 void _media_svc_remove_file(const char *path);
 int _media_svc_get_thumbnail_path(media_svc_media_type_e media_type, char *thumb_path, const char *pathname, const char *img_format, uid_t uid);
 int _media_svc_get_file_time(const char *full_path);
-int _media_svc_set_default_value(media_svc_content_info_s *content_info, bool refresh);
+char * _media_svc_get_title_by_path(const char *path);
 int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, bool refresh);
 int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info);
 int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc_content_info_s *content_info, uid_t uid);
-time_t __media_svc_get_timeline_from_str(const char *timstr);
 void _media_svc_destroy_content_info(media_svc_content_info_s *content_info);
 int _media_svc_create_thumbnail(const char *path, char *thumb_path, media_svc_media_type_e media_type, uid_t uid);
 int _media_svc_get_pinyin_str(const char *src_str, char **pinyin_str);