Remove gps getting function 92/223492/4
authorMinje Ahn <minje.ahn@samsung.com>
Thu, 30 Jan 2020 08:23:35 +0000 (17:23 +0900)
committerMinje ahn <minje.ahn@samsung.com>
Fri, 31 Jan 2020 02:42:08 +0000 (02:42 +0000)
Call mm_file_get_attrs directly

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

index a485686..86c9473 100644 (file)
@@ -482,32 +482,6 @@ static bool __media_svc_get_file_ext(const char *file_path, char *file_ext)
        return false;
 }
 
-static int __media_svc_get_location_value(MMHandleType tag, double *longitude, double *latitude, double *altitude)
-{
-       int mmf_error = 0;
-       double gps_value = 0.0;
-
-       mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_LONGITUDE, &gps_value, NULL);
-       if (mmf_error == FILEINFO_ERROR_NONE) {
-               if (longitude != NULL)
-                       *longitude = (gps_value == 0.0) ? MEDIA_SVC_DEFAULT_GPS_VALUE : gps_value;
-       }
-
-       mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_LATIDUE, &gps_value, NULL);
-       if (mmf_error == FILEINFO_ERROR_NONE) {
-               if (latitude != NULL)
-                       *latitude = (gps_value == 0.0) ? MEDIA_SVC_DEFAULT_GPS_VALUE : gps_value;
-       }
-
-       mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_ALTIDUE, &gps_value, NULL);
-       if (mmf_error == FILEINFO_ERROR_NONE) {
-               if (altitude != NULL)
-                       *altitude = (gps_value == 0.0) ? MEDIA_SVC_DEFAULT_GPS_VALUE : gps_value;
-       }
-
-       return MS_MEDIA_ERR_NONE;
-}
-
 static int __media_svc_resize_artwork(const char *path, const char *img_format)
 {
        int ret = MS_MEDIA_ERR_NONE;
@@ -1250,23 +1224,10 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc
 
                mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_TITLE, &p, &size, NULL);
                if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
-                       if (!isspace(*p)) {
-                               content_info->media_meta.title = g_strdup(p);
-                       } else {
-                               int idx = 0;
+                       while(p && isspace(*p))
+                               p++;
 
-                               for (idx = 0; idx < size; idx++) {
-                                       if (isspace(*p)) {
-                                               media_svc_debug("SPACE [%s]", p);
-                                               p++;
-                                               continue;
-                                       } else {
-                                               media_svc_debug("Not SPACE [%s]", p);
-                                               content_info->media_meta.title = g_strdup(p);
-                                               break;
-                                       }
-                               }
-                       }
+                       content_info->media_meta.title = g_strdup(p);
                }
 
                mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_DESCRIPTION, &p, &size, NULL);
@@ -1423,10 +1384,14 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc
                        double latitude = 0.0;
                        double altitude = 0.0;
 
-                       __media_svc_get_location_value(tag, &longitude, &latitude, &altitude);
-                       content_info->media_meta.longitude = longitude;
-                       content_info->media_meta.latitude = latitude;
-                       content_info->media_meta.altitude = altitude;
+                       mm_file_get_attrs(tag, MM_FILE_TAG_LONGITUDE, &longitude,
+                               MM_FILE_TAG_LATIDUE, &latitude,
+                               MM_FILE_TAG_ALTIDUE, &altitude,
+                               NULL);
+
+                       content_info->media_meta.longitude = (longitude == 0.0) ? MEDIA_SVC_DEFAULT_GPS_VALUE : longitude;
+                       content_info->media_meta.latitude = (latitude == 0.0) ? MEDIA_SVC_DEFAULT_GPS_VALUE : latitude;
+                       content_info->media_meta.altitude = (altitude == 0.0) ? MEDIA_SVC_DEFAULT_GPS_VALUE : altitude;
 
                        mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_CDIS, &cdis_value, NULL);
                        if (mmf_error != FILEINFO_ERROR_NONE)