summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2020-04-23 15:58:47 +0900
committerMinje Ahn <minje.ahn@samsung.com>2020-04-23 15:58:47 +0900
commitae0afbc687587aa7784a4a9342b06b0e785eb207 (patch)
tree99f11a310b9358520de3b2ca47526fc55da76a8b
parent460489dd5800adc5d45e801bb7da4b812a63ea2a (diff)
downloadlibmedia-thumbnail-submit/tizen_5.5/20200423.075012.tar.gz
libmedia-thumbnail-submit/tizen_5.5/20200423.075012.tar.bz2
libmedia-thumbnail-submit/tizen_5.5/20200423.075012.zip
Change-Id: I3aca617be6e44e56078d7460eb925db6429e2596 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
-rwxr-xr-xsrc/media-thumb-internal.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c
index ddba747..bed7cd6 100755
--- a/src/media-thumb-internal.c
+++ b/src/media-thumb-internal.c
@@ -316,6 +316,7 @@ int _media_thumb_video(const char *origin_path, const char *thumb_path, unsigned
unsigned int width = 0;
unsigned int height = 0;
mm_util_image_h dst_img = NULL;
+ mm_util_image_h convert_img = NULL;
unsigned char *buf = NULL;
size_t size = 0;
mm_util_color_format_e format = MM_UTIL_COLOR_NUM;
@@ -328,25 +329,29 @@ int _media_thumb_video(const char *origin_path, const char *thumb_path, unsigned
if (STRING_VALID(thumb_path)) {
err = __get_video_thumb(width, height, frame, size, rot_type, thumb_path, thumb_width, thumb_height, NULL);
-
+ SAFE_FREE(frame);
} else if (thumb_info) {
err = __get_video_thumb(width, height, frame, size, rot_type, NULL, thumb_width, thumb_height, &dst_img);
- if (err == MS_MEDIA_ERR_NONE) {
- err = mm_image_get_image(dst_img, &width, &height, &format, &buf, &size);
- thumb_info->data = buf;
- thumb_info->size = size;
- thumb_info->width = width;
- thumb_info->height = height;
- }
+ SAFE_FREE(frame);
+ thumb_retvm_if(err != MS_MEDIA_ERR_NONE, err, "__get_video_thumb failed");
+ /* Convert rgb to bgra */
+ err = mm_util_convert_B_B(dst_img, MM_UTIL_COLOR_BGRA, &convert_img);
mm_image_destroy_image(dst_img);
+ thumb_retvm_if(err != MS_MEDIA_ERR_NONE, err, "mm_util_convert_B_B failed");
+
+ err = mm_image_get_image(convert_img, &width, &height, &format, &buf, &size);
+ thumb_info->data = buf;
+ thumb_info->size = size;
+ thumb_info->width = width;
+ thumb_info->height = height;
+
+ mm_image_destroy_image(convert_img);
} else {
thumb_err("Invalid parameter");
err = MS_MEDIA_ERR_INVALID_PARAMETER;
}
- SAFE_FREE(frame);
-
return err;
}