forked from enlightenment/efl
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
This commit is contained in:
parent
897f27eff4
commit
7e7496f25a
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]]
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue