summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilbok Lee <gilbok.lee@samsung.com>2017-04-10 13:01:50 +0900
committerGilbok Lee <gilbok.lee@samsung.com>2017-04-10 13:15:58 +0900
commit3bc8e303ae07b3d3c9933495b86f6d7ebc0c875c (patch)
tree2d5b3a2c72020202067f650bb80fd14d0ef0bab7
parent23ef9e97a385f33d15897dbeed159fa24968ac67 (diff)
downloadlibmm-radio-3bc8e303ae07b3d3c9933495b86f6d7ebc0c875c.tar.gz
libmm-radio-3bc8e303ae07b3d3c9933495b86f6d7ebc0c875c.tar.bz2
libmm-radio-3bc8e303ae07b3d3c9933495b86f6d7ebc0c875c.zip
Remove MMRADIO_FOCUS_CB_ enum
Use bool type for classify focus_cb, due to unuse MMRADIO_FOCUS_CB_SKIP_POSTMSG enum Brief Description (should be single line) [Version] 0.2.24 [Profile] Mobile, Wearable [Issue Type] Fix bugs Change-Id: I9d799a3b9af12c188a3ff06bfefa2ee6c2b354d9
-rwxr-xr-xpackaging/libmm-radio.spec2
-rw-r--r--src/include/mm_radio_sound_focus.h7
-rw-r--r--src/mm_radio_priv_emulator.c41
-rw-r--r--src/mm_radio_priv_hal.c41
-rw-r--r--src/mm_radio_sound_focus.c5
5 files changed, 33 insertions, 63 deletions
diff --git a/packaging/libmm-radio.spec b/packaging/libmm-radio.spec
index 3cf206e..d51df59 100755
--- a/packaging/libmm-radio.spec
+++ b/packaging/libmm-radio.spec
@@ -1,6 +1,6 @@
Name: libmm-radio
Summary: Multimedia Framework Radio Library
-Version: 0.2.23
+Version: 0.2.24
Release: 0
Group: System/Libraries
License: Apache-2.0
diff --git a/src/include/mm_radio_sound_focus.h b/src/include/mm_radio_sound_focus.h
index 64a69d8..31f008d 100644
--- a/src/include/mm_radio_sound_focus.h
+++ b/src/include/mm_radio_sound_focus.h
@@ -28,11 +28,6 @@
#include <mm_sound_focus.h>
#include <mm_message.h>
-enum {
- MMRADIO_FOCUS_CB_NONE,
- MMRADIO_FOCUS_CB_POSTMSG,
- MMRADIO_FOCUS_CB_SKIP_POSTMSG
-};
typedef struct {
int focus_id;
int watch_id;
@@ -40,7 +35,7 @@ typedef struct {
unsigned int device_subs_id;
int handle;
int pid;
- int by_focus_cb;
+ bool by_focus_cb;
int event_src;
int snd_session_flags;
int session_type;
diff --git a/src/mm_radio_priv_emulator.c b/src/mm_radio_priv_emulator.c
index 9debc9a..9219214 100644
--- a/src/mm_radio_priv_emulator.c
+++ b/src/mm_radio_priv_emulator.c
@@ -1245,26 +1245,15 @@ static bool __mmradio_set_state(mm_radio_t * radio, int new_state)
#ifdef TIZEN_FEATURE_SOUND_FOCUS
/* post message to application */
- switch (radio->sound_focus.by_focus_cb) {
- case MMRADIO_FOCUS_CB_NONE:
- {
- msg_type = MM_MESSAGE_STATE_CHANGED;
- MMRADIO_POST_MSG(radio, msg_type, &msg);
- }
- break;
-
- case MMRADIO_FOCUS_CB_POSTMSG:
- {
- msg_type = MM_MESSAGE_STATE_INTERRUPTED;
- msg.union_type = MM_MSG_UNION_CODE;
- msg.code = radio->sound_focus.event_src;
- MMRADIO_POST_MSG(radio, msg_type, &msg);
- }
- break;
-
- case MMRADIO_FOCUS_CB_SKIP_POSTMSG:
- default:
- break;
+ if (radio->sound_focus.by_focus_cb) {
+ msg_type = MM_MESSAGE_STATE_INTERRUPTED;
+ msg.union_type = MM_MSG_UNION_CODE;
+ msg.code = radio->sound_focus.event_src;
+ MMRADIO_POST_MSG(radio, msg_type, &msg);
+ radio->sound_focus.by_focus_cb = false;
+ } else {
+ msg_type = MM_MESSAGE_STATE_CHANGED;
+ MMRADIO_POST_MSG(radio, msg_type, &msg);
}
#else
msg_type = MM_MESSAGE_STATE_CHANGED;
@@ -1304,12 +1293,14 @@ static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
switch (focus_state) {
case FOCUS_IS_RELEASED:{
radio->sound_focus.cur_focus_type &= ~focus_type;
- radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_POSTMSG;
+ radio->sound_focus.by_focus_cb = true;
result = _mmradio_stop(radio);
if (result)
MMRADIO_LOG_ERROR("failed to stop radio\n");
+ radio->sound_focus.by_focus_cb = false;
+
MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
}
break;
@@ -1324,8 +1315,6 @@ static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
if ((postMsg) && (FOCUS_FOR_BOTH == radio->sound_focus.cur_focus_type))
MMRADIO_POST_MSG(radio, MM_MESSAGE_READY_TO_RESUME, &msg);
- radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
-
MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
}
break;
@@ -1356,12 +1345,14 @@ static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_t
switch (focus_state) {
case FOCUS_IS_ACQUIRED: {
radio->sound_focus.cur_focus_type &= ~focus_type;
- radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_POSTMSG;
+ radio->sound_focus.by_focus_cb = true;
result = _mmradio_stop(radio);
if (result)
MMRADIO_LOG_ERROR("failed to stop radio\n");
+ radio->sound_focus.by_focus_cb = false;
+
MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
}
break;
@@ -1376,8 +1367,6 @@ static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_t
if ((postMsg) && (FOCUS_FOR_BOTH == radio->sound_focus.cur_focus_type))
MMRADIO_POST_MSG(radio, MM_MESSAGE_READY_TO_RESUME, &msg);
- radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
-
MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
}
break;
diff --git a/src/mm_radio_priv_hal.c b/src/mm_radio_priv_hal.c
index 0ccd884..f13b632 100644
--- a/src/mm_radio_priv_hal.c
+++ b/src/mm_radio_priv_hal.c
@@ -1301,26 +1301,14 @@ static bool __mmradio_set_state(mm_radio_t *radio, int new_state)
#ifdef TIZEN_FEATURE_SOUND_FOCUS
/* post message to application */
- switch (radio->sound_focus.by_focus_cb) {
- case MMRADIO_FOCUS_CB_NONE:
- {
- msg_type = MM_MESSAGE_STATE_CHANGED;
- MMRADIO_POST_MSG(radio, msg_type, &msg);
- }
- break;
-
- case MMRADIO_FOCUS_CB_POSTMSG:
- {
- msg_type = MM_MESSAGE_STATE_INTERRUPTED;
- msg.union_type = MM_MSG_UNION_CODE;
- msg.code = radio->sound_focus.event_src;
- MMRADIO_POST_MSG(radio, msg_type, &msg);
- }
- break;
-
- case MMRADIO_FOCUS_CB_SKIP_POSTMSG:
- default:
- break;
+ if (radio->sound_focus.by_focus_cb) {
+ msg_type = MM_MESSAGE_STATE_INTERRUPTED;
+ msg.union_type = MM_MSG_UNION_CODE;
+ msg.code = radio->sound_focus.event_src;
+ MMRADIO_POST_MSG(radio, msg_type, &msg);
+ } else {
+ msg_type = MM_MESSAGE_STATE_CHANGED;
+ MMRADIO_POST_MSG(radio, msg_type, &msg);
}
#else
msg_type = MM_MESSAGE_STATE_CHANGED;
@@ -1362,13 +1350,13 @@ static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
switch (focus_state) {
case FOCUS_IS_RELEASED:{
radio->sound_focus.cur_focus_type &= ~focus_type;
- radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_POSTMSG;
+ radio->sound_focus.by_focus_cb = true;
result = _mmradio_stop(radio);
if (result)
MMRADIO_LOG_ERROR("failed to stop radio");
- radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
+ radio->sound_focus.by_focus_cb = false;
MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
}
@@ -1384,8 +1372,6 @@ static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
if ((postMsg) && (FOCUS_FOR_BOTH == radio->sound_focus.cur_focus_type))
MMRADIO_POST_MSG(radio, MM_MESSAGE_READY_TO_RESUME, &msg);
- radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
-
MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
}
break;
@@ -1417,12 +1403,13 @@ static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_t
switch (focus_state) {
case FOCUS_IS_ACQUIRED: {
radio->sound_focus.cur_focus_type &= ~focus_type;
- radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_POSTMSG;
+ radio->sound_focus.by_focus_cb = true;
result = _mmradio_stop(radio);
if (result)
MMRADIO_LOG_ERROR("failed to stop radio");
- radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
+
+ radio->sound_focus.by_focus_cb = false;
MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type);
}
@@ -1438,8 +1425,6 @@ static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_t
if ((postMsg) && (FOCUS_FOR_BOTH == radio->sound_focus.cur_focus_type))
MMRADIO_POST_MSG(radio, MM_MESSAGE_READY_TO_RESUME, &msg);
- radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
-
MMRADIO_LOG_DEBUG("FOCUS_IS_ACQUIRED cur_focus_type : %d", radio->sound_focus.cur_focus_type);
}
break;
diff --git a/src/mm_radio_sound_focus.c b/src/mm_radio_sound_focus.c
index 766a913..0eff66e 100644
--- a/src/mm_radio_sound_focus.c
+++ b/src/mm_radio_sound_focus.c
@@ -48,13 +48,14 @@ static void _mmradio_device_connected_cb(MMSoundDevice_t device, bool is_connect
case MM_SOUND_DEVICE_TYPE_USB_AUDIO:
if (!is_connected) {
MMRADIO_LOG_ERROR("sound device unplugged");
- radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_POSTMSG;
+ radio->sound_focus.by_focus_cb = true;
radio->sound_focus.event_src = MM_MSG_CODE_INTERRUPTED_BY_EARJACK_UNPLUG;
result = _mmradio_stop(radio);
if (result != MM_ERROR_NONE)
MMRADIO_LOG_ERROR("failed to stop radio");
- radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE;
+
+ radio->sound_focus.by_focus_cb = false;
}
break;
default: