efl_ui/image: implement efl.player::playback_progress method
authorMike Blumenkrantz <zmike@samsung.com>
Tue, 24 Sep 2019 19:30:11 +0000 (15:30 -0400)
committerJongmin Lee <jm105.lee@samsung.com>
Wed, 25 Sep 2019 21:11:54 +0000 (06:11 +0900)
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D10120

src/lib/elementary/efl_ui_image.c
src/lib/elementary/efl_ui_image.eo
src/lib/elementary/efl_ui_image_zoomable.c
src/lib/elementary/efl_ui_image_zoomable.eo

index 53e521e..ba71e49 100644 (file)
@@ -1849,6 +1849,16 @@ _efl_ui_image_efl_player_playback_position_get(const Eo *obj EINA_UNUSED, Efl_Ui
    return 0.0;
 }
 
+EOLIAN static double
+_efl_ui_image_efl_player_playback_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
+{
+   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;
+   return 0.0;
+}
+
 static Eina_Bool
 _efl_ui_image_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool paused)
 {
index ced215a..5d32abd 100644 (file)
@@ -101,6 +101,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.Layout.Signal.signal_emit;
       Efl.Layout.Signal.message_send;
       Efl.Layout.Signal.signal_callback_add;
index a53b362..00c71a0 100644 (file)
@@ -3163,6 +3163,16 @@ _efl_ui_image_zoomable_efl_player_playback_position_get(const Eo *obj EINA_UNUSE
    return 0.0;
 }
 
+EOLIAN static double
+_efl_ui_image_zoomable_efl_player_playback_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd)
+{
+   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;
+   return 0.0;
+}
+
 EOLIAN static void
 _efl_ui_image_zoomable_class_constructor(Efl_Class *klass EINA_UNUSED)
 {
index 52df2c3..40dca93 100644 (file)
@@ -47,6 +47,7 @@ class @beta 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.Ui.Zoom.zoom_animation { set; get; }
       Efl.Ui.Zoom.zoom_level { set; get; }
       Efl.Ui.Zoom.zoom_mode { set; get; }