From: Enlightenment C. <no...@cv...> - 2006-06-03 11:22:18
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon/src/bin Modified Files: epsilon_thumbd.c Log Message: * Make video thumbnailing compile again =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/bin/epsilon_thumbd.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- epsilon_thumbd.c 28 Mar 2006 09:10:13 -0000 1.1 +++ epsilon_thumbd.c 3 Jun 2006 11:19:59 -0000 1.2 @@ -369,7 +369,7 @@ /* * Don't dispatch work to active workers. */ - if (!worker->child) { + if (!worker->child && !ecore_list_nodes(worker->thumbs)) { Epsilon_Message *msg; /* |
From: Enlightenment C. <no...@cv...> - 2006-06-03 11:22:23
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon Modified Files: configure.in Log Message: * Make video thumbnailing compile again =================================================================== RCS file: /cvs/e/e17/libs/epsilon/configure.in,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- configure.in 30 Apr 2006 13:44:38 -0000 1.22 +++ configure.in 3 Jun 2006 11:19:59 -0000 1.23 @@ -107,7 +107,7 @@ xine_libs=`xine-config --libs` xine_plugins=`xine-config --plugindir` AC_DEFINE(HAVE_LIBXINE, 1, build xinefile thumbnailer) - xine="xine "],[ + xine="xine"],[ AC_MSG_WARN([libxine too old; no thumbnails for videos...])])]) else AC_MSG_RESULT(yes) @@ -116,7 +116,7 @@ AC_SUBST(xine_LIBS) AC_SUBST(xine_CFLAGS) AC_SUBST(xine_PLUGINS) -AM_CONDITIONAL(HAVE_XINE, test $xine = "xine ") +AM_CONDITIONAL(HAVE_XINE, test $xine = "xine") dnl Make sure the Edje header/lib is available |
From: Enlightenment C. <no...@cv...> - 2006-06-03 12:24:36
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon Modified Files: configure.in Log Message: * and fix the variables i forgot about =================================================================== RCS file: /cvs/e/e17/libs/epsilon/configure.in,v retrieving revision 1.23 retrieving revision 1.24 diff -u -3 -r1.23 -r1.24 --- configure.in 3 Jun 2006 11:19:59 -0000 1.23 +++ configure.in 3 Jun 2006 12:22:40 -0000 1.24 @@ -103,9 +103,9 @@ AC_DEFINE(HAVE_LIBXINE, 1, libxine thumbnailer) xine="xine "], [AC_PATH_GENERIC(xine, 1.0.0, [ - xine_cflags=`xine-config --cflags` - xine_libs=`xine-config --libs` - xine_plugins=`xine-config --plugindir` + xine_CFLAGS=`xine-config --cflags` + xine_LIBS=`xine-config --libs` + xine_PLUGINS=`xine-config --plugindir` AC_DEFINE(HAVE_LIBXINE, 1, build xinefile thumbnailer) xine="xine"],[ AC_MSG_WARN([libxine too old; no thumbnails for videos...])])]) |
From: Enlightenment C. <no...@cv...> - 2007-06-25 10:28:49
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon/src/plugins Modified Files: Makefile.am Added Files: pdf_thumbnailer.c Log Message: * First checkin of the pdf thumbnailer =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/plugins/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- Makefile.am 22 Apr 2007 02:59:17 -0000 1.6 +++ Makefile.am 25 Jun 2007 10:28:39 -0000 1.7 @@ -14,13 +14,23 @@ XINE_L = endif +if HAVE_EPDF +EPDF_L = +else +EPDF_L = +endif - -pkg_LTLIBRARIES = $(XINE_L) +pkg_LTLIBRARIES = $(XINE_L) $(EPDF_L) xine_thumbnailer_la_SOURCES = xine_thumbnailer.c xine_thumbnailer_la_LDFLAGS = -module -avoid-version xine_thumbnailer_la_LIBADD = @XINE_LIBS@ @IMLIB2_LIBS@ xine_thumbnailer_la_CFLAGS = @XINE_CFLAGS@ @IMLIB2_CFLAGS@ + +epdf_thumbnailer_la_SOURCES = pdf_thumbnailer.c +epdf_thumbnailer_la_LDFLAGS = -module -avoid-version +epdf_thumbnailer_la_LIBADD = @EPDF_LIBS@ @IMLIB2_LIBS@ +epdf_thumbnailer_la_CFLAGS = @EPDF_CFLAGS@ @IMLIB2_CFLAGS@ + |
From: Enlightenment C. <no...@cv...> - 2007-06-25 10:29:10
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon Modified Files: configure.in Log Message: * First checkin of the pdf thumbnailer =================================================================== RCS file: /cvs/e/e17/libs/epsilon/configure.in,v retrieving revision 1.28 retrieving revision 1.29 diff -u -3 -r1.28 -r1.29 --- configure.in 17 Jun 2007 15:25:50 -0000 1.28 +++ configure.in 25 Jun 2007 10:28:39 -0000 1.29 @@ -67,7 +67,10 @@ ] ) +epdf="" PKG_CHECK_MODULES(EDJE, [edje >= 0.5.0]) +PKG_CHECK_MODULES(EPDF, [epdf >= 0.1], epdf="yes",epdf="no") +AM_CONDITIONAL(HAVE_EPDF, test $epdf = "yes") xine="" AC_MSG_CHECKING(whether the xine thumbnailer was explicitly disabled) |
From: Enlightenment C. <no...@cv...> - 2007-06-25 10:29:10
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon/src/lib Modified Files: Epsilon.c Log Message: * First checkin of the pdf thumbnailer =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/lib/Epsilon.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -3 -r1.32 -r1.33 --- Epsilon.c 6 May 2007 15:20:42 -0000 1.32 +++ Epsilon.c 25 Jun 2007 10:28:39 -0000 1.33 @@ -412,6 +412,7 @@ else if (!strcasecmp(extension, "wmv")) return "video/x-ms-wmv"; else if (!strcasecmp(extension, "avi")) return "video/x-msvideo"; else if (!strcasecmp(extension, "mov")) return "video/quicktime"; + else if (!strcasecmp(extension, "pdf")) return "application/pdf"; else return NULL; } |
From: Enlightenment C. <no...@cv...> - 2007-06-25 11:31:49
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon/src/plugins Modified Files: Makefile.am pdf_thumbnailer.c Log Message: * PDF thumbnailer now works! =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/plugins/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- Makefile.am 25 Jun 2007 10:28:39 -0000 1.7 +++ Makefile.am 25 Jun 2007 11:31:47 -0000 1.8 @@ -15,7 +15,7 @@ endif if HAVE_EPDF -EPDF_L = +EPDF_L = epdf_thumbnailer.la else EPDF_L = endif =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/plugins/pdf_thumbnailer.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- pdf_thumbnailer.c 25 Jun 2007 10:28:39 -0000 1.1 +++ pdf_thumbnailer.c 25 Jun 2007 11:31:47 -0000 1.2 @@ -65,7 +65,7 @@ Imlib_Image epsilon_generate_thumb (Epsilon * e) { - Imlib_Image img; + Imlib_Image img = NULL; Ecore_Evas *ee; Evas *evas; Evas_Object *o; @@ -86,18 +86,16 @@ ecore_evas_resize (ee, epdf_page_width_get (page), epdf_page_height_get (page)); pixels = ecore_evas_buffer_pixels_get (ee); - img = imlib_create_image_using_data (w, h, (DATA32 *) pixels); + img = imlib_create_image_using_data (epdf_page_width_get (page), + epdf_page_height_get (page), + (DATA32 *) pixels); - imlib_context_set_image(tmp); + imlib_context_set_image(img); epdf_page_delete (page); epdf_document_delete (document); - printf("Thumbnailing %s", e->src); - - - return img; } |
From: Enlightenment C. <no...@cv...> - 2007-06-25 11:32:18
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon/src/bin Modified Files: epsilon_main.c Log Message: * PDF thumbnailer now works! =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/bin/epsilon_main.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- epsilon_main.c 16 Jul 2005 15:54:39 -0000 1.7 +++ epsilon_main.c 25 Jun 2007 11:31:47 -0000 1.8 @@ -29,7 +29,7 @@ "Thumbnail for %s needs to be generated: ", argv[argc]); if (epsilon_generate (e) == EPSILON_OK) - fprintf (stderr, "OK\n"); + fprintf (stderr, "OK - thumb is %s\n", (char*)epsilon_thumb_file_get(e)); else fprintf (stderr, "FAILED\n"); } |
From: Enlightenment C. <no...@cv...> - 2007-06-25 11:32:18
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon/src/lib Modified Files: Epsilon.c Log Message: * PDF thumbnailer now works! =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/lib/Epsilon.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -3 -r1.33 -r1.34 --- Epsilon.c 25 Jun 2007 10:28:39 -0000 1.33 +++ Epsilon.c 25 Jun 2007 11:31:47 -0000 1.34 @@ -584,6 +584,18 @@ len = strlen (e->src); + if (!evas_init()) return -1; + if (!ecore_init()) { + evas_shutdown (); + return -1; + } + + if (!ecore_evas_init()) { + evas_shutdown (); + ecore_shutdown (); + return -1; + } + if ((len > 4) && (!strcmp (&e->src[len - 3], "edj"))) { Evas *evas = NULL; @@ -688,9 +700,9 @@ return (EPSILON_OK); } imlib_free_image_and_decache (); - } + } - } + } #endif if (ee) ecore_evas_free(ee); } |
From: Enlightenment C. <no...@cv...> - 2007-07-01 00:05:26
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon/src/bin Modified Files: epsilon_thumbd.c Log Message: * Experimental fix to recent epsilon issues. We now start/pull down the 'worker listener' ecore_con in response to the number of children we're waiting to finish. This stops the connection mysteriously disappearing. =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/bin/epsilon_thumbd.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- epsilon_thumbd.c 3 Jun 2006 11:19:59 -0000 1.2 +++ epsilon_thumbd.c 1 Jul 2007 00:05:19 -0000 1.3 @@ -76,8 +76,9 @@ }; static int client_id = 1; -static int debug = 0; +static int debug = 1; static double idle_time = 0; +static int running_workers = 0; static int worker_limit = EPSILON_WORKERS; @@ -90,6 +91,7 @@ static Ecore_Event_Handler *worker_data = NULL; static Ecore_List *queued_workers; +static Ecore_List *gworkers = NULL; static Ecore_Con_Server *thumb_server = NULL; static Ecore_Con_Server *thumbd_server = NULL; @@ -101,6 +103,49 @@ static int epsilond_client_clean(Epsilon_Client *cl); static int epsilond_worker_clean(Epsilon_Worker *worker); +int epsilond_cb_worker_add(void *data, int type, void *event); +int epsilond_cb_worker_del(void *data, int type, void *event); +int epsilond_cb_worker_data(void *data, int type, void *event); + + +void epsilond_init_thumbd_server(Ecore_List* workers) +{ + char* buf; + + /* + * Retrieve the safe socket name for the server. + */ + buf = epsilond_socket_path(EPSILOND_SOCK); + + if (debug) printf("socket name %s\n", buf); + + /* + * Setup the IPC server to handle completed notifications + */ + thumbd_server = ecore_con_server_add(ECORE_CON_LOCAL_USER, buf, 0, NULL); + + free(buf); + + /* + * Prepare the handlers for worker IPC events + */ + worker_add = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, epsilond_cb_worker_add, workers); + worker_del = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, epsilond_cb_worker_del, workers); + worker_data = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, epsilond_cb_worker_data, workers); +} + +void epsilond_shutdown_thumbd_server() +{ + if (thumbd_server) + ecore_con_server_del(thumbd_server); + + ecore_event_handler_del(worker_add); + ecore_event_handler_del(worker_del); + ecore_event_handler_del(worker_data); +} + + + /* * Handle a client connect and add the new client to the list of clients. */ @@ -196,6 +241,9 @@ ecore_list_next(clients); } + running_workers--; + if (!running_workers) epsilond_shutdown_thumbd_server(); + return 1; } @@ -633,6 +681,10 @@ if (!worker->child) { if (ecore_list_nodes(worker->thumbs)) { idle--; + + if (!running_workers) epsilond_init_thumbd_server(gworkers); + running_workers++; + if (!epsilond_worker_fork(worker)) return 0; } @@ -664,7 +716,6 @@ int wi; char *buf; Ecore_List *clients = NULL; - Ecore_List *workers = NULL; epsilon_init(); @@ -672,7 +723,7 @@ * Create the accounting data for the clients and thumbnail queue. */ clients = ecore_list_new(); - workers = ecore_list_new(); + gworkers = ecore_list_new(); response_queue = ecore_list_new(); queued_workers = ecore_list_new(); @@ -696,27 +747,6 @@ client_add = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, epsilond_cb_client_add, clients); client_del = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, epsilond_cb_client_del, clients); client_data = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, epsilond_cb_client_data, clients); - - /* - * Retrieve the safe socket name for the server. - */ - buf = epsilond_socket_path(EPSILOND_SOCK); - - if (debug) printf("socket name %s\n", buf); - - /* - * Setup the IPC server to handle completed notifications - */ - thumbd_server = ecore_con_server_add(ECORE_CON_LOCAL_USER, buf, 0, NULL); - - free(buf); - - /* - * Prepare the handlers for worker IPC events - */ - worker_add = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, epsilond_cb_worker_add, workers); - worker_del = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, epsilond_cb_worker_del, workers); - worker_data = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, epsilond_cb_worker_data, workers); /* * Initialize the worker threads |
From: Enlightenment C. <no...@cv...> - 2007-07-01 00:11:49
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon/src/bin Modified Files: epsilon_thumbd.c Log Message: * debug-- =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/bin/epsilon_thumbd.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- epsilon_thumbd.c 1 Jul 2007 00:05:19 -0000 1.3 +++ epsilon_thumbd.c 1 Jul 2007 00:11:48 -0000 1.4 @@ -76,7 +76,7 @@ }; static int client_id = 1; -static int debug = 1; +static int debug = 0; static double idle_time = 0; static int running_workers = 0; |
From: Enlightenment C. <no...@cv...> - 2007-07-27 14:09:34
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon/src/lib Modified Files: epsilon_thumb.c Log Message: * Epsilon has moved to ecore_ipc - we may as well rely on the infrastructure provided by Ecore, and not duplicate * Epsilon now works, and doesn't seem to crash on large input sets. Please test, and report back to me if something doesn't work * printfs->debug =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/lib/epsilon_thumb.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- epsilon_thumb.c 25 Jul 2007 17:00:58 -0000 1.11 +++ epsilon_thumb.c 27 Jul 2007 14:09:32 -0000 1.12 @@ -1,6 +1,6 @@ #include <Ecore.h> #include <Ecore_Data.h> -#include <Ecore_Con.h> +#include <Ecore_Ipc.h> #include <Ecore_File.h> #include "Epsilon_Request.h" @@ -18,7 +18,7 @@ static Ecore_DList *epsilon_request_queue = NULL; -static Ecore_Con_Server *epsilon_server = NULL; +static Ecore_Ipc_Server *epsilon_server = NULL; static Epsilon_Ipc_End buffer; @@ -40,7 +40,7 @@ * Init required subsystems. */ if (!ecore_init()) goto init_error; - if (!ecore_con_init()) goto con_init_error; + if (!ecore_ipc_init()) goto con_init_error; /* * Allocate a list for queueing requests. @@ -52,13 +52,13 @@ /* * Setup handlers for server events. */ - epsilon_server_add = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, epsilon_cb_server_add, NULL); + epsilon_server_add = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, epsilon_cb_server_add, NULL); if (!epsilon_server_add) goto handler_add_error; - epsilon_server_del = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, epsilon_cb_server_del, NULL); + epsilon_server_del = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, epsilon_cb_server_del, NULL); if (!epsilon_server_del) goto handler_del_error; - epsilon_server_data = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, epsilon_cb_server_data, NULL); + epsilon_server_data = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, epsilon_cb_server_data, NULL); if (!epsilon_server_data) goto handler_data_error; /* @@ -94,7 +94,7 @@ handler_add_error: ecore_dlist_destroy(epsilon_request_queue); queue_error: - ecore_con_shutdown(); + ecore_ipc_shutdown(); con_init_error: ecore_shutdown(); init_error: @@ -114,7 +114,7 @@ ecore_dlist_destroy(epsilon_request_queue); } - ecore_con_shutdown(); + ecore_ipc_shutdown(); ecore_shutdown(); return epsilon_init_count; @@ -167,8 +167,9 @@ static int epsilon_cb_server_data(void *data, int type, void *event) { - Ecore_Con_Event_Server_Data *e; + Ecore_Ipc_Event_Server_Data *e; Epsilon_Message *msg; + int i = 0; data = NULL; type = 0; @@ -180,44 +181,47 @@ if (e->server != epsilon_server) return 1; - epsilon_ipc_push(&buffer, e->data, e->size); - while ((msg = epsilon_ipc_consume(&buffer))) { - Epsilon_Request *thumb; + msg = e->data; + Epsilon_Request *thumb; - if (debug) printf("Received %d response for %s\n", msg->status, - ((char *)msg) + sizeof(Epsilon_Message)); + if (debug) printf("Received %d response for %d\n", msg->status,msg->mid); - /* - * Find the thumbnail request matching this message response. - */ - ecore_dlist_first_goto(epsilon_request_queue); - while ((thumb = ecore_dlist_current(epsilon_request_queue))) { - if (thumb->id == msg->mid) { - ecore_dlist_remove(epsilon_request_queue); - break; - } - ecore_dlist_next(epsilon_request_queue); - } + /* + * Find the thumbnail request matching this message response. + */ - /*If the thumb dest is not set, but the generation was successful, - * try to get the dest now */ - if ( thumb && (!thumb->dest) && thumb->path && !thumb->status ) { - Epsilon* tb; - - /* - * Create a temp thumbnail struct to get the thumbnail - * path, don't actually generate the thumbnail here. - */ - tb = epsilon_new(thumb->path); - epsilon_exists(tb); - thumb->dest = (char *)epsilon_thumb_file_get(tb); - if (thumb->dest) - thumb->dest = strdup(thumb->dest); - epsilon_free(tb); + ecore_dlist_first_goto(epsilon_request_queue); + while ((thumb = ecore_dlist_current(epsilon_request_queue))) { + if (thumb->id == msg->mid) { + if (debug) printf("Removing %d from queue\n", thumb->id); + ecore_dlist_remove(epsilon_request_queue); + break; } + ecore_dlist_next(epsilon_request_queue); + if (debug) printf("Cycling %d times looking for %d, current is %d\n", i++, msg->mid, thumb->id); + } + + /*If the thumb dest is not set, but the generation was successful, + * try to get the dest now */ + if ( thumb && (!thumb->dest) && thumb->path && !thumb->status ) { + Epsilon* tb; + + /* + * Create a temp thumbnail struct to get the thumbnail + * path, don't actually generate the thumbnail here. + */ + tb = epsilon_new(thumb->path); + epsilon_exists(tb); + thumb->dest = (char *)epsilon_thumb_file_get(tb); + if (thumb->dest) + thumb->dest = strdup(thumb->dest); + epsilon_free(tb); + } + if (thumb) { ecore_event_add(EPSILON_EVENT_DONE, thumb, epsilon_event_free, NULL); } + if (debug) printf("Jump out\n"); return 1; } @@ -238,18 +242,14 @@ * Use a socket with the hostname appended to help avoid potential * conflicts in NFS systems. */ - gethostname(sockname, MAXHOSTNAMELEN); - buf = malloc((MAXHOSTNAMELEN + strlen(EPSILON_SOCK) + 1)); - snprintf(buf, MAXHOSTNAMELEN + strlen(EPSILON_SOCK), "%s-%s", - EPSILON_SOCK, sockname); - if (debug) printf("socket name %s\n", buf); + if (debug) printf("socket name %s\n", EPSILON_SOCK); /* * Connect to an existing server instance if available. */ while (!epsilon_server && retries++ < MAX_RETRY) { - epsilon_server = ecore_con_server_connect(ECORE_CON_LOCAL_USER, - buf, 0, NULL); + epsilon_server = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, + EPSILON_SOCK, 0, NULL); if (!epsilon_server) { pid_t child; @@ -271,8 +271,6 @@ } } - free(buf); - if (epsilon_server) { if (debug) printf("connect to ipc server: %p\n", epsilon_server); @@ -328,8 +326,9 @@ msg = epsilon_message_new(epsilon_mid++, (char *)path, dst, 0); if (msg) { msg->thumbsize = size; - if (debug) printf("!! requesting thumbnail for %s !!\n", path); - if (epsilon_ipc_server_send(epsilon_server, msg)) { + if (debug) printf("!! requesting thumbnail for %s (request %d)!!, %d\n", path, msg->mid, sizeof(Epsilon_Message)+msg->bufsize); + + if (ecore_ipc_server_send(epsilon_server, 1,1,1,1,1,msg,sizeof(Epsilon_Message)+msg->bufsize)) { thumb->id = msg->mid; ecore_dlist_append(epsilon_request_queue, thumb); } |
From: Enlightenment C. <no...@cv...> - 2007-07-27 14:10:08
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon/src/bin Modified Files: epsilon_thumbd.c Log Message: * Epsilon has moved to ecore_ipc - we may as well rely on the infrastructure provided by Ecore, and not duplicate * Epsilon now works, and doesn't seem to crash on large input sets. Please test, and report back to me if something doesn't work * printfs->debug =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/bin/epsilon_thumbd.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- epsilon_thumbd.c 25 Jul 2007 17:00:58 -0000 1.5 +++ epsilon_thumbd.c 27 Jul 2007 14:09:32 -0000 1.6 @@ -1,7 +1,7 @@ #include "epsilon_private.h" #include <Ecore.h> #include <Ecore_Data.h> -#include <Ecore_Con.h> +#include <Ecore_Ipc.h> #include <stdio.h> #include <stdlib.h> @@ -33,7 +33,7 @@ struct _Epsilon_Client { unsigned int id; - Ecore_Con_Client *client; + Ecore_Ipc_Client *client; Ecore_List *thumbs; Epsilon_Ipc_End ipcend; @@ -60,7 +60,7 @@ { Ecore_List *thumbs; pid_t child; - Ecore_Con_Server *server; + Ecore_Ipc_Server *server; Epsilon_Ipc_End ipcend; }; @@ -93,8 +93,8 @@ static Ecore_List *queued_workers; static Ecore_List *gworkers = NULL; -static Ecore_Con_Server *thumb_server = NULL; -static Ecore_Con_Server *thumbd_server = NULL; +static Ecore_Ipc_Server *thumb_server = NULL; +static Ecore_Ipc_Server *thumbd_server = NULL; static Ecore_List *response_queue = NULL; @@ -111,6 +111,8 @@ void epsilond_init_thumbd_server(Ecore_List* workers) { char* buf; + + ecore_init(); /* * Retrieve the safe socket name for the server. @@ -122,22 +124,23 @@ /* * Setup the IPC server to handle completed notifications */ - thumbd_server = ecore_con_server_add(ECORE_CON_LOCAL_USER, buf, 0, NULL); - - free(buf); + thumbd_server = ecore_ipc_server_add(ECORE_IPC_LOCAL_USER, EPSILOND_SOCK, 0, NULL); /* * Prepare the handlers for worker IPC events */ - worker_add = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, epsilond_cb_worker_add, workers); - worker_del = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, epsilond_cb_worker_del, workers); - worker_data = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, epsilond_cb_worker_data, workers); + worker_add = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, epsilond_cb_worker_add, workers); + worker_del = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, epsilond_cb_worker_del, workers); + worker_data = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, epsilond_cb_worker_data, workers); + } void epsilond_shutdown_thumbd_server() { - if (thumbd_server) - ecore_con_server_del(thumbd_server); + if (thumbd_server) { + ecore_ipc_server_del(thumbd_server); + thumbd_server = NULL; + } ecore_event_handler_del(worker_add); ecore_event_handler_del(worker_del); @@ -153,13 +156,13 @@ epsilond_cb_client_add(void *data, int type, void *event) { Epsilon_Client *cl; - Ecore_Con_Event_Client_Add *e; + Ecore_Ipc_Event_Client_Add *e; Ecore_List *clients = data; e = event; type = 0; - if (ecore_con_client_server_get(e->client) != thumb_server) return 1; + if (ecore_ipc_client_server_get(e->client) != thumb_server) return 1; if (debug) printf("!!! client %p connected to server!\n", e->client); cl = calloc(1, sizeof(Epsilon_Client)); @@ -184,14 +187,14 @@ epsilond_cb_worker_add(void *data, int type, void *event) { Epsilon_Client *cl; - Ecore_Con_Event_Client_Add *e; + Ecore_Ipc_Event_Client_Add *e; Ecore_List *workers = data; e = event; data = NULL; type = 0; - if (ecore_con_client_server_get(e->client) != thumbd_server) return 1; + if (ecore_ipc_client_server_get(e->client) != thumbd_server) return 1; if (debug) printf("?? Worker added to %ld ??\n", (long int)getpid()); cl = calloc(1, sizeof(Epsilon_Client)); @@ -212,14 +215,14 @@ int epsilond_cb_client_del(void *data, int type, void *event) { - Ecore_Con_Event_Client_Del *e; + Ecore_Ipc_Event_Client_Del *e; Epsilon_Client *cl; Ecore_List *clients = data; e = event; type = 0; - if (ecore_con_client_server_get(e->client) != thumb_server) return 1; + if (ecore_ipc_client_server_get(e->client) != thumb_server) return 1; if (debug) printf("!!! client %p disconnected from server!\n", e->client); @@ -241,23 +244,20 @@ ecore_list_next(clients); } - running_workers--; - if (!running_workers) epsilond_shutdown_thumbd_server(); - return 1; } int epsilond_cb_worker_del(void *data, int type, void *event) { - Ecore_Con_Event_Client_Del *e; + Ecore_Ipc_Event_Client_Del *e; Epsilon_Client *cl; Ecore_List *workers = data; e = event; type = 0; - if (ecore_con_client_server_get(e->client) != thumbd_server) return 1; + if (ecore_ipc_client_server_get(e->client) != thumbd_server) return 1; if (debug) printf("!!! worker %p disconnected from server!\n", e->client); @@ -279,6 +279,10 @@ ecore_list_next(workers); } + running_workers--; + /*if (!running_workers) epsilond_shutdown_thumbd_server(); + else printf ("**** Worker finished - now %d\n", running_workers);*/ + return 1; } @@ -307,14 +311,14 @@ int epsilond_cb_client_data(void *data, int type, void *event) { - Ecore_Con_Event_Client_Data *e; + Ecore_Ipc_Event_Client_Data *e; Epsilon_Client *cl; Ecore_List *clients = data; e = event; type = 0; - if (ecore_con_client_server_get(e->client) != thumb_server) return 1; + if (ecore_ipc_client_server_get(e->client) != thumb_server) return 1; if (debug) printf("!!! client %p sent data\n", e->client); @@ -329,19 +333,21 @@ if (cl) { Epsilon_Message *msg; - epsilon_ipc_push(&cl->ipcend, e->data, e->size); + Epsilon_Message *msg2; /* * Process all messages in the data buffer for this client and * queue them for processing in the next idle state. */ - while ((msg = epsilon_ipc_consume(&cl->ipcend))) { - if (debug) printf("** Received %s **\n", ((char *)msg + sizeof(Epsilon_Message))); - if (!cl->thumbs) - cl->thumbs = ecore_list_new(); - msg->nid = cl->id; - ecore_list_append(cl->thumbs, msg); - } + msg = e->data; + msg2 = calloc(1,sizeof(Epsilon_Message)+msg->bufsize); + memcpy(msg2,msg,sizeof(Epsilon_Message)+msg->bufsize); + + if (debug) printf("** Received %d : %s **\n",msg->mid, ((char *)msg + sizeof(Epsilon_Message))); + if (!cl->thumbs) + cl->thumbs = ecore_list_new(); + msg2->nid = cl->id; + ecore_list_append(cl->thumbs, msg2); } else { if (debug) printf("ERROR: No matching client for data\n"); @@ -353,7 +359,7 @@ int epsilond_cb_worker_data(void *data, int type, void *event) { - Ecore_Con_Event_Client_Data *e; + Ecore_Ipc_Event_Client_Data *e; Epsilon_Client *cl; Ecore_List *workers; @@ -361,7 +367,7 @@ workers = data; type = 0; - if (ecore_con_client_server_get(e->client) != thumbd_server) return 1; + if (ecore_ipc_client_server_get(e->client) != thumbd_server) return 1; if (debug) printf("?? Worker data ??\n"); @@ -376,21 +382,21 @@ if (cl) { Epsilon_Message *msg; + msg = (Epsilon_Message*)e->data; - epsilon_ipc_push(&cl->ipcend, e->data, e->size); + if (debug) printf("Onsend to client -> response for %d\n", msg->mid); /* * Process all messages in the data buffer for this client. */ - while ((msg = epsilon_ipc_consume(&cl->ipcend))) { - Epsilon_Response *response; + Epsilon_Response *response; - response = calloc(1, sizeof(Epsilon_Response)); - if (response) { - response->client = cl; - response->msg = msg; - ecore_list_append(response_queue, response); - } + response = calloc(1, sizeof(Epsilon_Response)); + if (response) { + response->client = cl; + response->msg = calloc(1,sizeof(Epsilon_Message)+msg->bufsize); + memcpy(response->msg, msg, sizeof(Epsilon_Message)+msg->bufsize); + ecore_list_append(response_queue, response); } } else { @@ -481,7 +487,7 @@ path = ((char *)msg + sizeof(Epsilon_Message)); ep = epsilon_new(path); epsilon_thumb_size(ep, msg->thumbsize); - if (debug) printf("Thumbnailing %s\n", path); + if (debug) printf("Thumbnailing %d: %s\n", msg->mid, path); /* * Check for an existing thumbnail and generate one if it @@ -515,11 +521,13 @@ * Notify the daemon of the completed thumbnail. */ msg->status = status; - if (epsilon_ipc_server_send(worker->server, msg) < 0) { + if (debug) printf("Dispatching response for %d\n", msg->mid); + if (ecore_ipc_server_send(worker->server, 1,1,1,1,1,msg,sizeof(Epsilon_Message)+msg->bufsize) < 0) { perror("write"); } + //ecore_ipc_server_flush(worker->server); } - + //ecore_ipc_server_flush(worker->server); ecore_main_loop_quit(); return 1; @@ -549,8 +557,8 @@ ecore_event_handler_del(client_data); client_data = NULL; - ecore_con_server_del(thumb_server); - ecore_con_server_del(thumbd_server); + ecore_ipc_server_del(thumb_server); + ecore_ipc_server_del(thumbd_server); thumb_server = NULL; thumbd_server = NULL; @@ -558,19 +566,15 @@ /* * Connect back to the parent process. */ - buf = epsilond_socket_path(EPSILOND_SOCK); - - worker->server = ecore_con_server_connect(ECORE_CON_LOCAL_USER, buf, 0, NULL); + worker->server = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, EPSILOND_SOCK, 0, NULL); if (worker->server) { - if (debug) printf("Connecting to %s\n", buf); + if (debug) printf("Connecting to %s\n", EPSILOND_SOCK); } else { - if (debug) printf("Failed connection to %s\n", buf); + if (debug) printf("Failed connection to %s\n", EPSILOND_SOCK); exit(1); } - free(buf); - // ecore_idler_add(epsilond_worker_run, worker); epsilond_worker_run(worker); return 0; } @@ -613,9 +617,11 @@ (long int)getpid(), cl->id); if (debug) printf("Client %p\n", cl->client); - if (epsilon_ipc_client_send(cl->client, msg) < 0) + if (ecore_ipc_client_send(cl->client, 1,1,1,1,1,msg,sizeof(Epsilon_Message) + msg->bufsize) < 0) perror("write"); free(msg); + } else { + printf("Client: %p, Msg: %p\n",cl,msg); } free(response); @@ -682,7 +688,8 @@ if (ecore_list_count(worker->thumbs)) { idle--; - if (!running_workers) epsilond_init_thumbd_server(gworkers); + /*if (!running_workers) epsilond_init_thumbd_server(gworkers); + else printf ("**** Added worker - now %d\n", running_workers+1);*/ running_workers++; if (!epsilond_worker_fork(worker)) @@ -737,16 +744,18 @@ /* * Setup the IPC server to handle requests */ - thumb_server = ecore_con_server_add(ECORE_CON_LOCAL_USER, buf, 0, clients); + thumb_server = ecore_ipc_server_add(ECORE_IPC_LOCAL_USER, EPSILON_SOCK, 0, NULL); free(buf); /* * Prepare the handlers for client interaction. */ - client_add = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, epsilond_cb_client_add, clients); - client_del = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, epsilond_cb_client_del, clients); - client_data = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, epsilond_cb_client_data, clients); + client_add = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, epsilond_cb_client_add, clients); + client_del = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, epsilond_cb_client_del, clients); + client_data = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, epsilond_cb_client_data, clients); + + epsilond_init_thumbd_server(gworkers); /* * Initialize the worker threads @@ -814,7 +823,7 @@ { Epsilon_Message *msg; worker->child = 0; - while ((msg = ecore_list_first_remove(worker->thumbs))) + while ((msg = ecore_list_remove_first(worker->thumbs))) free(msg); return 1; } @@ -826,7 +835,7 @@ * Initialize ecore internals. */ ecore_init(); - ecore_con_init(); + ecore_ipc_init(); ecore_app_args_set(argc, argv); /* @@ -842,7 +851,7 @@ /* * Request processing complete, cleanup. */ - ecore_con_shutdown(); + ecore_ipc_shutdown(); ecore_shutdown(); if (debug) printf("Process %ld shut down\n", (long int)getpid()); |
From: Enlightenment C. <no...@cv...> - 2007-07-27 14:10:12
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon Modified Files: configure.in Log Message: * Epsilon has moved to ecore_ipc - we may as well rely on the infrastructure provided by Ecore, and not duplicate * Epsilon now works, and doesn't seem to crash on large input sets. Please test, and report back to me if something doesn't work * printfs->debug =================================================================== RCS file: /cvs/e/e17/libs/epsilon/configure.in,v retrieving revision 1.31 retrieving revision 1.32 diff -u -3 -r1.31 -r1.32 --- configure.in 10 Jul 2007 00:13:25 -0000 1.31 +++ configure.in 27 Jul 2007 14:09:32 -0000 1.32 @@ -64,6 +64,7 @@ ecore-evas >= 0.9.9 ecore-file >= 0.9.9 ecore-con >= 0.9.9 + ecore-ipc >= 0.9.9 ] ) |
From: Enlightenment C. <no...@cv...> - 2007-07-29 00:38:12
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon/src/lib Modified Files: epsilon_thumb.c Log Message: * OK, I could have *sworn* that ecore was supposed to delete your client socket automatically on disconnect - apparantly not. For those having issues with epsilon crashing after 'a while' - this fixes it. Process was hitting FD limit =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/lib/epsilon_thumb.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- epsilon_thumb.c 27 Jul 2007 14:09:32 -0000 1.12 +++ epsilon_thumb.c 29 Jul 2007 00:38:09 -0000 1.13 @@ -14,7 +14,7 @@ static int debug = 0; static int epsilon_init_count = 0; -static int epsilon_mid = 0; +static unsigned long epsilon_mid = 0; static Ecore_DList *epsilon_request_queue = NULL; |
From: Enlightenment C. <no...@cv...> - 2007-07-29 00:38:40
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon/src/bin Modified Files: epsilon_thumb_test.c epsilon_thumbd.c Log Message: * OK, I could have *sworn* that ecore was supposed to delete your client socket automatically on disconnect - apparantly not. For those having issues with epsilon crashing after 'a while' - this fixes it. Process was hitting FD limit =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/bin/epsilon_thumb_test.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- epsilon_thumb_test.c 25 Jul 2007 17:00:58 -0000 1.6 +++ epsilon_thumb_test.c 29 Jul 2007 00:38:09 -0000 1.7 @@ -76,42 +76,5 @@ printf("\nEpsilon Thumb completed in %g seconds\n\n", end - start); epsilon_shutdown(); -#if 0 - sleep(5); - - start = ecore_time_get(); - ecore_list_first_goto(files); - while ((file = ecore_list_next(files))) { - pid_t pid; - char *realpath; - char fullpath[PATH_MAX]; - - snprintf(fullpath, PATH_MAX, "%s/%s", PATH, file); - realpath = ecore_file_realpath(fullpath); - - if (ecore_file_exists(realpath) && !ecore_file_is_dir(realpath)) { - if ((pid = fork()) == 0) { - Epsilon *ep; - - ep = epsilon_new(realpath); - if (epsilon_exists(ep) == EPSILON_FAIL) { - epsilon_generate(ep); - } - epsilon_free(ep); - exit(0); - } - else if (pid > 0) { - int status; - waitpid(pid, &status, WNOHANG); - printf("\n! EVENT ! THUMB COMPLETE ! %d REMAINING !\n\n", incomplete_thumbs); - } - incomplete_thumbs++; - } - } - - end = ecore_time_get(); - printf("\nFork & Wait completed in %g seconds\n\n", end - start); -#endif - return 0; } =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/bin/epsilon_thumbd.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- epsilon_thumbd.c 27 Jul 2007 14:09:32 -0000 1.6 +++ epsilon_thumbd.c 29 Jul 2007 00:38:09 -0000 1.7 @@ -32,7 +32,7 @@ typedef struct _Epsilon_Client Epsilon_Client; struct _Epsilon_Client { - unsigned int id; + unsigned int id; Ecore_Ipc_Client *client; Ecore_List *thumbs; @@ -60,8 +60,8 @@ { Ecore_List *thumbs; pid_t child; + double runtime; Ecore_Ipc_Server *server; - Epsilon_Ipc_End ipcend; }; @@ -75,7 +75,7 @@ Epsilon_Message *msg; }; -static int client_id = 1; +static unsigned int client_id = 1; static int debug = 0; static double idle_time = 0; static int running_workers = 0; @@ -107,7 +107,6 @@ int epsilond_cb_worker_del(void *data, int type, void *event); int epsilond_cb_worker_data(void *data, int type, void *event); - void epsilond_init_thumbd_server(Ecore_List* workers) { char* buf; @@ -131,12 +130,14 @@ */ worker_add = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, epsilond_cb_worker_add, workers); worker_del = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, epsilond_cb_worker_del, workers); - worker_data = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, epsilond_cb_worker_data, workers); - + worker_data = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, epsilond_cb_worker_data, workers); } + + void epsilond_shutdown_thumbd_server() { + if (debug) printf("Shutting down server (thumbd)\n"); if (thumbd_server) { ecore_ipc_server_del(thumbd_server); thumbd_server = NULL; @@ -244,6 +245,8 @@ ecore_list_next(clients); } + ecore_ipc_client_del(e->client); + return 1; } @@ -279,9 +282,8 @@ ecore_list_next(workers); } + ecore_ipc_client_del(e->client); running_workers--; - /*if (!running_workers) epsilond_shutdown_thumbd_server(); - else printf ("**** Worker finished - now %d\n", running_workers);*/ return 1; } @@ -318,7 +320,9 @@ e = event; type = 0; - if (ecore_ipc_client_server_get(e->client) != thumb_server) return 1; + if (ecore_ipc_client_server_get(e->client) != thumb_server) { + return 1; + } if (debug) printf("!!! client %p sent data\n", e->client); @@ -525,9 +529,11 @@ if (ecore_ipc_server_send(worker->server, 1,1,1,1,1,msg,sizeof(Epsilon_Message)+msg->bufsize) < 0) { perror("write"); } - //ecore_ipc_server_flush(worker->server); + ecore_ipc_server_flush(worker->server); + + free(msg); } - //ecore_ipc_server_flush(worker->server); + ecore_ipc_server_flush(worker->server); ecore_main_loop_quit(); return 1; @@ -541,6 +547,7 @@ */ ecore_list_first_goto(worker->thumbs); + worker->runtime = ecore_time_get(); worker->child = fork(); /* @@ -548,8 +555,6 @@ * it's idler. */ if (!worker->child) { - char *buf; - ecore_event_handler_del(client_add); client_add = NULL; ecore_event_handler_del(client_del); @@ -589,7 +594,7 @@ int epsilond_idle_enterer(void *data) { - int idle; + int idle=0; Epsilon_Client *cl; Epsilon_Response *response; Epsilon_Worker *worker; @@ -597,7 +602,6 @@ if (debug) printf("Idle state entered\n"); - /* * Send responses for completed thumbnails */ @@ -613,17 +617,16 @@ } if (cl && msg) { - if (debug) printf("%ld sending response to %d\n", - (long int)getpid(), cl->id); + if (debug) printf("%ld sending response to %d (%d)\n", + (long int)getpid(), cl->id, msg->mid); if (debug) printf("Client %p\n", cl->client); if (ecore_ipc_client_send(cl->client, 1,1,1,1,1,msg,sizeof(Epsilon_Message) + msg->bufsize) < 0) perror("write"); free(msg); } else { - printf("Client: %p, Msg: %p\n",cl,msg); + if (debug) printf("Client: %p, Msg: %p\n",cl,msg); } - free(response); } if (debug) printf("Finished responses\n"); @@ -651,8 +654,13 @@ epsilond_worker_clean(worker); } else { + if (debug) printf("Moving idle down to %d\n", idle); idle--; } + + if (debug) printf("Worker %d runtime: %f\n", worker->child, ecore_time_get() - worker->runtime); + } else { + if (debug) printf("Worker child pid not set, thumbs is: %d\n", ecore_list_count(worker->thumbs)); } } @@ -672,13 +680,17 @@ /* * No worker threads available, so quit trying to do work. */ - if (available < 1) + if (available < 1) { + if (debug) printf("No workers available\n"); break; + } } idle = ecore_list_count(queued_workers); + if (debug) printf("Idle: %d\n", idle); + /* * Fork off worker threads to begin thumbnailing. */ @@ -692,14 +704,19 @@ else printf ("**** Added worker - now %d\n", running_workers+1);*/ running_workers++; - if (!epsilond_worker_fork(worker)) + if (!epsilond_worker_fork(worker)) { + if (debug) printf("Error forking worker %p\n", worker); return 0; + } + } else { + if (debug) printf ("No thumbs to process\n"); } } else { idle--; } } + if (debug) printf("Idle: %d\n", idle); /* * FIXME: Detect idle time and exit after a specified interval |
From: Enlightenment C. <no...@cv...> - 2007-08-03 02:20:17
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon/src/bin Modified Files: epsilon_thumbd.c Log Message: Changes to ensure correct operation on large data sets =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/bin/epsilon_thumbd.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- epsilon_thumbd.c 29 Jul 2007 02:10:48 -0000 1.8 +++ epsilon_thumbd.c 3 Aug 2007 02:20:05 -0000 1.9 @@ -25,6 +25,8 @@ #endif #define EPSILON_WORKERS 4 +#define EPSILON_WORKER_RECONNECT_ATTEMPTS 5 +#define EPSILON_WORKER_RECONNECT_INTERVAL 100000 /* * Connected client requesting thumbnailing. @@ -124,6 +126,7 @@ * Setup the IPC server to handle completed notifications */ thumbd_server = ecore_ipc_server_add(ECORE_IPC_LOCAL_USER, EPSILOND_SOCK, 0, NULL); + ecore_ipc_server_client_limit_set(thumbd_server, 50, 0); /* * Prepare the handlers for worker IPC events @@ -542,6 +545,8 @@ int epsilond_worker_fork(Epsilon_Worker *worker) { + int attempts = 0; + /* * Begin iteration of the thumb list. */ @@ -571,11 +576,18 @@ /* * Connect back to the parent process. */ + + connect: worker->server = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, EPSILOND_SOCK, 0, NULL); if (worker->server) { if (debug) printf("Connecting to %s\n", EPSILOND_SOCK); } else { + if (attempts < EPSILON_WORKER_RECONNECT_ATTEMPTS) { + attempts++; + usleep(EPSILON_WORKER_RECONNECT_INTERVAL); + goto connect; + } if (debug) printf("Failed connection to %s\n", EPSILOND_SOCK); exit(1); } @@ -700,13 +712,10 @@ if (ecore_list_count(worker->thumbs)) { idle--; - /*if (!running_workers) epsilond_init_thumbd_server(gworkers); - else printf ("**** Added worker - now %d\n", running_workers+1);*/ running_workers++; if (!epsilond_worker_fork(worker)) { - if (debug) printf("Error forking worker %p\n", worker); - return 0; + return 1; } } else { if (debug) printf ("No thumbs to process\n"); @@ -762,6 +771,7 @@ * Setup the IPC server to handle requests */ thumb_server = ecore_ipc_server_add(ECORE_IPC_LOCAL_USER, EPSILON_SOCK, 0, NULL); + ecore_ipc_server_client_limit_set(thumb_server, 50, 0); free(buf); |
From: Enlightenment C. <no...@cv...> - 2007-08-03 04:49:00
|
Enlightenment CVS committal Author : chaos Project : e17 Module : libs/epsilon Dir : e17/libs/epsilon/src/plugins Modified Files: xine_thumbnailer.c Log Message: Make 'dark frame' skipping actually work =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/plugins/xine_thumbnailer.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- xine_thumbnailer.c 9 Jul 2007 16:10:36 -0000 1.3 +++ xine_thumbnailer.c 3 Aug 2007 04:48:58 -0000 1.4 @@ -17,6 +17,7 @@ #define XINE_THUMB_RETRY -10 #define XINE_THUMB_FAIL -11 #define XINE_THUMB_SUCCESS -9 +#define XINE_THUMBNAILER_DEBUG 0 typedef struct _epsilon_xine_param { @@ -139,8 +140,10 @@ if (rp) *rp = NULL; - if (!(dst = imlib_create_image (w, h))) + if (!(dst = imlib_create_image (w, h))) { + if (XINE_THUMBNAILER_DEBUG) printf("Couldn't create yv12_to_rgb imlib image..\n"); return XINE_THUMB_FAIL; + } imlib_context_set_image (dst); imlib_image_set_format ("argb"); @@ -196,13 +199,15 @@ if ((sy < 32) || (sy > 223)) { + if (XINE_THUMBNAILER_DEBUG) printf("Image too dark!..\n"); ret = XINE_THUMB_RETRY; } - else + else { ret = XINE_THUMB_SUCCESS; - free (*buf); - *buf = NULL; + free (*buf); + *buf = NULL; + } imlib_image_put_back_data ((DATA32 *) _rgb); @@ -268,6 +273,8 @@ goto done; } + if (XINE_THUMBNAILER_DEBUG) printf("Starting xine thumbnail process..\n"); + try_get_chance: new_perc = -1; new_time = req_time; @@ -279,6 +286,7 @@ if (!xine_play (param->stream, new_perc, 0)) { ret = XINE_THUMB_FAIL; + if (XINE_THUMBNAILER_DEBUG) printf("Coudln't play video %s..\n", e->src); goto close_stream; } } @@ -292,6 +300,7 @@ if (length < 0) { + if (XINE_THUMBNAILER_DEBUG) printf("Video is 0 length!..\n"); ret = XINE_THUMB_FAIL; goto close_stream; } @@ -314,7 +323,7 @@ if (!xine_get_current_frame (param->stream, &w, &h, &ratio, &format, NULL)) { attempts++; - if (attempts < 4) + if (attempts < 10) { if (req_time < 10000) req_time += 1000; @@ -325,12 +334,14 @@ } else { + if (XINE_THUMBNAILER_DEBUG) printf("Exhausted attempts to thumbnail..\n"); ret = XINE_THUMB_FAIL; goto close_stream; } } else if ((w <= 0) || (h <= 0)) { + if (XINE_THUMBNAILER_DEBUG) printf("Width/Height of video invalid: %d:%d..\n", w,h); ret = XINE_THUMB_FAIL; goto close_stream; } @@ -339,6 +350,7 @@ /* know we know the size, get a buffer for the snapshot */ if (!(buf = malloc (w * h * 2))) { + if (XINE_THUMBNAILER_DEBUG) printf("Couldn't allocate memory for thumbnail buffer..\n"); ret = XINE_THUMB_FAIL; goto close_stream; } @@ -347,12 +359,14 @@ if (!xine_get_current_frame (param->stream, &w, &h, &ratio, &format, buf)) { + if (XINE_THUMBNAILER_DEBUG) printf("Couldn't retrieve current video frame..\n"); ret = XINE_THUMB_FAIL; goto close_stream; } else if ((w <= 0) || (h <= 0)) { + if (XINE_THUMBNAILER_DEBUG) printf("Width/height of video invalid: %d:%d..\n",w,h); ret = XINE_THUMB_FAIL; goto close_stream; } @@ -377,7 +391,7 @@ { if (img) { - if (++attempts > 4) + if (++attempts > 10) goto close_stream; imlib_free_image (); img = NULL; @@ -393,6 +407,8 @@ req_time = 3000; goto try_get_chance; } + + if (XINE_THUMBNAILER_DEBUG) printf("Exhausted attempts to thumbnail pos 2..\n"); ret = XINE_THUMB_FAIL; goto close_stream; } @@ -400,6 +416,7 @@ else { + if (XINE_THUMBNAILER_DEBUG) printf("Couldn't complete yv12_to_rgb..\n"); ret = XINE_THUMB_FAIL; goto close_stream; } |