tethering: remove build depedency. 61/27661/1
authorKitae Kim <kt920.kim@samsung.com>
Wed, 17 Sep 2014 05:03:10 +0000 (14:03 +0900)
committerKitae Kim <kt920.kim@samsung.com>
Wed, 17 Sep 2014 08:07:56 +0000 (17:07 +0900)
when --disable-sdl or --disable-shm on Mac OS X,
encode_fb module get compilation errors because of depedencies.

Change-Id: I0a312acb9ba4b0ec77de5df960de852b8c55a890
Signed-off-by: Kitae Kim <kt920.kim@samsung.com>
tizen/src/display/maru_sdl.c
tizen/src/display/maru_sdl.h
tizen/src/display/maru_shm.c
tizen/src/display/maru_shm.h
tizen/src/tethering/encode_fb.c
tizen/src/tethering/encode_fb.h
tizen/src/tethering/touch.c
tizen/src/tethering/touch.h

index 04bf1a7fbeb1cd2fc5ce1cc0fbfcc3367947969d..e0c177e0da2d91ac14012660f9526c14566fc1e5 100644 (file)
@@ -39,7 +39,7 @@
 #include "hw/pci/maru_brightness.h"
 #include "debug_ch.h"
 
-#include "tethering/touch.h"
+#include "tethering/encode_fb.h"
 
 #include <SDL.h>
 #ifndef CONFIG_WIN32
index 5345c78476f3a843466952748779ecccd7d03043..87e4ec877d94486f202a3677e0db489e819e61fa 100644 (file)
@@ -46,6 +46,4 @@ void maru_sdl_invalidate(bool on);
 void maru_sdl_interpolation(bool on);
 void maru_sdl_quit(void);
 
-bool maru_extract_framebuffer(void *buffer);
-
 #endif /* MARU_SDL_H_ */
index 9d14fcc2ea8ea8140e26b7146b5ae1988144c73d..e2c00bae60f90fb695293ca1391d5e000a6964d6 100644 (file)
@@ -41,7 +41,7 @@
 #include "util/maru_err_table.h"
 #include "debug_ch.h"
 
-#include "tethering/touch.h"
+#include "tethering/encode_fb.h"
 
 MULTI_DEBUG_CHANNEL(tizen, maru_shm);
 
