This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository efl.

View the commit online.

commit 7d3a91691fa89e1f3f9f43bcec92a6672ae46383
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 15 12:49:10 2026 -0600

    emotion: Efl.Canvas.Video implements the interfaces it claims
    
    The class claims Efl.File, Efl.Audio_Control, Efl.Player, Efl.Playable,
    Efl.Gfx.Image and Efl.Gfx.Image_Load_Controller and answered for part
    of them. Eolian only checks that on a stable class, which is why nobody
    had noticed that Efl.Player.playback_speed, autoplay and playback_loop,
    Efl.Playable.playable, Efl.Gfx.Image.scale_method and nineteen further
    members of Efl.Gfx.Image and Efl.Gfx.Image_Load_Controller had no
    implementation at all.
    
    What is on screen is a canvas image and this object holds one, so
    Efl.Gfx.Image is handed to it in full. Efl.Gfx.Image_Load_Controller
    is a different matter -- it steers a raster loader: decode at this dpi,
    only this region, halve it on the way in -- and a media engine takes
    none of that. Those say so and answer neutrally rather than taking a
    value and dropping it. The decoder does not start or restart by itself
    either, so Efl.Player.autoplay and playback_loop are refused the same
    way.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/emotion/efl_canvas_video.eo   |  26 ++++-
 src/lib/emotion/emotion_smart.c       | 195 ++++++++++++++++++++++++++++++++++
 src/tests/elementary/elm_test_video.c |  98 +++++++++++++++++
 3 files changed, 318 insertions(+), 1 deletion(-)

diff --git a/src/lib/emotion/efl_canvas_video.eo b/src/lib/emotion/efl_canvas_video.eo
index 33549391a9..8cd4dddc63 100644
--- a/src/lib/emotion/efl_canvas_video.eo
+++ b/src/lib/emotion/efl_canvas_video.eo
@@ -60,14 +60,38 @@ 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_speed { get; set; }
+        Efl.Player.autoplay { get; set; }
+        Efl.Player.playback_loop { get; set; }
         Efl.Player.playback_progress { get; set; }
         Efl.Audio_Control.volume { get; set; }
         Efl.Audio_Control.mute { get; set; }
         Efl.Playable.length { get; }
+        Efl.Playable.playable { get; }
         Efl.Playable.seekable { get; }
-        Efl.Gfx.Image_Load_Controller.load_size { get; }
+        Efl.Gfx.Image_Load_Controller.load_size { get; set; }
         Efl.Gfx.Image.ratio { get; }
         Efl.Gfx.Image.smooth_scale { get; set; }
+        Efl.Gfx.Image.scale_method { get; set; }
+        Efl.Gfx.Image.can_upscale { get; set; }
+        Efl.Gfx.Image.can_downscale { get; set; }
+        Efl.Gfx.Image.content_region { get; }
+        Efl.Gfx.Image.border_insets { get; set; }
+        Efl.Gfx.Image.border_insets_scale { get; set; }
+        Efl.Gfx.Image.center_fill_mode { get; set; }
+        Efl.Gfx.Image.stretch_region { get; set; }
+        Efl.Gfx.Image.content_hint { get; set; }
+        Efl.Gfx.Image.scale_hint { get; set; }
+        Efl.Gfx.Image_Load_Controller.load_dpi { get; set; }
+        Efl.Gfx.Image_Load_Controller.load_region { get; set; }
+        Efl.Gfx.Image_Load_Controller.load_region_support { get; }
+        Efl.Gfx.Image_Load_Controller.load_orientation { get; set; }
+        Efl.Gfx.Image_Load_Controller.load_scale_down { get; set; }
+        Efl.Gfx.Image_Load_Controller.load_skip_header { get; set; }
+        Efl.Gfx.Image.image_size { get; }
+        Efl.Gfx.Image.image_load_error { get; }
+        Efl.Gfx.Image_Load_Controller.load_async_start;
+        Efl.Gfx.Image_Load_Controller.load_async_cancel;
    }
    events {
         frame,decode: void; [[Called when the frame was decoded]]
diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c
index 3dc5dd4270..2ab0b76125 100644
--- a/src/lib/emotion/emotion_smart.c
+++ b/src/lib/emotion/emotion_smart.c
@@ -835,6 +835,201 @@ emotion_object_smooth_scale_set(Evas_Object *obj, Eina_Bool smooth)
    efl_gfx_image_smooth_scale_set(obj, smooth);
 }
 
