diff options
author | Jean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org> | 2014-12-15 15:55:31 +0100 |
---|---|---|
committer | Jean-BenoƮt MARTIN <jean-benoit.martin@open.eurogiciel.org> | 2015-01-06 02:23:42 -0800 |
commit | 23d402a209ebef8a4203ced3bdcdfee2f89924eb (patch) | |
tree | 44b8be4a5638f775dff39cf336b4699e0f3975f6 | |
parent | 37205426f1d5468d4240af9e64b8d308ca13dfe1 (diff) | |
download | libmedia-thumbnail-submit/tizen_tv/20150120.000002.tar.gz libmedia-thumbnail-submit/tizen_tv/20150120.000002.tar.bz2 libmedia-thumbnail-submit/tizen_tv/20150120.000002.zip |
Use gdk pixbuf for saving video thumbnailtizen_3.0_ivi_releasesubmit/tizen_wearable/20150127.000000submit/tizen_wearable/20150116.060702submit/tizen_wearable/20150116.000000submit/tizen_tv/20150130.050505submit/tizen_tv/20150130.000000submit/tizen_tv/20150120.000002submit/tizen_tv/20150120.000000submit/tizen_tv/20150119.000001submit/tizen_tv/20150119.000000submit/tizen_tv/20150116.000000submit/tizen_mobile/20150213.000000submit/tizen_mobile/20150129.000000submit/tizen_mobile/20150116.000003submit/tizen_mobile/20150116.000001submit/tizen_mobile/20150116.000000submit/tizen_ivi/20150112.111111submit/tizen_common/20150108.112600accepted/tizen/wearable/20150128.040604accepted/tizen/ivi/20150112.234217accepted/tizen/common/20150109.094257tizen_3.0_ivitizen_3.0.2015.q1_commontizen_3.0.2014.q4_common
change video frame into gdkpixbuff object
Bug-Tizen: TC-2270
Change-Id: I8204d0aed2763150ed4ea6bb136745c093b1af7a
Signed-off-by: Jean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
-rwxr-xr-x | src/include/media-thumb-internal.h | 3 | ||||
-rwxr-xr-x | src/ipc/media-thumb-ipc.c | 17 | ||||
-rwxr-xr-x | src/media-thumb-internal.c | 7 | ||||
-rwxr-xr-x | src/util/media-thumb-util.c | 2 |
4 files changed, 19 insertions, 10 deletions
diff --git a/src/include/media-thumb-internal.h b/src/include/media-thumb-internal.h index e9990b2..84556fc 100755 --- a/src/include/media-thumb-internal.h +++ b/src/include/media-thumb-internal.h @@ -45,7 +45,8 @@ typedef struct { int origin_width; int origin_height; gboolean alpha; - GdkPixbuf *data; + unsigned char *data; + GdkPixbuf *gdkdata; } media_thumb_info; enum Exif_Orientation { diff --git a/src/ipc/media-thumb-ipc.c b/src/ipc/media-thumb-ipc.c index 080a817..6968101 100755 --- a/src/ipc/media-thumb-ipc.c +++ b/src/ipc/media-thumb-ipc.c @@ -523,7 +523,7 @@ int _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; @@ -597,11 +597,12 @@ _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid) _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; @@ -631,10 +632,12 @@ _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid) 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); @@ -660,7 +663,7 @@ _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid) } /* End of fsync */ - g_object_unref(data); + g_object_unref(gdkdata); /* DB update if needed */ if (need_update_db == 1) { diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c index 9fc6086..b8ddb9c 100755 --- a/src/media-thumb-internal.c +++ b/src/media-thumb-internal.c @@ -581,7 +581,7 @@ int _media_thumb_decode_with_gdk(const char *origin_path, 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; @@ -1012,6 +1012,7 @@ _media_thumb_video(const char *origin_path, 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); @@ -1192,6 +1193,10 @@ _media_thumb_video(const char *origin_path, 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; diff --git a/src/util/media-thumb-util.c b/src/util/media-thumb-util.c index 3cccc9e..8421146 100755 --- a/src/util/media-thumb-util.c +++ b/src/util/media-thumb-util.c @@ -432,7 +432,7 @@ int _thumbnail_get_data(const char *origin_path, 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; |