Fix build capi-media-player into pure Wayland profile. 68/16568/3 accepted/tizen_3.0.2014.q3_common accepted/tizen_3.0.m14.3_ivi accepted/tizen_generic accepted/tizen_ivi_panda tizen_3.0.2014.q3_common tizen_3.0.m14.2_ivi tizen_3.0.m14.3_ivi accepted/tizen/generic/20140408.104738 accepted/tizen/ivi/20140409.182412 accepted/tizen/ivi/panda/20140408.203111 submit/tizen/20140408.104729 submit/tizen_common/20140521.232441 submit/tizen_common/20140522.140947 submit/tizen_mobile/20141120.000000 tizen_3.0.2014.q3_common_release tizen_3.0.m14.2_ivi_release tizen_3.0.m14.3_ivi_release
authorRonan Le Martret <ronan@fridu.net>
Wed, 19 Feb 2014 08:55:39 +0000 (09:55 +0100)
committerRonan Le Martret <ronan@fridu.net>
Thu, 3 Apr 2014 09:56:04 +0000 (11:56 +0200)
Change-Id: I58637d05300d7c8218ebcf80bb71d2277553eec0
Signed-off-by: Ronan Le Martret <ronan@fridu.net>
CMakeLists.txt
packaging/capi-media-player.spec
test/CMakeLists.txt
test/player_test.c

index 274351e..4497476 100644 (file)
@@ -26,6 +26,13 @@ IF("${ARCH}" STREQUAL "arm")
     ADD_DEFINITIONS("-DTARGET")
 ENDIF("${ARCH}" STREQUAL "arm")
 
+IF(WAYLAND_SUPPORT)
+ ADD_DEFINITIONS("-DHAVE_WAYLAND")
+ENDIF(WAYLAND_SUPPORT)
+IF(X11_SUPPORT)
+ ADD_DEFINITIONS("-DHAVE_X11")
+ENDIF(X11_SUPPORT)
+
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
 ADD_DEFINITIONS("-DTIZEN_DEBUG")
 
@@ -69,10 +76,10 @@ IF(UNIX)
 
 ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
 ADD_CUSTOM_COMMAND(
-        DEPENDS clean 
+        DEPENDS clean
         COMMENT "distribution clean"
         COMMAND find
-        ARGS    . 
+        ARGS    .
         -not -name config.cmake -and \(
         -name tester.c -or
         -name Testing -or
index b4a3be5..a4faa4d 100644 (file)
@@ -1,3 +1,6 @@
+%bcond_with wayland
+%bcond_with x
+
 Name:       capi-media-player
 Summary:    A Media Player library in Tizen Native API
 Version:    0.1.1
@@ -16,7 +19,12 @@ BuildRequires:  pkgconfig(appcore-efl)
 BuildRequires:  pkgconfig(elementary)
 BuildRequires:  pkgconfig(ecore)
 BuildRequires:  pkgconfig(evas)
+%if %{with x}
 BuildRequires:  pkgconfig(ecore-x)
+%endif
+%if %{with wayland}
+BuildRequires:  pkgconfig(ecore-wayland)
+%endif
 
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
@@ -40,7 +48,17 @@ cp %{SOURCE1001} .
 
 %build
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
+%if %{with wayland}
+         -DWAYLAND_SUPPORT=On \
+%else
+         -DWAYLAND_SUPPORT=Off \
+%endif
+%if %{with x}
+         -DX11_SUPPORT=On
+%else
+         -DX11_SUPPORT=Off
+%endif
 
 
 make %{?jobs:-j%jobs}
index 461b088..1df3198 100644 (file)
@@ -4,14 +4,30 @@ SET(fw_test "${fw_name}-test")
 INCLUDE_DIRECTORIES(../include)
 link_directories(${CMAKE_SOURCE_DIR}/../)
 
+IF(X11_SUPPORT)
+       SET(WIN_PKG "ecore-x")
+ENDIF(X11_SUPPORT)
+IF(WAYLAND_SUPPORT)
+       SET(WIN_PKG "${WIN_PKG} ecore-wayland")
+ENDIF(WAYLAND_SUPPORT)
 INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_test} REQUIRED mm-player appcore-efl elementary ecore evas ecore-x capi-media-sound-manager)
