summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/bin
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2008-09-26 23:17:57 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2008-09-26 23:17:57 +0000
commitaa3aac7dbfd67d5184d41fa73b581df337bcc7ef (patch)
treec7a2a65a01bb4fdb05b6c0d2b4e4e9a173baa716 /legacy/emotion/src/bin
parent2acd11a39ec554ef390bb840175a11e108732379 (diff)
Fix position reporting.
Always call pos_get() and also fix these on xine and gstreamer, we should query the current position and do not trust cached value. For instance, when no video is present, no handoff/frame-decoded is called so no cache is updated. SVN revision: 36271
Diffstat (limited to 'legacy/emotion/src/bin')
-rw-r--r--legacy/emotion/src/bin/emotion_test_main.c54
1 files changed, 30 insertions, 24 deletions
diff --git a/legacy/emotion/src/bin/emotion_test_main.c b/legacy/emotion/src/bin/emotion_test_main.c
index fbf2a0442f..10be617a15 100644
--- a/legacy/emotion/src/bin/emotion_test_main.c
+++ b/legacy/emotion/src/bin/emotion_test_main.c
@@ -467,18 +467,17 @@ video_obj_move_cb(void *data, Evas *ev, Evas_Object *obj, void *event_info)
467} 467}
468 468
469static void 469static void
470video_obj_frame_decode_cb(void *data, Evas_Object *obj, void *event_info) 470video_obj_time_changed(Evas_Object *obj, Evas_Object *edje)
471{ 471{
472 Evas_Object *oe; 472 double pos, len, scale;
473 double pos, len;
474 char buf[256]; 473 char buf[256];
475 int ph, pm, ps, pf, lh, lm, ls; 474 int ph, pm, ps, pf, lh, lm, ls;
476 475
477 oe = data;
478 pos = emotion_object_position_get(obj); 476 pos = emotion_object_position_get(obj);
479 len = emotion_object_play_length_get(obj); 477 len = emotion_object_play_length_get(obj);
480// printf("%3.3f, %3.3f\n", pos, len); 478// printf("%3.3f, %3.3f\n", pos, len);
481 edje_object_part_drag_value_set(oe, "video_progress", pos / len, 0.0); 479 scale = (len > 0.0) ? pos / len : 0.0;
480 edje_object_part_drag_value_set(edje, "video_progress", scale, 0.0);
482 lh = len / 3600; 481 lh = len / 3600;
483 lm = len / 60 - (lh * 60); 482 lm = len / 60 - (lh * 60);
484 ls = len - (lm * 60); 483 ls = len - (lm * 60);
@@ -488,7 +487,13 @@ video_obj_frame_decode_cb(void *data, Evas_Object *obj, void *event_info)
488 pf = pos * 100 - (ps * 100) - (pm * 60 * 100) - (ph * 60 * 60 * 100); 487 pf = pos * 100 - (ps * 100) - (pm * 60 * 100) - (ph * 60 * 60 * 100);
489 snprintf(buf, sizeof(buf), "%i:%02i:%02i.%02i / %i:%02i:%02i", 488 snprintf(buf, sizeof(buf), "%i:%02i:%02i.%02i / %i:%02i:%02i",
490 ph, pm, ps, pf, lh, lm, ls); 489 ph, pm, ps, pf, lh, lm, ls);
491 edje_object_part_text_set(oe, "video_progress_txt", buf); 490 edje_object_part_text_set(edje, "video_progress_txt", buf);
491}
492
493static void
494video_obj_frame_decode_cb(void *data, Evas_Object *obj, void *event_info)
495{
496 video_obj_time_changed(obj, data);
492 497
493 if (0) 498 if (0)
494 { 499 {
@@ -524,25 +529,13 @@ video_obj_frame_resize_cb(void *data, Evas_Object *obj, void *event_info)
524static void 529static void
525video_obj_length_change_cb(void *data, Evas_Object *obj, void *event_info) 530video_obj_length_change_cb(void *data, Evas_Object *obj, void *event_info)
526{ 531{
527 Evas_Object *oe; 532 video_obj_time_changed(obj, data);
528 double pos, len; 533}
529 char buf[256];
530 int ph, pm, ps, pf, lh, lm, ls;
531 534
532 oe = data; 535static void
533 pos = emotion_object_position_get(obj); 536video_obj_position_update_cb(void *data, Evas_Object *obj, void *event_info)
534 len = emotion_object_play_length_get(obj); 537{
535 edje_object_part_drag_value_set(oe, "video_progress", pos / len, 0.0); 538 video_obj_time_changed(obj, data);
536 lh = len / 3600;
537 lm = len / 60 - (lh * 60);
538 ls = len - (lm * 60);
539 ph = pos / 3600;
540 pm = pos / 60 - (ph * 60);
541 ps = pos - (pm * 60);
542 pf = pos * 100 - (ps * 100) - (pm * 60 * 100) - (ph * 60 * 60 * 100);
543 snprintf(buf, sizeof(buf), "%i:%02i:%02i.%02i / %i:%02i:%02i",
544 ph, pm, ps, pf, lh, lm, ls);
545 edje_object_part_text_set(oe, "video_progress_txt", buf);
546} 539}
547 540
548static void 541static void
@@ -801,6 +794,7 @@ init_video_object(char *module_filename, char *filename)
801 evas_object_smart_callback_add(o, "frame_decode", video_obj_frame_decode_cb, oe); 794 evas_object_smart_callback_add(o, "frame_decode", video_obj_frame_decode_cb, oe);
802 evas_object_smart_callback_add(o, "frame_resize", video_obj_frame_resize_cb, oe); 795 evas_object_smart_callback_add(o, "frame_resize", video_obj_frame_resize_cb, oe);
803 evas_object_smart_callback_add(o, "length_change", video_obj_length_change_cb, oe); 796 evas_object_smart_callback_add(o, "length_change", video_obj_length_change_cb, oe);
797 evas_object_smart_callback_add(o, "position_update", video_obj_position_update_cb, oe);
804 798
805 evas_object_smart_callback_add(o, "decode_stop", video_obj_stopped_cb, oe); 799 evas_object_smart_callback_add(o, "decode_stop", video_obj_stopped_cb, oe);
806 evas_object_smart_callback_add(o, "channels_change", video_obj_channels_cb, oe); 800 evas_object_smart_callback_add(o, "channels_change", video_obj_channels_cb, oe);
@@ -848,6 +842,17 @@ enter_idle(void *data)
848 return 1; 842 return 1;
849} 843}
850 844
845static int
846check_positions(void *data)
847{
848 const Evas_List *lst;
849
850 for (lst = video_objs; lst != NULL; lst = lst->next)
851 video_obj_time_changed(lst->data, evas_object_smart_parent_get(lst->data));
852
853 return !!video_objs;
854}
855
851int 856int
852main(int argc, char **argv) 857main(int argc, char **argv)
853{ 858{
@@ -902,6 +907,7 @@ main(int argc, char **argv)
902 } 907 }
903 908
904 ecore_idle_enterer_add(enter_idle, NULL); 909 ecore_idle_enterer_add(enter_idle, NULL);
910 ecore_animator_add(check_positions, NULL);
905 911
906 ecore_main_loop_begin(); 912 ecore_main_loop_begin();
907 main_stop(); 913 main_stop();