[0.2.123] resolve the SAM violation issues 89/212489/3
authorEunhye Choi <eunhae1.choi@samsung.com>
Thu, 22 Aug 2019 05:17:12 +0000 (14:17 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Mon, 26 Aug 2019 07:00:24 +0000 (16:00 +0900)
- remove module circular dependency
- remove unused setting sound stream info function
- check state pre-condition before setting capture callback

Change-Id: Ic0de65dfb15064eea04a80d3fbd9637492dd9ce6

legacy/CMakeLists.txt
legacy/include/legacy_player.h
legacy/include/legacy_player_internal.h
legacy/include/legacy_player_private.h
legacy/src/legacy_player.c
legacy/src/legacy_player_internal.c
muse/src/muse_player.c
packaging/mmsvc-player.spec

index 3bcba47..601de9d 100644 (file)
@@ -22,7 +22,7 @@ FOREACH(flag ${${LEGACY_PLAYER}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(CMAKE_C_FLAGS "-I./include -I../muse/include ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -Wno-deprecated -Wno-deprecated-declarations")
+SET(CMAKE_C_FLAGS "-I./include ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -Wno-deprecated -Wno-deprecated-declarations")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
 IF("${ARCH}" STREQUAL "arm")
index c12436c..46fce5d 100644 (file)
@@ -178,10 +178,44 @@ typedef enum {
        PLAYER_CONTENT_INFO_YEAR,       /**< Year */
 } player_content_info_e;
 
+typedef enum {
+       LEGACY_PLAYER_CALLBACK_TYPE_PREPARE,
+       LEGACY_PLAYER_CALLBACK_TYPE_COMPLETE,
+       LEGACY_PLAYER_CALLBACK_TYPE_INTERRUPT,
+       LEGACY_PLAYER_CALLBACK_TYPE_ERROR,
+       LEGACY_PLAYER_CALLBACK_TYPE_BUFFERING,
+       LEGACY_PLAYER_CALLBACK_TYPE_SUBTITLE,
+       LEGACY_PLAYER_CALLBACK_TYPE_CAPTURE,
+       LEGACY_PLAYER_CALLBACK_TYPE_SEEK,
+       LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_PACKET_VIDEO_FRAME,
+       LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_PACKET_AUDIO_FRAME,
+       LEGACY_PLAYER_CALLBACK_TYPE_VIDEO_FRAME_RENDER_ERROR,
+       LEGACY_PLAYER_CALLBACK_TYPE_SUPPORTED_AUDIO_EFFECT,
+       LEGACY_PLAYER_CALLBACK_TYPE_SUPPORTED_AUDIO_EFFECT_PRESET,
+       LEGACY_PLAYER_CALLBACK_TYPE_MISSED_PLUGIN,
+#ifdef _PLAYER_FOR_PRODUCT
+       LEGACY_PLAYER_CALLBACK_TYPE_IMAGE_BUFFER,
+       LEGACY_PLAYER_CALLBACK_TYPE_SELECTED_SUBTITLE_LANGUAGE,
+#endif
+       LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS,
+       LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS,
+       LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO,
+       LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO,
+       LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_VIDEO_SEEK,
+       LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_AUDIO_SEEK,
+       LEGACY_PLAYER_CALLBACK_TYPE_AUDIO_STREAM_CHANGED,
+       LEGACY_PLAYER_CALLBACK_TYPE_VIDEO_STREAM_CHANGED,
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       LEGACY_PLAYER_CALLBACK_TYPE_RETURN_BUFFER,
+#endif
+       LEGACY_PLAYER_CALLBACK_TYPE_SERVICE_DISCONNECTED,
+       LEGACY_PLAYER_CALLBACK_TYPE_NUM
+} legacy_player_callback_type_e;
+
 /**
  * @brief  Default callback type
  */
-typedef void (*legacy_player_default_callback)(muse_player_event_e type, void *user_data);
+typedef void (*legacy_player_default_callback)(legacy_player_callback_type_e type, void *user_data);
 
 /**
  * @brief  Called when the subtitle is updated.
@@ -222,12 +256,12 @@ typedef bool (*legacy_player_media_packet_audio_decoded_cb)(void *audio_data, vo
 /**
  * @brief Called when the buffer level drops below the threshold of max size or no free space in buffer.
  */
-typedef void (*legacy_player_media_stream_buffer_status_cb)(muse_player_event_e type, player_media_stream_buffer_status_e status, void *user_data);
+typedef void (*legacy_player_media_stream_buffer_status_cb)(legacy_player_callback_type_e type, player_media_stream_buffer_status_e status, void *user_data);
 
 /**
  * @brief Called to notify the next push-buffer offset when seeking is occurred.
  */
-typedef void (*legacy_player_media_stream_seek_cb)(muse_player_event_e type, unsigned long long offset, void *user_data);
+typedef void (*legacy_player_media_stream_seek_cb)(legacy_player_callback_type_e type, unsigned long long offset, void *user_data);
 
 /**
  * @brief Called to notify the video stream changed.
@@ -343,8 +377,8 @@ int legacy_player_unprepare(legacy_player_h player);
 /**
  * @brief Set and Unset the legacy player callback
  */
-int legacy_player_set_callback(legacy_player_h player, muse_player_event_e type, void *callback, void *user_data);
-int legacy_player_unset_callback(legacy_player_h player, muse_player_event_e type);
+int legacy_player_set_callback(legacy_player_h player, legacy_player_callback_type_e type, void *callback, void *user_data);
+int legacy_player_unset_callback(legacy_player_h player, legacy_player_callback_type_e type);
 
 /**
  * @brief Sets the data source (file-path, HTTP or RSTP URI) to use.
@@ -442,28 +476,6 @@ int legacy_player_set_volume(legacy_player_h player, float volume);
 int legacy_player_get_volume(legacy_player_h player, float *volume);
 
 /**
- * @brief Sets the player's sound manager stream information.
- * @since_tizen 3.0
- * @remarks You can set sound stream information including audio routing and volume type.
- * For more details, please refer to sound_manager.h
- *
- * @param[in] player The handle to the media player
- * @param[in] stream_info The sound manager info type
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #PLAYER_ERROR_NONE Successful
- * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
- * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
- * @pre The player state must be set to #PLAYER_STATE_IDLE by calling legacy_player_create().
- * @see #sound_stream_info_h
- * @see sound_manager_create_stream_information()
- * @see sound_manager_destroy_stream_information()
- */
-int legacy_player_set_sound_stream_info(legacy_player_h player, sound_stream_info_h stream_info);
-
-/**
  * @brief Sets the audio latency mode.
  * @since_tizen 2.3
  * @remarks The default audio latency mode of the player is #AUDIO_LATENCY_MODE_MID.
@@ -1478,7 +1490,7 @@ int legacy_player_set_roi_area(legacy_player_h player, int x, int y, int w, int
  * @retval  #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval  #PLAYER_ERROR_INVALID_OPERATION Invalid operation
  */
-int legacy_player_set_sound_stream_info_for_mused(legacy_player_h player, char *stream_type, int stream_index);
+int legacy_player_set_sound_stream_info(legacy_player_h player, char *stream_type, int stream_index);
 
 /**
  * @brief Gets time out time from muse-server
index fb71d67..bab93dd 100644 (file)
@@ -45,7 +45,7 @@ typedef enum
 /**
  * @brief Called when the buffer level drops below the min size or exceeds the max size.
  */
-typedef void (*legacy_player_media_stream_buffer_status_cb_ex)(muse_player_event_e type,
+typedef void (*legacy_player_media_stream_buffer_status_cb_ex)(legacy_player_callback_type_e type,
                player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data);
 
 /**
index 81347e1..2bc1fee 100644 (file)
@@ -79,9 +79,9 @@ typedef enum {
 
 typedef struct {
        MMHandleType mm_handle;
-       const void *user_cb[MUSE_PLAYER_EVENT_TYPE_NUM];
-       void *user_data[MUSE_PLAYER_EVENT_TYPE_NUM];
-       GMutex user_cb_lock[MUSE_PLAYER_EVENT_TYPE_NUM];
+       const void *user_cb[LEGACY_PLAYER_CALLBACK_TYPE_NUM];
+       void *user_data[LEGACY_PLAYER_CALLBACK_TYPE_NUM];
+       GMutex user_cb_lock[LEGACY_PLAYER_CALLBACK_TYPE_NUM];
        void *wl_display;
        player_display_type_e display_type;
        player_state_e state;
@@ -96,7 +96,7 @@ typedef struct {
 } legacy_player_t;
 
 typedef struct {
-       muse_player_event_e type;
+       legacy_player_callback_type_e type;
        player_internal_state_e set_state;
        player_internal_state_e unset_state;
 } legacy_player_callback_pre_state_t;
index 1a171a5..1313cc4 100644 (file)
@@ -25,7 +25,6 @@
 #include <sound_manager.h>
 #include <sound_manager_internal.h>
 #include <dlog.h>
-#include "muse_player.h"
 #include "legacy_player.h"
 #include "legacy_player_internal.h"
 #include "legacy_player_private.h"
@@ -268,9 +267,9 @@ static player_state_e __lplayer_convert_state(mmplayer_state_e state)
 static bool __lplayer_check_enabled_user_cb_lock(int type)
 {
        switch (type) {
-       case MUSE_PLAYER_EVENT_TYPE_PREPARE:          /* fall through */
-       case MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO:    /* fall through */
-       case MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO:    /* fall through */
+       case LEGACY_PLAYER_CALLBACK_TYPE_PREPARE:          /* fall through */
+       case LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO:    /* fall through */
+       case LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO:    /* fall through */
                return true;
        default:
                return false;
@@ -279,18 +278,18 @@ static bool __lplayer_check_enabled_user_cb_lock(int type)
 
 static void __lplayer_buffer_status_callback(legacy_player_t *handle, MMMessageParamType *msg)
 {
-       muse_player_event_e event_type;
-       muse_player_event_e event_type_internal;
+       legacy_player_callback_type_e event_type;
+       legacy_player_callback_type_e event_type_internal;
        player_media_stream_buffer_status_e buffer_status;
        unsigned long long buffer_bytes;
 
        /* check public api callback, higher priority */
        if (msg->buffer_status.stream_type == MM_PLAYER_STREAM_TYPE_AUDIO) {
-               event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS;
-               event_type_internal = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO;
+               event_type = LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS;
+               event_type_internal = LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO;
        } else if (msg->buffer_status.stream_type == MM_PLAYER_STREAM_TYPE_VIDEO) {
-               event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS;
-               event_type_internal = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO;
+               event_type = LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS;
+               event_type_internal = LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO;
        } else {
                LOGE("invalid stream type %d", msg->buffer_status.stream_type);
                return;
@@ -323,7 +322,7 @@ static void __lplayer_buffer_status_callback(legacy_player_t *handle, MMMessageP
 static void __lplayer_video_stream_changed_callback(legacy_player_t *handle)
 {
        int ret = MM_ERROR_NONE;
-       muse_player_event_e event_type = MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED;
+       legacy_player_callback_type_e event_type = LEGACY_PLAYER_CALLBACK_TYPE_VIDEO_STREAM_CHANGED;
        int width = 0;
        int height = 0;
        int fps = 0;
@@ -345,7 +344,7 @@ static void __lplayer_video_stream_changed_callback(legacy_player_t *handle)
        return;
 }
 
-static void __lplayer_default_callback(legacy_player_t *handle, muse_player_event_e type)
+static void __lplayer_default_callback(legacy_player_t *handle, legacy_player_callback_type_e type)
 {
        LOGD("type %d", type);
 
@@ -355,6 +354,22 @@ static void __lplayer_default_callback(legacy_player_t *handle, muse_player_even
        L_PLAYER_USER_CB_UNLOCK(handle, type);
 }
 
+static void __lplayer_unset_callback(legacy_player_t *handle,
+               legacy_player_callback_type_e type, bool release_data)
+{
+       LOGD("type : %d ", type);
+
+       L_PLAYER_USER_CB_LOCK(handle, type);
+
+       handle->user_cb[type] = NULL;
+
+       if (release_data)
+               g_free(handle->user_data[type]);
+       handle->user_data[type] = NULL;
+
+       L_PLAYER_USER_CB_UNLOCK(handle, type);
+}
+
 static int __lplayer_message_callback(int message, void *param, void *user_data)
 {
        legacy_player_t *handle = (legacy_player_t *)user_data;
@@ -365,34 +380,27 @@ static int __lplayer_message_callback(int message, void *param, void *user_data)
        switch (message) {
        case MM_MESSAGE_ERROR:  /* 0x01 */
                err_code = _lplayer_convert_error_code(msg->code, (char *)__FUNCTION__);
-
-               L_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
-               if (PLAYER_ERROR_NOT_SUPPORTED_FILE == err_code && handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
-                       LOGW("Failed to pause, so prepare cb will be released soon");
-                       handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
-                       if (handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
-                               g_free(handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE]);
-                               handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
-                       }
+               if (err_code == PLAYER_ERROR_NOT_SUPPORTED_FILE) {
+                       LOGE("failed to pause, so prepare cb will be released soon");
+                       __lplayer_unset_callback(handle, LEGACY_PLAYER_CALLBACK_TYPE_PREPARE, true);
                }
-               L_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
                break;
        case MM_MESSAGE_STATE_CHANGED:  /* 0x03 */
                LOGI("state chagned from: %d, to: %d (CAPI State: %d)", msg->state.previous, msg->state.current, handle->state);
                if (msg->state.previous == MM_PLAYER_STATE_READY && msg->state.current == MM_PLAYER_STATE_PAUSED) {
-                       L_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
-                       if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
+                       L_PLAYER_USER_CB_LOCK(handle, LEGACY_PLAYER_CALLBACK_TYPE_PREPARE);
+                       if (handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_PREPARE]) {
                                /* async && prepared cb has been set */
                                LOGD("Prepared! [current state : %d]", handle->state);
                                PLAYER_TRACE_ASYNC_END("MM:PLAYER:PREPARE_ASYNC", *(int *)handle);
 
                                __lplayer_update_state(handle, PLAYER_INTERNAL_STATE_READY);
-                               ((legacy_player_prepared_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE]);
+                               ((legacy_player_prepared_cb)handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_PREPARE])(handle->user_data[LEGACY_PLAYER_CALLBACK_TYPE_PREPARE]);
 
-                               handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
-                               handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
+                               handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_PREPARE] = NULL;
+                               handle->user_data[LEGACY_PLAYER_CALLBACK_TYPE_PREPARE] = NULL;
                        }
-                       L_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
+                       L_PLAYER_USER_CB_UNLOCK(handle, LEGACY_PLAYER_CALLBACK_TYPE_PREPARE);
                }
                break;
        case MM_MESSAGE_BEGIN_OF_STREAM:        /* 0x104 */
@@ -400,18 +408,18 @@ static int __lplayer_message_callback(int message, void *param, void *user_data)
                break;
        case MM_MESSAGE_END_OF_STREAM:  /* 0x105 */
                LOGD("Playback is completed.");
-               __lplayer_default_callback(handle, MUSE_PLAYER_EVENT_TYPE_COMPLETE);
+               __lplayer_default_callback(handle, LEGACY_PLAYER_CALLBACK_TYPE_COMPLETE);
                break;
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        case MM_MESSAGE_GAPLESS_CONSTRUCTION:   /* 0x105 */
                LOGD("Retrieve exported buffers.");
-               __lplayer_default_callback(handle, MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER);
+               __lplayer_default_callback(handle, LEGACY_PLAYER_CALLBACK_TYPE_RETURN_BUFFER);
                break;
 #endif
        case MM_MESSAGE_BUFFERING:      /* 0x103 */
-               if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_BUFFERING])
-                       ((legacy_player_buffering_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_BUFFERING]) \
-                                       (msg->connection.buffering, handle->user_data[MUSE_PLAYER_EVENT_TYPE_BUFFERING]);
+               if (handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_BUFFERING])
+                       ((legacy_player_buffering_cb)handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_BUFFERING]) \
+                                       (msg->connection.buffering, handle->user_data[LEGACY_PLAYER_CALLBACK_TYPE_BUFFERING]);
                break;
        case MM_MESSAGE_STATE_INTERRUPTED:      /* 0x04 */
                if (msg->union_type == MM_MSG_UNION_STATE) {
@@ -421,28 +429,28 @@ static int __lplayer_message_callback(int message, void *param, void *user_data)
                }
 
                LOGD("Interrupted");
-               __lplayer_default_callback(handle, MUSE_PLAYER_EVENT_TYPE_INTERRUPT);
+               __lplayer_default_callback(handle, LEGACY_PLAYER_CALLBACK_TYPE_INTERRUPT);
                break;
        case MM_MESSAGE_CONNECTION_TIMEOUT:     /* 0x102 */
                LOGE("PLAYER_ERROR_CONNECTION_FAILED : CONNECTION_TIMEOUT");
                err_code = PLAYER_ERROR_CONNECTION_FAILED;
                break;
        case MM_MESSAGE_UPDATE_SUBTITLE:        /* 0x109 */
-               if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SUBTITLE])
-                       ((legacy_player_subtitle_updated_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SUBTITLE]) \
-                                       (msg->subtitle.duration, (char *)msg->data, handle->user_data[MUSE_PLAYER_EVENT_TYPE_SUBTITLE]);
+               if (handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_SUBTITLE])
+                       ((legacy_player_subtitle_updated_cb)handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_SUBTITLE]) \
+                                       (msg->subtitle.duration, (char *)msg->data, handle->user_data[LEGACY_PLAYER_CALLBACK_TYPE_SUBTITLE]);
                break;
        case MM_MESSAGE_VIDEO_NOT_CAPTURED:     /* 0x113 */
                LOGE("PLAYER_ERROR_VIDEO_CAPTURE_FAILED");
