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
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
#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;
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;
#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;
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;
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;
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;
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;
#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;
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);
}
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;
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);
}
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;
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: