summaryrefslogtreecommitdiff
path: root/src/tests/emotion
diff options
context:
space:
mode:
authorAvi Levin <avi.levin@samsung.com>2015-04-26 14:49:26 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2015-06-07 11:00:52 +0300
commitf9c116a48749c642eb31154a4cfb5f60a110dcba (patch)
tree2cbf4d8891d6aa65c5f8867cb95549947208b864 /src/tests/emotion
parentb563efc52ffbc02ae33d4901326a583102975cbb (diff)
emotion: porting evas smart callbacks to eo
Diffstat (limited to 'src/tests/emotion')
-rw-r--r--src/tests/emotion/emotion_test_main.c110
1 files changed, 74 insertions, 36 deletions
diff --git a/src/tests/emotion/emotion_test_main.c b/src/tests/emotion/emotion_test_main.c
index 24ab7dbffe..3d7d4a935e 100644
--- a/src/tests/emotion/emotion_test_main.c
+++ b/src/tests/emotion/emotion_test_main.c
@@ -1,7 +1,11 @@
1#ifdef HAVE_CONFIG_H 1#ifdef HAVE_CONFIG_H
2# include "config.h" 2#include "config.h"
3#else
4#define EFL_EO_API_SUPPORT
5#define EFL_BETA_API_SUPPORT
3#endif 6#endif
4 7
8#include <Eo.h>
5#include <stdlib.h> 9#include <stdlib.h>
6#include <stdio.h> 10#include <stdio.h>
7#include <string.h> 11#include <string.h>
@@ -325,8 +329,9 @@ video_obj_time_changed(Evas_Object *obj, Evas_Object *edje)
325 edje_object_part_text_set(edje, "video_progress_txt", buf); 329 edje_object_part_text_set(edje, "video_progress_txt", buf);
326} 330}
327 331
328static void 332static Eina_Bool
329video_obj_frame_decode_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 333video_obj_frame_decode_cb(void *data,
334 Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
330{ 335{
331 video_obj_time_changed(obj, data); 336 video_obj_time_changed(obj, data);
332 337
@@ -338,10 +343,12 @@ video_obj_frame_decode_cb(void *data, Evas_Object *obj, void *event_info EINA_UN
338 printf("FPS: %3.3f\n", 1.0 / (t - pt)); 343 printf("FPS: %3.3f\n", 1.0 / (t - pt));
339 pt = t; 344 pt = t;
340 } 345 }
346 return EINA_TRUE;
341} 347}
342 348
343static void 349static Eina_Bool
344video_obj_frame_resize_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 350video_obj_frame_resize_cb(void *data,
351 Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
345{ 352{
346 Evas_Object *oe; 353 Evas_Object *oe;
347 int iw, ih; 354 int iw, ih;
@@ -359,24 +366,33 @@ video_obj_frame_resize_cb(void *data, Evas_Object *obj, void *event_info EINA_UN
359 evas_object_resize(oe, w, h); 366 evas_object_resize(oe, w, h);
360 evas_object_size_hint_min_set(obj, 0, 0); 367 evas_object_size_hint_min_set(obj, 0, 0);
361 edje_object_part_swallow(oe, "video_swallow", obj); 368 edje_object_part_swallow(oe, "video_swallow", obj);
369
370 return EINA_TRUE;
362} 371}
363 372
364static void 373static Eina_Bool
365video_obj_length_change_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 374video_obj_length_change_cb(void *data,
375 Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
366{ 376{
367 printf("len change!\n"); 377 printf("len change!\n");
368 video_obj_time_changed(obj, data); 378 video_obj_time_changed(obj, data);
379
380 return EINA_TRUE;
369} 381}
370 382
371static void 383static Eina_Bool
372video_obj_position_update_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 384video_obj_position_update_cb(void *data,
385 Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
373{ 386{
374 printf("pos up!\n"); 387 printf("pos up!\n");
375 video_obj_time_changed(obj, data); 388 video_obj_time_changed(obj, data);
389
390 return EINA_TRUE;
376} 391}
377 392
378static void 393static Eina_Bool
379video_obj_stopped_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) 394video_obj_stopped_cb(void *data EINA_UNUSED,
395 Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
380{ 396{
381 printf("video stopped!!!\n"); 397 printf("video stopped!!!\n");
382 if (loop) 398 if (loop)
@@ -384,53 +400,72 @@ video_obj_stopped_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info
384 emotion_object_position_set(obj, 0.0); 400 emotion_object_position_set(obj, 0.0);
385 emotion_object_play_set(obj, 1); 401 emotion_object_play_set(obj, 1);
386 } 402 }
403
404 return EINA_TRUE;
387} 405}
388 406
389static void 407static Eina_Bool
390video_obj_channels_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) 408video_obj_channels_cb(void *data EINA_UNUSED,
409 Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
391{ 410{
392 printf("channels changed: [AUD %i][VID %i][SPU %i]\n", 411 printf("channels changed: [AUD %i][VID %i][SPU %i]\n",
393 emotion_object_audio_channel_count(obj), 412 emotion_object_audio_channel_count(obj),
394 emotion_object_video_channel_count(obj), 413 emotion_object_video_channel_count(obj),
395 emotion_object_spu_channel_count(obj)); 414 emotion_object_spu_channel_count(obj));
415
416 return EINA_TRUE;
396} 417}
397 418
398static void 419static Eina_Bool
399video_obj_title_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) 420 video_obj_title_cb(void *data EINA_UNUSED,
421 Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
400{ 422{
401 printf("video title to: \"%s\"\n", emotion_object_title_get(obj)); 423 printf("video title to: \"%s\"\n", emotion_object_title_get(obj));
424
425 return EINA_TRUE;
402} 426}
403 427
404static void 428static Eina_Bool
405video_obj_progress_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) 429video_obj_progress_cb(void *data EINA_UNUSED,
430 Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
406{ 431{
407 printf("progress: \"%s\" %3.3f\n", 432 printf("progress: \"%s\" %3.3f\n",
408 emotion_object_progress_info_get(obj), 433 emotion_object_progress_info_get(obj),
409 emotion_object_progress_status_get(obj)); 434 emotion_object_progress_status_get(obj));
435
436 return EINA_TRUE;
410} 437}
411 438
412static void 439static Eina_Bool
413video_obj_ref_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) 440video_obj_ref_cb(void *data EINA_UNUSED,
441 Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
414{ 442{
415 printf("video ref to: \"%s\" %i\n", 443 printf("video ref to: \"%s\" %i\n",
416 emotion_object_ref_file_get(obj), 444 emotion_object_ref_file_get(obj),
417 emotion_object_ref_num_get(obj)); 445 emotion_object_ref_num_get(obj));
446
447 return EINA_TRUE;
418} 448}
419 449
420static void 450static Eina_Bool
421video_obj_button_num_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) 451video_obj_button_num_cb(void *data EINA_UNUSED,
452 Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
422{ 453{
423 printf("video spu buttons to: %i\n", 454 printf("video spu buttons to: %i\n",
424 emotion_object_spu_button_count_get(obj)); 455 emotion_object_spu_button_count_get(obj));
456
457 return EINA_TRUE;
425} 458}
426 459
427static void 460static Eina_Bool
428video_obj_button_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) 461video_obj_button_cb(void *data EINA_UNUSED,
462 Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
429{ 463{
430 printf("video selected spu button: %i\n", 464 printf("video selected spu button: %i\n",
431 emotion_object_spu_button_get(obj)); 465 emotion_object_spu_button_get(obj));
432}
433 466
467 return EINA_TRUE;
468}
434 469
435static void 470static void
436video_obj_signal_play_cb(void *data, Evas_Object *o, const char *emission EINA_UNUSED, const char *source EINA_UNUSED) 471video_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
576 } 611 }
577} 612}
578 613
614static const Eo_Callback_Array_Item emotion_object_test_callbacks[] = {
615 { EMOTION_OBJECT_EVENT_FRAME_DECODE, video_obj_frame_decode_cb },
616 { EMOTION_OBJECT_EVENT_FRAME_RESIZE, video_obj_frame_resize_cb },
617 { EMOTION_OBJECT_EVENT_LENGTH_CHANGE, video_obj_length_change_cb },
618 { EMOTION_OBJECT_EVENT_POSITION_UPDATE, video_obj_position_update_cb },
619 { EMOTION_OBJECT_EVENT_DECODE_STOP, video_obj_stopped_cb },
620 { EMOTION_OBJECT_EVENT_CHANNELS_CHANGE, video_obj_channels_cb },
621 { EMOTION_OBJECT_EVENT_TITLE_CHANGE, video_obj_title_cb },
622 { EMOTION_OBJECT_EVENT_PROGRESS_CHANGE, video_obj_progress_cb },
623 { EMOTION_OBJECT_EVENT_REF_CHANGE, video_obj_ref_cb },
624 { EMOTION_OBJECT_EVENT_BUTTON_NUM_CHANGE, video_obj_button_num_cb },
625 { EMOTION_OBJECT_EVENT_BUTTON_CHANGE, video_obj_button_cb },
626 { NULL, NULL }
627};
579 628
580static void 629static void
581init_video_object(const char *module_filename, const char *filename) 630init_video_object(const char *module_filename, const char *filename)
@@ -621,18 +670,7 @@ init_video_object(const char *module_filename, const char *filename)
621 edje_object_size_min_calc(oe, &w, &h); 670 edje_object_size_min_calc(oe, &w, &h);
622 evas_object_resize(oe, w, h); 671 evas_object_resize(oe, w, h);
623 672
624 evas_object_smart_callback_add(o, "frame_decode", video_obj_frame_decode_cb, oe); 673 eo_do(o, eo_event_callback_array_add(emotion_object_test_callbacks, oe));
625 evas_object_smart_callback_add(o, "frame_resize", video_obj_frame_resize_cb, oe);
626 evas_object_smart_callback_add(o, "length_change", video_obj_length_change_cb, oe);
627 evas_object_smart_callback_add(o, "position_update", video_obj_position_update_cb, oe);
628
629 evas_object_smart_callback_add(o, "decode_stop", video_obj_stopped_cb, oe);
630 evas_object_smart_callback_add(o, "channels_change", video_obj_channels_cb, oe);
631 evas_object_smart_callback_add(o, "title_change", video_obj_title_cb, oe);
632 evas_object_smart_callback_add(o, "progress_change", video_obj_progress_cb, oe);
633 evas_object_smart_callback_add(o, "ref_change", video_obj_ref_cb, oe);
634 evas_object_smart_callback_add(o, "button_num_change", video_obj_button_num_cb, oe);
635 evas_object_smart_callback_add(o, "button_change", video_obj_button_cb, oe);
636 674
637 edje_object_signal_callback_add(oe, "video_control", "play", video_obj_signal_play_cb, o); 675 edje_object_signal_callback_add(oe, "video_control", "play", video_obj_signal_play_cb, o);
638 edje_object_signal_callback_add(oe, "video_control", "pause", video_obj_signal_pause_cb, o); 676 edje_object_signal_callback_add(oe, "video_control", "pause", video_obj_signal_pause_cb, o);