Add wayland feature 48/38048/2 accepted/tizen/common/20150414.100130 accepted/tizen/mobile/20150415.015046 accepted/tizen/tv/20150415.012611 accepted/tizen/wearable/20150415.013826 submit/tizen/20150414.023516
authorHyunil Park <hyunil46.park@samsung.com>
Fri, 10 Apr 2015 07:38:54 +0000 (16:38 +0900)
committerHyunil Park <hyunil46.park@samsung.com>
Mon, 13 Apr 2015 08:03:25 +0000 (17:03 +0900)
  1. setting wayland display by gst_wayland_display_handle_context_new()
  2. setting wayland surface by video_overlay_set_window_handle()
  3. setting window render rectangle by gst_video_overlay_set_render_rectangle()

Change-Id: Ia43d6ca5102ee7e938a6f0052ecbd73a621660b8
Signed-off-by: Hyunil Park <hyunil46.park@samsung.com>
configure.ac
packaging/libmm-player.spec [changed mode: 0644->0755]
src/Makefile.am [changed mode: 0644->0755]
src/mm_player_attrs.c
src/mm_player_priv.c

index e25a4fc..9df2ed4 100755 (executable)
@@ -61,6 +61,21 @@ PKG_CHECK_MODULES(GST_PLUGIN_BASE, gstreamer-plugins-base-1.0 >= 1.2.0)
 AC_SUBST(GST_PLUGIN_BASE_CFLAGS)
 AC_SUBST(GST_PLUGIN_BASE_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(GST_VIDEO, gstreamer-video-1.0 >= 1.2.0)
 AC_SUBST(GST_VIDEO_CFLAGS)
 AC_SUBST(GST_VIDEO_LIBS)
old mode 100644 (file)
new mode 100755 (executable)
index 41eb3a0..fea0808
@@ -1,7 +1,10 @@
+%bcond_with wayland
+%bcond_with x
+
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
 Version:    0.5.56
-Release:    1
+Release:    2
 Group:      Multimedia/Libraries
 License:    Apache-2.0
 URL:        http://source.tizen.org
@@ -13,6 +16,9 @@ BuildRequires:  pkgconfig(mm-common)
 BuildRequires:  pkgconfig(mm-sound)
 BuildRequires:  pkgconfig(gstreamer-1.0)
 BuildRequires:  pkgconfig(gstreamer-plugins-base-1.0)
+%if %{with wayland}
+BuildRequires:  pkgconfig(gstreamer-wayland-1.0)
+%endif
 BuildRequires:  pkgconfig(gstreamer-video-1.0)
 BuildRequires:  pkgconfig(gstreamer-app-1.0)
 BuildRequires:  pkgconfig(appcore-efl)
@@ -39,12 +45,24 @@ Multimedia Framework Player Library files (DEV).
 cp %{SOURCE1001} .
 
 %build
-CFLAGS+="  -Wall -D_FILE_OFFSET_BITS=64 -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" "; export CFLAGS
+%if %{with x}
+CFLAGS+="  -Wall -D_FILE_OFFSET_BITS=64 -DHAVE_X11 -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" "; export CFLAGS
+%endif
+%if %{with wayland}
+CFLAGS+="  -Wall -D_FILE_OFFSET_BITS=64 -DHAVE_WAYLAND -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" "; export CFLAGS
+%endif
 LDFLAGS+="-Wl,--rpath=%{_prefix}/lib -Wl,--hash-style=both -Wl,--as-needed"; export LDFLAGS
 ./autogen.sh
 # always enable sdk build. This option should go away
 CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS ./configure --enable-sdk --prefix=%{_prefix} --disable-static
-%configure --disable-static
+%configure \
+%if %{with x}
+--disable-static
+%endif
+%if %{with wayland}
+--disable-static \
+--enable-wayland
+%endif
 #%__make -j1
 make %{?jobs:-j%jobs}
 
old mode 100644 (file)
new mode 100755 (executable)
index ea6084b..f60a38f
@@ -53,3 +53,8 @@ libmmfplayer_la_LIBADD += $(MMLOG_LIBS)
 if IS_SDK
 libmmfplayer_la_CFLAGS += -DIS_SDK
 endif
+
+if WAYLAND_SUPPORT
+libmmfplayer_la_CFLAGS += $(GST_WAYLAND_CFLAGS)
+libmmfplayer_la_LIBADD += $(GST_WAYLAND_LIBS)
+endif
index c7cb67c..7cd8867 100755 (executable)
@@ -718,6 +718,53 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        0,
                        0
                },
