summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/lib/emotion_smart.c
diff options
context:
space:
mode:
authordoursse <doursse>2005-10-02 07:34:36 +0000
committerdoursse <doursse@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2005-10-02 07:34:36 +0000
commitbad4d6e848af68f23d207b55d1fd5d4c741336ac (patch)
treec33956c097a4c070700db976017b969b4741db52 /legacy/emotion/src/lib/emotion_smart.c
parentdc5e3e07afcc52d47b8d80f40ef06c95c819a4a3 (diff)
emotion can use gstreamer, now
SVN revision: 17103
Diffstat (limited to '')
-rw-r--r--legacy/emotion/src/lib/emotion_smart.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c
index b9c6be3ead..1d02acd9ed 100644
--- a/legacy/emotion/src/lib/emotion_smart.c
+++ b/legacy/emotion/src/lib/emotion_smart.c
@@ -35,6 +35,8 @@ struct _Smart_Data
35 Emotion_Video_Module *module; 35 Emotion_Video_Module *module;
36 void *video; 36 void *video;
37 37
38 char *module_name;
39
38 char *file; 40 char *file;
39 Evas_Object *obj; 41 Evas_Object *obj;
40 double ratio; 42 double ratio;
@@ -94,12 +96,15 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **
94 void *handle; 96 void *handle;
95 char buf[4096]; 97 char buf[4096];
96 98
97 snprintf(buf, sizeof(buf), "%s/%s", PACKAGE_LIB_DIR"/emotion/", name); 99 snprintf(buf, sizeof(buf), "%s%s", PACKAGE_LIB_DIR"/emotion/",
100 name);
101 printf ("module : %s\n", buf);
98 handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL); 102 handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL);
99 if (handle) 103 if (handle)
100 { 104 {
101 unsigned char (*func_module_open)(Evas_Object *, Emotion_Video_Module **, void **); 105 unsigned char (*func_module_open)(Evas_Object *, Emotion_Video_Module **, void **);
102 106
107 printf ("module opened\n");
103 func_module_open = dlsym(handle, "module_open"); 108 func_module_open = dlsym(handle, "module_open");
104 if (func_module_open) 109 if (func_module_open)
105 { 110 {
@@ -111,6 +116,12 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **
111 } 116 }
112 dlclose(handle); 117 dlclose(handle);
113 } 118 }
119 else
120 {
121 char *err;
122 err = dlerror();
123 printf ("pas de module : %s\n", err);
124 }
114 return 0; 125 return 0;
115} 126}
116 127
@@ -129,6 +140,9 @@ _emotion_module_close(Emotion_Video_Module *mod, void *video)
129/*******************************/ 140/*******************************/
130/* Externally accessible calls */ 141/* Externally accessible calls */
131/*******************************/ 142/*******************************/
143
144
145
132Evas_Object * 146Evas_Object *
133emotion_object_add(Evas *evas) 147emotion_object_add(Evas *evas)
134{ 148{
@@ -137,7 +151,7 @@ emotion_object_add(Evas *evas)
137} 151}
138 152
139Evas_Bool 153Evas_Bool
140emotion_object_init(Evas_Object *obj) 154emotion_object_init(Evas_Object *obj, const char *module_filename)
141{ 155{
142 Smart_Data *sd; 156 Smart_Data *sd;
143 157
@@ -162,10 +176,14 @@ emotion_object_init(Evas_Object *obj)
162 176
163 if (!sd->module || !sd->video) 177 if (!sd->module || !sd->video)
164 { 178 {
165 if (!_emotion_module_open("emotion_decoder_xine.so", obj, &sd->module, &sd->video)) 179 if (!_emotion_module_open(module_filename, obj, &sd->module, &sd->video))
166 return 0; 180 return 0;
167 } 181 }
168 182
183 if (!sd->module || !sd->video)
184 if (!_emotion_module_open(module_filename, obj, &sd->module, &sd->video))
185 return 0;
186
169 return 1; 187 return 1;
170} 188}
171 189
@@ -177,27 +195,22 @@ emotion_object_file_set(Evas_Object *obj, const char *file)
177 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 195 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
178 196
179 if ((file) && (sd->file) && (!strcmp(file, sd->file))) return; 197 if ((file) && (sd->file) && (!strcmp(file, sd->file))) return;
180
181 if ((file) && (strlen(file) > 0)) 198 if ((file) && (strlen(file) > 0))
182 { 199 {
183 int w, h; 200 int w, h;
184
185 if (!emotion_object_init(obj))
186 return;
187 sd->file = strdup(file); 201 sd->file = strdup(file);
188 if (sd->module) 202 if (sd->module)
189 { 203 {
190 sd->module->file_close(sd->video); 204 sd->module->file_close(sd->video);
191 evas_object_image_size_set(sd->obj, 0, 0); 205 evas_object_image_size_set(sd->obj, 0, 0);
192 } 206 }
193 if (!sd->module->file_open(sd->file, obj, sd->video)) 207 if (!sd->module->file_open(sd->file, obj, sd->video))
194 return; 208 return;
195 sd->module->size_get(sd->video, &w, &h); 209 sd->module->size_get(sd->video, &w, &h);
196 evas_object_image_size_set(sd->obj, w, h); 210 evas_object_image_size_set(sd->obj, w, h);
197 sd->ratio = sd->module->ratio_get(sd->video); 211 sd->ratio = sd->module->ratio_get(sd->video);
198 sd->pos = 0.0; 212 sd->pos = 0.0;
199 if (sd->play) 213 if (sd->play) sd->module->play(sd->video, 0.0);
200 sd->module->play(sd->video, 0.0);
201 } 214 }
202 else 215 else
203 { 216 {
@@ -238,8 +251,11 @@ emotion_object_play_get(Evas_Object *obj)
238{ 251{
239 Smart_Data *sd; 252 Smart_Data *sd;
240 253
254 printf ("play get\n");
241 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); 255 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
256 printf ("play get1\n");
242 if (!sd->video) return 0; 257 if (!sd->video) return 0;
258 printf ("play get2\n");
243 return sd->play; 259 return sd->play;
244} 260}
245 261
@@ -810,7 +826,7 @@ _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio)
810 Smart_Data *sd; 826 Smart_Data *sd;
811 int iw, ih; 827 int iw, ih;
812 int changed = 0; 828 int changed = 0;
813 829 printf ("frame resize %d %d\n", w, h);
814 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 830 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
815 evas_object_image_size_get(sd->obj, &iw, &ih); 831 evas_object_image_size_get(sd->obj, &iw, &ih);
816 if ((w != iw) || (h != ih)) 832 if ((w != iw) || (h != ih))