diff options
author | JunsuChoi <jsuya.choi@samsung.com> | 2019-12-31 09:53:10 -0500 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2019-12-31 09:53:10 -0500 |
commit | 3dc3deba6280349021d877c29362fd80eaed57aa (patch) | |
tree | 2feef6e5a917335633f0975219ef72b4528cbde1 | |
parent | baa1e6553bc96a1f099c1aadc1f5fcfd2295f520 (diff) |
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
Diffstat (limited to '')
-rw-r--r-- | src/bin/elementary/test_efl_gfx_vg_value_provider.c | 2 | ||||
-rw-r--r-- | src/bin/elementary/test_efl_ui_animation_view.c | 2 | ||||
-rw-r--r-- | src/lib/efl/interfaces/efl_player.eo | 6 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_animation_view.c | 46 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_animation_view.eo | 16 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_animation_view_eo.legacy.c | 2 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_image.c | 18 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_image.eo | 2 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_image_zoomable.c | 21 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_image_zoomable.eo | 2 | ||||
-rw-r--r-- | src/lib/emotion/efl_canvas_video.eo | 2 | ||||
-rw-r--r-- | src/lib/emotion/emotion_smart.c | 7 |
12 files changed, 74 insertions, 52 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 e7a15206d6..22a55d5545 100644 --- a/src/bin/elementary/test_efl_gfx_vg_value_provider.c +++ b/src/bin/elementary/test_efl_gfx_vg_value_provider.c | |||
@@ -241,7 +241,7 @@ static void | |||
241 | _slider_changed_cb(void *data, const Efl_Event *ev) | 241 | _slider_changed_cb(void *data, const Efl_Event *ev) |
242 | { | 242 | { |
243 | Evas_Object *anim_view = data; | 243 | Evas_Object *anim_view = data; |
244 | efl_ui_animation_view_progress_set(anim_view, efl_ui_range_value_get(ev->object)); | 244 | efl_player_playback_progress_set(anim_view, efl_ui_range_value_get(ev->object)); |
245 | } | 245 | } |
246 | 246 | ||
247 | static void | 247 | static void |
diff --git a/src/bin/elementary/test_efl_ui_animation_view.c b/src/bin/elementary/test_efl_ui_animation_view.c index 912aa7164a..fe828a7534 100644 --- a/src/bin/elementary/test_efl_ui_animation_view.c +++ b/src/bin/elementary/test_efl_ui_animation_view.c | |||
@@ -133,7 +133,7 @@ static void | |||
133 | _slider_changed_cb(void *data, const Efl_Event *ev) | 133 | _slider_changed_cb(void *data, const Efl_Event *ev) |
134 | { | 134 | { |
135 | Evas_Object *anim_view = data; | 135 | Evas_Object *anim_view = data; |
136 | efl_ui_animation_view_progress_set(anim_view, efl_ui_range_value_get(ev->object)); | 136 | efl_player_playback_progress_set(anim_view, efl_ui_range_value_get(ev->object)); |
137 | } | 137 | } |
138 | 138 | ||
139 | static void | 139 | static void |
diff --git a/src/lib/efl/interfaces/efl_player.eo b/src/lib/efl/interfaces/efl_player.eo index afeb7c2d13..434482ab63 100644 --- a/src/lib/efl/interfaces/efl_player.eo +++ b/src/lib/efl/interfaces/efl_player.eo | |||
@@ -67,9 +67,11 @@ interface Efl.Player | |||
67 | @property playback_progress { | 67 | @property playback_progress { |
68 | [[How much of the file has been played. | 68 | [[How much of the file has been played. |
69 | 69 | ||
70 | This function gets the progress in playing the file, the | 70 | This function sets or gets the progress in playing the file, the |
71 | return value is in the [0, 1] range. | 71 | value is in the [0, 1] range. |
72 | ]] | 72 | ]] |
73 | set { | ||
74 | } | ||
73 | get { | 75 | get { |
74 | } | 76 | } |
75 | values { | 77 | values { |
diff --git a/src/lib/elementary/efl_ui_animation_view.c b/src/lib/elementary/efl_ui_animation_view.c index 2240624623..6669d53ff3 100644 --- a/src/lib/elementary/efl_ui_animation_view.c +++ b/src/lib/elementary/efl_ui_animation_view.c | |||
@@ -509,30 +509,9 @@ _playing_stop(Eo* obj, Efl_Ui_Animation_View_Data *pd) | |||
509 | } | 509 | } |
510 | 510 | ||
511 | EOLIAN static void | 511 | EOLIAN static void |
512 | _efl_ui_animation_view_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double progress) | ||
513 | { | ||
514 | if (progress < 0) progress = 0; | ||
515 | else if (progress > 1) progress = 1; | ||
516 | if (pd->progress == progress) return; | ||
517 | |||
518 | pd->progress = progress; | ||
519 | |||
520 | if (pd->frame_cnt > 0) | ||
521 | evas_object_vg_animated_frame_set(pd->vg, (int) ((pd->frame_cnt - 1) * progress)); | ||
522 | |||
523 | if (pd->transit) | ||
524 | { | ||
525 | if (pd->playing_reverse) | ||
526 | elm_transit_progress_value_set(pd->transit, 1 - progress); | ||
527 | else | ||
528 | elm_transit_progress_value_set(pd->transit, progress); | ||
529 | } | ||
530 | } | ||
531 | |||
532 | EOLIAN static void | ||
533 | _efl_ui_animation_view_frame_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, int frame_num) | 512 | _efl_ui_animation_view_frame_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, int frame_num) |
534 | { | 513 | { |
535 | efl_ui_animation_view_progress_set(obj, (double) frame_num / (double) (evas_object_vg_animated_frame_count_get(pd->vg) - 1)); | 514 | efl_player_playback_progress_set(obj, (double) frame_num / (double) (evas_object_vg_animated_frame_count_get(pd->vg) - 1)); |
536 | } | 515 | } |
537 | 516 | ||
538 | EOLIAN static int | 517 | EOLIAN static int |
@@ -768,7 +747,7 @@ _efl_ui_animation_view_efl_player_playback_position_set(Eo *obj, Efl_Ui_Animatio | |||
768 | EINA_SAFETY_ON_TRUE_RETURN(sec < 0); | 747 | EINA_SAFETY_ON_TRUE_RETURN(sec < 0); |
769 | EINA_SAFETY_ON_TRUE_RETURN(sec > pd->frame_duration); | 748 | EINA_SAFETY_ON_TRUE_RETURN(sec > pd->frame_duration); |
770 | 749 | ||
771 | efl_ui_animation_view_progress_set(obj, pd->frame_duration != 0 ? sec / pd->frame_duration : 0); | 750 | efl_player_playback_progress_set(obj, pd->frame_duration != 0 ? sec / pd->frame_duration : 0); |
772 | } | 751 | } |
773 | 752 | ||
774 | EOLIAN static double | 753 | EOLIAN static double |
@@ -784,6 +763,27 @@ _efl_ui_animation_view_efl_player_playback_progress_get(const Eo *obj EINA_UNUSE | |||
784 | } | 763 | } |
785 | 764 | ||
786 | EOLIAN static void | 765 | EOLIAN static void |
766 | _efl_ui_animation_view_efl_player_playback_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double progress) | ||
767 | { | ||
768 | if (progress < 0) progress = 0; | ||
769 | else if (progress > 1) progress = 1; | ||
770 | if (pd->progress == progress) return; | ||
771 | |||
772 | pd->progress = progress; | ||
773 | |||
774 | if (pd->frame_cnt > 0) | ||
775 | evas_object_vg_animated_frame_set(pd->vg, (int) ((pd->frame_cnt - 1) * progress)); | ||
776 | |||
777 | if (pd->transit) | ||
778 | { | ||
779 | if (pd->playing_reverse) | ||
780 | elm_transit_progress_value_set(pd->transit, 1 - progress); | ||
781 | else | ||
782 | elm_transit_progress_value_set(pd->transit, progress); | ||
783 | } | ||
784 | } | ||
785 | |||
786 | EOLIAN static void | ||
787 | _efl_ui_animation_view_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double speed) | 787 | _efl_ui_animation_view_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double speed) |
788 | { | 788 | { |
789 | // pd->playback_direction_changed is used only during playback. | 789 | // pd->playback_direction_changed is used only during playback. |
diff --git a/src/lib/elementary/efl_ui_animation_view.eo b/src/lib/elementary/efl_ui_animation_view.eo index 1d7d0c23ae..c14b927e3c 100644 --- a/src/lib/elementary/efl_ui_animation_view.eo +++ b/src/lib/elementary/efl_ui_animation_view.eo | |||
@@ -75,20 +75,6 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View, | |||
75 | frame_duration: double; [[duration time in the seconds]] | 75 | frame_duration: double; [[duration time in the seconds]] |
76 | } | 76 | } |
77 | } | 77 | } |
78 | @property progress { | ||
79 | [[Set current progress position of animation view object. | ||
80 | |||
81 | When you required to jump on a certain frame instantly, | ||
82 | you can change current position by using this API. | ||
83 | |||
84 | Warning: The range of progress is 0 ~ 1. | ||
85 | ]] | ||
86 | set { | ||
87 | } | ||
88 | values { | ||
89 | progress: double; [[Progress position. Value must be 0 ~ 1.]] | ||
90 | } | ||
91 | } | ||
92 | @property frame { | 78 | @property frame { |
93 | [[Number of current frame. | 79 | [[Number of current frame. |
94 | 80 | ||
@@ -224,7 +210,7 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View, | |||
224 | Efl.Player.playing { set; get; } | 210 | Efl.Player.playing { set; get; } |
225 | Efl.Player.paused { set; get; } | 211 | Efl.Player.paused { set; get; } |
226 | Efl.Player.playback_position { set; get; } | 212 | Efl.Player.playback_position { set; get; } |
227 | Efl.Player.playback_progress { get; } | 213 | Efl.Player.playback_progress { get; set; } |
228 | Efl.Player.playback_speed { set; get; } | 214 | Efl.Player.playback_speed { set; get; } |
229 | } | 215 | } |
230 | events { | 216 | events { |
diff --git a/src/lib/elementary/efl_ui_animation_view_eo.legacy.c b/src/lib/elementary/efl_ui_animation_view_eo.legacy.c index e213ebb6e9..b109e0ef5e 100644 --- a/src/lib/elementary/efl_ui_animation_view_eo.legacy.c +++ b/src/lib/elementary/efl_ui_animation_view_eo.legacy.c | |||
@@ -46,7 +46,7 @@ elm_animation_view_duration_time_get(const Efl_Ui_Animation_View *obj) | |||
46 | EAPI void | 46 | EAPI void |
47 | elm_animation_view_progress_set(Efl_Ui_Animation_View *obj, double progress) | 47 | elm_animation_view_progress_set(Efl_Ui_Animation_View *obj, double progress) |
48 | { | 48 | { |
49 | efl_ui_animation_view_progress_set(obj, progress); | 49 | efl_player_playback_progress_set(obj, progress); |
50 | } | 50 | } |
51 | 51 | ||
52 | EAPI double | 52 | EAPI double |
diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index 213d55edd2..2d9ce304fe 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c | |||
@@ -1753,7 +1753,7 @@ _efl_ui_image_animated_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool an | |||
1753 | if (anim) | 1753 | if (anim) |
1754 | { | 1754 | { |
1755 | sd->frame_count = evas_object_image_animated_frame_count_get(sd->img); | 1755 | sd->frame_count = evas_object_image_animated_frame_count_get(sd->img); |
1756 | sd->cur_frame = 1; | 1756 | sd->cur_frame = 0; |
1757 | sd->frame_duration = | 1757 | sd->frame_duration = |
1758 | evas_object_image_animated_frame_duration_get | 1758 | evas_object_image_animated_frame_duration_get |
1759 | (sd->img, sd->cur_frame, 0); | 1759 | (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 | |||
1859 | { | 1859 | { |
1860 | if (sd->edje) | 1860 | if (sd->edje) |
1861 | efl_player_playback_progress_get(sd->img); | 1861 | efl_player_playback_progress_get(sd->img); |
1862 | else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) | 1862 | else if (sd->frame_count > 1) |
1863 | return (sd->cur_frame * sd->frame_duration) / sd->frame_count; | 1863 | return sd->cur_frame / (sd->frame_count - 1); |
1864 | return 0.0; | 1864 | return 0.0; |
1865 | } | 1865 | } |
1866 | 1866 | ||
1867 | EOLIAN static void | ||
1868 | _efl_ui_image_efl_player_playback_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, double progress) | ||
1869 | { | ||
1870 | EINA_SAFETY_ON_TRUE_RETURN(progress > 1 || progress < 0); | ||
1871 | if (sd->edje) | ||
1872 | efl_player_playback_progress_set(sd->img, progress); | ||
1873 | else if (sd->frame_count > 1) | ||
1874 | sd->cur_frame = lround(progress * (sd->frame_count - 1)); | ||
1875 | else | ||
1876 | sd->cur_frame = 0; | ||
1877 | } | ||
1878 | |||
1867 | static Eina_Bool | 1879 | static Eina_Bool |
1868 | _efl_ui_image_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool paused) | 1880 | _efl_ui_image_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool paused) |
1869 | { | 1881 | { |
diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo index 207a264e70..0cabaa0290 100644 --- a/src/lib/elementary/efl_ui_image.eo +++ b/src/lib/elementary/efl_ui_image.eo | |||
@@ -103,7 +103,7 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui. | |||
103 | Efl.Player.playing { get; set; } | 103 | Efl.Player.playing { get; set; } |
104 | Efl.Player.paused { get; set; } | 104 | Efl.Player.paused { get; set; } |
105 | Efl.Player.playback_position { get; set; } | 105 | Efl.Player.playback_position { get; set; } |
106 | Efl.Player.playback_progress { get; } | 106 | Efl.Player.playback_progress { get; set; } |
107 | Efl.Player.playback_speed { get; set; } | 107 | Efl.Player.playback_speed { get; set; } |
108 | Efl.Layout.Signal.signal_emit; | 108 | Efl.Layout.Signal.signal_emit; |
109 | Efl.Layout.Signal.message_send; | 109 | Efl.Layout.Signal.message_send; |
diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 19d2e0155b..62a146422f 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c | |||
@@ -3058,7 +3058,7 @@ _efl_ui_image_zoomable_animated_set_internal(Eo *obj EINA_UNUSED, Efl_Ui_Image_Z | |||
3058 | if (anim) | 3058 | if (anim) |
3059 | { | 3059 | { |
3060 | sd->frame_count = evas_object_image_animated_frame_count_get(sd->img); | 3060 | sd->frame_count = evas_object_image_animated_frame_count_get(sd->img); |
3061 | sd->cur_frame = 1; | 3061 | sd->cur_frame = 0; |
3062 | sd->frame_duration = | 3062 | sd->frame_duration = |
3063 | evas_object_image_animated_frame_duration_get | 3063 | evas_object_image_animated_frame_duration_get |
3064 | (sd->img, sd->cur_frame, 0); | 3064 | (sd->img, sd->cur_frame, 0); |
@@ -3178,12 +3178,27 @@ _efl_ui_image_zoomable_efl_player_playback_progress_get(const Eo *obj EINA_UNUSE | |||
3178 | { | 3178 | { |
3179 | if (sd->edje) | 3179 | if (sd->edje) |
3180 | efl_player_playback_progress_get(sd->edje); | 3180 | efl_player_playback_progress_get(sd->edje); |
3181 | else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) | 3181 | else if (sd->frame_count > 1) |
3182 | return (sd->cur_frame * sd->frame_duration) / sd->frame_count; | 3182 | return sd->cur_frame / (sd->frame_count - 1); |
3183 | return 0.0; | 3183 | return 0.0; |
3184 | } | 3184 | } |
3185 | 3185 | ||
3186 | EOLIAN static void | 3186 | EOLIAN static void |
3187 | _efl_ui_image_zoomable_efl_player_playback_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, double progress) | ||
3188 | { | ||
3189 | EINA_SAFETY_ON_TRUE_RETURN(progress > 1 || progress < 0); | ||
3190 | if (sd->edje) | ||
3191 | { | ||
3192 | efl_player_playback_progress_set(sd->img, progress); | ||
3193 | } | ||
3194 | else if (sd->frame_count > 1) | ||
3195 | sd->cur_frame = lround(progress * (sd->frame_count - 1)); | ||
3196 | else | ||
3197 | sd->cur_frame = 0; | ||
3198 | } | ||
3199 | |||
3200 | |||
3201 | EOLIAN static void | ||
3187 | _efl_ui_image_zoomable_class_constructor(Efl_Class *klass EINA_UNUSED) | 3202 | _efl_ui_image_zoomable_class_constructor(Efl_Class *klass EINA_UNUSED) |
3188 | { | 3203 | { |
3189 | PHOTO_FILE_LOAD_ERROR_GENERIC = eina_error_msg_static_register("Generic load error"); | 3204 | PHOTO_FILE_LOAD_ERROR_GENERIC = eina_error_msg_static_register("Generic load error"); |
diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo index 5b097e1fab..4887128503 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.eo +++ b/src/lib/elementary/efl_ui_image_zoomable.eo | |||
@@ -50,7 +50,7 @@ class Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom | |||
50 | Efl.Player.playing { get; set; } | 50 | Efl.Player.playing { get; set; } |
51 | Efl.Player.paused { get; set; } | 51 | Efl.Player.paused { get; set; } |
52 | Efl.Player.playback_position { get; set; } | 52 | Efl.Player.playback_position { get; set; } |
53 | Efl.Player.playback_progress { get; } | 53 | Efl.Player.playback_progress { get; set; } |
54 | Efl.Player.playback_speed { get; set; } | 54 | Efl.Player.playback_speed { get; set; } |
55 | Efl.Ui.Zoom.zoom_animation { set; get; } | 55 | Efl.Ui.Zoom.zoom_animation { set; get; } |
56 | Efl.Ui.Zoom.zoom_level { set; get; } | 56 | Efl.Ui.Zoom.zoom_level { set; get; } |
diff --git a/src/lib/emotion/efl_canvas_video.eo b/src/lib/emotion/efl_canvas_video.eo index 162e0fcc27..0f2ffa7435 100644 --- a/src/lib/emotion/efl_canvas_video.eo +++ b/src/lib/emotion/efl_canvas_video.eo | |||
@@ -60,7 +60,7 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group | |||
60 | Efl.Player.playing { get; set; } | 60 | Efl.Player.playing { get; set; } |
61 | Efl.Player.paused { get; set; } | 61 | Efl.Player.paused { get; set; } |
62 | Efl.Player.playback_position { get; set; } | 62 | Efl.Player.playback_position { get; set; } |
63 | Efl.Player.playback_progress { get; } | 63 | Efl.Player.playback_progress { get; set; } |
64 | Efl.Audio_Control.volume { get; set; } | 64 | Efl.Audio_Control.volume { get; set; } |
65 | Efl.Audio_Control.mute { get; set; } | 65 | Efl.Audio_Control.mute { get; set; } |
66 | Efl.Playable.length { get; } | 66 | Efl.Playable.length { get; } |
diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c index a642386fbe..9f723e5bef 100644 --- a/src/lib/emotion/emotion_smart.c +++ b/src/lib/emotion/emotion_smart.c | |||
@@ -1217,6 +1217,13 @@ _efl_canvas_video_efl_player_playback_progress_get(const Eo *obj EINA_UNUSED, Ef | |||
1217 | return sd->progress.stat; | 1217 | return sd->progress.stat; |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | EOLIAN static void | ||
1221 | _efl_canvas_video_efl_player_playback_progress_set(Eo *obj, Efl_Canvas_Video_Data *sd EINA_UNUSED, double progress) | ||
1222 | { | ||
1223 | const char *info = emotion_object_progress_info_get((const Evas_Object*)obj); | ||
1224 | _emotion_progress_set(obj, (char*)info, progress); | ||
1225 | } | ||
1226 | |||
1220 | EOLIAN static double | 1227 | EOLIAN static double |
1221 | _efl_canvas_video_efl_playable_length_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) | 1228 | _efl_canvas_video_efl_playable_length_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) |
1222 | { | 1229 | { |