From 7e7496f25a37957ed2c249f6c7eab088c819ff5a Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Tue, 28 Jan 2020 16:36:33 +0100 Subject: [PATCH] Efl.Player: Move autoplay/playback_loop from Efl.Ui.Vg_Animation Summary: Move autoplay and playback_loop method from Efl.Ui.Vg_Animation/ and The playback_loop changed from looping because it conflict with the efl_ui_scrollable's symbol. Efl.Ui.Image and Efl.Ui.Image_Zoomable is needed implements about this method. So it temporarily set the @empty marker. ref T8476 Test Plan: elementary_test -to "Vector Graphics Animation" check to 'loop' Reviewers: Hermet, bu5hm4n, zmike, Jaehyun_Cho, jsuya Reviewed By: zmike Subscribers: cedric, #reviewers, #committers, woohyun, kimcinoo Tags: #efl Maniphest Tasks: T8476 Differential Revision: https://phab.enlightenment.org/D11212 --- .../test_efl_gfx_vg_value_provider.c | 2 +- src/bin/elementary/test_efl_ui_vg_animation.c | 2 +- src/lib/efl/interfaces/efl_player.eo | 39 ++++++++++++++++++ src/lib/elementary/efl_ui_image.eo | 2 + src/lib/elementary/efl_ui_image_zoomable.c | 1 - src/lib/elementary/efl_ui_image_zoomable.eo | 2 + src/lib/elementary/efl_ui_vg_animation.c | 20 +++++----- src/lib/elementary/efl_ui_vg_animation.eo | 40 +------------------ .../efl_ui_vg_animation_eo.legacy.c | 8 ++-- .../elementary/efl_ui_vg_animation_private.h | 2 +- .../elementary/efl_ui_test_vg_animation.c | 8 ++-- 11 files changed, 66 insertions(+), 60 deletions(-) diff --git a/src/bin/elementary/test_efl_gfx_vg_value_provider.c b/src/bin/elementary/test_efl_gfx_vg_value_provider.c index 5127bb0eb2..c6f3189908 100644 --- a/src/bin/elementary/test_efl_gfx_vg_value_provider.c +++ b/src/bin/elementary/test_efl_gfx_vg_value_provider.c @@ -159,7 +159,7 @@ static void check_changed_cb(void *data, const Efl_Event *event) { Evas_Object *anim_view = data; - efl_ui_vg_animation_looping_set(anim_view, efl_ui_selectable_selected_get(event->object)); + efl_player_playback_loop_set(anim_view, efl_ui_selectable_selected_get(event->object)); } static void diff --git a/src/bin/elementary/test_efl_ui_vg_animation.c b/src/bin/elementary/test_efl_ui_vg_animation.c index 5d943a795f..a54a816bf1 100644 --- a/src/bin/elementary/test_efl_ui_vg_animation.c +++ b/src/bin/elementary/test_efl_ui_vg_animation.c @@ -52,7 +52,7 @@ static void check_changed_cb(void *data, const Efl_Event *event) { Evas_Object *anim_view = data; - efl_ui_vg_animation_looping_set(anim_view, efl_ui_selectable_selected_get(event->object)); + efl_player_playback_loop_set(anim_view, efl_ui_selectable_selected_get(event->object)); } static void diff --git a/src/lib/efl/interfaces/efl_player.eo b/src/lib/efl/interfaces/efl_player.eo index 90717ff7a3..82411fa7f4 100644 --- a/src/lib/efl/interfaces/efl_player.eo +++ b/src/lib/efl/interfaces/efl_player.eo @@ -93,6 +93,45 @@ interface Efl.Player speed: double; [[The play speed in the [0, infinity) range.]] } } + @property autoplay { + [[When $true, playback will start as soon as the media is ready. + + This means that the media file has been successfully loaded and the + object is visible. + + If the object becomes invisible later on the playback is paused, + resuming when it is visible again. + + Changing this property affects the next media being loaded, + so set it before setting the media file. + + @since 1.24 + ]] + set { + } + get { + } + values { + autoplay: bool; [[Auto play mode, Default is $false.]] + } + } + @property playback_loop { + [[Enable playback looping. + + When $true, playback continues from the beginning when it reaches the last frame. + Otherwise, playback stops. + This works both when playing forward and backward. + + @since 1.24 + ]] + set { + } + get { + } + values { + looping: bool; [[Loop mode, Default is $false.]] + } + } } events { playing,changed: bool; [[Called when the playing state has changed. The event value reflects the current state. @since 1.24]] diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo index 0cabaa0290..f358500a57 100644 --- a/src/lib/elementary/efl_ui_image.eo +++ b/src/lib/elementary/efl_ui_image.eo @@ -105,6 +105,8 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui. Efl.Player.playback_position { get; set; } Efl.Player.playback_progress { get; set; } Efl.Player.playback_speed { get; set; } + @empty Efl.Player.autoplay { set; get; } + @empty Efl.Player.playback_loop { set; get; } Efl.Layout.Signal.signal_emit; Efl.Layout.Signal.message_send; Efl.Layout.Signal.signal_callback_add; diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 7d4f5d072a..478dbb4117 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -3171,7 +3171,6 @@ _efl_ui_image_zoomable_efl_player_playback_progress_set(Eo *obj EINA_UNUSED, Efl sd->cur_frame = 0; } - EOLIAN static void _efl_ui_image_zoomable_class_constructor(Efl_Class *klass EINA_UNUSED) { diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo index e27eb82c13..64dc7a57b7 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.eo +++ b/src/lib/elementary/efl_ui_image_zoomable.eo @@ -52,6 +52,8 @@ class Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom Efl.Player.playback_position { get; set; } Efl.Player.playback_progress { get; set; } Efl.Player.playback_speed { get; set; } + @empty Efl.Player.autoplay { set; get; } + @empty Efl.Player.playback_loop { set; get; } Efl.Ui.Zoom.zoom_animation { set; get; } Efl.Ui.Zoom.zoom_level { set; get; } Efl.Ui.Zoom.zoom_mode { set; get; } diff --git a/src/lib/elementary/efl_ui_vg_animation.c b/src/lib/elementary/efl_ui_vg_animation.c index e723a922a4..83f666fdd0 100644 --- a/src/lib/elementary/efl_ui_vg_animation.c +++ b/src/lib/elementary/efl_ui_vg_animation.c @@ -217,7 +217,7 @@ _transit_cb(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress) evas_object_vg_animated_frame_set(pd->vg, update_frame); - if (pd->looping) + if (pd->loop) { int repeat_times = elm_transit_current_repeat_times_get(pd->transit); if (pd->repeat_times != repeat_times) @@ -327,7 +327,7 @@ _ready_play(Eo *obj, Efl_Ui_Vg_Animation_Data *pd) double speed = pd->playback_speed < 0 ? pd->playback_speed * -1 : pd->playback_speed; Elm_Transit *transit = elm_transit_add(); elm_transit_object_add(transit, pd->vg); - if (pd->looping) elm_transit_repeat_times_set(transit, -1); + if (pd->loop) elm_transit_repeat_times_set(transit, -1); elm_transit_effect_add(transit, _transit_cb, obj, _transit_del_cb); elm_transit_progress_value_set(transit, pd->progress); elm_transit_objects_final_state_keep_set(transit, EINA_TRUE); @@ -462,25 +462,25 @@ _efl_ui_vg_animation_efl_gfx_view_view_size_get(const Eo *obj EINA_UNUSED, } EOLIAN static void -_efl_ui_vg_animation_looping_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, Eina_Bool looping) +_efl_ui_vg_animation_efl_player_playback_loop_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, Eina_Bool loop) { - if (pd->looping == looping) return; - pd->looping = looping; + if (pd->loop == loop) return; + pd->loop = loop; if (pd->transit) { - if (looping) elm_transit_repeat_times_set(pd->transit, -1); + if (loop) elm_transit_repeat_times_set(pd->transit, -1); else elm_transit_repeat_times_set(pd->transit, 0); } } EOLIAN static Eina_Bool -_efl_ui_vg_animation_looping_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +_efl_ui_vg_animation_efl_player_playback_loop_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) { - return pd->looping; + return pd->loop; } EOLIAN static void -_efl_ui_vg_animation_autoplay_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, +_efl_ui_vg_animation_efl_player_autoplay_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, Eina_Bool autoplay) { pd->autoplay = autoplay; @@ -488,7 +488,7 @@ _efl_ui_vg_animation_autoplay_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data } EOLIAN static Eina_Bool -_efl_ui_vg_animation_autoplay_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +_efl_ui_vg_animation_efl_player_autoplay_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) { return pd->autoplay; } diff --git a/src/lib/elementary/efl_ui_vg_animation.eo b/src/lib/elementary/efl_ui_vg_animation.eo index 9c44a93665..d87055a83b 100644 --- a/src/lib/elementary/efl_ui_vg_animation.eo +++ b/src/lib/elementary/efl_ui_vg_animation.eo @@ -25,44 +25,6 @@ class @beta Efl.Ui.Vg_Animation extends Efl.Ui.Widget implements Efl.Gfx.View, E ]] event_c_prefix: efl_ui_vg_animation; methods { - @property autoplay { - [[Animation will be started automatically when it's possible. - - If @.autoplay is $true, animation will be started when it's readied. - The condition of $auto play is when vg animation opened file successfully, - yet to play it plus when the object is visible. - If vg animation is disabled, invisible, - it turns to pause state then resume animation when it's visible again. - - $true Enable auto play mode, disable otherwise. - - Warning: This auto play will be only affected to the next animation source. - So must be called before setting animation file. - ]] - set { - } - get { - } - values { - autoplay: bool(false); [[Auto play mode.]] - } - } - @property looping { - [[Turn on/off animation looping. - - When $true, animation is restarted when it reaches the last frame. - This works both when playing forward and backward. - - $true Enable loop mode, disable otherwise. - ]] - set { - } - get { - } - values { - looping: bool; [[Loop mode, Default is $false.]] - } - } @property frame { [[Number of current frame. @@ -203,5 +165,7 @@ class @beta Efl.Ui.Vg_Animation extends Efl.Ui.Widget implements Efl.Gfx.View, E Efl.Playable.length { get; } Efl.Playable.playable { get; } Efl.Playable.seekable { get; } + Efl.Player.autoplay { set; get; } + Efl.Player.playback_loop { set; get; } } } diff --git a/src/lib/elementary/efl_ui_vg_animation_eo.legacy.c b/src/lib/elementary/efl_ui_vg_animation_eo.legacy.c index 78c24cfe11..40b0b8fe81 100644 --- a/src/lib/elementary/efl_ui_vg_animation_eo.legacy.c +++ b/src/lib/elementary/efl_ui_vg_animation_eo.legacy.c @@ -2,25 +2,25 @@ EAPI void elm_animation_view_auto_play_set(Efl_Ui_Vg_Animation *obj, Eina_Bool auto_play) { - efl_ui_vg_animation_autoplay_set(obj, auto_play); + efl_player_autoplay_set(obj, auto_play); } EAPI Eina_Bool elm_animation_view_auto_play_get(const Efl_Ui_Vg_Animation *obj) { - return efl_ui_vg_animation_autoplay_get(obj); + return efl_player_autoplay_get(obj); } EAPI void elm_animation_view_auto_repeat_set(Efl_Ui_Vg_Animation *obj, Eina_Bool autorepeat) { - efl_ui_vg_animation_looping_set(obj, autorepeat); + efl_player_playback_loop_set(obj, autorepeat); } EAPI Eina_Bool elm_animation_view_auto_repeat_get(const Efl_Ui_Vg_Animation *obj) { - return efl_ui_vg_animation_looping_get(obj); + return efl_player_playback_loop_get(obj); } EAPI Eina_Bool diff --git a/src/lib/elementary/efl_ui_vg_animation_private.h b/src/lib/elementary/efl_ui_vg_animation_private.h index 98304f39ad..6629e43c62 100644 --- a/src/lib/elementary/efl_ui_vg_animation_private.h +++ b/src/lib/elementary/efl_ui_vg_animation_private.h @@ -24,7 +24,7 @@ struct _Efl_Ui_Vg_Animation_Data Eina_Bool playing_reverse : 1; Eina_Bool autoplay : 1; Eina_Bool autoplay_pause: 1; - Eina_Bool looping : 1; + Eina_Bool loop : 1; Eina_Bool playback_direction_changed : 1; }; diff --git a/src/tests/elementary/efl_ui_test_vg_animation.c b/src/tests/elementary/efl_ui_test_vg_animation.c index 2da7d0fbde..2909ede100 100644 --- a/src/tests/elementary/efl_ui_test_vg_animation.c +++ b/src/tests/elementary/efl_ui_test_vg_animation.c @@ -50,12 +50,12 @@ EFL_START_TEST(vg_anim_playing_control) ck_assert_int_eq(efl_ui_vg_animation_state_get(vg_anim), EFL_UI_VG_ANIMATION_STATE_STOPPED); // Auto repeat - efl_ui_vg_animation_looping_set(vg_anim, EINA_TRUE); - ck_assert_int_eq(efl_ui_vg_animation_looping_get(vg_anim), EINA_TRUE); + efl_player_playback_loop_set(vg_anim, EINA_TRUE); + ck_assert_int_eq(efl_player_playback_loop_get(vg_anim), EINA_TRUE); // Auto play - efl_ui_vg_animation_autoplay_set(vg_anim, EINA_TRUE); - ck_assert_int_eq(efl_ui_vg_animation_autoplay_get(vg_anim), EINA_TRUE); + efl_player_autoplay_set(vg_anim, EINA_TRUE); + ck_assert_int_eq(efl_player_autoplay_get(vg_anim), EINA_TRUE); } EFL_END_TEST