_media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
{
int err = -1;
- GdkPixbuf *data = NULL;
+ GdkPixbuf *gdkdata = NULL;
int thumb_size = 0;
int thumb_w = 0;
int thumb_h = 0;
_media_thumb_remove_file(thumb_path);
}
- err = _thumbnail_get_data(origin_path, thumb_type, thumb_format, &data, &thumb_size, &thumb_w, &thumb_h, &origin_w, &origin_h, &alpha, uid);
+ err = _thumbnail_get_data(origin_path, thumb_type, thumb_format, &gdkdata, &thumb_size, &thumb_w, &thumb_h, &origin_w, &origin_h, &alpha, uid);
if (err < 0) {
thumb_err("_thumbnail_get_data failed - %d\n", err);
- g_object_unref(data);
-
+ if ( gdkdata != NULL ){
+ g_object_unref(gdkdata);
+ }
strncpy(thumb_path, _media_thumb_get_default_path(uid), max_length);
_media_thumb_db_disconnect();
return err;
thumb_dbg("Thumb path is changed : %s", thumb_path);
}
- err = _media_thumb_save_to_file_with_gdk(data, thumb_w, thumb_h, alpha, thumb_path);
+ err = _media_thumb_save_to_file_with_gdk(gdkdata, thumb_w, thumb_h, alpha, thumb_path);
if (err < 0) {
thumb_err("save_to_file_with_gdk failed - %d\n", err);
- g_object_unref(data);
+ if ( gdkdata != NULL ){
+ g_object_unref(gdkdata);
+ }
if (msg_type == THUMB_REQUEST_DB_INSERT || msg_type == THUMB_REQUEST_ALL_MEDIA)
strncpy(thumb_path, _media_thumb_get_default_path(uid), max_length);
}
/* End of fsync */
- g_object_unref(data);
+ g_object_unref(gdkdata);
/* DB update if needed */
if (need_update_db == 1) {
thumb_info->alpha = gdk_pixbuf_get_has_alpha(pixbuf);
thumb_info->width = thumb_width;
thumb_info->height = thumb_height;
- thumb_info->data = gdk_pixbuf_copy(pixbuf);
+ thumb_info->gdkdata = gdk_pixbuf_copy(pixbuf);
g_object_unref(pixbuf);
return 0;
int width = 0;
int height = 0;
int ret = 0;
+ GdkPixbuf *pixbuf;
drm_bool_type_e drm_type;
ret = (drm_is_drm_file(origin_path, &drm_type) == 1);
SAFE_FREE(thumb_info->data);
return err;
}
+ pixbuf = gdk_pixbuf_new_from_data (thumb_info->data, GDK_COLORSPACE_RGB, FALSE, 8, thumb_info->width, thumb_info->height, 3*thumb_info->width, NULL, NULL);
+ thumb_info->gdkdata = gdk_pixbuf_copy(pixbuf);
+ g_object_unref(pixbuf);
+
} else {
thumb_dbg("no contents information\n");
frame = NULL;
if (size) *size = thumb_info.size;
if (width) *width = thumb_info.width;
if (height) *height = thumb_info.height;
- *data = thumb_info.data;
+ *data = thumb_info.gdkdata;
if (origin_width) *origin_width = thumb_info.origin_width;
if (origin_height) *origin_height = thumb_info.origin_height;
if (alpha) *alpha = thumb_info.alpha;