* Use ecore_plugin instead of dlfcn

* the modules names are now "xine" and "gstreamer" (it's useless to add
   the extension, as ecore_plugin do not need it). I'll fix eclair,
   etk_extra and ewl.
 * look for the modules in path that is pointed by the env variable
    EMOTION_MODULES_DIR first.
 * fix a leak in the gstreamer module
 * remove some trailing spaces


SVN revision: 32261
This commit is contained in:
doursse 2007-10-31 19:34:39 +00:00 committed by doursse
parent 5f684ac512
commit 4649e92bb8
7 changed files with 208 additions and 202 deletions

View File

@ -47,7 +47,7 @@ if test "x${libdir}" = 'x${exec_prefix}/lib'; then
fi
fi
fi
dnl Set PACKAGE_DATA_DIR in config.h.
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}", [Shared Data Directory])
@ -169,9 +169,6 @@ fi
AM_CONDITIONAL([BUILD_XINE_MODULE], [test "$HAVE_XINE" = yes])
AM_CONDITIONAL([BUILD_GSTREAMER_MODULE], [test "$HAVE_GSTREAMER" = yes])
AC_CHECK_LIB(dl, dlopen, dlopen_libs=-ldl)
AC_SUBST(dlopen_libs)
AC_OUTPUT([
Makefile
emotion.pc
@ -213,4 +210,3 @@ echo " binaries.......: $bindir"
echo " libraries......: $libdir"
echo " headers........: $includedir"
echo

View File

@ -51,13 +51,13 @@ static int
main_start(int argc, char **argv)
{
int mode = 0;
start_time = ecore_time_get();
if (!ecore_init()) return -1;
ecore_app_args_set(argc, (const char **)argv);
ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, main_signal_exit, NULL);
if (!ecore_evas_init()) return -1;
#ifndef FB_ONLY
#ifndef FB_ONLY
{
int i;
@ -69,7 +69,7 @@ main_start(int argc, char **argv)
{
int n, w, h;
char buf[16], buf2[16];
n = sscanf(argv[i +1], "%10[^x]x%10s", buf, buf2);
if (n == 2)
{
@ -97,7 +97,7 @@ main_start(int argc, char **argv)
#if HAVE_ECORE_EVAS_X
if (mode == 0)
ecore_evas = ecore_evas_software_x11_new(NULL, 0, 0, 0, startw, starth);
#endif
#endif
#if HAVE_ECORE_EVAS_GL
if (mode == 1)
ecore_evas = ecore_evas_gl_x11_new(NULL, 0, 0, 0, startw, starth);
@ -108,7 +108,7 @@ main_start(int argc, char **argv)
#endif
if (mode == 3)
ecore_evas = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, startw, starth);
#else
startw = 240;
starth = 320;
@ -124,7 +124,7 @@ main_start(int argc, char **argv)
evas_image_cache_set(evas, 8 * 1024 * 1024);
evas_font_cache_set(evas, 1 * 1024 * 1024);
evas_font_path_append(evas, PACKAGE_DATA_DIR"/data/fonts");
edje_init();
edje_frametime_set(1.0 / 30.0);
return 1;
@ -141,7 +141,7 @@ static void
main_resize(Ecore_Evas *ee)
{
Evas_Coord w, h;
evas_output_viewport_get(evas, NULL, NULL, &w, &h);
bg_resize(w, h);
}
@ -176,7 +176,7 @@ bg_setup(void)
evas_object_move(o, 0, 0);
evas_object_resize(o, startw, starth);
evas_object_layer_set(o, -999);
evas_object_show(o);
evas_object_show(o);
evas_object_focus_set(o, 1);
evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, bg_key_down, NULL);
o_bg = o;
@ -192,11 +192,11 @@ static void
broadcast_event(Emotion_Event ev)
{
Evas_List *l;
for (l = video_objs; l; l = l->next)
{
Evas_Object *obj;
obj = l->data;
emotion_object_event_simple_send(obj, ev);
}
@ -206,7 +206,7 @@ static void
bg_key_down(void *data, Evas * e, Evas_Object * obj, void *event_info)
{
Evas_Event_Key_Down *ev;
ev = (Evas_Event_Key_Down *)event_info;
if (!strcmp(ev->keyname, "Escape"))
ecore_main_loop_quit();
@ -251,11 +251,11 @@ bg_key_down(void *data, Evas * e, Evas_Object * obj, void *event_info)
else if (!strcmp(ev->keyname, "bracketleft"))
{
Evas_List *l;
for (l = video_objs; l; l = l->next)
{
Evas_Object *obj;
obj = l->data;
emotion_object_audio_volume_set(obj, emotion_object_audio_volume_get(obj) - 0.1);
}
@ -263,11 +263,11 @@ bg_key_down(void *data, Evas * e, Evas_Object * obj, void *event_info)
else if (!strcmp(ev->keyname, "bracketright"))
{
Evas_List *l;
for (l = video_objs; l; l = l->next)
{
Evas_Object *obj;
obj = l->data;
emotion_object_audio_volume_set(obj, emotion_object_audio_volume_get(obj) + 0.1);
}
@ -275,11 +275,11 @@ bg_key_down(void *data, Evas * e, Evas_Object * obj, void *event_info)
else if (!strcmp(ev->keyname, "v"))
{
Evas_List *l;
for (l = video_objs; l; l = l->next)
{
Evas_Object *obj;
obj = l->data;
if (emotion_object_video_mute_get(obj))
emotion_object_video_mute_set(obj, 0);
@ -290,11 +290,11 @@ bg_key_down(void *data, Evas * e, Evas_Object * obj, void *event_info)
else if (!strcmp(ev->keyname, "a"))
{
Evas_List *l;
for (l = video_objs; l; l = l->next)
{
Evas_Object *obj;
obj = l->data;
if (emotion_object_audio_mute_get(obj))
{
@ -311,11 +311,11 @@ bg_key_down(void *data, Evas * e, Evas_Object * obj, void *event_info)
else if (!strcmp(ev->keyname, "i"))
{
Evas_List *l;
for (l = video_objs; l; l = l->next)
{
Evas_Object *obj;
obj = l->data;
printf("audio channels: %i\n", emotion_object_audio_channel_count(obj));
printf("video channels: %i\n", emotion_object_video_channel_count(obj));
@ -390,7 +390,7 @@ static void
video_obj_down_cb(void *data, Evas *ev, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Down *e;
e = event_info;
evas_object_color_set(obj, 200, 50, 40, 200);
evas_object_raise(obj);
@ -400,7 +400,7 @@ static void
video_obj_up_cb(void *data, Evas *ev, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Up *e;
e = event_info;
evas_object_color_set(obj, 100, 100, 100, 100);
}
@ -409,12 +409,12 @@ static void
video_obj_move_cb(void *data, Evas *ev, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Move *e;
e = event_info;
if (e->buttons & 0x1)
{
Evas_Coord x, y;
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
x += e->cur.canvas.x - e->prev.canvas.x;
y += e->cur.canvas.y - e->prev.canvas.y;
@ -423,7 +423,7 @@ video_obj_move_cb(void *data, Evas *ev, Evas_Object *obj, void *event_info)
else if (e->buttons & 0x4)
{
Evas_Coord w, h;
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
w += e->cur.canvas.x - e->prev.canvas.x;
h += e->cur.canvas.y - e->prev.canvas.y;
@ -454,7 +454,7 @@ video_obj_frame_decode_cb(void *data, Evas_Object *obj, void *event_info)
snprintf(buf, sizeof(buf), "%i:%02i:%02i.%02i / %i:%02i:%02i",
ph, pm, ps, pf, lh, lm, ls);
edje_object_part_text_set(oe, "video_progress_txt", buf);
if (0)
{
double t;
@ -548,7 +548,7 @@ video_obj_progress_cb(void *data, Evas_Object *obj, void *event_info)
Evas_Object *oe;
oe = data;
printf("progress: \"%s\" %3.3f\n",
printf("progress: \"%s\" %3.3f\n",
emotion_object_progress_info_get(obj),
emotion_object_progress_status_get(obj));
}
@ -590,7 +590,7 @@ static void
video_obj_signal_play_cb(void *data, Evas_Object *o, const char *emission, const char *source)
{
Evas_Object *ov;
ov = data;
emotion_object_play_set(ov, 1);
edje_object_signal_emit(o, "video_state", "play");
@ -600,7 +600,7 @@ static void
video_obj_signal_pause_cb(void *data, Evas_Object *o, const char *emission, const char *source)
{
Evas_Object *ov;
ov = data;
emotion_object_play_set(ov, 0);
edje_object_signal_emit(o, "video_state", "pause");
@ -610,7 +610,7 @@ static void
video_obj_signal_stop_cb(void *data, Evas_Object *o, const char *emission, const char *source)
{
Evas_Object *ov;
ov = data;
emotion_object_play_set(ov, 0);
emotion_object_position_set(ov, 0);
@ -623,7 +623,7 @@ video_obj_signal_jump_cb(void *data, Evas_Object *o, const char *emission, const
Evas_Object *ov;
double len;
double x, y;
ov = data;
edje_object_part_drag_value_get(o, source, &x, &y);
len = emotion_object_play_length_get(ov);
@ -637,7 +637,7 @@ video_obj_signal_speed_cb(void *data, Evas_Object *o, const char *emission, cons
double spd;
double x, y;
char buf[256];
ov = data;
edje_object_part_drag_value_get(o, source, &x, &y);
spd = 255 * y;
@ -651,7 +651,7 @@ video_obj_signal_frame_move_start_cb(void *data, Evas_Object *o, const char *emi
{
Frame_Data *fd;
Evas_Coord x, y;
fd = evas_object_data_get(o, "frame_data");
fd->moving = 1;
evas_pointer_canvas_xy_get(evas_object_evas_get(o), &x, &y);
@ -664,7 +664,7 @@ static void
video_obj_signal_frame_move_stop_cb(void *data, Evas_Object *o, const char *emission, const char *source)
{
Frame_Data *fd;
fd = evas_object_data_get(o, "frame_data");
fd->moving = 0;
}
@ -674,7 +674,7 @@ video_obj_signal_frame_resize_start_cb(void *data, Evas_Object *o, const char *e
{
Frame_Data *fd;
Evas_Coord x, y;
fd = evas_object_data_get(o, "frame_data");
fd->resizing = 1;
evas_pointer_canvas_xy_get(evas_object_evas_get(o), &x, &y);
@ -687,7 +687,7 @@ static void
video_obj_signal_frame_resize_stop_cb(void *data, Evas_Object *o, const char *emission, const char *source)
{
Frame_Data *fd;
fd = evas_object_data_get(o, "frame_data");
fd->resizing = 0;
}
@ -696,12 +696,12 @@ static void
video_obj_signal_frame_move_cb(void *data, Evas_Object *o, const char *emission, const char *source)
{
Frame_Data *fd;
fd = evas_object_data_get(o, "frame_data");
if (fd->moving)
{
Evas_Coord x, y, ox, oy;
evas_pointer_canvas_xy_get(evas_object_evas_get(o), &x, &y);
evas_object_geometry_get(o, &ox, &oy, NULL, NULL);
evas_object_move(o, ox + (x - fd->x), oy + (y - fd->y));
@ -711,7 +711,7 @@ video_obj_signal_frame_move_cb(void *data, Evas_Object *o, const char *emission,
else if (fd->resizing)
{
Evas_Coord x, y, ow, oh;
evas_pointer_canvas_xy_get(evas_object_evas_get(o), &x, &y);
evas_object_geometry_get(o, NULL, NULL, &ow, &oh);
evas_object_resize(o, ow + (x - fd->x), oh + (y - fd->y));
@ -729,11 +729,11 @@ init_video_object(char *module_filename, char *filename)
Evas_Coord w, h;
Frame_Data *fd;
/* basic video object setup */
o = emotion_object_add(evas);
/* basic video object setup */
o = emotion_object_add(evas);
if (!emotion_object_init(o, module_filename))
return;
return;
emotion_object_file_set(o, filename);
emotion_object_play_set(o, 1);
evas_object_move(o, 0, 0);
@ -742,14 +742,14 @@ init_video_object(char *module_filename, char *filename)
evas_object_show(o);
/* end basic video setup. all the rest here is just to be fancy */
video_objs = evas_list_append(video_objs, o);
emotion_object_size_get(o, &iw, &ih);
w = iw; h = ih;
fd = calloc(1, sizeof(Frame_Data));
oe = edje_object_add(evas);
evas_object_data_set(oe, "frame_data", fd);
edje_object_file_set(oe, PACKAGE_DATA_DIR"/data/theme.edj", "video_controller");
@ -761,7 +761,7 @@ init_video_object(char *module_filename, char *filename)
evas_object_resize(oe, w, h);
edje_extern_object_min_size_set(o, 0, 0);
edje_object_part_swallow(oe, "video_swallow", o);
evas_object_smart_callback_add(o, "frame_decode", video_obj_frame_decode_cb, oe);
evas_object_smart_callback_add(o, "frame_resize", video_obj_frame_resize_cb, oe);
evas_object_smart_callback_add(o, "length_change", video_obj_length_change_cb, oe);
@ -773,7 +773,7 @@ init_video_object(char *module_filename, char *filename)
evas_object_smart_callback_add(o, "ref_change", video_obj_ref_cb, oe);
evas_object_smart_callback_add(o, "button_num_change", video_obj_button_num_cb, oe);
evas_object_smart_callback_add(o, "button_change", video_obj_button_cb, oe);
edje_object_signal_callback_add(oe, "video_control", "play", video_obj_signal_play_cb, o);
edje_object_signal_callback_add(oe, "video_control", "pause", video_obj_signal_pause_cb, o);
edje_object_signal_callback_add(oe, "video_control", "stop", video_obj_signal_stop_cb, o);
@ -785,12 +785,12 @@ init_video_object(char *module_filename, char *filename)
edje_object_signal_callback_add(oe, "frame_resize", "start", video_obj_signal_frame_resize_start_cb, oe);
edje_object_signal_callback_add(oe, "frame_resize", "stop", video_obj_signal_frame_resize_stop_cb, oe);
edje_object_signal_callback_add(oe, "mouse,move", "*", video_obj_signal_frame_move_cb, oe);
edje_object_part_drag_value_set(oe, "video_speed", 0.0, 1.0);
edje_object_part_text_set(oe, "video_speed_txt", "1.0");
edje_object_signal_emit(o, "video_state", "play");
evas_object_show(oe);
}
@ -800,7 +800,7 @@ enter_idle(void *data)
double t;
static double pt = 0.0;
static int frames = 0;
t = ecore_time_get();
if (frames == 0) pt = t;
frames++;
@ -817,11 +817,11 @@ main(int argc, char **argv)
{
char *module_filename;
int i;
if (main_start(argc, argv) < 1) return -1;
bg_setup();
module_filename = "emotion_decoder_xine.so";
module_filename = "xine";
for (i = 1; i < argc; i++)
{
@ -848,11 +848,11 @@ main(int argc, char **argv)
}
else if (!strcmp(argv[i], "-xine"))
{
module_filename = "emotion_decoder_xine.so";
module_filename = "xine";
}
else if (!strcmp(argv[i], "-gstreamer"))
{
module_filename = "emotion_decoder_gstreamer.so";
module_filename = "gstreamer";
}
else
{
@ -860,7 +860,7 @@ main(int argc, char **argv)
init_video_object(module_filename, argv[i]);
}
}
ecore_idle_enterer_add(enter_idle, NULL);
ecore_main_loop_begin();

View File

@ -15,6 +15,6 @@ libemotion_la_SOURCES = \
emotion_smart.c \
emotion_private.h
libemotion_la_LIBADD = @EVAS_LIBS@ @ECORE_LIBS@ @dlopen_libs@
libemotion_la_LIBADD = @EVAS_LIBS@ @ECORE_LIBS@
libemotion_la_DEPENDENCIES = $(top_builddir)/config.h
libemotion_la_LDFLAGS = -version-info 0:1:0

View File

@ -4,6 +4,8 @@
#include <Evas.h>
#include <Ecore.h>
#include <Ecore_Job.h>
#include <Ecore_Data.h>
#include <Ecore_Str.h>
#include <stdlib.h>
#include <stdio.h>
@ -64,7 +66,7 @@ struct _Emotion_Module_Options
struct _Emotion_Video_Module
{
unsigned char (*init) (Evas_Object *obj, void **video, Emotion_Module_Options *opt);
unsigned char (*init) (Evas_Object *obj, void **video, Emotion_Module_Options *opt);
int (*shutdown) (void *video);
unsigned char (*file_open) (const char *file, Evas_Object *obj, void *video);
void (*file_close) (void *ef);
@ -119,8 +121,9 @@ struct _Emotion_Video_Module
double (*speed_get) (void *ef);
int (*eject) (void *ef);
const char * (*meta_get) (void *ef, int meta);
void *handle;
Ecore_Plugin *plugin;
int group_id;
};
EAPI void *_emotion_video_get(Evas_Object *obj);
@ -136,5 +139,5 @@ EAPI void _emotion_progress_set(Evas_Object *obj, char *info, double stat);
EAPI void _emotion_file_ref_set(Evas_Object *obj, char *file, int num);
EAPI void _emotion_spu_button_num_set(Evas_Object *obj, int num);
EAPI void _emotion_spu_button_set(Evas_Object *obj, int button);
#endif

View File

@ -1,6 +1,5 @@
#include "Emotion.h"
#include "emotion_private.h"
#include <dlfcn.h>
#define E_SMART_OBJ_GET(smart, o, type) \
{ \
@ -34,7 +33,7 @@ struct _Smart_Data
{
Emotion_Video_Module *module;
void *video;
char *module_name;
char *file;
@ -43,12 +42,12 @@ struct _Smart_Data
double pos;
double seek_pos;
double len;
Ecore_Job *job;
unsigned char play : 1;
unsigned char seek : 1;
char *title;
struct {
char *info;
@ -90,56 +89,62 @@ static Evas_Smart *smart = NULL;
static unsigned char
_emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **mod, void **video)
{
void *handle;
char buf[4096];
Ecore_Plugin *plugin;
int group_id;
char *tmp = NULL;
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
snprintf(buf, sizeof(buf), "%s%s", PACKAGE_LIB_DIR"/emotion/",
name);
handle = dlopen(buf, RTLD_LAZY);
if (handle)
group_id = ecore_path_group_new("emotion_module");
tmp = getenv("EMOTION_MODULES_DIR");
if (tmp)
ecore_path_group_add(group_id, tmp);
ecore_path_group_add(group_id, PACKAGE_LIB_DIR"/emotion/");
plugin = ecore_plugin_load(group_id, name, NULL);
if (plugin)
{
unsigned char (*func_module_open)(Evas_Object *, Emotion_Video_Module **, void **, Emotion_Module_Options *);
func_module_open = dlsym(handle, "module_open");
func_module_open = ecore_plugin_symbol_get(plugin, "module_open");
if (func_module_open)
{
if (func_module_open(obj, mod, video, &(sd->module_options)))
{
if (*mod)
{
(*mod)->handle = handle;
(*mod)->plugin = plugin;
(*mod)->group_id = group_id;
return 1;
}
}
}
dlclose(handle);
ecore_plugin_unload(plugin);
}
else
{
char *err;
err = dlerror();
printf ("No module. Error: %s\n", err);
}
printf ("Unable to load module %s\n", name);
ecore_path_group_del(group_id);
return 0;
}
static void
_emotion_module_close(Emotion_Video_Module *mod, void *video)
{
void *handle;
Ecore_Plugin *plugin;
void (*module_close) (Emotion_Video_Module *module, void *);
handle = mod->handle;
module_close = dlsym(handle, "module_close");
plugin = mod->plugin;
module_close = ecore_plugin_symbol_get(mod->plugin, "module_close");
if ((module_close) && (video)) module_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 shouldnt be too bad and
* mean that once a module is dlopened() it cant be closed - its refcount
* will just keep going up
*/
// dlclose(handle);
/*
ecore_plugin_unload(plugin);
ecore_path_group_del(group_id);
*/
}
/*******************************/
@ -152,14 +157,14 @@ EAPI Evas_Object *
emotion_object_add(Evas *evas)
{
_smart_init();
return evas_object_smart_add(evas, smart);
return evas_object_smart_add(evas, smart);
}
EAPI void
emotion_object_module_option_set(Evas_Object *obj, const char *opt, const char *val)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if ((!opt) || (!val)) return;
if (!strcmp(opt, "video"))
@ -176,7 +181,7 @@ EAPI Evas_Bool
emotion_object_init(Evas_Object *obj, const char *module_filename)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (sd->file) free(sd->file);
@ -212,14 +217,14 @@ EAPI 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) && (file[0] != 0))
{
int w, h;
sd->file = strdup(file);
if (sd->module)
{
@ -249,7 +254,7 @@ EAPI const char *
emotion_object_file_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
return sd->file;
}
@ -258,7 +263,7 @@ EAPI void
emotion_object_play_set(Evas_Object *obj, Evas_Bool play)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (((play) && (sd->play)) || ((!play) && (!sd->play))) return;
if (!sd->module) return;
@ -272,7 +277,7 @@ EAPI Evas_Bool
emotion_object_play_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->video) return 0;
@ -283,7 +288,7 @@ EAPI void
emotion_object_position_set(Evas_Object *obj, double sec)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (!sd->module) return;
if (!sd->video) return;
@ -298,7 +303,7 @@ EAPI double
emotion_object_position_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
if (!sd->module) return 0.0;
if (!sd->video) return 0.0;
@ -309,7 +314,7 @@ EAPI Evas_Bool
emotion_object_seekable_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->module) return 0;
if (!sd->video) return 0;
@ -320,7 +325,7 @@ EAPI Evas_Bool
emotion_object_video_handled_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->module) return 0;
if (!sd->video) return 0;
@ -331,7 +336,7 @@ EAPI Evas_Bool
emotion_object_audio_handled_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->module) return 0;
if (!sd->video) return 0;
@ -342,7 +347,7 @@ EAPI double
emotion_object_play_length_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
if (!sd->module) return 0.0;
if (!sd->video) return 0.0;
@ -354,7 +359,7 @@ EAPI void
emotion_object_size_get(Evas_Object *obj, int *iw, int *ih)
{
Smart_Data *sd;
if (iw) *iw = 0;
if (ih) *ih = 0;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
@ -365,7 +370,7 @@ EAPI void
emotion_object_smooth_scale_set(Evas_Object *obj, Evas_Bool smooth)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
evas_object_image_smooth_scale_set(sd->obj, smooth);
}
@ -374,7 +379,7 @@ EAPI Evas_Bool
emotion_object_smooth_scale_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
return evas_object_image_smooth_scale_get(sd->obj);
}
@ -383,7 +388,7 @@ EAPI double
emotion_object_ratio_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 1.0);
if (!sd->module) return 0.0;
if (!sd->video) return 0.0;
@ -394,7 +399,7 @@ EAPI void
emotion_object_event_simple_send(Evas_Object *obj, Emotion_Event ev)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (!sd->module) return;
if (!sd->video) return;
@ -405,7 +410,7 @@ EAPI void
emotion_object_audio_volume_set(Evas_Object *obj, double vol)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (!sd->module) return;
if (!sd->video) return;
@ -416,7 +421,7 @@ EAPI double
emotion_object_audio_volume_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 1.0);
if (!sd->module) return 0.0;
if (!sd->video) return 0.0;
@ -427,7 +432,7 @@ EAPI void
emotion_object_audio_mute_set(Evas_Object *obj, Evas_Bool mute)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (!sd->module) return;
if (!sd->video) return;
@ -438,7 +443,7 @@ EAPI Evas_Bool
emotion_object_audio_mute_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->module) return 0;
if (!sd->video) return 0;
@ -449,7 +454,7 @@ EAPI int
emotion_object_audio_channel_count(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->module) return 0;
if (!sd->video) return 0;
@ -460,7 +465,7 @@ EAPI const char *
emotion_object_audio_channel_name_get(Evas_Object *obj, int channel)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
if (!sd->module) return NULL;
if (!sd->video) return NULL;
@ -471,7 +476,7 @@ EAPI void
emotion_object_audio_channel_set(Evas_Object *obj, int channel)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (!sd->module) return;
if (!sd->video) return;
@ -482,7 +487,7 @@ EAPI int
emotion_object_audio_channel_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->module) return 0;
if (!sd->video) return 0;
@ -493,7 +498,7 @@ EAPI void
emotion_object_video_mute_set(Evas_Object *obj, Evas_Bool mute)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (!sd->module) return;
if (!sd->video) return;
@ -504,7 +509,7 @@ EAPI Evas_Bool
emotion_object_video_mute_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->module) return 0;
if (!sd->video) return 0;
@ -515,7 +520,7 @@ EAPI int
emotion_object_video_channel_count(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->module) return 0;
if (!sd->video) return 0;
@ -526,7 +531,7 @@ EAPI const char *
emotion_object_video_channel_name_get(Evas_Object *obj, int channel)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
if (!sd->module) return NULL;
if (!sd->video) return NULL;
@ -537,7 +542,7 @@ EAPI void
emotion_object_video_channel_set(Evas_Object *obj, int channel)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (!sd->module) return;
if (!sd->video) return;
@ -548,7 +553,7 @@ EAPI int
emotion_object_video_channel_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->module) return 0;
if (!sd->video) return 0;
@ -559,7 +564,7 @@ EAPI void
emotion_object_spu_mute_set(Evas_Object *obj, Evas_Bool mute)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (!sd->module) return;
if (!sd->video) return;
@ -570,7 +575,7 @@ EAPI Evas_Bool
emotion_object_spu_mute_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->module) return 0;
if (!sd->video) return 0;
@ -581,7 +586,7 @@ EAPI int
emotion_object_spu_channel_count(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->module) return 0;
if (!sd->video) return 0;
@ -592,7 +597,7 @@ EAPI const char *
emotion_object_spu_channel_name_get(Evas_Object *obj, int channel)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
if (!sd->module) return NULL;
if (!sd->video) return NULL;
@ -603,7 +608,7 @@ EAPI void
emotion_object_spu_channel_set(Evas_Object *obj, int channel)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (!sd->module) return;
if (!sd->video) return;
@ -614,7 +619,7 @@ EAPI int
emotion_object_spu_channel_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->module) return 0;
if (!sd->video) return 0;
@ -625,7 +630,7 @@ EAPI int
emotion_object_chapter_count(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->module) return 0;
if (!sd->video) return 0;
@ -636,7 +641,7 @@ EAPI void
emotion_object_chapter_set(Evas_Object *obj, int chapter)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (!sd->module) return;
if (!sd->video) return;
@ -647,7 +652,7 @@ EAPI int
emotion_object_chapter_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
if (!sd->module) return 0;
if (!sd->video) return 0;
@ -658,7 +663,7 @@ EAPI const char *
emotion_object_chapter_name_get(Evas_Object *obj, int chapter)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
if (!sd->module) return NULL;
if (!sd->video) return NULL;
@ -669,7 +674,7 @@ EAPI void
emotion_object_play_speed_set(Evas_Object *obj, double speed)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (!sd->module) return;
if (!sd->video) return;
@ -680,7 +685,7 @@ EAPI double
emotion_object_play_speed_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
if (!sd->module) return 0.0;
if (!sd->video) return 0.0;
@ -691,7 +696,7 @@ EAPI void
emotion_object_eject(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (!sd->module) return;
if (!sd->video) return;
@ -702,7 +707,7 @@ EAPI const char *
emotion_object_title_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
return sd->title;
}
@ -711,7 +716,7 @@ EAPI const char *
emotion_object_progress_info_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
return sd->progress.info;
}
@ -720,7 +725,7 @@ EAPI double
emotion_object_progress_status_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
return sd->progress.stat;
}
@ -729,7 +734,7 @@ EAPI const char *
emotion_object_ref_file_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
return sd->ref.file;
}
@ -738,7 +743,7 @@ EAPI int
emotion_object_ref_num_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
return sd->ref.num;
}
@ -747,7 +752,7 @@ EAPI int
emotion_object_spu_button_count_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
return sd->spu.button_num;
}
@ -756,7 +761,7 @@ EAPI int
emotion_object_spu_button_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
return sd->spu.button;
}
@ -765,7 +770,7 @@ EAPI const char *
emotion_object_meta_info_get(Evas_Object *obj, Emotion_Meta_Info meta)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
if (!sd->module) return NULL;
if (!sd->video) return NULL;
@ -811,7 +816,7 @@ EAPI void *
_emotion_video_get(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
return sd->video;
}
@ -820,7 +825,7 @@ EAPI void
_emotion_frame_new(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
// printf("pix get set 1 %p\n", sd->obj);
evas_object_image_pixels_dirty_set(sd->obj, 1);
@ -831,7 +836,7 @@ _emotion_video_pos_update(Evas_Object *obj, double pos, double len)
{
Smart_Data *sd;
int npos = 0, nlen = 0;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (pos != sd->pos) npos = 1;
if (len != sd->len) nlen = 1;
@ -869,7 +874,7 @@ EAPI void
_emotion_decode_stop(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (sd->play)
{
@ -894,7 +899,7 @@ EAPI void
_emotion_channels_change(Evas_Object *obj)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
evas_object_smart_callback_call(obj, "channels_change", NULL);
}
@ -903,7 +908,7 @@ EAPI void
_emotion_title_set(Evas_Object *obj, char *title)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (sd->title) free(sd->title);
sd->title = strdup(title);
@ -914,7 +919,7 @@ EAPI void
_emotion_progress_set(Evas_Object *obj, char *info, double stat)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (sd->progress.info) free(sd->progress.info);
sd->progress.info = strdup(info);
@ -926,7 +931,7 @@ EAPI void
_emotion_file_ref_set(Evas_Object *obj, char *file, int num)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if (sd->ref.file) free(sd->ref.file);
sd->ref.file = strdup(file);
@ -938,7 +943,7 @@ EAPI void
_emotion_spu_button_num_set(Evas_Object *obj, int num)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
sd->spu.button_num = num;
evas_object_smart_callback_call(obj, "button_num_change", NULL);
@ -948,7 +953,7 @@ EAPI void
_emotion_spu_button_set(Evas_Object *obj, int button)
{
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
sd->spu.button = button;
evas_object_smart_callback_call(obj, "button_change", NULL);
@ -959,14 +964,14 @@ _emotion_spu_button_set(Evas_Object *obj, int button)
/* Internal object routines */
/****************************/
static void
static void
_mouse_move(void *data, Evas *ev, Evas_Object *obj, void *event_info)
{
{
Evas_Event_Mouse_Move *e;
Smart_Data *sd;
int x, y, iw, ih;
Evas_Coord ox, oy, ow, oh;
e = event_info;
sd = data;
if (!sd->module) return;
@ -979,14 +984,14 @@ _mouse_move(void *data, Evas *ev, Evas_Object *obj, void *event_info)
sd->module->event_mouse_move_feed(sd->video, x, y);
}
static void
static void
_mouse_down(void *data, Evas *ev, Evas_Object *obj, void *event_info)
{
{
Evas_Event_Mouse_Down *e;
Smart_Data *sd;
int x, y, iw, ih;
Evas_Coord ox, oy, ow, oh;
e = event_info;
sd = data;
if (!sd->module) return;
@ -1004,7 +1009,7 @@ _pos_set_job(void *data)
{
Evas_Object *obj;
Smart_Data *sd;
obj = data;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
sd->job = NULL;
@ -1023,7 +1028,7 @@ _pixels_get(void *data, Evas_Object *obj)
Smart_Data *sd;
Emotion_Format format;
unsigned char *bgra_data;
sd = data;
evas_object_image_size_get(obj, &iw, &ih);
sd->module->video_data_size_get(sd->video, &w, &h);
@ -1048,14 +1053,14 @@ _pixels_get(void *data, Evas_Object *obj)
if ((format == EMOTION_FORMAT_YV12) || (format == EMOTION_FORMAT_I420))
{
unsigned char **rows;
evas_object_image_colorspace_set(obj, EVAS_COLORSPACE_YCBCR422P601_PL);
rows = evas_object_image_data_get(obj, 1);
if (rows)
{
if (sd->module->yuv_rows_get(sd->video, iw, ih,
rows,
&rows[ih],
rows,
&rows[ih],
&rows[ih + (ih / 2)]))
evas_object_image_data_update_add(obj, 0, 0, iw, ih);
}
@ -1074,10 +1079,10 @@ _pixels_get(void *data, Evas_Object *obj)
}
}
// no need for this because on any new frame decode info from the decoder
// module, the previous "current frame" is released (done) for us anyway
// module, the previous "current frame" is released (done) for us anyway
// sd->module->frame_done(sd->video);
/*
/*
evas_object_image_size_get(obj, &iw, &ih);
sd->module->video_data_size_get(sd->video, &w, &h);
if ((w != iw) || (h != ih))
@ -1091,23 +1096,23 @@ _pixels_get(void *data, Evas_Object *obj)
{
unsigned char **rows;
Evas_Pixel_Import_Source ps;
ps.format = EVAS_PIXEL_FORMAT_YUV420P_601;
ps.w = iw;
ps.h = ih;
ps.rows = malloc(ps.h * 2 * sizeof(void *));
if (!ps.rows)
{
sd->module->frame_done(sd->video);
return;
}
rows = (unsigned char **)ps.rows;
if (sd->module->yuv_rows_get(sd->video, iw, ih,
rows,
&rows[ps.h],
rows,
&rows[ps.h],
&rows[ps.h + (ps.h / 2)]))
evas_object_image_pixels_import(obj, &ps);
evas_object_image_pixels_dirty_set(obj, 0);
@ -1122,7 +1127,7 @@ _pixels_get(void *data, Evas_Object *obj)
}
}
sd->module->frame_done(sd->video);
*/
*/
}
/*******************************************/
@ -1157,7 +1162,7 @@ _smart_add(Evas_Object * obj)
{
Smart_Data *sd;
unsigned int *pixel;
sd = calloc(1, sizeof(Smart_Data));
if (!sd) return;
sd->obj = evas_object_image_add(evas_object_evas_get(obj));
@ -1176,11 +1181,12 @@ _smart_add(Evas_Object * obj)
}
evas_object_smart_data_set(obj, sd);
}
static void
_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);
@ -1199,7 +1205,7 @@ static void
_smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
evas_object_move(sd->obj, x, y);
@ -1209,7 +1215,7 @@ static void
_smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
evas_object_image_fill_set(sd->obj, 0, 0, w, h);
@ -1220,18 +1226,18 @@ static void
_smart_show(Evas_Object * obj)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
evas_object_show(sd->obj);
}
static void
_smart_hide(Evas_Object * obj)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
evas_object_hide(sd->obj);
@ -1241,7 +1247,7 @@ static void
_smart_color_set(Evas_Object * obj, int r, int g, int b, int a)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
evas_object_color_set(sd->obj, r, g, b, a);
@ -1251,7 +1257,7 @@ static void
_smart_clip_set(Evas_Object * obj, Evas_Object * clip)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
evas_object_clip_set(sd->obj, clip);
@ -1261,8 +1267,8 @@ static void
_smart_clip_unset(Evas_Object * obj)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
evas_object_clip_unset(sd->obj);
}
}

View File

@ -1,11 +1,11 @@
## Process this file with automake to produce Makefile.in
if BUILD_XINE_MODULE
XINE_LIB_NAME=emotion_decoder_xine.la
XINE_LIB_NAME = xine.la
endif
if BUILD_GSTREAMER_MODULE
GSTREAMER_LIB_NAME = emotion_decoder_gstreamer.la
GSTREAMER_LIB_NAME = gstreamer.la
endif
#AUTOMAKE_OPTIONS = 1.4 foreign
@ -22,24 +22,24 @@ pkgdir = $(libdir)/emotion
pkg_LTLIBRARIES = $(XINE_LIB_NAME) $(GSTREAMER_LIB_NAME)
if BUILD_XINE_MODULE
emotion_decoder_xine_la_SOURCES = \
xine_la_SOURCES = \
emotion_xine.c \
emotion_xine.h \
emotion_xine_vo_out.c
emotion_decoder_xine_la_LIBADD = @EVAS_LIBS@ @ECORE_LIBS@ @XINE_LIBS@ $(top_builddir)/src/lib/libemotion.la -lpthread
emotion_decoder_xine_la_LDFLAGS = -module -avoid-version \
-L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
emotion_decoder_xine_la_DEPENDENCIES = $(top_builddir)/config.h
xine_la_LIBADD = @EVAS_LIBS@ @ECORE_LIBS@ @XINE_LIBS@ $(top_builddir)/src/lib/libemotion.la -lpthread
xine_la_LDFLAGS = -module -avoid-version \
-L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
xine_la_DEPENDENCIES = $(top_builddir)/config.h
endif
if BUILD_GSTREAMER_MODULE
emotion_decoder_gstreamer_la_SOURCES = \
gstreamer_la_SOURCES = \
emotion_gstreamer.c \
emotion_gstreamer.h \
emotion_gstreamer_pipeline.c \
emotion_gstreamer_pipeline.h
emotion_decoder_gstreamer_la_LIBADD = @EVAS_LIBS@ @ECORE_LIBS@ @GST_LIBS@ $(top_builddir)/src/lib/libemotion.la
emotion_decoder_gstreamer_la_LDFLAGS = -module -avoid-version \
-L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
emotion_decoder_gstreamer_la_DEPENDENCIES = $(top_builddir)/config.h
gstreamer_la_LIBADD = @EVAS_LIBS@ @ECORE_LIBS@ @GST_LIBS@ $(top_builddir)/src/lib/libemotion.la
gstreamer_la_LDFLAGS = -module -avoid-version \
-L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
gstreamer_la_DEPENDENCIES = $(top_builddir)/config.h
endif

View File

@ -328,6 +328,7 @@ em_shutdown(void *video)
ecore_list_destroy (ev->audio_sinks);
/* FIXME: and the evas object ? */
if (ev->obj_data) free(ev->obj_data);
ecore_main_fd_handler_del(ev->fd_ev_handler);
close(ev->fd_ev_write);