[waylandsink] Add tizne subsurface protocol
authorHyunil Park <hyunil46.park@samsung.com>
Wed, 20 May 2015 08:58:11 +0000 (17:58 +0900)
committerHyunil Park <hyunil46.park@samsung.com>
Wed, 20 May 2015 08:58:11 +0000 (17:58 +0900)
1. video subsurface place under UI subsurface

Change-Id: I0f74a62acd06537242c6a36c0bc9a6220cb0795f
Signed-off-by: Hyunil Park <hyunil46.park@samsung.com>
ext/wayland/Makefile.am
ext/wayland/tizen-subsurfaceprotocol.c [new file with mode: 0644]
ext/wayland/tizen-subsurfaceprotocol.h [new file with mode: 0755]
ext/wayland/wldisplay.c
ext/wayland/wldisplay.h
ext/wayland/wlwindow.c
packaging/gst-plugins-bad.spec

index 58c1e99..6116fff 100644 (file)
@@ -6,7 +6,8 @@ libgstwaylandsink_la_SOURCES =  \
        wldisplay.c \
        wlwindow.c \
        wlvideoformat.c \
-       scaler-protocol.c
+       scaler-protocol.c \
+       tizen-subsurfaceprotocol.c
 
 libgstwaylandsink_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
                                $(WAYLAND_CFLAGS) $(GST_PLUGINS_BAD_CFLAGS)
@@ -24,7 +25,8 @@ noinst_HEADERS = \
        wldisplay.h \
        wlwindow.h \
        wlvideoformat.h \
-       scaler-client-protocol.h
+       scaler-client-protocol.h \
+       tizen-subsurfaceprotocol.h
 
 EXTRA_DIST = scaler.xml
 CLEANFILES = scaler-protocol.c scaler-client-protocol.h
diff --git a/ext/wayland/tizen-subsurfaceprotocol.c b/ext/wayland/tizen-subsurfaceprotocol.c
new file mode 100644 (file)
index 0000000..07cd295
--- /dev/null
@@ -0,0 +1,19 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include "wayland-util.h"
+
+extern const struct wl_interface wl_subsurface_interface;
+
+static const struct wl_interface *types[] = {
+  &wl_subsurface_interface,
+};
+
+static const struct wl_message tizen_subsurface_requests[] = {
+  {"place_below_parent", "o", types + 0},
+};
+
+WL_EXPORT const struct wl_interface tizen_subsurface_interface = {
+  "tizen_subsurface", 1,
+  1, tizen_subsurface_requests,
+  0, NULL,
+};
diff --git a/ext/wayland/tizen-subsurfaceprotocol.h b/ext/wayland/tizen-subsurfaceprotocol.h
new file mode 100755 (executable)
index 0000000..0f83061
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef TIZEN_SUBSURFACEPROTOCOL_H
+#define TIZEN_SUBSURFACEPROTOCOL_H
+
+#ifdef  __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-client.h"
+
+  struct wl_client;
+  struct wl_resource;
+
+  struct tizen_subsurface;
+
+  extern const struct wl_interface tizen_subsurface_interface;
+
+#define TIZEN_SUBSURFACE_PLACE_BELOW_PARENT    0
+
+  static inline void
+      tizen_subsurface_set_user_data (struct tizen_subsurface *tizen_subsurface,
+      void *user_data)
+  {
+    wl_proxy_set_user_data ((struct wl_proxy *) tizen_subsurface, user_data);
+  }
+
+  static inline void *tizen_subsurface_get_user_data (struct tizen_subsurface
+      *tizen_subsurface)
+  {
+    return wl_proxy_get_user_data ((struct wl_proxy *) tizen_subsurface);
+  }
+
+  static inline void
+      tizen_subsurface_destroy (struct tizen_subsurface *tizen_subsurface)
+  {
+    wl_proxy_destroy ((struct wl_proxy *) tizen_subsurface);
+  }
+
+  static inline void
+      tizen_subsurface_place_below_parent (struct tizen_subsurface
+      *tizen_subsurface, struct wl_subsurface *subsurface)
+  {
+    wl_proxy_marshal ((struct wl_proxy *) tizen_subsurface,
+        TIZEN_SUBSURFACE_PLACE_BELOW_PARENT, subsurface);
+  }
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif
index 515951d..c812b86 100755 (executable)
@@ -64,7 +64,10 @@ gst_wl_display_finalize (GObject * gobject)
 
   g_array_unref (self->formats);
   gst_poll_free (self->wl_fd_poll);
-
+#ifdef GST_ENHANCEMENT
+  if (self->tz_subsurface)
+    tizen_subsurface_destroy (self->tz_subsurface);
+#endif
   if (self->shm)
     wl_shm_destroy (self->shm);
 
@@ -161,7 +164,11 @@ registry_handle_global (void *data, struct wl_registry *registry,
     wl_shm_add_listener (self->shm, &shm_listener, self);
   } else if (g_strcmp0 (interface, "wl_scaler") == 0) {
     self->scaler = wl_registry_bind (registry, id, &wl_scaler_interface, 2);
+#ifdef GST_ENHANCEMENT
+  } else if (g_strcmp0 (interface, "tizen_subsurface") == 0) {
+    self->tz_subsurface = wl_registry_bind (registry, id, &tizen_subsurface_interface, 1);
   }
+#endif
 }
 
 static const struct wl_registry_listener registry_listener = {
index 83b64c1..c98c801 100755 (executable)
@@ -24,7 +24,9 @@
 #include <gst/gst.h>
 #include <wayland-client.h>
 #include "scaler-client-protocol.h"
-
+#ifdef GST_ENHANCEMENT
+#include "tizen-subsurfaceprotocol.h"
+#endif
 G_BEGIN_DECLS
 #define GST_TYPE_WL_DISPLAY                  (gst_wl_display_get_type ())
 #define GST_WL_DISPLAY(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_DISPLAY, GstWlDisplay))
@@ -55,6 +57,9 @@ struct _GstWlDisplay
   struct wl_shell *shell;
   struct wl_shm *shm;
   struct wl_scaler *scaler;
+#ifdef GST_ENHANCEMENT
+  struct tizen_subsurface *tz_subsurface;
+#endif
   GArray *formats;
 
   /* private */
index cb92409..5c1822f 100755 (executable)
@@ -174,7 +174,12 @@ gst_wl_window_new_in_surface (GstWlDisplay * display,
   window->subsurface = wl_subcompositor_get_subsurface (display->subcompositor,
       window->surface, parent);
   wl_subsurface_set_desync (window->subsurface);
+#ifdef GST_ENHANCEMENT
+  if (display->tz_subsurface)
+    tizen_subsurface_place_below_parent (display->tz_subsurface, window->subsurface);
 
+  wl_surface_commit (parent);
+#endif
   return window;
 }
 
index 054e3be..a0947ad 100644 (file)
@@ -4,7 +4,7 @@
 
 Name:           gst-plugins-bad
 Version:        1.4.1
-Release:        2
+Release:        3
 Summary:        GStreamer Streaming-Media Framework Plug-Ins
 License:        GPL-2.0+ and LGPL-2.1+
 Group:          Multimedia/Framework
@@ -68,6 +68,7 @@ processing capabilities can be added simply by installing new plug-ins.
 %build
 export V=1
 NOCONFIGURE=1 ./autogen.sh
+export CFLAGS="-DGST_ENHANCEMENT"
 %configure\
     --disable-static\
     --disable-examples\