jackdanielz pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f9c116a48749c642eb31154a4cfb5f60a110dcba
commit f9c116a48749c642eb31154a4cfb5f60a110dcba Author: Avi Levin <avi.le...@samsung.com> Date: Sun Apr 26 14:49:26 2015 +0300 emotion: porting evas smart callbacks to eo --- src/examples/emotion/emotion_basic_example.c | 17 +++- src/examples/emotion/emotion_border_example.c | 66 +++++++++---- src/examples/emotion/emotion_generic_example.c | 80 ++++++++++----- .../emotion/emotion_generic_subtitle_example.c | 16 ++- src/examples/emotion/emotion_signals_example.c | 87 ++++++++++------ src/lib/emotion/emotion_smart.c | 76 ++++++-------- src/modules/ethumb/emotion/emotion.c | 56 +++++++---- src/tests/emotion/emotion_test_main.c | 110 ++++++++++++++------- 8 files changed, 318 insertions(+), 190 deletions(-) diff --git a/src/examples/emotion/emotion_basic_example.c b/src/examples/emotion/emotion_basic_example.c index ec465bc..ebf8244 100644 --- a/src/examples/emotion/emotion_basic_example.c +++ b/src/examples/emotion/emotion_basic_example.c @@ -1,5 +1,9 @@ //Compile with: -// gcc -o emotion_basic_example emotion_basic_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas` +// gcc -o emotion_basic_example emotion_basic_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas eo` + +#define EFL_BETA_API_SUPPORT +#define EFL_EO_API_SUPPORT +#include <Eo.h> #include <Ecore.h> #include <Ecore_Evas.h> @@ -10,10 +14,13 @@ #define WIDTH (320) #define HEIGHT (240) -static void -_playback_started_cb(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) +static Eina_Bool +_playback_started_cb(void *data EINA_UNUSED, + Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("Emotion object started playback.\n"); + + return EINA_TRUE; } int @@ -58,8 +65,8 @@ main(int argc, const char *argv[]) em = emotion_object_add(e); emotion_object_init(em, NULL); - evas_object_smart_callback_add( - em, "playback_started", _playback_started_cb, NULL); + eo_do(em, eo_event_callback_add + (EMOTION_OBJECT_EVENT_PLAYBACK_START, _playback_started_cb, NULL)); emotion_object_file_set(em, filename); diff --git a/src/examples/emotion/emotion_border_example.c b/src/examples/emotion/emotion_border_example.c index 695b507..22eca25 100644 --- a/src/examples/emotion/emotion_border_example.c +++ b/src/examples/emotion/emotion_border_example.c @@ -1,5 +1,8 @@ //Compile with: -// gcc -o emotion_border_example emotion_border_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas eina` +// gcc -o emotion_border_example emotion_border_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas eina eo` + +#define EFL_EO_API_SUPPORT +#define EFL_BETA_API_SUPPORT #include <Ecore.h> #include <Ecore_Evas.h> @@ -14,10 +17,13 @@ static Eina_List *filenames = NULL; static Eina_List *curfile = NULL; -static void -_playback_started_cb(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) +static Eina_Bool +_playback_started_cb(void *data EINA_UNUSED, + Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("Emotion object started playback.\n"); + + return EINA_TRUE; } static Evas_Object * @@ -27,8 +33,8 @@ _create_emotion_object(Evas *e) emotion_object_init(em, "gstreamer1"); - evas_object_smart_callback_add( - em, "playback_started", _playback_started_cb, NULL); + eo_do(em, eo_event_callback_add( + EMOTION_OBJECT_EVENT_PLAYBACK_STARTED, _playback_started_cb, NULL)); return em; } @@ -103,38 +109,53 @@ _on_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void * } } -static void -_frame_decode_cb(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) +static Eina_Bool +_frame_decode_cb(void *data EINA_UNUSED, + Eo *o EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { // fprintf(stderr, "smartcb: frame_decode\n"); + + return EINA_TRUE; } -static void -_length_change_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_length_change_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { fprintf(stderr, "smartcb: length_change: %0.3f\n", emotion_object_play_length_get(o)); + + return EINA_TRUE; } -static void -_position_update_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_position_update_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { fprintf(stderr, "smartcb: position_update: %0.3f\n", emotion_object_position_get(o)); + + return EINA_TRUE; } -static void -_progress_change_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_progress_change_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { fprintf(stderr, "smartcb: progress_change: %0.3f, %s\n", emotion_object_progress_status_get(o), emotion_object_progress_info_get(o)); + + return EINA_TRUE; } -static void -_frame_resize_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_frame_resize_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { int w, h; emotion_object_size_get(o, &w, &h); fprintf(stderr, "smartcb: frame_resize: %dx%d\n", w, h); + + return EINA_TRUE; } static void /* adjust canvas' contents on resizes */ @@ -153,6 +174,15 @@ _canvas_resize_cb(Ecore_Evas *ee) evas_object_resize(em, w - 20, h - 20); } +static const Eo_Callback_Array_Item emotion_object_example_callbacks[] = { + { EMOTION_OBJECT_EVENT_FRAME_DECODE, _frame_decode_cb }, + { EMOTION_OBJECT_EVENT_LENGTH_CHANGE, _length_change_cb }, + { EMOTION_OBJECT_EVENT_POSITION_UPDATE, _position_update_cb }, + { EMOTION_OBJECT_EVENT_PROGRESS_CHANGE, _progress_change_cb }, + { EMOTION_OBJECT_EVENT_FRAME_RESIZE, _frame_resize_cb }, + { NULL, NULL } +}; + int main(int argc, const char *argv[]) { @@ -211,11 +241,7 @@ main(int argc, const char *argv[]) ecore_evas_data_set(ee, "emotion", em); - evas_object_smart_callback_add(em, "frame_decode", _frame_decode_cb, NULL); - evas_object_smart_callback_add(em, "length_change", _length_change_cb, NULL); - evas_object_smart_callback_add(em, "position_update", _position_update_cb, NULL); - evas_object_smart_callback_add(em, "progress_change", _progress_change_cb, NULL); - evas_object_smart_callback_add(em, "frame_resize", _frame_resize_cb, NULL); + eo_do(em, eo_event_callback_array_add(emotion_object_example_callbacks, NULL)); evas_object_event_callback_add(bg, EVAS_CALLBACK_KEY_DOWN, _on_key_down, em); evas_object_focus_set(bg, EINA_TRUE); diff --git a/src/examples/emotion/emotion_generic_example.c b/src/examples/emotion/emotion_generic_example.c index 9320230..5bd869c 100644 --- a/src/examples/emotion/emotion_generic_example.c +++ b/src/examples/emotion/emotion_generic_example.c @@ -1,5 +1,8 @@ //Compile with: -// gcc -o emotion_generic_example emotion_generic_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas eina` +// gcc -o emotion_generic_example emotion_generic_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas eina eo` + +#define EFL_EO_API_SUPPORT +#define EFL_BETA_API_SUPPORT #include <Ecore.h> #include <Ecore_Evas.h> @@ -15,18 +18,24 @@ static Eina_List *filenames = NULL; static Eina_List *curfile = NULL; -static void -_playback_started_cb(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) +static Eina_Bool +_playback_started_cb(void *data EINA_UNUSED, + Eo *o EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("Emotion object started playback.\n"); + + return EINA_TRUE; } -static void -_playback_stopped_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_playback_stopped_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("Emotion playback stopped.\n"); emotion_object_play_set(o, EINA_FALSE); emotion_object_position_set(o, 0); + + return EINA_TRUE; } static Evas_Object * @@ -36,10 +45,10 @@ _create_emotion_object(Evas *e) emotion_object_init(em, "generic"); - evas_object_smart_callback_add( - em, "playback_started", _playback_started_cb, NULL); - evas_object_smart_callback_add( - em, "playback_finished", _playback_stopped_cb, NULL); + eo_do(em, eo_event_callback_add + (EMOTION_OBJECT_EVENT_PLAYBACK_STARTED, _playback_started_cb, NULL)); + eo_do(em, eo_event_callback_add + (EMOTION_OBJECT_EVENT_PLAYBACK_FINISHED, _playback_stopped_cb, NULL)); return em; } @@ -123,40 +132,63 @@ _on_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void * } } -static void -_frame_decode_cb(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) +static Eina_Bool +_frame_decode_cb(void *data EINA_UNUSED, + Eo *o EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { // fprintf(stderr, "smartcb: frame_decode\n"); + + return EINA_TRUE; } -static void -_length_change_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_length_change_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { fprintf(stderr, "smartcb: length_change: %0.3f\n", emotion_object_play_length_get(o)); + + return EINA_TRUE; } -static void -_position_update_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_position_update_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { fprintf(stderr, "smartcb: position_update: %0.3f\n", emotion_object_position_get(o)); + + return EINA_TRUE; } -static void -_progress_change_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_progress_change_cb(void *data EINA_UNUSED, + Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { fprintf(stderr, "smartcb: progress_change: %0.3f, %s\n", - emotion_object_progress_status_get(o), - emotion_object_progress_info_get(o)); + emotion_object_progress_status_get(obj), + emotion_object_progress_info_get(obj)); + + return EINA_TRUE; } -static void -_frame_resize_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_frame_resize_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { int w, h; emotion_object_size_get(o, &w, &h); fprintf(stderr, "smartcb: frame_resize: %dx%d\n", w, h); + + return EINA_TRUE; } +static const Eo_Callback_Array_Item emotion_object_example_callbacks[] = { + { EMOTION_OBJECT_EVENT_FRAME_DECODE, _frame_decode_cb }, + { EMOTION_OBJECT_EVENT_LENGTH_CHANGE, _length_change_cb }, + { EMOTION_OBJECT_EVENT_POSITION_UPDATE, _position_update_cb }, + { EMOTION_OBJECT_EVENT_PROGRESS_CHANGE, _progress_change_cb }, + { NULL, NULL } +}; + int main(int argc, const char *argv[]) { @@ -206,11 +238,7 @@ main(int argc, const char *argv[]) evas_object_resize(em, WIDTH, HEIGHT); evas_object_show(em); - evas_object_smart_callback_add(em, "frame_decode", _frame_decode_cb, NULL); - evas_object_smart_callback_add(em, "length_change", _length_change_cb, NULL); - evas_object_smart_callback_add(em, "position_update", _position_update_cb, NULL); - evas_object_smart_callback_add(em, "progress_change", _progress_change_cb, NULL); - evas_object_smart_callback_add(em, "frame_resize", _frame_resize_cb, NULL); + eo_do(em, eo_event_callback_array_add(emotion_object_example_callbacks, NULL)); evas_object_event_callback_add(bg, EVAS_CALLBACK_KEY_DOWN, _on_key_down, em); evas_object_focus_set(bg, EINA_TRUE); diff --git a/src/examples/emotion/emotion_generic_subtitle_example.c b/src/examples/emotion/emotion_generic_subtitle_example.c index b5fb5a8..03b8aab 100644 --- a/src/examples/emotion/emotion_generic_subtitle_example.c +++ b/src/examples/emotion/emotion_generic_subtitle_example.c @@ -1,5 +1,8 @@ //Compile with: -// gcc -o emotion_generic_subtitle_example emotion_generic_subtitle_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas` +// gcc -o emotion_generic_subtitle_example emotion_generic_subtitle_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas eo` + +#define EFL_EO_API_SUPPORT +#define EFL_BETA_API_SUPPORT #include <Ecore.h> #include <Ecore_Evas.h> @@ -10,10 +13,13 @@ #define WIDTH (320) #define HEIGHT (240) -static void -_playback_started_cb(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) +static Eina_Bool +_playback_started_cb(void *data EINA_UNUSED, + Eo *o EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("Emotion object started playback.\n"); + + return EINA_TRUE; } static void @@ -74,8 +80,8 @@ main(int argc, const char *argv[]) if (subtitle_filename) emotion_object_video_subtitle_file_set(em, subtitle_filename); - evas_object_smart_callback_add( - em, "playback_started", _playback_started_cb, NULL); + eo_do(em, eo_event_callback_add + (EMOTION_OBJECT_EVENT_PLAYBACK_STARTED, _playback_started_cb, NULL)); emotion_object_file_set(em, filename); diff --git a/src/examples/emotion/emotion_signals_example.c b/src/examples/emotion/emotion_signals_example.c index dd83ac2..3c56c40 100644 --- a/src/examples/emotion/emotion_signals_example.c +++ b/src/examples/emotion/emotion_signals_example.c @@ -1,5 +1,8 @@ //Compile with: -// gcc -o emotion_signals_example emotion_signals_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas` +// gcc -o emotion_signals_example emotion_signals_example.c `pkg-config --libs --cflags emotion evas ecore ecore-evas eo` + +#define EFL_EO_API_SUPPORT +#define EFL_BETA_API_SUPPORT #include <Ecore.h> #include <Ecore_Evas.h> @@ -30,74 +33,96 @@ _display_info(Evas_Object *o) printf("\n"); } -static void -_playback_started_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_playback_started_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf(">>> Emotion object started playback.\n"); _display_info(o); + + return EINA_TRUE; } -static void -_playback_finished_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_playback_finished_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf(">>> Emotion object finished playback.\n"); _display_info(o); + + return EINA_TRUE; } -static void -_open_done_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_open_done_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf(">>> Emotion object open done.\n"); _display_info(o); + + return EINA_TRUE; } -static void -_position_update_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_position_update_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf(">>> Emotion object first position update.\n"); - evas_object_smart_callback_del(o, "position_update", _position_update_cb); + eo_do(o, eo_event_callback_del(EMOTION_OBJECT_EVENT_POSITION_UPDATE, + _position_update_cb, NULL)); _display_info(o); + + return EINA_TRUE; } -static void -_frame_decode_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_frame_decode_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf(">>> Emotion object first frame decode.\n"); - evas_object_smart_callback_del(o, "frame_decode", _frame_decode_cb); + eo_do(o, eo_event_callback_del(EMOTION_OBJECT_EVENT_FRAME_DECODE, + _frame_decode_cb, NULL)); _display_info(o); + + return EINA_TRUE; } -static void -_decode_stop_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_decode_stop_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf(">>> Emotion object decode stop.\n"); _display_info(o); + + return EINA_TRUE; } -static void -_frame_resize_cb(void *data EINA_UNUSED, Evas_Object *o, void *event_info EINA_UNUSED) +static Eina_Bool +_frame_resize_cb(void *data EINA_UNUSED, + Eo *o, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf(">>> Emotion object frame resize.\n"); _display_info(o); + + return EINA_TRUE; } +static const Eo_Callback_Array_Item emotion_object_example_callbacks[] = { + { EMOTION_OBJECT_EVENT_PLAYBACK_STARTED, _playback_started_cb }, + { EMOTION_OBJECT_EVENT_PLAYBACK_FINISHED, _playback_finished_cb }, + { EMOTION_OBJECT_EVENT_OPEN_DONE, _open_done_cb }, + { EMOTION_OBJECT_EVENT_POSITION_UPDATE, _position_update_cb }, + { EMOTION_OBJECT_EVENT_FRAME_DECODE, _frame_decode_cb }, + { EMOTION_OBJECT_EVENT_DECODE_STOP, _decode_stop_cb }, + { EMOTION_OBJECT_EVENT_FRAME_RESIZE, _frame_resize_cb }, + { NULL, NULL } +}; + static void _setup_emotion_callbacks(Evas_Object *o) { - evas_object_smart_callback_add( - o, "playback_started", _playback_started_cb, NULL); - evas_object_smart_callback_add( - o, "playback_finished", _playback_finished_cb, NULL); - evas_object_smart_callback_add( - o, "open_done", _open_done_cb, NULL); - evas_object_smart_callback_add( - o, "position_update", _position_update_cb, NULL); - evas_object_smart_callback_add( - o, "frame_decode", _frame_decode_cb, NULL); - evas_object_smart_callback_add( - o, "decode_stop", _decode_stop_cb, NULL); - evas_object_smart_callback_add( - o, "frame_resize", _frame_resize_cb, NULL); + eo_do(o, eo_event_callback_add + (EMOTION_OBJECT_EVENT_PLAYBACK_STARTED, _playback_started_cb, NULL)); } int diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c index fbbbb49..ea1130e 100644 --- a/src/lib/emotion/emotion_smart.c +++ b/src/lib/emotion/emotion_smart.c @@ -123,29 +123,6 @@ static void _mouse_down(void *data, Evas *ev, Evas_Object *obj, void *event_info static void _pos_set_job(void *data); static void _pixels_get(void *data, Evas_Object *obj); -/**********************************/ -/* Globals for the E Video Object */ -/**********************************/ -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 const char SIG_FRAME_RESIZE[] = "frame_resize"; -static const char SIG_DECODE_STOP[] = "decode_stop"; -static const char SIG_PLAYBACK_STARTED[] = "playback_started"; -static const char SIG_PLAYBACK_FINISHED[] = "playback_finished"; -static const char SIG_AUDIO_LEVEL_CHANGE[] = "audio_level_change"; -static const char SIG_CHANNELS_CHANGE[] = "channels_change"; -static const char SIG_TITLE_CHANGE[] = "title_change"; -static const char SIG_PROGRESS_CHANGE[] = "progress_change"; -static const char SIG_REF_CHANGE[] = "ref_change"; -static const char SIG_BUTTON_NUM_CHANGE[] = "button_num_change"; -static const char SIG_BUTTON_CHANGE[] = "button_change"; -static const char SIG_OPEN_DONE[] = "open_done"; -static const char SIG_POSITION_SAVE_SUCCEED[] = "position_save,succeed"; -static const char SIG_POSITION_SAVE_FAILED[] = "position_save,failed"; -static const char SIG_POSITION_LOAD_SUCCEED[] = "position_load,succeed"; -static const char SIG_POSITION_LOAD_FAILED[] = "position_load,failed"; - static void _engine_init(Eo *obj, Emotion_Object_Data *sd) { @@ -1341,7 +1318,8 @@ _eio_load_xattr_done(void *data, Eio_File *handler, double xattr_double) Emotion_Object_Data *sd = data; emotion_object_position_set(evas_object_smart_parent_get(sd->obj), xattr_double); - evas_object_smart_callback_call(evas_object_smart_parent_get(sd->obj), SIG_POSITION_LOAD_SUCCEED, NULL); + eo_do(evas_object_smart_parent_get(sd->obj), + eo_event_callback_call(EMOTION_OBJECT_EVENT_POSITION_LOAD_SUCCEED, NULL)); _eio_load_xattr_cleanup(sd, handler); } @@ -1350,7 +1328,8 @@ _eio_load_xattr_error(void *data, Eio_File *handler, int err EINA_UNUSED) { Emotion_Object_Data *sd = data; - evas_object_smart_callback_call(evas_object_smart_parent_get(sd->obj), SIG_POSITION_LOAD_FAILED, NULL); + eo_do(evas_object_smart_parent_get(sd->obj), + eo_event_callback_call(EMOTION_OBJECT_EVENT_POSITION_LOAD_FAILED, NULL)); _eio_load_xattr_cleanup(sd, handler); } #endif @@ -1385,10 +1364,10 @@ emotion_object_last_position_load(Evas_Object *obj) if (eina_xattr_double_get(tmp, "user.e.time_seek", &xattr)) { emotion_object_position_set(obj, xattr); - evas_object_smart_callback_call(obj, SIG_POSITION_LOAD_SUCCEED, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_POSITION_LOAD_SUCCEED, NULL)); } else - evas_object_smart_callback_call(obj, SIG_POSITION_LOAD_FAILED, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_POSITION_LOAD_FAILED, NULL)); #endif } @@ -1411,7 +1390,7 @@ _eio_save_xattr_done(void *data, Eio_File *handler) { Emotion_Object_Data *sd = data; - evas_object_smart_callback_call(sd->obj, SIG_POSITION_SAVE_SUCCEED, NULL); + eo_do(sd->obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_POSITION_SAVE_SUCCEED, NULL)); _eio_save_xattr_cleanup(sd, handler); } @@ -1420,7 +1399,7 @@ _eio_save_xattr_error(void *data, Eio_File *handler, int err EINA_UNUSED) { Emotion_Object_Data *sd = data; - evas_object_smart_callback_call(sd->obj, SIG_POSITION_SAVE_FAILED, NULL); + eo_do(sd->obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_POSITION_SAVE_FAILED, NULL)); _eio_save_xattr_cleanup(sd, handler); } #endif @@ -1450,9 +1429,10 @@ emotion_object_last_position_save(Evas_Object *obj) sd); #else if (eina_xattr_double_set(tmp, "user.e.time_seek", emotion_object_position_get(obj), 0)) - evas_object_smart_callback_call(obj, SIG_POSITION_SAVE_SUCCEED, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_POSITION_SAVE_SUCCEED, NULL)); else - evas_object_smart_callback_call(obj, SIG_POSITION_SAVE_FAILED, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_POSITION_SAVE_FAILED, NULL)); + #endif } @@ -1513,7 +1493,7 @@ _emotion_frame_anim(void *data) _emotion_video_pos_update(obj, emotion_engine_instance_pos_get(sd->engine_instance), emotion_engine_instance_len_get(sd->engine_instance)); - evas_object_smart_callback_call(obj, SIG_FRAME_DECODE, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_FRAME_DECODE, NULL)); return EINA_FALSE; } @@ -1537,8 +1517,10 @@ _emotion_video_pos_update(Evas_Object *obj, double pos, double len) if (len != sd->len) nlen = 1; sd->pos = pos; sd->len = len; - if (npos) evas_object_smart_callback_call(obj, SIG_POSITION_UPDATE, NULL); - if (nlen) evas_object_smart_callback_call(obj, SIG_LENGTH_CHANGE, NULL); + if (npos) eo_do(obj, + eo_event_callback_call(EMOTION_OBJECT_EVENT_POSITION_UPDATE, NULL)); + if (nlen) eo_do(obj, + eo_event_callback_call(EMOTION_OBJECT_EVENT_LENGTH_CHANGE, NULL)); } EAPI void @@ -1567,7 +1549,7 @@ _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio) if (changed) { evas_object_size_hint_request_set(obj, w, h); - evas_object_smart_callback_call(obj, SIG_FRAME_RESIZE, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_FRAME_RESIZE, NULL)); evas_object_geometry_get(obj, NULL, NULL, &w, &h); _emotion_object_aspect_border_apply(obj, sd, w, h); } @@ -1591,7 +1573,7 @@ _emotion_decode_stop(Evas_Object *obj) if (sd->play) { sd->play = 0; - evas_object_smart_callback_call(obj, SIG_DECODE_STOP, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_DECODE_STOP, NULL)); } } @@ -1607,25 +1589,26 @@ _emotion_open_done(Evas_Object *obj) emotion_object_position_set(obj, sd->remember_jump); if (sd->remember_play != sd->play) emotion_object_play_set(obj, sd->remember_play); - evas_object_smart_callback_call(obj, SIG_OPEN_DONE, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_OPEN_DONE, NULL)); + } EAPI void _emotion_playback_started(Evas_Object *obj) { - evas_object_smart_callback_call(obj, SIG_PLAYBACK_STARTED, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_PLAYBACK_STARTED, NULL)); } EAPI void _emotion_playback_finished(Evas_Object *obj) { - evas_object_smart_callback_call(obj, SIG_PLAYBACK_FINISHED, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_PLAYBACK_FINISHED, NULL)); } EAPI void _emotion_audio_level_change(Evas_Object *obj) { - evas_object_smart_callback_call(obj, SIG_AUDIO_LEVEL_CHANGE, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_AUDIO_LEVEL_CHANGE, NULL)); } EAPI void @@ -1634,7 +1617,7 @@ _emotion_channels_change(Evas_Object *obj) Emotion_Object_Data *sd; E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); - evas_object_smart_callback_call(obj, SIG_CHANNELS_CHANGE, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_CHANNELS_CHANGE, NULL)); } EAPI void @@ -1644,7 +1627,8 @@ _emotion_title_set(Evas_Object *obj, char *title) E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); eina_stringshare_replace(&sd->title, title); - evas_object_smart_callback_call(obj, SIG_TITLE_CHANGE, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_TITLE_CHANGE, NULL)); + } EAPI void @@ -1655,7 +1639,7 @@ _emotion_progress_set(Evas_Object *obj, char *info, double st) E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); eina_stringshare_replace(&sd->progress.info, info); sd->progress.stat = st; - evas_object_smart_callback_call(obj, SIG_PROGRESS_CHANGE, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_PROGRESS_CHANGE, NULL)); } EAPI void @@ -1666,7 +1650,7 @@ _emotion_file_ref_set(Evas_Object *obj, const char *file, int num) E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); eina_stringshare_replace(&sd->ref.file, file); sd->ref.num = num; - evas_object_smart_callback_call(obj, SIG_REF_CHANGE, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_REF_CHANGE, NULL)); } EAPI void @@ -1676,7 +1660,7 @@ _emotion_spu_button_num_set(Evas_Object *obj, int num) E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); sd->spu.button_num = num; - evas_object_smart_callback_call(obj, SIG_BUTTON_NUM_CHANGE, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_BUTTON_NUM_CHANGE, NULL)); } EAPI void @@ -1686,7 +1670,7 @@ _emotion_spu_button_set(Evas_Object *obj, int button) E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); sd->spu.button = button; - evas_object_smart_callback_call(obj, SIG_BUTTON_CHANGE, NULL); + eo_do(obj, eo_event_callback_call(EMOTION_OBJECT_EVENT_BUTTON_CHANGE, NULL)); } EAPI void diff --git a/src/modules/ethumb/emotion/emotion.c b/src/modules/ethumb/emotion/emotion.c index 4443712..6134406 100644 --- a/src/modules/ethumb/emotion/emotion.c +++ b/src/modules/ethumb/emotion/emotion.c @@ -1,5 +1,8 @@ #ifdef HAVE_CONFIG_H #include "config.h" +#else +#define EFL_EO_API_SUPPORT +#define EFL_BETA_API_SUPPORT #endif #include "Ethumb.h" @@ -9,6 +12,7 @@ #include <stdio.h> #include <stdlib.h> +#include <Eo.h> #include <Eina.h> #include <Eet.h> #include <Ecore_File.h> @@ -67,8 +71,9 @@ _resize_movie(struct _emotion_plugin *_plugin) emotion_object_audio_mute_set(_plugin->video, 1); } -static void -_frame_decode_cb(void *data, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) +static Eina_Bool +_frame_decode_cb(void *data, + Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { struct _emotion_plugin *_plugin = data; @@ -76,16 +81,22 @@ _frame_decode_cb(void *data, Evas_Object *o EINA_UNUSED, void *event_info EINA_U _frame_grab(data); else _frame_grab_single(data); -} -static void -_frame_resized_cb(void *data, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) + return EINA_TRUE; + } + +static Eina_Bool +_frame_resized_cb(void *data, + Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { _resize_movie(data); + + return EINA_TRUE; } -static void -_video_stopped_cb(void *data, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) +static Eina_Bool +_video_stopped_cb(void *data, + Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { struct _emotion_plugin *_plugin = data; @@ -94,6 +105,8 @@ _video_stopped_cb(void *data, Evas_Object *o EINA_UNUSED, void *event_info EINA_ _plugin->ptotal = 0; _plugin->first = EINA_FALSE; _plugin->total_time = _plugin->tmp_time; + + return EINA_TRUE; } static void @@ -194,12 +207,12 @@ _finish_thumb_generation(struct _emotion_plugin *_plugin, int success) { int r = 0; - evas_object_smart_callback_del(_plugin->video, "frame_resize", - _frame_resized_cb); - evas_object_smart_callback_del(_plugin->video, "frame_decode", - _frame_decode_cb); - evas_object_smart_callback_del(_plugin->video, "decode_stop", - _video_stopped_cb); + eo_do(_plugin->video, eo_event_callback_del( + EMOTION_OBJECT_EVENT_FRAME_RESIZE, _frame_resized_cb, _plugin)); + eo_do(_plugin->video, eo_event_callback_del( + EMOTION_OBJECT_EVENT_FRAME_DECODE, _frame_decode_cb, _plugin)); + eo_do(_plugin->video, eo_event_callback_del( + EMOTION_OBJECT_EVENT_DECODE_STOP, _video_stopped_cb, _plugin)); emotion_object_play_set(_plugin->video, 0); @@ -243,8 +256,9 @@ _frame_grab_single(void *data) ethumb_image_save(e); - evas_object_smart_callback_del(_plugin->video, "frame_resize", - _frame_resized_cb); + eo_do(_plugin->video, eo_event_callback_del( + EMOTION_OBJECT_EVENT_FRAME_RESIZE, _frame_resized_cb, _plugin)); + emotion_object_play_set(_plugin->video, 0); evas_object_del(_plugin->video); free(_plugin); @@ -383,12 +397,12 @@ _thumb_generate(Ethumb *e) _plugin->pcount = 1; _resize_movie(_plugin); - evas_object_smart_callback_add(o, "frame_decode", - _frame_decode_cb, _plugin); - evas_object_smart_callback_add(o, "frame_resize", - _frame_resized_cb, _plugin); - evas_object_smart_callback_add(o, "decode_stop", - _video_stopped_cb, _plugin); + eo_do(o, eo_event_callback_add + (EMOTION_OBJECT_EVENT_FRAME_DECODE, _frame_decode_cb, _plugin)); + eo_do(o, eo_event_callback_add + (EMOTION_OBJECT_EVENT_FRAME_RESIZE,_frame_resized_cb, _plugin)); + eo_do(o, eo_event_callback_add + (EMOTION_OBJECT_EVENT_DECODE_STOP, _video_stopped_cb, _plugin)); if (f == ETHUMB_THUMB_EET) { diff --git a/src/tests/emotion/emotion_test_main.c b/src/tests/emotion/emotion_test_main.c index 24ab7db..3d7d4a9 100644 --- a/src/tests/emotion/emotion_test_main.c +++ b/src/tests/emotion/emotion_test_main.c @@ -1,7 +1,11 @@ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" +#else +#define EFL_EO_API_SUPPORT +#define EFL_BETA_API_SUPPORT #endif +#include <Eo.h> #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -325,8 +329,9 @@ video_obj_time_changed(Evas_Object *obj, Evas_Object *edje) edje_object_part_text_set(edje, "video_progress_txt", buf); } -static void -video_obj_frame_decode_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +static Eina_Bool +video_obj_frame_decode_cb(void *data, + Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { video_obj_time_changed(obj, data); @@ -338,10 +343,12 @@ video_obj_frame_decode_cb(void *data, Evas_Object *obj, void *event_info EINA_UN printf("FPS: %3.3f\n", 1.0 / (t - pt)); pt = t; } + return EINA_TRUE; } -static void -video_obj_frame_resize_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +static Eina_Bool +video_obj_frame_resize_cb(void *data, + Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { Evas_Object *oe; int iw, ih; @@ -359,24 +366,33 @@ video_obj_frame_resize_cb(void *data, Evas_Object *obj, void *event_info EINA_UN evas_object_resize(oe, w, h); evas_object_size_hint_min_set(obj, 0, 0); edje_object_part_swallow(oe, "video_swallow", obj); + + return EINA_TRUE; } -static void -video_obj_length_change_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +static Eina_Bool +video_obj_length_change_cb(void *data, + Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("len change!\n"); video_obj_time_changed(obj, data); + + return EINA_TRUE; } -static void -video_obj_position_update_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +static Eina_Bool +video_obj_position_update_cb(void *data, + Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("pos up!\n"); video_obj_time_changed(obj, data); + + return EINA_TRUE; } -static void -video_obj_stopped_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +static Eina_Bool +video_obj_stopped_cb(void *data EINA_UNUSED, + Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("video stopped!!!\n"); if (loop) @@ -384,53 +400,72 @@ video_obj_stopped_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info emotion_object_position_set(obj, 0.0); emotion_object_play_set(obj, 1); } + + return EINA_TRUE; } -static void -video_obj_channels_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +static Eina_Bool +video_obj_channels_cb(void *data EINA_UNUSED, + Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("channels changed: [AUD %i][VID %i][SPU %i]\n", emotion_object_audio_channel_count(obj), emotion_object_video_channel_count(obj), emotion_object_spu_channel_count(obj)); + + return EINA_TRUE; } -static void -video_obj_title_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +static Eina_Bool + video_obj_title_cb(void *data EINA_UNUSED, + Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("video title to: \"%s\"\n", emotion_object_title_get(obj)); + + return EINA_TRUE; } -static void -video_obj_progress_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +static Eina_Bool +video_obj_progress_cb(void *data EINA_UNUSED, + Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("progress: \"%s\" %3.3f\n", emotion_object_progress_info_get(obj), emotion_object_progress_status_get(obj)); + + return EINA_TRUE; } -static void -video_obj_ref_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +static Eina_Bool +video_obj_ref_cb(void *data EINA_UNUSED, + Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("video ref to: \"%s\" %i\n", emotion_object_ref_file_get(obj), emotion_object_ref_num_get(obj)); + + return EINA_TRUE; } -static void -video_obj_button_num_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +static Eina_Bool +video_obj_button_num_cb(void *data EINA_UNUSED, + Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("video spu buttons to: %i\n", emotion_object_spu_button_count_get(obj)); + + return EINA_TRUE; } -static void -video_obj_button_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +static Eina_Bool +video_obj_button_cb(void *data EINA_UNUSED, + Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { printf("video selected spu button: %i\n", emotion_object_spu_button_get(obj)); -} + return EINA_TRUE; +} static void video_obj_signal_play_cb(void *data, Evas_Object *o, const char *emission EINA_UNUSED, const char *source EINA_UNUSED) @@ -576,6 +611,20 @@ video_obj_signal_frame_move_cb(void *data EINA_UNUSED, Evas_Object *o, const cha } } +static const Eo_Callback_Array_Item emotion_object_test_callbacks[] = { + { EMOTION_OBJECT_EVENT_FRAME_DECODE, video_obj_frame_decode_cb }, + { EMOTION_OBJECT_EVENT_FRAME_RESIZE, video_obj_frame_resize_cb }, + { EMOTION_OBJECT_EVENT_LENGTH_CHANGE, video_obj_length_change_cb }, + { EMOTION_OBJECT_EVENT_POSITION_UPDATE, video_obj_position_update_cb }, + { EMOTION_OBJECT_EVENT_DECODE_STOP, video_obj_stopped_cb }, + { EMOTION_OBJECT_EVENT_CHANNELS_CHANGE, video_obj_channels_cb }, + { EMOTION_OBJECT_EVENT_TITLE_CHANGE, video_obj_title_cb }, + { EMOTION_OBJECT_EVENT_PROGRESS_CHANGE, video_obj_progress_cb }, + { EMOTION_OBJECT_EVENT_REF_CHANGE, video_obj_ref_cb }, + { EMOTION_OBJECT_EVENT_BUTTON_NUM_CHANGE, video_obj_button_num_cb }, + { EMOTION_OBJECT_EVENT_BUTTON_CHANGE, video_obj_button_cb }, + { NULL, NULL } +}; static void init_video_object(const char *module_filename, const char *filename) @@ -621,18 +670,7 @@ init_video_object(const char *module_filename, const char *filename) edje_object_size_min_calc(oe, &w, &h); evas_object_resize(oe, w, h); - 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); - evas_object_smart_callback_add(o, "position_update", video_obj_position_update_cb, oe); - - evas_object_smart_callback_add(o, "decode_stop", video_obj_stopped_cb, oe); - evas_object_smart_callback_add(o, "channels_change", video_obj_channels_cb, oe); - evas_object_smart_callback_add(o, "title_change", video_obj_title_cb, oe); - evas_object_smart_callback_add(o, "progress_change", video_obj_progress_cb, oe); - 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); + eo_do(o, eo_event_callback_array_add(emotion_object_test_callbacks, 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); --