[0.2.80] replace msg macro to reduce code size 09/180709/3 accepted/tizen/unified/20180611.015457 submit/tizen/20180605.085831 submit/tizen/20180607.021137
authorEunhae Choi <eunhae1.choi@samsung.com>
Fri, 1 Jun 2018 08:53:47 +0000 (17:53 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Mon, 4 Jun 2018 04:51:33 +0000 (13:51 +0900)
Change-Id: I43d57bb55cb8c77d482efa219d9390a658ccbf98

muse/include/muse_player_msg.h
muse/src/muse_player.c
muse/src/muse_player_dispatcher.c
packaging/mmsvc-player.spec

index e9b9729..332b05d 100644 (file)
@@ -58,6 +58,8 @@ typedef struct {
        int wl_window_height;
 } wl_win_msg_type;
 
+extern int _player_disp_send_msg(int send_fd, char* msg, int *tfd);
+
 /**
  * @brief Get value from Message.
  * @remarks Does NOT guarantee thread safe.
@@ -96,340 +98,21 @@ typedef struct {
        muse_core_msg_deserialize(#param, buf, NULL, NULL, MUSE_TYPE_ANY, param)
 
 /**
- * @brief Get value from Message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] buf string of message buffer. has key and value
- * @param[out] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] type# The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE)
- * @param[out] ret result of get value
- */
-#define player_msg_get2(buf, param1, type1, param2, type2, ret) \
-       do { \
-               muse_core_msg_parse_err_e __err__ = MUSE_MSG_PARSE_ERROR_NONE; \
-               void *__jobj__ = muse_core_msg_object_new(buf, NULL, &__err__); \
-               if (!__jobj__) { \
-                       LOGE("failed to get msg object. err:%d", __err__); \
-                       ret = FALSE; \
-               } else { \
-                       if (!muse_core_msg_object_get_value(#param1, __jobj__, MUSE_TYPE_##type1, &param1)) { \
-                               ret = FALSE; \
-                               LOGE("failed to get %s value", #param1); \
-                       } \
-                       if (ret && !muse_core_msg_object_get_value(#param2, __jobj__, MUSE_TYPE_##type2, &param2)) { \
-                               ret = FALSE; \
-                               LOGE("failed to get %s value", #param2); \
-                       } \
-                       muse_core_msg_object_free(__jobj__); \
-               } \
-       } while (0)
-
-/**
- * @brief Get value from Message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] buf string of message buffer. has key and value
- * @param[out] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] type# The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE)
- * @param[out] ret result of get value
- */
-#define player_msg_get3(buf, param1, type1, param2, type2, param3, type3, ret) \
-       do { \
-               muse_core_msg_parse_err_e __err__ = MUSE_MSG_PARSE_ERROR_NONE; \
-               void *__jobj__ = muse_core_msg_object_new(buf, NULL, &__err__); \
-               if (!__jobj__) { \
-                       LOGE("failed to get msg object. err:%d", __err__); \
-                       ret = FALSE; \
-               } else { \
-                       if (!muse_core_msg_object_get_value(#param1, __jobj__, MUSE_TYPE_##type1, &param1)) { \
-                               ret = FALSE; \
-                               LOGE("failed to get %s value", #param1); \
-                       } \
-                       if (ret && !muse_core_msg_object_get_value(#param2, __jobj__, MUSE_TYPE_##type2, &param2)) { \
-                               ret = FALSE; \
-                               LOGE("failed to get %s value", #param2); \
-                       } \
-                       if (ret && !muse_core_msg_object_get_value(#param3, __jobj__, MUSE_TYPE_##type3, &param3)) { \
-                               ret = FALSE; \
-                               LOGE("failed to get %s value", #param3); \
-                       } \
-                       muse_core_msg_object_free(__jobj__); \
-               } \
-       } while (0)
-
-/**
- * @brief Get value from Message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] buf string of message buffer. has key and value
- * @param[out] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] type# The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE)
- * @param[out] ret result of get value
- */
-#define player_msg_get4(buf, param1, type1, param2, type2, param3, type3, param4, type4, ret) \
-       do { \
-               muse_core_msg_parse_err_e __err__ = MUSE_MSG_PARSE_ERROR_NONE; \
-               void *__jobj__ = muse_core_msg_object_new(buf, NULL, &__err__); \
-               if (!__jobj__) { \
-                       LOGE("failed to get msg object. err:%d", __err__); \
-                       ret = FALSE; \
-               } else { \
-                       if (!muse_core_msg_object_get_value(#param1, __jobj__, MUSE_TYPE_##type1, &param1)) { \
-                               ret = FALSE; \
-                               LOGE("failed to get %s value", #param1); \
-                       } \
-                       if (ret && !muse_core_msg_object_get_value(#param2, __jobj__, MUSE_TYPE_##type2, &param2)) { \
-                               ret = FALSE; \
-                               LOGE("failed to get %s value", #param2); \
-                       } \
-                       if (ret && !muse_core_msg_object_get_value(#param3, __jobj__, MUSE_TYPE_##type3, &param3)) { \
-                               ret = FALSE; \
-                               LOGE("failed to get %s value", #param3); \
-                       } \
-                       if (ret && !muse_core_msg_object_get_value(#param4, __jobj__, MUSE_TYPE_##type4, &param4)) { \
-                               ret = FALSE; \
-                               LOGE("failed to get %s value", #param4); \
-                       } \
-                       muse_core_msg_object_free(__jobj__); \
-               } \
-       } while (0)
-
-/**
- * @brief Get value from Message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] buf string of message buffer. has key and value
- * @param[out] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] type# The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE)
- * @param[out] str_param the name of param is key, must be local pointer variable.
- * @param[out] ret result of get value
- */
-#define player_msg_get1_string(buf, param1, type1, str_param, ret) \
-       do { \
-               muse_core_msg_parse_err_e __err__ = MUSE_MSG_PARSE_ERROR_NONE; \
-               void *__jobj__ = muse_core_msg_object_new(buf, NULL, &__err__); \
-               if (!__jobj__) { \
-                       LOGE("failed to get msg object. err:%d", __err__); \
-                       ret = FALSE; \
-               } else { \
-                       if (!muse_core_msg_object_get_value(#param1, __jobj__, MUSE_TYPE_##type1, &param1)) { \
-                               LOGE("failed to get %s value", #param1); \
-                               ret = FALSE; \
-                       } \
-                       if (ret && !muse_core_msg_object_get_value(#str_param, __jobj__, MUSE_TYPE_STRING, str_param)) { \
-                               LOGE("failed to get %s value", #str_param); \
-                               ret = FALSE; \
-                       } \
-                       muse_core_msg_object_free(__jobj__); \
-               } \
-       } while (0)
-
-
-/**
- * @brief Get value from Message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] buf string of message buffer. has key and value
- * @param[out] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] type# The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE)
- * @param[out] str_param the name of param is key, must be local pointer variable.
- * @param[out] ret result of get value
- */
-#define player_msg_get2_string(buf, param1, type1, param2, type2, str_param, ret) \
-       do { \
-               muse_core_msg_parse_err_e __err__ = MUSE_MSG_PARSE_ERROR_NONE; \
-               void *__jobj__ = muse_core_msg_object_new(buf, NULL, &__err__); \
-               if (!__jobj__) { \
-                       LOGE("failed to get msg object. err:%d", __err__); \
-                       ret = FALSE; \
-               } else { \
-                       if (!muse_core_msg_object_get_value(#param1, __jobj__, MUSE_TYPE_##type1, &param1)) { \
-                               LOGE("failed to get %s value", #param1); \
-                               ret = FALSE; \
-                       } \
-                       if (ret && !muse_core_msg_object_get_value(#param2, __jobj__, MUSE_TYPE_##type2, &param2)) { \
-                               LOGE("failed to get %s value", #param2); \
-                               ret = FALSE; \
-                       } \
-                       if (ret && !muse_core_msg_object_get_value(#str_param, __jobj__, MUSE_TYPE_STRING, str_param)) { \
-                               LOGE("failed to get %s value", #str_param); \
-                               ret = FALSE; \
-                       } \
-                       muse_core_msg_object_free(__jobj__); \
-               } \
-       } while (0)
-
-#define player_send_msg_with_no_return(fd, msg) \
-       do { \
-               int __len__ = 0; \
-               if ((fd != MM_ERROR_INVALID_ARGUMENT) && muse_core_fd_is_valid(fd)) {   \
-                       __len__ = muse_core_msg_send(fd, msg); \
-                       if (__len__ <= 0) \
-                               LOGE("sending message failed"); \
-               } else {        \
-                       LOGE("get msg fd failed");      \
-               }       \
-       } while (0)
-
-#define player_send_msg(fd, msg, ret) \
-       do { \
-               int __len__ = 0; \
-               if ((fd != MM_ERROR_INVALID_ARGUMENT) && muse_core_fd_is_valid(fd)) {   \
-                       __len__ = muse_core_msg_send(fd, msg); \
-                       if (__len__ <= 0) { \
-                               LOGE("sending message failed"); \
-                               ret = PLAYER_ERROR_INVALID_OPERATION; \
-                       } \
-               } else {        \
-                       LOGE("get msg fd failed");      \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               }       \
-       } while (0)
-
-#define player_send_msg_with_fd(fd, tfd, msg) \
-       do { \
-               int __len__ = 0; \
-               if ((fd > 0) && muse_core_fd_is_valid(fd)) {    \
-                       __len__ = muse_core_msg_send_fd(fd, tfd, msg); \
-                       if (__len__ <= 0) \
-                               LOGE("sending message failed"); \
-               } else {        \
-                       LOGE("get msg fd failed");      \
-               }       \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] ret Thre result of API.
- * @param[in] module mused module information
- */
-#define player_msg_return(api, ret, module) \
-       do {    \
-               char *__sndMsg__; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
-                               0); \
-               player_send_msg(muse_server_module_get_msg_fd(module), __sndMsg__, ret); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] ret Thre result of API.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param the name of param is key, must be local variable. never be pointer.
- */
-#define player_msg_return1(api, ret, module, type, param) \
-       do {    \
-               char *__sndMsg__; \
-               type __value__ = (type)param; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
-                               MUSE_TYPE_##type, #param, __value__, \
-                               0); \
-               player_send_msg(muse_server_module_get_msg_fd(module), __sndMsg__, ret); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] ret Thre result of API.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- */
-#define player_msg_return2(api, ret, module, type1, param1, type2, param2) \
-       do {    \
-               char *__sndMsg__; \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               0); \
-               player_send_msg(muse_server_module_get_msg_fd(module), __sndMsg__, ret); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] ret Thre result of API.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- */
-#define player_msg_return3(api, ret, module, type1, param1, type2, param2, type3, param3) \
-       do {    \
-               char *__sndMsg__; \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               type3 __value3__ = (type3)param3; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               MUSE_TYPE_##type3, #param3, __value3__, \
-                               0); \
-               player_send_msg(muse_server_module_get_msg_fd(module), __sndMsg__, ret); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
  * @brief Create and send return message.
  * @remarks Does NOT guarantee thread safe.
  * @param[in] api The enum of module API.
  * @param[in] ret Thre result of API.
  * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
+ * @param[in] variadic argument The argument information to create return msg
  */
-#define player_msg_return4(api, ret, module, type1, param1, type2, param2, type3, param3, type4, param4) \
-       do {    \
-               char *__sndMsg__; \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               type3 __value3__ = (type3)param3; \
-               type4 __value4__ = (type4)param4; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               MUSE_TYPE_##type3, #param3, __value3__, \
-                               MUSE_TYPE_##type4, #param4, __value4__, \
-                               0); \
-               player_send_msg(muse_server_module_get_msg_fd(module), __sndMsg__, ret); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] ret Thre result of API.
- * @param[in] module mused module information
- * @param[in] param the name of param is key, must be local array/pointer variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- */
-#define player_msg_return_array(api, ret, module, param, length, datum_size) \
-       do {    \
-               char *__sndMsg__; \
-               int *__value__ = (int *)param; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
-                               MUSE_TYPE_INT, #length, length, \
-                               MUSE_TYPE_ARRAY, #param, \
-                                       datum_size == sizeof(int) ? length :  \
-                                       length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
-                                       __value__, \
-                               0); \
-               player_send_msg(muse_server_module_get_msg_fd(module), __sndMsg__, ret); \
-               muse_core_msg_free(__sndMsg__); \
+#define PLAYER_RETURN_MSG(api, ret, module, ...) \
+       do { \
+               char *__msg__ = NULL; \
+               __msg__ = muse_core_msg_new(api, \
+                                       MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
+                                       ##__VA_ARGS__, 0); \
+               ret = _player_disp_send_msg(muse_server_module_get_msg_fd(module), __msg__, NULL); \
+               muse_core_msg_free(__msg__); \
        } while (0)
 
 /**
@@ -438,52 +121,19 @@ typedef struct {
  * @param[in] api The enum of module API.
  * @param[in] ret Thre result of API.
  * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] tfd the tbm_fd from tbm_bo_export_fd().
+ * @param[in] variadic argument The argument information to create return msg
  */
-#define player_msg_return2_fd(api, ret, module, type1, param1, type2, param2, tfd) \
+#define PLAYER_RETURN_MSG_WITH_TFD(api, ret, module, tfd, ...) \
        do { \
-               int __fd__; \
-               char *__sndMsg__; \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
+               char *__msg__ = NULL; \
                int __tfd__[MUSE_NUM_FD]; \
                memset(__tfd__, -1, sizeof(__tfd__)); \
                __tfd__[0] = tfd; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               0); \
-               __fd__ = muse_server_module_get_msg_fd(module); \
-               if (__fd__ > 0) {       \
-                       if (muse_core_msg_send_fd(__fd__, __tfd__, __sndMsg__) <= 0) { \
-                               LOGE("sending message failed"); \
-                               ret = PLAYER_ERROR_INVALID_OPERATION; \
-                       } \
-               } else {        \
-                       LOGE("get msg fd failed");      \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               }       \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- */
-#define player_msg_event(api, event, module) \
-       do {    \
-               char *__sndMsg__; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
-                               0); \
-               player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
+               __msg__ = muse_core_msg_new(api, \
+                                       MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
+                                       ##__VA_ARGS__, 0); \
+               ret = _player_disp_send_msg(muse_server_module_get_msg_fd(module), __msg__, __tfd__); \
+               muse_core_msg_free(__msg__); \
        } while (0)
 
 /**
@@ -492,145 +142,16 @@ typedef struct {
  * @param[in] api The enum of module API.
  * @param[in] event The event number.
  * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param the name of param is key, must be local variable. never be pointer.
+ * @param[in] variadic argument The argument information to create event msg
  */
-#define player_msg_event1(api, event, module, type, param) \
-       do {    \
-               char *__sndMsg__; \
-               type __value__ = (type)param; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
-                               MUSE_TYPE_##type, #param, __value__, \
-                               0); \
-               player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- */
-#define player_msg_event2(api, event, module, type1, param1, type2, param2) \
-       do {    \
-               char *__sndMsg__; \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               0); \
-               player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- */
-#define player_msg_event3(api, event, module, type1, param1, type2, param2, type3, param3) \
-       do {    \
-               char *__sndMsg__; \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               type3 __value3__ = (type3)param3; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               MUSE_TYPE_##type3, #param3, __value3__, \
-                               0); \
-               player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- */
-#define player_msg_event4(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4) \
-       do {    \
-               char *__sndMsg__; \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               type3 __value3__ = (type3)param3; \
-               type4 __value4__ = (type4)param4; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               MUSE_TYPE_##type3, #param3, __value3__, \
-                               MUSE_TYPE_##type4, #param4, __value4__, \
-                               0); \
-               player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] arr_param the name of param is key, must be local pointer/array variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- */
-#define player_msg_event_array(api, event, module, arr_param, length, datum_size) \
-       do {    \
-               char *__sndMsg__; \
-               int *__arr_value__ = (int *)arr_param; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
-                               MUSE_TYPE_INT, #length, length, \
-                               MUSE_TYPE_ARRAY, #arr_param, \
-                                       datum_size == sizeof(int) ? length :  \
-                                       length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
-                                       __arr_value__, \
-                               0); \
-               player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param the name of param is key, must be local variable. never be pointer.
- * @param[in] tfd the tbm_fd from tbm_bo_export_fd().
- */
-#define player_msg_event1_fd(api, event, module, type, param, tfd) \
-       do {    \
-               char *__sndMsg__; \
-               type __value__ = (type)param; \
-               int __tfd__[MUSE_NUM_FD]; \
-               memset(__tfd__, -1, sizeof(__tfd__)); \
-               __tfd__[0] = tfd; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
-                               MUSE_TYPE_##type, #param, __value__, \
-                               0); \
-               player_send_msg_with_fd(muse_server_module_get_msg_fd(module), __tfd__, __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
+#define PLAYER_SEND_EVENT_MSG(api, event, module, ...) \
+       do { \
+               char *__msg__ = NULL; \
+               __msg__ = muse_core_msg_new(api, \
+                                       MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
+                                       ##__VA_ARGS__, 0); \
+               _player_disp_send_msg(muse_server_module_get_msg_fd(module), __msg__, NULL); \
+               muse_core_msg_free(__msg__); \
        } while (0)
 
 /**
@@ -639,244 +160,30 @@ typedef struct {
  * @param[in] api The enum of module API.
  * @param[in] event The event number.
  * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
  * @param[in] tfd the tbm_fd from tbm_bo_export_fd().
+ * @param[in] variadic argument The argument information to create event msg
  */
-#define player_msg_event4_fd(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4, tfd) \
-       do {    \
-               char *__sndMsg__; \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               type3 __value3__ = (type3)param3; \
-               type4 __value4__ = (type4)param4; \
+#define PLAYER_SEND_EVENT_MSG_WITH_TFD(api, event, module, tfd, ...) \
+       do { \
+               char *__msg__ = NULL; \
                int __tfd__[MUSE_NUM_FD]; \
                memset(__tfd__, -1, sizeof(__tfd__)); \
                __tfd__[0] = tfd; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               MUSE_TYPE_##type3, #param3, __value3__, \
-                               MUSE_TYPE_##type4, #param4, __value4__, \
-                               0); \
-               player_send_msg_with_fd(muse_server_module_get_msg_fd(module), __tfd__, __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
+               __msg__ = muse_core_msg_new(api, \
+                                       MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
+                                       ##__VA_ARGS__, 0); \
+               _player_disp_send_msg(muse_server_module_get_msg_fd(module), __msg__, __tfd__); \
+               muse_core_msg_free(__msg__); \
        } while (0)
 
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] arr_param the name of param is key, must be local pointer/array variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- */
-#define player_msg_event1_array(api, event, module, type1, param1, arr_param, length, datum_size) \
-       do {    \
-               char *__sndMsg__; \
-               type1 __value1__ = (type1)param1; \
-               int *__arr_value__ = (int *)arr_param; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_INT, #length, length, \
-                               MUSE_TYPE_ARRAY, #arr_param, \
-                                       datum_size == sizeof(int) ? length :  \
-                                       length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
-                                       __arr_value__, \
-                               0); \
-               player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] arr_param the name of param is key, must be local pointer/array variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- */
-#define player_msg_event2_array(api, event, module, type1, param1, type2, param2, arr_param, length, datum_size) \
-       do {    \
-               char *__sndMsg__; \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               int *__arr_value__ = (int *)arr_param; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               MUSE_TYPE_INT, #length, length, \
-                               MUSE_TYPE_ARRAY, #arr_param, \
-                                       datum_size == sizeof(int) ? length :  \
-                                       length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
-                                       __arr_value__, \
-                               0); \
-               player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] arr_param the name of param is key, must be local array/pointer variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- */
-#define player_msg_event3_array(api, event, module, type1, param1, type2, param2, type3, param3,  arr_param, length, datum_size) \
-       do {    \
-               char *__sndMsg__; \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               type3 __value3__ = (type3)param3; \
-               int *__arr_value__ = (int *)arr_param; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               MUSE_TYPE_##type3, #param3, __value3__, \
-                               MUSE_TYPE_INT, #length, length, \
-                               MUSE_TYPE_ARRAY, #arr_param, \
-                                       datum_size == sizeof(int) ? length :  \
-                                       length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
-                                       __arr_value__, \
-                               0); \
-               player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] arr_param the name of param is key, must be local array/pointer variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- */
-#define player_msg_event4_array(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4, arr_param, length, datum_size) \
-       do {    \
-               char *__sndMsg__; \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               type3 __value3__ = (type3)param3; \
-               type4 __value4__ = (type4)param4; \
-               int *__arr_value__ = (int *)arr_param; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               MUSE_TYPE_##type3, #param3, __value3__, \
-                               MUSE_TYPE_##type4, #param4, __value4__, \
-                               MUSE_TYPE_INT, #length, length, \
-                               MUSE_TYPE_ARRAY, #arr_param, \
-                                       datum_size == sizeof(int) ? length :  \
-                                       length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
-                                       __arr_value__, \
-                               0); \
-               player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] arr_param the name of param is key, must be local array/pointer variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- */
-#define player_msg_event5_array(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4, type5, param5, arr_param, length, datum_size) \
-       do {    \
-               char *__sndMsg__; \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               type3 __value3__ = (type3)param3; \
-               type4 __value4__ = (type4)param4; \
-               type5 __value5__ = (type5)param5; \
-               int *__arr_value__ = (int *)arr_param; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               MUSE_TYPE_##type3, #param3, __value3__, \
-                               MUSE_TYPE_##type4, #param4, __value4__, \
-                               MUSE_TYPE_##type5, #param5, __value5__, \
-                               MUSE_TYPE_INT, #length, length, \
-                               MUSE_TYPE_ARRAY, #arr_param, \
-                                       datum_size == sizeof(int) ? length :  \
-                                       length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
-                                       __arr_value__, \
-                               0); \
-               player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] arr_param the name of param is key, must be local array/pointer variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- * @param[in] tfd the array of tbm_fd from tbm_bo_export_fd().
- */
-#define player_msg_event8_array_fd(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4, type5, param5, type6, param6, type7, param7, type8, param8, arr_param, length, datum_size, tfd) \
-       do {    \
-               char *__sndMsg__; \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               type3 __value3__ = (type3)param3; \
-               type4 __value4__ = (type4)param4; \
-               type5 __value5__ = (type5)param5; \
-               type6 __value6__ = (type6)param6; \
-               type7 __value7__ = (type7)param7; \
-               type8 __value8__ = (type8)param8; \
-               int *__arr_value__ = (int *)arr_param; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               MUSE_TYPE_##type3, #param3, __value3__, \
-                               MUSE_TYPE_##type4, #param4, __value4__, \
-                               MUSE_TYPE_##type5, #param5, __value5__, \
-                               MUSE_TYPE_##type6, #param6, __value6__, \
-                               MUSE_TYPE_##type7, #param7, __value7__, \
-                               MUSE_TYPE_##type8, #param8, __value8__, \
-                               MUSE_TYPE_INT, #length, length, \
-                               MUSE_TYPE_ARRAY, #arr_param, \
-                                       datum_size == sizeof(int) ? length :  \
-                                       length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
-                                       __arr_value__, \
-                               0); \
-               player_send_msg_with_fd(muse_server_module_get_msg_fd(module), tfd, __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
+#define PLAYER_SEND_EVENT_MSG_WITH_TFDS(api, event, module, tfds, ...) \
+       do { \
+               char *__msg__ = NULL; \
+               __msg__ = muse_core_msg_new(api, \
+                                       MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
+                       ##__VA_ARGS__, 0); \
+               _player_disp_send_msg(muse_server_module_get_msg_fd(module), __msg__, tfds); \
+               muse_core_msg_free(__msg__); \
        } while (0)
 
 /**
@@ -884,13 +191,13 @@ typedef struct {
  * @remarks Does NOT guarantee thread safe.
  * @param[in] module mused module information
  */
-#define player_msg_create_ack(module) \
+#define PLAYER_SEND_CREATE_ACK(module) \
        do {    \
-               char *__sndMsg__; \
-               __sndMsg__ = muse_core_msg_new(MUSE_PLAYER_CB_CREATE_ACK, \
+               char *__msg__; \
+               __msg__ = muse_core_msg_new(MUSE_PLAYER_CB_CREATE_ACK, \
                                        0); \
-               player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
+               _player_disp_send_msg(muse_server_module_get_msg_fd(module), __msg__, NULL); \
+               muse_core_msg_free(__msg__); \
        } while (0)
 
 
index b5d1065..335bd33 100644 (file)
@@ -49,6 +49,8 @@
 #define EXTERNAL_STORAGE_PRIVILEGE_NAME "http://tizen.org/privilege/externalstorage"
 #define INTERNET_PRIVILEGE_NAME         "http://tizen.org/privilege/internet"
 #define NUM_OF_URI_PREFIX 7
+#define INVALID_MUSE_TYPE_VALUE 0
+
 static const char *uri_prefix[NUM_OF_URI_PREFIX] = {
        "http://",
        "https://",
@@ -499,7 +501,7 @@ static void _prepare_async_cb(void *user_data)
                LOGD("num of vdec out buffer, total:%d, extra:%d", num, extra_num);
        }
 
-       player_msg_event(api, ev, module);
+       PLAYER_SEND_EVENT_MSG(api, ev, module);
 }
 
 static void __player_callback(muse_player_event_e ev, muse_module_h module)
@@ -508,7 +510,7 @@ static void __player_callback(muse_player_event_e ev, muse_module_h module)
 
        LOGD("ENTER");
 
-       player_msg_event(api, ev, module);
+       PLAYER_SEND_EVENT_MSG(api, ev, module);
 }
 
 static void _seek_complate_cb(void *user_data)
@@ -577,7 +579,9 @@ static void _capture_video_cb(unsigned char *data, int width, int height, unsign
                return;
        }
 
-       player_msg_event4_fd(api, ev, module, INT, width, INT, height, INT, size, INT, key, tfd);
+       PLAYER_SEND_EVENT_MSG_WITH_TFD(api, ev, module, tfd,
+                       MUSE_TYPE_INT, "width", width, MUSE_TYPE_INT, "height", height,
+                       MUSE_TYPE_INT, "size", (int)size, MUSE_TYPE_INT, "key", key);
        return;
 }
 
@@ -589,7 +593,7 @@ static void _pd_msg_cb(player_pd_message_type_e type, void *user_data)
 
        LOGD("ENTER");
 
-       player_msg_event1(api, ev, module, INT, type);
+       PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "type", (int)type);
 }
 
 static int _get_tbm_surface_format(int in_format, uint32_t *out_format)
@@ -724,6 +728,7 @@ static bool __video_decoded_callback(void *video_data, void *user_data)
        bool ret_val = false;
        uint64_t pts = 0;
        int orientation = 0;
+       int msg_len = 0;
 
        memset(&sinfo, 0, sizeof(tbm_surface_info_s));
        memset(tfd, INVALID_DEFAULT_VALUE, sizeof(tfd));
@@ -803,7 +808,13 @@ static bool __video_decoded_callback(void *video_data, void *user_data)
        muse_player->video_data_list = g_list_append(muse_player->video_data_list, (gpointer)video_data);
        g_mutex_unlock(&muse_player->list_lock);
 
-       player_msg_event8_array_fd(api, ev, module, INT, key[0], INT, key[1], INT, key[2], INT, key[3], POINTER, v_data, INT, mimetype, INT64, pts, INT, orientation, surface_info, surface_info_size, sizeof(char), tfd);
+       msg_len = (surface_info_size/sizeof(int) + (surface_info_size%sizeof(int) ? 1 : 0));
+       PLAYER_SEND_EVENT_MSG_WITH_TFDS(api, ev, module, tfd,
+               MUSE_TYPE_INT, "key[0]", key[0], MUSE_TYPE_INT, "key[1]", key[1],
+               MUSE_TYPE_INT, "key[2]", key[2], MUSE_TYPE_INT, "key[3]", key[3],
+               MUSE_TYPE_POINTER, "v_data", v_data, MUSE_TYPE_INT, "mimetype", (int)mimetype,
+               MUSE_TYPE_INT64, "pts", (INT64)pts, MUSE_TYPE_INT, "orientation", orientation,
+               MUSE_TYPE_ARRAY, "surface_info", msg_len, surface_info);
 
        ret_val = true;
 ERROR:
@@ -822,7 +833,9 @@ static void _video_stream_changed_cb(int width, int height, int fps, int bit_rat
        muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED;
        muse_module_h module = (muse_module_h)user_data;
 
-       player_msg_event4(api, ev, module, INT, width, INT, height, INT, fps, INT, bit_rate);
+       PLAYER_SEND_EVENT_MSG(api, ev, module,
+                       MUSE_TYPE_INT, "width", width, MUSE_TYPE_INT, "height", height,
+                       MUSE_TYPE_INT, "fps", fps, MUSE_TYPE_INT, "bit_rate", bit_rate);
 }
 
 static void _media_stream_audio_buffer_status_cb(player_media_stream_buffer_status_e status, void *user_data)
@@ -831,7 +844,7 @@ static void _media_stream_audio_buffer_status_cb(player_media_stream_buffer_stat
        muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS;
        muse_module_h module = (muse_module_h)user_data;
 
-       player_msg_event1(api, ev, module, INT, status);
+       PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "status", (int)status);
 }
 
 static void _media_stream_video_buffer_status_cb(player_media_stream_buffer_status_e status, void *user_data)
@@ -840,7 +853,7 @@ static void _media_stream_video_buffer_status_cb(player_media_stream_buffer_stat
        muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS;
        muse_module_h module = (muse_module_h)user_data;
 
-       player_msg_event1(api, ev, module, INT, status);
+       PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "status", (int)status);
 }
 
 static void _media_stream_audio_buffer_status_cb_ex(player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data)
@@ -849,7 +862,8 @@ static void _media_stream_audio_buffer_status_cb_ex(player_media_stream_buffer_s
        muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO;
        muse_module_h module = (muse_module_h)user_data;
 
-       player_msg_event2(api, ev, module, INT, status, INT64, bytes);
+       PLAYER_SEND_EVENT_MSG(api, ev, module,
+                       MUSE_TYPE_INT, "status", (int)status, MUSE_TYPE_INT64, "bytes", (INT64)bytes);
 }
 
 static void _media_stream_video_buffer_status_cb_ex(player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data)
@@ -858,7 +872,8 @@ static void _media_stream_video_buffer_status_cb_ex(player_media_stream_buffer_s
        muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO;
        muse_module_h module = (muse_module_h)user_data;
 
-       player_msg_event2(api, ev, module, INT, status, INT64, bytes);
+       PLAYER_SEND_EVENT_MSG(api, ev, module,
+                       MUSE_TYPE_INT, "status", (int)status, MUSE_TYPE_INT64, "bytes", (INT64)bytes);
 }
 
 static void _media_stream_audio_seek_cb(unsigned long long offset, void *user_data)
@@ -867,7 +882,7 @@ static void _media_stream_audio_seek_cb(unsigned long long offset, void *user_da
        muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK;
        muse_module_h module = (muse_module_h)user_data;
 
-       player_msg_event1(api, ev, module, INT64, offset);
+       PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT64, "offset", (INT64)offset);
 }
 
 static void _media_stream_video_seek_cb(unsigned long long offset, void *user_data)
@@ -876,7 +891,7 @@ static void _media_stream_video_seek_cb(unsigned long long offset, void *user_da
        muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK;
        muse_module_h module = (muse_module_h)user_data;
 
-       player_msg_event1(api, ev, module, INT64, offset);
+       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)
@@ -887,7 +902,7 @@ static void _interrupted_cb(player_interrupted_code_e code, void *user_data)
 
        LOGD("ENTER");
 
-       player_msg_event1(api, ev, module, INT, code);
+       PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "code", (int)code);
 }
 
 static void _set_interrupted_cb(player_h player, void *module, bool set)
@@ -906,7 +921,7 @@ static void _error_cb(int code, void *user_data)
 
        LOGD("ENTER");
 
-       player_msg_event1(api, ev, module, INT, code);
+       PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "code", code);
 }
 
 static void _set_error_cb(player_h player, void *module, bool set)
@@ -925,7 +940,8 @@ static void _subtitle_updated_cb(unsigned long duration, char *text, void *user_
 
        LOGD("ENTER");
 
-       player_msg_event2(api, ev, module, INT, duration, STRING, text);
+       PLAYER_SEND_EVENT_MSG(api, ev, module,
+                       MUSE_TYPE_INT, "duration", (int)duration, MUSE_TYPE_STRING, "text", (const char*)text);
 }
 
 static void _set_subtitle_cb(player_h player, void *module, bool set)
@@ -944,7 +960,7 @@ static void _buffering_cb(int percent, void *user_data)
 
        LOGD("ENTER");
 
-       player_msg_event1(api, ev, module, INT, percent);
+       PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "percent", percent);
 
 }
 
@@ -966,7 +982,7 @@ static void _set_pd_msg_cb(player_h player, void *module, bool set)
        else
                ret = legacy_player_unset_progressive_download_message_cb(player);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 }
 
 static void _set_media_packet_video_frame_cb(player_h player, void *data, bool set)
@@ -985,7 +1001,7 @@ static void _set_media_packet_video_frame_cb(player_h player, void *data, bool s
                ret = legacy_player_unset_media_packet_video_frame_decoded_cb(player);
        }
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 }
 
 static void _set_video_stream_changed_cb(player_h player, void *data, bool set)
@@ -999,7 +1015,7 @@ static void _set_video_stream_changed_cb(player_h player, void *data, bool set)
        else
                ret = legacy_player_unset_video_stream_changed_cb(player);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 }
 
 static void _set_media_stream_audio_seek_cb(player_h player, void *data, bool set)
@@ -1013,7 +1029,7 @@ static void _set_media_stream_audio_seek_cb(player_h player, void *data, bool se
        else
                ret = legacy_player_unset_media_stream_seek_cb(player, PLAYER_STREAM_TYPE_AUDIO);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 }
 
 static void _set_media_stream_video_seek_cb(player_h player, void *data, bool set)
@@ -1027,7 +1043,7 @@ static void _set_media_stream_video_seek_cb(player_h player, void *data, bool se
        else
                ret = legacy_player_unset_media_stream_seek_cb(player, PLAYER_STREAM_TYPE_VIDEO);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 }
 
 static void _set_media_stream_audio_buffer_cb(player_h player, void *data, bool set)
@@ -1041,7 +1057,7 @@ static void _set_media_stream_audio_buffer_cb(player_h player, void *data, bool
        else
                ret = legacy_player_unset_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_AUDIO);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 }
 
 static void _set_media_stream_video_buffer_cb(player_h player, void *data, bool set)
@@ -1055,7 +1071,7 @@ static void _set_media_stream_video_buffer_cb(player_h player, void *data, bool
        else
                ret = legacy_player_unset_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_VIDEO);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 }
 
 static void _set_media_stream_audio_buffer_cb_ex(player_h player, void *data, bool set)
@@ -1069,7 +1085,7 @@ static void _set_media_stream_audio_buffer_cb_ex(player_h player, void *data, bo
        else
                ret = legacy_player_unset_media_stream_buffer_status_cb_ex(player, PLAYER_STREAM_TYPE_AUDIO);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 }
 
 static void _set_media_stream_video_buffer_cb_ex(player_h player, void *data, bool set)
@@ -1083,7 +1099,7 @@ static void _set_media_stream_video_buffer_cb_ex(player_h player, void *data, bo
        else
                ret = legacy_player_unset_media_stream_buffer_status_cb_ex(player, PLAYER_STREAM_TYPE_VIDEO);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 }
 
 static void (*set_callback_func[MUSE_PLAYER_EVENT_TYPE_NUM])(player_h player, void *user_data, bool set) = {
@@ -1236,10 +1252,97 @@ static void _audio_frame_decoded_cb(player_audio_raw_data_s * audio_frame, void
        }
 
        /* send message */
-       player_msg_event1_fd(api, ev, module, INT, key, tfd);
+       PLAYER_SEND_EVENT_MSG_WITH_TFD(api, ev, module, tfd, MUSE_TYPE_INT, "key", key);
        return;
 }
 
+int _player_disp_send_msg(int send_fd, char* msg, int *tfd)
+{
+       int send_len = 0;
+
+       if ((send_fd <= 0) || !muse_core_fd_is_valid(send_fd)) {
+               LOGE("invalid socket fd %d", send_fd);
+               return PLAYER_ERROR_INVALID_OPERATION;
+       }
+
+       if (tfd != NULL) {
+               send_len = muse_core_msg_send_fd(send_fd, tfd, msg);
+       } else {
+               send_len = muse_core_msg_send(send_fd, msg);
+       }
+       if (send_len <= 0) {
+               LOGE("sending message failed");
+               return PLAYER_ERROR_INVALID_OPERATION;
+       }
+
+       return PLAYER_ERROR_NONE;
+}
+
+int _player_disp_send_msg_async(int send_fd, char* msg)
+{
+       int send_len = 0;
+
+       if ((send_fd <= 0) || !muse_core_fd_is_valid(send_fd)) {
+               LOGE("invalid socket fd %d", send_fd);
+               return PLAYER_ERROR_INVALID_OPERATION;
+       }
+
+       send_len = muse_core_msg_send(send_fd, msg);
+       if (send_len <= 0) {
+               LOGE("sending message failed");
+               return PLAYER_ERROR_INVALID_OPERATION;
+       }
+
+       return PLAYER_ERROR_NONE;
+}
+
+static bool _player_disp_get_param_value(char* buf, ...)
+{
+       muse_core_msg_parse_err_e err = MUSE_MSG_PARSE_ERROR_NONE;
+       bool ret = true;
+       va_list var_args;
+       int type = MUSE_TYPE_ANY;
+       char *param_name = NULL;
+       void *value = NULL;
+
+       LOGE("ENTER");
+
+       void *jobj = muse_core_msg_object_new(buf, NULL, &err);
+
+       if (!jobj) {
+               LOGE("failed to get msg object. err:%d", err);
+               return false;
+       }
+
+       va_start(var_args, buf);
+
+       while ((type = va_arg(var_args, int)) != INVALID_MUSE_TYPE_VALUE) {
+               param_name = va_arg(var_args, char *);
+               switch (type) {
+               case MUSE_TYPE_INT:
+               case MUSE_TYPE_INT64:
+               case MUSE_TYPE_DOUBLE:
+               case MUSE_TYPE_STRING:
+                       value = va_arg(var_args, void *);
+
+                       if (!muse_core_msg_object_get_value(param_name, jobj, type, value)) {
+                               ret = false;
+                               LOGE("failed to get %s value", param_name);
+                       }
+                       break;
+               default:
+                       LOGE("Unexpected type %d", type);
+                       ret = false;
+                       break;
+               }
+       }
+
+       muse_core_msg_object_free(jobj);
+
+       va_end(var_args);
+       return ret;
+}
+
 int player_disp_create(muse_module_h module)
 {
        int ret = PLAYER_ERROR_NONE;
@@ -1257,7 +1360,7 @@ int player_disp_create(muse_module_h module)
        if (muse_player == NULL) {
                ret = PLAYER_ERROR_OUT_OF_MEMORY;
                LOGE("failed to alloc handle 0x%x", ret);
-               player_msg_return(api, ret, module);
+               PLAYER_RETURN_MSG(api, ret, module);
                return ret;
        }
        memset(muse_player, 0x0, sizeof(muse_player_handle_s));
@@ -1282,7 +1385,7 @@ int player_disp_create(muse_module_h module)
 
        handle = (intptr_t)muse_player;
        muse_server_ipc_set_handle(module, handle);
-       player_msg_return1(api, ret, module, POINTER, module_addr);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_POINTER, "module_addr", module_addr);
        return ret;
 
 ERROR:
@@ -1290,7 +1393,7 @@ ERROR:
 
        free(muse_player);
        muse_player = NULL;
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
        return ret;
 }
 
@@ -1324,7 +1427,7 @@ int player_disp_destroy(muse_module_h module)
        free(muse_player);
        muse_player = NULL;
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return PLAYER_ERROR_NONE; /* to clean up the resource */
 }
@@ -1350,9 +1453,9 @@ int player_disp_prepare(muse_module_h module)
                legacy_player_get_timeout_for_muse(muse_player->player_handle, &timeout);
                muse_player->total_size_of_buffers = num;
                muse_player->extra_size_of_buffers = extra_num;
-               player_msg_return1(api, ret, module, INT, timeout);
+               PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "timeout", timeout);
        } else {
-               player_msg_return(api, ret, module);
+               PLAYER_RETURN_MSG(api, ret, module);
        }
 
        return ret;
@@ -1380,7 +1483,7 @@ int player_disp_prepare_async(muse_module_h module)
        ret = legacy_player_prepare_async(muse_player->player_handle, _prepare_async_cb, prepare_data);
        if (ret == PLAYER_ERROR_NONE) {
                legacy_player_get_timeout_for_muse(muse_player->player_handle, &timeout);
-               player_msg_return1(api, ret, module, INT, timeout);
+               PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "timeout", timeout);
                return ret;
        } /* else is error */
 
@@ -1388,7 +1491,7 @@ ERROR:
        if (prepare_data)
                g_free(prepare_data);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
        return ret;
 }
 
@@ -1407,7 +1510,7 @@ int player_disp_unprepare(muse_module_h module)
 
        _remove_export_data(module, 0, TRUE);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1425,7 +1528,7 @@ int player_disp_set_uri(muse_module_h module)
        if ((ret = _check_supportable(module, path)) == PLAYER_ERROR_NONE)
                ret = legacy_player_set_uri(muse_player->player_handle, path);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        if (ret == PLAYER_ERROR_NONE) {
                const char* file_buffering_path = muse_server_module_get_temporal_path();
@@ -1447,7 +1550,7 @@ int player_disp_start(muse_module_h module)
 
        ret = legacy_player_start(muse_player->player_handle);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1462,7 +1565,7 @@ int player_disp_stop(muse_module_h module)
 
        ret = legacy_player_stop(muse_player->player_handle);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1477,7 +1580,7 @@ int player_disp_pause(muse_module_h module)
 
        ret = legacy_player_pause(muse_player->player_handle);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1520,7 +1623,7 @@ int player_disp_set_memory_buffer(muse_module_h module)
                goto ERROR;
        }
 
-       player_msg_return1(api, ret, module, INT, bo_addr);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "bo_addr", bo_addr);
 
        /* don't call bo unmap/unref here *
         * it will be released at player_disp_deinit_memory_buffer() during _destroy */
