* 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
This commit is contained in:
moom16 2005-05-04 21:32:37 +00:00 committed by moom16
parent f41eaabb1a
commit 9eee3ff2ce
2 changed files with 26 additions and 10 deletions

View File

@ -55,6 +55,7 @@ typedef enum _Emotion_Meta_Info Emotion_Meta_Info;
/* api calls available */ /* api calls available */
Evas_Object *emotion_object_add (Evas *evas); 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); void emotion_object_file_set (Evas_Object *obj, const char *file);
const char *emotion_object_file_get (Evas_Object *obj); const char *emotion_object_file_get (Evas_Object *obj);
void emotion_object_play_set (Evas_Object *obj, Evas_Bool play); void emotion_object_play_set (Evas_Object *obj, Evas_Bool play);

View File

@ -136,14 +136,13 @@ emotion_object_add(Evas *evas)
return evas_object_smart_add(evas, smart); return evas_object_smart_add(evas, smart);
} }
void Evas_Bool
emotion_object_file_set(Evas_Object *obj, const char *file) emotion_object_init(Evas_Object *obj)
{ {
Smart_Data *sd; Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if ((file) && (sd->file) && (!strcmp(file, sd->file))) return;
if (sd->file) free(sd->file); if (sd->file) free(sd->file);
sd->file = NULL; sd->file = NULL;
if (sd->title) free(sd->title); if (sd->title) free(sd->title);
@ -160,21 +159,37 @@ emotion_object_file_set(Evas_Object *obj, const char *file)
sd->pos = 0; sd->pos = 0;
sd->seek_pos = 0; sd->seek_pos = 0;
sd->len = 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)) if ((file) && (strlen(file) > 0))
{ {
int w, h; int w, h;
if (!emotion_object_init(obj))
return;
sd->file = strdup(file); sd->file = strdup(file);
if (sd->module) if (sd->module)
{ {
sd->module->file_close(sd->video); sd->module->file_close(sd->video);
evas_object_image_size_set(sd->obj, 0, 0); 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)) if (!sd->module->file_open(sd->file, obj, sd->video))
return; return;
sd->module->size_get(sd->video, &w, &h); sd->module->size_get(sd->video, &w, &h);
@ -185,7 +200,7 @@ emotion_object_file_set(Evas_Object *obj, const char *file)
} }
else else
{ {
if (sd->video) if (sd->video && sd->module)
{ {
sd->module->file_close(sd->video); sd->module->file_close(sd->video);
sd->video = NULL; sd->video = NULL;