+/* Efl.Gfx.Image is forwarded to the canvas image this object draws into. */
+#define VIDEO_FWD_SET(name, type) \
+   EOLIAN static void \
+   _efl_canvas_video_efl_gfx_image_##name##_set(Eo *obj EINA_UNUSED, \
+                                                Efl_Canvas_Video_Data *sd, \
+                                                type v) \
+   { \
+      efl_gfx_image_##name##_set(sd->obj, v); \
+   }
+#define VIDEO_FWD_GET(name, type) \
+   EOLIAN static type \
+   _efl_canvas_video_efl_gfx_image_##name##_get(const Eo *obj EINA_UNUSED, \
+                                                Efl_Canvas_Video_Data *sd) \
+   { \
+      return efl_gfx_image_##name##_get(sd->obj); \
+   }
+VIDEO_FWD_SET(can_upscale, Eina_Bool)
+VIDEO_FWD_GET(can_upscale, Eina_Bool)
+VIDEO_FWD_SET(can_downscale, Eina_Bool)
+VIDEO_FWD_GET(can_downscale, Eina_Bool)
+VIDEO_FWD_GET(content_region, Eina_Rect)
+VIDEO_FWD_SET(border_insets_scale, double)
+VIDEO_FWD_GET(border_insets_scale, double)
+VIDEO_FWD_SET(center_fill_mode, Efl_Gfx_Center_Fill_Mode)
+VIDEO_FWD_GET(center_fill_mode, Efl_Gfx_Center_Fill_Mode)
+VIDEO_FWD_SET(content_hint, Efl_Gfx_Image_Content_Hint)
+VIDEO_FWD_GET(content_hint, Efl_Gfx_Image_Content_Hint)
+VIDEO_FWD_SET(scale_hint, Efl_Gfx_Image_Scale_Hint)
+VIDEO_FWD_GET(scale_hint, Efl_Gfx_Image_Scale_Hint)
+
+/* Efl.Gfx.Image_Load_Controller steers a raster loader: decode at this dpi,
+ * only this region, skip the header, halve it on the way in. A video is
+ * decoded frame by frame by a media engine that takes none of those, so the
+ * setters refuse and the getters answer neutrally.
+ */
+#define VIDEO_LOAD_REFUSE_SET(name, type) \
+   EOLIAN static void \
+   _efl_canvas_video_efl_gfx_image_load_controller_##name##_set(Eo *obj EINA_UNUSED, \
+                                                                Efl_Canvas_Video_Data *sd EINA_UNUSED, \
+                                                                type v EINA_UNUSED) \
+   { \
+      ERR("A video is decoded by its media engine; " #name " does not apply."); \
+   }
+#define VIDEO_LOAD_NEUTRAL_GET(name, type, zero) \
+   EOLIAN static type \
+   _efl_canvas_video_efl_gfx_image_load_controller_##name##_get(const Eo *obj EINA_UNUSED, \
+                                                                Efl_Canvas_Video_Data *sd EINA_UNUSED) \
+   { \
+      return zero; \
+   }
+
+VIDEO_LOAD_REFUSE_SET(load_dpi, double)
+VIDEO_LOAD_NEUTRAL_GET(load_dpi, double, 0.0)
+VIDEO_LOAD_REFUSE_SET(load_region, Eina_Rect)
+VIDEO_LOAD_NEUTRAL_GET(load_region, Eina_Rect, EINA_RECT(0, 0, 0, 0))
+VIDEO_LOAD_NEUTRAL_GET(load_region_support, Eina_Bool, EINA_FALSE)
+VIDEO_LOAD_REFUSE_SET(load_orientation, Eina_Bool)
+VIDEO_LOAD_NEUTRAL_GET(load_orientation, Eina_Bool, EINA_FALSE)
+VIDEO_LOAD_REFUSE_SET(load_scale_down, int)
+VIDEO_LOAD_NEUTRAL_GET(load_scale_down, int, 0)
+VIDEO_LOAD_REFUSE_SET(load_skip_header, Eina_Bool)
+VIDEO_LOAD_NEUTRAL_GET(load_skip_header, Eina_Bool, EINA_FALSE)
+
+#undef VIDEO_LOAD_REFUSE_SET
+#undef VIDEO_LOAD_NEUTRAL_GET
+#undef VIDEO_FWD_SET
+#undef VIDEO_FWD_GET
+
+EOLIAN static Eina_Size2D
+_efl_canvas_video_efl_gfx_image_image_size_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
+{
+   return efl_gfx_image_size_get(sd->obj);
+}
+
+EOLIAN static Eina_Error
+_efl_canvas_video_efl_gfx_image_image_load_error_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
+{
+   return efl_gfx_image_load_error_get(sd->obj);
+}
+
+EOLIAN static void
+_efl_canvas_video_efl_gfx_image_border_insets_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, int l, int r, int t, int b)
+{
+   efl_gfx_image_border_insets_set(sd->obj, l, r, t, b);
+}
+
+EOLIAN static void
+_efl_canvas_video_efl_gfx_image_border_insets_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, int *l, int *r, int *t, int *b)
+{
+   efl_gfx_image_border_insets_get(sd->obj, l, r, t, b);
+}
+
+EOLIAN static Eina_Error
+_efl_canvas_video_efl_gfx_image_stretch_region_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, Eina_Iterator *horizontal, Eina_Iterator *vertical)
+{
+   return efl_gfx_image_stretch_region_set(sd->obj, horizontal, vertical);
+}
+
+EOLIAN static void
+_efl_canvas_video_efl_gfx_image_stretch_region_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, Eina_Iterator **horizontal, Eina_Iterator **vertical)
+{
+   efl_gfx_image_stretch_region_get(sd->obj, horizontal, vertical);
+}
+
+/* Loading is driven by the decoding engine, not by the caller: there is no
+ * point at which a frame is waiting to be asked for.
+ */
+EOLIAN static void
+_efl_canvas_video_efl_gfx_image_load_controller_load_async_start(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd EINA_UNUSED)
+{
+}
+
+EOLIAN static void
+_efl_canvas_video_efl_gfx_image_load_controller_load_async_cancel(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd EINA_UNUSED)
+{
+}
+
+EOLIAN static void
+_efl_canvas_video_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, double speed)
+{
+   if (!sd->engine_instance) return;
+   emotion_engine_instance_speed_set(sd->engine_instance, speed);
+}
+
+EOLIAN static double
+_efl_canvas_video_efl_player_playback_speed_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
+{
+   if (!sd->engine_instance) return 0.0;
+   return emotion_engine_instance_speed_get(sd->engine_instance);
+}
+
+/* The decoder starts and restarts only when told to: autoplay and looping are
+ * not something it does by itself, so setting them is refused.
+ */
+EOLIAN static void
+_efl_canvas_video_efl_player_autoplay_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd EINA_UNUSED,
+                                          Eina_Bool autoplay EINA_UNUSED)
+{
+   ERR("A video does not start by itself; autoplay is not supported.");
+}
+
+EOLIAN static Eina_Bool
+_efl_canvas_video_efl_player_autoplay_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+EOLIAN static void
+_efl_canvas_video_efl_player_playback_loop_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd EINA_UNUSED,
+                                               Eina_Bool loop EINA_UNUSED)
+{
+   ERR("A video does not restart by itself; playback_loop is not supported.");
+}
+
+EOLIAN static Eina_Bool
+_efl_canvas_video_efl_player_playback_loop_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+/* There is something to play once a file has been opened and the engine
+ * reports a length for it; a file that failed to open has neither.
+ */
+EOLIAN static Eina_Bool
+_efl_canvas_video_efl_playable_playable_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
+{
+   if (!sd->engine_instance) return EINA_FALSE;
+   if (!sd->open) return EINA_FALSE;
+   return emotion_engine_instance_len_get(sd->engine_instance) > 0.0;
+}
+
+/* A video frame is scaled by the canvas image below it, which is where the
+ * method is kept.
+ */
+EOLIAN static void
+_efl_canvas_video_efl_gfx_image_scale_method_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, Efl_Gfx_Image_Scale_Method method)
+{
+   efl_gfx_image_scale_method_set(sd->obj, method);
+}
+
+EOLIAN static Efl_Gfx_Image_Scale_Method
+_efl_canvas_video_efl_gfx_image_scale_method_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd)
+{
+   return efl_gfx_image_scale_method_get(sd->obj);
+}
+
+/* The decoded size is the movie's own, decided by the file rather than asked
+ * for, so the setter says so instead of silently doing nothing.
+ */
+EOLIAN static void
+_efl_canvas_video_efl_gfx_image_load_controller_load_size_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd EINA_UNUSED, Eina_Size2D sz EINA_UNUSED)
+{
+   ERR("A video decodes at the size its file specifies; load_size cannot bound it.");
+}
+
 EOLIAN static void
 _efl_canvas_video_efl_gfx_image_smooth_scale_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, Eina_Bool smooth)
 {
diff --git a/src/tests/elementary/elm_test_video.c b/src/tests/elementary/elm_test_video.c
index 89ecd503b9..1c78bc5c22 100644
--- a/src/tests/elementary/elm_test_video.c
+++ b/src/tests/elementary/elm_test_video.c
@@ -4,6 +4,7 @@
 
 #define EFL_ACCESS_OBJECT_BETA
 #include <Elementary.h>
+#include <Emotion.h>
 #include "elm_suite.h"
 
 EFL_START_TEST(elm_video_legacy_type_check)
@@ -43,6 +44,100 @@ EFL_START_TEST(elm_atspi_role_get)
 EFL_END_TEST
 */
 
+/* Efl.Canvas.Video is the decoder: an Efl.Canvas.Group that draws frames and
+ * answers for playback, audio and the image it is showing.
+ *
+ * None of this needs a file to be decoded, which is deliberate: a test that
+ * needs a working gstreamer pipeline is a test that does not run everywhere.
+ */
+
+EFL_START_TEST(efl_canvas_video_test_playback_properties)
+{
+   Eo *win, *video;
+
+   win = win_add(NULL, "video", ELM_WIN_BASIC);
+   video = efl_add(EFL_CANVAS_VIDEO_CLASS, win);
+   ck_assert(video != NULL);
+
+   /* The decoder neither starts nor restarts by itself: both are refused and
+      read back as off. */
+   EXPECT_ERROR_START;
+   efl_player_autoplay_set(video, EINA_TRUE);
+   EXPECT_ERROR_END;
+   ck_assert(!efl_player_autoplay_get(video));
+
+   EXPECT_ERROR_START;
+   efl_player_playback_loop_set(video, EINA_TRUE);
+   EXPECT_ERROR_END;
+   ck_assert(!efl_player_playback_loop_get(video));
+
+   /* Nothing has been loaded, so there is nothing to play and nowhere to seek
+      to. */
+   ck_assert(!efl_playable_get(video));
+   ck_assert(!efl_playable_seekable_get(video));
+   ck_assert(EINA_DBL_EQ(efl_playable_length_get(video), 0.0));
+}
+EFL_END_TEST
+
+EFL_START_TEST(efl_canvas_video_test_audio_control)
+{
+   Eo *win, *video;
+
+   win = win_add(NULL, "video", ELM_WIN_BASIC);
+   video = efl_add(EFL_CANVAS_VIDEO_CLASS, win);
+
+   efl_audio_control_mute_set(video, EINA_TRUE);
+   ck_assert(efl_audio_control_mute_get(video));
+   efl_audio_control_mute_set(video, EINA_FALSE);
+   ck_assert(!efl_audio_control_mute_get(video));
+}
+EFL_END_TEST
+
+/* Efl.Gfx.Image and Efl.Gfx.Image_Load_Controller are answered by handing the
+ * question to the canvas image the object draws into, so what is set comes
+ * back.
+ */
+EFL_START_TEST(efl_canvas_video_test_image_properties)
+{
+   Eo *win, *video;
+   int l, r, t, b;
+
+   win = win_add(NULL, "video", ELM_WIN_BASIC);
+   video = efl_add(EFL_CANVAS_VIDEO_CLASS, win);
+
+   efl_gfx_image_can_upscale_set(video, EINA_FALSE);
+   ck_assert(!efl_gfx_image_can_upscale_get(video));
+   efl_gfx_image_can_downscale_set(video, EINA_FALSE);
+   ck_assert(!efl_gfx_image_can_downscale_get(video));
+
+   efl_gfx_image_scale_method_set(video, EFL_GFX_IMAGE_SCALE_METHOD_FIT);
+   ck_assert_int_eq(efl_gfx_image_scale_method_get(video),
+                    EFL_GFX_IMAGE_SCALE_METHOD_FIT);
+
+   efl_gfx_image_border_insets_set(video, 1, 2, 3, 4);
+   efl_gfx_image_border_insets_get(video, &l, &r, &t, &b);
+   ck_assert_int_eq(l, 1);
+   ck_assert_int_eq(r, 2);
+   ck_assert_int_eq(t, 3);
+   ck_assert_int_eq(b, 4);
+
+   efl_gfx_image_border_insets_scale_set(video, 2.0);
+   ck_assert(EINA_DBL_EQ(efl_gfx_image_border_insets_scale_get(video), 2.0));
+
+   /* Efl.Gfx.Image_Load_Controller steers a raster loader, and a video is
+      decoded by a media engine that takes none of it. Every one of these says
+      so and answers neutrally rather than accepting a value and dropping it. */
+   EXPECT_ERROR_START;
+   efl_gfx_image_load_controller_load_scale_down_set(video, 2);
+   ck_assert_int_eq(efl_gfx_image_load_controller_load_scale_down_get(video), 0);
+   efl_gfx_image_load_controller_load_dpi_set(video, 300.0);
+   ck_assert(EINA_DBL_EQ(efl_gfx_image_load_controller_load_dpi_get(video), 0.0));
+   ck_assert(!efl_gfx_image_load_controller_load_region_support_get(video));
+   efl_gfx_image_load_controller_load_size_set(video, EINA_SIZE2D(64, 64));
+   EXPECT_ERROR_END;
+}
+EFL_END_TEST
+
 /* Emotion goes down with Elementary and comes back with it: the engine has to
    be there the second time, after two videos in the first life. */
 EFL_START_TEST(elm_video_engine_after_shutdown)
@@ -67,6 +162,9 @@ EFL_END_TEST
 void elm_test_video(TCase *tc)
 {
    tcase_add_test(tc, elm_video_legacy_type_check);
+   tcase_add_test(tc, efl_canvas_video_test_playback_properties);
+   tcase_add_test(tc, efl_canvas_video_test_audio_control);
+   tcase_add_test(tc, efl_canvas_video_test_image_properties);
    tcase_add_test(tc, elm_video_engine_after_shutdown);
 //   tcase_add_test(tc, elm_atspi_role_get);
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to