From: Ronan Le Martret Date: Wed, 19 Feb 2014 08:55:39 +0000 (+0100) Subject: Fix build capi-media-player into pure Wayland profile. X-Git-Tag: accepted/tizen/generic/20140408.104738^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc46eba4ea63fa54ec87ec4ec787739407596ea8;p=platform%2Fcore%2Fapi%2Fplayer.git Fix build capi-media-player into pure Wayland profile. Change-Id: I58637d05300d7c8218ebcf80bb71d2277553eec0 Signed-off-by: Ronan Le Martret --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 274351e..4497476 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index b4a3be5..a4faa4d 100644 --- a/packaging/capi-media-player.spec +++ b/packaging/capi-media-player.spec @@ -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} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 461b088..1df3198 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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) diff --git a/test/player_test.c b/test/player_test.c index d4d28db..176c567 100644 --- a/test/player_test.c +++ b/test/player_test.c @@ -13,14 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + #include #include #include #include #include #include + +#ifdef HAVE_X11 #include +#endif +#ifdef HAVE_WAYLAND +#include +#include +#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);