@@ -1535,7 +1638,7 @@ ERROR:
        if (bo)
                tbm_bo_unref(bo);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
        return ret;
 }
 
@@ -1566,7 +1669,7 @@ int player_disp_get_state(muse_module_h module)
 
        ret = legacy_player_get_state(muse_player->player_handle, &state);
 
-       player_msg_return1(api, ret, module, INT, state);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "state", (int)state);
 
        return ret;
 }
@@ -1579,14 +1682,17 @@ int player_disp_set_volume(muse_module_h module)
        double left, right;
        bool ret_val = TRUE;
 
-       player_msg_get2(muse_server_module_get_msg(module), left, DOUBLE, right, DOUBLE, ret_val);
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                                               MUSE_TYPE_DOUBLE, "left", (void *)&left,
+                                                               MUSE_TYPE_DOUBLE, "right", (void *)&right,
+                                                               INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
                ret = legacy_player_set_volume(muse_player->player_handle, (float)left, (float)right);
        } else {
                ret = PLAYER_ERROR_INVALID_OPERATION;
        }
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1602,7 +1708,7 @@ int player_disp_get_volume(muse_module_h module)
 
        ret = legacy_player_get_volume(muse_player->player_handle, &left, &right);
 
-       player_msg_return2(api, ret, module, DOUBLE, left, DOUBLE, right);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_DOUBLE, "left", (double)left, MUSE_TYPE_DOUBLE, "right", (double)right);
 
        return ret;
 }
@@ -1616,7 +1722,10 @@ int player_disp_set_sound_stream_info(muse_module_h module)
        char stream_type[MUSE_URI_MAX_LENGTH] = { 0, };
        bool ret_val = TRUE;
 
-       player_msg_get1_string(muse_server_module_get_msg(module), stream_index, INT, stream_type, ret_val);
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                                               MUSE_TYPE_INT, "stream_index", (void *)&stream_index,
+                                                               MUSE_TYPE_STRING, "stream_type", (void *)stream_type,
+                                                               INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
                ret = legacy_player_set_sound_stream_info_for_mused(muse_player->player_handle, stream_type, stream_index);
@@ -1624,7 +1733,7 @@ int player_disp_set_sound_stream_info(muse_module_h module)
                ret = PLAYER_ERROR_INVALID_OPERATION;
        }
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1641,7 +1750,7 @@ int player_disp_set_audio_latency_mode(muse_module_h module)
 
        ret = legacy_player_set_audio_latency_mode(muse_player->player_handle, (audio_latency_mode_e)latency_mode);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1657,7 +1766,7 @@ int player_disp_get_audio_latency_mode(muse_module_h module)
 
        ret = legacy_player_get_audio_latency_mode(muse_player->player_handle, &latency_mode);
 
-       player_msg_return1(api, ret, module, INT, latency_mode);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "latency_mode", (int)latency_mode);
 
        return ret;
 }
