void generic_module_shutdown(void);
#endif
-Eina_Hash *_emotion_backends = NULL;
-Eina_Array *_emotion_modules = NULL;
+static Eina_Hash *_emotion_backends = NULL;
+static Eina_Array *_emotion_modules = NULL;
static void
_emotion_modules_load(void)
{
int static_modules = 0;
+ _emotion_backends = eina_hash_string_small_new(free);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(_emotion_backends, EINA_FALSE);
+
_emotion_modules_load();
/* Init static module */
INF("unregister module=%s", name);
return eina_hash_del_by_key(_emotion_backends, name);
}
+
+struct _Emotion_Engine_Instance
+{
+ Emotion_Video_Module *api;
+ Evas_Object *obj;
+ char *name;
+ void *data;
+};
+
+#define EMOTION_ENGINE_INSTANCE_CHECK(inst, meth, ...) \
+ do \
+ { \
+ if (!inst) \
+ { \
+ DBG("no instance to call "#meth); \
+ return __VA_ARGS__; \
+ } \
+ if (!inst->api->meth) \
+ { \
+ DBG("no "#meth" in instance=%p", inst); \
+ return __VA_ARGS__; \
+ } \
+ } \
+ while (0)
+
+#define EMOTION_ENGINE_INSTANCE_CALL(inst, meth, ...) \
+ do \
+ { \
+ EMOTION_ENGINE_INSTANCE_CHECK(inst, meth); \
+ inst->api->meth(inst->data, ## __VA_ARGS__); \
+ } \
+ while (0)
+
+#define EMOTION_ENGINE_INSTANCE_CALL_RET(inst, meth, retval, ...) \
+ do \
+ { \
+ EMOTION_ENGINE_INSTANCE_CHECK(inst, meth, retval); \
+ return inst->api->meth(inst->data, ## __VA_ARGS__); \
+ } \
+ while (0)
+
+
+static const char *_backend_priority[] = {
+ "gstreamer",
+ "xine",
+ "generic"
+};
+
+Emotion_Engine_Instance *
+emotion_engine_instance_new(const char *name, Evas_Object *obj, Emotion_Module_Options *opts)
+{
+ // TODO: rewrite
+ Eina_Emotion_Plugins *plugin;
+ unsigned int i = 0;
+ Emotion_Video_Module *mod = NULL;
+ void *data = NULL;
+
+ if (!_emotion_backends)
+ {
+ ERR("No backend loaded");
+ return NULL;
+ }
+
+ if (!name && getenv("EMOTION_ENGINE"))
+ {
+ name = getenv("EMOTION_ENGINE");
+ DBG("using EMOTION_ENGINE=%s", name);
+ }
+
+ /* FIXME: Always look for a working backend. */
+ retry:
+ if (!name || i > 0)
+ name = _backend_priority[i++];
+
+ plugin = eina_hash_find(_emotion_backends, name);
+ DBG("try engine=%s, plugin=%p", name, plugin);
+ if (!plugin)
+ {
+ if (i != 0 && i < (sizeof (_backend_priority) / sizeof (char*)))
+ goto retry;
+
+ ERR("No backend loaded");
+ return NULL;
+ }
+
+ if (plugin->open(obj, (const Emotion_Video_Module **) &mod, &data, opts))
+ {
+ Emotion_Engine_Instance *inst = calloc(1, sizeof(Emotion_Engine_Instance));
+ INF("opened %s, mod=%p, video=%p", name, mod, data);
+ mod->plugin = plugin;
+ inst->api = mod;
+ inst->obj = obj;
+ inst->data = data;
+ inst->name = strdup(name);
+ return inst;
+ }
+
+ if (i != 0 && i < (sizeof (_backend_priority) / sizeof (char*)))
+ goto retry;
+
+ ERR("Unable to load module: %s", name);
+
+ return NULL;
+}
+
+void
+emotion_engine_instance_del(Emotion_Engine_Instance *inst)
+{
+ EINA_SAFETY_ON_NULL_RETURN(inst);
+ inst->api->plugin->close(inst->api, inst->data); // TODO: weird api
+}
+
+Eina_Bool
+emotion_engine_instance_name_equal(const Emotion_Engine_Instance *inst, const char *name)
+{
+ /* these are valid, no safety macros here */
+ if (!name) return EINA_FALSE;
+ if (!inst) return EINA_FALSE;
+ return strcmp(name, inst->name) == 0;
+}
+
+void *
+emotion_engine_instance_data_get(const Emotion_Engine_Instance *inst)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(inst, NULL);
+ return inst->data;
+}
+
+unsigned char
+emotion_engine_instance_file_open(Emotion_Engine_Instance *inst, const char *file)
+{
+ EMOTION_ENGINE_INSTANCE_CHECK(inst, file_open, EINA_FALSE);
+ return inst->api->file_open(file, inst->obj, inst->data); // TODO: weird api
+}
+
+void
+emotion_engine_instance_file_close(Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, file_close);
+}
+
+void
+emotion_engine_instance_play(Emotion_Engine_Instance *inst, double pos)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, play, pos);
+}
+
+void
+emotion_engine_instance_stop(Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, stop);
+}
+
+void
+emotion_engine_instance_size_get(const Emotion_Engine_Instance *inst, int *w, int *h)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, size_get, w, h);
+}
+
+void
+emotion_engine_instance_pos_set(Emotion_Engine_Instance *inst, double pos)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, pos_set, pos);
+}
+
+double
+emotion_engine_instance_len_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, len_get, 0.0);
+}
+
+double
+emotion_engine_instance_buffer_size_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, buffer_size_get, 1.0);
+}
+
+int
+emotion_engine_instance_fps_num_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, fps_num_get, 1);
+}
+
+int
+emotion_engine_instance_fps_den_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, fps_den_get, 1);
+}
+
+double
+emotion_engine_instance_fps_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, fps_get, 1.0);
+}
+
+double
+emotion_engine_instance_pos_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, pos_get, 0.0);
+}
+
+void
+emotion_engine_instance_vis_set(Emotion_Engine_Instance *inst, Emotion_Vis vis)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, vis_set, vis);
+}
+
+Emotion_Vis
+emotion_engine_instance_vis_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, vis_get, EMOTION_VIS_NONE);
+}
+
+Eina_Bool
+emotion_engine_instance_vis_supported(Emotion_Engine_Instance *inst, Emotion_Vis vis)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, vis_supported, EINA_FALSE, vis);
+}
+
+double
+emotion_engine_instance_ratio_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, ratio_get, 0.0);
+}
+
+Eina_Bool
+emotion_engine_instance_video_handled(Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_handled, EINA_FALSE);
+}
+
+Eina_Bool
+emotion_engine_instance_audio_handled(Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_handled, EINA_FALSE);
+}
+
+Eina_Bool
+emotion_engine_instance_seekable(Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, seekable, EINA_FALSE);
+}
+
+void
+emotion_engine_instance_frame_done(Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, frame_done);
+}
+
+Emotion_Format
+emotion_engine_instance_format_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, format_get, EMOTION_FORMAT_NONE);
+}
+
+void
+emotion_engine_instance_video_data_size_get(const Emotion_Engine_Instance *inst, int *w, int *h)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, video_data_size_get, w, h);
+}
+
+Eina_Bool
+emotion_engine_instance_yuv_rows_get(const Emotion_Engine_Instance *inst, int w, int h, unsigned char **yrows, unsigned char **urows, unsigned char **vrows)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, yuv_rows_get, EINA_FALSE, w, h, yrows, urows, vrows);
+}
+
+Eina_Bool
+emotion_engine_instance_bgra_data_get(const Emotion_Engine_Instance *inst, unsigned char **bgra_data)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, bgra_data_get, EINA_FALSE, bgra_data);
+}
+
+void
+emotion_engine_instance_event_feed(Emotion_Engine_Instance *inst, int event)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, event_feed, event);
+}
+
+void
+emotion_engine_instance_event_mouse_button_feed(Emotion_Engine_Instance *inst, int button, int x, int y)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, event_mouse_button_feed, button, x, y);
+}
+
+void
+emotion_engine_instance_event_mouse_move_feed(Emotion_Engine_Instance *inst, int x, int y)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, event_mouse_move_feed, x, y);
+}
+
+int
+emotion_engine_instance_video_channel_count(Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_channel_count, 0);
+}
+
+void
+emotion_engine_instance_video_channel_set(Emotion_Engine_Instance *inst, int channel)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, video_channel_set, channel);
+}
+
+int
+emotion_engine_instance_video_channel_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_channel_get, 0);
+}
+
+void
+emotion_engine_instance_video_subtitle_file_set(Emotion_Engine_Instance *inst, const char *filepath)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, video_subtitle_file_set, filepath);
+}
+
+const char *
+emotion_engine_instance_video_subtitle_file_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_subtitle_file_get, NULL);
+}
+
+const char *
+emotion_engine_instance_video_channel_name_get(const Emotion_Engine_Instance *inst, int channel)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_channel_name_get, NULL, channel);
+}
+
+void
+emotion_engine_instance_video_channel_mute_set(Emotion_Engine_Instance *inst, Eina_Bool mute)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, video_channel_mute_set, mute);
+}
+
+Eina_Bool
+emotion_engine_instance_video_channel_mute_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, video_channel_mute_get, EINA_FALSE);
+}
+
+int
+emotion_engine_instance_audio_channel_count(Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_count, 0);
+}
+
+void
+emotion_engine_instance_audio_channel_set(Emotion_Engine_Instance *inst, int channel)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, audio_channel_set, channel);
+}
+
+int
+emotion_engine_instance_audio_channel_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_get, 0);
+}
+
+const char *
+emotion_engine_instance_audio_channel_name_get(const Emotion_Engine_Instance *inst, int channel)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_name_get, NULL, channel);
+}
+
+void
+emotion_engine_instance_audio_channel_mute_set(Emotion_Engine_Instance *inst, Eina_Bool mute)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, audio_channel_mute_set, mute);
+}
+
+Eina_Bool
+emotion_engine_instance_audio_channel_mute_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_mute_get, EINA_FALSE);
+}
+
+void
+emotion_engine_instance_audio_channel_volume_set(Emotion_Engine_Instance *inst, double vol)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, audio_channel_volume_set, vol);
+}
+
+double
+emotion_engine_instance_audio_channel_volume_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, audio_channel_volume_get, 0.0);
+}
+
+int
+emotion_engine_instance_spu_channel_count(Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, spu_channel_count, 0);
+}
+
+void
+emotion_engine_instance_spu_channel_set(Emotion_Engine_Instance *inst, int channel)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, spu_channel_set, channel);
+}
+
+int
+emotion_engine_instance_spu_channel_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, spu_channel_get, 0);
+}
+
+const char *
+emotion_engine_instance_spu_channel_name_get(const Emotion_Engine_Instance *inst, int channel)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, spu_channel_name_get, NULL, channel);
+}
+
+void
+emotion_engine_instance_spu_channel_mute_set(Emotion_Engine_Instance *inst, Eina_Bool mute)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, spu_channel_mute_set, mute);
+}
+
+Eina_Bool
+emotion_engine_instance_spu_channel_mute_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, spu_channel_mute_get, EINA_FALSE);
+}
+
+int
+emotion_engine_instance_chapter_count(Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, chapter_count, 0);
+}
+
+void
+emotion_engine_instance_chapter_set(Emotion_Engine_Instance *inst, int chapter)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, chapter_set, chapter);
+}
+
+int
+emotion_engine_instance_chapter_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, chapter_get, 0);
+}
+
+const char *
+emotion_engine_instance_chapter_name_get(const Emotion_Engine_Instance *inst, int chapter)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, chapter_name_get, NULL, chapter);
+}
+
+void
+emotion_engine_instance_speed_set(Emotion_Engine_Instance *inst, double speed)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, speed_set, speed);
+}
+
+double
+emotion_engine_instance_speed_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, speed_get, 0.0);
+}
+
+Eina_Bool
+emotion_engine_instance_eject(Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, eject, EINA_FALSE);
+}
+
+const char *
+emotion_engine_instance_meta_get(const Emotion_Engine_Instance *inst, int meta)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, meta_get, NULL, meta);
+}
+
+void
+emotion_engine_instance_priority_set(Emotion_Engine_Instance *inst, Eina_Bool priority)
+{
+ EMOTION_ENGINE_INSTANCE_CALL(inst, priority_set, priority);
+}
+
+Eina_Bool
+emotion_engine_instance_priority_get(const Emotion_Engine_Instance *inst)
+{
+ EMOTION_ENGINE_INSTANCE_CALL_RET(inst, priority_get, EINA_FALSE);
+}
struct _Smart_Data
{
EINA_REFCOUNT;
- Emotion_Video_Module *module;
- void *video_data;
-
- char *module_name;
+ Emotion_Engine_Instance *engine_instance;
const char *file;
Evas_Object *obj;
/**********************************/
static Evas_Smart *smart = NULL;
-static const char *_backend_priority[] = {
- "gstreamer",
- "xine",
- "generic"
-};
-
static const char SIG_FRAME_DECODE[] = "frame_decode";
static const char SIG_POSITION_UPDATE[] = "position_update";
static const char SIG_LENGTH_CHANGE[] = "length_change";
}
static void
-_emotion_module_close(Emotion_Video_Module *mod, void *video)
-{
- if (!mod) return;
- if (mod->plugin->close && video)
- mod->plugin->close(mod, video);
- /* FIXME: we can't go dlclosing here as a thread still may be running from
- * the module - this in theory will leak- but it shouldn't be too bad and
- * mean that once a module is dlopened() it can't be closed - its refcount
- * will just keep going up
- */
-}
-
-static void
_smart_data_free(Smart_Data *sd)
{
- if (sd->video_data) sd->module->file_close(sd->video_data);
- _emotion_module_close(sd->module, sd->video_data);
+ if (sd->engine_instance)
+ {
+ emotion_engine_instance_file_close(sd->engine_instance);
+ emotion_engine_instance_del(sd->engine_instance);
+ }
evas_object_del(sd->obj);
evas_object_del(sd->crop.clipper);
evas_object_del(sd->bg);
eina_stringshare_del(sd->file);
- free(sd->module_name);
if (sd->job) ecore_job_del(sd->job);
if (sd->anim) ecore_animator_del(sd->anim);
free(sd->progress.info);
emotion_shutdown();
}
-static const char *
-_emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **mod, void **video)
-{
- Eina_Emotion_Plugins *plugin;
- Smart_Data *sd;
- unsigned int i = 0;
-
- E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!_emotion_backends)
- {
- ERR("No backend loaded");
- return NULL;
- }
-
- if (!name && getenv("EMOTION_ENGINE"))
- {
- name = getenv("EMOTION_ENGINE");
- DBG("using EMOTION_ENGINE=%s", name);
- }
-
- /* FIXME: Always look for a working backend. */
- retry:
- if (!name || i > 0)
- name = _backend_priority[i++];
-
- plugin = eina_hash_find(_emotion_backends, name);
- DBG("try engine=%s, plugin=%p", name, plugin);
- if (!plugin)
- {
- if (i != 0 && i < (sizeof (_backend_priority) / sizeof (char*)))
- goto retry;
-
- ERR("No backend loaded");
- return EINA_FALSE;
- }
-
- if (plugin->open(obj, (const Emotion_Video_Module **) mod, video, &(sd->module_options)))
- {
- INF("opened %s, mod=%p, video=%p", name, mod, video);
- if (*mod)
- {
- (*mod)->plugin = plugin;
- return name;
- }
- }
-
- if (i != 0 && i < (sizeof (_backend_priority) / sizeof (char*)))
- goto retry;
-
- ERR("Unable to load module: %s", name);
-
- return NULL;
-}
-
static void
_clipper_position_size_update(Evas_Object *obj, int x, int y, int w, int h, int vid_w, int vid_h)
{
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if ((!opt) || (!val)) return;
+ // TODO remove me
if (!strcmp(opt, "player"))
eina_stringshare_replace(&sd->module_options.player, val);
}
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if ((sd->module_name) && module_filename && (!strcmp(sd->module_name, module_filename)))
- return EINA_TRUE;
- free(sd->module_name);
- sd->module_name = NULL;
+ if (emotion_engine_instance_name_equal(sd->engine_instance, module_filename))
+ {
+ DBG("no need to reset engine, already set: %s", module_filename);
+ return EINA_TRUE;
+ }
file = sd->file;
sd->file = NULL;
if (sd->anim) ecore_animator_del(sd->anim);
sd->anim = NULL;
- _emotion_module_close(sd->module, sd->video_data);
- sd->module = NULL;
- sd->video_data = NULL;
-
- module_filename = _emotion_module_open(module_filename, obj, &sd->module, &sd->video_data);
- if (!module_filename)
- return EINA_FALSE;
-
- sd->module_name = strdup(module_filename);
+ if (sd->engine_instance) emotion_engine_instance_del(sd->engine_instance);
+ sd->engine_instance = emotion_engine_instance_new(module_filename, obj, &(sd->module_options));
+ if (!sd->engine_instance)
+ {
+ sd->file = file;
+ return EINA_FALSE;
+ }
if (file)
{
- emotion_object_file_set(obj, file);
- eina_stringshare_del(file);
+ emotion_object_file_set(obj, file);
+ eina_stringshare_del(file);
}
return EINA_TRUE;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EINA_FALSE);
DBG("file=%s", file);
- if (!sd->module) return EINA_FALSE;
+
+ if (!eina_stringshare_replace(&sd->file, file))
+ return EINA_TRUE;
+
+ if (!sd->engine_instance)
+ {
+ WRN("No engine choosen. Call emotion_object_init()?");
+ return EINA_FALSE;
+ }
sd->video.w = 0;
sd->video.h = 0;
- if ((file) && (sd->file) &&
- ((file == sd->file) || (!strcmp(file, sd->file)))) return EINA_FALSE;
if ((file) && (file[0] != 0))
{
- eina_stringshare_replace(&sd->file, file);
- sd->module->file_close(sd->video_data);
+ eina_stringshare_replace(&sd->file, file);
+ emotion_engine_instance_file_close(sd->engine_instance);
evas_object_image_data_set(sd->obj, NULL);
- evas_object_image_size_set(sd->obj, 1, 1);
+ evas_object_image_size_set(sd->obj, 1, 1);
_emotion_image_data_zero(sd->obj);
sd->open = 0;
- if (!sd->module->file_open(sd->file, obj, sd->video_data))
- return EINA_FALSE;
- sd->pos = 0.0;
- if (sd->play) sd->module->play(sd->video_data, 0.0);
+ if (!emotion_engine_instance_file_open(sd->engine_instance, sd->file))
+ {
+ WRN("Couldn't open file=%s", sd->file);
+ return EINA_FALSE;
+ }
+ DBG("successfully opened file=%s", sd->file);
+ sd->pos = 0.0;
+ if (sd->play) emotion_engine_instance_play(sd->engine_instance, 0.0);
}
else
{
- if (sd->video_data && sd->module)
- {
- sd->module->file_close(sd->video_data);
- evas_object_image_data_set(sd->obj, NULL);
- evas_object_image_size_set(sd->obj, 1, 1);
- _emotion_image_data_zero(sd->obj);
- }
+ emotion_engine_instance_file_close(sd->engine_instance);
+ evas_object_image_data_set(sd->obj, NULL);
+ evas_object_image_size_set(sd->obj, 1, 1);
+ _emotion_image_data_zero(sd->obj);
eina_stringshare_replace(&sd->file, NULL);
}
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("play=" FMT_UCHAR ", was=" FMT_UCHAR, play, sd->play);
if (play == sd->play) return;
- if (!sd->module) return;
- if (!sd->video_data) return;
+ if (!sd->engine_instance) return;
if (!sd->open)
{
sd->remember_play = play;
sd->play = play;
sd->remember_play = play;
if (sd->state != EMOTION_WAKEUP) emotion_object_suspend_set(obj, EMOTION_WAKEUP);
- if (sd->play) sd->module->play(sd->video_data, sd->pos);
- else sd->module->stop(sd->video_data);
+ if (sd->play) emotion_engine_instance_play(sd->engine_instance, sd->pos);
+ else emotion_engine_instance_stop(sd->engine_instance);
}
EAPI Eina_Bool
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->video_data) return EINA_FALSE;
+ if (!sd->engine_instance) return EINA_FALSE;
return sd->play;
}
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("sec=%f", sec);
- if (!sd->module) return;
- if (!sd->video_data) return;
+ if (!sd->engine_instance) return;
if (!sd->open)
{
sd->remember_jump = sec;
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
- if (!sd->module) return 0.0;
- if (!sd->video_data) return 0.0;
- if (!sd->module->pos_get) return 0.0;
- sd->pos = sd->module->pos_get(sd->video_data);
+ sd->pos = emotion_engine_instance_pos_get(sd->engine_instance);
return sd->pos;
}
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 1.0);
- if (!sd->module) return 1.0;
- if (!sd->video_data) return 1.0;
- if (!sd->module->buffer_size_get) return 1.0;
- return sd->module->buffer_size_get(sd->video_data);
+ return emotion_engine_instance_buffer_size_get(sd->engine_instance);
}
EAPI Eina_Bool
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return EINA_FALSE;
- if (!sd->video_data) return EINA_FALSE;
- return sd->module->seekable(sd->video_data);
+ return emotion_engine_instance_seekable(sd->engine_instance);
}
EAPI Eina_Bool
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return EINA_FALSE;
- if (!sd->video_data) return EINA_FALSE;
- return sd->module->video_handled(sd->video_data);
+ return emotion_engine_instance_video_handled(sd->engine_instance);
}
EAPI Eina_Bool
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return EINA_FALSE;
- if (!sd->video_data) return EINA_FALSE;
- return sd->module->audio_handled(sd->video_data);
+ return emotion_engine_instance_audio_handled(sd->engine_instance);
}
EAPI double
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
- if (!sd->module) return 0.0;
- if (!sd->video_data) return 0.0;
- sd->len = sd->module->len_get(sd->video_data);
+ sd->len = emotion_engine_instance_len_get(sd->engine_instance);
return sd->len;
}
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 1.0);
- if (!sd->module) return 0.0;
- if (!sd->video_data) return 0.0;
+ if (!sd->engine_instance) return 0.0;
return sd->ratio;
}
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
- if (!sd->module) return;
- if (!sd->video_data) return;
- sd->module->event_feed(sd->video_data, ev);
+ emotion_engine_instance_event_feed(sd->engine_instance, ev);
}
EAPI void
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("vol=%f", vol);
- if (!sd->module) return;
- if (!sd->video_data) return;
- sd->module->audio_channel_volume_set(sd->video_data, vol);
+ emotion_engine_instance_audio_channel_volume_set(sd->engine_instance, vol);
}
EAPI double
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 1.0);
- if (!sd->module) return 0.0;
- if (!sd->video_data) return 0.0;
- return sd->module->audio_channel_volume_get(sd->video_data);
+ return emotion_engine_instance_audio_channel_volume_get(sd->engine_instance);
}
EAPI void
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("mute=" FMT_UCHAR, mute);
- if (!sd->module) return;
- if (!sd->video_data) return;
- sd->module->audio_channel_mute_set(sd->video_data, mute);
+ emotion_engine_instance_audio_channel_mute_set(sd->engine_instance, mute);
}
EAPI Eina_Bool
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return EINA_FALSE;
- if (!sd->video_data) return EINA_FALSE;
- return sd->module->audio_channel_mute_get(sd->video_data);
+ return emotion_engine_instance_audio_channel_mute_get(sd->engine_instance);
}
EAPI int
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return 0;
- if (!sd->video_data) return 0;
- return sd->module->audio_channel_count(sd->video_data);
+ return emotion_engine_instance_audio_channel_count(sd->engine_instance);
}
EAPI const char *
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
- if (!sd->module) return NULL;
- if (!sd->video_data) return NULL;
- return sd->module->audio_channel_name_get(sd->video_data, channel);
+ return emotion_engine_instance_audio_channel_name_get(sd->engine_instance, channel);
}
EAPI void
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("channel=%d", channel);
- if (!sd->module) return;
- if (!sd->video_data) return;
- sd->module->audio_channel_set(sd->video_data, channel);
+ emotion_engine_instance_audio_channel_set(sd->engine_instance, channel);
}
EAPI int
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return 0;
- if (!sd->video_data) return 0;
- return sd->module->audio_channel_get(sd->video_data);
+ return emotion_engine_instance_audio_channel_get(sd->engine_instance);
}
EAPI void
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("mute=" FMT_UCHAR, mute);
- if (!sd->module) return;
- if (!sd->video_data) return;
- sd->module->video_channel_mute_set(sd->video_data, mute);
+ emotion_engine_instance_video_channel_mute_set(sd->engine_instance, mute);
}
EAPI Eina_Bool
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return EINA_FALSE;
- if (!sd->video_data) return EINA_FALSE;
- return sd->module->video_channel_mute_get(sd->video_data);
+ return emotion_engine_instance_video_channel_mute_get(sd->engine_instance);
}
EAPI void
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("subtitle=%s", filepath);
- if (!sd->module) return;
- if (!sd->video_data) return;
- sd->module->video_subtitle_file_set(sd->video_data, filepath);
+ emotion_engine_instance_video_subtitle_file_set(sd->engine_instance, filepath);
}
EAPI const char *
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return EINA_FALSE;
- if (!sd->video_data) return EINA_FALSE;
- return sd->module->video_subtitle_file_get(sd->video_data);
+ return emotion_engine_instance_video_subtitle_file_get(sd->engine_instance);
}
EAPI int
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return EINA_FALSE;
- if (!sd->video_data) return EINA_FALSE;
- return sd->module->video_channel_count(sd->video_data);
+ return emotion_engine_instance_video_channel_count(sd->engine_instance);
}
EAPI const char *
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
- if (!sd->module) return NULL;
- if (!sd->video_data) return NULL;
- return sd->module->video_channel_name_get(sd->video_data, channel);
+ return emotion_engine_instance_video_channel_name_get(sd->engine_instance, channel);
}
EAPI void
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("channel=%d", channel);
- if (!sd->module) return;
- if (!sd->video_data) return;
- sd->module->video_channel_set(sd->video_data, channel);
+ emotion_engine_instance_video_channel_set(sd->engine_instance, channel);
}
EAPI int
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return 0;
- if (!sd->video_data) return 0;
- return sd->module->video_channel_get(sd->video_data);
+ return emotion_engine_instance_video_channel_get(sd->engine_instance);
}
EAPI void
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("mute=" FMT_UCHAR, mute);
- if (!sd->module) return;
- if (!sd->video_data) return;
- sd->module->spu_channel_mute_set(sd->video_data, mute);
+ emotion_engine_instance_spu_channel_mute_set(sd->engine_instance, mute);
}
EAPI Eina_Bool
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return EINA_FALSE;
- if (!sd->video_data) return EINA_FALSE;
- return sd->module->spu_channel_mute_get(sd->video_data);
+ return emotion_engine_instance_spu_channel_mute_get(sd->engine_instance);
}
EAPI int
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return 0;
- if (!sd->video_data) return 0;
- return sd->module->spu_channel_count(sd->video_data);
+ return emotion_engine_instance_spu_channel_count(sd->engine_instance);
}
EAPI const char *
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
- if (!sd->module) return NULL;
- if (!sd->video_data) return NULL;
- return sd->module->spu_channel_name_get(sd->video_data, channel);
+ return emotion_engine_instance_spu_channel_name_get(sd->engine_instance, channel);
}
EAPI void
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("channel=%d", channel);
- if (!sd->module) return;
- if (!sd->video_data) return;
- sd->module->spu_channel_set(sd->video_data, channel);
+ emotion_engine_instance_spu_channel_set(sd->engine_instance, channel);
}
EAPI int
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return 0;
- if (!sd->video_data) return 0;
- return sd->module->spu_channel_get(sd->video_data);
+ return emotion_engine_instance_spu_channel_get(sd->engine_instance);
}
EAPI int
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return 0;
- if (!sd->video_data) return 0;
- return sd->module->chapter_count(sd->video_data);
+ return emotion_engine_instance_chapter_count(sd->engine_instance);
}
EAPI void
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("chapter=%d", chapter);
- if (!sd->module) return;
- if (!sd->video_data) return;
- sd->module->chapter_set(sd->video_data, chapter);
+ emotion_engine_instance_chapter_set(sd->engine_instance, chapter);
}
EAPI int
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return 0;
- if (!sd->video_data) return 0;
- return sd->module->chapter_get(sd->video_data);
+ return emotion_engine_instance_chapter_get(sd->engine_instance);
}
EAPI const char *
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
- if (!sd->module) return NULL;
- if (!sd->video_data) return NULL;
- return sd->module->chapter_name_get(sd->video_data, chapter);
+ return emotion_engine_instance_chapter_name_get(sd->engine_instance, chapter);
}
EAPI void
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("speed=%f", speed);
- if (!sd->module) return;
- if (!sd->video_data) return;
- sd->module->speed_set(sd->video_data, speed);
+ emotion_engine_instance_speed_set(sd->engine_instance, speed);
}
EAPI double
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
- if (!sd->module) return 0.0;
- if (!sd->video_data) return 0.0;
- return sd->module->speed_get(sd->video_data);
+ return emotion_engine_instance_speed_get(sd->engine_instance);
}
EAPI void
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
- if (!sd->module) return;
- if (!sd->video_data) return;
- sd->module->eject(sd->video_data);
+ emotion_engine_instance_eject(sd->engine_instance);
}
EAPI const char *
emotion_object_meta_info_get(const Evas_Object *obj, Emotion_Meta_Info meta)
{
Smart_Data *sd;
+ int id;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
- if (!sd->module) return NULL;
- if (!sd->video_data) return NULL;
switch (meta)
{
case EMOTION_META_INFO_TRACK_TITLE:
- return sd->module->meta_get(sd->video_data, META_TRACK_TITLE);
+ id = META_TRACK_TITLE;
+ break;
case EMOTION_META_INFO_TRACK_ARTIST:
- return sd->module->meta_get(sd->video_data, META_TRACK_ARTIST);
+ id = META_TRACK_ARTIST;
+ break;
case EMOTION_META_INFO_TRACK_ALBUM:
- return sd->module->meta_get(sd->video_data, META_TRACK_ALBUM);
+ id = META_TRACK_ALBUM;
+ break;
case EMOTION_META_INFO_TRACK_YEAR:
- return sd->module->meta_get(sd->video_data, META_TRACK_YEAR);
+ id = META_TRACK_YEAR;
+ break;
case EMOTION_META_INFO_TRACK_GENRE:
- return sd->module->meta_get(sd->video_data, META_TRACK_GENRE);
+ id = META_TRACK_GENRE;
+ break;
case EMOTION_META_INFO_TRACK_COMMENT:
- return sd->module->meta_get(sd->video_data, META_TRACK_COMMENT);
+ id = META_TRACK_COMMENT;
+ break;
case EMOTION_META_INFO_TRACK_DISC_ID:
- return sd->module->meta_get(sd->video_data, META_TRACK_DISCID);
+ id = META_TRACK_DISCID;
default:
- break;
+ ERR("Unknown meta info id: %d", meta);
+ return NULL;
}
- return NULL;
+
+ return emotion_engine_instance_meta_get(sd->engine_instance, id);
}
EAPI void
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("visualization=%d", visualization);
- if (!sd->module) return;
- if (!sd->video_data) return;
- if (!sd->module->vis_set) return;
- sd->module->vis_set(sd->video_data, visualization);
+ emotion_engine_instance_vis_set(sd->engine_instance, visualization);
}
EAPI Emotion_Vis
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, EMOTION_VIS_NONE);
- if (!sd->module) return EMOTION_VIS_NONE;
- if (!sd->video_data) return EMOTION_VIS_NONE;
- if (!sd->module->vis_get) return EMOTION_VIS_NONE;
- return sd->module->vis_get(sd->video_data);
+ return emotion_engine_instance_vis_get(sd->engine_instance);
}
EAPI Eina_Bool
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return EINA_FALSE;
- if (!sd->video_data) return EINA_FALSE;
- if (!sd->module->vis_supported) return EINA_FALSE;
- return sd->module->vis_supported(sd->video_data, visualization);
+ return emotion_engine_instance_vis_supported(sd->engine_instance, visualization);
}
EAPI void
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
- if (!sd->module) return ;
- if (!sd->video_data) return ;
- if (!sd->module->priority_set) return ;
- sd->module->priority_set(sd->video_data, priority);
+ emotion_engine_instance_priority_set(sd->engine_instance, priority);
}
EAPI Eina_Bool
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
- if (!sd->module) return EINA_FALSE;
- if (!sd->video_data) return EINA_FALSE;
- if (!sd->module->priority_get) return EINA_FALSE;
- return sd->module->priority_get(sd->video_data);
+ return emotion_engine_instance_priority_get(sd->engine_instance);
}
#ifdef HAVE_EIO
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
- return sd->video_data;
+ return emotion_engine_instance_data_get(sd->engine_instance);
}
static Eina_Bool
e = event_info;
sd = data;
- if (!sd->module) return;
- if (!sd->video_data) return;
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
evas_object_image_size_get(obj, &iw, &ih);
if ((iw < 1) || (ih < 1)) return;
x = (((int)e->cur.canvas.x - ox) * iw) / ow;
y = (((int)e->cur.canvas.y - oy) * ih) / oh;
- sd->module->event_mouse_move_feed(sd->video_data, x, y);
+ emotion_engine_instance_event_mouse_move_feed(sd->engine_instance, x, y);
}
static void
e = event_info;
sd = data;
- if (!sd->module) return;
- if (!sd->video_data) return;
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
evas_object_image_size_get(obj, &iw, &ih);
if ((iw < 1) || (ih < 1)) return;
x = (((int)e->canvas.x - ox) * iw) / ow;
y = (((int)e->canvas.y - oy) * ih) / oh;
- sd->module->event_mouse_button_feed(sd->video_data, 1, x, y);
+ emotion_engine_instance_event_mouse_button_feed(sd->engine_instance, 1, x, y);
}
static void
if (sd->seek)
{
sd->seeking = 1;
- sd->module->pos_set(sd->video_data, sd->seek_pos);
+ emotion_engine_instance_pos_set(sd->engine_instance, sd->seek_pos);
sd->seek = 0;
}
}
unsigned char *bgra_data;
sd = data;
- sd->module->video_data_size_get(sd->video_data, &w, &h);
+ emotion_engine_instance_video_data_size_get(sd->engine_instance, &w, &h);
w = (w >> 1) << 1;
h = (h >> 1) << 1;
}
else
{
- format = sd->module->format_get(sd->video_data);
+ format = emotion_engine_instance_format_get(sd->engine_instance);
if ((format == EMOTION_FORMAT_YV12) || (format == EMOTION_FORMAT_I420))
{
unsigned char **rows;
rows = evas_object_image_data_get(obj, 1);
if (rows)
{
- if (sd->module->yuv_rows_get(sd->video_data, iw, ih,
- rows,
- &rows[ih],
- &rows[ih + (ih / 2)]))
+ if (emotion_engine_instance_yuv_rows_get(sd->engine_instance, iw, ih,
+ rows,
+ &rows[ih],
+ &rows[ih + (ih / 2)]))
evas_object_image_data_update_add(obj, 0, 0, iw, ih);
}
evas_object_image_data_set(obj, rows);
else if (format == EMOTION_FORMAT_BGRA)
{
evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_ARGB8888);
- if (sd->module->bgra_data_get(sd->video_data, &bgra_data))
+ if (emotion_engine_instance_bgra_data_get(sd->engine_instance, &bgra_data))
{
evas_object_image_data_set(obj, bgra_data);
evas_object_image_pixels_dirty_set(obj, 0);