From 345c781655d0213dcf09d5fc597c1a24bdc7f6bc Mon Sep 17 00:00:00 2001 From: "jiyong.min" Date: Thu, 14 Mar 2019 08:43:41 +0900 Subject: [PATCH] Change to resize image with mm_util_image_h - Changed function : mm_util_resize_image() - This function resize mm_util_image_h image with width & height, it will return allocated resized mm_util_image_h image. before changing, it has too few parameter to check problem like buffer overflow. So, change parameter to mm_util_image_h with mandotory information. [Version] 0.10.180 [Profile] Common [Issue Type] Update image-utility [Dependency module] N/A [Test] Svace=(OK, http://10.113.170.22:8810/build/2920) Change-Id: I461f96a1051d9918b81e5ec76ed434df5739b0bb --- packaging/libmm-camcorder.spec | 2 +- src/mm_camcorder_util.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/packaging/libmm-camcorder.spec b/packaging/libmm-camcorder.spec index ea3e369..e1bce11 100644 --- a/packaging/libmm-camcorder.spec +++ b/packaging/libmm-camcorder.spec @@ -1,6 +1,6 @@ Name: libmm-camcorder Summary: Camera and recorder library -Version: 0.10.179 +Version: 0.10.180 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/mm_camcorder_util.c b/src/mm_camcorder_util.c index bc34463..5fb7c21 100644 --- a/src/mm_camcorder_util.c +++ b/src/mm_camcorder_util.c @@ -35,6 +35,7 @@ #include "mm_camcorder_internal.h" #include "mm_camcorder_util.h" #include "mm_camcorder_sound.h" +#include #include #include @@ -1733,6 +1734,8 @@ gboolean _mmcamcorder_resize_frame(unsigned char *src_data, unsigned int src_wid int ret = TRUE; int mm_ret = MM_ERROR_NONE; int input_format = MM_UTIL_COLOR_YUV420; + mm_util_image_h src_image = NULL; + mm_util_image_h dst_image = NULL; if (!src_data || !dst_data || !dst_width || !dst_height || !dst_length) { _mmcam_dbg_err("something is NULL %p,%p,%p,%p,%p", @@ -1767,14 +1770,26 @@ gboolean _mmcamcorder_resize_frame(unsigned char *src_data, unsigned int src_wid _mmcam_dbg_log("src size %dx%d -> dst size %dx%d", src_width, src_height, *dst_width, *dst_height); - mm_ret = mm_util_resize_image(src_data, src_width, src_height, input_format, - *dst_width, *dst_height, dst_data, dst_width, dst_height, dst_length); + mm_ret = mm_image_create_image(src_width, src_height, input_format, src_data, (size_t)src_length, &src_image); + if (mm_ret != MM_ERROR_NONE) { + GST_ERROR("mm_image_create_image failed 0x%x", ret); + return FALSE; + } + mm_ret = mm_util_resize_image(src_image, *dst_width, *dst_height, &dst_image); + mm_image_destroy_image(src_image); if (mm_ret != MM_ERROR_NONE) { GST_ERROR("mm_util_resize_image failed 0x%x", ret); return FALSE; } + mm_ret = mm_image_get_image(dst_image, dst_width, dst_height, NULL, dst_data, dst_length); + mm_image_destroy_image(dst_image); + if (mm_ret != MM_ERROR_NONE) { + GST_ERROR("mm_image_get_image failed 0x%x", ret); + return FALSE; + } + _mmcam_dbg_log("resize done %dx%d -> %dx%d, %p, length %zu", src_width, src_height, *dst_width, *dst_height, *dst_data, *dst_length); -- 2.7.4