if (ad->is_anim_paused)
{
//Pause animation
- efl_player_play_set(ad->anim_obj, EINA_FALSE);
+ efl_player_paused_set(ad->anim_obj, EINA_TRUE);
elm_object_text_set(obj, "Resume Animation");
}
else
{
//Resume animation
- efl_player_play_set(ad->anim_obj, EINA_TRUE);
+ efl_player_paused_set(ad->anim_obj, EINA_FALSE);
elm_object_text_set(obj, "Pause Animation");
}
}
App_Data *ad = calloc(1, sizeof(App_Data));
if (!ad) return;
- Evas_Object *win = elm_win_add(NULL, "Efl Animation Repeat", ELM_WIN_BASIC);
- elm_win_title_set(win, "Efl Animation Repeat");
+ Evas_Object *win = elm_win_util_standard_add(NULL, "Efl Animation Repeat");
elm_win_autodel_set(win, EINA_TRUE);
evas_object_smart_callback_add(win, "delete,request", _win_del_cb, ad);
EINA_ITERATOR_FOREACH(it, o)
{
if (efl_isa(o, EFL_PLAYER_INTERFACE) && efl_playable_get(o))
- efl_player_play_set(o, !efl_player_play_get(o));
+ {
+ if (!efl_player_playing_get(o))
+ efl_player_playing_set(o, EINA_TRUE);
+ efl_player_paused_set(o, !efl_player_paused_get(o));
+ }
}
eina_iterator_free(it);
}
efl_name_set(efl_added, images[k].src_name),
elm_object_tooltip_text_set(efl_added, images[k].src_name));
if (efl_playable_get(o))
- efl_player_play_set(o, 1);
+ efl_player_playing_set(o, 1);
efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _img_click, win);
efl_pack(box2, o);
}
if (file && eina_str_has_extension(file, ".gif")
&& efl_playable_get(ph))
- efl_player_play_set(ph, EINA_TRUE);
+ efl_player_playing_set(ph, EINA_TRUE);
}
static void
static void
_zoomable_clicked_cb(void *data EINA_UNUSED, const Efl_Event *ev)
{
- Eina_Bool play;
+ Eina_Bool paused;
- play = !efl_player_play_get(ev->object);
- printf("image clicked! play = %d\n", play);
- efl_player_play_set(ev->object, play);
+ paused = efl_player_paused_get(ev->object);
+ printf("image clicked! paused = %d\n", paused);
+ efl_player_paused_set(ev->object, !paused);
}
static void
if (efl_playable_get(zoomable))
{
printf("animation is available for this image.\n");
- efl_player_play_set(zoomable, EINA_TRUE);
+ efl_player_playing_set(zoomable, EINA_TRUE);
}
rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, win,
EAPI void
edje_object_play_set(Evas_Object *obj, Eina_Bool play)
{
- efl_player_play_set(obj, play);
+ efl_player_paused_set(obj, !play);
}
EAPI Eina_Bool
edje_object_play_get(const Evas_Object *obj)
{
- return efl_player_play_get(obj);
+ return !efl_player_paused_get(obj);
}
EAPI void
return EINA_TRUE;
}
-EOLIAN void
-_efl_canvas_layout_efl_player_play_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool play)
+EOLIAN Eina_Bool
+_efl_canvas_layout_efl_player_paused_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool paused)
{
double t;
Eina_List *l;
Edje_Running_Program *runp;
unsigned short i;
- if (!ed) return;
- if (ed->delete_me) return;
- if (play)
+ if (!ed) return EINA_FALSE;
+ if (ed->delete_me) return EINA_FALSE;
+ paused = !!paused;
+ if (ed->paused == paused) return EINA_TRUE;
+ if (!paused)
{
- if (!ed->paused) return;
- ed->paused = EINA_FALSE;
t = ecore_time_get() - ed->paused_at;
EINA_LIST_FOREACH(ed->actions, l, runp)
runp->start_time += t;
}
else
{
- if (ed->paused) return;
- ed->paused = EINA_TRUE;
ed->paused_at = ecore_time_get();
}
((rp->type == EDJE_RP_TYPE_SWALLOW) &&
(rp->typedata.swallow)) &&
(rp->typedata.swallow->swallowed_object))
- edje_object_play_set(rp->typedata.swallow->swallowed_object, play);
+ efl_player_paused_set(rp->typedata.swallow->swallowed_object, paused);
}
+ return EINA_TRUE;
}
EOLIAN Eina_Bool
-_efl_canvas_layout_efl_player_play_get(const Eo *obj EINA_UNUSED, Edje *ed)
+_efl_canvas_layout_efl_player_paused_get(const Eo *obj EINA_UNUSED, Edje *ed)
{
if (!ed) return EINA_FALSE;
if (ed->delete_me) return EINA_FALSE;
- if (ed->paused) return EINA_FALSE;
-
- return EINA_TRUE;
+ return ed->paused;
}
EOLIAN void
Efl.Part.part_get; [[Returns @Efl.Canvas.Layout_Part]]
Efl.Observer.update;
Efl.Playable.playable { get; }
- Efl.Player.play { get; set; }
+ Efl.Player.paused { get; set; }
Efl.Player.play_speed { get; set; }
}
}
playing: bool; [[$true if playing, $false otherwise.]]
}
}
- @property play {
- [[Playback state of the media file.
+ @property paused {
+ [[Pause state of the media file.
+
+ This property sets the pause state of the media. Re-setting the current
+ pause state has no effect.
- This property sets the currently playback state of the
- video. Using this function to play or pause the video
- doesn't alter it's current position.
+ If @.playing is set to $true, this property can be used to pause and resume
+ playback of the media without changing its @.progress property.
]]
set {
+ return: bool(false); [[If $true, the property change has succeeded.]]
}
get {
}
values {
- play: bool; [[$true if playing, $false otherwise.]]
+ paused: bool; [[$true if paused, $false otherwise.]]
}
}
@property playback_position {
pd->scale_type = EFL_GFX_IMAGE_SCALE_METHOD_FIT;
pd->self = obj;
+ /* legacy elm_image starts paused */
+ pd->paused = elm_widget_is_legacy(obj);
return obj;
}
if (sd->anim)
{
ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del);
- sd->play = EINA_FALSE;
+ sd->paused = elm_widget_is_legacy(obj);
sd->anim = EINA_FALSE;
+ sd->frame_count = -1;
+ sd->cur_frame = -1;
+ sd->frame_duration = -1;
}
if (file && _efl_ui_image_is_remote(file))
if (sd->anim)
{
ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del);
- sd->play = EINA_FALSE;
+ sd->paused = elm_widget_is_legacy(obj);
sd->anim = EINA_FALSE;
+ sd->frame_count = -1;
+ sd->cur_frame = -1;
+ sd->frame_duration = -1;
}
if (sd->prev_img)
return evas_object_image_animated_get(elm_image_object_get(obj));
}
-static void
+static Eina_Bool
_efl_ui_image_animated_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool anim)
{
anim = !!anim;
- if (sd->anim == anim) return;
-
- sd->anim = anim;
+ if (sd->anim == anim) return EINA_TRUE;
if (sd->edje)
{
edje_object_animation_set(sd->img, anim);
- return;
+ sd->anim = anim;
+ return EINA_TRUE;
}
sd->img = elm_image_object_get(obj);
- if (!evas_object_image_animated_get(sd->img)) return;
+ if (!evas_object_image_animated_get(sd->img)) return EINA_FALSE;
+ sd->anim = anim;
if (anim)
{
evas_object_image_animated_frame_duration_get
(sd->img, sd->cur_frame, 0);
evas_object_image_animated_frame_set(sd->img, sd->cur_frame);
+ if (!sd->paused)//legacy
+ sd->anim_timer = ecore_timer_add
+ (sd->frame_duration, _efl_ui_image_animate_cb, obj);
}
else
{
sd->frame_count = -1;
sd->cur_frame = -1;
sd->frame_duration = -1;
+ ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del);
}
+ return EINA_TRUE;
}
static Eina_Bool
return _efl_ui_image_animated_get_internal(obj, sd);
}
-static void
-_efl_ui_image_animated_play_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool play)
+EOLIAN static Eina_Bool
+_efl_ui_image_efl_player_playing_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool playing)
+{
+ return _efl_ui_image_animated_set_internal(obj, sd, playing);
+}
+
+EOLIAN static Eina_Bool
+_efl_ui_image_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Data *sd)
{
- if (!sd->anim) return;
- if (sd->play == play) return;
- sd->play = play;
+ return _efl_ui_image_animated_get_internal(obj, sd);
+}
+
+static Eina_Bool
+_efl_ui_image_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool paused)
+{
+ paused = !!paused;
+ if (!sd->anim) return EINA_FALSE;
+ if (sd->paused == paused) return EINA_TRUE;
+ sd->paused = paused;
if (sd->edje)
{
- edje_object_play_set(sd->img, play);
- return;
+ edje_object_play_set(sd->img, !paused);
+ return EINA_TRUE;
}
- if (play)
+ if (!paused)
{
sd->anim_timer = ecore_timer_add
(sd->frame_duration, _efl_ui_image_animate_cb, obj);
{
ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del);
}
+ return EINA_TRUE;
}
static Eina_Bool
-_efl_ui_image_animated_play_get_internal(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
+_efl_ui_image_animated_paused_get_internal(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
{
if (sd->edje)
- return edje_object_play_get(sd->img);
- return sd->play;
+ return !edje_object_play_get(sd->img);
+ return sd->paused;
}
EAPI void
{
Efl_Ui_Image_Data *sd = efl_data_scope_get(obj, MY_CLASS);
if (!sd) return;
- _efl_ui_image_animated_play_set_internal(obj, sd, play);
+ _efl_ui_image_animated_paused_set_internal(obj, sd, !play);
}
EAPI Eina_Bool
{
Efl_Ui_Image_Data *sd = efl_data_scope_get(obj, MY_CLASS);
if (!sd) return EINA_FALSE;
- return _efl_ui_image_animated_play_get_internal(obj, sd);
+ return _efl_ui_image_animated_paused_get_internal(obj, sd);
}
-EOLIAN static void
-_efl_ui_image_efl_player_play_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool play)
+EOLIAN static Eina_Bool
+_efl_ui_image_efl_player_paused_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool paused)
{
- if (play && !_efl_ui_image_animated_get_internal(obj, sd))
- _efl_ui_image_animated_set_internal(obj, sd, play);
- _efl_ui_image_animated_play_set_internal(obj, sd, play);
+ return _efl_ui_image_animated_paused_set_internal(obj, sd, paused);
}
EOLIAN static Eina_Bool
-_efl_ui_image_efl_player_play_get(const Eo *obj, Efl_Ui_Image_Data *sd)
+_efl_ui_image_efl_player_paused_get(const Eo *obj, Efl_Ui_Image_Data *sd)
{
- return _efl_ui_image_animated_play_get_internal(obj, sd);
+ return _efl_ui_image_animated_paused_get_internal(obj, sd);
}
EOLIAN static void
Efl.Gfx.Image.content_hint { get; set; }
Efl.Gfx.Image.image_load_error { get; }
Efl.Playable.playable { get; }
- Efl.Player.play { get; set; }
+ Efl.Player.playing { get; set; }
+ Efl.Player.paused { get; set; }
Efl.Layout.Signal.signal_emit;
Efl.Layout.Signal.message_send;
Efl.Layout.Signal.signal_callback_add;
return sd->anim;
}
-static void
+static Eina_Bool
+_efl_ui_image_zoomable_animate_cb(void *data)
+{
+ EFL_UI_IMAGE_ZOOMABLE_DATA_GET(data, sd);
+ _grid_clear_all(data);
+
+ if (!sd->anim) return ECORE_CALLBACK_CANCEL;
+
+ sd->cur_frame++;
+ if ((sd->frame_count > 0) && (sd->cur_frame > sd->frame_count))
+ sd->cur_frame = sd->cur_frame % sd->frame_count;
+
+ evas_object_image_animated_frame_set(sd->img, sd->cur_frame);
+ sd->frame_duration = evas_object_image_animated_frame_duration_get
+ (sd->img, sd->cur_frame, 0);
+
+ if (sd->frame_duration > 0)
+ ecore_timer_interval_set(sd->anim_timer, sd->frame_duration);
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
_efl_ui_image_zoomable_animated_set_internal(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool anim)
{
anim = !!anim;
- if (sd->anim == anim) return;
-
- sd->anim = anim;
+ if (sd->anim == anim) return EINA_TRUE;
if (sd->edje)
{
+ sd->anim = anim;
edje_object_animation_set(sd->edje, anim);
- return;
+ return EINA_TRUE;
}
- if (!evas_object_image_animated_get(sd->img)) return;
-
+ if (!evas_object_image_animated_get(sd->img)) return EINA_FALSE;
+ sd->anim = anim;
if (anim)
{
sd->frame_count = evas_object_image_animated_frame_count_get(sd->img);
evas_object_image_animated_frame_duration_get
(sd->img, sd->cur_frame, 0);
evas_object_image_animated_frame_set(sd->img, sd->cur_frame);
+ if (!sd->paused)//legacy
+ sd->anim_timer = ecore_timer_add
+ (sd->frame_duration, _efl_ui_image_zoomable_animate_cb, obj);
}
else
{
sd->frame_count = -1;
sd->cur_frame = -1;
sd->frame_duration = -1;
+ ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del);
}
+ return EINA_TRUE;
}
static Eina_Bool
-_efl_ui_image_zoomable_animate_cb(void *data)
-{
- EFL_UI_IMAGE_ZOOMABLE_DATA_GET(data, sd);
- _grid_clear_all(data);
-
- if (!sd->anim) return ECORE_CALLBACK_CANCEL;
-
- sd->cur_frame++;
- if ((sd->frame_count > 0) && (sd->cur_frame > sd->frame_count))
- sd->cur_frame = sd->cur_frame % sd->frame_count;
-
- evas_object_image_animated_frame_set(sd->img, sd->cur_frame);
- sd->frame_duration = evas_object_image_animated_frame_duration_get
- (sd->img, sd->cur_frame, 0);
-
- if (sd->frame_duration > 0)
- ecore_timer_interval_set(sd->anim_timer, sd->frame_duration);
-
- return ECORE_CALLBACK_RENEW;
-}
-
-static void
-_efl_ui_image_zoomable_animated_play_set_internal(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool play)
+_efl_ui_image_zoomable_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool paused)
{
- if (!sd->anim) return;
- if (sd->play == play) return;
- sd->play = play;
+ paused = !!paused;
+ if (!sd->anim) return EINA_FALSE;
+ if (sd->paused == paused) return EINA_TRUE;
+ sd->paused = paused;
if (sd->edje)
{
- edje_object_play_set(sd->edje, play);
- return;
+ edje_object_play_set(sd->edje, !paused);
+ return EINA_TRUE;
}
- if (play)
+ if (!paused)
{
sd->anim_timer = ecore_timer_add
(sd->frame_duration, _efl_ui_image_zoomable_animate_cb, obj);
{
ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del);
}
+ return EINA_TRUE;
}
-EOLIAN static void
-_efl_ui_image_zoomable_efl_player_play_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool play)
+EOLIAN static Eina_Bool
+_efl_ui_image_zoomable_efl_player_playing_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool playing)
{
- evas_object_image_preload(sd->img, EINA_FALSE);
- if (play && !_efl_ui_image_zoomable_animated_get_internal(obj, sd))
- _efl_ui_image_zoomable_animated_set_internal(obj, sd, play);
+ return _efl_ui_image_zoomable_animated_set_internal(obj, sd, playing);
+}
- _efl_ui_image_zoomable_animated_play_set_internal(obj, sd, play);
+EOLIAN static Eina_Bool
+_efl_ui_image_zoomable_efl_player_paused_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool paused)
+{
+ return _efl_ui_image_zoomable_animated_paused_set_internal(obj, sd, paused);
}
-static Eina_Bool
-_efl_ui_image_zoomable_animated_play_get_internal(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd)
+EOLIAN static Eina_Bool
+_efl_ui_image_zoomable_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Zoomable_Data *sd)
{
- if (sd->edje)
- return edje_object_play_get(sd->edje);
- return sd->play;
+ return _efl_ui_image_zoomable_animated_get_internal(obj, sd);
}
EOLIAN static Eina_Bool
-_efl_ui_image_zoomable_efl_player_play_get(const Eo *obj, Efl_Ui_Image_Zoomable_Data *sd)
+_efl_ui_image_zoomable_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd)
{
- return _efl_ui_image_zoomable_animated_play_get_internal(obj, sd);
+ if (sd->edje)
+ return !edje_object_play_get(sd->edje);
+ return sd->paused;
}
EOLIAN static void
Efl.Gfx.Image.image_size { get; }
Efl.Ui.Image.icon { set; get; }
Efl.Playable.playable { get; }
- Efl.Player.play { get; set; }
+ Efl.Player.playing { get; set; }
+ Efl.Player.paused { get; set; }
Efl.Ui.Zoom.zoom_animation { set; get; }
Efl.Ui.Zoom.zoom_level { set; get; }
Efl.Ui.Zoom.zoom_mode { set; get; }
Eina_Bool on_hold : 1;
Eina_Bool paused : 1;
Eina_Bool orientation_changed : 1;
- Eina_Bool play : 1;
Eina_Bool anim : 1;
Eina_Bool freeze_want : 1;
Eina_Bool show_item: 1;
{
Eina_Array *array = eina_array_new(2);
Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->group);
- if (efl_player_play_get(pd->hide))
+ if (efl_player_playing_get(pd->hide))
{
//we are currently in animation, sync the geometry of the targets
eina_array_push(array, efl_animation_player_target_get(pd->hide));
pd->show = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, obj);
efl_animation_player_animation_set(pd->show, show_anim);
- efl_player_play_set(pd->show, EINA_FALSE);
+ efl_player_playing_set(pd->show, EINA_FALSE);
efl_event_callback_array_add(pd->show, _anim_show_event_cb(), obj);
//Default Hide Animation
pd->hide = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, obj);
efl_animation_player_animation_set(pd->hide, hide_anim);
- efl_player_play_set(pd->hide, EINA_FALSE);
+ efl_player_playing_set(pd->hide, EINA_FALSE);
efl_event_callback_array_add(pd->hide, _anim_hide_event_cb(), obj);
for (int i = 0; i < efl_content_count(spotlight) ; ++i) {
static Eina_Bool
_key_action_play(Evas_Object *obj, const char *params EINA_UNUSED)
{
- if (efl_player_play_get(obj))
+ if (!efl_player_paused_get(obj))
elm_video_pause(obj);
else
elm_video_play(obj);
return sd->emotion;
}
-EOLIAN static void
-_efl_ui_video_efl_player_play_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool play)
+EOLIAN static Eina_Bool
+_efl_ui_video_efl_player_paused_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool paused)
{
- if (emotion_object_play_get(sd->emotion) == !!play) return;
+ paused = !!paused;
+ /* can't pause if we're stopped */
+ if (sd->stop) return EINA_FALSE;
+ if (emotion_object_play_get(sd->emotion) == !paused) return EINA_TRUE;
- if (play)
+ if (!paused)
{
ELM_SAFE_FREE(sd->timer, ecore_timer_del);
- sd->stop = EINA_FALSE;
emotion_object_play_set(sd->emotion, EINA_TRUE);
if(elm_widget_is_legacy(obj))
else
elm_layout_signal_emit(obj, "efl,video,pause", "efl");
}
+ return EINA_TRUE;
}
/* FIXME: stop should go into hibernate state directly.
}
EOLIAN static Eina_Bool
-_efl_ui_video_efl_player_play_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd)
+_efl_ui_video_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd)
{
- return emotion_object_play_get(sd->emotion);
+ /* pause is when !playing and !stopped */
+ return !emotion_object_play_get(sd->emotion) && !sd->stop;
}
EOLIAN static const char*
EAPI Eina_Bool
elm_video_is_playing_get(Evas_Object *obj)
{
- return efl_player_play_get(obj);
+ return efl_player_playing_get(obj) && !efl_player_paused_get(obj);
}
EAPI void
elm_video_play(Evas_Object *obj)
{
- efl_player_play_set(obj, EINA_TRUE);
+ if (efl_player_playing_get(obj))
+ efl_player_paused_set(obj, EINA_FALSE);
+ else
+ efl_player_playing_set(obj, EINA_TRUE);
}
EAPI void
EAPI void
elm_video_pause(Evas_Object *obj)
{
- efl_player_play_set(obj, EINA_FALSE);
+ efl_player_paused_set(obj, EINA_TRUE);
}
#include "efl_ui_video_legacy_eo.c"
Efl.Ui.Widget.widget_input_event_handler;
Efl.Access.Widget.Action.elm_actions { get; }
Efl.Player.playing { get; set; }
- Efl.Player.play { get; set; }
+ Efl.Player.paused { get; set; }
}
}
Eina_Bool edit : 1;
Eina_Bool edje : 1;
Eina_Bool anim : 1;
- Eina_Bool play : 1;
+ Eina_Bool paused : 1;
Eina_Bool async_enable : 1;
Eina_Bool scale_up : 1;
Eina_Bool scale_down : 1;
Efl.File.unload;
Efl.File.file { set; }
Efl.File.loaded { get; }
- Efl.Player.play { get; set; }
+ Efl.Player.playing { get; set; }
+ Efl.Player.paused { get; set; }
Efl.Player.playback_position { get; set; }
Efl.Player.progress { get; }
Efl.Audio_Control.volume { get; set; }
Eina_Bool open : 1;
Eina_Bool play : 1;
+ Eina_Bool pause : 1;
Eina_Bool remember_play : 1;
Eina_Bool seek : 1;
Eina_Bool seeking : 1;
EAPI void
emotion_object_play_set(Evas_Object *obj, Eina_Bool play)
{
- efl_player_play_set(obj, play);
+ /* avoid calling playback_position_set(0) for legacy */
+ if (play)
+ efl_player_playing_set(obj, EINA_TRUE);
+ efl_player_paused_set(obj, !play);
}
-EOLIAN static void
-_efl_canvas_video_efl_player_play_set(Eo *obj, Efl_Canvas_Video_Data *sd, Eina_Bool play)
+EOLIAN static Eina_Bool
+_efl_canvas_video_efl_player_playing_set(Eo *obj, Efl_Canvas_Video_Data *sd, Eina_Bool play)
{
+ play = !!play;
DBG("play=" FMT_UCHAR ", was=" FMT_UCHAR, play, sd->play);
- if (!sd->engine_instance) return;
+ if (!sd->engine_instance) return EINA_FALSE;
+ /* always unset pause if playing is false */
+ if (!play) sd->pause = EINA_FALSE;
if (!sd->open)
{
sd->remember_play = play;
- return;
+ return EINA_TRUE;
}
- if (play == sd->play) return;
+ if (play == sd->play) return EINA_TRUE;
sd->play = play;
sd->remember_play = play;
if (sd->state != EMOTION_WAKEUP) emotion_object_suspend_set(obj, EMOTION_WAKEUP);
- if (sd->play) emotion_engine_instance_play(sd->engine_instance, sd->pos);
- else emotion_engine_instance_stop(sd->engine_instance);
+ if (sd->play) emotion_engine_instance_play(sd->engine_instance, 0.0);
+ else
+ {
+ emotion_engine_instance_stop(sd->engine_instance);
+ efl_player_playback_position_set(obj, 0.0);
+ }
+ return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_efl_canvas_video_efl_player_paused_set(Eo *obj, Efl_Canvas_Video_Data *sd, Eina_Bool paused)
+{
+ paused = !!paused;
+ DBG("paused=" FMT_UCHAR ", was=" FMT_UCHAR, paused, sd->pause);
+ if (!sd->engine_instance) return EINA_FALSE;
+ if (!sd->open)
+ {
+ /* queue pause */
+ if (sd->remember_play)
+ sd->pause = paused;
+ return sd->remember_play;
+ }
+ if (!sd->play) return EINA_FALSE;
+ if (paused == sd->pause) return EINA_TRUE;
+ sd->pause = paused;
+ if (sd->pause)
+ emotion_engine_instance_stop(sd->engine_instance);
+ else
+ {
+ if (sd->state != EMOTION_WAKEUP) emotion_object_suspend_set(obj, EMOTION_WAKEUP);
+ emotion_engine_instance_play(sd->engine_instance, sd->pos);
+ }
+ return EINA_TRUE;
}
EAPI Eina_Bool
emotion_object_play_get(const Evas_Object *obj)
{
- return efl_player_play_get(obj);
+ return efl_player_playing_get(obj) && !efl_player_paused_get(obj);
}
EOLIAN static Eina_Bool
-_efl_canvas_video_efl_player_play_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
+_efl_canvas_video_efl_player_playing_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
{
if (!sd->engine_instance) return EINA_FALSE;
return sd->play;
}
+EOLIAN static Eina_Bool
+_efl_canvas_video_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
+{
+ if (!sd->engine_instance) return EINA_FALSE;
+ if (!sd->play) return EINA_FALSE;
+ return sd->pause;
+}
+
EAPI void
emotion_object_position_set(Evas_Object *obj, double sec)
{
if (!EINA_DBL_EQ(sd->remember_jump, 0.0))
emotion_object_position_set(obj, sd->remember_jump);
if (sd->remember_play != sd->play)
- emotion_object_play_set(obj, sd->remember_play);
+ {
+ if (sd->pause)
+ sd->play = sd->remember_play;
+ else
+ emotion_object_play_set(obj, sd->remember_play);
+ }
efl_event_callback_call(obj, EFL_CANVAS_VIDEO_EVENT_OPEN_DONE, NULL);
evas_object_smart_callback_call(obj, "open_done", NULL);
}
//Reset the state of the target to the initial state
efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj));
- Eina_Bool play = efl_player_play_get(eo_obj);
- if (play)
+ if (efl_animation_final_state_keep_get(anim))
{
- efl_player_play_set(eo_obj, EINA_FALSE);
- if (efl_animation_final_state_keep_get(anim))
+ if (_is_final_state(anim, pd->progress))
{
- if (_is_final_state(anim, pd->progress))
- {
- /* Keep the final state only if efl_player_stop is called at
- * the end of _animator_cb. */
- efl_animation_apply(anim, pd->progress,
- efl_animation_player_target_get(eo_obj));
- }
- else
- {
- pd->progress = 0.0;
- }
+ /* Keep the final state only if efl_player_playing_set(EINA_FALSE) is called at
+ * the end of _animator_cb. */
+ efl_animation_apply(anim, pd->progress,
+ efl_animation_player_target_get(eo_obj));
}
else
{
pd->progress = 0.0;
}
- efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL);
}
else
{
pd->progress = 0.0;
}
-
+ efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL);
if (pd->auto_del) efl_del(eo_obj);
}
pd->is_play = !!playing;
if (!playing)
{
+ if (!pd->is_play) return EINA_TRUE;
+ pd->is_paused = EINA_FALSE;
_player_stop(eo_obj, pd, anim);
return EINA_TRUE;
}
return pd->is_play;
}
-EOLIAN static void
-_efl_canvas_animation_player_efl_player_play_set(Eo *eo_obj,
+EOLIAN static Eina_Bool
+_efl_canvas_animation_player_efl_player_paused_set(Eo *eo_obj,
Efl_Canvas_Animation_Player_Data *pd,
- Eina_Bool play)
+ Eina_Bool paused)
{
- if (efl_player_play_get(eo_obj) == !!play)
- return;
-
- pd->is_play = play;
- if (play)
+ paused = !!paused;
+ /* can't pause if not playing */
+ if (!pd->is_play) return EINA_FALSE;
+ if (pd->is_paused == paused) return EINA_TRUE;
+ pd->is_paused = paused;
+ if (!paused)
{
//TODO: check this case is correct.
- if (pd->start_delay_timer) return;
+ if (pd->start_delay_timer) return EINA_FALSE;
pd->time.prev = ecore_loop_time_get();
pd->animator = ecore_evas_animator_add(pd->target, _animator_cb, eo_obj);
ecore_animator_del(pd->animator);
pd->animator = NULL;
}
+ return EINA_TRUE;
}
EOLIAN static Eina_Bool
-_efl_canvas_animation_player_efl_player_play_get(const Eo *eo_obj EINA_UNUSED,
+_efl_canvas_animation_player_efl_player_paused_get(const Eo *eo_obj EINA_UNUSED,
Efl_Canvas_Animation_Player_Data *pd)
{
- return pd->is_play;
+ return pd->is_paused;
}
EOLIAN static Eina_Bool
Efl.Object.constructor;
Efl.Object.destructor;
Efl.Player.playing { get; set; }
- Efl.Player.play { get; set; }
+ Efl.Player.paused { get; set; }
Efl.Playable.playable { get; }
Efl.Player.playback_position { get; set; }
Efl.Player.progress { get;}
Eina_Bool auto_del : 1;
Eina_Bool is_play : 1;
+ Eina_Bool is_paused : 1;
Eina_Bool keep_final_state : 1;
Eina_Bool is_direction_forward : 1;
} Efl_Canvas_Animation_Player_Data;
/* If show is called during hide animation is running, then the
* current hide animation is cancelled and show operation is
* proceeded. */
- if ((!obj->anim_player) || (!efl_player_play_get(obj->anim_player)))
+ if ((!obj->anim_player) || (!efl_player_playing_get(obj->anim_player)))
return 1;
}
if (!obj->interceptors) return 0;