summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/lib/emotion_smart.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2007-03-13 02:30:14 +0000
committerCarsten Haitzler <raster@rasterman.com>2007-03-13 02:30:14 +0000
commit2dbc5651d4cc39b6e836a0f88d731f5c7755d163 (patch)
treee550975cdf41c75b190c0349a925018a7a4d29d9 /legacy/emotion/src/lib/emotion_smart.c
parent66954e5331285cec0f88e4fde7f1ba071c893664 (diff)
move emotion to fix latency on video load, deadlocks on stop/shutdown etc.
SVN revision: 28679
Diffstat (limited to 'legacy/emotion/src/lib/emotion_smart.c')
-rw-r--r--legacy/emotion/src/lib/emotion_smart.c51
1 files changed, 44 insertions, 7 deletions
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c
index e071df7a1d..71a81a1c40 100644
--- a/legacy/emotion/src/lib/emotion_smart.c
+++ b/legacy/emotion/src/lib/emotion_smart.c
@@ -62,6 +62,8 @@ struct _Smart_Data
62 int button_num; 62 int button_num;
63 int button; 63 int button;
64 } spu; 64 } spu;
65
66 Emotion_Module_Options module_options;
65}; 67};
66 68
67static void _mouse_move(void *data, Evas *ev, Evas_Object *obj, void *event_info); 69static void _mouse_move(void *data, Evas *ev, Evas_Object *obj, void *event_info);
@@ -95,18 +97,20 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **
95{ 97{
96 void *handle; 98 void *handle;
97 char buf[4096]; 99 char buf[4096];
100 Smart_Data *sd;
98 101
102 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
99 snprintf(buf, sizeof(buf), "%s%s", PACKAGE_LIB_DIR"/emotion/", 103 snprintf(buf, sizeof(buf), "%s%s", PACKAGE_LIB_DIR"/emotion/",
100 name); 104 name);
101 handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL); 105 handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL);
102 if (handle) 106 if (handle)
103 { 107 {
104 unsigned char (*func_module_open)(Evas_Object *, Emotion_Video_Module **, void **); 108 unsigned char (*func_module_open)(Evas_Object *, Emotion_Video_Module **, void **, Emotion_Module_Options *);
105 109
106 func_module_open = dlsym(handle, "module_open"); 110 func_module_open = dlsym(handle, "module_open");
107 if (func_module_open) 111 if (func_module_open)
108 { 112 {
109 if (func_module_open(obj, mod, video)) 113 if (func_module_open(obj, mod, video, &(sd->module_options)))
110 { 114 {
111 (*mod)->handle = handle; 115 (*mod)->handle = handle;
112 return 1; 116 return 1;
@@ -132,7 +136,12 @@ _emotion_module_close(Emotion_Video_Module *mod, void *video)
132 handle = mod->handle; 136 handle = mod->handle;
133 module_close = dlsym(handle, "module_close"); 137 module_close = dlsym(handle, "module_close");
134 if ((module_close) && (video)) module_close(mod, video); 138 if ((module_close) && (video)) module_close(mod, video);
135 dlclose(handle); 139 /* FIXME: we can't go dlclosing here as a thread still may be running from
140 * the module - this in theory will leak- but it shouldnt be too bad and
141 * mean that once a module is dlopened() it cant be closed - its refcount
142 * will just keep going up
143 */
144// dlclose(handle);
136} 145}
137 146
138/*******************************/ 147/*******************************/
@@ -148,6 +157,23 @@ emotion_object_add(Evas *evas)
148 return evas_object_smart_add(evas, smart); 157 return evas_object_smart_add(evas, smart);
149} 158}
150 159
160EAPI void
161emotion_object_module_option_set(Evas_Object *obj, const char *opt, const char *val)
162{
163 Smart_Data *sd;
164
165 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
166 if ((!opt) || (!val)) return;
167 if (!strcmp(opt, "video"))
168 {
169 if (!strcmp(val, "off")) sd->module_options.no_video = 1;
170 }
171 else if (!strcmp(opt, "audio"))
172 {
173 if (!strcmp(val, "off")) sd->module_options.no_audio = 1;
174 }
175}
176
151EAPI Evas_Bool 177EAPI Evas_Bool
152emotion_object_init(Evas_Object *obj, const char *module_filename) 178emotion_object_init(Evas_Object *obj, const char *module_filename)
153{ 179{
@@ -172,10 +198,12 @@ emotion_object_init(Evas_Object *obj, const char *module_filename)
172 sd->seek_pos = 0; 198 sd->seek_pos = 0;
173 sd->len = 0; 199 sd->len = 0;
174 200
175 if (!sd->module || !sd->video) 201 if ((!sd->module) || (!sd->video))
176 if (!_emotion_module_open(module_filename, obj, &sd->module, &sd->video)) 202 {
177 return 0; 203 if (!_emotion_module_open(module_filename, obj,
178 204 &sd->module, &sd->video))
205 return 0;
206 }
179 return 1; 207 return 1;
180} 208}
181 209
@@ -1119,6 +1147,7 @@ static void
1119_smart_add(Evas_Object * obj) 1147_smart_add(Evas_Object * obj)
1120{ 1148{
1121 Smart_Data *sd; 1149 Smart_Data *sd;
1150 unsigned int *pixel;
1122 1151
1123 sd = calloc(1, sizeof(Smart_Data)); 1152 sd = calloc(1, sizeof(Smart_Data));
1124 if (!sd) return; 1153 if (!sd) return;
@@ -1130,6 +1159,12 @@ _smart_add(Evas_Object * obj)
1130 sd->ratio = 1.0; 1159 sd->ratio = 1.0;
1131 sd->spu.button = -1; 1160 sd->spu.button = -1;
1132 evas_object_image_alpha_set(sd->obj, 0); 1161 evas_object_image_alpha_set(sd->obj, 0);
1162 pixel = evas_object_image_data_get(obj, 1);
1163 if (pixel)
1164 {
1165 *pixel = 0xff000000;
1166 evas_object_image_data_set(obj, pixel);
1167 }
1133 evas_object_smart_data_set(obj, sd); 1168 evas_object_smart_data_set(obj, sd);
1134} 1169}
1135 1170
@@ -1141,7 +1176,9 @@ _smart_del(Evas_Object * obj)
1141 if (!sd) return; 1176 if (!sd) return;
1142 printf("DEL: sd->video = %p\n", sd->video); 1177 printf("DEL: sd->video = %p\n", sd->video);
1143 if (sd->video) sd->module->file_close(sd->video); 1178 if (sd->video) sd->module->file_close(sd->video);
1179 printf("MOD CLOSE: sd->video = %p\n", sd->video);
1144 _emotion_module_close(sd->module, sd->video); 1180 _emotion_module_close(sd->module, sd->video);
1181 printf("DEL SD: sd = %p\n", sd);
1145 evas_object_del(sd->obj); 1182 evas_object_del(sd->obj);
1146 if (sd->file) free(sd->file); 1183 if (sd->file) free(sd->file);
1147 if (sd->job) ecore_job_del(sd->job); 1184 if (sd->job) ecore_job_del(sd->job);