-               if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR])
-                       ((legacy_player_error_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR]) \
-                                       (PLAYER_ERROR_VIDEO_CAPTURE_FAILED, handle->user_data[MUSE_PLAYER_EVENT_TYPE_ERROR]);
+               if (handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_ERROR])
+                       ((legacy_player_error_cb)handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_ERROR]) \
+                                       (PLAYER_ERROR_VIDEO_CAPTURE_FAILED, handle->user_data[LEGACY_PLAYER_CALLBACK_TYPE_ERROR]);
                break;
        case MM_MESSAGE_VIDEO_CAPTURED: /* 0x110 */
        {
                mmplayer_video_capture_t *capture = (mmplayer_video_capture_t *)msg->data;
 
-               if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE]) {
+               if (handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_CAPTURE]) {
                        if (!capture || !capture->data) {
                                LOGE("PLAYER_ERROR_VIDEO_CAPTURE_FAILED : Failed to get capture data");
                                err_code = PLAYER_ERROR_VIDEO_CAPTURE_FAILED;
@@ -451,12 +459,12 @@ static int __lplayer_message_callback(int message, void *param, void *user_data)
                                                        capture->orientation, capture->width, capture->height, capture->size);
 
                                /* call application callback */
-                               ((legacy_player_video_captured_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE])(capture->data, \
-                                               capture->width, capture->height, capture->size, handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE]);
+                               ((legacy_player_video_captured_cb)handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_CAPTURE])(capture->data, \
+                                               capture->width, capture->height, capture->size, handle->user_data[LEGACY_PLAYER_CALLBACK_TYPE_CAPTURE]);
                        }
 
