PLAYER_ERROR_NOT_SUPPORTED_SUBTITLE = PLAYER_ERROR_CLASS | 0x10, /**< Not supported subtitle format (Since 4.0) */
} player_error_e;
-/**
- * @brief Enumeration for media player's interruption type.
- * @since_tizen 2.3
- */
-typedef enum {
- PLAYER_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed (Deprecated since 3.0)*/
- PLAYER_INTERRUPTED_BY_MEDIA, /**< Interrupted by a non-resumable media application (Deprecated since 3.0)*/
- PLAYER_INTERRUPTED_BY_CALL, /**< Interrupted by an incoming call (Deprecated since 3.0)*/
- PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphones (Deprecated since 3.0)*/
- PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by a resource conflict */
- PLAYER_INTERRUPTED_BY_ALARM, /**< Interrupted by an alarm (Deprecated since 3.0)*/
- PLAYER_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by an emergency (Deprecated since 3.0)*/
- PLAYER_INTERRUPTED_BY_NOTIFICATION, /**< Interrupted by a notification (Deprecated since 3.0)*/
-} player_interrupted_code_e;
-
/**
* @brief Enumeration for progressive download message type.
* @since_tizen 2.3
/**
* @brief Called when the media player is interrupted.
* @since_tizen 2.3
- * @param[in] error_code The interrupted error code
* @param[in] user_data The user data passed from the callback registration function
* @see legacy_player_set_interrupted_cb()
* @see legacy_player_unset_interrupted_cb()
*/
-typedef void (*player_interrupted_cb)(player_interrupted_code_e code, void *user_data);
+typedef void (*player_interrupted_cb)(void *user_data);
/**
* @brief Called when an error occurs in the media player.
* @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
* @post player_interrupted_cb() will be invoked.
* @see legacy_player_unset_interrupted_cb()
- * @see #player_interrupted_code_e
* @see legacy_player_interrupted_cb()
*/
int legacy_player_set_interrupted_cb(player_h player, player_interrupted_cb callback, void *user_data);
return ret;
}
-static player_interrupted_code_e __convert_interrupted_code(int code)
-{
- player_interrupted_code_e ret = PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT;
- switch (code) {
- case MM_PLAYER_FOCUS_CHANGED_COMPLETED:
- ret = PLAYER_INTERRUPTED_COMPLETED;
- break;
- case MM_PLAYER_FOCUS_CHANGED_BY_MEDIA:
- case MM_PLAYER_FOCUS_CHANGED_BY_UNKNOWN:
- ret = PLAYER_INTERRUPTED_BY_MEDIA;
- break;
- case MM_PLAYER_FOCUS_CHANGED_BY_CALL:
- ret = PLAYER_INTERRUPTED_BY_CALL;
- break;
- case MM_PLAYER_FOCUS_CHANGED_BY_EARJACK_UNPLUG:
- ret = PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG;
- break;
- case MM_PLAYER_FOCUS_CHANGED_BY_ALARM:
- ret = PLAYER_INTERRUPTED_BY_ALARM;
- break;
- case MM_PLAYER_FOCUS_CHANGED_BY_NOTIFICATION:
- ret = PLAYER_INTERRUPTED_BY_NOTIFICATION;
- break;
- case MM_PLAYER_FOCUS_CHANGED_BY_EMERGENCY:
- ret = PLAYER_INTERRUPTED_BY_EMERGENCY;
- break;
- case MM_PLAYER_FOCUS_CHANGED_BY_RESOURCE_CONFLICT:
- default:
- ret = PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT;
- break;
- }
- LOGE("[%s] interrupted code(%d) => ret(%d)", __FUNCTION__, code, ret);
- return ret;
-}
-
-static player_state_e __convert_player_state(MMPlayerStateType state)
-{
- if (state == MM_PLAYER_STATE_NONE)
- return PLAYER_STATE_NONE;
- else
- return state + 1;
-}
-
bool __player_state_validate(player_s *handle, player_state_e threshold)
{
if (handle->state < threshold)
break;
case MM_MESSAGE_STATE_CHANGED: /* 0x03 */
LOGI("STATE CHANGED INTERNALLY - from : %d, to : %d (CAPI State : %d)", msg->state.previous, msg->state.current, handle->state);
- if ((handle->is_progressive_download && msg->state.previous == MM_PLAYER_STATE_NULL && msg->state.current == MM_PLAYER_STATE_READY) || (msg->state.previous == MM_PLAYER_STATE_READY && msg->state.current == MM_PLAYER_STATE_PAUSED)) {
+ if ((handle->is_progressive_download && msg->state.previous == MM_PLAYER_STATE_NULL && msg->state.current == MM_PLAYER_STATE_READY) ||
+ (msg->state.previous == MM_PLAYER_STATE_READY && msg->state.current == MM_PLAYER_STATE_PAUSED)) {
LEGACY_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
/* asyc && prepared cb has been set */
LEGACY_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
}
break;
- case MM_MESSAGE_READY_TO_RESUME: /* 0x05 */
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_INTERRUPT])
- ((player_interrupted_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_INTERRUPT])(PLAYER_INTERRUPTED_COMPLETED, handle->user_data[MUSE_PLAYER_EVENT_TYPE_INTERRUPT]);
- break;
case MM_MESSAGE_BEGIN_OF_STREAM: /* 0x104 */
LOGI("[%s] Ready to streaming information (BOS) [current state : %d]", __FUNCTION__, handle->state);
break;
((player_buffering_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_BUFFERING])(msg->connection.buffering, handle->user_data[MUSE_PLAYER_EVENT_TYPE_BUFFERING]);
break;
case MM_MESSAGE_STATE_INTERRUPTED: /* 0x04 */
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_INTERRUPT]) {
- int code = 0;
- if (msg->union_type == MM_MSG_UNION_STATE) {
- handle->state = __convert_player_state(msg->state.current);
- LOGD("update player state to %d", handle->state);
-
- if (handle->state == PLAYER_STATE_READY)
- handle->is_stopped = TRUE;
- code = msg->state.code;
- } else if (msg->union_type == MM_MSG_UNION_CODE) {
- code = msg->code;
- } else {
- LOGE("invalid msg type %d", msg->union_type);
- break;
- }
- ((player_interrupted_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_INTERRUPT])(__convert_interrupted_code(code), handle->user_data[MUSE_PLAYER_EVENT_TYPE_INTERRUPT]);
- }
+ if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_INTERRUPT])
+ ((player_interrupted_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_INTERRUPT])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_INTERRUPT]);
break;
case MM_MESSAGE_CONNECTION_TIMEOUT: /* 0x102 */
LOGI("[%s] PLAYER_ERROR_CONNECTION_FAILED (0x%08x) : CONNECTION_TIMEOUT", __FUNCTION__, PLAYER_ERROR_CONNECTION_FAILED);
ret = mm_player_start(handle->mm_handle);
LOGI("[%s] stop -> start() ", __FUNCTION__);
} else {
- if (handle->is_progressive_download && handle->state == PLAYER_STATE_READY)
+ if (handle->state == PLAYER_STATE_READY)
ret = mm_player_start(handle->mm_handle);
else
ret = mm_player_resume(handle->mm_handle);
PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT64, "offset", (INT64)offset);
}
-static void _interrupted_cb(player_interrupted_code_e code, void *user_data)
+static void _interrupted_cb(void *user_data)
{
- muse_player_cb_e api = MUSE_PLAYER_CB_EVENT;
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_INTERRUPT;
- muse_module_h module = (muse_module_h)user_data;
-
- LOGD("ENTER");
-
- PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "code", (int)code);
+ __player_callback(ev, (muse_module_h)user_data);
}
static void _set_interrupted_cb(player_h player, void *module, bool set)