From acd4ace06c45b858a8017267253dbbe7fc61c73b Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 17 Apr 2015 16:08:56 +0100 Subject: [PATCH] Emotion: Migrate some more of emotion to Eo/efl.player. --- src/lib/efl/interfaces/efl_player.eo | 22 ++++++++++++++++++++ src/lib/emotion/emotion_object.eo | 6 ++---- src/lib/emotion/emotion_smart.c | 30 ++++++++++++++++++---------- 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/src/lib/efl/interfaces/efl_player.eo b/src/lib/efl/interfaces/efl_player.eo index 4592896577..b1fab48d76 100644 --- a/src/lib/efl/interfaces/efl_player.eo +++ b/src/lib/efl/interfaces/efl_player.eo @@ -105,5 +105,27 @@ interface Efl.Player { bool mute; /*@ The mute state. True or false. */ } } + length { + /** + * @brief Get the length of play for the media file. + * + * This function returns the length of the media file in seconds. + */ + get { + } + values { + double length; /*@ The length of the stream in seconds. */ + } + } + seekable { + /** + * @brief Get whether the media file is seekable. + */ + get { + } + values { + bool seekable; /*@ True if seekable. */ + } + } } } diff --git a/src/lib/emotion/emotion_object.eo b/src/lib/emotion/emotion_object.eo index 3fe8fffbcc..9749d1193a 100644 --- a/src/lib/emotion/emotion_object.eo +++ b/src/lib/emotion/emotion_object.eo @@ -74,6 +74,8 @@ class Emotion.Object (Evas.Object_Smart, Efl.File, Efl.Player, Efl.Image) { Efl.Player.audio_volume.get; Efl.Player.audio_mute.set; Efl.Player.audio_mute.get; + Efl.Player.length.get; + Efl.Player.seekable.get; Efl.Image.load_size.get; Efl.Image.ratio.get; Efl.Image.smooth_scale.set; @@ -104,11 +106,7 @@ class Emotion.Object (Evas.Object_Smart, Efl.File, Efl.Player, Efl.Image) { /* FIXME: Need to be added: EAPI double emotion_object_buffer_size_get (const Evas_Object *obj); -EAPI Eina_Bool emotion_object_seekable_get (const Evas_Object *obj); -EAPI double emotion_object_play_length_get (const Evas_Object *obj); EAPI const char *emotion_object_progress_info_get (const Evas_Object *obj); -EAPI Eina_Bool emotion_object_video_handled_get (const Evas_Object *obj); -EAPI Eina_Bool emotion_object_audio_handled_get (const Evas_Object *obj); Everything starting from (needs to be added): EAPI int emotion_object_audio_channel_count (const Evas_Object *obj); diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c index 4d8b4df720..8cf589903d 100644 --- a/src/lib/emotion/emotion_smart.c +++ b/src/lib/emotion/emotion_smart.c @@ -733,11 +733,8 @@ emotion_object_buffer_size_get(const Evas_Object *obj) EAPI Eina_Bool emotion_object_seekable_get(const Evas_Object *obj) { - Emotion_Object_Data *sd; - - E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0); - if (!sd->engine_instance) return EINA_FALSE; - return emotion_engine_instance_seekable(sd->engine_instance); + Eina_Bool ret; + return eo_do_ret(obj, ret, efl_player_seekable_get()); } EAPI Eina_Bool @@ -763,12 +760,8 @@ emotion_object_audio_handled_get(const Evas_Object *obj) EAPI double emotion_object_play_length_get(const Evas_Object *obj) { - Emotion_Object_Data *sd; - - E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0); - if (!sd->engine_instance) return 0.0; - sd->len = emotion_engine_instance_len_get(sd->engine_instance); - return sd->len; + double ret; + return eo_do_ret(obj, ret, efl_player_length_get()); } EAPI void @@ -1185,6 +1178,21 @@ _emotion_object_efl_player_progress_get(Eo *obj EINA_UNUSED, Emotion_Object_Data return sd->progress.stat; } +EOLIAN static double +_emotion_object_efl_player_length_get(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd) +{ + if (!sd->engine_instance) return 0.0; + sd->len = emotion_engine_instance_len_get(sd->engine_instance); + return sd->len; +} + +EOLIAN static Eina_Bool +_emotion_object_efl_player_seekable_get(Eo *obj EINA_UNUSED, Emotion_Object_Data *sd) +{ + if (!sd->engine_instance) return EINA_FALSE; + return emotion_engine_instance_seekable(sd->engine_instance); +} + EAPI const char * emotion_object_ref_file_get(const Evas_Object *obj) { -- 2.34.1