-                       handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
-                       handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
+                       handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_CAPTURE] = NULL;
+                       handle->user_data[LEGACY_PLAYER_CALLBACK_TYPE_CAPTURE] = NULL;
                }
 
                /* capure->data have to be released to avoid mem leak in all cases. */
@@ -484,16 +492,15 @@ static int __lplayer_message_callback(int message, void *param, void *user_data)
                }
 
                LOGD("Seek is completed");
-               __lplayer_default_callback(handle, MUSE_PLAYER_EVENT_TYPE_SEEK);
-               handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
-               handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
+               __lplayer_default_callback(handle, LEGACY_PLAYER_CALLBACK_TYPE_SEEK);
+               __lplayer_unset_callback(handle, LEGACY_PLAYER_CALLBACK_TYPE_SEEK, false);
                break;
        case MM_MESSAGE_PLAY_POSITION:
                LOGI("MM_MESSAGE_PLAY_POSITION (%"PRId64" ns)", msg->time.elapsed);
                handle->last_play_position = msg->time.elapsed;
                break;
        case MM_MESSAGE_VIDEO_STREAM_CHANGED:
-               if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED])
+               if (handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_VIDEO_STREAM_CHANGED])
                        __lplayer_video_stream_changed_callback(handle);
                break;
        case MM_MESSAGE_PUSH_BUFFER_STATUS:
