Modify branching regarding USE_FOCUS definition 27/87927/3
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 12 Sep 2016 07:01:22 +0000 (16:01 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 12 Sep 2016 07:42:56 +0000 (16:42 +0900)
[Version] 0.10.51
[Profile] Common
[Issue Type] CleanUp

Change-Id: I1b483d8ffad036e2f887d64a1001330905ee7d36

Makefile.am
focus_server/mm_sound_mgr_focus_ipc.c
include/mm_sound_proxy.h
mm_sound_client.c
mm_sound_proxy.c
packaging/libmm-sound.spec
testsuite/mm_sound_testsuite_simple.c

index 00f4cf7..6498203 100644 (file)
@@ -2,8 +2,11 @@ SUBDIRS = common \
                pkgconfig \
                . \
                server \
-               testsuite \
-               focus_server
+               testsuite
+
+if USE_FOCUS
+SUBDIRS += focus_server
+endif
 
 lib_LTLIBRARIES = libmmfsound.la
 
@@ -11,7 +14,6 @@ includelibmmfsounddir = $(includedir)/mmf
 includelibmmfsound_HEADERS = include/mm_sound.h \
                                                        include/mm_sound_private.h \
                                                        include/mm_sound_pa_client.h \
-                                                       include/mm_sound_focus.h \
                                                        include/mm_sound_device.h
 
 libmmfsound_la_SOURCES = mm_sound.c \
@@ -20,6 +22,7 @@ libmmfsound_la_SOURCES = mm_sound.c \
                        mm_sound_device.c \
                        mm_sound_pa_client.c
 if USE_FOCUS
+includelibmmfsound_HEADERS += include/mm_sound_focus.h
 libmmfsound_la_SOURCES += mm_sound_focus.c
 endif
 
@@ -57,10 +60,9 @@ libmmfsound_la_LDFLAGS = -version-info 1:0:1
 libmmfsound_la_CFLAGS += $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x020 -DMMF_DEBUG_PREFIX=\"MMF-SOUND\"
 libmmfsound_la_LIBADD += $(MMLOGSVR_LIBS)
 
-
-
-
-
+if USE_FOCUS
+libmmfsound_la_CFLAGS += -DUSE_FOCUS
+endif
 
 
 lib_LTLIBRARIES += libmmfkeysound.la
index 4b42c93..c062364 100644 (file)
@@ -29,8 +29,6 @@
 #include "include/mm_sound_mgr_focus.h"
 #include <mm_debug.h>
 
-#ifdef USE_FOCUS
-
 int __mm_sound_mgr_focus_ipc_register_focus(int client_pid, int handle_id, const char* stream_type, bool is_for_session)
 {
        _mm_sound_mgr_focus_param_t param;
@@ -175,5 +173,4 @@ int __mm_sound_mgr_focus_ipc_emergent_exit(int pid)
 
        return ret;
 }
-#endif
 
index fdbbb27..898437e 100644 (file)
@@ -61,6 +61,7 @@ int mm_sound_proxy_remove_device_info_changed_callback(unsigned subs_id);
 int mm_sound_proxy_set_volume_by_type(const char *volume_type, const unsigned volume_level);
 int mm_sound_proxy_add_volume_changed_callback(mm_sound_volume_changed_wrapper_cb func, void* userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id);
 int mm_sound_proxy_remove_volume_changed_callback(unsigned subs_id);
+int mm_sound_proxy_emergent_exit(int exit_pid);
 
 #ifdef USE_FOCUS
 int mm_sound_proxy_get_unique_id(int *id);
@@ -72,7 +73,6 @@ int mm_sound_proxy_acquire_focus(int instance, int id, mm_sound_focus_type_e typ
 int mm_sound_proxy_release_focus(int instance, int id, mm_sound_focus_type_e type, const char *option, bool is_for_session);
 int mm_sound_proxy_set_focus_watch_callback(int instance, int handle, mm_sound_focus_type_e type, mm_sound_focus_changed_watch_cb callback, bool is_for_session, void *user_data);
 int mm_sound_proxy_unset_focus_watch_callback(int focus_tid, int handle, bool is_for_session);
-int mm_sound_proxy_emergent_exit(int exit_pid);
 #endif
 
 int mm_sound_proxy_add_test_callback(mm_sound_test_cb func, void *userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id);
index 924f34d..8f772c1 100644 (file)
@@ -80,7 +80,7 @@ struct callback_data {
                _cb_data->extra_data = _extradata; \
        } while (0)
 
-
+#ifdef USE_FOCUS
 typedef struct {
        int focus_tid;
        int handle;
@@ -112,13 +112,6 @@ typedef struct {
        void* user_data;
 } focus_session_interrupt_info_t;
 
-typedef struct {
-       /* handle to watch end of playing */
-       int watching_handle;
-       /* subscription id to unsubscribe when handle ended */
-       unsigned subs_id;
-} play_sound_end_callback_data_t;
-
 typedef gboolean (*focus_gLoopPollHandler_t)(gpointer d);
 
 GThread *g_focus_thread;
@@ -126,10 +119,18 @@ GMainLoop *g_focus_loop;
 focus_sound_info_t g_focus_sound_handle[FOCUS_HANDLE_MAX];
 focus_session_interrupt_info_t g_focus_session_interrupt_info = {NULL, NULL};
 static pthread_mutex_t g_index_mutex = PTHREAD_MUTEX_INITIALIZER;
-
 guint g_focus_signal_handle = 0;
+#endif
+
 gboolean g_need_emergent_exit = FALSE;
 
+typedef struct {
+       /* handle to watch end of playing */
+       int watching_handle;
+       /* subscription id to unsubscribe when handle ended */
+       unsigned subs_id;
+} play_sound_end_callback_data_t;
+
 void _system_signal_handler(int signo)
 {
        int ret = MM_ERROR_NONE;
@@ -289,7 +290,7 @@ void mm_sound_convert_volume_type_to_stream_type(int volume_type, char *stream_t
 /*****************************************************************************************
                            DBUS SUPPORTED FUNCTIONS
 ******************************************************************************************/
-
+#ifdef USE_FOCUS
 void _mm_sound_client_focus_signal_callback(mm_sound_signal_name_t signal, int value, void *user_data)
 {
        int ret = MM_ERROR_NONE;
@@ -305,6 +306,7 @@ void _mm_sound_client_focus_signal_callback(mm_sound_signal_name_t signal, int v
                g_focus_signal_handle = 0;
        }
 }
+#endif
 
 int mm_sound_client_play_tone(int number, int volume_config, double volume, int time, int *handle, bool enable_session)
 {
@@ -351,7 +353,7 @@ int mm_sound_client_play_tone(int number, int volume_config, double volume, int
        mm_sound_convert_volume_type_to_stream_type(volume_type, stream_type);
        ret = mm_sound_proxy_play_tone(number, time, volume, volume_config,
                                        session_type, session_options, getpid(), enable_session, handle, stream_type, -1);
-
+#ifdef USE_FOCUS
        if (enable_session && !g_focus_signal_handle) {
                ret = mm_sound_subscribe_signal(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, &g_focus_signal_handle, _mm_sound_client_focus_signal_callback, NULL);
                if (ret) {
@@ -359,6 +361,7 @@ int mm_sound_client_play_tone(int number, int volume_config, double volume, int
                        return MM_ERROR_POLICY_INTERNAL;
                }
        }
+#endif
 
        debug_fleave();
        return ret;
@@ -472,6 +475,7 @@ int mm_sound_client_play_sound(MMSoundPlayParam *param, int tone, int *handle)
                        debug_error("Add callback for play sound(%d) Failed", *handle);
                }
        }
+#ifdef USE_FOCUS
        if (!param->skip_session && !g_focus_signal_handle) {
                ret = mm_sound_subscribe_signal(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, &g_focus_signal_handle, _mm_sound_client_focus_signal_callback, NULL);
                if (ret) {
@@ -479,6 +483,7 @@ int mm_sound_client_play_sound(MMSoundPlayParam *param, int tone, int *handle)
                        return MM_ERROR_POLICY_INTERNAL;
                }
        }
+#endif
 
 failed:
 
index 81f6e88..d14e35c 100644 (file)
@@ -437,8 +437,6 @@ cleanup:
 
        debug_fleave();
        return ret;
-
-
 }
 
 int mm_sound_proxy_play_tone_with_stream_info(int client_pid, int tone, char *stream_type, int stream_index, int volume, int repeat, int *codechandle)
@@ -478,8 +476,6 @@ cleanup:
 
        debug_fleave();
        return ret;
-
-
 }
 
 int mm_sound_proxy_play_sound(const char* filename, int tone, int repeat, int volume, int volume_config,
@@ -568,7 +564,6 @@ cleanup:
 
 }
 
-
 int mm_sound_proxy_stop_sound(int handle)
 {
        int ret = MM_ERROR_NONE;
index 1e87c59..e7653fc 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.10.50
+Version:    0.10.51
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
@@ -74,11 +74,7 @@ MMSound utility package - contians mm_sound_testsuite, sound_check for sound sys
 %define tizen_audio_feature_bluetooth_enable 1
 %endif
 
-%ifarch %{arm}
-       CFLAGS="%{optflags} -fvisibility=hidden -D_TIZEN_PUBLIC_ -DUSE_FOCUS -DMM_DEBUG_FLAG -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"" ;export CFLAGS
-%else
-       CFLAGS="%{optflags} -fvisibility=hidden -D_TIZEN_PUBLIC_ -DUSE_FOCUS -DMM_DEBUG_FLAG -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"" ;export CFLAGS
-%endif
+CFLAGS="%{optflags} -fvisibility=hidden -D_TIZEN_PUBLIC_ -DMM_DEBUG_FLAG -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"" ;export CFLAGS
 
 %if "%{?tizen_profile_name}" == "wearable"
        CFLAGS+=" -DTIZEN_MICRO";export CFLAGS
@@ -97,11 +93,7 @@ MMSound utility package - contians mm_sound_testsuite, sound_check for sound sys
        --enable-prelink \
        --enable-lwipc \
 %endif
-%ifarch %{arm}
        --prefix=/usr --enable-pulse --enable-focus
-%else
-       --prefix=/usr --enable-pulse --enable-focus
-%endif
 
 make %{?_smp_mflags}
 
index 8334f0f..2362214 100755 (executable)
@@ -68,7 +68,9 @@ GIOChannel *stdin_channel;
 char g_file_name[MAX_STRING_LEN];
 char g_dir_name[MAX_PATH_LEN];
 
+#ifdef USE_FOCUS
 int g_focus_watch_index = -1;
+#endif
 GMainLoop* g_loop;
 
 unsigned int g_subs_id_test, g_subs_id_volume, g_subs_id_device_conn, g_subs_id_device_info;
@@ -344,6 +346,7 @@ static void input_dirname(char *dirname)
        g_print("\nThe input directory is '%s' \n\n",g_dir_name);
 }
 
+#ifdef USE_FOCUS
 static void __mm_sound_signal_cb1 (mm_sound_signal_name_t signal, int value, void *user_data)
 {
        int _value = 0;
@@ -359,13 +362,14 @@ static void __mm_sound_signal_cb2 (mm_sound_signal_name_t signal, int value, voi
        mm_sound_get_signal_value (signal, &_value);
        g_print (" -- get value : %d\n", _value);
 }
+
 unsigned int g_subscribe_id1 = 0;
 unsigned int g_subscribe_id2 = 0;
+#endif
 
 static void interpret (char *cmd)
 {
        int ret=0;
-       int value = 0;
        static int handle = -1;
        MMSoundPlayParam soundparam = {0,};
 
@@ -394,6 +398,7 @@ static void interpret (char *cmd)
                        }
 
                        else if(strncmp(cmd, "SS", 2) == 0) {
+                               int value = 0;
                                ret = mm_sound_send_signal(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, 1);
                                if(ret < 0)
                                        debug_log("mm_sound_send_signal() failed with 0x%x\n", ret);
@@ -695,6 +700,7 @@ static void interpret (char *cmd)
                                        g_print("failed to mm_sound_unset_focus_watch_callback(), ret[0x%x]\n", ret);
                                }
                        }
+
                        else if(strncmp(cmd, "k", 1) == 0)
 #else
                        if(strncmp(cmd, "k", 1) == 0)