[0.6.94] apply the modified mm util interface 51/170751/3 accepted/tizen/unified/20180226.142332 submit/tizen/20180223.061228
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 22 Feb 2018 03:03:58 +0000 (12:03 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Fri, 23 Feb 2018 05:57:12 +0000 (14:57 +0900)
Change-Id: I0fd23d47d23f804511e9da718b6f330d4c4a50be

packaging/libmm-player.spec
src/mm_player_capture.c

index 0a9f86d65b0ff8b383d451b1dd8713802233be26..eb42865ef819cfb5c684e3d31a89bee53896f5bb 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.93
+Version:    0.6.94
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 432213014abcef6515f7204358e58fabb8f6f402..154de2a5b3a03a4434ae610123ed4eb36309711d 100755 (executable)
@@ -196,7 +196,7 @@ __mmplayer_handle_orientation(mm_player_t* player, int orientation, int format)
        unsigned char *dst_frame = NULL;
        unsigned int dst_width = 0;
        unsigned int dst_height = 0;
-       unsigned int dst_size = 0;
+       size_t dst_size = 0;
        mm_util_img_rotate_type rot_enum = MM_UTIL_ROTATE_NUM;
 
        player->capture.orientation = orientation;
@@ -216,21 +216,8 @@ __mmplayer_handle_orientation(mm_player_t* player, int orientation, int format)
        } else
                LOGE("wrong orientation value...");
 
-    /* height & width will be interchanged for 90 and 270 orientation */
-       ret = mm_util_get_image_size(format, dst_width, dst_height, &dst_size);
-       if (ret != MM_ERROR_NONE) {
-               LOGE("failed to get destination frame size");
-               return ret;
-       }
-
+       /* height & width will be interchanged for 90 and 270 orientation */
        LOGD("before rotation : dst_width = %d and dst_height = %d", dst_width, dst_height);
-
-       dst_frame = (unsigned char*) malloc(dst_size);
-       if (!dst_frame) {
-               LOGE("failed to allocate memory");
-               return MM_ERROR_PLAYER_NO_FREE_SPACE;
-       }
-
        src_buffer = (unsigned char*)player->capture.data;
 
        /* convert orientation degree into enum here */
@@ -252,20 +239,20 @@ __mmplayer_handle_orientation(mm_player_t* player, int orientation, int format)
        LOGD("source buffer for rotation = %p and rotation = %d", src_buffer, rot_enum);
 
        ret = mm_util_rotate_image(src_buffer,
-                       player->captured.width[0], player->captured.height[0], format,
-                       dst_frame, &dst_width, &dst_height, rot_enum);
-       if (ret != MM_ERROR_NONE) {
+                       player->captured.width[0], player->captured.height[0], format, rot_enum,
+                       &dst_frame, &dst_width, &dst_height, &dst_size);
+       if (ret != MM_ERROR_NONE || !dst_frame) {
                LOGE("failed to do rotate image");
                free(dst_frame);
                return ret;
        }
 
-       LOGD("after rotation same stride: dst_width = %d and dst_height = %d", dst_width, dst_height);
+       LOGD("after rotation same stride: dst_width = %d and dst_height = %d, dst_size = %zu", dst_width, dst_height, dst_size);
 
        g_free(src_buffer);
 
        player->capture.data = dst_frame;
-       player->capture.size = dst_size;
+       player->capture.size = (int)dst_size;
        player->capture.orientation = orientation;
        player->capture.width = dst_width;
        player->capture.height = dst_height;
@@ -770,36 +757,23 @@ static int
 __mm_player_convert_colorspace(mm_player_t* player, unsigned char* src_data, mm_util_color_format_e src_fmt, unsigned int src_w, unsigned int src_h, mm_util_color_format_e dst_fmt)
 {
        unsigned char *dst_data = NULL;
-       unsigned int dst_size;
+       unsigned int dst_width = 0;
+       unsigned int dst_height = 0;
+       size_t dst_size = 0;
        int ret = MM_ERROR_NONE;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_INTERNAL);
-       ret = mm_util_get_image_size(dst_fmt, src_w, src_h, &dst_size);
+       SECURE_LOGD("src size info. width: %d, height: %d \n", src_w, src_h);
 
-       if (ret != MM_ERROR_NONE) {
-               LOGE("failed to get image size for capture, %d\n", ret);
-               return MM_ERROR_PLAYER_INTERNAL;
-       }
-
-       SECURE_LOGD("width: %d, height: %d to capture, dest size: %d\n", src_w, src_h, dst_size);
-
-       dst_data = (unsigned char*)g_malloc0(dst_size);
-
-       if (!dst_data) {
-               LOGE("no free space to capture\n");
-               g_free(dst_data);
-               return MM_ERROR_PLAYER_NO_FREE_SPACE;
-       }
-
-       ret = mm_util_convert_colorspace(src_data, src_w, src_h, src_fmt, dst_data, dst_fmt);
-
-       if (ret != MM_ERROR_NONE) {
+       ret = mm_util_convert_colorspace(src_data, src_w, src_h, src_fmt, dst_fmt, &dst_data, &dst_width, &dst_height, &dst_size);
+       if (ret != MM_ERROR_NONE || !dst_data) {
                LOGE("failed to convert for capture, %d\n", ret);
                g_free(dst_data);
                return MM_ERROR_PLAYER_INTERNAL;
        }
+       SECURE_LOGD("dst size info. width: %d, height: %d, size: %zu\n", dst_width, dst_height, dst_size);
 
-       player->capture.size = dst_size;
+       player->capture.size = (int)dst_size;
        player->capture.data = dst_data;
 
        return MM_ERROR_NONE;