Add get_media_type for scanner v2 50/101650/2 accepted/tizen/3.0/common/20161207.194420 accepted/tizen/3.0/ivi/20161207.011844 accepted/tizen/3.0/mobile/20161207.011353 accepted/tizen/3.0/tv/20161207.011636 accepted/tizen/3.0/wearable/20161207.011737 submit/tizen_3.0/20161206.052949
authorJiyong Min <jiyong.min@samsung.com>
Fri, 2 Dec 2016 00:11:13 +0000 (09:11 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Fri, 2 Dec 2016 01:15:07 +0000 (10:15 +0900)
Change-Id: I01ea9b93132b2864ad7e20f8aa554bd26d39e8bc
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
include/media-svc.h
plugin/media-content-plugin.c
src/common/media-svc-util.c
src/common/media-svc.c
src/include/common/media-svc-util.h

index a7dbc63..1a57126 100755 (executable)
@@ -107,6 +107,8 @@ int media_svc_get_folder_id(MediaSvcHandle *handle, const char *storage_id, cons
 int media_svc_append_query(const char *query, uid_t uid);
 int media_svc_send_query(uid_t uid);
 
+int media_svc_get_media_type(const char *path, int *mediatype);
+
 #ifdef __cplusplus
 }
 #endif
index 8116c6b..3218e33 100755 (executable)
@@ -1248,7 +1248,6 @@ int get_folder_id(void * handle, const char *storage_id, const char *path, char
 
 int get_media_type(void *handle, const char *path, int *mediatype, char **err_msg)
 {
-#if 0
        int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
 
        if (handle == NULL) {
@@ -1261,7 +1260,7 @@ int get_media_type(void *handle, const char *path, int *mediatype, char **err_ms
                __set_error_message(ret, err_msg);
                return MEDIA_SVC_PLUGIN_ERROR;
        }
-#endif
+
        return MEDIA_SVC_PLUGIN_ERROR_NONE;
 }
 
index b5b57e9..7474d9a 100755 (executable)
@@ -2540,3 +2540,22 @@ void _media_svc_print_stderror(void)
 
        media_svc_error("STANDARD ERROR [%s]", strerror_r(errno, buf, BUF_LENGHT));
 }
+
+int _media_svc_get_media_type(const char *path, int *mediatype)
+{
+       int ret = MS_MEDIA_ERR_NONE;
+       char mime_type[256] = {0};
+       media_svc_media_type_e media_type =  MEDIA_SVC_MEDIA_TYPE_OTHER;
+
+       ret = __media_svc_get_mime_type(path, mime_type);
+       if (ret == MS_MEDIA_ERR_NONE) {
+               __media_svc_get_media_type(path, mime_type, &media_type);
+       } else {
+               media_svc_error("__media_svc_get_mime_type failed");
+       }
+
+       *mediatype = media_type;
+
+       return ret;
+}
+
index c10cfd9..4347437 100755 (executable)
@@ -2361,3 +2361,11 @@ int media_svc_send_query(uid_t uid)
        return ret;
 }
 
+int media_svc_get_media_type(const char *path, int *mediatype)
+{
+       media_svc_retvm_if(path == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
+
+       return _media_svc_get_media_type(path, mediatype);
+}
+
+
index 1d37260..81d17e2 100755 (executable)
@@ -72,6 +72,7 @@ bool _media_svc_check_pinyin_support(void);
 int _media_svc_extract_music_metadata_for_update(sqlite3 *handle, media_svc_content_info_s *content_info, media_svc_media_type_e media_type);
 char *_media_svc_get_title_from_path(const char *path);
 void _media_svc_print_stderror(void);
+int _media_svc_get_media_type(const char *path, int *mediatype);
 
 #ifdef __cplusplus
 }