+pkg_check_modules(${fw_test} REQUIRED mm-player appcore-efl elementary ecore evas capi-media-sound-manager ${WIN_PKG})
+
+
 FOREACH(flag ${${fw_test}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
 
+IF(WAYLAND_SUPPORT)
+    ADD_DEFINITIONS("-DHAVE_WAYLAND")
+ENDIF(WAYLAND_SUPPORT)
+
+IF(X11_SUPPORT)
+    ADD_DEFINITIONS("-DHAVE_X11")
+ENDIF(X11_SUPPORT)
+
 aux_source_directory(. sources)
 FOREACH(src ${sources})
     GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
index d4d28db..176c567 100644 (file)
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
+
 #include <player.h>
 #include <pthread.h>
 #include <glib.h>
 #include <dlfcn.h>
 #include <appcore-efl.h>
 #include <Elementary.h>
+
+#ifdef HAVE_X11
 #include <Ecore_X.h>
+#endif
+#ifdef HAVE_WAYLAND
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#endif
+
 
 #define PACKAGE "player_test"
 #define MAX_STRING_LEN         2048
@@ -53,7 +61,11 @@ struct appdata
        Evas_Object *win;
 
        Evas_Object *layout_main; /* layout widget based on EDJ */
+       #ifdef HAVE_X11
        Ecore_X_Window xid;
+       #elif HAVE_WAYLAND
+       unsigned int xid;
+       #endif
        /* add more variables here */
 };
 
@@ -74,7 +86,22 @@ static Evas_Object* create_win(const char *name)
                                elm_win_title_set(eo, name);
                                elm_win_borderless_set(eo, EINA_TRUE);
                                evas_object_smart_callback_add(eo, "delete,request",win_del, NULL);
-                               ecore_x_window_size_get(ecore_x_window_root_first_get(),&w, &h);
+                               #ifdef HAVE_X11
+                               Ecore_X_Window xwin;
+                               xwin = elm_win_xwindow_get(eo);
+                               if (xwin != 0)
+                                 ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+                               else {
+                               #endif
+                               #ifdef HAVE_WAYLAND
+                               Ecore_Wl_Window *wlwin;
+                               wlwin = elm_win_wl_window_get(eo);
+                               if (wlwin != NULL)
+                               ecore_wl_screen_size_get(&w, &h);
+                               #endif
+                               #ifdef HAVE_X11
+                               }
+                               #endif
                                evas_object_resize(eo, w, h);
                }
 
@@ -89,8 +116,8 @@ static int app_create(void *data)
                win = create_win(PACKAGE);
                if (win == NULL)
                                return -1;
-               ad->win = win; 
-               evas_object_show(win); 
+               ad->win = win;
+               evas_object_show(win);
                return 0;
 }
 
@@ -227,11 +254,17 @@ static void _player_prepare(bool async)
                player_set_subtitle_path(g_player,g_subtitle_uri);
                player_set_subtitle_updated_cb(g_player, subtitle_updated_cb, (void*)g_player);
        }
+       #ifdef HAVE_X11
        player_set_display(g_player,PLAYER_DISPLAY_TYPE_X11,GET_DISPLAY(ad.xid));
+       #elif HAVE_WAYLAND
+       player_set_display(g_player,PLAYER_DISPLAY_TYPE_EVAS,GET_DISPLAY(ad.xid));
+       #endif
+
+
        player_set_buffering_cb(g_player, buffering_cb, (void*)g_player);
        player_set_completed_cb(g_player, completed_cb, (void*)g_player);
        player_set_uri(g_player, g_uri);
-       
+
        if ( async )
        {
                ret = player_prepare_async(g_player, prepared_cb, (void*) g_player);