Fix error type 08/62008/1 accepted/tizen/common/20160317.160427 accepted/tizen/ivi/20160318.112707 accepted/tizen/mobile/20160318.111953 accepted/tizen/tv/20160318.112313 accepted/tizen/wearable/20160318.112318 submit/tizen/20160317.012622
authorMinje Ahn <minje.ahn@samsung.com>
Sun, 13 Mar 2016 23:31:29 +0000 (08:31 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Sun, 13 Mar 2016 23:31:29 +0000 (08:31 +0900)
Change-Id: If5f5de21d9906f240b6003463d94e66fc8b70c03
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
src/thumbnail_util.c

index 87f466f..5ccc6be 100755 (executable)
 */
 
 #include <media-thumbnail.h>
+#include <media-util.h>
 #include <thumbnail_util.h>
 #include <thumbnail_util_private.h>
 
 #define MAX_SIZE 16
 
+int __thumbnail_util_error_capi(int content_error)
+{
+       /*Error None*/
+       if(content_error == MS_MEDIA_ERR_NONE)
+               return THUMBNAIL_UTIL_ERROR_NONE;
+
+       /* Internal operation error*/
+       else if((content_error == MS_MEDIA_ERR_INVALID_PARAMETER) ||
+               (content_error == MS_MEDIA_ERR_INVALID_PATH) ||
+               (content_error == MS_MEDIA_ERR_THUMB_DUPLICATED_REQUEST))
+               return THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER;
+
+       else if(content_error == MS_MEDIA_ERR_OUT_OF_MEMORY)
+               return THUMBNAIL_UTIL_ERROR_OUT_OF_MEMORY;
+
+       /* IPC operation error*/
+       else if((content_error <= MS_MEDIA_ERR_SOCKET_CONN) && (content_error >= MS_MEDIA_ERR_SOCKET_INTERNAL))
+               return THUMBNAIL_UTIL_ERROR_INVALID_OPERATION;
+
+       /* MEDIA SERVER error*/
+       else if(content_error == MS_MEDIA_ERR_PERMISSION_DENIED)
+               return THUMBNAIL_UTIL_ERROR_PERMISSION_DENIED;
+
+       /*ETC*/
+       return THUMBNAIL_UTIL_ERROR_INVALID_OPERATION;
+}
+
 void __thumbnail_util_convert_itoa(int request_id, char **req_str)
 {
        char *buf = NULL;
@@ -103,7 +131,7 @@ int thumbnail_util_extract(thumbnail_h thumb, thumbnail_extracted_cb callback, v
                ret = THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER;
        }
 
-       return ret;
+       return __thumbnail_util_error_capi(ret);
 }
 
 int thumbnail_util_set_path(thumbnail_h thumb, const char *path)