Support waylandsink 74/38574/2 submit/tizen/20150430.023919 submit/tizen_common/20150505.090000
authorJeongmo Yang <jm80.yang@samsung.com>
Wed, 22 Apr 2015 08:05:40 +0000 (17:05 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Fri, 24 Apr 2015 07:56:58 +0000 (16:56 +0900)
Change-Id: Ibe87620b9a84a8adcddf5fb14831e032b5e305e5
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
configure.ac
packaging/libmm-camcorder.spec
src/Makefile.am
src/include/mm_camcorder.h
src/mm_camcorder_attribute.c
src/mm_camcorder_gstcommon.c

index 24b79a2282fa7053092c0643b1f674b30c463633..3d7fb36462ecb8d5b3f906e2b44893bc19caaca4 100644 (file)
@@ -39,6 +39,21 @@ PKG_CHECK_MODULES(GST_APP, gstreamer-app-1.0 >= 1.2.0)
 AC_SUBST(GST_APP_CFLAGS)
 AC_SUBST(GST_APP_LIBS)
 
+AC_ARG_ENABLE(wayland, AC_HELP_STRING([--enable-wayland], [enable wayland]),
+[
+  case "${enableval}" in
+    yes) WAYLAND_SUPPORT=yes ;;
+    no)  WAYLAND_SUPPORT=no ;;
+    *) AC_MSG_ERROR(bad value ${enableval} for --enable-wayland) ;;
+  esac
+],[WAYLAND_SUPPORT=no])
+if test "x$WAYLAND_SUPPORT" = "xyes"; then
+PKG_CHECK_MODULES(GST_WAYLAND, gstreamer-wayland-1.0 >= 1.2.0)
+AC_SUBST(GST_WAYLAND_CFLAGS)
+AC_SUBST(GST_WAYLAND_LIBS)
+fi
+AM_CONDITIONAL([WAYLAND_SUPPORT], [test "x$WAYLAND_SUPPORT" = "xyes"])
+
 PKG_CHECK_MODULES(MM_COMMON, mm-common)
 AC_SUBST(MM_COMMON_CFLAGS)
 AC_SUBST(MM_COMMON_LIBS)
index 01451b7f9431fa1df4c90e0015eedea9d3b9e34c..f9eb0352797e1811c291486a735260913afdac49 100644 (file)
@@ -1,7 +1,9 @@
+%bcond_with wayland
+
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    0.9.3
-Release:    1
+Version:    0.9.4
+Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
@@ -15,6 +17,10 @@ BuildRequires:  pkgconfig(libexif)
 BuildRequires:  pkgconfig(mmutil-imgp)
 BuildRequires:  pkgconfig(mm-log)
 BuildRequires:  pkgconfig(gstreamer-base-1.0)
+%if %{with wayland}
+BuildRequires:  pkgconfig(gstreamer-wayland-1.0)
+BuildRequires:  pkgconfig(wayland-client)
+%endif
 BuildRequires:  pkgconfig(sndfile)
 BuildRequires:  pkgconfig(camsrcjpegenc)
 BuildRequires:  pkgconfig(libpulse)
@@ -41,8 +47,15 @@ Camera and recorder development library.
 
 
 %build
+%if %{with wayland}
+export CFLAGS+=" -DHAVE_WAYLAND"
+%endif
 ./autogen.sh
-%configure --disable-static
+%configure \
+%if %{with wayland}
+       --enable-wayland \
+%endif
+       --disable-static
 make %{?jobs:-j%jobs}
 
 %install
index 740e536cb80f8a5c8db6b5fa2145fd66770c71cd..78a5c8f153e87639291f0adea3ade99b7d6c5eb9 100644 (file)
@@ -65,6 +65,11 @@ libmmfcamcorder_la_CFLAGS += -DMMF_LOG_OWNER=0x010 -D_FILE_OFFSET_BITS=64
 libmmfcamcorder_la_CFLAGS += -fdata-sections -ffunction-sections -Wl,--gc-sections
 libmmfcamcorder_la_LIBADD += $(SYSTEMINFO_LIBS)
 