+#ifdef HAVE_WAYLAND
+               {
+                       "wl_display",
+                       MM_ATTRS_TYPE_DATA,
+                       MM_ATTRS_FLAG_RW,
+                       (void *) NULL,
+                       MM_ATTRS_VALID_TYPE_NONE,
+                       0,
+                       0
+               },
+               {
+                       "wl_window_render_x",
+                       MM_ATTRS_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       (void *) 0,
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       0,
+                       MMPLAYER_MAX_INT
+               },
+               {
+                       "wl_window_render_y",
+                       MM_ATTRS_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       (void *) 0,
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       0,
+                       MMPLAYER_MAX_INT
+               },
+               {
+                       "wl_window_render_width",
+                       MM_ATTRS_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       (void *) 0,
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       0,
+                       MMPLAYER_MAX_INT
+               },
+               {
+                       "wl_window_render_height",
+                       MM_ATTRS_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       (void *) 0,
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       0,
+                       MMPLAYER_MAX_INT
+               },
+#endif
                {
                        "display_overlay_user_data",
                        MM_ATTRS_TYPE_DATA,
index a97b693..0d8eb06 100755 (executable)
@@ -29,6 +29,9 @@
 #include <gst/gst.h>
 #include <gst/app/gstappsrc.h>
 #include <gst/video/videooverlay.h>
+#ifdef HAVE_WAYLAND
+#include <gst/wayland/wayland.h>
+#endif
 #include <unistd.h>
 #include <sys/stat.h>
 #include <string.h>
@@ -4628,7 +4631,7 @@ _mmplayer_update_video_param(mm_player_t* player) // @
                case MM_DISPLAY_SURFACE_X:
                {
                        /* ximagesink or xvimagesink */
-                       void *xid = NULL;
+                       void *surface = NULL;
                        double zoom = 0;
                        int display_method = 0;
                        int roi_x = 0;
@@ -4642,17 +4645,52 @@ _mmplayer_update_video_param(mm_player_t* player) // @
                        int force_aspect_ratio = 0;
                        gboolean visible = TRUE;
 
+#ifdef HAVE_WAYLAND
+                       /*set wl_display*/
+                       void* wl_display = NULL;
+                       GstContext *context = NULL;
+                       int wl_window_x = 0;
+                       int wl_window_y = 0;
+                       int wl_window_width = 0;
+                       int wl_window_height = 0;
+
+                       mm_attrs_get_data_by_name(attrs, "wl_display", &wl_display);
+                       if (wl_display)
+                               context = gst_wayland_display_handle_context_new(wl_display);
+                       if (context)
+                               gst_element_set_context(GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_SINK].gst), context);
+
+                       /*It should be set after setting window*/
+                       mm_attrs_get_int_by_name(attrs, "wl_window_render_x", &wl_window_x);
+                       mm_attrs_get_int_by_name(attrs, "wl_window_render_y", &wl_window_y);
+                       mm_attrs_get_int_by_name(attrs, "wl_window_render_width", &wl_window_width);
+                       mm_attrs_get_int_by_name(attrs, "wl_window_render_height", &wl_window_height);
+#endif
                        /* common case if using x surface */
-                       mm_attrs_get_data_by_name(attrs, "display_overlay", &xid);
-                       if ( xid )
+                       mm_attrs_get_data_by_name(attrs, "display_overlay", &surface);
+                       if ( surface )
                        {
+#ifdef HAVE_WAYLAND
+                               int wl_surface = 0;
+                               wl_surface = (int*)surface;
+                               debug_log("set video param : xid %p", (int*)surface);
+                               if (wl_surface)
+                               {
+                                       gst_video_overlay_set_window_handle( GST_VIDEO_OVERLAY( player->pipeline->videobin[MMPLAYER_V_SINK].gst ), (int*)surface );
+                                       /* After setting window handle, set render      rectangle */
+                                       gst_video_overlay_set_render_rectangle(
+                                                GST_VIDEO_OVERLAY( player->pipeline->videobin[MMPLAYER_V_SINK].gst ),
+                                                wl_window_x,wl_window_y,wl_window_width,wl_window_height);
+                               }
+#else // HAVE_X11
                                int xwin_id = 0;
-                               xwin_id = *(int*)xid;
-                               debug_log("set video param : xid %d", *(int*)xid);
+                               xwin_id = *(int*)surface;
+                               debug_log("set video param : xid %p", *(int*)surface);
                                if (xwin_id)
                                {
-                                       gst_video_overlay_set_window_handle( GST_VIDEO_OVERLAY( player->pipeline->videobin[MMPLAYER_V_SINK].gst ), *(int*)xid );
+                                       gst_video_overlay_set_window_handle( GST_VIDEO_OVERLAY( player->pipeline->videobin[MMPLAYER_V_SINK].gst ), *(int*)surface );
                                }
+#endif
                        }
                        else
                        {