@@ -1671,7 +1780,10 @@ int player_disp_set_play_position(muse_module_h module)
        int accurate = 0;
        bool ret_val = TRUE;
 
-       player_msg_get2(muse_server_module_get_msg(module), pos, INT, accurate, INT, ret_val);
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                                               MUSE_TYPE_INT, "pos", (void *)&pos,
+                                                               MUSE_TYPE_INT, "accurate", (void *)&accurate,
+                                                               INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
                ret = legacy_player_set_play_position(muse_player->player_handle, pos, accurate, _seek_complate_cb, module);
@@ -1679,7 +1791,7 @@ int player_disp_set_play_position(muse_module_h module)
                ret = PLAYER_ERROR_INVALID_OPERATION;
        }
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1695,7 +1807,7 @@ int player_disp_get_play_position(muse_module_h module)
 
        ret = legacy_player_get_play_position(muse_player->player_handle, &pos);
 
-       player_msg_return1(api, ret, module, INT, pos);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "pos", pos);
 
        return ret;
 }
@@ -1712,7 +1824,7 @@ int player_disp_set_mute(muse_module_h module)
 
        ret = legacy_player_set_mute(muse_player->player_handle, (bool)mute);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1728,7 +1840,7 @@ int player_disp_is_muted(muse_module_h module)
 
        ret = legacy_player_is_muted(muse_player->player_handle, &mute);
 
