From 313dda5f2d801ac1e34a9c138dd9aa82b43d9aca Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Sun, 2 Oct 2016 00:34:52 +0900 Subject: [PATCH] albumart - fix albumart display if paths are uri's @fix --- src/bin/video.c | 20 ++++++++++++--- src/bin/videothumb.c | 1 + src/bin/win.c | 58 +++++++++++++++++++++++++++++++------------- 3 files changed, 58 insertions(+), 21 deletions(-) diff --git a/src/bin/video.c b/src/bin/video.c index 603361c..32bc78f 100644 --- a/src/bin/video.c +++ b/src/bin/video.c @@ -86,7 +86,10 @@ _art_check(Evas_Object *obj) free(thumb); } } - else evas_object_hide(sd->o_img); + else + { + evas_object_hide(sd->o_img); + } } static void @@ -97,8 +100,16 @@ _cb_vid_frame(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) if (!sd) return; evas_object_geometry_get(data, &ox, &oy, &ow, &oh); - evas_object_show(sd->o_vid); - evas_object_hide(sd->o_img); + if (!emotion_object_video_handled_get(sd->o_vid)) + { + evas_object_hide(sd->o_vid); + evas_object_show(sd->o_img); + } + else + { + evas_object_show(sd->o_vid); + evas_object_hide(sd->o_img); + } evas_object_show(sd->clip); _ob_resize(data, ox, oy, ow, oh); evas_object_smart_callback_call(data, "frame_decode", NULL); @@ -292,7 +303,8 @@ _ob_resize(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coor sd->pih = sd->ih; evas_object_smart_callback_call(obj, "frame_resize", NULL); } - if ((sd->tw > 0) && (sd->th > 0) && (sd->doart)) + if ((sd->tw > 0) && (sd->th > 0) && (sd->doart) && + (!emotion_object_video_handled_get(sd->o_vid))) { int iw, ih; diff --git a/src/bin/videothumb.c b/src/bin/videothumb.c index be003ac..97152cb 100644 --- a/src/bin/videothumb.c +++ b/src/bin/videothumb.c @@ -276,6 +276,7 @@ _videothumb_image_load(Evas_Object *obj) if (sd->poster_mode) { artfile = albumart_file_get(sd->realpath); + printf("artfile for %s = %s\n", sd->realpath, artfile); if (artfile) { if (ecore_file_exists(artfile)) diff --git a/src/bin/win.c b/src/bin/win.c index e977e77..474592e 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -185,7 +185,22 @@ _cb_fetched(void *data) file = video_file_get(inf->vid); if (file) { - char *realfile = ecore_file_realpath(file); + char *realfile = NULL; + + if (!strncasecmp(file, "file:/", 6)) + { + Efreet_Uri *uri = efreet_uri_decode(file); + if (uri) + { + realfile = ecore_file_realpath(uri->path); + efreet_uri_free(uri); + } + } + else if ((!strncasecmp(file, "http:/", 6)) || + (!strncasecmp(file, "https:/", 7))) + realfile = strdup(file); + else + realfile = ecore_file_realpath(file); if (realfile) { char *path = albumart_file_get(realfile); @@ -617,24 +632,33 @@ win_art(Evas_Object *win, const char *path) if (inf->artimg) { - evas_object_del(inf->artimg); - inf->artimg = NULL; + const char *path2; + + evas_object_image_file_get(inf->artimg, &path2, NULL); + if ((!path2) || (strcmp(path, path2))) + { + evas_object_del(inf->artimg); + inf->artimg = NULL; + } } - inf->artimg = evas_object_image_filled_add(evas_object_evas_get(win)); - evas_object_image_file_set(inf->artimg, path, NULL); - evas_object_image_size_get(inf->artimg, &iw, &ih); - if ((iw > 0) && (ih > 0)) + if (!inf->artimg) { - evas_object_size_hint_aspect_set(inf->artimg, - EVAS_ASPECT_CONTROL_NEITHER, - iw, ih); - elm_object_part_content_set(inf->lay, "rage.art", inf->artimg); - elm_layout_signal_emit(inf->lay, "state,art", "rage"); - } - else - { - evas_object_del(inf->artimg); - inf->artimg = NULL; + inf->artimg = evas_object_image_filled_add(evas_object_evas_get(win)); + evas_object_image_file_set(inf->artimg, path, NULL); + evas_object_image_size_get(inf->artimg, &iw, &ih); + if ((iw > 0) && (ih > 0)) + { + evas_object_size_hint_aspect_set(inf->artimg, + EVAS_ASPECT_CONTROL_NEITHER, + iw, ih); + elm_object_part_content_set(inf->lay, "rage.art", inf->artimg); + elm_layout_signal_emit(inf->lay, "state,art", "rage"); + } + else + { + evas_object_del(inf->artimg); + inf->artimg = NULL; + } } } }