headless_server : seperate headless-output function for selective action
authordyamy-lee <dyamy.lee@samsung.com>
Fri, 12 Nov 2021 06:02:08 +0000 (15:02 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Wed, 9 Jun 2021 02:42:48 +0000 (11:42 +0900)
Change-Id: I5588abd49502aeac9a8f8e7fb4cdb30c017fd04c
(cherry picked from commit cf68a6aa3d32547749bef5e8a35810d4105e7888)

src/headless_server.c

index 5275e49..14ce747 100644 (file)
@@ -30,6 +30,8 @@
 #include <pepper.h>
 #include <headless_server.h>
 
+int use_output = 1;
+
 static int
 handle_sigint(int signal_number, void *data)
 {
@@ -78,6 +80,11 @@ int main(int argc, char *argv[])
        if (!getenv("XDG_RUNTIME_DIR"))
                setenv("XDG_RUNTIME_DIR", "/run", 1);
 
+       if(!getenv("RUN_WITH_SPEAKER"))
+       {
+               use_output = 0;
+       }
+
        /* create pepper compositir */
        compositor = pepper_compositor_create(socket_name, NULL);
        PEPPER_CHECK(compositor, return EXIT_FAILURE, "Failed to create compositor !");
@@ -91,8 +98,11 @@ int main(int argc, char *argv[])
        PEPPER_CHECK(ret, goto end, "headless_input_init() failed\n");
 
        /* Init Output */
-       ret = headless_output_init(compositor);
-       PEPPER_CHECK(ret, goto end, "headless_output_init() failed.\n");
+       if(use_output)
+       {
+               ret = headless_output_init(compositor);
+               PEPPER_CHECK(ret, goto end, "headless_output_init() failed.\n");
+       }
 
        /* Init Shell */
        ret = headless_shell_init(compositor);
@@ -108,7 +118,8 @@ end:
        /* Deinit Process */
        headless_shell_deinit(compositor);
        headless_input_deinit(compositor);
-       headless_output_deinit(compositor);
+       if(use_output)
+               headless_output_deinit(compositor);
        headless_debug_deinit(compositor);
        pepper_compositor_destroy(compositor);