From 9eee3ff2ce97431667ed3eee78a2887ba80fa5ff Mon Sep 17 00:00:00 2001 From: moom16 Date: Wed, 4 May 2005 21:32:37 +0000 Subject: [PATCH] * We can now initialize the module without having to play a file (we can now initialize the emotion module on the start of the application and so speed up the first play) SVN revision: 14606 --- legacy/emotion/src/lib/Emotion.h | 1 + legacy/emotion/src/lib/emotion_smart.c | 35 ++++++++++++++++++-------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/legacy/emotion/src/lib/Emotion.h b/legacy/emotion/src/lib/Emotion.h index 01a578f753..e8de3c190f 100644 --- a/legacy/emotion/src/lib/Emotion.h +++ b/legacy/emotion/src/lib/Emotion.h @@ -55,6 +55,7 @@ typedef enum _Emotion_Meta_Info Emotion_Meta_Info; /* api calls available */ Evas_Object *emotion_object_add (Evas *evas); +Evas_Bool emotion_object_init (Evas_Object *obj); void emotion_object_file_set (Evas_Object *obj, const char *file); const char *emotion_object_file_get (Evas_Object *obj); void emotion_object_play_set (Evas_Object *obj, Evas_Bool play); diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c index 64be4bc0df..b49f097921 100644 --- a/legacy/emotion/src/lib/emotion_smart.c +++ b/legacy/emotion/src/lib/emotion_smart.c @@ -136,14 +136,13 @@ emotion_object_add(Evas *evas) return evas_object_smart_add(evas, smart); } -void -emotion_object_file_set(Evas_Object *obj, const char *file) +Evas_Bool +emotion_object_init(Evas_Object *obj) { Smart_Data *sd; E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); - - if ((file) && (sd->file) && (!strcmp(file, sd->file))) return; + if (sd->file) free(sd->file); sd->file = NULL; if (sd->title) free(sd->title); @@ -160,21 +159,37 @@ emotion_object_file_set(Evas_Object *obj, const char *file) sd->pos = 0; sd->seek_pos = 0; sd->len = 0; + + if (!sd->module || !sd->video) + { + if (!_emotion_module_open("emotion_decoder_xine.so", obj, &sd->module, &sd->video)) + return 0; + } + + return 1; +} + +void +emotion_object_file_set(Evas_Object *obj, const char *file) +{ + Smart_Data *sd; + + E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); + + if ((file) && (sd->file) && (!strcmp(file, sd->file))) return; + if ((file) && (strlen(file) > 0)) { int w, h; + if (!emotion_object_init(obj)) + return; sd->file = strdup(file); if (sd->module) { sd->module->file_close(sd->video); evas_object_image_size_set(sd->obj, 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); @@ -185,7 +200,7 @@ emotion_object_file_set(Evas_Object *obj, const char *file) } else { - if (sd->video) + if (sd->video && sd->module) { sd->module->file_close(sd->video); sd->video = NULL;