-       player_msg_return1(api, ret, module, INT, mute);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "mute", (int)mute);
 
        return ret;
 }
@@ -1745,7 +1857,7 @@ int player_disp_set_looping(muse_module_h module)
 
        ret = legacy_player_set_looping(muse_player->player_handle, (bool)looping);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1761,7 +1873,7 @@ int player_disp_is_looping(muse_module_h module)
 
        ret = legacy_player_is_looping(muse_player->player_handle, &looping);
 
-       player_msg_return1(api, ret, module, INT, looping);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "looping", (int)looping);
 
        return ret;
 }
@@ -1777,7 +1889,7 @@ int player_disp_get_duration(muse_module_h module)
 
        ret = legacy_player_get_duration(muse_player->player_handle, &duration);
 
-       player_msg_return1(api, ret, module, INT, duration);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "duration", duration);
 
        return ret;
 }
@@ -1793,7 +1905,7 @@ int player_disp_set_display(muse_module_h module)
        muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
        player_msg_get_array(wl_win_msg, muse_server_module_get_msg(module));
        ret = legacy_player_set_display(muse_player->player_handle, wl_win.type, wl_win.wl_surface_id);
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1811,7 +1923,7 @@ int player_disp_set_display_mode(muse_module_h module)
 
        ret = legacy_player_set_display_mode(muse_player->player_handle, (player_display_mode_e)mode);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1828,7 +1940,7 @@ int player_disp_get_display_mode(muse_module_h module)
 
        ret = legacy_player_get_display_mode(muse_player->player_handle, &mode);
 
-       player_msg_return1(api, ret, module, INT, mode);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "mode", (int)mode);
 
        return ret;
 }
@@ -1844,7 +1956,7 @@ int player_disp_set_display_roi_area(muse_module_h module)
        muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
        player_msg_get_array(wl_win_msg, muse_server_module_get_msg(module));
        ret = legacy_player_set_roi_area(muse_player->player_handle, wl_win.wl_window_x, wl_win.wl_window_y, wl_win.wl_window_width, wl_win.wl_window_height);
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1861,7 +1973,7 @@ int player_disp_set_playback_rate(muse_module_h module)
 
        ret = legacy_player_set_playback_rate(muse_player->player_handle, (float)rate);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1878,7 +1990,7 @@ int player_disp_set_display_rotation(muse_module_h module)
 
        ret = legacy_player_set_display_rotation(muse_player->player_handle, (player_display_rotation_e)rotation);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1894,7 +2006,7 @@ int player_disp_get_display_rotation(muse_module_h module)
 
        ret = legacy_player_get_display_rotation(muse_player->player_handle, &rotation);
 
