/* message posting */
#define MMPLAYER_POST_MSG(x_player, x_msgtype, x_msg_param) \
-LOGD("posting %s to application\n", #x_msgtype); \
-__mmplayer_post_message(x_player, x_msgtype, x_msg_param);
+do { \
+ LOGD("posting %s to application\n", #x_msgtype); \
+ __mmplayer_post_message(x_player, x_msgtype, x_msg_param); \
+} while (0)
/* setting player state */
#define MMPLAYER_SET_STATE(x_player, x_state) \
-LOGD("update state machine to %d\n", x_state); \
-__mmplayer_set_state(x_player, x_state);
+do { \
+ LOGD("update state machine to %d\n", x_state); \
+ __mmplayer_set_state(x_player, x_state); \
+} while (0)
#define MMPLAYER_CHECK_STATE(x_player, x_command) \
LOGD("checking player state before doing %s\n", #x_command); \
gboolean post_bos = FALSE;
gboolean interrupted_by_focus = FALSE;
gboolean interrupted_by_resource = FALSE;
- int ret = MM_ERROR_NONE;
MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
if (MMPLAYER_CURRENT_STATE(player) == state) {
LOGW("already same state(%s)\n", MMPLAYER_STATE_GET_NAME(state));
MMPLAYER_PENDING_STATE(player) = MM_PLAYER_STATE_NONE;
- return ret;
+ return MM_ERROR_NONE;
}
/* update player states */
LOGE("failed to go ahead because of video conflict\n");
msg.union_type = MM_MSG_UNION_CODE;
- msg.code = MM_ERROR_POLICY_INTERRUPTED;
+ msg.code = MM_PLAYER_FOCUS_CHANGED_BY_RESOURCE_CONFLICT;
MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_INTERRUPTED, &msg);
_mmplayer_unrealize((MMHandleType)player);
} else {
LOGE("failed to play by sound focus error : 0x%X\n", sound_result);
_mmplayer_pause((MMHandleType)player);
- return sound_result;
}
return MM_ERROR_POLICY_INTERNAL;
/* post message to application */
if (MMPLAYER_TARGET_STATE(player) == state) {
/* fill the message with state of player */
+ msg.union_type = MM_MSG_UNION_STATE;
msg.state.previous = MMPLAYER_PREV_STATE(player);
msg.state.current = MMPLAYER_CURRENT_STATE(player);
/* state changed by focus or resource callback */
if (interrupted_by_focus || interrupted_by_resource) {
- msg.union_type = MM_MSG_UNION_CODE;
if (interrupted_by_focus)
- msg.code = player->sound_focus.focus_changed_msg;
+ msg.state.code = player->sound_focus.focus_changed_msg;
else if (interrupted_by_resource)
- msg.code = MM_PLAYER_FOCUS_CHANGED_BY_RESOURCE_CONFLICT;
+ msg.state.code = MM_PLAYER_FOCUS_CHANGED_BY_RESOURCE_CONFLICT;
MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_INTERRUPTED, &msg);
- } else /* state changed by usecase */
+ } else { /* state changed by usecase */
MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_CHANGED, &msg);
+ }
} else {
LOGD("intermediate state, do nothing.\n");
MMPLAYER_PRINT_STATE(player);
- return ret;
+ return MM_ERROR_NONE;
}
if (post_bos) {
player->sent_bos = TRUE;
}
- return ret;
+ return MM_ERROR_NONE;
}
static gpointer __mmplayer_next_play_thread(gpointer data)
/* return error if failed to set state */
LOGE("failed to set READY state");
return ret;
- } else
- MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_READY);
+ }
+
+ MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_READY);
/* create dot before error-return. for debugging */
MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-realize");
mm_attrs_set_int_by_name(attrs, "profile_play_count", player->play_count);
mmf_attrs_commit(attrs);
- } else
+ } else {
LOGE("seeking to 0 failed in repeat play");
- } else
+ }
+ } else {
/* posting eos */
MMPLAYER_POST_MSG(player, MM_MESSAGE_END_OF_STREAM, NULL);
+ }
/* we are returning FALSE as we need only one posting */
return FALSE;