@@ -501,10 +508,10 @@ static int __lplayer_message_callback(int message, void *param, void *user_data)
                break;
        case MM_MESSAGE_PUSH_BUFFER_SEEK_DATA:
        {
-               muse_player_event_e event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK;
+               legacy_player_callback_type_e event_type = LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_VIDEO_SEEK;
 
                if (msg->seek_data.stream_type == MM_PLAYER_STREAM_TYPE_AUDIO)
-                       event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK;
+                       event_type = LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_AUDIO_SEEK;
 
                if (handle->user_cb[event_type])
                        ((legacy_player_media_stream_seek_cb)handle->user_cb[event_type])(event_type, msg->seek_data.offset, handle->user_data[event_type]);
@@ -522,10 +529,10 @@ static int __lplayer_message_callback(int message, void *param, void *user_data)
                break;
        }
 
-       if (err_code != PLAYER_ERROR_NONE && handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR]) {
+       if (err_code != PLAYER_ERROR_NONE && handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_ERROR]) {
                handle->error_code = err_code;
                LOGE("ERROR is occurred 0x%X", err_code);
-               ((legacy_player_error_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR])(err_code, handle->user_data[MUSE_PLAYER_EVENT_TYPE_ERROR]);
+               ((legacy_player_error_cb)handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_ERROR])(err_code, handle->user_data[LEGACY_PLAYER_CALLBACK_TYPE_ERROR]);
        }
 
        LPLAYER_FLEAVE();