index efa50e2fe901e4073bfcffd36a0b76276f502eae..e52d3898470e1c041b249d9039e5f61e8f1277c4 100644 (file)
@@ -42,6 +42,5 @@ void maru_shm_init(uint64 swt_handle,
 void maru_shm_resize(void);
 void maru_shm_quit(void);
 void maru_shm_update(void);
-bool maru_extract_framebuffer(void *buffer);
 
 #endif /* MARU_SHM_H_ */
index 139fcb195996edb1c76d4ea0df752b9327865042..022fba13f57e7f7f795baa9103832ffbf6867386 100644 (file)
 
 #include "emulator_common.h"
 #include "emul_state.h"
-
-#ifdef CONFIG_SDL
-#include "display/maru_sdl.h"
-#endif
-#ifdef CONFIG_USE_SHM
-#include "display/maru_shm.h"
-#endif
-
 #include "skin/maruskin_operation.h"
 #include "encode_fb.h"
 
 DECLARE_DEBUG_CHANNEL(app_tethering);
 
 #ifdef CONFIG_WEBP
-static void *encode_webp(void);
-#endif
-static void *encode_png(void);
-
-void *encode_framebuffer(int encoder)
+/*
+ *  webp functions
+ */
+static void *encode_webp(void)
 {
-    void *output = NULL;
+    int width = 0, height = 0, image_stride = 0;
+    size_t ret = 0;
 
-#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG)
-    struct timespec start, end;
+    struct encode_mem *container = NULL;
+    uint8_t *surface = NULL;
+    uint32_t surface_size = 0;
 
-    clock_gettime(CLOCK_MONOTONIC, &start);
-#endif
+    container = g_malloc(sizeof(struct encode_mem));
+    if (!container) {
+        LOG_SEVERE("failed to allocate encode_mem\n");
+        return NULL;
+    }
 
-#ifdef CONFIG_WEBP
-    if (encoder == 0) {
-        output = encode_webp();
-    } else if (encoder == 1) {
-        output = encode_png();
+    container->buffer = NULL;
+    container->length = 0;
+
+    width = get_emul_resolution_width();
+    height = get_emul_resolution_height();
+
+    image_stride = width * 4;
+    LOG_TRACE("width %d, height %d, stride %d, raw image %d\n",
+        width, height, image_stride, (image_stride * height));
+
+    surface_size = width * height * 4;
+
+    surface = g_malloc0(surface_size);
+    if (!surface) {
+        LOG_SEVERE("failed to allocate framebuffer\n");
+        return NULL;
     }
-#else
-    output = encode_png();
-#endif
 
-#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG)
-    clock_gettime(CLOCK_MONOTONIC, &end);
+    if (!maru_extract_framebuffer(surface)) {
+        LOG_SEVERE("failed to extract framebuffer\n");
+        g_free(surface);
+        return NULL;
+    }
 
-    LOG_TRACE("encoding time: %.5f seconds\n",
-        ((double)end.tv_sec + (1.0e-9 * end.tv_nsec)) -
-        ((double)start.tv_sec + (1.0e-9 * start.tv_nsec)));
-#endif
+    container = g_malloc(sizeof(struct encode_mem));
+    if (!container) {
+        LOG_SEVERE("failed to allocate encode_mem\n");
+        g_free(surface);
+        return NULL;
+    }
 
-    return output;
+    container->buffer = NULL;
+    container->length = 0;
+
+    ret = WebPEncodeLosslessBGRA((const uint8_t *)surface, width,
+            height, image_stride, &container->buffer);
+    LOG_TRACE("lossless encode framebuffer via webp. result %zu\n", ret);
+
+    container->length = (int)ret;
+
+    g_free(surface);
+
+    return container;
 }
+#endif
 
+#ifdef CONFIG_PNG
+/*
+ *  png functions
+ */
 static void user_write_data(png_structp png_ptr, png_bytep data, png_size_t len)
 {
     struct encode_mem *p = (struct encode_mem *)png_get_io_ptr(png_ptr);
@@ -232,65 +257,42 @@ static void *encode_png(void)
 
     return container;
 }
+#endif
 
-#ifdef CONFIG_WEBP
-static void *encode_webp(void)
+void *encode_framebuffer(int encoder)
 {
-    int width = 0, height = 0, image_stride = 0;
-    size_t ret = 0;
-
-    struct encode_mem *container = NULL;
-    uint8_t *surface = NULL;
-    uint32_t surface_size = 0;
-
-    container = g_malloc(sizeof(struct encode_mem));
-    if (!container) {
-        LOG_SEVERE("failed to allocate encode_mem\n");
-        return NULL;
-    }
-
-    container->buffer = NULL;
-    container->length = 0;
-
-    width = get_emul_resolution_width();
-    height = get_emul_resolution_height();
-
-    image_stride = width * 4;
-    LOG_TRACE("width %d, height %d, stride %d, raw image %d\n",
-        width, height, image_stride, (image_stride * height));
+    void *output = NULL;
 
-    surface_size = width * height * 4;
+#ifdef CONFIG_PNG
+#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG)
+    struct timespec start, end;
 
-    surface = g_malloc0(surface_size);
-    if (!surface) {
-        LOG_SEVERE("failed to allocate framebuffer\n");
-        return NULL;
-    }
+    clock_gettime(CLOCK_MONOTONIC, &start);
+#endif
 
-    if (!maru_extract_framebuffer(surface)) {
-        LOG_SEVERE("failed to extract framebuffer\n");
-        g_free(surface);
-        return NULL;
-    }
+    output = encode_png();
 
-    container = g_malloc(sizeof(struct encode_mem));
-    if (!container) {
-        LOG_SEVERE("failed to allocate encode_mem\n");
-        g_free(surface);
-        return NULL;
-    }
+#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG)
+    clock_gettime(CLOCK_MONOTONIC, &end);
 
-    container->buffer = NULL;
-    container->length = 0;
+    LOG_TRACE("encoding time: %.5f seconds\n",
+        ((double)end.tv_sec + (1.0e-9 * end.tv_nsec)) -
+        ((double)start.tv_sec + (1.0e-9 * start.tv_nsec)));
+#endif
+#endif
 
-    ret = WebPEncodeLosslessBGRA((const uint8_t *)surface, width,
-            height, image_stride, &container->buffer);
-    LOG_TRACE("lossless encode framebuffer via webp. result %zu\n", ret);
+    return output;
+}
 
-    container->length = (int)ret;
+static bool display_dirty = false;
 
-    g_free(surface);
+void set_display_dirty(bool dirty)
+{
+    LOG_TRACE("qemu display update: %d\n", display_dirty);
+    display_dirty = dirty;
+}
 
-    return container;
+bool is_display_dirty(void)
+{
+    return display_dirty;
 }
-#endif
index 330fc3abd6aa1ae74d56bae88ac0b76288387b79..32a777f22f957679b1f3feda6e493236709055ca 100644 (file)
@@ -34,3 +34,9 @@ struct encode_mem {
 };
 
 void *encode_framebuffer(int encoder);
+
+bool maru_extract_framebuffer(void *buffer);
+
+void set_display_dirty(bool dirty);
+
+bool is_display_dirty(void);
index 85f067cd9d603fcaed59cb5e92431a836c5e4629..30a0b3a09dd288e76c980f0424e9bc495379e675 100644 (file)
@@ -197,14 +197,6 @@ static void set_hwkey_data(Tethering__HWKeyMsg *msg)
     send_tethering_hwkey_data(keycode);
 }
 
-static bool is_display_dirty = false;
-
-void set_display_dirty(bool dirty)
-{
-    LOG_TRACE("qemu display update: %d\n", is_display_dirty);
-    is_display_dirty = dirty;
-}
-
 bool msgproc_tethering_touch_msg(void *message)
 {
     bool ret = true;
@@ -229,11 +221,11 @@ bool msgproc_tethering_touch_msg(void *message)
     case TETHERING__TOUCH_MSG__TYPE__DISPLAY_MSG:
         LOG_TRACE("TOUCH_MSG_TYPE_DISPLAY_MSG\n");
 
-        if (is_display_dirty) {
+        if (is_display_dirty()) {
             LOG_TRACE("display dirty status!! send the image\n");
 
             send_display_image_data();
-            is_display_dirty = false;
+            set_display_dirty(false);
         }
         break;
 
index 251a68b9fe28821f5b303aeb40a8640c43e3e4b3..cb29c9b804655162e1ab5749edebf8e05bf60283 100644 (file)
@@ -38,5 +38,3 @@ bool msgproc_tethering_touch_msg(void *message);
 int get_tethering_touch_status(void);
 
 void set_tethering_touch_status(int status);
-
-void set_display_dirty(bool dirty);