Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/emotion

Dir     : e17/libs/emotion/src/lib


Modified Files:
        emotion_private.h emotion_smart.c 


Log Message:


simon treney's emotion patches - THANKs :o)

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/emotion/src/lib/emotion_private.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- emotion_private.h   24 Jul 2004 09:53:00 -0000      1.3
+++ emotion_private.h   15 Apr 2005 07:27:02 -0000      1.4
@@ -19,9 +19,9 @@
 
 struct _Emotion_Video_Module
 {
-   int          (*init) (void);
-   int          (*shutdown) (void);
-   void *       (*file_open) (const char *file, Evas_Object *obj);
+   unsigned char (*init) (Evas_Object *obj, void **video);
+   int          (*shutdown) (void *video);
+   unsigned char (*file_open) (const char *file, Evas_Object *obj, void 
*video);
    void         (*file_close) (void *ef);
    void         (*play) (void *ef, double pos);
    void         (*stop) (void *ef);
@@ -75,6 +75,7 @@
 void  _emotion_video_pos_update(Evas_Object *obj, double pos, double len);
 void  _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio);
 void  _emotion_decode_stop(Evas_Object *obj);
+void  _emotion_playback_finished(Evas_Object *obj);
 void  _emotion_channels_change(Evas_Object *obj);
 void  _emotion_title_set(Evas_Object *obj, char *title);
 void  _emotion_progress_set(Evas_Object *obj, char *info, double stat);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/emotion/src/lib/emotion_smart.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- emotion_smart.c     24 Jul 2004 09:53:00 -0000      1.8
+++ emotion_smart.c     15 Apr 2005 07:27:02 -0000      1.9
@@ -88,8 +88,8 @@
 /**********************************/
 static Evas_Smart  *smart = NULL;
 
-static Emotion_Video_Module *
-_emotion_module_open(const char *name)
+static unsigned char
+_emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module 
**mod, void **video)
 {
    void *handle;
    char buf[4096];
@@ -98,34 +98,31 @@
    handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL);
    if (handle)
      {
-       Emotion_Video_Module *(*func_module_open) (void);
+       unsigned char (*func_module_open)(Evas_Object *, Emotion_Video_Module 
**, void **);
        
        func_module_open = dlsym(handle, "module_open");
        if (func_module_open)
          {
-            Emotion_Video_Module *mod;
-            
-            mod = func_module_open();
-            if (mod)
+            if (func_module_open(obj, mod, video))
               {
-                 mod->handle = handle;
-                 return mod;
+                 (*mod)->handle = handle;
+                 return 1;
               }
          }
        dlclose(handle);
      }
-   return NULL;
+   return 0;
 }
 
 static void
-_emotion_module_close(Emotion_Video_Module *mod)
+_emotion_module_close(Emotion_Video_Module *mod, void *video)
 {
    void *handle;
-   void (*module_close) (Emotion_Video_Module *module);
+   void (*module_close) (Emotion_Video_Module *module, void *);
    
    handle = mod->handle;
    module_close = dlsym(handle, "module_close");
-   if (module_close) module_close(mod);
+   if (module_close) module_close(mod, video);
    dlclose(handle);
 }
 
@@ -168,24 +165,23 @@
        int w, h;
        
        sd->file = strdup(file);
-       if ((sd->video) && (sd->module))
+       if (sd->module)
          {
             sd->module->file_close(sd->video);
-            sd->video = NULL;
             evas_object_image_size_set(sd->obj, 0, 0);
          }
-       if (sd->module) _emotion_module_close(sd->module);
-       sd->module = _emotion_module_open("emotion_decoder_xine.so");
-       if (!sd->module) return;
-       sd->video = sd->module->file_open(sd->file, obj);
-       if (sd->video)
-         {
-            sd->module->size_get(sd->video, &w, &h);
-            evas_object_image_size_set(sd->obj, w, h);
-            sd->ratio = sd->module->ratio_get(sd->video);
-            sd->pos = 0.0;
-            if (sd->play) sd->module->play(sd->video, 0.0);
-         }
+       if (!sd->module || !sd->video)
+   {
+      if (!_emotion_module_open("emotion_decoder_xine.so", obj, &sd->module, 
&sd->video))
+         return;
+   }
+   if (!sd->module->file_open(sd->file, obj, sd->video))
+      return;
+   sd->module->size_get(sd->video, &w, &h);
+   evas_object_image_size_set(sd->obj, w, h);
+   sd->ratio = sd->module->ratio_get(sd->video);
+   sd->pos = 0.0;
+   if (sd->play) sd->module->play(sd->video, 0.0);
      }
    else
      {
@@ -195,8 +191,6 @@
             sd->video = NULL;
             evas_object_image_size_set(sd->obj, 0, 0);
          }
-       if (sd->module) _emotion_module_close(sd->module);
-       sd->module = NULL;
      }
 }
 
@@ -811,6 +805,12 @@
 }
 
 void
+_emotion_playback_finished(Evas_Object *obj)
+{
+   evas_object_smart_callback_call(obj, "playback_finished", NULL);
+}
+
+void
 _emotion_channels_change(Evas_Object *obj)
 {
    Smart_Data *sd;
@@ -1025,11 +1025,10 @@
 _smart_del(Evas_Object * obj)
 {
    Smart_Data *sd;
-   
    sd = evas_object_smart_data_get(obj);
    if (!sd) return;
    if (sd->video) sd->module->file_close(sd->video);
-   if (sd->module) _emotion_module_close(sd->module);
+   if (sd->module) _emotion_module_close(sd->module, sd->video);
    evas_object_del(sd->obj);
    if (sd->file) free(sd->file);
    if (sd->job) ecore_job_del(sd->job);




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to