From 82f1b8a1c153b9f5f4bf2dc8009f70e712421153 Mon Sep 17 00:00:00 2001 From: Al Poole Date: Mon, 17 Apr 2017 12:06:11 +0900 Subject: [PATCH] E -> Enlightenment_thumb -> Media -> Thumbnail Creation. Summary: E -> Enlightenment_thumb -> Media -> Thumbnail Creation. @feature Add thumbnail creation to ethumb rather than in the image loaders. See: https://www.enlightenment.org/ss/display.php?image=e-58e93eef5e8b58.22514685.jpg Test Plan: View directory with mp4 video in efm and see thumbnail. Reviewers: zmike!, raster Reviewed By: raster Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D4779 --- src/bin/Makefile.mk | 2 +- src/bin/e_thumb_main.c | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/bin/Makefile.mk b/src/bin/Makefile.mk index 5fdc79f81..6106b22f2 100644 --- a/src/bin/Makefile.mk +++ b/src/bin/Makefile.mk @@ -504,7 +504,7 @@ src/bin/e_sha1.c \ src/bin/e_thumb_main.c \ src/bin/e_user.c -src_bin_enlightenment_thumb_LDADD = @E_THUMB_LIBS@ +src_bin_enlightenment_thumb_LDADD = @e_libs@ src_bin_enlightenment_thumb_CPPFLAGS = $(E_CPPFLAGS) src_bin_enlightenment_elm_cfgtool_SOURCES = \ diff --git a/src/bin/e_thumb_main.c b/src/bin/e_thumb_main.c index 2d331c9c9..c0e786c6e 100644 --- a/src/bin/e_thumb_main.c +++ b/src/bin/e_thumb_main.c @@ -28,6 +28,7 @@ void *alloca(size_t); #include #include #include +#include #include "e_sha1.h" #include "e_user.h" @@ -110,6 +111,7 @@ main(int argc, edje_init(); ecore_file_init(); ecore_ipc_init(); + emotion_init(); e_user_dir_concat_static(_thumbdir, "fileman/thumbnails"); ecore_file_mkpath(_thumbdir); @@ -122,6 +124,7 @@ main(int argc, _e_ipc_server = NULL; } + emotion_shutdown(); ecore_ipc_shutdown(); ecore_file_shutdown(); ecore_evas_shutdown(); @@ -362,7 +365,32 @@ _e_thumb_generate(E_Thumb *eth) ext = strrchr(eth->file, '.'); sortkey = EINA_FALSE; - + + if ((ext) && + ((!strcasecmp(ext, ".mp4")) || + (!strcasecmp(ext, ".m4a")) || + (!strcasecmp(ext, ".mp3")) + )) + { + Evas_Object *em; + + em = emotion_object_add(evas); + emotion_object_init(em, NULL); + emotion_object_file_set(em, eth->file); + + im = emotion_file_meta_artwork_get(em, eth->file, EMOTION_ARTWORK_PREVIEW_IMAGE); + if (!im) im = emotion_file_meta_artwork_get(em, eth->file, EMOTION_ARTWORK_IMAGE); + if (im) + { + evas_object_image_size_get(im, &ww, &hh); + evas_object_image_fill_set(im, 0, 0, ww, hh); + evas_object_move(im, 0, 0); + evas_object_resize(im, ww, hh); + } + evas_object_del(em); + if (im) goto process; + } + if ((ext) && (eth->key) && ((!strcasecmp(ext, ".edj")) || (!strcasecmp(ext, ".eap")))) @@ -505,7 +533,8 @@ _e_thumb_generate(E_Thumb *eth) } else goto end; - + +process: ecore_evas_alpha_set(ee, alpha); ecore_evas_resize(ee, ww, hh); evas_object_show(im);