summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/lib/emotion_smart.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2005-04-15 07:27:02 +0000
committerCarsten Haitzler <raster@rasterman.com>2005-04-15 07:27:02 +0000
commit4c2a9d32f9f515bac025e7ec9770970369777679 (patch)
tree8aa36e793da544de73acc6b1c71d313cdbb11c5c /legacy/emotion/src/lib/emotion_smart.c
parent67ce5e1c1f3aca6d06531459dce03b552fc7f4b3 (diff)
simon treney's emotion patches - THANKs :o)
SVN revision: 14208
Diffstat (limited to '')
-rw-r--r--legacy/emotion/src/lib/emotion_smart.c61
1 files changed, 30 insertions, 31 deletions
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c
index 031ac790ab..12df051a16 100644
--- a/legacy/emotion/src/lib/emotion_smart.c
+++ b/legacy/emotion/src/lib/emotion_smart.c
@@ -88,8 +88,8 @@ static void _smart_clip_unset(Evas_Object * obj);
88/**********************************/ 88/**********************************/
89static Evas_Smart *smart = NULL; 89static Evas_Smart *smart = NULL;
90 90
91static Emotion_Video_Module * 91static unsigned char
92_emotion_module_open(const char *name) 92_emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **mod, void **video)
93{ 93{
94 void *handle; 94 void *handle;
95 char buf[4096]; 95 char buf[4096];
@@ -98,34 +98,31 @@ _emotion_module_open(const char *name)
98 handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL); 98 handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL);
99 if (handle) 99 if (handle)
100 { 100 {
101 Emotion_Video_Module *(*func_module_open) (void); 101 unsigned char (*func_module_open)(Evas_Object *, Emotion_Video_Module **, void **);
102 102
103 func_module_open = dlsym(handle, "module_open"); 103 func_module_open = dlsym(handle, "module_open");
104 if (func_module_open) 104 if (func_module_open)
105 { 105 {
106 Emotion_Video_Module *mod; 106 if (func_module_open(obj, mod, video))
107
108 mod = func_module_open();
109 if (mod)
110 { 107 {
111 mod->handle = handle; 108 (*mod)->handle = handle;
112 return mod; 109 return 1;
113 } 110 }
114 } 111 }
115 dlclose(handle); 112 dlclose(handle);
116 } 113 }
117 return NULL; 114 return 0;
118} 115}
119 116
120static void 117static void
121_emotion_module_close(Emotion_Video_Module *mod) 118_emotion_module_close(Emotion_Video_Module *mod, void *video)
122{ 119{
123 void *handle; 120 void *handle;
124 void (*module_close) (Emotion_Video_Module *module); 121 void (*module_close) (Emotion_Video_Module *module, void *);
125 122
126 handle = mod->handle; 123 handle = mod->handle;
127 module_close = dlsym(handle, "module_close"); 124 module_close = dlsym(handle, "module_close");
128 if (module_close) module_close(mod); 125 if (module_close) module_close(mod, video);
129 dlclose(handle); 126 dlclose(handle);
130} 127}
131 128
@@ -168,24 +165,23 @@ emotion_object_file_set(Evas_Object *obj, const char *file)
168 int w, h; 165 int w, h;
169 166
170 sd->file = strdup(file); 167 sd->file = strdup(file);
171 if ((sd->video) && (sd->module)) 168 if (sd->module)
172 { 169 {
173 sd->module->file_close(sd->video); 170 sd->module->file_close(sd->video);
174 sd->video = NULL;
175 evas_object_image_size_set(sd->obj, 0, 0); 171 evas_object_image_size_set(sd->obj, 0, 0);
176 } 172 }
177 if (sd->module) _emotion_module_close(sd->module); 173 if (!sd->module || !sd->video)
178 sd->module = _emotion_module_open("emotion_decoder_xine.so"); 174 {
179 if (!sd->module) return; 175 if (!_emotion_module_open("emotion_decoder_xine.so", obj, &sd->module, &sd->video))
180 sd->video = sd->module->file_open(sd->file, obj); 176 return;
181 if (sd->video) 177 }
182 { 178 if (!sd->module->file_open(sd->file, obj, sd->video))
183 sd->module->size_get(sd->video, &w, &h); 179 return;
184 evas_object_image_size_set(sd->obj, w, h); 180 sd->module->size_get(sd->video, &w, &h);
185 sd->ratio = sd->module->ratio_get(sd->video); 181 evas_object_image_size_set(sd->obj, w, h);
186 sd->pos = 0.0; 182 sd->ratio = sd->module->ratio_get(sd->video);
187 if (sd->play) sd->module->play(sd->video, 0.0); 183 sd->pos = 0.0;
188 } 184 if (sd->play) sd->module->play(sd->video, 0.0);
189 } 185 }
190 else 186 else
191 { 187 {
@@ -195,8 +191,6 @@ emotion_object_file_set(Evas_Object *obj, const char *file)
195 sd->video = NULL; 191 sd->video = NULL;
196 evas_object_image_size_set(sd->obj, 0, 0); 192 evas_object_image_size_set(sd->obj, 0, 0);
197 } 193 }
198 if (sd->module) _emotion_module_close(sd->module);
199 sd->module = NULL;
200 } 194 }
201} 195}
202 196
@@ -811,6 +805,12 @@ _emotion_decode_stop(Evas_Object *obj)
811} 805}
812 806
813void 807void
808_emotion_playback_finished(Evas_Object *obj)
809{
810 evas_object_smart_callback_call(obj, "playback_finished", NULL);
811}
812
813void
814_emotion_channels_change(Evas_Object *obj) 814_emotion_channels_change(Evas_Object *obj)
815{ 815{
816 Smart_Data *sd; 816 Smart_Data *sd;
@@ -1025,11 +1025,10 @@ static void
1025_smart_del(Evas_Object * obj) 1025_smart_del(Evas_Object * obj)
1026{ 1026{
1027 Smart_Data *sd; 1027 Smart_Data *sd;
1028
1029 sd = evas_object_smart_data_get(obj); 1028 sd = evas_object_smart_data_get(obj);
1030 if (!sd) return; 1029 if (!sd) return;
1031 if (sd->video) sd->module->file_close(sd->video); 1030 if (sd->video) sd->module->file_close(sd->video);
1032 if (sd->module) _emotion_module_close(sd->module); 1031 if (sd->module) _emotion_module_close(sd->module, sd->video);
1033 evas_object_del(sd->obj); 1032 evas_object_del(sd->obj);
1034 if (sd->file) free(sd->file); 1033 if (sd->file) free(sd->file);
1035 if (sd->job) ecore_job_del(sd->job); 1034 if (sd->job) ecore_job_del(sd->job);