-       player_msg_return1(api, ret, module, INT, rotation);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "rotation", (int)rotation);
 
        return ret;
 }
@@ -1911,7 +2023,7 @@ int player_disp_set_display_visible(muse_module_h module)
 
        ret = legacy_player_set_display_visible(muse_player->player_handle, visible);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1927,7 +2039,7 @@ int player_disp_is_display_visible(muse_module_h module)
 
        ret = legacy_player_is_display_visible(muse_player->player_handle, &value);
 
-       player_msg_return1(api, ret, module, INT, value);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "value", (int)value);
 
        return ret;
 }
@@ -1946,10 +2058,10 @@ int player_disp_get_content_info(muse_module_h module)
        ret = legacy_player_get_content_info(muse_player->player_handle, key, &value);
 
        if (ret == PLAYER_ERROR_NONE) {
-               player_msg_return1(api, ret, module, STRING, value);
+               PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_STRING, "value", (const char*)value);
                free(value);
        } else
-               player_msg_return(api, ret, module);
+               PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1967,12 +2079,14 @@ int player_disp_get_codec_info(muse_module_h module)
        ret = legacy_player_get_codec_info(muse_player->player_handle, &audio_codec, &video_codec);
 
        if (ret == PLAYER_ERROR_NONE) {
-               player_msg_return2(api, ret, module, STRING, audio_codec, STRING, video_codec);
+               PLAYER_RETURN_MSG(api, ret, module,
+                               MUSE_TYPE_STRING, "audio_codec", (const char*)audio_codec,
+                               MUSE_TYPE_STRING, "video_codec", (const char*)video_codec);
 
                free(audio_codec);
                free(video_codec);
        } else
-               player_msg_return(api, ret, module);
+               PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -1990,7 +2104,10 @@ int player_disp_get_audio_stream_info(muse_module_h module)
 
        ret = legacy_player_get_audio_stream_info(muse_player->player_handle, &sample_rate, &channel, &bit_rate);
 
-       player_msg_return3(api, ret, module, INT, sample_rate, INT, channel, INT, bit_rate);
+       PLAYER_RETURN_MSG(api, ret, module,
+                                       MUSE_TYPE_INT, "sample_rate", sample_rate,
+                                       MUSE_TYPE_INT, "channel", channel,
+                                       MUSE_TYPE_INT, "bit_rate", bit_rate);
 
        return ret;
 }
@@ -2007,7 +2124,7 @@ int player_disp_get_video_stream_info(muse_module_h module)
 
        ret = legacy_player_get_video_stream_info(muse_player->player_handle, &fps, &bit_rate);
 
-       player_msg_return2(api, ret, module, INT, fps, INT, bit_rate);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "fps", fps, MUSE_TYPE_INT, "bit_rate", bit_rate);
 
        return ret;
 }
@@ -2024,7 +2141,7 @@ int player_disp_get_video_size(muse_module_h module)
 
        ret = legacy_player_get_video_size(muse_player->player_handle, &width, &height);
 
-       player_msg_return2(api, ret, module, INT, width, INT, height);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "width", width, MUSE_TYPE_INT, "height", height);
 
        return ret;
 }
@@ -2058,17 +2175,18 @@ int player_disp_get_album_art(muse_module_h module)
                        ret = PLAYER_ERROR_INVALID_OPERATION;
                        goto ERROR;
                }
-               player_msg_return2_fd(api, ret, module, INT, size, INT, key, tfd);
+               PLAYER_RETURN_MSG_WITH_TFD(api, ret, module, tfd,
+                                               MUSE_TYPE_INT, "size", size, MUSE_TYPE_INT, "key", key);
        } else {
                LOGD("album art is empty, didn't make tbm_bo");
                size = 0;
-               player_msg_return1(api, ret, module, INT, size);
+               PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "size", size);
        }
 
        return ret;
 
 ERROR:
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
        return ret;
 }
 
@@ -2083,7 +2201,7 @@ int player_disp_audio_effect_get_equalizer_bands_count(muse_module_h module)
 
        ret = legacy_player_audio_effect_get_equalizer_bands_count(muse_player->player_handle, &count);
 
-       player_msg_return1(api, ret, module, INT, count);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "count", count);
 
        return ret;
 }
@@ -2122,7 +2240,7 @@ DONE:
        if (jobj)
                muse_core_msg_object_free(jobj);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2135,7 +2253,10 @@ int player_disp_audio_effect_set_equalizer_band_level(muse_module_h module)
        int index = 0, level = 0;
        bool ret_val = TRUE;
 
-       player_msg_get2(muse_server_module_get_msg(module), index, INT, level, INT, ret_val);
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                                               MUSE_TYPE_INT, "index", (void *)&index,
+                                                               MUSE_TYPE_INT, "level", (void *)&level,
+                                                               INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
                ret = legacy_player_audio_effect_set_equalizer_band_level(muse_player->player_handle, index, level);
@@ -2143,7 +2264,7 @@ int player_disp_audio_effect_set_equalizer_band_level(muse_module_h module)
                ret = PLAYER_ERROR_INVALID_OPERATION;
        }
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2160,7 +2281,7 @@ int player_disp_audio_effect_get_equalizer_band_level(muse_module_h module)
 
        ret = legacy_player_audio_effect_get_equalizer_band_level(muse_player->player_handle, index, &level);
 
-       player_msg_return1(api, ret, module, INT, level);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "level", level);
 
        return ret;
 }
@@ -2176,7 +2297,7 @@ int player_disp_audio_effect_get_equalizer_level_range(muse_module_h module)
 
        ret = legacy_player_audio_effect_get_equalizer_level_range(muse_player->player_handle, &min, &max);
 
-       player_msg_return2(api, ret, module, INT, min, INT, max);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "min", min, MUSE_TYPE_INT, "max", max);
 
        return ret;
 }
@@ -2193,7 +2314,7 @@ int player_disp_audio_effect_get_equalizer_band_frequency(muse_module_h module)
 
        ret = legacy_player_audio_effect_get_equalizer_band_frequency(muse_player->player_handle, index, &frequency);
 
-       player_msg_return1(api, ret, module, INT, frequency);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "frequency", frequency);
 
        return ret;
 }
@@ -2210,7 +2331,7 @@ int player_disp_audio_effect_get_equalizer_band_frequency_range(muse_module_h mo
 
        ret = legacy_player_audio_effect_get_equalizer_band_frequency_range(muse_player->player_handle, index, &range);
 
-       player_msg_return1(api, ret, module, INT, range);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "range", range);
 
        return ret;
 }
@@ -2225,7 +2346,7 @@ int player_disp_audio_effect_equalizer_clear(muse_module_h module)
 
        ret = legacy_player_audio_effect_equalizer_clear(muse_player->player_handle);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2241,7 +2362,7 @@ int player_disp_audio_effect_equalizer_is_available(muse_module_h module)
 
        ret = legacy_player_audio_effect_equalizer_is_available(muse_player->player_handle, &available);
 
-       player_msg_return1(api, ret, module, INT, available);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "available", (int)available);
 
        return ret;
 }
@@ -2259,7 +2380,7 @@ int player_disp_set_progressive_download_path(muse_module_h module)
        if ((ret = _check_supportable(module, dw_path)) == PLAYER_ERROR_NONE)
                ret = legacy_player_set_progressive_download_path(muse_player->player_handle, dw_path);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
        return ret;
 }
 
@@ -2275,7 +2396,9 @@ int player_disp_get_progressive_download_status(muse_module_h module)
 
        ret = legacy_player_get_progressive_download_status(muse_player->player_handle, &current, &total_size);
 
-       player_msg_return2(api, ret, module, POINTER, current, POINTER, total_size);
+       PLAYER_RETURN_MSG(api, ret, module,
+                       MUSE_TYPE_POINTER, "current", (POINTER)current,
+                       MUSE_TYPE_POINTER, "total_size", (POINTER)total_size);
 
        return ret;
 }
@@ -2290,7 +2413,7 @@ int player_disp_capture_video(muse_module_h module)
 
        ret = legacy_player_capture_video(muse_player->player_handle, _capture_video_cb, module);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2329,7 +2452,7 @@ DONE:
        if (jobj)
                muse_core_msg_object_free(jobj);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2368,7 +2491,7 @@ DONE:
        if (jobj)
                muse_core_msg_object_free(jobj);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2384,7 +2507,7 @@ int player_disp_get_streaming_download_progress(muse_module_h module)
 
        ret = legacy_player_get_streaming_download_progress(muse_player->player_handle, &start, &current);
 
-       player_msg_return2(api, ret, module, INT, start, INT, current);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "start", start, MUSE_TYPE_INT, "current", current);
 
        return ret;
 }
@@ -2406,7 +2529,7 @@ int player_disp_set_subtitle_path(muse_module_h module)
                ret = legacy_player_set_subtitle_path(muse_player->player_handle, NULL);
        }
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2423,7 +2546,7 @@ int player_disp_set_subtitle_position_offset(muse_module_h module)
 
        ret = legacy_player_set_subtitle_position_offset(muse_player->player_handle, millisecond);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2498,7 +2621,7 @@ push_media_stream_exit1:
 
        if (jobj)
                muse_core_msg_object_free(jobj);
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
        return ret;
 }
 
@@ -2565,7 +2688,7 @@ int player_disp_set_media_stream_info(muse_module_h module)
 
 set_media_stream_info_exit:
        media_format_unref(format);
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
        return ret;
 }
 
@@ -2576,9 +2699,13 @@ int player_disp_set_callback(muse_module_h module)
        muse_player_handle_s *muse_player = NULL;
        muse_player_event_e type;
        int set = 0;
