Remove Profile Build Dependency: Do it at runtime 37/97437/4
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 14 Nov 2016 07:28:49 +0000 (16:28 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 16 Jan 2017 12:13:14 +0000 (04:13 -0800)
- This is for Tizen 4.0.

  : Tizen 4.0 Configurability and Build Blocks require
  to remove all profile-depending build options in spec files.
  (No More profile macros)

- It is recommended to distinguish features/profiles at runtime.
 unless it incurs too much overhead, which requires you to
 create multiple binaries and subpackages.

Change-Id: Iad4bd14dc3bdecdf1b5b9814969223aacc260402
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
configure.ac
packaging/libmm-player.spec
src/Makefile.am
src/mm_player_priv.c

index b2a745d..89c923d 100644 (file)
@@ -133,6 +133,10 @@ PKG_CHECK_MODULES(DLOG, dlog)
 AC_SUBST(DLOG_CFLAGS)
 AC_SUBST(DLOG_LIBS)
 
+PKG_CHECK_MODULES(SYSTEMINFO, capi-system-info)
+AC_SUBST(SYSTEMINFO_CFLAGS)
+AC_SUBST(SYSTEMINFO_LIBS)
+
 AC_ARG_ENABLE(sdk, AC_HELP_STRING([--enable-sdk], [sdk build]),
         [
                case "${enableval}" in
index 5e73f39..4fb0439 100644 (file)
@@ -27,6 +27,7 @@ BuildRequires:  pkgconfig(icu-i18n)
 BuildRequires:  pkgconfig(capi-media-tool)
 BuildRequires:  pkgconfig(murphy-resource)
 BuildRequires:  pkgconfig(murphy-glib)
+BuildRequires:  pkgconfig(capi-system-info)
 
 %description
 Multimedia Framework Player Library files.
@@ -48,9 +49,6 @@ export CFLAGS+=" -Wall -DTIZEN_DEBUG -D_FILE_OFFSET_BITS=64 -DSYSCONFDIR=\\\"%{_
 %if %{with x}
 export CFLAGS+=" -DHAVE_X11"
 %endif
-%if "%{?profile}" == "tv"
-export CFLAGS+=" -DTIZEN_TV"
-%endif
 
 LDFLAGS+="-Wl,--rpath=%{_prefix}/lib -Wl,--hash-style=both -Wl,--as-needed"; export LDFLAGS
 ./autogen.sh
index 8314d5e..b2d775c 100644 (file)
@@ -38,6 +38,7 @@ libmmfplayer_la_CFLAGS =  -I$(srcdir)/include \
                        $(DLOG_CFLAGS) \
                        $(EVAS_CFLAGS) \
                        $(ECORE_CFLAGS) \
+                       $(SYSTEMINFO_CFLAGS) \
                        -Werror -Wno-deprecated -Wno-deprecated-declarations -Wno-cpp
 
 noinst_HEADERS = include/mm_player_utils.h \
@@ -68,7 +69,8 @@ libmmfplayer_la_LIBADD = $(GST_LIBS) \
                $(DLOG_LIBS) \
                $(UTILX_LIBS) \
                $(EVAS_LIBS) \
-               $(ECORE_LIBS)
+               $(ECORE_LIBS) \
+               $(SYSTEMINFO_LIBS)
 
 
 if IS_SDK
@@ -78,4 +80,4 @@ endif
 if WAYLAND_SUPPORT
 libmmfplayer_la_CFLAGS += $(GST_WAYLAND_CFLAGS)
 libmmfplayer_la_LIBADD += $(GST_WAYLAND_LIBS)
-endif
\ No newline at end of file
+endif
index bec94d9..a30f508 100644 (file)
@@ -51,6 +51,8 @@
 #include "mm_player_utils.h"
 #include "mm_player_tracks.h"
 
+#include <system_info.h>
+
 /*===========================================================================================
 |                                                                                                                                                                                      |
 |  LOCAL DEFINITIONS AND DECLARATIONS FOR MODULE                                                                                       |
@@ -11066,6 +11068,7 @@ __mmplayer_verify_next_play_path(mm_player_t *player)
        gint count = 0;
        gint gapless = 0;
        guint num_of_list = 0;
+       static int profile_tv = -1;
 
        MMPLAYER_FENTER();
 
@@ -11084,13 +11087,24 @@ __mmplayer_verify_next_play_path(mm_player_t *player)
 
        mm_attrs_get_int_by_name(attrs, "content_video_found", &video);
 
-#ifdef TIZEN_TV
+       if (__builtin_expect(profile_tv == -1, 0)) {
+               char *profileName;
+               system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+               switch (*profileName) {
+                       case 't':
+                       case 'T':
+                               profile_tv = 1;
+                               break;
+                       default:
+                               profile_tv = 0;
+               }
+               free(profileName);
+       }
        /* gapless playback is not supported in case of video at TV profile. */
-       if (video) {
+       if (profile_tv && video) {
                LOGW("not support video gapless playback");
                goto ERROR;
        }
-#endif
 
        if (mm_attrs_get_int_by_name(attrs, "pd_mode", &mode) == MM_ERROR_NONE) {
                if (mode == TRUE) {