e_info: Add video_shell command 91/315091/1
authorSeunghun Lee <shiin.lee@samsung.com>
Tue, 23 Jul 2024 04:45:59 +0000 (13:45 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Thu, 25 Jul 2024 02:44:10 +0000 (11:44 +0900)
Change-Id: I44cac8c5101e1195acc8b6ee3228f4ad6ae87900

src/bin/debug/e_info_client.c
src/bin/debug/e_info_server.c
src/bin/server/e_video_shell.c
src/include/e_info_shared_types.h

index 5299d66..daabf06 100644 (file)
@@ -6695,6 +6695,28 @@ _e_info_client_log_control(int argc, char **argv)
      }
 }
 
+static void
+_e_info_client_proc_video_shell(int argc, char **argv)
+{
+   char **args = &argv[2];
+
+   argc = argc - 2;
+   if (argc <= 0)
+     goto err;
+
+   if (strcmp(args[0], "--enable-border") == 0)
+     _e_info_client_eldbus_message_with_args(VIDEO_SHELL_BORDER_ENABLED_SET_METHOD_NAME, NULL, "b", EINA_TRUE);
+   else if (strcmp(args[0], "--disable-border") == 0)
+     _e_info_client_eldbus_message_with_args(VIDEO_SHELL_BORDER_ENABLED_SET_METHOD_NAME, NULL, "b", EINA_FALSE);
+   else
+     goto err;
+
+   return;
+err:
+   printf("video_shell: error: invalid argument\n");
+   printf("%s", USAGE_VIDEO_SHELL);
+}
+
 typedef struct _ProcInfo
 {
    const char *option;
@@ -7105,6 +7127,12 @@ static ProcInfo procs_to_execute[] =
       "Enable/Disable specific log",
       _e_info_client_log_control
    },
+   {
+      "video_shell",
+      USAGE_VIDEO_SHELL,
+      "The command for video shell",
+      _e_info_client_proc_video_shell,
+   },
 };
 
 ProcInfo procs_to_input[] =
index 68efcf5..addf334 100644 (file)
@@ -39,6 +39,7 @@
 #include "e_comp_input_intern.h"
 #include "e_alpha_mask_rect_intern.h"
 #include "e_display_intern.h"
+#include "e_video_shell_intern.h"
 
 #include <tbm_bufmgr.h>
 #include <tbm_surface.h>
@@ -7311,6 +7312,24 @@ _e_info_server_cb_log_control(const Eldbus_Service_Interface *iface EINA_UNUSED,
    return reply;
 }
 
+static Eldbus_Message *
+_e_info_server_cb_video_shell_border_enabled_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+   Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+   Eina_Bool enabled;
+
+   if (!eldbus_message_arguments_get(msg, "b", &enabled))
+     {
+        ERR("Error getting arguments.");
+        goto end;
+     }
+
+   e_video_shell_border_enabled_set(enabled);
+
+end:
+   return reply;
+}
+
 //{ "method_name", arguments_from_client, return_values_to_client, _method_cb, ELDBUS_METHOD_FLAG },
 static const Eldbus_Method methods[] = {
    { "get_window_info", NULL, ELDBUS_ARGS({"iiiiisiiia("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}), _e_info_server_cb_window_info_get, 0 },
@@ -7410,6 +7429,7 @@ static const Eldbus_Method methods[] = {
    { "input_subtype_set", ELDBUS_ARGS({"ss", "set input device's subtype(subclas)"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_input_subtype_set, 0 },
    { "kvm_transparent", ELDBUS_ARGS({"i", "set kvm service window to transparent"}), NULL, _e_info_server_cb_kvm_transparent_set, 0 },
    { "log_control", ELDBUS_ARGS({"s","log type" }, {"i", "enable"}), NULL, _e_info_server_cb_log_control, 0},
+   { VIDEO_SHELL_BORDER_ENABLED_SET_METHOD_NAME, ELDBUS_ARGS({"b", "enable border of video viewport"}), NULL, _e_info_server_cb_video_shell_border_enabled_set, 0},
    { NULL, NULL, NULL, NULL, 0 }
 };
 
index c9a1582..d27bf35 100644 (file)
@@ -164,6 +164,7 @@ struct _E_Video_Viewport_Source
 
 static const char *e_video_surface_role_name = "wtz_video_surface";
 static Eina_Bool border_enabled = EINA_FALSE;
+static Eina_List *shells;
 
 static void _source_viewport_destroyed(E_Video_Viewport_Source *source);
 static void _source_viewport_committed(E_Video_Viewport_Source *source);
@@ -1731,6 +1732,7 @@ _video_shell_free(E_Video_Shell *shell)
 {
    VS_INF("SHELL %p| Free", shell);
 
+   shells = eina_list_remove(shells, shell);
    eina_hash_free(shell->viewports);
    free(shell);
 }
@@ -1764,6 +1766,8 @@ e_video_shell_create(struct wl_display *display)
    shell->display_destroy.notify = _video_shell_cb_display_destroy;
    wl_display_add_destroy_listener(display, &shell->display_destroy);
 
+   shells = eina_list_append(shells, shell);
+
    VS_INF("SHELL %p| Created", shell);
 
    return shell;
@@ -1772,6 +1776,29 @@ e_video_shell_create(struct wl_display *display)
 EINTERN void
 e_video_shell_border_enabled_set(Eina_Bool enabled)
 {
+   E_Video_Shell *shell;
+   E_Video_Viewport *viewport;
+   Eina_Iterator *itr;
+   Eina_List *l;
+
+   EINA_LIST_FOREACH(shells, l, shell)
+     {
+        itr = eina_hash_iterator_data_new(shell->viewports);
+        EINA_ITERATOR_FOREACH(itr, viewport)
+          {
+             if (enabled)
+               {
+                  _viewport_border_init(viewport);
+                  _viewport_border_geometry_update(viewport);
+               }
+             else
+               {
+                  _viewport_border_finish(viewport);
+               }
+          }
+        eina_iterator_free(itr);
+     }
+
    border_enabled = enabled;
 }
 
index 25d4284..02062a6 100644 (file)
@@ -368,4 +368,16 @@ typedef enum
    "\twinfo -log key_input_ttrace_enable 1\n"    \
    "\twinfo -log buffer_serial_log_enable 1\n"
 
+/* -------------------------------------------------------------------------- */
+/* VIDEO SHELL                                                                */
+/* -------------------------------------------------------------------------- */
+#define VIDEO_SHELL_BORDER_ENABLED_SET_METHOD_NAME "video_shell_border_enabled_set"
+#define USAGE_VIDEO_SHELL                                                       \
+   "-video_shell [OPTIONS]\n"                                                   \
+   "\t--enable-border : Enable video viewport border\n"                         \
+   "\t--disable-border : Disable video viewport border\n"                       \
+   "Example:\n"                                                                 \
+   "\twinfo -video_shell --enable-border\n"                                     \
+   "\twinfo -video_shell --dislable-border\n"                                   \
+
 #endif /* end of _E_INFO_SHARED_TYPES_ */