Remove parameter with fixed value 59/280759/3 accepted/tizen/unified/20220915.173230 accepted/tizen/unified/20220916.022117 accepted/tizen/unified/20220916.022154 accepted/tizen/unified/20220919.012617
authorminje.ahn <minje.ahn@samsung.com>
Mon, 5 Sep 2022 00:53:44 +0000 (09:53 +0900)
committerminje.ahn <minje.ahn@samsung.com>
Mon, 5 Sep 2022 02:20:26 +0000 (11:20 +0900)
Change-Id: I4003386f70581c0796929e0442701fb00244f50d
Signed-off-by: minje.ahn <minje.ahn@samsung.com>
src/media-thumbnail.c

index bcff8a2..5d21169 100755 (executable)
@@ -173,10 +173,7 @@ static int __get_video_thumb_to_file(unsigned int width, unsigned int height, vo
        thumb_retvm_if(!thumb_path, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid thumb_path");
 
        __media_thumb_get_proper_thumb_size(width, height, &thumb_w, &thumb_h);
-       if (thumb_w == 0 || thumb_h == 0) {
-               thumb_err("Failed to get thumb size");
-               return MS_MEDIA_ERR_INTERNAL;
-       }
+       thumb_retv_if(thumb_w == 0 || thumb_h == 0, MS_MEDIA_ERR_INTERNAL);
 
        err = mm_image_create_image(width, height, MM_UTIL_COLOR_RGB24, (unsigned char *)frame, frame_size, &img);
        thumb_retvm_if(err != MM_UTIL_ERROR_NONE, err, "fail to mm_image_create_image [%d]", err);
@@ -202,54 +199,30 @@ static int __get_video_thumb_to_file(unsigned int width, unsigned int height, vo
 ERROR:
        mm_image_destroy_image(img);
        mm_image_destroy_image(resize_img);
-       if (err == MS_MEDIA_ERR_NONE)
-               return err;
 
-       return MS_MEDIA_ERR_INTERNAL;
+       return (err == MM_UTIL_ERROR_NONE) ? MS_MEDIA_ERR_NONE : MS_MEDIA_ERR_INTERNAL;
 }
 
-static int __get_video_thumb_to_buffer(unsigned int width, unsigned int height, void *frame, size_t frame_size, mm_util_rotate_type_e rot_type, unsigned int thumb_width, unsigned int thumb_height, mm_util_image_h *dst_img)
+static int __get_video_thumb_to_buffer(unsigned int width, unsigned int height, void *frame, size_t frame_size, unsigned int thumb_width, unsigned int thumb_height, mm_util_image_h *dst_img)
 {
        int err = MS_MEDIA_ERR_NONE;
        mm_util_image_h img = NULL;
-       mm_util_image_h resize_img = NULL;
        unsigned int thumb_w = thumb_width;
        unsigned int thumb_h = thumb_height;
 
        __media_thumb_get_proper_thumb_size(width, height, &thumb_w, &thumb_h);
-       if (thumb_w == 0 || thumb_h == 0) {
-               thumb_err("Failed to get thumb size");
-               return MS_MEDIA_ERR_INTERNAL;
-       }
+       thumb_retv_if(thumb_w == 0 || thumb_h == 0, MS_MEDIA_ERR_INTERNAL);
 
        err = mm_image_create_image(width, height, MM_UTIL_COLOR_RGB24, (unsigned char *)frame, frame_size, &img);
        thumb_retvm_if(err != MM_UTIL_ERROR_NONE, err, "fail to mm_image_create_image [%d]", err);
 
-       if (width > thumb_w || height > thumb_h) {
-               if (rot_type != MM_UTIL_ROTATE_0) {
-                       err = mm_util_resize_B_B(img, thumb_w, thumb_h, &resize_img);
-                       if (err != MM_UTIL_ERROR_NONE)
-                               goto ERROR;
-
-                       err = mm_util_rotate_B_B(resize_img, rot_type, dst_img);
-
-               } else {
-                       err = mm_util_resize_B_B(img, thumb_w, thumb_h, dst_img);
-               }
-       } else {
-               if (rot_type != MM_UTIL_ROTATE_0)
-                       err = mm_util_rotate_B_B(img, rot_type, dst_img);
-               else
-                       err = mm_image_clone_image(img, dst_img);
-       }
-
-ERROR:
+       if (width > thumb_w || height > thumb_h)
+               err = mm_util_resize_B_B(img, thumb_w, thumb_h, dst_img);
+       else
+               err = mm_image_clone_image(img, dst_img);
        mm_image_destroy_image(img);
-       mm_image_destroy_image(resize_img);
-       if (err != MS_MEDIA_ERR_NONE)
-               return MS_MEDIA_ERR_INTERNAL;
 
-       return MS_MEDIA_ERR_NONE;
+       return (err == MM_UTIL_ERROR_NONE) ? MS_MEDIA_ERR_NONE : MS_MEDIA_ERR_INTERNAL;
 }
 
 static int __check_path_validity(const char *path)
@@ -374,7 +347,7 @@ int create_video_thumbnail_to_buffer(const char *path,
        thumb_retvm_if(video_track_num == 0, MM_UTIL_ERROR_NONE, "No video track");
 
        //Extract thumbnail
-       err = __get_video_thumb_to_buffer(video_w, video_h, frame, frame_size, MM_UTIL_ROTATE_0, width, height, &img);
+       err = __get_video_thumb_to_buffer(video_w, video_h, frame, frame_size, width, height, &img);
        g_free(frame);
        if (err != MS_MEDIA_ERR_NONE)
                return err;