@@ -547,22 +554,22 @@ static MMDisplaySurfaceType __lplayer_convert_display_type(player_display_type_e
        }
 }
 
-static int __lplayer_check_callback_precondition(legacy_player_t *handle, muse_player_event_e type, bool set)
+static int __lplayer_check_callback_precondition(legacy_player_t *handle, legacy_player_callback_type_e type, bool set)
 {
        int i = 0;
        int size = 0;
        player_internal_state_e cb_state = PLAYER_INTERNAL_STATE_NONE;
 
        legacy_player_callback_pre_state_t callback_pre_state[] = {
-               {MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME,                                       PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_IDLE},
-               {MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME,                                       PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_IDLE},
-               {MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS,                       PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
-               {MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS,                       PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
-               {MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO,     PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
-               {MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO,     PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
-               {MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK,                                        PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
-               {MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK,                                        PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
-               {MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED,                                           PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
+               {LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_PACKET_VIDEO_FRAME,                                  PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_IDLE},
+               {LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_PACKET_AUDIO_FRAME,                                  PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_IDLE},
+               {LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS,                  PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
+               {LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS,                  PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
+               {LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO,        PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
+               {LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO,        PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
+               {LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_VIDEO_SEEK,                                   PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
+               {LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_STREAM_AUDIO_SEEK,                                   PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
+               {LEGACY_PLAYER_CALLBACK_TYPE_VIDEO_STREAM_CHANGED,                                              PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
        };
 
        size = sizeof(callback_pre_state)/sizeof(legacy_player_callback_pre_state_t);
@@ -590,8 +597,8 @@ static int
 __lplayer_set_buffer_export_callback(legacy_player_t *handle)
 {
        int ret = MM_ERROR_NONE;
-       muse_player_event_e video_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME;
-       muse_player_event_e audio_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME;
+       legacy_player_callback_type_e video_type = LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_PACKET_VIDEO_FRAME;
+       legacy_player_callback_type_e audio_type = LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_PACKET_AUDIO_FRAME;
 
        if (handle->user_cb[video_type])
                ret = mm_player_set_video_decoded_callback(handle->mm_handle,
@@ -670,6 +677,7 @@ int legacy_player_create(legacy_player_h *player)
 {
        legacy_player_t *handle;
        int ret = MM_ERROR_NONE;
+       legacy_player_callback_type_e type = LEGACY_PLAYER_CALLBACK_TYPE_PREPARE;
 
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_TRACE_BEGIN("MM:PLAYER:CREATE");
@@ -688,15 +696,13 @@ int legacy_player_create(legacy_player_h *player)
                return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
        }
 
-       muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_PREPARE;
-
        *player = (legacy_player_h)handle;
        __lplayer_update_state(handle, PLAYER_INTERNAL_STATE_IDLE);
        handle->display_type = PLAYER_DISPLAY_TYPE_NONE;
        handle->is_display_visible = true;
        handle->is_media_stream = false;
 
-       for (type = MUSE_PLAYER_EVENT_TYPE_PREPARE; type < MUSE_PLAYER_EVENT_TYPE_NUM; type++) {
+       for (type = LEGACY_PLAYER_CALLBACK_TYPE_PREPARE; type < LEGACY_PLAYER_CALLBACK_TYPE_NUM; type++) {
                if (__lplayer_check_enabled_user_cb_lock(type))
                        g_mutex_init(&handle->user_cb_lock[type]);
        }
@@ -710,6 +716,7 @@ int legacy_player_destroy(legacy_player_h player)
 {
        legacy_player_t *handle = (legacy_player_t *)player;
        int ret = MM_ERROR_NONE;
+       legacy_player_callback_type_e type = LEGACY_PLAYER_CALLBACK_TYPE_PREPARE;
 
        LOGI("<Enter: %p>", player);
        PLAYER_TRACE_BEGIN("MM:PLAYER:DESTROY");
@@ -717,13 +724,7 @@ int legacy_player_destroy(legacy_player_h player)
 
        handle->is_shutdown = true;
 
-       L_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
-       if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
-               handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
-               g_free(handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE]);
-               handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
-       }
-       L_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
+       __lplayer_unset_callback(handle, LEGACY_PLAYER_CALLBACK_TYPE_PREPARE, true);
 
        /* stop the pause state trasition to release prepare thread */
        if (handle->internal_state == PLAYER_INTERNAL_STATE_PRE_READY)
@@ -738,11 +739,9 @@ int legacy_player_destroy(legacy_player_h player)
        }
        LOGI("Done mm_player_destroy");
 
-       muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_PREPARE;
-
        __lplayer_update_state(handle, PLAYER_INTERNAL_STATE_NONE);
 
-       for (type = MUSE_PLAYER_EVENT_TYPE_PREPARE; type < MUSE_PLAYER_EVENT_TYPE_NUM; type++) {
+       for (type = LEGACY_PLAYER_CALLBACK_TYPE_PREPARE; type < LEGACY_PLAYER_CALLBACK_TYPE_NUM; type++) {
                if (__lplayer_check_enabled_user_cb_lock(type))
                        g_mutex_clear(&handle->user_cb_lock[type]);
        }
@@ -787,7 +786,8 @@ static void *__lplayer_prepare_async_thread_func(void *data)
 int legacy_player_prepare_async(legacy_player_h player, legacy_player_prepared_cb callback, void *user_data)
 {
        legacy_player_t *handle = (legacy_player_t *)player;
-       int ret = MM_ERROR_NONE;
+       int ret = PLAYER_ERROR_NONE;
+       int mm_ret = MM_ERROR_NONE;
        int visible = 0;
        int value = 0;
 
@@ -797,88 +797,87 @@ int legacy_player_prepare_async(legacy_player_h player, legacy_player_prepared_c
        PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
 
        __lplayer_update_state(handle, PLAYER_INTERNAL_STATE_PRE_READY);
-       L_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
+       L_PLAYER_USER_CB_LOCK(handle, LEGACY_PLAYER_CALLBACK_TYPE_PREPARE);
 
        handle->last_play_position = 0;
-       if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
+       if (handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_PREPARE]) {
                LOGE("player is already prepareing");
-               L_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
+               L_PLAYER_USER_CB_UNLOCK(handle, LEGACY_PLAYER_CALLBACK_TYPE_PREPARE);
                __lplayer_update_state(handle, PLAYER_INTERNAL_STATE_IDLE);
                return PLAYER_ERROR_INVALID_OPERATION;
        }
 
-       /* LOGI("Event type : %d ", MUSE_PLAYER_EVENT_TYPE_PREPARE); */
-       handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE] = callback;
-       handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = user_data;
+       handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_PREPARE] = callback;
+       handle->user_data[LEGACY_PLAYER_CALLBACK_TYPE_PREPARE] = user_data;
 
-       L_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
+       L_PLAYER_USER_CB_UNLOCK(handle, LEGACY_PLAYER_CALLBACK_TYPE_PREPARE);
 
-       ret = mm_player_set_message_callback(handle->mm_handle, __lplayer_message_callback, (void *)handle);
-       if (ret != MM_ERROR_NONE)
-               LOGW("Failed to set message callback function (0x%x)", ret);
+       mm_ret = mm_player_set_message_callback(handle->mm_handle, __lplayer_message_callback, (void *)handle);
+       if (mm_ret != MM_ERROR_NONE) {
+               LOGE("failed to set message callback function (0x%x)", mm_ret);
+               goto ERROR;
+       }
 
-       ret = __lplayer_set_buffer_export_callback(handle);
-       if (ret != MM_ERROR_NONE) {
-               LOGW("Failed to set buffer export callback function (0x%x)", ret);
-               return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
+       mm_ret = __lplayer_set_buffer_export_callback(handle);
+       if (mm_ret != MM_ERROR_NONE) {
+               LOGE("failed to set buffer export callback function (0x%x)", mm_ret);
+               goto ERROR;
        }
 
        if (handle->display_type == PLAYER_DISPLAY_TYPE_NONE) {
-               ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_surface_type", MM_DISPLAY_SURFACE_NULL, (char *)NULL);
-               if (ret != MM_ERROR_NONE)
-                       LOGW("Failed to set display surface type 'MM_DISPLAY_SURFACE_NULL' (0x%x)", ret);
+               mm_ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_surface_type", MM_DISPLAY_SURFACE_NULL, (char *)NULL);
+               if (mm_ret != MM_ERROR_NONE) {
+                       LOGW("failed to set none display type (0x%x)", mm_ret);
+                       goto ERROR;
+               }
        } else {
 
                /* FIXME : new funct path is needed to update video instead of set attr again */
-               ret = mm_player_get_attribute(handle->mm_handle, NULL, "display_visible", &visible, (char *)NULL);
-               if (ret != MM_ERROR_NONE) goto ERROR;
+               mm_ret = mm_player_get_attribute(handle->mm_handle, NULL, "display_visible", &visible, (char *)NULL);
+               if (mm_ret != MM_ERROR_NONE) {
+                       LOGE("failed to get display visible attr");
+                       goto ERROR;
+               }
 
                if (!visible)
                        value = FALSE;
                else
                        value = TRUE;
 
-               ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", value, (char *)NULL);
-               if (ret != MM_ERROR_NONE) goto ERROR;
+               mm_ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", value, (char *)NULL);
+               if (mm_ret != MM_ERROR_NONE) {
+                       LOGE("failed to set display visible attr");
+                       goto ERROR;
+               }
        }
 
-       ret = mm_player_realize(handle->mm_handle);
-       if (ret != MM_ERROR_NONE) {
-               LOGE("Failed to realize - 0x%x", ret);
+       mm_ret = mm_player_realize(handle->mm_handle);
+       if (mm_ret != MM_ERROR_NONE) {
+               LOGE("failed to realize - 0x%x", mm_ret);
                goto ERROR;
        }
 
-       ret = pthread_create(&handle->prepare_async_thread, NULL, (void *)__lplayer_prepare_async_thread_func, (void *)handle);
-
-       if (ret != 0) {
-               LOGE("Failed to create thread ret = %d", ret);
-               L_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
-               if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
-                       handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
-                       /* user_data will be free at player_disp_prepare_async() */
-                       handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
-               }
-               L_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
-               __lplayer_update_state(handle, PLAYER_INTERNAL_STATE_IDLE);
-               return PLAYER_ERROR_OUT_OF_MEMORY;
+       if (pthread_create(&handle->prepare_async_thread, NULL,
+                       (void *)__lplayer_prepare_async_thread_func, (void *)handle) != 0) {
+               LOGE("failed to create thread for async prepare");
+               ret = PLAYER_ERROR_INVALID_OPERATION;
+               goto ERROR_WITH_RETURN_VALUE;
        }
 
        LPLAYER_FLEAVE();
        return PLAYER_ERROR_NONE;
 
 ERROR:
-       LOGW("prepare cb is released");
-       L_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
-       if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
-               handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
-               /* user_data will be free at player_disp_prepare_async() */
-               handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
-       }
-       L_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
+       if (mm_ret != MM_ERROR_NONE)
+               ret =_lplayer_convert_error_code(mm_ret, (char *)__FUNCTION__);
+
+ERROR_WITH_RETURN_VALUE:
+       /* callback user_data will be free at player_disp_prepare_async() */
+       __lplayer_unset_callback(handle, LEGACY_PLAYER_CALLBACK_TYPE_PREPARE, false);
        __lplayer_update_state(handle, PLAYER_INTERNAL_STATE_IDLE);
 
-       LOGE("LEAVE 0x%X", ret);
-       return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
+       LPLAYER_FLEAVE();
+       return ret;
 }
 
 int legacy_player_prepare(legacy_player_h player)
@@ -958,24 +957,13 @@ int legacy_player_unprepare(legacy_player_h player)
        handle->is_shutdown = true;
 
        /* Initialize the setting regardless of error return */
-       if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK]) {
-               handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
-               handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
-       }
+       __lplayer_unset_callback(handle, LEGACY_PLAYER_CALLBACK_TYPE_SEEK, false);
 
-       if (!_lplayer_state_validate(handle, PLAYER_STATE_READY) && !handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
+       if (!_lplayer_state_validate(handle, PLAYER_STATE_READY) && !handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_PREPARE]) {
                LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
                return PLAYER_ERROR_INVALID_STATE;
        }
-
-       L_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
-       if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
-               LOGW("Need to check. prepare cb have to be reset before");
-               handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
-               g_free(handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE]);
-               handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
-       }
-       L_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
+       __lplayer_unset_callback(handle, LEGACY_PLAYER_CALLBACK_TYPE_PREPARE, true);
 
        /* stop the pause state trasition to release prepare thread */
        if (handle->internal_state == PLAYER_INTERNAL_STATE_PRE_READY)
@@ -1069,38 +1057,6 @@ int legacy_player_get_volume(legacy_player_h player, float *volume)
        return PLAYER_ERROR_NONE;
 }
 
-int legacy_player_set_sound_stream_info(legacy_player_h player, sound_stream_info_h stream_info)
-{
-       legacy_player_t *handle = (legacy_player_t *)player;
-       int ret = MM_ERROR_NONE;
-       bool is_available = false;
-       PLAYER_INSTANCE_CHECK(player);
-       PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
-
-       /* check if stream_info is valid */
-       ret = sound_manager_is_available_stream_information(stream_info, NATIVE_API_PLAYER, &is_available);
-       if (ret != MM_ERROR_NONE)
-               return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
-
-       if (is_available) {
-               char *stream_type = NULL;
-               int stream_index = 0;
-               ret = sound_manager_get_type_from_stream_information(stream_info, &stream_type);
-               ret = sound_manager_get_index_from_stream_information(stream_info, &stream_index);
-               if (ret == SOUND_MANAGER_ERROR_NONE)
-                       ret = mm_player_set_sound_stream_info(handle->mm_handle, stream_type, stream_index);
-               else
-                       ret = MM_ERROR_PLAYER_INTERNAL;
-       } else {
-               ret = MM_ERROR_NOT_SUPPORT_API;
-       }
-
-       if (ret != MM_ERROR_NONE)
-               return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
-
-       return PLAYER_ERROR_NONE;
-}
-
 int legacy_player_set_audio_latency_mode(legacy_player_h player, audio_latency_mode_e latency_mode)
 {
        legacy_player_t *handle = (legacy_player_t *)player;
@@ -1193,11 +1149,7 @@ int legacy_player_stop(legacy_player_h player)
                        return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
                }
 
-               if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK]) {
-                       handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
-                       handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
-               }
-
+               __lplayer_unset_callback(handle, LEGACY_PLAYER_CALLBACK_TYPE_SEEK, false);
                __lplayer_update_state(handle, PLAYER_INTERNAL_STATE_STOPPED);
 
                LPLAYER_FLEAVE();
@@ -1242,14 +1194,14 @@ int legacy_player_set_play_position(legacy_player_h player, int64_t nanoseconds,
                return PLAYER_ERROR_INVALID_STATE;
        }
 
-       if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] && !handle->is_media_stream) {
+       if (handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_SEEK] && !handle->is_media_stream) {
                LOGE("previous seeking request is in processing.");
                return PLAYER_ERROR_SEEK_FAILED;
        }
 
-       LOGI("Event type : %d, pos : %"PRId64, MUSE_PLAYER_EVENT_TYPE_SEEK, nanoseconds);
-       handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = callback;
-       handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = user_data;
+       LOGI("Event type : %d, pos : %"PRId64, LEGACY_PLAYER_CALLBACK_TYPE_SEEK, nanoseconds);
+       handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_SEEK] = callback;
+       handle->user_data[LEGACY_PLAYER_CALLBACK_TYPE_SEEK] = user_data;
 
        ret = mm_player_set_attribute(handle->mm_handle, NULL, "accurate_seek", accurated, (char *)NULL);
        if (ret != MM_ERROR_NONE)
@@ -1257,8 +1209,8 @@ int legacy_player_set_play_position(legacy_player_h player, int64_t nanoseconds,
 
        ret = mm_player_set_position(handle->mm_handle, nanoseconds);
        if (ret != MM_ERROR_NONE) {
-               handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
-               handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
+               handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_SEEK] = NULL;
+               handle->user_data[LEGACY_PLAYER_CALLBACK_TYPE_SEEK] = NULL;
                return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
        }
 
@@ -1901,37 +1853,30 @@ int legacy_player_capture_video(legacy_player_h player, legacy_player_video_capt
        LPLAYER_FENTER();
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(callback);
-       if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE]) {
+
+       if (!_lplayer_state_validate(handle, PLAYER_STATE_PLAYING)) {
+               LOGE("invalid state error, current state - %d", handle->state);
+               return PLAYER_ERROR_INVALID_STATE;
+       }
+
+       if (handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_CAPTURE]) {
                LOGE("previous capturing request is in processing.");
                return PLAYER_ERROR_VIDEO_CAPTURE_FAILED;
        }
 
-       LOGI("Event type : %d ", MUSE_PLAYER_EVENT_TYPE_CAPTURE);
-       handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = callback;
-       handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = user_data;
+       LOGI("Event type : %d ", LEGACY_PLAYER_CALLBACK_TYPE_CAPTURE);
+       handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_CAPTURE] = callback;
+       handle->user_data[LEGACY_PLAYER_CALLBACK_TYPE_CAPTURE] = user_data;
 
-       if (handle->state >= PLAYER_STATE_READY) {
-               ret = mm_player_do_video_capture(handle->mm_handle);
-               if (ret == MM_ERROR_PLAYER_NO_OP) {
-                       handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
-                       handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
-                       LOGE("PLAYER_ERROR_INVALID_OPERATION : video display must be set : %d", handle->display_type);
-                       return PLAYER_ERROR_INVALID_OPERATION;
-               }
-               if (ret != MM_ERROR_NONE) {
-                       handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
-                       handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
-                       return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
-               }
-               return PLAYER_ERROR_NONE;
+       ret = mm_player_do_video_capture(handle->mm_handle);
+       if (ret != MM_ERROR_NONE) {
+               LOGE("failed to capture video 0x%X", ret);
+               __lplayer_unset_callback(handle, LEGACY_PLAYER_CALLBACK_TYPE_CAPTURE, false);
+               return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
        }
 
-       LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
-       handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
-       handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
-
        LPLAYER_FLEAVE();
-       return PLAYER_ERROR_INVALID_STATE;
+       return PLAYER_ERROR_NONE;
 }
 
 int legacy_player_set_streaming_cookie(legacy_player_h player, const char *cookie, int size)
@@ -1984,7 +1929,7 @@ int legacy_player_get_streaming_download_progress(legacy_player_h player, int *s
        return PLAYER_ERROR_NONE;
 }
 
-int legacy_player_set_callback(legacy_player_h player, muse_player_event_e type, void *callback, void *user_data)
+int legacy_player_set_callback(legacy_player_h player, legacy_player_callback_type_e type, void *callback, void *user_data)
 {
        int ret = PLAYER_ERROR_NONE;
        legacy_player_t *handle = (legacy_player_t *)player;
@@ -2009,9 +1954,9 @@ int legacy_player_set_callback(legacy_player_h player, muse_player_event_e type,
        return PLAYER_ERROR_NONE;
 }
 
-int legacy_player_unset_callback(legacy_player_h player, muse_player_event_e type)
+int legacy_player_unset_callback(legacy_player_h player, legacy_player_callback_type_e type)
 {
-       int ret = MM_ERROR_NONE;
+       int ret = PLAYER_ERROR_NONE;
        legacy_player_t *handle = (legacy_player_t *)player;
        PLAYER_INSTANCE_CHECK(player);
 
@@ -2515,7 +2460,7 @@ int legacy_player_set_display(legacy_player_h player, player_display_type_e type
        return PLAYER_ERROR_NONE;
 }
 
-int legacy_player_set_sound_stream_info_for_mused(legacy_player_h player, char *stream_type, int stream_index)
+int legacy_player_set_sound_stream_info(legacy_player_h player, char *stream_type, int stream_index)
 {
        legacy_player_t *handle = (legacy_player_t *)player;
        int ret = MM_ERROR_NONE;
index 2d2b363..8848960 100644 (file)
@@ -22,7 +22,6 @@
 #include <mm.h>
 #include <mm_player.h>
 #include <mm_types.h>
-#include "muse_player.h"
 #include "legacy_player.h"
 #include "legacy_player_internal.h"
 #include "legacy_player_private.h"
index 37c5f18..aa11fb5 100644 (file)
@@ -1561,7 +1561,7 @@ int player_disp_set_sound_stream_info(muse_module_h module)
                                                                INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
-               ret = legacy_player_set_sound_stream_info_for_mused(muse_player->player_handle, stream_type, stream_index);
+               ret = legacy_player_set_sound_stream_info(muse_player->player_handle, stream_type, stream_index);
        } else {
                ret = PLAYER_ERROR_INVALID_OPERATION;
        }
index cffbf2e..74c4f73 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-player
 Summary:    A Media Player module for muse server
-Version:    0.2.122
+Version:    0.2.123
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0