-       bool ret_val = TRUE;
+       bool ret_val = true;
+
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                                               MUSE_TYPE_INT, "type", (void *)&type,
+                                                               MUSE_TYPE_INT, "set", (void *)&set,
+                                                               INVALID_MUSE_TYPE_VALUE);
 
-       player_msg_get2(muse_server_module_get_msg(module), type, INT, set, INT, ret_val);
        if (ret_val) {
                muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
                if (type < MUSE_PLAYER_EVENT_TYPE_NUM && set_callback_func[type] != NULL)
@@ -2625,7 +2752,10 @@ int player_disp_set_media_stream_buffer_max_size(muse_module_h module)
        unsigned long long max_size;
        bool ret_val = TRUE;
 
-       player_msg_get2(muse_server_module_get_msg(module), type, INT, max_size, INT64, ret_val);
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                                               MUSE_TYPE_INT, "type", (void *)&type,
+                                                               MUSE_TYPE_INT64, "max_size", (void *)&max_size,
+                                                               INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
                ret = legacy_player_set_media_stream_buffer_max_size(muse_player->player_handle, type, max_size);
@@ -2633,7 +2763,7 @@ int player_disp_set_media_stream_buffer_max_size(muse_module_h module)
                ret = PLAYER_ERROR_INVALID_OPERATION;
        }
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2653,9 +2783,9 @@ int player_disp_get_media_stream_buffer_max_size(muse_module_h module)
 
        ret = legacy_player_get_media_stream_buffer_max_size(muse_player->player_handle, type, &max_size);
        if (ret == PLAYER_ERROR_NONE)
-               player_msg_return1(api, ret, module, INT64, max_size);
+               PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT64, "max_size", (INT64)max_size);
        else
-               player_msg_return(api, ret, module);
+               PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2669,14 +2799,17 @@ int player_disp_set_media_stream_buffer_min_threshold(muse_module_h module)
        unsigned percent = 0;
        bool ret_val = TRUE;
 
-       player_msg_get2(muse_server_module_get_msg(module), type, INT, percent, INT, ret_val);
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                                               MUSE_TYPE_INT, "type", (void *)&type,
+                                                               MUSE_TYPE_INT, "percent", (void *)&percent,
+                                                               INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
                ret = legacy_player_set_media_stream_buffer_min_threshold(muse_player->player_handle, type, percent);
        } else {
                ret = PLAYER_ERROR_INVALID_OPERATION;
        }
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2694,9 +2827,9 @@ int player_disp_get_media_stream_buffer_min_threshold(muse_module_h module)
 
        ret = legacy_player_get_media_stream_buffer_min_threshold(muse_player->player_handle, type, &percent);
        if (ret == PLAYER_ERROR_NONE)
-               player_msg_return1(api, ret, module, INT, percent);
+               PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "percent", (int)percent);
        else
-               player_msg_return(api, ret, module);
+               PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2713,7 +2846,7 @@ int player_disp_set_media_stream_dynamic_resolution(muse_module_h module)
 
        ret = legacy_player_set_media_stream_dynamic_resolution(muse_player->player_handle, (bool)drc);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2732,9 +2865,9 @@ int player_disp_get_track_count(muse_module_h module)
 
        ret = legacy_player_get_track_count(muse_player->player_handle, type, &count);
        if (ret == PLAYER_ERROR_NONE)
-               player_msg_return1(api, ret, module, INT, count);
+               PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "count", count);
        else
-               player_msg_return(api, ret, module);
+               PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2752,9 +2885,9 @@ int player_disp_get_current_track(muse_module_h module)
 
        ret = legacy_player_get_current_track(muse_player->player_handle, type, &index);
        if (ret == PLAYER_ERROR_NONE)
-               player_msg_return1(api, ret, module, INT, index);
+               PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "index", index);
        else
-               player_msg_return(api, ret, module);
+               PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2768,14 +2901,17 @@ int player_disp_select_track(muse_module_h module)
        int index = 0;
        bool ret_val = TRUE;
 
-       player_msg_get2(muse_server_module_get_msg(module), type, INT, index, INT, ret_val);
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                                               MUSE_TYPE_INT, "type", (void *)&type,
+                                                               MUSE_TYPE_INT, "index", (void *)&index,
+                                                               INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
                ret = legacy_player_select_track(muse_player->player_handle, type, index);
        } else {
                ret = PLAYER_ERROR_INVALID_OPERATION;
        }
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2791,7 +2927,10 @@ int player_disp_get_track_language_code(muse_module_h module)
        int code_len = 0;
        bool ret_val = TRUE;
 
-       player_msg_get2(muse_server_module_get_msg(module), type, INT, index, INT, ret_val);
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                                               MUSE_TYPE_INT, "type", (void *)&type,
+                                                               MUSE_TYPE_INT, "index", (void *)&index,
+                                                               INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
                ret = legacy_player_get_track_language_code(muse_player->player_handle, type, index, &code, &code_len);
@@ -2800,9 +2939,11 @@ int player_disp_get_track_language_code(muse_module_h module)
        }
 
        if (ret == PLAYER_ERROR_NONE)
-               player_msg_return_array(api, ret, module, code, code_len, sizeof(char));
+               PLAYER_RETURN_MSG(api, ret, module,
+                                               MUSE_TYPE_INT, "code_len", code_len,
+                                               MUSE_TYPE_STRING, "code", (const char*)code);
        else
-               player_msg_return(api, ret, module);
+               PLAYER_RETURN_MSG(api, ret, module);
 
        if (code)
                free(code);
@@ -2822,7 +2963,7 @@ int player_disp_set_pcm_extraction_mode(muse_module_h module)
 
        ret = legacy_player_set_pcm_extraction_mode(muse_player->player_handle, sync, _audio_frame_decoded_cb, module);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2837,8 +2978,11 @@ int player_disp_set_pcm_spec(muse_module_h module)
        int channel = 0;
        bool ret_val = TRUE;
 
-       player_msg_get2_string(muse_server_module_get_msg(module), samplerate, INT, channel, INT, format, ret_val);
-
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                                               MUSE_TYPE_INT, "samplerate", (void *)&samplerate,
+                                                               MUSE_TYPE_INT, "channel", (void *)&channel,
+                                                               MUSE_TYPE_STRING, "format", (void *)format,
+                                                               INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
                ret = legacy_player_set_pcm_spec(muse_player->player_handle, format, samplerate, channel);
@@ -2846,7 +2990,7 @@ int player_disp_set_pcm_spec(muse_module_h module)
                ret = PLAYER_ERROR_INVALID_OPERATION;
        }
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2863,7 +3007,7 @@ int player_disp_set_streaming_playback_rate(muse_module_h module)
 
        ret = legacy_player_set_streaming_playback_rate(muse_player->player_handle, (float)rate);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2882,9 +3026,8 @@ int player_disp_return_buffer(muse_module_h module)       /* MUSE_PLAYER_API_RETURN_BU
        if (!_remove_export_data(module, key, FALSE))
                LOGE("failed to remove export data : key %d", key);
 
-       /* This funct does not send return value to client *
-        * You have to use player_msg_send1_no_return()    *
-        * when you send msg to muse demon. */
+       /* This funct does not send return value to client.        *
+        * You have to use PLAYER_SEND_MSG_ASYNC to return buffer. */
 
        return PLAYER_ERROR_NONE;
 }
@@ -2901,7 +3044,7 @@ int player_disp_set_next_uri(muse_module_h module)
 
        ret = legacy_player_set_next_uri(muse_player->player_handle, path);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2917,10 +3060,10 @@ int player_disp_get_next_uri(muse_module_h module)
 
        ret = legacy_player_get_next_uri(muse_player->player_handle, &next_uri);
        if (ret == PLAYER_ERROR_NONE) {
-               player_msg_return1(api, ret, module, STRING, next_uri);
+               PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_STRING, "next_uri", (const char*)next_uri);
                free(next_uri);
        } else {
-               player_msg_return(api, ret, module);
+               PLAYER_RETURN_MSG(api, ret, module);
        }
 
        return ret;
@@ -2938,7 +3081,7 @@ int player_disp_set_gapless(muse_module_h module)
 
        ret = legacy_player_set_gapless(muse_player->player_handle, (bool)gapless);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -2954,7 +3097,7 @@ int player_disp_is_gapless(muse_module_h module)
 
        ret = legacy_player_is_gapless(muse_player->player_handle, &value);
 
-       player_msg_return1(api, ret, module, INT, value);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "value", (int)value);
 
        return ret;
 }
@@ -2971,10 +3114,10 @@ int player_disp_get_media_packet_video_frame_pool_size(muse_module_h module)
        LOGD("size of v buffer: %d", muse_player->total_size_of_buffers);
        if (muse_player->total_size_of_buffers > DEFAULT_VDEC_TOTAL_SIZE_OF_BUFFER) {
                value = muse_player->total_size_of_buffers;
-               player_msg_return1(api, ret, module, INT, value);
+               PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "value", value);
        } else {
                ret = PLAYER_ERROR_INVALID_STATE;
-               player_msg_return(api, ret, module);
+               PLAYER_RETURN_MSG(api, ret, module);
        }
 
        return ret;
@@ -2992,7 +3135,7 @@ int player_disp_enable_media_packet_video_frame_decoded_cb(muse_module_h module)
 
        ret = legacy_player_enable_media_packet_video_frame_decoded_cb(muse_player->player_handle, (bool)enable);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -3010,9 +3153,11 @@ int player_disp_get_adaptive_variant_info(muse_module_h module)
        ret = legacy_player_get_adaptive_variant_info(muse_player->player_handle, &num, &var_info);
 
        if (ret != PLAYER_ERROR_NONE || num <= 0)
-               player_msg_return1(api, ret, module, INT, num);
+               PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "num", num);
        else
-               player_msg_return2(api, ret, module, INT, num, STRING, var_info);
+               PLAYER_RETURN_MSG(api, ret, module,
+                               MUSE_TYPE_INT, "num", num,
+                               MUSE_TYPE_STRING, "var_info", (const char*)var_info);
 
        g_free(var_info);
 
@@ -3029,7 +3174,11 @@ int player_disp_set_max_adaptive_variant_limit(muse_module_h module)
        int width = ADAPTIVE_VARIANT_DEFAULT_VALUE;
        int height = ADAPTIVE_VARIANT_DEFAULT_VALUE;
 
-       player_msg_get3(muse_server_module_get_msg(module), bandwidth, INT, width, INT, height, INT, ret_val);
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                                               MUSE_TYPE_INT, "bandwidth", (void *)&bandwidth,
+                                                               MUSE_TYPE_INT, "width", (void *)&width,
+                                                               MUSE_TYPE_INT, "height", (void *)&height,
+                                                               INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
                ret = legacy_player_set_max_adaptive_variant_limit(muse_player->player_handle, bandwidth, width, height);
@@ -3037,7 +3186,7 @@ int player_disp_set_max_adaptive_variant_limit(muse_module_h module)
                ret = PLAYER_ERROR_INVALID_OPERATION;
        }
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
        return ret;
 }
 
@@ -3054,9 +3203,12 @@ int player_disp_get_max_adaptive_variant_limit(muse_module_h module)
 
        ret = legacy_player_get_max_adaptive_variant_limit(muse_player->player_handle, &bandwidth, &width, &height);
        if (ret == PLAYER_ERROR_NONE)
-               player_msg_return3(api, ret, module, INT, bandwidth, INT, width, INT, height);
+               PLAYER_RETURN_MSG(api, ret, module,
+                                               MUSE_TYPE_INT, "bandwidth", bandwidth,
+                                               MUSE_TYPE_INT, "width", width,
+                                               MUSE_TYPE_INT, "height", height);
        else
-               player_msg_return(api, ret, module);
+               PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -3073,7 +3225,7 @@ int player_disp_set_audio_only(muse_module_h module)
 
        ret = legacy_player_set_audio_only(muse_player->player_handle, (bool)audio_only);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -3089,7 +3241,7 @@ int player_disp_is_audio_only(muse_module_h module)
 
        ret = legacy_player_is_audio_only(muse_player->player_handle, &audio_only);
 
-       player_msg_return1(api, ret, module, INT, audio_only);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "audio_only", (int)audio_only);
 
        return ret;
 }
@@ -3102,12 +3254,18 @@ int player_disp_set_streaming_buffering_time(muse_module_h module)
        int buffer_ms = 0, rebuffer_ms = 0;
        bool ret_val = true;
 
-       muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
-       player_msg_get2(muse_server_module_get_msg(module), buffer_ms, INT, rebuffer_ms, INT, ret_val);
-
-       ret = legacy_player_set_streaming_buffering_time(muse_player->player_handle, buffer_ms, rebuffer_ms);
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                                               MUSE_TYPE_INT, "buffer_ms", (void *)&buffer_ms,
+                                                               MUSE_TYPE_INT, "rebuffer_ms", (void *)&rebuffer_ms,
+                                                               INVALID_MUSE_TYPE_VALUE);
+       if (ret_val) {
+               muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
+               ret = legacy_player_set_streaming_buffering_time(muse_player->player_handle, buffer_ms, rebuffer_ms);
+       } else {
+               ret = PLAYER_ERROR_INVALID_OPERATION; /* FIXME: mismatch with API return type */
+       }
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
        return ret;
 }
 
@@ -3122,9 +3280,10 @@ int player_disp_get_streaming_buffering_time(muse_module_h module)
 
        ret = legacy_player_get_streaming_buffering_time(muse_player->player_handle, &buffering_time, &rebuffering_time);
        if (ret == PLAYER_ERROR_NONE)
-               player_msg_return2(api, ret, module, INT, buffering_time, INT, rebuffering_time);
+               PLAYER_RETURN_MSG(api, ret, module,
+                       MUSE_TYPE_INT, "buffering_time", buffering_time, MUSE_TYPE_INT, "rebuffering_time", rebuffering_time);
        else
-               player_msg_return(api, ret, module);
+               PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -3140,7 +3299,7 @@ int player_disp_360_is_content_spherical(muse_module_h module)
 
        ret = legacy_player_360_is_content_spherical(muse_player->player_handle, &val);
 
-       player_msg_return1(api, ret, module, INT, val);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "val", (int)val);
        return ret;
 }
 
@@ -3156,7 +3315,7 @@ int player_disp_360_set_enabled(muse_module_h module)
 
        ret = legacy_player_360_set_enabled(muse_player->player_handle, (bool)val);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
        return ret;
 }
 
@@ -3171,7 +3330,7 @@ int player_disp_360_is_enabled(muse_module_h module)
 
        ret = legacy_player_360_is_enabled(muse_player->player_handle, &val);
 
-       player_msg_return1(api, ret, module, INT, val);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "val", (int)val);
        return ret;
 }
 
@@ -3183,14 +3342,17 @@ int player_disp_360_set_direction_of_view(muse_module_h module)
        double yaw, pitch;
        bool ret_val = TRUE;
 
-       player_msg_get2(muse_server_module_get_msg(module), yaw, DOUBLE, pitch, DOUBLE, ret_val);
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                                               MUSE_TYPE_DOUBLE, "yaw", (void *)&yaw,
+                                                               MUSE_TYPE_DOUBLE, "pitch", (void *)&pitch,
+                                                               INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
                ret = legacy_player_360_set_direction_of_view(muse_player->player_handle, (float)yaw, (float)pitch);
        } else {
                ret = PLAYER_ERROR_INVALID_OPERATION;
        }
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
        return ret;
 }
 
@@ -3205,7 +3367,10 @@ int player_disp_360_get_direction_of_view(muse_module_h module)
 
        ret = legacy_player_360_get_direction_of_view(muse_player->player_handle, &yaw_val, &pitch_val);
 
-       player_msg_return2(api, ret, module, DOUBLE, yaw_val, DOUBLE, pitch_val);
+       PLAYER_RETURN_MSG(api, ret, module,
+                       MUSE_TYPE_DOUBLE, "yaw_val", (double)yaw_val,
+                       MUSE_TYPE_DOUBLE, "pitch_val", (double)pitch_val);
+
        return ret;
 }
 
@@ -3221,7 +3386,7 @@ int player_disp_360_set_zoom(muse_module_h module)
 
        ret = legacy_player_360_set_zoom(muse_player->player_handle, (float)level);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
        return ret;
 }
 
@@ -3236,7 +3401,7 @@ int player_disp_360_get_zoom(muse_module_h module)
 
        ret = legacy_player_360_get_zoom(muse_player->player_handle, &zoom);
 
-       player_msg_return1(api, ret, module, DOUBLE, zoom);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_DOUBLE, "zoom", (double)zoom);
        return ret;
 }
 
@@ -3248,14 +3413,17 @@ int player_disp_360_set_field_of_view(muse_module_h module)
        int horizontal_degrees = 0, vertical_degrees = 0;
        bool ret_val = TRUE;
 
-       player_msg_get2(muse_server_module_get_msg(module), horizontal_degrees, INT, vertical_degrees, INT, ret_val);
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                                               MUSE_TYPE_INT, "horizontal_degrees", (void *)&horizontal_degrees,
+                                                               MUSE_TYPE_INT, "vertical_degrees", (void *)&vertical_degrees,
+                                                               INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
                ret = legacy_player_360_set_field_of_view(muse_player->player_handle, horizontal_degrees, vertical_degrees);
        } else {
                ret = PLAYER_ERROR_INVALID_OPERATION;
        }
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -3271,7 +3439,7 @@ int player_disp_360_get_field_of_view(muse_module_h module)
 
        ret = legacy_player_360_get_field_of_view(muse_player->player_handle, &h_val, &v_val);
 
-       player_msg_return2(api, ret, module, INT, h_val, INT, v_val);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "h_val", h_val, MUSE_TYPE_INT, "v_val", v_val);
        return ret;
 }
 
@@ -3298,7 +3466,7 @@ int player_disp_set_codec_type(muse_module_h module)
        ret = legacy_player_set_codec_type(muse_player->player_handle, (player_stream_type_e)stream_type, (player_codec_type_e)codec_type);
 
 EXIT:
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -3316,7 +3484,7 @@ int player_disp_get_codec_type(muse_module_h module)
 
        ret = legacy_player_get_codec_type(muse_player->player_handle, (player_stream_type_e)stream_type, &codec_type);
 
-       player_msg_return1(api, ret, module, INT, codec_type);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "codec_type", (int)codec_type);
 
        return ret;
 }
@@ -3332,7 +3500,7 @@ int player_disp_set_replaygain_enabled(muse_module_h module)
 
        ret = legacy_player_set_replaygain_enabled(muse_player->player_handle, (bool)val);
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;
 }
@@ -3348,7 +3516,7 @@ int player_disp_is_replaygain_enabled(muse_module_h module)
 
        ret = legacy_player_is_replaygain_enabled(muse_player->player_handle, &val);
 
-       player_msg_return1(api, ret, module, INT, val);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "val", (int)val);
 
        return ret;
 }
index a784168..4e23d26 100644 (file)
@@ -63,7 +63,7 @@ static int player_cmd_shutdown(muse_module_h module)
 static int player_cmd_create_server_ack(muse_module_h module)
 {
        LOGD("ENTER");
-       player_msg_create_ack(module);
+       PLAYER_SEND_CREATE_ACK(module);
        return PLAYER_ERROR_NONE;
 }
 
@@ -73,7 +73,7 @@ static int player_cmd_resouce_not_available(muse_module_h module)
        muse_player_api_e api = MUSE_PLAYER_API_CREATE;
        LOGD("return PLAYER_ERROR_RESOURCE_LIMIT");
 
-       player_msg_return(api, ret, module);
+       PLAYER_RETURN_MSG(api, ret, module);
 
        return PLAYER_ERROR_NONE;
 }
index b0f6c54..b39c4de 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-player
 Summary:    A Media Player module for muse server
-Version:    0.2.79
+Version:    0.2.80
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0