forked from enlightenment/efl
Efl.Player: Add setter of playback_progress
Summary: The setter of Efl.Player.playback_progress is implemented in each class below. Efl.Ui.Animation_View Efl.Ui.Image Efl.Ui.Image_Zoomable Efl.Canvas.Video ref T8476 Depends on D10915 Test Plan: N/A Reviewers: Hermet, bu5hm4n, kimcinoo, Jaehyun_Cho, segfaultxavi, zmike Reviewed By: zmike Subscribers: zmike, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8476 Differential Revision: https://phab.enlightenment.org/D10931
This commit is contained in:
parent
baa1e6553b
commit
3dc3deba62
|
@ -241,7 +241,7 @@ static void
|
|||
_slider_changed_cb(void *data, const Efl_Event *ev)
|
||||
{
|
||||
Evas_Object *anim_view = data;
|
||||
efl_ui_animation_view_progress_set(anim_view, efl_ui_range_value_get(ev->object));
|
||||
efl_player_playback_progress_set(anim_view, efl_ui_range_value_get(ev->object));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -133,7 +133,7 @@ static void
|
|||
_slider_changed_cb(void *data, const Efl_Event *ev)
|
||||
{
|
||||
Evas_Object *anim_view = data;
|
||||
efl_ui_animation_view_progress_set(anim_view, efl_ui_range_value_get(ev->object));
|
||||
efl_player_playback_progress_set(anim_view, efl_ui_range_value_get(ev->object));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -67,9 +67,11 @@ interface Efl.Player
|
|||
@property playback_progress {
|
||||
[[How much of the file has been played.
|
||||
|
||||
This function gets the progress in playing the file, the
|
||||
return value is in the [0, 1] range.
|
||||
This function sets or gets the progress in playing the file, the
|
||||
value is in the [0, 1] range.
|
||||
]]
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
|
|
|
@ -508,31 +508,10 @@ _playing_stop(Eo* obj, Efl_Ui_Animation_View_Data *pd)
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_animation_view_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double progress)
|
||||
{
|
||||
if (progress < 0) progress = 0;
|
||||
else if (progress > 1) progress = 1;
|
||||
if (pd->progress == progress) return;
|
||||
|
||||
pd->progress = progress;
|
||||
|
||||
if (pd->frame_cnt > 0)
|
||||
evas_object_vg_animated_frame_set(pd->vg, (int) ((pd->frame_cnt - 1) * progress));
|
||||
|
||||
if (pd->transit)
|
||||
{
|
||||
if (pd->playing_reverse)
|
||||
elm_transit_progress_value_set(pd->transit, 1 - progress);
|
||||
else
|
||||
elm_transit_progress_value_set(pd->transit, progress);
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_animation_view_frame_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, int frame_num)
|
||||
{
|
||||
efl_ui_animation_view_progress_set(obj, (double) frame_num / (double) (evas_object_vg_animated_frame_count_get(pd->vg) - 1));
|
||||
efl_player_playback_progress_set(obj, (double) frame_num / (double) (evas_object_vg_animated_frame_count_get(pd->vg) - 1));
|
||||
}
|
||||
|
||||
EOLIAN static int
|
||||
|
@ -768,7 +747,7 @@ _efl_ui_animation_view_efl_player_playback_position_set(Eo *obj, Efl_Ui_Animatio
|
|||
EINA_SAFETY_ON_TRUE_RETURN(sec < 0);
|
||||
EINA_SAFETY_ON_TRUE_RETURN(sec > pd->frame_duration);
|
||||
|
||||
efl_ui_animation_view_progress_set(obj, pd->frame_duration != 0 ? sec / pd->frame_duration : 0);
|
||||
efl_player_playback_progress_set(obj, pd->frame_duration != 0 ? sec / pd->frame_duration : 0);
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
|
@ -783,6 +762,27 @@ _efl_ui_animation_view_efl_player_playback_progress_get(const Eo *obj EINA_UNUSE
|
|||
return pd->progress;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_animation_view_efl_player_playback_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double progress)
|
||||
{
|
||||
if (progress < 0) progress = 0;
|
||||
else if (progress > 1) progress = 1;
|
||||
if (pd->progress == progress) return;
|
||||
|
||||
pd->progress = progress;
|
||||
|
||||
if (pd->frame_cnt > 0)
|
||||
evas_object_vg_animated_frame_set(pd->vg, (int) ((pd->frame_cnt - 1) * progress));
|
||||
|
||||
if (pd->transit)
|
||||
{
|
||||
if (pd->playing_reverse)
|
||||
elm_transit_progress_value_set(pd->transit, 1 - progress);
|
||||
else
|
||||
elm_transit_progress_value_set(pd->transit, progress);
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_animation_view_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double speed)
|
||||
{
|
||||
|
|
|
@ -75,20 +75,6 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
|
|||
frame_duration: double; [[duration time in the seconds]]
|
||||
}
|
||||
}
|
||||
@property progress {
|
||||
[[Set current progress position of animation view object.
|
||||
|
||||
When you required to jump on a certain frame instantly,
|
||||
you can change current position by using this API.
|
||||
|
||||
Warning: The range of progress is 0 ~ 1.
|
||||
]]
|
||||
set {
|
||||
}
|
||||
values {
|
||||
progress: double; [[Progress position. Value must be 0 ~ 1.]]
|
||||
}
|
||||
}
|
||||
@property frame {
|
||||
[[Number of current frame.
|
||||
|
||||
|
@ -224,7 +210,7 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
|
|||
Efl.Player.playing { set; get; }
|
||||
Efl.Player.paused { set; get; }
|
||||
Efl.Player.playback_position { set; get; }
|
||||
Efl.Player.playback_progress { get; }
|
||||
Efl.Player.playback_progress { get; set; }
|
||||
Efl.Player.playback_speed { set; get; }
|
||||
}
|
||||
events {
|
||||
|
|
|
@ -46,7 +46,7 @@ elm_animation_view_duration_time_get(const Efl_Ui_Animation_View *obj)
|
|||
EAPI void
|
||||
elm_animation_view_progress_set(Efl_Ui_Animation_View *obj, double progress)
|
||||
{
|
||||
efl_ui_animation_view_progress_set(obj, progress);
|
||||
efl_player_playback_progress_set(obj, progress);
|
||||
}
|
||||
|
||||
EAPI double
|
||||
|
|
|
@ -1753,7 +1753,7 @@ _efl_ui_image_animated_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool an
|
|||
if (anim)
|
||||
{
|
||||
sd->frame_count = evas_object_image_animated_frame_count_get(sd->img);
|
||||
sd->cur_frame = 1;
|
||||
sd->cur_frame = 0;
|
||||
sd->frame_duration =
|
||||
evas_object_image_animated_frame_duration_get
|
||||
(sd->img, sd->cur_frame, 0);
|
||||
|
@ -1859,11 +1859,23 @@ _efl_ui_image_efl_player_playback_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui
|
|||
{
|
||||
if (sd->edje)
|
||||
efl_player_playback_progress_get(sd->img);
|
||||
else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0))
|
||||
return (sd->cur_frame * sd->frame_duration) / sd->frame_count;
|
||||
else if (sd->frame_count > 1)
|
||||
return sd->cur_frame / (sd->frame_count - 1);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_image_efl_player_playback_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, double progress)
|
||||
{
|
||||
EINA_SAFETY_ON_TRUE_RETURN(progress > 1 || progress < 0);
|
||||
if (sd->edje)
|
||||
efl_player_playback_progress_set(sd->img, progress);
|
||||
else if (sd->frame_count > 1)
|
||||
sd->cur_frame = lround(progress * (sd->frame_count - 1));
|
||||
else
|
||||
sd->cur_frame = 0;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_efl_ui_image_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool paused)
|
||||
{
|
||||
|
|
|
@ -103,7 +103,7 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui.
|
|||
Efl.Player.playing { get; set; }
|
||||
Efl.Player.paused { get; set; }
|
||||
Efl.Player.playback_position { get; set; }
|
||||
Efl.Player.playback_progress { get; }
|
||||
Efl.Player.playback_progress { get; set; }
|
||||
Efl.Player.playback_speed { get; set; }
|
||||
Efl.Layout.Signal.signal_emit;
|
||||
Efl.Layout.Signal.message_send;
|
||||
|
|
|
@ -3058,7 +3058,7 @@ _efl_ui_image_zoomable_animated_set_internal(Eo *obj EINA_UNUSED, Efl_Ui_Image_Z
|
|||
if (anim)
|
||||
{
|
||||
sd->frame_count = evas_object_image_animated_frame_count_get(sd->img);
|
||||
sd->cur_frame = 1;
|
||||
sd->cur_frame = 0;
|
||||
sd->frame_duration =
|
||||
evas_object_image_animated_frame_duration_get
|
||||
(sd->img, sd->cur_frame, 0);
|
||||
|
@ -3178,11 +3178,26 @@ _efl_ui_image_zoomable_efl_player_playback_progress_get(const Eo *obj EINA_UNUSE
|
|||
{
|
||||
if (sd->edje)
|
||||
efl_player_playback_progress_get(sd->edje);
|
||||
else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0))
|
||||
return (sd->cur_frame * sd->frame_duration) / sd->frame_count;
|
||||
else if (sd->frame_count > 1)
|
||||
return sd->cur_frame / (sd->frame_count - 1);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_image_zoomable_efl_player_playback_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, double progress)
|
||||
{
|
||||
EINA_SAFETY_ON_TRUE_RETURN(progress > 1 || progress < 0);
|
||||
if (sd->edje)
|
||||
{
|
||||
efl_player_playback_progress_set(sd->img, progress);
|
||||
}
|
||||
else if (sd->frame_count > 1)
|
||||
sd->cur_frame = lround(progress * (sd->frame_count - 1));
|
||||
else
|
||||
sd->cur_frame = 0;
|
||||
}
|
||||
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_image_zoomable_class_constructor(Efl_Class *klass EINA_UNUSED)
|
||||
{
|
||||
|
|
|
@ -50,7 +50,7 @@ class Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom
|
|||
Efl.Player.playing { get; set; }
|
||||
Efl.Player.paused { get; set; }
|
||||
Efl.Player.playback_position { get; set; }
|
||||
Efl.Player.playback_progress { get; }
|
||||
Efl.Player.playback_progress { get; set; }
|
||||
Efl.Player.playback_speed { get; set; }
|
||||
Efl.Ui.Zoom.zoom_animation { set; get; }
|
||||
Efl.Ui.Zoom.zoom_level { set; get; }
|
||||
|
|
|
@ -60,7 +60,7 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group
|
|||
Efl.Player.playing { get; set; }
|
||||
Efl.Player.paused { get; set; }
|
||||
Efl.Player.playback_position { get; set; }
|
||||
Efl.Player.playback_progress { get; }
|
||||
Efl.Player.playback_progress { get; set; }
|
||||
Efl.Audio_Control.volume { get; set; }
|
||||
Efl.Audio_Control.mute { get; set; }
|
||||
Efl.Playable.length { get; }
|
||||
|
|
|
@ -1217,6 +1217,13 @@ _efl_canvas_video_efl_player_playback_progress_get(const Eo *obj EINA_UNUSED, Ef
|
|||
return sd->progress.stat;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_canvas_video_efl_player_playback_progress_set(Eo *obj, Efl_Canvas_Video_Data *sd EINA_UNUSED, double progress)
|
||||
{
|
||||
const char *info = emotion_object_progress_info_get((const Evas_Object*)obj);
|
||||
_emotion_progress_set(obj, (char*)info, progress);
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_canvas_video_efl_playable_length_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue