summaryrefslogtreecommitdiff
path: root/src/media-thumb-internal.c
diff options
context:
space:
mode:
authorhj kim <backto.kim@samsung.com>2015-06-05 04:09:04 (GMT)
committerhj kim <backto.kim@samsung.com>2015-06-05 04:09:04 (GMT)
commit999b9402a56d7c9738d6d632eff2f90004bbfbaf (patch)
tree31416fd3ece796751014dab252673fc71b278240 /src/media-thumb-internal.c
parentc896230ef091a244204b17bc9ab0ffa974ce2031 (diff)
downloadlibmedia-thumbnail-999b9402a56d7c9738d6d632eff2f90004bbfbaf.zip
libmedia-thumbnail-999b9402a56d7c9738d6d632eff2f90004bbfbaf.tar.gz
libmedia-thumbnail-999b9402a56d7c9738d6d632eff2f90004bbfbaf.tar.bz2
This reverts commit c896230ef091a244204b17bc9ab0ffa974ce2031. Change-Id: I94ec0a56f7c3d84ad76645b91310494b96d41932
Diffstat (limited to 'src/media-thumb-internal.c')
-rwxr-xr-xsrc/media-thumb-internal.c204
1 files changed, 108 insertions, 96 deletions
diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c
index b8890f7..e6b3f12 100755
--- a/src/media-thumb-internal.c
+++ b/src/media-thumb-internal.c
@@ -111,7 +111,7 @@ int _media_thumb_get_proper_thumb_size(media_thumb_type thumb_type,
thumb_dbg("proper thumb w: %d h: %d", *thumb_w, *thumb_h);
- return MS_MEDIA_ERR_NONE;
+ return 0;
}
int _media_thumb_get_exif_info(ExifData *ed, char *buf, int max_size, int *value,
@@ -122,7 +122,7 @@ int _media_thumb_get_exif_info(ExifData *ed, char *buf, int max_size, int *value
ExifTag tag;
if (ed == NULL) {
- return MS_MEDIA_ERR_INVALID_PARAMETER;
+ return -1;
}
ifd = ifdtype;
@@ -136,7 +136,7 @@ int _media_thumb_get_exif_info(ExifData *ed, char *buf, int max_size, int *value
if (value == NULL) {
thumb_dbg("value is NULL");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
+ return -1;
}
ExifByteOrder mByteOrder = exif_data_get_byte_order(ed);
@@ -147,7 +147,7 @@ int _media_thumb_get_exif_info(ExifData *ed, char *buf, int max_size, int *value
/* Get the contents of the tag in human-readable form */
if (buf == NULL) {
thumb_dbg("buf is NULL");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
+ return -1;
}
exif_entry_get_value(entry, buf, max_size);
buf[strlen(buf)] = '\0';
@@ -159,10 +159,11 @@ int _media_thumb_get_exif_info(ExifData *ed, char *buf, int max_size, int *value
}
}
- return MS_MEDIA_ERR_NONE;
+ return 0;
}
-int _media_thumb_get_thumb_from_exif(ExifData *ed,
+int
+_media_thumb_get_thumb_from_exif(ExifData *ed,
const char *file_full_path,
int orientation,
int required_width,
@@ -199,15 +200,16 @@ int _media_thumb_get_thumb_from_exif(ExifData *ed,
thumb_dbg("There's jpeg thumb in this image");
} else {
thumb_dbg("There's NO jpeg thumb in this image");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
+ return -1;
}
} else {
thumb_dbg("entry is NULL");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
+ return -1;
}
/* Get width and height of thumbnail */
tag = EXIF_TAG_IMAGE_WIDTH;
+
entry = exif_content_get_entry(ed->ifd[ifd], tag);
if (entry) {
@@ -219,7 +221,9 @@ int _media_thumb_get_thumb_from_exif(ExifData *ed,
}
tag = EXIF_TAG_IMAGE_LENGTH;
+
entry = exif_content_get_entry(ed->ifd[ifd], tag);
+
if (entry) {
/* Get the contents of the tag in human-readable form */
ExifShort value = exif_get_short(entry->data, byte_order);
@@ -454,10 +458,11 @@ int _media_thumb_resize_data(unsigned char *src_data,
int thumb_width = dst_width;
int thumb_height = dst_height;
unsigned int buf_size = 0;
-
- if (mm_util_get_image_size(src_format, thumb_width, thumb_height, &buf_size) < 0) {
+
+ if (mm_util_get_image_size(src_format, thumb_width,
+ thumb_height, &buf_size) < 0) {
thumb_err("Failed to get buffer size");
- return MS_MEDIA_ERR_INTERNAL;
+ return MEDIA_THUMB_ERROR_MM_UTIL;
}
thumb_dbg("mm_util_get_image_size : %d", buf_size);
@@ -472,7 +477,7 @@ int _media_thumb_resize_data(unsigned char *src_data,
SAFE_FREE(dst);
- return MS_MEDIA_ERR_INTERNAL;
+ return MEDIA_THUMB_ERROR_MM_UTIL;
}
thumb_info->size = buf_size;
@@ -483,7 +488,7 @@ int _media_thumb_resize_data(unsigned char *src_data,
SAFE_FREE(dst);
- return MS_MEDIA_ERR_NONE;
+ return 0;
}
int _media_thumb_get_wh_with_gdk(const char *origin_path, int *width, int *height)
@@ -496,14 +501,14 @@ int _media_thumb_get_wh_with_gdk(const char *origin_path, int *width, int *heigh
if (error) {
thumb_err ("Error loading image file %s",origin_path);
g_error_free (error);
- return MS_MEDIA_ERR_INTERNAL;
+ return -1;
}
/* Get w/h of original image */
*width = gdk_pixbuf_get_width(pixbuf);
*height = gdk_pixbuf_get_height(pixbuf);
- return MS_MEDIA_ERR_NONE;
+ return 0;
}
int _media_thumb_decode_with_gdk(const char *origin_path,
@@ -517,7 +522,7 @@ int _media_thumb_decode_with_gdk(const char *origin_path,
if (error) {
thumb_err ("Error loading image file %s",origin_path);
g_error_free (error);
- return MS_MEDIA_ERR_INTERNAL;
+ return -1;
}
/* Get w/h of original image */
@@ -541,7 +546,7 @@ int _media_thumb_decode_with_gdk(const char *origin_path,
rotated_orig_h = height;
}
- int err = MS_MEDIA_ERR_NONE;
+ int err = -1;
media_thumb_type thumb_type;
if (thumb_width == _media_thumb_get_width(MEDIA_THUMB_LARGE)) {
@@ -553,7 +558,7 @@ int _media_thumb_decode_with_gdk(const char *origin_path,
err = _media_thumb_get_proper_thumb_size(thumb_type,
rotated_orig_w, rotated_orig_h,
&thumb_width, &thumb_height);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("_media_thumb_get_proper_thumb_size failed: %d", err);
g_object_unref(pixbuf);
return err;
@@ -569,7 +574,7 @@ int _media_thumb_decode_with_gdk(const char *origin_path,
g_object_unref(pixbuf);
- return MS_MEDIA_ERR_INTERNAL;
+ return MEDIA_THUMB_ERROR_MM_UTIL;
}
thumb_info->size = buf_size;
@@ -579,37 +584,38 @@ int _media_thumb_decode_with_gdk(const char *origin_path,
thumb_info->gdkdata = gdk_pixbuf_copy(pixbuf);
g_object_unref(pixbuf);
- return MS_MEDIA_ERR_NONE;
+ return 0;
}
mm_util_img_format _media_thumb_get_format(media_thumb_format src_format)
{
switch(src_format) {
- case MEDIA_THUMB_BGRA:
+ case MEDIA_THUMB_BGRA:
return MM_UTIL_IMG_FMT_BGRA8888;
- case MEDIA_THUMB_RGB888:
+ case MEDIA_THUMB_RGB888:
return MM_UTIL_IMG_FMT_RGB888;
default:
- return MS_MEDIA_ERR_INVALID_PARAMETER;
+ return -1;
}
}
int _media_thumb_convert_data(media_thumb_info *thumb_info,
- int thumb_width,
+ int thumb_width,
int thumb_height,
mm_util_img_format src_format,
mm_util_img_format dst_format)
{
- int err = MS_MEDIA_ERR_NONE;
+ int err = -1;
unsigned int buf_size = 0;
unsigned char *src_data = thumb_info->data;
unsigned char *dst_data = NULL;
thumb_dbg("src format:%d, dst format:%d", src_format, dst_format);
- if (mm_util_get_image_size(dst_format, thumb_width, thumb_height, &buf_size) < 0) {
+ if (mm_util_get_image_size(dst_format, thumb_width,
+ thumb_height, &buf_size) < 0) {
thumb_err("Failed to get buffer size");
- return MS_MEDIA_ERR_INTERNAL;
+ return MEDIA_THUMB_ERROR_MM_UTIL;
}
thumb_dbg("mm_util_get_image_size : %d", buf_size);
@@ -635,11 +641,11 @@ int _media_thumb_convert_data(media_thumb_info *thumb_info,
src_format,
dst_data,
dst_format);
-
+
if (err < 0) {
thumb_err("Failed to change from rgb888 to argb8888 %d", err);
SAFE_FREE(dst_data);
- return MS_MEDIA_ERR_INTERNAL;
+ return MEDIA_THUMB_ERROR_MM_UTIL;
}
}
@@ -649,18 +655,18 @@ int _media_thumb_convert_data(media_thumb_info *thumb_info,
thumb_dbg("_media_thumb_convert_data success");
- return err;
+ return 0;
}
int _media_thumb_convert_format(media_thumb_info *thumb_info,
media_thumb_format src_format,
media_thumb_format dst_format)
{
- int err = MS_MEDIA_ERR_NONE;
+ int err = -1;
if (src_format == dst_format) {
//thumb_dbg("src_format == dst_format");
- return err;
+ return 0;
}
mm_util_img_format src_mm_format;
@@ -671,21 +677,21 @@ int _media_thumb_convert_format(media_thumb_info *thumb_info,
if (src_mm_format == -1 || dst_mm_format == -1) {
thumb_err("Format is invalid");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
+ return MEDIA_THUMB_ERROR_UNSUPPORTED;
}
- err = _media_thumb_convert_data(thumb_info,
- thumb_info->width,
+ err = _media_thumb_convert_data(thumb_info,
+ thumb_info->width,
thumb_info->height,
- src_mm_format,
+ src_mm_format,
dst_mm_format);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("media_thumb_convert_format failed : %d", err);
return err;
}
- return err;
+ return 0;
}
int _media_thumb_agif(const char *origin_path,
@@ -695,7 +701,7 @@ int _media_thumb_agif(const char *origin_path,
media_thumb_format format,
media_thumb_info *thumb_info)
{
- int err = MS_MEDIA_ERR_NONE;
+ int err = -1;
unsigned int *thumb = NULL;
media_thumb_type thumb_type;
@@ -703,7 +709,7 @@ int _media_thumb_agif(const char *origin_path,
if (!thumb) {
thumb_err("Frame data is NULL!!");
- return MS_MEDIA_ERR_INTERNAL;
+ return MEDIA_THUMB_ERROR_UNSUPPORTED;
}
if (thumb_width == _media_thumb_get_width(MEDIA_THUMB_LARGE)) {
@@ -715,13 +721,13 @@ int _media_thumb_agif(const char *origin_path,
err = _media_thumb_get_proper_thumb_size(thumb_type,
thumb_info->origin_width, thumb_info->origin_height,
&thumb_width, &thumb_height);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("_media_thumb_get_proper_thumb_size failed: %d", err);
SAFE_FREE(thumb);
return err;
}
- err = _media_thumb_resize_data((unsigned char *)thumb,
+ err = _media_thumb_resize_data((unsigned char *)thumb,
image_info->width,
image_info->height,
MM_UTIL_IMG_FMT_RGB888,
@@ -729,7 +735,7 @@ int _media_thumb_agif(const char *origin_path,
thumb_width,
thumb_height);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("_media_thumb_resize_data failed: %d", err);
SAFE_FREE(thumb);
return err;
@@ -738,13 +744,13 @@ int _media_thumb_agif(const char *origin_path,
SAFE_FREE(thumb);
err = _media_thumb_convert_format(thumb_info, MEDIA_THUMB_RGB888, format);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("_media_thumb_convert_format falied: %d", err);
SAFE_FREE(thumb_info->data);
return err;
}
- return err;
+ return 0;
}
int _media_thumb_png(const char *origin_path,
@@ -753,22 +759,22 @@ int _media_thumb_png(const char *origin_path,
media_thumb_format format,
media_thumb_info *thumb_info)
{
- int err = MS_MEDIA_ERR_NONE;
+ int err = -1;
err = _media_thumb_decode_with_gdk(origin_path, thumb_width, thumb_height, thumb_info, 0, NORMAL);
-
- if (err != MS_MEDIA_ERR_NONE) {
+
+ if (err < 0) {
thumb_err("decode_with_gdk failed : %d", err);
return err;
}
err = _media_thumb_convert_format(thumb_info, MEDIA_THUMB_RGB888, format);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("_media_thumb_convert_format falied: %d", err);
SAFE_FREE(thumb_info->data);
return err;
}
- return err;
+ return 0;
}
int _media_thumb_bmp(const char *origin_path,
@@ -777,22 +783,22 @@ int _media_thumb_bmp(const char *origin_path,
media_thumb_format format,
media_thumb_info *thumb_info)
{
- int err = MS_MEDIA_ERR_NONE;
+ int err = -1;
err = _media_thumb_decode_with_gdk(origin_path, thumb_width, thumb_height, thumb_info, 0, NORMAL);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("decode_with_gdk failed : %d", err);
return err;
}
err = _media_thumb_convert_format(thumb_info, MEDIA_THUMB_RGB888, format);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("_media_thumb_convert_format falied: %d", err);
SAFE_FREE(thumb_info->data);
return err;
}
- return err;
+ return 0;
}
int _media_thumb_wbmp(const char *origin_path,
@@ -801,46 +807,46 @@ int _media_thumb_wbmp(const char *origin_path,
media_thumb_format format,
media_thumb_info *thumb_info)
{
- int err = MS_MEDIA_ERR_NONE;
+ int err = -1;
err = _media_thumb_decode_with_gdk(origin_path, thumb_width, thumb_height, thumb_info, 0, NORMAL);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("decode_with_gdk failed : %d", err);
return err;
}
err = _media_thumb_convert_format(thumb_info, MEDIA_THUMB_RGB888, format);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("_media_thumb_convert_format falied: %d", err);
SAFE_FREE(thumb_info->data);
return err;
}
- return err;
+ return 0;
}
-int _media_thumb_gif(const char *origin_path,
+int _media_thumb_gif(const char *origin_path,
int thumb_width,
int thumb_height,
media_thumb_format format,
media_thumb_info *thumb_info)
{
- int err = MS_MEDIA_ERR_NONE;
+ int err = -1;
err = _media_thumb_decode_with_gdk(origin_path, thumb_width, thumb_height, thumb_info, 0, NORMAL);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("decode_with_gdk failed : %d", err);
return err;
}
err = _media_thumb_convert_format(thumb_info, MEDIA_THUMB_RGB888, format);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("_media_thumb_convert_format falied: %d", err);
SAFE_FREE(thumb_info->data);
return err;
}
- return err;
+ return 0;
}
int _media_thumb_jpeg(const char *origin_path,
@@ -850,7 +856,7 @@ int _media_thumb_jpeg(const char *origin_path,
media_thumb_info *thumb_info,
uid_t uid)
{
- int err = MS_MEDIA_ERR_NONE;
+ int err = -1;
ExifData *ed = NULL;
int thumb_done = 0;
int orientation = NORMAL;
@@ -862,14 +868,14 @@ int _media_thumb_jpeg(const char *origin_path,
/* First, Get orientation from exif */
err = _media_thumb_get_exif_info(ed, NULL, 0, &orientation, EXIF_IFD_0, EXIF_TAG_ORIENTATION);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_warn("_media_thumb_get_exif_info failed");
}
/* Second, Get thumb from exif */
err = _media_thumb_get_thumb_from_exif(ed, origin_path, orientation, thumb_width, thumb_height, thumb_info, uid);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_dbg("_media_thumb_get_thumb_from_exif failed");
} else {
thumb_done = 1;
@@ -883,7 +889,7 @@ int _media_thumb_jpeg(const char *origin_path,
MM_UTIL_IMG_FMT_RGB888,
dst_format);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("_media_thumb_convert_data failed : %d", err);
exif_data_unref(ed);
return err;
@@ -897,20 +903,20 @@ int _media_thumb_jpeg(const char *origin_path,
err = _media_thumb_decode_with_gdk(origin_path, thumb_width, thumb_height, thumb_info, 0, orientation);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("decode_with_gdk failed : %d", err);
return err;
}
err = _media_thumb_convert_format(thumb_info, MEDIA_THUMB_RGB888, format);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("_media_thumb_convert_format falied: %d", err);
SAFE_FREE(thumb_info->data);
return err;
}
}
- return err;
+ return 0;
}
int
@@ -920,7 +926,7 @@ _media_thumb_image(const char *origin_path,
media_thumb_format format,
media_thumb_info *thumb_info, uid_t uid)
{
- int err = MS_MEDIA_ERR_NONE;
+ int err = -1;
int image_type = 0;
int origin_w = 0;
int origin_h = 0;
@@ -936,7 +942,7 @@ _media_thumb_image(const char *origin_path,
if ((image_type != IMG_CODEC_JPEG) &&
(origin_w * origin_h > THUMB_MAX_ALLOWED_MEM_FOR_THUMB)) {
thumb_warn("This original image is too big");
- return MS_MEDIA_ERR_THUMB_TOO_BIG;
+ return MEDIA_THUMB_ERROR_UNSUPPORTED;
}
if (image_type == IMG_CODEC_AGIF) {
@@ -952,7 +958,7 @@ _media_thumb_image(const char *origin_path,
} else {
char file_ext[10];
err = _media_thumb_get_file_ext(origin_path, file_ext, sizeof(file_ext));
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_warn("_media_thumb_get_file_ext failed");
} else {
if (strcasecmp(file_ext, "wbmp") == 0) {
@@ -961,14 +967,14 @@ _media_thumb_image(const char *origin_path,
int wbmp_height = 0;
err = _media_thumb_get_wh_with_gdk(origin_path, &wbmp_width, &wbmp_height);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("_media_thumb_get_wh_with_gdk in WBMP : %d", err);
return err;
}
if (wbmp_width * wbmp_height > THUMB_MAX_ALLOWED_MEM_FOR_THUMB) {
thumb_warn("This original image is too big");
- return MS_MEDIA_ERR_THUMB_TOO_BIG;
+ return MEDIA_THUMB_ERROR_UNSUPPORTED;
}
thumb_info->origin_width = wbmp_width;
@@ -981,21 +987,22 @@ _media_thumb_image(const char *origin_path,
}
thumb_warn("Unsupported image type");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
+ return MEDIA_THUMB_ERROR_UNSUPPORTED;
}
return err;
}
-int _media_thumb_video(const char *origin_path,
+int
+_media_thumb_video(const char *origin_path,
int thumb_width,
int thumb_height,
media_thumb_format format,
media_thumb_info *thumb_info,
uid_t uid)
{
- int err = MS_MEDIA_ERR_NONE;
-
+ int err = -1;
+
MMHandleType content = (MMHandleType) NULL;
void *frame = NULL;
int video_track_num = 0;
@@ -1009,7 +1016,7 @@ int _media_thumb_video(const char *origin_path,
drm_bool_type_e drm_type;
ret = (drm_is_drm_file(origin_path, &drm_type) == 1);
- if (ret != MS_MEDIA_ERR_NONE) {
+ if (ret < 0) {
thumb_err("drm_is_drm_file falied : %d", ret);
drm_type = DRM_FALSE;
}
@@ -1017,17 +1024,21 @@ int _media_thumb_video(const char *origin_path,
is_drm = drm_type;
err = mm_file_create_content_attrs(&content, origin_path);
- if (err != MM_ERROR_NONE) {
+ if (err < 0) {
thumb_err("mm_file_create_content_attrs fails : %d", err);
- return MS_MEDIA_ERR_INTERNAL;
+ return MEDIA_THUMB_ERROR_MM_UTIL;
}
- err = mm_file_get_attrs(content, &err_msg, MM_FILE_CONTENT_VIDEO_TRACK_COUNT, &video_track_num, NULL);
- if (err != MM_ERROR_NONE) {
+ err =
+ mm_file_get_attrs(content, &err_msg,
+ MM_FILE_CONTENT_VIDEO_TRACK_COUNT,
+ &video_track_num, NULL);
+
+ if (err != 0) {
thumb_err("mm_file_get_attrs fails : %s", err_msg);
SAFE_FREE(err_msg);
mm_file_destroy_content_attrs(content);
- return MS_MEDIA_ERR_INTERNAL;
+ return MEDIA_THUMB_ERROR_MM_UTIL;
}
/* MMF api handle both normal and DRM video */
@@ -1041,11 +1052,11 @@ int _media_thumb_video(const char *origin_path,
MM_FILE_CONTENT_VIDEO_THUMBNAIL, &frame, /* raw image is RGB888 format */
&size, NULL);
- if (err != MM_ERROR_NONE) {
+ if (err != 0) {
thumb_err("mm_file_get_attrs fails : %s", err_msg);
SAFE_FREE(err_msg);
mm_file_destroy_content_attrs(content);
- return MS_MEDIA_ERR_INTERNAL;
+ return MEDIA_THUMB_ERROR_MM_UTIL;
}
thumb_dbg("video width: %d", width);
@@ -1056,7 +1067,7 @@ int _media_thumb_video(const char *origin_path,
if (frame == NULL || width == 0 || height == 0) {
thumb_err("Failed to get frame data");
mm_file_destroy_content_attrs(content);
- return MS_MEDIA_ERR_INTERNAL;
+ return MEDIA_THUMB_ERROR_MM_UTIL;
}
media_thumb_type thumb_type;
@@ -1080,7 +1091,7 @@ int _media_thumb_video(const char *origin_path,
thumb_width,
thumb_height);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("_media_thumb_resize_data failed - %d", err);
SAFE_FREE(thumb_info->data);
mm_file_destroy_content_attrs(content);
@@ -1146,8 +1157,8 @@ int _media_thumb_video(const char *origin_path,
}
err = mm_util_get_image_size(MM_UTIL_IMG_FMT_RGB888, r_w, r_h, &r_size);
- if (err != MM_ERROR_NONE) {
- thumb_err("mm_util_get_image_size failed : %d", err);
+ if (err < 0) {
+ thumb_dbg("mm_util_get_image_size failed : %d", err);
SAFE_FREE(thumb_info->data);
return err;
}
@@ -1156,10 +1167,10 @@ int _media_thumb_video(const char *origin_path,
rotated = (unsigned char *)malloc(r_size);
err = mm_util_rotate_image(thumb_info->data, thumb_info->width, thumb_info->height,
MM_UTIL_IMG_FMT_RGB888,
- rotated, &r_w, &r_h,
+ rotated, &r_w, &r_h,
rot_type);
- if (err != MM_ERROR_NONE) {
+ if (err < 0) {
thumb_err("mm_util_rotate_image failed : %d", err);
SAFE_FREE(thumb_info->data);
SAFE_FREE(rotated);
@@ -1169,6 +1180,7 @@ int _media_thumb_video(const char *origin_path,
}
SAFE_FREE(thumb_info->data);
+
thumb_info->data = rotated;
thumb_info->size = r_size;
thumb_info->width = r_w;
@@ -1176,7 +1188,7 @@ int _media_thumb_video(const char *origin_path,
}
err = _media_thumb_convert_format(thumb_info, MEDIA_THUMB_RGB888, format);
- if (err != MS_MEDIA_ERR_NONE) {
+ if (err < 0) {
thumb_err("_media_thumb_convert_format falied: %d", err);
SAFE_FREE(thumb_info->data);
return err;
@@ -1190,9 +1202,9 @@ int _media_thumb_video(const char *origin_path,
frame = NULL;
mm_file_destroy_content_attrs(content);
- return MS_MEDIA_ERR_INTERNAL;
+ return MEDIA_THUMB_ERROR_UNSUPPORTED;
}
- return err;
+ return 0;
}