+if WAYLAND_SUPPORT
+libmmfcamcorder_la_CFLAGS += $(GST_WAYLAND_CFLAGS)
+libmmfcamcorder_la_LIBADD += $(GST_WAYLAND_LIBS)
+endif
+
 install-exec-hook:
                                        mkdir -p $(DESTDIR)$(prefix)/share/sounds/mm-camcorder && \
                                        cp $(srcdir)/../sounds/* $(DESTDIR)$(prefix)/share/sounds/mm-camcorder/
index 1d4b4c35a6ae6047e46f920a41910a8e4e028580..528de76dd311a7fdaf41deab606c9cf652bad9bc 100644 (file)
@@ -1756,6 +1756,21 @@ typedef struct _MMCamFaceDetectInfo {
        MMCamFaceInfo *face_info;               /**< face information, this should be freed after use it. */
 } MMCamFaceDetectInfo;
 
+#ifdef HAVE_WAYLAND
+/**
+ * Wayland information
+ */
+typedef struct _MMCamWaylandInfo {
+       void *evas_obj;
+       void *window;
+       void *surface;
+       void *display;
+       int window_x;
+       int window_y;
+       int window_width;
+       int window_height;
+} MMCamWaylandInfo;
+#endif /* HAVE_WAYLAND */
 
 /*=======================================================================================
 | TYPE DEFINITIONS                                                                     |
index 3dec59546df3dd789d3c1e5cb66bd8a5b599cc49..849f88d29720d07d4d63b2755805ca310121860a 100644 (file)
@@ -29,6 +29,9 @@
 #include <gst/video/colorbalance.h>
 #include <gst/video/cameracontrol.h>
 #include <gst/video/videooverlay.h>
+#ifdef HAVE_WAYLAND
+#include <gst/wayland/wayland.h>
+#endif
 
 /*-----------------------------------------------------------------------
 |    MACRO DEFINITIONS:                                                        |
@@ -3050,6 +3053,25 @@ bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const
                           !strcmp(videosink_name, "evaspixmapsink")) {
                        _mmcam_dbg_log("Commit : Set evas object [%p]", p_handle);
                        MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "evas-object", p_handle);
+#ifdef HAVE_WAYLAND
+               } else if (!strcmp(videosink_name, "waylandsink")) {
+                       MMCamWaylandInfo *wl_info = (MMCamWaylandInfo *)p_handle;
+                       GstContext *context = NULL;
+
+                       context = gst_wayland_display_handle_context_new((struct wl_display *)wl_info->display);
+                       if (context) {
+                               gst_element_set_context(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), context);
+                       } else {
+                               _mmcam_dbg_warn("gst_wayland_display_handle_context_new failed");
+                       }
+
+                       gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), (guintptr)wl_info->surface);
+                       gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst),
+                                                              wl_info->window_x,
+                                                              wl_info->window_y,
+                                                              wl_info->window_width,
+                                                              wl_info->window_height);
+#endif /* HAVE_WAYLAND */
                } else {
                        _mmcam_dbg_warn("Commit : Nothing to commit with this element[%s]", videosink_name);
                        return FALSE;
index 1f24b65547e054b6c197db155fb883068522c54a..cb29fa5ae6d3e804ddf36fdb1a4b3bffcbfde8fb 100644 (file)
 #include <gst/audio/audio-format.h>
 #include <gst/video/videooverlay.h>
 #include <gst/video/cameracontrol.h>
+#ifdef HAVE_WAYLAND
+#include <gst/wayland/wayland.h>
+#endif
+
 #include <sys/time.h>
 #include <unistd.h>
 
@@ -1220,6 +1224,29 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi
                        _mmcam_dbg_err("display handle(eavs object) is NULL");
                        return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
                }
+#ifdef HAVE_WAYLAND
+       } else if (!strcmp(videosink_name, "waylandsink")) {
+               MMCamWaylandInfo *wl_info = (MMCamWaylandInfo *)overlay;
+               if (wl_info) {
+                       GstContext *context = NULL;
+
+                       context = gst_wayland_display_handle_context_new((struct wl_display *)wl_info->display);
+                       if (context) {
+                               gst_element_set_context(vsink, context);
+                       } else {
+                               _mmcam_dbg_warn("gst_wayland_display_handle_context_new failed");
+                       }
+
+                       gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(vsink), (guintptr)wl_info->surface);
+                       gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(vsink),
+                                                              wl_info->window_x,
+                                                              wl_info->window_y,
+                                                              wl_info->window_width,
+                                                              wl_info->window_height);
+               } else {
+                       _mmcam_dbg_warn("Handle is NULL. skip setting.");
+               }
+#endif /* HAVE_WAYLAND */
        } else {
                _mmcam_dbg_warn("Who are you?? (Videosink: %s)", videosink_name);
        }