summaryrefslogtreecommitdiff
path: root/src/lib/emotion
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-09-24 11:18:57 -0400
committerCedric Bail <cedric.bail@free.fr>2019-09-24 15:23:15 -0700
commit3d3cdc5955560726f0b9a8cef492274a1f7254a4 (patch)
treedb17c01b91b5a1d98367a2e168154fd1a0f4c974 /src/lib/emotion
parent89bee7a11a61d08cc758b061fd2f5e705d1f9029 (diff)
efl/player: rename 'play' property to 'pause'
this is a bit of an overhaul wherein the existing 'play' mechanics are all inverted. 'pause' is a state which stops playback but does not affect the playback_position property. this patch also includes implementations of Efl.Player::playing for a couple classes which (now) only implement pause, as this is a requirement for the objects to actually activate their animations test cases: * unit tests * all elm_test animation cases * elm_test video * rage Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10114
Diffstat (limited to 'src/lib/emotion')
-rw-r--r--src/lib/emotion/efl_canvas_video.eo3
-rw-r--r--src/lib/emotion/emotion_smart.c73
2 files changed, 64 insertions, 12 deletions
diff --git a/src/lib/emotion/efl_canvas_video.eo b/src/lib/emotion/efl_canvas_video.eo
index d8bb286..21bb8a3 100644
--- a/src/lib/emotion/efl_canvas_video.eo
+++ b/src/lib/emotion/efl_canvas_video.eo
@@ -57,7 +57,8 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group
57 Efl.File.unload; 57 Efl.File.unload;
58 Efl.File.file { set; } 58 Efl.File.file { set; }
59 Efl.File.loaded { get; } 59 Efl.File.loaded { get; }
60 Efl.Player.play { get; set; } 60 Efl.Player.playing { get; set; }
61 Efl.Player.paused { get; set; }
61 Efl.Player.playback_position { get; set; } 62 Efl.Player.playback_position { get; set; }
62 Efl.Player.progress { get; } 63 Efl.Player.progress { get; }
63 Efl.Audio_Control.volume { get; set; } 64 Efl.Audio_Control.volume { get; set; }
diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c
index e5183ea..5569e54 100644
--- a/src/lib/emotion/emotion_smart.c
+++ b/src/lib/emotion/emotion_smart.c
@@ -116,6 +116,7 @@ struct _Efl_Canvas_Video_Data
116 116
117 Eina_Bool open : 1; 117 Eina_Bool open : 1;
118 Eina_Bool play : 1; 118 Eina_Bool play : 1;
119 Eina_Bool pause : 1;
119 Eina_Bool remember_play : 1; 120 Eina_Bool remember_play : 1;
120 Eina_Bool seek : 1; 121 Eina_Bool seek : 1;
121 Eina_Bool seeking : 1; 122 Eina_Bool seeking : 1;
@@ -645,40 +646,85 @@ emotion_object_keep_aspect_get(const Evas_Object *obj)
645EAPI void 646EAPI void
646emotion_object_play_set(Evas_Object *obj, Eina_Bool play) 647emotion_object_play_set(Evas_Object *obj, Eina_Bool play)
647{ 648{
648 efl_player_play_set(obj, play); 649 /* avoid calling playback_position_set(0) for legacy */
650 if (play)
651 efl_player_playing_set(obj, EINA_TRUE);
652 efl_player_paused_set(obj, !play);
649} 653}
650 654
651EOLIAN static void 655EOLIAN static Eina_Bool
652_efl_canvas_video_efl_player_play_set(Eo *obj, Efl_Canvas_Video_Data *sd, Eina_Bool play) 656_efl_canvas_video_efl_player_playing_set(Eo *obj, Efl_Canvas_Video_Data *sd, Eina_Bool play)
653{ 657{
658 play = !!play;
654 DBG("play=" FMT_UCHAR ", was=" FMT_UCHAR, play, sd->play); 659 DBG("play=" FMT_UCHAR ", was=" FMT_UCHAR, play, sd->play);
655 if (!sd->engine_instance) return; 660 if (!sd->engine_instance) return EINA_FALSE;
661 /* always unset pause if playing is false */
662 if (!play) sd->pause = EINA_FALSE;
656 if (!sd->open) 663 if (!sd->open)
657 { 664 {
658 sd->remember_play = play; 665 sd->remember_play = play;
659 return; 666 return EINA_TRUE;
660 } 667 }
661 if (play == sd->play) return; 668 if (play == sd->play) return EINA_TRUE;
662 sd->play = play; 669 sd->play = play;
663 sd->remember_play = play; 670 sd->remember_play = play;
664 if (sd->state != EMOTION_WAKEUP) emotion_object_suspend_set(obj, EMOTION_WAKEUP); 671 if (sd->state != EMOTION_WAKEUP) emotion_object_suspend_set(obj, EMOTION_WAKEUP);
665 if (sd->play) emotion_engine_instance_play(sd->engine_instance, sd->pos); 672 if (sd->play) emotion_engine_instance_play(sd->engine_instance, 0.0);
666 else emotion_engine_instance_stop(sd->engine_instance); 673 else
674 {
675 emotion_engine_instance_stop(sd->engine_instance);
676 efl_player_playback_position_set(obj, 0.0);
677 }
678 return EINA_TRUE;
679}
680
681EOLIAN static Eina_Bool
682_efl_canvas_video_efl_player_paused_set(Eo *obj, Efl_Canvas_Video_Data *sd, Eina_Bool paused)
683{
684 paused = !!paused;
685 DBG("paused=" FMT_UCHAR ", was=" FMT_UCHAR, paused, sd->pause);
686 if (!sd->engine_instance) return EINA_FALSE;
687 if (!sd->open)
688 {
689 /* queue pause */
690 if (sd->remember_play)
691 sd->pause = paused;
692 return sd->remember_play;
693 }
694 if (!sd->play) return EINA_FALSE;
695 if (paused == sd->pause) return EINA_TRUE;
696 sd->pause = paused;
697 if (sd->pause)
698 emotion_engine_instance_stop(sd->engine_instance);
699 else
700 {
701 if (sd->state != EMOTION_WAKEUP) emotion_object_suspend_set(obj, EMOTION_WAKEUP);
702 emotion_engine_instance_play(sd->engine_instance, sd->pos);
703 }
704 return EINA_TRUE;
667} 705}
668 706
669EAPI Eina_Bool 707EAPI Eina_Bool
670emotion_object_play_get(const Evas_Object *obj) 708emotion_object_play_get(const Evas_Object *obj)
671{ 709{
672 return efl_player_play_get(obj); 710 return efl_player_playing_get(obj) && !efl_player_paused_get(obj);
673} 711}
674 712
675EOLIAN static Eina_Bool 713EOLIAN static Eina_Bool
676_efl_canvas_video_efl_player_play_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) 714_efl_canvas_video_efl_player_playing_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
677{ 715{
678 if (!sd->engine_instance) return EINA_FALSE; 716 if (!sd->engine_instance) return EINA_FALSE;
679 return sd->play; 717 return sd->play;
680} 718}
681 719
720EOLIAN static Eina_Bool
721_efl_canvas_video_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
722{
723 if (!sd->engine_instance) return EINA_FALSE;
724 if (!sd->play) return EINA_FALSE;
725 return sd->pause;
726}
727
682EAPI void 728EAPI void
683emotion_object_position_set(Evas_Object *obj, double sec) 729emotion_object_position_set(Evas_Object *obj, double sec)
684{ 730{
@@ -1632,7 +1678,12 @@ _emotion_open_done(Evas_Object *obj)
1632 if (!EINA_DBL_EQ(sd->remember_jump, 0.0)) 1678 if (!EINA_DBL_EQ(sd->remember_jump, 0.0))
1633 emotion_object_position_set(obj, sd->remember_jump); 1679 emotion_object_position_set(obj, sd->remember_jump);
1634 if (sd->remember_play != sd->play) 1680 if (sd->remember_play != sd->play)
1635 emotion_object_play_set(obj, sd->remember_play); 1681 {
1682 if (sd->pause)
1683 sd->play = sd->remember_play;
1684 else
1685 emotion_object_play_set(obj, sd->remember_play);
1686 }
1636 efl_event_callback_call(obj, EFL_CANVAS_VIDEO_EVENT_OPEN_DONE, NULL); 1687 efl_event_callback_call(obj, EFL_CANVAS_VIDEO_EVENT_OPEN_DONE, NULL);
1637 evas_object_smart_callback_call(obj, "open_done", NULL); 1688 evas_object_smart_callback_call(obj, "open_done", NULL);
1638} 1689}