{
int err = MS_MEDIA_ERR_NONE;
- err = _media_thumb_process(req_msg, res_msg);
- if (err != MS_MEDIA_ERR_NONE)
- thumb_warn("_media_thumb_process is failed: %d", err);
-
- return err;
-}
-
-static int __thumb_daemon_process_job_raw(thumbMsg *req_msg, thumbMsg *res_msg)
-{
- int err = MS_MEDIA_ERR_NONE;
-
- err = _media_thumb_process_raw(req_msg, res_msg);
- if (err != MS_MEDIA_ERR_NONE)
- thumb_warn("_media_thumb_process_raw is failed: %d", err);
+ if (req_msg->msg_type == THUMB_REQUEST_RAW_DATA) {
+ err = _media_thumb_process_raw(req_msg, res_msg);
+ if (err != MS_MEDIA_ERR_NONE)
+ thumb_warn("_media_thumb_process_raw is failed: %d", err);
+ } else {
+ err = _media_thumb_process(req_msg, res_msg);
+ if (err != MS_MEDIA_ERR_NONE)
+ thumb_warn("_media_thumb_process is failed: %d", err);
+ }
return err;
}
thumb_warn_slog("Received [%d] %s(%d) from PID(%d)", recv_msg.msg_type, recv_msg.org_path, strlen(recv_msg.org_path), recv_msg.pid);
- if (recv_msg.msg_type == THUMB_REQUEST_RAW_DATA) {
- __thumb_daemon_process_job_raw(&recv_msg, &res_msg);
- } else if (recv_msg.msg_type == THUMB_REQUEST_KILL_SERVER) {
- thumb_warn("received KILL msg from thumbnail agent.");
- } else {
+ if (recv_msg.msg_type != THUMB_REQUEST_KILL_SERVER)
_thumb_daemon_process_job(&recv_msg, &res_msg);
- }
if (res_msg.msg_type == 0)
res_msg.msg_type = recv_msg.msg_type;
block_size = THUMB_BLOCK_SIZE;
}
}
- if (buf_size == 0) {
- thumb_dbg_slog("Sent data(%d) from %s", res_msg.thumb_size, res_msg.org_path);
- }
+
+ thumb_dbg_slog("Sent data(%d) from %s", res_msg.thumb_size, res_msg.org_path);
+
SAFE_FREE(buf);
SAFE_FREE(res_msg.thumb_data);
}
int _thumbnail_get_data(const char *origin_path,
- media_thumb_format format,
char *thumb_path,
unsigned char **data,
int *size,
int thumb_width = -1;
int thumb_height = -1;
- if (origin_path == NULL || size == NULL
- || width == NULL || height == NULL) {
+ if (origin_path == NULL || size == NULL || width == NULL || height == NULL) {
thumb_err("Invalid parameter");
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- if (format < MEDIA_THUMB_BGRA || format > MEDIA_THUMB_RGB888) {
- thumb_err("parameter format is invalid");
+ if (!g_file_test(origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
+ thumb_err("Original path (%s) does not exist", origin_path);
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- if (!g_file_test
- (origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
- thumb_err("Original path (%s) does not exist", origin_path);
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
thumb_dbg("Origin path : %s", origin_path);
int file_type = THUMB_NONE_TYPE;
thumb_info.is_raw = FALSE;
if (file_type == THUMB_IMAGE_TYPE) {
- err = _media_thumb_image(origin_path, thumb_path, thumb_width, thumb_height, format, &thumb_info);
+ err = _media_thumb_image(origin_path, thumb_path, thumb_width, thumb_height, &thumb_info);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_image failed");
return err;
}
} else if (file_type == THUMB_VIDEO_TYPE) {
- err = _media_thumb_video(origin_path, thumb_width, thumb_height, format, &thumb_info);
+ err = _media_thumb_video(origin_path, thumb_width, thumb_height, &thumb_info);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_image failed");
return err;
}
int _thumbnail_get_raw_data(const char *origin_path,
- media_thumb_format format,
int *width,
int *height,
unsigned char **data,
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- if (format < MEDIA_THUMB_BGRA || format > MEDIA_THUMB_RGB888) {
- thumb_err("parameter format is invalid");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
if (!g_file_test(origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
thumb_err("Original path (%s) does not exist", origin_path);
return MS_MEDIA_ERR_INVALID_PARAMETER;
thumb_info.is_raw = TRUE;
if (file_type == THUMB_IMAGE_TYPE) {
- err = _media_thumb_image(origin_path, thumb_path, thumb_width, thumb_height, format, &thumb_info);
+ err = _media_thumb_image(origin_path, thumb_path, thumb_width, thumb_height, &thumb_info);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_image failed");
return err;
}
} else if (file_type == THUMB_VIDEO_TYPE) {
- err = _media_thumb_video(origin_path, thumb_width, thumb_height, format, &thumb_info);
+ err = _media_thumb_video(origin_path, thumb_width, thumb_height, &thumb_info);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_image failed");
return err;
int msg_type = req_msg->msg_type;
const char *origin_path = req_msg->org_path;
-
- media_thumb_format thumb_format = MEDIA_THUMB_BGRA;
thumb_w = req_msg->thumb_width;
thumb_h = req_msg->thumb_height;
thumb_path = res_msg->dst_path;
_media_thumb_remove_file(thumb_path);
}
- err = _thumbnail_get_data(origin_path, thumb_format, thumb_path, &data, &thumb_size, &thumb_w, &thumb_h, &origin_w, &origin_h, &alpha, &is_saved);
+ err = _thumbnail_get_data(origin_path, thumb_path, &data, &thumb_size, &thumb_w, &thumb_h, &origin_w, &origin_h, &alpha, &is_saved);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_thumbnail_get_data failed - %d", err);
SAFE_FREE(data);
}
const char *origin_path = req_msg->org_path;
-
- media_thumb_format thumb_format = MEDIA_THUMB_BGRA;
thumb_w = req_msg->thumb_width;
thumb_h = req_msg->thumb_height;
res_msg->status = MS_MEDIA_ERR_NONE;
- err = _thumbnail_get_raw_data(origin_path, thumb_format, &thumb_w, &thumb_h, &data, &thumb_size);
-
+ err = _thumbnail_get_raw_data(origin_path, &thumb_w, &thumb_h, &data, &thumb_size);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_thumbnail_get_data failed - %d", err);
res_msg->status = err;
#include <sys/stat.h>
#define MEDIA_THUMB_ROUND_UP_8(num) (((num)+7)&~7)
-/* performance enhanced to make thumbnail */
-#define THUMB_PERFORMANCE_ENHANCED 1
int _media_thumb_resize_data(unsigned char *src_data,
int src_width,
int dst_width,
int dst_height);
-#if THUMB_PERFORMANCE_ENHANCED
int _media_thumb_convert_video(const unsigned char *src_data, const int src_size,
unsigned char **dst_data,
unsigned int *buf_size,
int width,
- int height,
- mm_util_img_format src_format,
- mm_util_img_format dst_format)
+ int height)
{
int err = MS_MEDIA_ERR_NONE;
+ int i = 0, j;
- thumb_dbg("src format:%d, dst format:%d", src_format, dst_format);
-
- if (mm_util_get_image_size(dst_format, width, height, buf_size) < 0) {
+ if (mm_util_get_image_size(MM_UTIL_IMG_FMT_BGRA8888, width, height, buf_size) < 0) {
thumb_err("mm_util_get_image_size failed");
return MS_MEDIA_ERR_INTERNAL;
}
thumb_dbg("mm_util_get_image_size : %d", *buf_size);
*dst_data = (unsigned char *)malloc(*buf_size);
-
if (*dst_data == NULL) {
thumb_err("Failed to allocate memory");
return MS_MEDIA_ERR_OUT_OF_MEMORY;
}
- if (src_format == MM_UTIL_IMG_FMT_RGB888 &&
- dst_format == MM_UTIL_IMG_FMT_BGRA8888) {
-
- int i = 0, j;
- for (j = 0; ((j < src_size) && (i < *buf_size)); j += 3) {
- (*dst_data)[i++] = (src_data[j + 2]);
- (*dst_data)[i++] = (src_data[j + 1]);
- (*dst_data)[i++] = (src_data[j]);
- (*dst_data)[i++] = 0x0;
- }
-
- } else {
- err = mm_util_convert_colorspace(src_data,
- width,
- height,
- 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;
- }
+ for (j = 0; ((j < src_size) && (i < *buf_size)); j += 3) {
+ (*dst_data)[i++] = (src_data[j + 2]);
+ (*dst_data)[i++] = (src_data[j + 1]);
+ (*dst_data)[i++] = (src_data[j]);
+ (*dst_data)[i++] = 0x0;
}
thumb_dbg("_media_thumb_convert_video success");
thumb_dbg("_media_thumb_rotate_thumb success");
return MS_MEDIA_ERR_NONE;
}
-#endif
int _media_thumb_get_proper_thumb_size(int orig_w, int orig_h,
int *thumb_w, int *thumb_h)
thumb_width = decoded.width;
thumb_height = decoded.height;
-#if THUMB_PERFORMANCE_ENHANCED
int rot_type = MM_UTIL_ROTATE_0;
if (orientation == ROT_90) {
rot_type = MM_UTIL_ROTATE_90;
thumb_info->size = decoded.size;
thumb_info->width = decoded.width;
thumb_info->height = decoded.height;
-#else
- /* Start to decode to rotate */
- unsigned char *rotated = NULL;
- unsigned int r_w = decoded.height;
- unsigned int r_h = decoded.width;
- unsigned int r_size = 0;
- mm_util_img_rotate_type rot_type = MM_UTIL_ROTATE_0;
-
- int i, rotate_cnt = 0;
-
- rot_type = MM_UTIL_ROTATE_90;
- if (orientation == ROT_90) {
- rotate_cnt = 1;
- } else if (orientation == ROT_180) {
- rotate_cnt = 2;
- } else if (orientation == ROT_270) {
- rotate_cnt = 3;
- }
-
- for (i = 0; i < rotate_cnt; i++) {
- if (i == 1) {
- r_w = decoded.width;
- r_h = decoded.height;
- }
-
- err = mm_util_get_image_size(MM_UTIL_IMG_FMT_RGB888, r_w, r_h, &r_size);
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("mm_util_get_image_size failed : %d", err);
- SAFE_FREE(decoded.data);
- return err;
- }
-
- rotated = (unsigned char *)malloc(r_size);
- err = mm_util_rotate_image(decoded.data, decoded.width, decoded.height,
- MM_UTIL_IMG_FMT_RGB888,
- rotated, &r_w, &r_h,
- rot_type);
-
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("mm_util_rotate_image failed : %d", err);
- SAFE_FREE(decoded.data);
- SAFE_FREE(rotated);
- return err;
- } else {
- thumb_err("mm_util_rotate_image succeed");
- }
-
- SAFE_FREE(decoded.data);
- decoded.data = rotated;
- decoded.width = r_w;
- decoded.height = r_h;
- }
-
- //thumb_dbg("Width : %d, Height : %d", r_w, r_h);
- thumb_info->data = rotated;
- thumb_info->size = r_size;
- thumb_info->width = r_w;
- thumb_info->height = r_h;
-#endif
} else {
/*in this case, just write raw data in file */
thumb_dbg_slog("Thumb is :%s", thumb_path);
return err;
}
-mm_util_img_format _media_thumb_get_format(media_thumb_format src_format)
-{
- switch (src_format) {
- case MEDIA_THUMB_BGRA:
- return MM_UTIL_IMG_FMT_BGRA8888;
- case MEDIA_THUMB_RGB888:
- return MM_UTIL_IMG_FMT_RGB888;
- default:
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-}
-
-int _media_thumb_convert_data(media_thumb_info *thumb_info,
- int thumb_width,
- int thumb_height,
- mm_util_img_format src_format,
- mm_util_img_format dst_format)
+int _media_thumb_convert_data(media_thumb_info *thumb_info, int thumb_width, int thumb_height)
{
int err = MS_MEDIA_ERR_NONE;
unsigned int buf_size = 0;
unsigned char *src_data = thumb_info->data;
unsigned char *dst_data = NULL;
+ int i = 0, j;
- 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(MM_UTIL_IMG_FMT_BGRA8888, thumb_width, thumb_height, &buf_size) < 0) {
thumb_err("mm_util_get_image_size failed");
return MS_MEDIA_ERR_INTERNAL;
}
thumb_dbg("mm_util_get_image_size : %d", buf_size);
dst_data = (unsigned char *)malloc(buf_size);
-
if (dst_data == NULL) {
thumb_err("Failed to allocate memory");
return MS_MEDIA_ERR_OUT_OF_MEMORY;
}
- if (src_format == MM_UTIL_IMG_FMT_RGB888 &&
- dst_format == MM_UTIL_IMG_FMT_BGRA8888) {
-
- int i = 0, j;
- for (j = 0; j < thumb_width * 3 * thumb_height;
- j += 3) {
- dst_data[i++] = (src_data[j + 2]);
- dst_data[i++] = (src_data[j + 1]);
- dst_data[i++] = (src_data[j]);
- dst_data[i++] = 0x0;
- }
-
- } else {
- err = mm_util_convert_colorspace(src_data,
- thumb_width,
- thumb_height,
- 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;
- }
+ for (j = 0; j < thumb_width * 3 * thumb_height; j += 3) {
+ dst_data[i++] = (src_data[j + 2]);
+ dst_data[i++] = (src_data[j + 1]);
+ dst_data[i++] = (src_data[j]);
+ dst_data[i++] = 0x0;
}
SAFE_FREE(thumb_info->data);
return err;
}
-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;
-
- if (src_format == dst_format) {
- //thumb_dbg("src_format == dst_format");
- return err;
- }
-
- mm_util_img_format src_mm_format;
- mm_util_img_format dst_mm_format;
-
- src_mm_format = _media_thumb_get_format(src_format);
- dst_mm_format = _media_thumb_get_format(dst_format);
-
- if ((int)src_mm_format == -1 || (int)dst_mm_format == -1) {
- thumb_err("Format is invalid");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- err = _media_thumb_convert_data(thumb_info,
- thumb_info->width,
- thumb_info->height,
- src_mm_format,
- dst_mm_format);
-
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("media_thumb_convert_format failed : %d", err);
- return err;
- }
-
- return err;
-}
-
int _media_thumb_agif(const char *origin_path,
int image_width,
int image_height,
int thumb_width,
int thumb_height,
- media_thumb_format format,
media_thumb_info *thumb_info)
{
int err = MS_MEDIA_ERR_NONE;
SAFE_FREE(thumb);
- err = _media_thumb_convert_format(thumb_info, MEDIA_THUMB_RGB888, format);
+ err = _media_thumb_convert_data(thumb_info, thumb_info->width, thumb_info->height);
if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("_media_thumb_convert_format falied: %d", err);
+ thumb_err("_media_thumb_convert_data falied: %d", err);
SAFE_FREE(thumb_info->data);
return err;
}
int _media_thumb_png(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;
- err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 1, NORMAL);
+ err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 1, NORMAL);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("decode_with_evas failed : %d", err);
return err;
}
- err = _media_thumb_convert_format(thumb_info, MEDIA_THUMB_BGRA, format);
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("_media_thumb_convert_format falied: %d", err);
- SAFE_FREE(thumb_info->data);
- return err;
- }
-
return err;
}
int _media_thumb_bmp(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;
- err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 1, NORMAL);
+ err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 1, NORMAL);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("decode_with_evas failed : %d", err);
return err;
}
- err = _media_thumb_convert_format(thumb_info, MEDIA_THUMB_BGRA, format);
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("_media_thumb_convert_format falied: %d", err);
- SAFE_FREE(thumb_info->data);
- return err;
- }
-
return err;
}
int _media_thumb_wbmp(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;
- err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 1, NORMAL);
+ err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 1, NORMAL);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("decode_with_evas failed : %d", err);
return err;
}
- err = _media_thumb_convert_format(thumb_info, MEDIA_THUMB_BGRA, format);
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("_media_thumb_convert_format falied: %d", err);
- SAFE_FREE(thumb_info->data);
- return err;
- }
-
return err;
}
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;
- err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 1, NORMAL);
+ err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 1, NORMAL);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("decode_with_evas failed : %d", err);
return err;
}
- err = _media_thumb_convert_format(thumb_info, MEDIA_THUMB_BGRA, format);
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("_media_thumb_convert_format falied: %d", err);
- SAFE_FREE(thumb_info->data);
- return err;
- }
-
return err;
}
const char *thumb_path,
int thumb_width,
int thumb_height,
- media_thumb_format format,
media_thumb_info *thumb_info)
{
int err = MS_MEDIA_ERR_NONE;
if (ed) {
/* 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) {
thumb_warn("_media_thumb_get_exif_info failed");
}
/* Second, Get thumb from exif */
err = _media_thumb_get_thumb_from_exif(ed, origin_path, thumb_path, orientation, thumb_width, thumb_height, thumb_info);
-
if (err != MS_MEDIA_ERR_NONE) {
thumb_dbg("_media_thumb_get_thumb_from_exif failed");
} else {
}
if (thumb_info->is_saved == FALSE) {
- mm_util_img_format dst_format = _media_thumb_get_format(format);
-
- err = _media_thumb_convert_data(thumb_info,
- thumb_info->width,
- thumb_info->height,
- MM_UTIL_IMG_FMT_RGB888,
- dst_format);
-
+ err = _media_thumb_convert_data(thumb_info, thumb_info->width, thumb_info->height);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_convert_data failed : %d", err);
exif_data_unref(ed);
if (!thumb_done) {
err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 1, orientation);
-
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("decode_with_evas failed : %d", err);
return err;
}
-
- err = _media_thumb_convert_format(thumb_info, MEDIA_THUMB_BGRA, format);
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("_media_thumb_convert_format falied: %d", err);
- SAFE_FREE(thumb_info->data);
- return err;
- }
}
return err;
const char *thumb_path,
int thumb_width,
int thumb_height,
- media_thumb_format format,
media_thumb_info *thumb_info)
{
int err = MS_MEDIA_ERR_NONE;
}
if (image_type == IMG_CODEC_AGIF) {
- err = _media_thumb_agif(origin_path, origin_w, origin_h, thumb_width, thumb_height, format, thumb_info);
+ err = _media_thumb_agif(origin_path, origin_w, origin_h, thumb_width, thumb_height, thumb_info);
} else if (image_type == IMG_CODEC_JPEG) {
- err = _media_thumb_jpeg(origin_path, thumb_path, thumb_width, thumb_height, format, thumb_info);
+ err = _media_thumb_jpeg(origin_path, thumb_path, thumb_width, thumb_height, thumb_info);
} else if (image_type == IMG_CODEC_PNG) {
- err = _media_thumb_png(origin_path, thumb_width, thumb_height, format, thumb_info);
+ err = _media_thumb_png(origin_path, thumb_width, thumb_height, thumb_info);
} else if (image_type == IMG_CODEC_GIF) {
- err = _media_thumb_gif(origin_path, thumb_width, thumb_height, format, thumb_info);
+ err = _media_thumb_gif(origin_path, thumb_width, thumb_height, thumb_info);
} else if (image_type == IMG_CODEC_BMP) {
- err = _media_thumb_bmp(origin_path, thumb_width, thumb_height, format, thumb_info);
+ err = _media_thumb_bmp(origin_path, thumb_width, thumb_height, thumb_info);
} else {
char file_ext[10];
err = _media_thumb_get_file_ext(origin_path, file_ext, sizeof(file_ext));
thumb_info->origin_width = wbmp_width;
thumb_info->origin_height = wbmp_height;
- err = _media_thumb_wbmp(origin_path, thumb_width, thumb_height, format, thumb_info);
+ err = _media_thumb_wbmp(origin_path, thumb_width, thumb_height, thumb_info);
return err;
}
int _media_thumb_video(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;
/* MMF api handle both normal and DRM video */
if (video_track_num > 0 || is_drm) {
-
err = mm_file_get_attrs(content, &err_msg,
MM_FILE_CONTENT_VIDEO_WIDTH,
&width,
thumb_info->origin_height = height;
err = _media_thumb_get_proper_thumb_size(width, height, &thumb_width, &thumb_height);
-#if THUMB_PERFORMANCE_ENHANCED
+
unsigned int new_size = 0;
unsigned char *new_frame = NULL;
- err = _media_thumb_convert_video(frame, size, &new_frame, &new_size, width, height, MM_UTIL_IMG_FMT_RGB888, MM_UTIL_IMG_FMT_BGRA8888);
+ err = _media_thumb_convert_video(frame, size, &new_frame, &new_size, width, height);
if ((err != MS_MEDIA_ERR_NONE) || (new_frame == NULL)) {
thumb_err("_media_thumb_convert_video falied: %d", err);
mm_file_destroy_content_attrs(content);
return err;
}
}
-#else
- if (width > thumb_width || height > thumb_height) {
- err = _media_thumb_resize_data(frame,
- width,
- height,
- MM_UTIL_IMG_FMT_RGB888,
- thumb_info,
- thumb_width,
- thumb_height);
-
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("_media_thumb_resize_data failed - %d", err);
- SAFE_FREE(thumb_info->data);
- mm_file_destroy_content_attrs(content);
- return err;
- }
- } else {
- thumb_info->size = size;
- thumb_info->width = width;
- thumb_info->height = height;
- thumb_info->data = malloc(size);
- if (thumb_info->data == NULL) {
- thumb_err("memory allcation failed");
- mm_file_destroy_content_attrs(content);
- return MS_MEDIA_ERR_OUT_OF_MEMORY;
- }
- memcpy(thumb_info->data, frame, size);
- }
-
- mm_file_destroy_content_attrs(content);
- if (rot_type == MM_UTIL_ROTATE_90 || rot_type == MM_UTIL_ROTATE_180 || rot_type == MM_UTIL_ROTATE_270) {
- /* Start to decode to rotate */
- unsigned char *rotated = NULL;
- unsigned int r_w = thumb_info->height;
- unsigned int r_h = thumb_info->width;
- unsigned int r_size = 0;
-
- if (rot_type == MM_UTIL_ROTATE_180) {
- r_w = thumb_info->width;
- r_h = thumb_info->height;
- }
-
- err = mm_util_get_image_size(MM_UTIL_IMG_FMT_RGB888, r_w, r_h, &r_size);
- if (err != FILEINFO_ERROR_NONE) {
- thumb_err("mm_util_get_image_size failed : %d", err);
- SAFE_FREE(thumb_info->data);
- return err;
- }
-
- //thumb_dbg("Size of Rotated : %d", r_size);
- 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,
- rot_type);
-
- if (err != FILEINFO_ERROR_NONE) {
- thumb_err("mm_util_rotate_image failed : %d", err);
- SAFE_FREE(thumb_info->data);
- SAFE_FREE(rotated);
- return err;
- } else {
- thumb_dbg("mm_util_rotate_image succeed");
- }
-
- SAFE_FREE(thumb_info->data);
- thumb_info->data = rotated;
- thumb_info->size = r_size;
- thumb_info->width = r_w;
- thumb_info->height = r_h;
- }
- err = _media_thumb_convert_format(thumb_info, MEDIA_THUMB_RGB888, format);
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("_media_thumb_convert_format falied: %d", err);
- SAFE_FREE(thumb_info->data);
- return err;
- }
-#endif
} else {
thumb_dbg("no contents information");
frame = NULL;