From 00a46790b74fc0ae7a221c3d18aa269259607fd6 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Mon, 22 Aug 2016 11:28:56 +0900 Subject: [PATCH] rage videothumb - do not spawn multiple thumbnailers for the same file so if you slide up and down the seek bar without an existing thumb file (al my videos had thumb fils because i've been using the browser which generates the thumb files for me mostly), then rage may spawn several thumbnailersfor the same file. this is not a good thing. so avoid it and only have 1 thumbnailer per file --- src/bin/videothumb.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/bin/videothumb.c b/src/bin/videothumb.c index 3f6d3ae..be003ac 100644 --- a/src/bin/videothumb.c +++ b/src/bin/videothumb.c @@ -144,7 +144,7 @@ _videothumb_launch_do(Evas_Object *obj) sd->exe_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _cb_thumb_exe, obj); snprintf(buf, sizeof(buf), - "%s/rage/utils/rage_thumb %s 10000 %i 2>&1 /dev/null", + "%s/rage/utils/rage_thumb %s 10000 %i 1> /dev/null 2>&1", libdir, s, sd->poster_mode ? 1 : 0); sd->thumb_exe = ecore_exe_pipe_run(buf, ECORE_EXE_USE_SH | @@ -159,6 +159,25 @@ _videothumb_launch_do(Evas_Object *obj) } } +static Eina_Bool +_have_active_thumb(const char *path) +{ + Evas_Object *o; + Eina_List *l; + + EINA_LIST_FOREACH(vidthumbs, l, o) + { + Videothumb *sd = evas_object_smart_data_get(o); + + if (sd) + { + if ((sd->thumb_exe) && (!strcmp(path, sd->realpath))) + return EINA_TRUE; + } + } + return EINA_FALSE; +} + static Eina_Bool _cb_videothumb_delay(void *data) { @@ -167,9 +186,17 @@ _cb_videothumb_delay(void *data) int maxnum = (eina_cpu_count() / 2) + 1; if (!sd) return EINA_FALSE; if (_thumb_running < maxnum) + { + if (!_have_active_thumb(sd->realpath)) + { + sd->launch_timer = NULL; + _videothumb_launch_do(obj); + return EINA_FALSE; + } + } + if ((sd->iw > 0) && (sd->ih > 0)) { sd->launch_timer = NULL; - _videothumb_launch_do(obj); return EINA_FALSE; } return EINA_TRUE; @@ -182,7 +209,7 @@ _videothumb_launch(Evas_Object *obj) if (!sd) return; if (sd->launch_timer) return; - sd->launch_timer = ecore_timer_add(1.0, _cb_videothumb_delay, obj); + sd->launch_timer = ecore_timer_add(0.5, _cb_videothumb_delay, obj); } static Eina_Bool