Enlightenment CVS committal Author : raster Project : e17 Module : libs/emotion
Dir : e17/libs/emotion/src/lib Modified Files: Emotion.h emotion_private.h emotion_smart.c Log Message: move emotion to fix latency on video load, deadlocks on stop/shutdown etc. =================================================================== RCS file: /cvs/e/e17/libs/emotion/src/lib/Emotion.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- Emotion.h 6 Sep 2006 07:12:24 -0000 1.11 +++ Emotion.h 13 Mar 2007 02:30:14 -0000 1.12 @@ -87,6 +87,7 @@ /* api calls available */ EAPI Evas_Object *emotion_object_add (Evas *evas); +EAPI void emotion_object_module_option_set (Evas_Object *obj, const char *opt, const char *val); EAPI Evas_Bool emotion_object_init (Evas_Object *obj, const char *module_filename); EAPI void emotion_object_file_set (Evas_Object *obj, const char *filename); EAPI const char *emotion_object_file_get (Evas_Object *obj); =================================================================== RCS file: /cvs/e/e17/libs/emotion/src/lib/emotion_private.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- emotion_private.h 14 May 2006 14:32:02 -0000 1.12 +++ emotion_private.h 13 Mar 2007 02:30:14 -0000 1.13 @@ -23,6 +23,7 @@ typedef enum _Emotion_Format Emotion_Format; typedef enum _Emotion_Vis Emotion_Vis; typedef struct _Emotion_Video_Module Emotion_Video_Module; +typedef struct _Emotion_Module_Options Emotion_Module_Options; enum _Emotion_Format { @@ -55,9 +56,15 @@ EMOTION_VIS_LIBVISUAL_PLASMA }; +struct _Emotion_Module_Options +{ + unsigned char no_video : 1; + unsigned char no_audio : 1; +}; + struct _Emotion_Video_Module { - unsigned char (*init) (Evas_Object *obj, void **video); + unsigned char (*init) (Evas_Object *obj, void **video, Emotion_Module_Options *opt); int (*shutdown) (void *video); unsigned char (*file_open) (const char *file, Evas_Object *obj, void *video); void (*file_close) (void *ef); =================================================================== RCS file: /cvs/e/e17/libs/emotion/src/lib/emotion_smart.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -3 -r1.24 -r1.25 --- emotion_smart.c 3 Jan 2007 06:24:25 -0000 1.24 +++ emotion_smart.c 13 Mar 2007 02:30:14 -0000 1.25 @@ -62,6 +62,8 @@ int button_num; int button; } spu; + + Emotion_Module_Options module_options; }; static void _mouse_move(void *data, Evas *ev, Evas_Object *obj, void *event_info); @@ -95,18 +97,20 @@ { void *handle; char buf[4096]; + Smart_Data *sd; + E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); snprintf(buf, sizeof(buf), "%s%s", PACKAGE_LIB_DIR"/emotion/", name); handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL); if (handle) { - unsigned char (*func_module_open)(Evas_Object *, Emotion_Video_Module **, void **); + unsigned char (*func_module_open)(Evas_Object *, Emotion_Video_Module **, void **, Emotion_Module_Options *); func_module_open = dlsym(handle, "module_open"); if (func_module_open) { - if (func_module_open(obj, mod, video)) + if (func_module_open(obj, mod, video, &(sd->module_options))) { (*mod)->handle = handle; return 1; @@ -132,7 +136,12 @@ handle = mod->handle; module_close = dlsym(handle, "module_close"); if ((module_close) && (video)) module_close(mod, video); - dlclose(handle); + /* FIXME: we can't go dlclosing here as a thread still may be running from + * the module - this in theory will leak- but it shouldnt be too bad and + * mean that once a module is dlopened() it cant be closed - its refcount + * will just keep going up + */ +// dlclose(handle); } /*******************************/ @@ -148,6 +157,23 @@ return evas_object_smart_add(evas, smart); } +EAPI void +emotion_object_module_option_set(Evas_Object *obj, const char *opt, const char *val) +{ + Smart_Data *sd; + + E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); + if ((!opt) || (!val)) return; + if (!strcmp(opt, "video")) + { + if (!strcmp(val, "off")) sd->module_options.no_video = 1; + } + else if (!strcmp(opt, "audio")) + { + if (!strcmp(val, "off")) sd->module_options.no_audio = 1; + } +} + EAPI Evas_Bool emotion_object_init(Evas_Object *obj, const char *module_filename) { @@ -172,10 +198,12 @@ sd->seek_pos = 0; sd->len = 0; - if (!sd->module || !sd->video) - if (!_emotion_module_open(module_filename, obj, &sd->module, &sd->video)) - return 0; - + if ((!sd->module) || (!sd->video)) + { + if (!_emotion_module_open(module_filename, obj, + &sd->module, &sd->video)) + return 0; + } return 1; } @@ -1119,6 +1147,7 @@ _smart_add(Evas_Object * obj) { Smart_Data *sd; + unsigned int *pixel; sd = calloc(1, sizeof(Smart_Data)); if (!sd) return; @@ -1130,6 +1159,12 @@ sd->ratio = 1.0; sd->spu.button = -1; evas_object_image_alpha_set(sd->obj, 0); + pixel = evas_object_image_data_get(obj, 1); + if (pixel) + { + *pixel = 0xff000000; + evas_object_image_data_set(obj, pixel); + } evas_object_smart_data_set(obj, sd); } @@ -1141,7 +1176,9 @@ if (!sd) return; printf("DEL: sd->video = %p\n", sd->video); if (sd->video) sd->module->file_close(sd->video); + printf("MOD CLOSE: sd->video = %p\n", sd->video); _emotion_module_close(sd->module, sd->video); + printf("DEL SD: sd = %p\n", sd); evas_object_del(sd->obj); if (sd->file) free(sd->file); if (sd->job) ecore_job_del(sd->job); ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs