[0.3.93] replace msg macro to reduce code size 10/180710/2
authorEunhae Choi <eunhae1.choi@samsung.com>
Fri, 1 Jun 2018 08:54:41 +0000 (17:54 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Mon, 4 Jun 2018 04:51:20 +0000 (13:51 +0900)
Change-Id: Ib54ca4de1a25748d519ef15a344c944f6f3f716e

include/player_msg.h
packaging/capi-media-player.spec
src/player.c
src/player_internal.c

index ace8536..3896dac 100644 (file)
 extern "C" {
 #endif
 
-#include <muse_player_msg.h>
+#define INVALID_DEFAULT_VALUE   -1
 
-/**
- * @brief Create and send address of server side module infomation structure.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] module The server side module infomation.
- * @param[in] fd socket fd
- */
-#define muse_core_send_module_addr(module, fd, ret) \
-       do {\
-               char *__sndMsg__; \
-               int __len__; \
-               __sndMsg__ = muse_core_msg_new(0, \
-                               MUSE_TYPE_POINTER, #module, module, \
-                               0); \
-               __len__ = muse_core_msg_send(fd, __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-                       goto ERROR; \
-               } \
-       } while (0)
+extern int _player_send_msg(muse_player_api_e api, player_cli_s *player, char* msg, tbm_fd tfd, char **retbuf);
+extern int _player_send_msg_async(int send_fd, char* msg);
 
 /**
  * @brief Create and send message. Wait for server result.
@@ -52,545 +33,14 @@ extern "C" {
  * @param[in] player The handle of capi media player.
  * @param[out] retbuf The buffer of return message. Must be char pointer.
  * @param[out] ret The return value from server.
+ * @param[in] variadic argument The argument information to create msg
  */
-#define player_msg_send(api, player, retbuf, ret) \
-       do {    \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __timeout__ = client_get_api_timeout(player, api); \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               0); \
-               __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } else \
-                       ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send message. Wait for server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] player The handle of capi media player.
- * @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
- * @param[out] ret The return value from server.
- * @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_send1(api, player, retbuf, ret, type, param) \
-       do {    \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __timeout__ = client_get_api_timeout(player, api); \
-               type __value__ = (type)param; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_##type, #param, __value__, \
-                               0); \
-               __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } else \
-                       ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send message. Wait for server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] player The handle of capi media player.
- * @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
- * @param[out] ret The return value from server.
- * @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_send2(api, player, retbuf, ret, type1, param1, type2, param2) \
-       do {    \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __timeout__ = client_get_api_timeout(player, api); \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               0); \
-               __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } else \
-                       ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send message. Wait for server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] player The handle of capi media player.
- * @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
- * @param[out] ret The return value from server.
- * @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_send3(api, player, retbuf, ret, type1, param1, type2, param2, type3, param3) \
-       do {    \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __timeout__ = client_get_api_timeout(player, api); \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               type3 __value3__ = (type3)param3; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               MUSE_TYPE_##type3, #param3, __value3__, \
-                               0); \
-               __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } else \
-                       ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send message. Wait for server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] player The handle of capi media player.
- * @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
- * @param[out] ret The return value from server.
- * @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_send4(api, player, retbuf, ret, type1, param1, type2, param2, type3, param3, type4, param4) \
-       do {    \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __timeout__ = client_get_api_timeout(player, api); \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               type3 __value3__ = (type3)param3; \
-               type4 __value4__ = (type4)param4; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               MUSE_TYPE_##type3, #param3, __value3__, \
-                               MUSE_TYPE_##type4, #param4, __value4__, \
-                               0); \
-               __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } else \
-                       ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send message. Wait for server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] player The handle of capi media player.
- * @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
- * @param[out] ret The return value from server.
- * @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_send5(api, player, retbuf, ret, type1, param1, type2, param2, type3, param3, type4, param4, type5, param5) \
+#define PLAYER_SEND_MSG(api, player, ret_buf, ret, ...) \
        do { \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __timeout__ = client_get_api_timeout(player, api); \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               type3 __value3__ = (type3)param3; \
-               type4 __value4__ = (type4)param4; \
-               type5 __value5__ = (type5)param5; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                       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__, \
-                       0); \
-               __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } else \
-                       ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send message. Wait for server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] player The handle of capi media player.
- * @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
- * @param[out] ret The return value from server.
- * @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_send6(api, player, retbuf, ret, type1, param1, type2, param2, type3, param3, type4, param4, type5, param5, type6, param6) \
-       do {    \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __timeout__ = client_get_api_timeout(player, api); \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               type3 __value3__ = (type3)param3; \
-               type4 __value4__ = (type4)param4; \
-               type5 __value5__ = (type5)param5; \
-               type6 __value6__ = (type6)param6; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               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__, \
-                               0); \
-               __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } else \
-                       ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send message. Wait for server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] player The handle of capi media player.
- * @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
- * @param[out] ret The return value from server.
- * @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_send7(api, player, retbuf, ret, type1, param1, type2, param2, type3, param3, type4, param4, type5, param5, type6, param6, type7, param7) \
-       do {    \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __timeout__ = client_get_api_timeout(player, api); \
-               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; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               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__, \
-                               0); \
-               __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } else \
-                       ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send message. Wait for server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] player The handle of capi media player.
- * @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
- * @param[out] ret The return value from server.
- * @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_send_array(api, player, retbuf, ret, param, length, datum_size) \
-       do {    \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __timeout__ = client_get_api_timeout(player, api); \
-               int *__value__ = (int *)param; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, #length, length, \
-                               MUSE_TYPE_ARRAY, #param, \
-                                       datum_size == sizeof(int) ? length :  \
-                                       length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
-                                       __value__, \
-                               0); \
-               __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } else \
-                       ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send message. Wait for server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] player The handle of capi media player.
- * @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
- * @param[out] ret The return value from server.
- * @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_send_array2(api, player, retbuf, ret, param1, length1, datum_size1, param2, length2, datum_size2) \
-       do {    \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __timeout__ = client_get_api_timeout(player, api); \
-               int *__value1__ = (int *)param1; \
-               int *__value2__ = (int *)param2; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, #length1, length1, \
-                               MUSE_TYPE_ARRAY, #param1, \
-                                       datum_size1 == sizeof(int) ? length1 :  \
-                                       length1 / sizeof(int) + (length1 % sizeof(int) ? 1 : 0), \
-                                       __value1__, \
-                               MUSE_TYPE_INT, #length2, length2, \
-                               MUSE_TYPE_ARRAY, #param2, \
-                                       datum_size2 == sizeof(int) ? length2 :  \
-                                       length2 / sizeof(int) + (length2 % sizeof(int) ? 1 : 0), \
-                                       __value2__, \
-                               0); \
-               __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } else \
-                       ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send message. Wait for server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] player The handle of capi media player.
- * @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
- * @param[out] ret The return value from server.
- * @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_send1_array2(api, player, retbuf, ret, type1, param1, param2, length2, datum_size2, param3, length3, datum_size3) \
-       do { \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __timeout__ = client_get_api_timeout(player, api); \
-               type1 __value1__ = (type1)param1; \
-               int *__value2__ = (int *)param2; \
-               int *__value3__ = (int *)param3; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                       MUSE_TYPE_##type1, #param1, __value1__, \
-                       MUSE_TYPE_INT, #length2, length2, \
-                       MUSE_TYPE_ARRAY, #param2, \
-                               datum_size2 == sizeof(int) ? length2 :  \
-                               length2 / sizeof(int) + (length2 % sizeof(int) ? 1 : 0), \
-                               __value2__, \
-                       MUSE_TYPE_INT, #length3, length3, \
-                       MUSE_TYPE_ARRAY, #param3, \
-                               datum_size3 == sizeof(int) ? length3 :  \
-                               length3 / sizeof(int) + (length3 % sizeof(int) ? 1 : 0), \
-                               __value3__, \
-                       0); \
-           __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } else \
-                       ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send message. Wait for server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] player The handle of capi media player.
- * @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
- * @param[out] ret The return value from server.
- * @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] length# The size of array.
- * @param[in] datum_size# The size of a array's datum.
- */
-#define player_msg_send2_array(api, player, retbuf, ret, type1, param1, type2, param2, param_arr, length, datum_size) \
-       do {    \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __timeout__ = client_get_api_timeout(player, api); \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               int *__value_arr__ = (int *)param_arr; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               MUSE_TYPE_INT, #length, length, \
-                               MUSE_TYPE_ARRAY, #param_arr, \
-                                       datum_size == sizeof(int) ? length :  \
-                                       length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
-                                       __value_arr__, \
-                               0); \
-               __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } else \
-                       ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send message. Wait for server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] player The handle of capi media player.
- * @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
- * @param[out] ret The return value from server.
- * @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] length# The size of array.
- * @param[in] datum_size# The size of a array's datum.
- */
-#define player_msg_send3_array2(api, player, retbuf, ret, type1, param1, type2, param2, type3, param3, param4, length4, datum_size4, param5, length5, datum_size5) \
-       do { \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __timeout__ = client_get_api_timeout(player, api); \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               type3 __value3__ = (type3)param3; \
-               int *__value4__ = (int *)param4; \
-               int *__value5__ = (int *)param5; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               MUSE_TYPE_##type3, #param3, __value3__, \
-                               MUSE_TYPE_INT, #length4, length4, \
-                               MUSE_TYPE_ARRAY, #param4, \
-                                       datum_size4 == sizeof(int) ? length4 :  \
-                                       length4 / sizeof(int) + (length4 % sizeof(int) ? 1 : 0), \
-                                       __value4__, \
-                               MUSE_TYPE_INT, #length5, length5, \
-                               MUSE_TYPE_ARRAY, #param5, \
-                                       datum_size5 == sizeof(int) ? length5 :  \
-                                       length5 / sizeof(int) + (length5 % sizeof(int) ? 1 : 0), \
-                                       __value5__, \
-                               0); \
-               __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } else \
-                       ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
- * @brief Create and send message. Does not wait server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] player The handle of capi media player.
- * @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_send1_async(api, player, type, param) \
-       do {    \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               type __value__ = (type)param; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_##type, #param, __value__, \
-                               0); \
-               __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       return PLAYER_ERROR_INVALID_OPERATION; \
-               } \
-       } while (0)
-
-/**
- * @brief Create and send message. Does not wait server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] fd The socket fd to send msg.
- * @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_send1_no_return(api, fd, type, param) \
-       do { \
-               char *__sndMsg__; \
-               int __len__; \
-               type __value__ = (type)param; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_##type, #param, __value__, \
-                               0); \
-               __len__ = muse_core_msg_send(fd, __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-               } \
+               char *__msg__ = NULL; \
+               __msg__ = muse_core_msg_new(api, ##__VA_ARGS__, 0); \
+               ret = _player_send_msg(api, player, __msg__, INVALID_DEFAULT_VALUE, &ret_buf); \
+               muse_core_msg_free(__msg__); \
        } while (0)
 
 /**
@@ -598,188 +48,41 @@ extern "C" {
 * @remarks Does NOT guarantee thread safe.
 * @param[in] api The enum of module API.
 * @param[in] player The handle of capi media player.
-* @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
-* @param[out] ret The return value from server.
-* @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_send1_fd(api, player, retbuf, ret, type1, param1, tfd) \
-       do {    \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __timeout__ = client_get_api_timeout(player, api); \
-               type1 __value1__ = (type1)param1; \
-               int __tfd__[MUSE_NUM_FD];\
-               memset(__tfd__, -1, sizeof(__tfd__)); \
-               __tfd__[0] = tfd; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               0); \
-               __len__ = muse_core_msg_send_fd(__fd__, __tfd__, __sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } else \
-                       ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-               muse_core_msg_free(__sndMsg__); \
-       } while (0)
-
-/**
-* @brief Create and send message. Wait for server result.
-* @remarks Does NOT guarantee thread safe.
-* @param[in] api The enum of module API.
-* @param[in] player The handle of capi media player.
 * @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
 * @param[out] ret The return value from server.
-* @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.
-* @param[in] tfd the tbm fd from tbm_bo_export_fd().
+* @param[in] variadic argument The argument information to create msg
 */
-#define player_msg_send_array_fd(api, player, retbuf, ret, param, length, datum_size, tfd) \
-do {   \
-       char *__sndMsg__; \
-       int __len__; \
-       int __fd__; \
-       int __timeout__ = client_get_api_timeout(player, api); \
-       int *__value__ = (int *)param; \
-       int __tfd__[MUSE_NUM_FD]; \
-       memset(__tfd__, -1, sizeof(__tfd__)); \
-       __tfd__[0] = tfd; \
-       if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-       else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-       __sndMsg__ = muse_core_msg_new(api, \
-                       MUSE_TYPE_INT, #length, length, \
-                       MUSE_TYPE_ARRAY, #param, \
-                               datum_size == sizeof(int) ? length :  \
-                               length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
-                               __value__, \
-                       0); \
-       __len__ = muse_core_msg_send_fd(__fd__, __tfd__, __sndMsg__); \
-       if (__len__ <= 0) { \
-               LOGE("sending message failed"); \
-               ret = PLAYER_ERROR_INVALID_OPERATION; \
-       } else \
-               ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
-       muse_core_msg_free(__sndMsg__); \
-} while (0)
-
-/**
- * @brief Create and send message. Does not wait server result.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] fd socket fd
- * @param[in] type1 The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param1 the name of param is key, must be local variable. never be pointer.
- * @param[in] type2 The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param2 the name of param is key, must be local variable. never be pointer.
- * @param[out] ret set ERROR when fail to send msg.
- */
-#define player_msg_create_handle(api, fd, type1, param1, type2, param2, ret) \
-       do {    \
-               char *__sndMsg__; \
-               int __len__; \
-               type1 __value1__ = (type1)param1; \
-               type2 __value2__ = (type2)param2; \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_##type1, #param1, __value1__, \
-                               MUSE_TYPE_##type2, #param2, __value2__, \
-                               0); \
-               __len__ = muse_core_msg_send(fd, __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } \
+#define PLAYER_SEND_MSG_WITH_TFD(api, player, tfd, ret_buf, ret, ...) \
+       do { \
+               char *__msg__ = NULL; \
+               __msg__ = muse_core_msg_new(api, ##__VA_ARGS__, 0); \
+               ret = _player_send_msg(api, player, __msg__, tfd, &ret_buf); \
+               muse_core_msg_free(__msg__); \
        } while (0)
 
 /**
- * @brief Create and send message for callback. Does not wait server result.
+ * @brief Create and send message. Does not wait server result.
  * @remarks Does NOT guarantee thread safe.
  * @param[in] api The enum of module API.
- * @param[in] player The handle of capi media player.
- * @param[out] ret set ERROR when fail to send msg.
- * @param[in] event_type type of event (muse_player_event_e).
- * @param[in] set 1 is set the user callback, 0 is unset the user callback.
- */
-#define player_msg_set_callback(api, player, ret, event_type, set) \
-       do {    \
-               char *__sndMsg__; \
-               int __len__; \
-               int __fd__; \
-               int __value1__ = (int)event_type; \
-               int __value2__ = (int)set; \
-               if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
-               else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
-               __sndMsg__ = muse_core_msg_new(api, \
-                               MUSE_TYPE_INT, #event_type, __value1__, \
-                               MUSE_TYPE_INT, #set, __value2__, \
-                               0); \
-               __len__ = muse_core_msg_send(__fd__, __sndMsg__); \
-               muse_core_msg_free(__sndMsg__); \
-               if (__len__ <= 0) { \
-                       LOGE("sending message failed"); \
-                       ret = PLAYER_ERROR_INVALID_OPERATION; \
-               } \
-       } 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] arr_param the name of param is key, must be local variable. never be pointer.
- * @param[out] ret result of get value
-
+ * @param[in] fd The socket fd to send msg.
+ * @param[out] ret The msg sending result.
+ * @param[in] variadic argument The argument information to create msg
  */
-#define player_msg_get2_array(buf, param1, type1, param2, type2, arr_param, ret) \
+#define PLAYER_SEND_MSG_ASYNC(api, fd, ret, ...) \
        do { \
-               void *__jobj__ = muse_core_msg_object_new(buf, NULL, NULL); \
-               if (!muse_core_msg_object_get_value(#param1, __jobj__, MUSE_TYPE_##type1, &param1)) { \
-                       LOGE("failed to get value(%s)", #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(#arr_param, __jobj__, MUSE_TYPE_ANY, arr_param)) { \
-                       LOGE("failed to get %s value", #arr_param); \
-                       ret = FALSE; \
-               } \
-               muse_core_msg_object_free(__jobj__); \
+               char *__msg__ = NULL; \
+               __msg__ = muse_core_msg_new(api, ##__VA_ARGS__, 0); \
+               ret = _player_send_msg_async(fd, __msg__); \
+               muse_core_msg_free(__msg__); \
        } 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] str_param# the name of param is key, must be local pointer variable.
- * @param[out] ret result of get value
- */
-#define player_msg_get_string2(buf, str_param1, str_param2, ret) \
+#define PLAYER_SEND_MSG_ASYNC_WITH_NO_RETURN(api, fd, ...) \
        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(#str_param1, __jobj__, MUSE_TYPE_STRING, str_param1)) { \
-                               LOGE("failed to get %s value", #str_param1); \
-                               ret = FALSE; \
-                       } \
-                       if (ret && !muse_core_msg_object_get_value(#str_param2, __jobj__, MUSE_TYPE_STRING, str_param2)) { \
-                               LOGE("failed to get %s value", #str_param2); \
-                               ret = FALSE; \
-                       } \
-                       muse_core_msg_object_free(__jobj__); \
-               } \
+               char *__msg__ = NULL; \
+               __msg__ = muse_core_msg_new(api, ##__VA_ARGS__, 0); \
+               _player_send_msg_async(fd, __msg__); \
+               muse_core_msg_free(__msg__); \
        } while (0)
 
 #endif /* __TIZEN_MEDIA_PLAYER_MSG_PRIVATE_H__ */
index 7c7f3a2..afa0bdf 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.92
+Version:    0.3.93
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 2a84d29..52aeabb 100644 (file)
@@ -36,7 +36,7 @@
 #include "player_private.h"
 #include "player_msg.h"
 
-#define INVALID_DEFAULT_VALUE -1
+#define INVALID_MUSE_TYPE_VALUE 0
 #define MAX_S_PATH_LEN 32
 #define PLAYER_FEATURE_SOUND_STREAM      "http://tizen.org/feature/multimedia.player.stream_info"
 #define PLAYER_FEATURE_OPENGL            "http://tizen.org/feature/opengles.version.2_0"
@@ -51,6 +51,96 @@ typedef enum {
        TIZEN_PROFILE_COMMON = 0x10,
 } tizen_profile_t;
 
+typedef struct {
+       tbm_fd tfd[MUSE_NUM_FD];
+       char* buffer;
+} _player_recv_data;
+
+typedef struct {
+       int int_data;
+       callback_cb_info_s *cb_info;
+       _player_recv_data *recv_data;
+       GMutex event_mutex;
+} _player_cb_data;
+
+typedef struct {
+       intptr_t remote_v_data;
+       gint fd;
+       gint fd_id;
+       bool use_tsurf_pool;
+} _media_pkt_fin_data;
+
+static int _player_deinit_memory_buffer(player_cli_s * pc);
+static void _player_event_queue_add(player_event_queue * ev, _player_cb_data * data);
+static bool _player_need_sync_context(int event_id);
+static void _player_remove_idle_event(callback_cb_info_s *cb_info, muse_player_event_e event_type, bool remove_all);
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+typedef void (*player_retrieve_buffer_cb)(void *user_data);
+static void __retrieve_buffer_cb(void *user_data);
+static int __player_set_retrieve_buffer_cb(player_h player, player_retrieve_buffer_cb callback, void *user_data);
+static int __player_unset_retrieve_buffer_cb(player_h player);
+#endif
+static void _player_release_internal_memory(player_cli_s * pc, bool deinit_server_mem);
+
+/*
+* Internal Implementation
+*/
+int _player_send_msg(muse_player_api_e api, player_cli_s *player, char* msg, tbm_fd tfd, char **retbuf)
+{
+       int ret = PLAYER_ERROR_NONE;
+       int send_len = 0;
+       int send_fd = INVALID_DEFAULT_VALUE;
+       int send_tfd[MUSE_NUM_FD];
+       int timeout = client_get_api_timeout(player, api);
+
+       memset(send_tfd, INVALID_DEFAULT_VALUE, sizeof(send_tfd));
+
+       if (player && CALLBACK_INFO(player)) {
+               send_fd = MSG_FD(player);
+       } else {
+               LOGE("can not access to cb_info");
+               return PLAYER_ERROR_INVALID_STATE;
+       }
+
+       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 != INVALID_DEFAULT_VALUE) {
+               send_tfd[0] = tfd;
+               send_len = muse_core_msg_send_fd(send_fd, send_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;
+       } else {
+               ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), retbuf, timeout);
+       }
+
+       return ret;
+}
+
+int _player_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 tizen_profile_t _get_tizen_profile()
 {
        char *profileName;
@@ -94,7 +184,7 @@ static int _get_current_state(player_cli_s *pc, player_state_e *pstate)
        int state = PLAYER_STATE_NONE;
        char *ret_buf = NULL;
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
 
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(state, ret_buf);
@@ -106,43 +196,53 @@ static int _get_current_state(player_cli_s *pc, player_state_e *pstate)
        return ret;
 }
 
-typedef struct {
-       tbm_fd tfd[MUSE_NUM_FD];
-       char* buffer;
-} _player_recv_data;
+static bool _player_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;
 
-typedef struct {
-       int int_data;
-       callback_cb_info_s *cb_info;
-       _player_recv_data *recv_data;
-       GMutex event_mutex;
-} _player_cb_data;
+       LOGE("ENTER");
 
-typedef struct {
-       intptr_t remote_v_data;
-       gint fd;
-       gint fd_id;
-       bool use_tsurf_pool;
-} _media_pkt_fin_data;
+       void *jobj = muse_core_msg_object_new(buf, NULL, &err);
 
-/*
- Global varialbe
-*/
+       if (!jobj) {
+               LOGE("failed to get msg object. err:%d", err);
+               return false;
+       }
 
-/*
-* Internal Implementation
-*/
-static int _player_deinit_memory_buffer(player_cli_s * pc);
-static void _player_event_queue_add(player_event_queue * ev, _player_cb_data * data);
-static bool _player_need_sync_context(int event_id);
-static void _player_remove_idle_event(callback_cb_info_s *cb_info, muse_player_event_e event_type, bool remove_all);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
-typedef void (*player_retrieve_buffer_cb)(void *user_data);
-static void __retrieve_buffer_cb(void *user_data);
-static int __player_set_retrieve_buffer_cb(player_h player, player_retrieve_buffer_cb callback, void *user_data);
-static int __player_unset_retrieve_buffer_cb(player_h player);
-#endif
-static void _player_release_internal_memory(player_cli_s * pc, bool deinit_server_mem);
+       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:
+               case MUSE_TYPE_POINTER:
+                       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");
+                       ret = false;
+                       break;
+               }
+       }
+
+       muse_core_msg_object_free(jobj);
+
+       va_end(var_args);
+       return ret;
+}
 
 int _player_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
 {
@@ -387,8 +487,11 @@ static int __set_callback(muse_player_event_e type, player_h player, void *callb
                        return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
        }
 
+       if (!CALLBACK_INFO(pc))
+               return PLAYER_ERROR_INVALID_OPERATION;
+
        LOGI("Event type : %d ", type);
-       player_msg_set_callback(api, pc, ret, type, set);
+       PLAYER_SEND_MSG_ASYNC(api, MSG_FD(pc), ret, MUSE_TYPE_INT, "type", type, MUSE_TYPE_INT, "set", set);
 
        if (ret == PLAYER_ERROR_NONE) {
                pc->cb_info->user_cb[type] = callback;
@@ -410,8 +513,7 @@ static int __unset_callback(muse_player_event_e type, player_h player)
        PLAYER_NULL_ARG_CHECK(CALLBACK_INFO(pc));
        set_null_user_cb_lock(CALLBACK_INFO(pc), type);
 
-       player_msg_set_callback(api, pc, ret, type, set);
-       ret = PLAYER_ERROR_NONE;
+       PLAYER_SEND_MSG_ASYNC(api, MSG_FD(pc), ret, MUSE_TYPE_INT, "type", type, MUSE_TYPE_INT, "set", set);
 
        return ret;
 }
@@ -486,9 +588,12 @@ static void __subtitle_cb_handler(callback_cb_info_s * cb_info, _player_recv_dat
        int duration = 0;
        char text[MUSE_URI_MAX_LENGTH] = { 0, };
        muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_SUBTITLE;
-       bool ret = TRUE;
+       bool ret = true;
 
-       player_msg_get1_string(recv_data->buffer, duration, INT, text, ret);
+       ret = _player_get_param_value(recv_data->buffer,
+                                                               MUSE_TYPE_INT, "duration", (void *)&duration,
+                                                               MUSE_TYPE_STRING, "text", (void *)text,
+                                                               INVALID_MUSE_TYPE_VALUE);
        if (ret)
                ((player_subtitle_updated_cb) cb_info->user_cb[ev]) (duration, text, cb_info->user_data[ev]);
 }
@@ -502,10 +607,14 @@ static void __capture_cb_handler(callback_cb_info_s * cb_info, _player_recv_data
        tbm_bo bo = NULL;
        tbm_bo_handle thandle;
        int key = INVALID_DEFAULT_VALUE;
-       bool ret_val = TRUE;
-
-       player_msg_get4(recv_data->buffer, width, INT, height, INT, size, INT, key, INT, ret_val);
-       if (ret_val) {
+       bool get_ret = true;
+       get_ret = _player_get_param_value(recv_data->buffer,
+                                                                       MUSE_TYPE_INT, "width", (void *)&width,
+                                                                       MUSE_TYPE_INT, "height", (void *)&height,
+                                                                       MUSE_TYPE_INT, "size", (void *)&size,
+                                                                       MUSE_TYPE_INT, "key", (void *)&key,
+                                                                       INVALID_MUSE_TYPE_VALUE);
+       if (get_ret) {
                if (recv_data->tfd[0] < 0) {
                        LOGE("There is no valid tbm_fd");
                        goto EXIT;
@@ -543,7 +652,7 @@ EXIT:
        /* return buffer */
        if (key > INVALID_DEFAULT_VALUE) {
                LOGD("send msg to release buffer. key:%d", key);
-               player_msg_send1_no_return(MUSE_PLAYER_API_RETURN_BUFFER, cb_info->fd, INT, key);
+               PLAYER_SEND_MSG_ASYNC_WITH_NO_RETURN(MUSE_PLAYER_API_RETURN_BUFFER, cb_info->fd, MUSE_TYPE_INT, "key", key);
        }
 
        set_null_user_cb(cb_info, MUSE_PLAYER_EVENT_TYPE_CAPTURE);
@@ -683,7 +792,6 @@ static void __media_packet_video_frame_cb_handler(callback_cb_info_s * cb_info,
        intptr_t v_data = 0;
        uint64_t pts = 0;
        int i = 0, orientation = 0;
-
        muse_core_msg_parse_err_e err = MUSE_MSG_PARSE_ERROR_NONE;
 
        void *jobj = muse_core_msg_object_new(recv_data->buffer, NULL, &err);
@@ -863,7 +971,7 @@ ERROR:
        memset(recv_data->tfd, INVALID_DEFAULT_VALUE, sizeof(recv_data->tfd));
 
        if (cb_info && v_data)
-               player_msg_send1_no_return(MUSE_PLAYER_API_RETURN_VIDEO_DATA, cb_info->fd, POINTER, v_data);
+               PLAYER_SEND_MSG_ASYNC_WITH_NO_RETURN(MUSE_PLAYER_API_RETURN_VIDEO_DATA, cb_info->fd, MUSE_TYPE_POINTER, "v_data", v_data);
 
        return;
 }
@@ -915,7 +1023,7 @@ EXIT:
        /* return buffer */
        if (key > INVALID_DEFAULT_VALUE) {
                /* LOGD("send msg to release buffer. key:%d", key); */
-               player_msg_send1_no_return(MUSE_PLAYER_API_RETURN_BUFFER, cb_info->fd, INT, key);
+               PLAYER_SEND_MSG_ASYNC_WITH_NO_RETURN(MUSE_PLAYER_API_RETURN_BUFFER, cb_info->fd, MUSE_TYPE_INT, "key", key);
        }
 }
 
@@ -973,10 +1081,13 @@ static void __media_stream_video_buffer_cb_handler_ex(callback_cb_info_s * cb_in
        /* player_media_stream_buffer_status_e status; */
        int status;
        unsigned long long bytes;
-       bool ret = TRUE;
+       bool ret = true;
 
-       player_msg_get2(recv_data->buffer, status, INT, bytes, INT64, ret);
-       if (ret == TRUE) {
+       ret = _player_get_param_value(recv_data->buffer,
+                                                               MUSE_TYPE_INT, "status", (void *)&status,
+                                                               MUSE_TYPE_INT64, "bytes", (void *)&bytes,
+                                                               INVALID_MUSE_TYPE_VALUE);
+       if (ret == true) {
                ((player_media_stream_buffer_status_cb_ex)
                        cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO])
                        ((player_media_stream_buffer_status_e) status, bytes, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO]);
@@ -988,10 +1099,13 @@ static void __media_stream_audio_buffer_cb_handler_ex(callback_cb_info_s * cb_in
        /* player_media_stream_buffer_status_e status; */
        int status;
        unsigned long long bytes;
-       bool ret = TRUE;
+       bool ret = true;
 
-       player_msg_get2(recv_data->buffer, status, INT, bytes, INT64, ret);
-       if (ret == TRUE) {
+       ret = _player_get_param_value(recv_data->buffer,
+                                                               MUSE_TYPE_INT, "status", (void *)&status,
+                                                               MUSE_TYPE_INT64, "bytes", (void *)&bytes,
+                                                               INVALID_MUSE_TYPE_VALUE);
+       if (ret == true) {
                ((player_media_stream_buffer_status_cb_ex)
                        cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO])
                        ((player_media_stream_buffer_status_e) status, bytes, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO]);
@@ -1028,8 +1142,12 @@ static void __video_stream_changed_cb_handler(callback_cb_info_s * cb_info, _pla
        int fps;
        int bit_rate;
        bool ret_val = TRUE;
-
-       player_msg_get4(recv_data->buffer, width, INT, height, INT, fps, INT, bit_rate, INT, ret_val);
+       ret_val = _player_get_param_value(recv_data->buffer,
+                                                                       MUSE_TYPE_INT, "width", (void *)&width,
+                                                                       MUSE_TYPE_INT, "height", (void *)&height,
+                                                                       MUSE_TYPE_INT, "fps", (void *)&fps,
+                                                                       MUSE_TYPE_INT, "bit_rate", (void *)&bit_rate,
+                                                                       INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                ((player_video_stream_changed_cb) cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED])
                        (width, height, fps, bit_rate, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED]);
@@ -1757,7 +1875,9 @@ int player_create(player_h * player)
                        goto ERROR;
                }
 
-               player_msg_create_handle(api, sock_fd, INT, module, INT, pid, ret);
+               PLAYER_SEND_MSG_ASYNC(api, sock_fd, ret,
+                                                       MUSE_TYPE_INT, "module", module,
+                                                       MUSE_TYPE_INT, "pid", pid);
                if (ret == PLAYER_ERROR_INVALID_OPERATION)
                        goto ERROR;
 
@@ -1793,7 +1913,13 @@ int player_create(player_h * player)
                                        goto ERROR;
                                }
 
-                               muse_core_send_module_addr(module_addr, pc->cb_info->data_fd, ret);
+                               /* share the module addr info to the data_fd */
+                               PLAYER_SEND_MSG_ASYNC(MUSE_PLAYER_API_CREATE, pc->cb_info->data_fd, ret,
+                                                                       MUSE_TYPE_POINTER, "module_addr", module_addr);
+                               if (ret != PLAYER_ERROR_NONE) {
+                                       LOGE("Failed to send module address to the data fd");
+                                       goto ERROR;
+                               }
                                LOGD("Data channel fd %d, muse module addr %p", pc->cb_info->data_fd, module_addr);
                        } else {
                                ret = PLAYER_ERROR_INVALID_OPERATION;
@@ -1820,6 +1946,8 @@ int player_create(player_h * player)
                PLAYER_DISP_DLOPEN(pc); /* update supported_video */
 
                g_free(ret_buf);
+
+               LOGD("LEAVE 0x%X", ret);
                return ret;
 
  ERROR:
@@ -1841,6 +1969,8 @@ int player_create(player_h * player)
        g_free(pc);
        pc = NULL;
        *player = NULL;
+
+       LOGD("LEAVE 0x%X", ret);
        return ret;
 }
 
@@ -1852,6 +1982,7 @@ int player_destroy(player_h player)
        muse_player_api_e api = MUSE_PLAYER_API_DESTROY;
        player_cli_s *pc = (player_cli_s *) player;
        char *ret_buf = NULL;
+
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        int (*p_disp_destroy_evas_display)(void **) = NULL;
 #endif
@@ -1874,7 +2005,8 @@ int player_destroy(player_h player)
                }
        }
 #endif
-       player_msg_send(api, pc, ret_buf, ret);
+
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
 
        if (CALLBACK_INFO(pc)) {
                __player_remove_tsurf_list(pc);
@@ -1914,7 +2046,7 @@ int player_prepare_async(player_h player, player_prepared_cb callback, void *use
                pc->cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE] = callback;
                pc->cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = user_data;
        }
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                int timeout = 0;
                player_msg_get_type(timeout, ret_buf, INT);
@@ -1941,7 +2073,7 @@ int player_prepare(player_h player)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                int timeout = 0;
                player_msg_get_type(timeout, ret_buf, INT);
@@ -1951,6 +2083,8 @@ int player_prepare(player_h player)
        }
 
        g_free(ret_buf);
+
+       LOGD("LEAVE 0x%X", ret);
        return ret;
 }
 
@@ -1967,7 +2101,7 @@ int player_unprepare(player_h player)
        if (!CALLBACK_INFO(pc))
                return PLAYER_ERROR_INVALID_STATE;
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
 
        set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_SEEK);
        set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_PREPARE);
@@ -2059,7 +2193,7 @@ int player_set_uri(player_h player, const char *uri)
 
        SECURE_LOGD("new path : %s", path);
 
-       player_msg_send1(api, pc, ret_buf, ret, STRING, path);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_STRING, "path", (const char*)path);
        pc->push_media_stream = FALSE;
 
        g_free(ret_buf);
@@ -2107,7 +2241,7 @@ int player_set_memory_buffer(player_h player, const void *data, int size)
                goto EXIT;
        }
 
-       player_msg_send1_fd(api, pc, ret_buf, ret, INT, size, tfd);
+       PLAYER_SEND_MSG_WITH_TFD(api, pc, tfd, ret_buf, ret, MUSE_TYPE_INT, "size", size);
        pc->push_media_stream = FALSE;
 
  EXIT:
@@ -2144,11 +2278,10 @@ static int _player_deinit_memory_buffer(player_cli_s * pc)
        muse_player_api_e api = MUSE_PLAYER_API_DEINIT_MEMORY_BUFFER;
        intptr_t bo_addr = SERVER_TBM_BO(pc);
 
-       if (!bo_addr)
+       if (!bo_addr || !CALLBACK_INFO(pc))
                return ret;
 
-       player_msg_send1_async(api, pc, POINTER, bo_addr);
-
+       PLAYER_SEND_MSG_ASYNC(api, MSG_FD(pc), ret, MUSE_TYPE_POINTER, "bo_addr", bo_addr);
        SERVER_TBM_BO(pc) = 0;
 
        return ret;
@@ -2179,7 +2312,10 @@ int player_set_volume(player_h player, float left, float right)
 
        LOGD("ENTER");
 
-       player_msg_send2(api, pc, ret_buf, ret, DOUBLE, right, DOUBLE, left);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_DOUBLE, "right", (double)right,
+                                       MUSE_TYPE_DOUBLE, "left", (double)left);
+
        g_free(ret_buf);
        return ret;
 }
@@ -2197,11 +2333,14 @@ int player_get_volume(player_h player, float *pleft, float *pright)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
 
        if (ret == PLAYER_ERROR_NONE) {
-               bool ret_val = TRUE;
-               player_msg_get2(ret_buf, left, DOUBLE, right, DOUBLE, ret_val);
+               bool ret_val = true;
+               ret_val = _player_get_param_value(ret_buf,
+                                                                       MUSE_TYPE_DOUBLE, "left", (void *)&left,
+                                                                       MUSE_TYPE_DOUBLE, "right", (void *)&right,
+                                                                       INVALID_MUSE_TYPE_VALUE);
                if (ret_val) {
                        *pleft = (float)left;
                        *pright = (float)right;
@@ -2242,7 +2381,9 @@ int player_set_sound_stream_info(player_h player, sound_stream_info_h stream_inf
                ret = sound_manager_get_type_from_stream_information(stream_info, &stream_type);
                ret = sound_manager_get_index_from_stream_information(stream_info, &stream_index);
                if (ret == SOUND_MANAGER_ERROR_NONE)
-                       player_msg_send2(api, pc, ret_buf, ret, STRING, stream_type, INT, stream_index);
+                       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                                       MUSE_TYPE_STRING, "stream_type", (const char*)stream_type,
+                                                       MUSE_TYPE_INT, "stream_index", stream_index);
                else
                        ret = PLAYER_ERROR_INVALID_OPERATION;
        }
@@ -2264,7 +2405,7 @@ int player_set_audio_latency_mode(player_h player, audio_latency_mode_e latency_
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, latency_mode);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "latency_mode", (int)latency_mode);
        g_free(ret_buf);
        return ret;
 }
@@ -2281,7 +2422,7 @@ int player_get_audio_latency_mode(player_h player, audio_latency_mode_e * platen
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
 
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(latency_mode, ret_buf);
@@ -2320,9 +2461,11 @@ int player_start(player_h player)
        }
 #endif
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
 
        g_free(ret_buf);
+
+       LOGD("LEAVE 0x%X", ret);
        return ret;
 }
 
@@ -2364,11 +2507,13 @@ int player_stop(player_h player)
        }
 #endif
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE)
                set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_SEEK);
 
        g_free(ret_buf);
+
+       LOGD("LEAVE 0x%X", ret);
        return ret;
 }
 
@@ -2382,8 +2527,10 @@ int player_pause(player_h player)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        g_free(ret_buf);
+
+       LOGD("LEAVE 0x%X", ret);
        return ret;
 }
 
@@ -2421,7 +2568,9 @@ int player_set_play_position(player_h player, int millisecond, bool accurate, pl
        }
        g_mutex_unlock(&pc->cb_info->seek_cb_mutex);
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, pos, INT, accurate);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "pos", pos,
+                                       MUSE_TYPE_INT, "accurate", (int)accurate);
 
        if (ret != PLAYER_ERROR_NONE) {
                g_mutex_lock(&pc->cb_info->seek_cb_mutex);
@@ -2438,7 +2587,7 @@ int player_set_play_position(player_h player, int millisecond, bool accurate, pl
        pc->cb_info->seek_cb_state = PLAYER_SEEK_CB_STATE_NONE;
        g_mutex_unlock(&pc->cb_info->seek_cb_mutex);
 
-       LOGD("LEAVE");
+       LOGD("LEAVE 0x%X", ret);
        return ret;
 }
 
@@ -2455,7 +2604,7 @@ int player_get_play_position(player_h player, int *millisecond)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
 
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(pos, ret_buf);
@@ -2477,7 +2626,7 @@ int player_set_mute(player_h player, bool muted)
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, mute);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "mute", mute);
        g_free(ret_buf);
        return ret;
 }
@@ -2494,7 +2643,7 @@ int player_is_muted(player_h player, bool * muted)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(mute, ret_buf);
                *muted = (bool) mute;
@@ -2514,7 +2663,7 @@ int player_set_looping(player_h player, bool looping)
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, looping);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "looping", (int)looping);
        g_free(ret_buf);
        return ret;
 }
@@ -2531,7 +2680,7 @@ int player_is_looping(player_h player, bool * plooping)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(looping, ret_buf);
                *plooping = looping;
@@ -2552,7 +2701,7 @@ int player_get_duration(player_h player, int *pduration)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(duration, ret_buf);
                *pduration = duration;
@@ -2611,6 +2760,7 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
        unsigned int wl_surface_id;
        player_private_display_type_e conv_type;
        unsigned int (*p_disp_set_wl_display)(int, void *) = NULL;
+       int arr_msg_len = 0;
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        int (*p_disp_destroy_evas_display)(void **) = NULL;
        int (*p_disp_create_evas_display)(void *, void **) = NULL;
@@ -2711,7 +2861,10 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
                LOGI("Wayland surface type is NONE");
                wl_win.type = conv_type;
        }
-       player_msg_send_array(api, pc, ret_buf, ret, wl_win_msg, sizeof(wl_win_msg_type), sizeof(char));
+
+       arr_msg_len = (sizeof(wl_win_msg_type)/sizeof(int) + (sizeof(wl_win_msg_type)%sizeof(int) ? 1 : 0));
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_ARRAY, "wl_win_msg", arr_msg_len, (int*)wl_win_msg);
        g_free(ret_buf);
 
        return ret;
@@ -2744,7 +2897,7 @@ int player_set_display_mode(player_h player, player_display_mode_e mode)
                EVAS_INFO(pc)->update_needed = TRUE;
        }
 #endif
-       player_msg_send1(api, pc, ret_buf, ret, INT, mode);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "mode", (int)mode);
        g_free(ret_buf);
        return ret;
 }
@@ -2776,7 +2929,7 @@ int player_get_display_mode(player_h player, player_display_mode_e * pmode)
                        return PLAYER_ERROR_NONE;
        }
 #endif
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get_type(mode, ret_buf, INT);
                *pmode = mode;
@@ -2798,6 +2951,7 @@ int player_set_display_roi_area(player_h player, int x, int y, int width, int he
        char *ret_buf = NULL;
        wl_win_msg_type wl_win;
        char *wl_win_msg = (char *)&wl_win;
+       int arr_msg_len = 0;
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        int (*p_disp_set_evas_display_roi_area)(void *, int, int, int, int) = NULL;
 #endif
@@ -2828,7 +2982,10 @@ int player_set_display_roi_area(player_h player, int x, int y, int width, int he
        wl_win.wl_window_width = width;
        wl_win.wl_window_height = height;
 
-       player_msg_send_array(api, pc, ret_buf, ret, wl_win_msg, sizeof(wl_win_msg_type), sizeof(char));
+       arr_msg_len = (sizeof(wl_win_msg_type)/sizeof(int) + (sizeof(wl_win_msg_type)%sizeof(int) ? 1 : 0));
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_ARRAY, "wl_win_msg", arr_msg_len, (int*)wl_win_msg);
+
        g_free(ret_buf);
        return ret;
 }
@@ -2844,8 +3001,10 @@ int player_set_playback_rate(player_h player, float rate)
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, DOUBLE, rate);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_DOUBLE, "rate", (double)rate);
        g_free(ret_buf);
+
+       LOGD("LEAVE 0x%X", ret);
        return ret;
 }
 
@@ -2876,7 +3035,7 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat
                EVAS_INFO(pc)->update_needed = TRUE;
        }
 #endif
-       player_msg_send1(api, pc, ret_buf, ret, INT, rotation);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "rotation", (int)rotation);
        g_free(ret_buf);
        return ret;
 }
@@ -2908,7 +3067,7 @@ int player_get_display_rotation(player_h player, player_display_rotation_e * pro
                        return PLAYER_ERROR_NONE;
        }
 #endif
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get_type(rotation, ret_buf, INT);
                *protation = rotation;
@@ -2947,7 +3106,7 @@ int player_set_display_visible(player_h player, bool visible)
        }
 #endif
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, visible);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "visible", (int)visible);
        g_free(ret_buf);
        return ret;
 }
@@ -2984,7 +3143,7 @@ int player_is_display_visible(player_h player, bool * pvisible)
                        return PLAYER_ERROR_NONE;
        }
 #endif
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get_type(value, ret_buf, INT);
 
@@ -3010,7 +3169,7 @@ int player_get_content_info(player_h player, player_content_info_e key, char **p
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, key);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "key", (int)key);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get_string(value, ret_buf);
                *pvalue = strndup(value, MUSE_MSG_MAX_LENGTH);
@@ -3033,9 +3192,12 @@ int player_get_codec_info(player_h player, char **paudio_codec, char **pvideo_co
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
-               player_msg_get_string2(ret_buf, video_codec, audio_codec, ret_val);
+               ret_val = _player_get_param_value(ret_buf,
+                                                                       MUSE_TYPE_STRING, "video_codec", (void *)video_codec,
+                                                                       MUSE_TYPE_STRING, "audio_codec", (void *)audio_codec,
+                                                                       INVALID_MUSE_TYPE_VALUE);
                if (ret_val) {
                        if (pvideo_codec)
                                *pvideo_codec = strndup(video_codec, MUSE_MSG_MAX_LENGTH);
@@ -3063,10 +3225,14 @@ int player_get_audio_stream_info(player_h player, int *psample_rate, int *pchann
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
-               bool ret_val = TRUE;
-               player_msg_get3(ret_buf, sample_rate, INT, channel, INT, bit_rate, INT, ret_val);
+               bool ret_val = true;
+               ret_val = _player_get_param_value(ret_buf,
+                                                                               MUSE_TYPE_INT, "sample_rate", (void *)&sample_rate,
+                                                                               MUSE_TYPE_INT, "channel", (void *)&channel,
+                                                                               MUSE_TYPE_INT, "bit_rate", (void *)&bit_rate,
+                                                                               INVALID_MUSE_TYPE_VALUE);
                if (ret_val) {
                        if (psample_rate)
                                *psample_rate = sample_rate;
@@ -3095,10 +3261,13 @@ int player_get_video_stream_info(player_h player, int *pfps, int *pbit_rate)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
-               bool ret_val = TRUE;
-               player_msg_get2(ret_buf, fps, INT, bit_rate, INT, ret_val);
+               bool ret_val = true;
+               ret_val = _player_get_param_value(ret_buf,
+                                                                       MUSE_TYPE_INT, "fps", (void *)&fps,
+                                                                       MUSE_TYPE_INT, "bit_rate", (void *)&bit_rate,
+                                                                       INVALID_MUSE_TYPE_VALUE);
                if (ret_val) {
                        if (pfps)
                                *pfps = fps;
@@ -3125,10 +3294,13 @@ int player_get_video_size(player_h player, int *pwidth, int *pheight)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
-               bool ret_val = TRUE;
-               player_msg_get2(ret_buf, width, INT, height, INT, ret_val);
+               bool ret_val = true;
+               ret_val = _player_get_param_value(ret_buf,
+                                                                       MUSE_TYPE_INT, "width", (void *)&width,
+                                                                       MUSE_TYPE_INT, "height", (void *)&height,
+                                                                       INVALID_MUSE_TYPE_VALUE);
                if (ret_val) {
                        *pwidth = width;
                        *pheight = height;
@@ -3158,7 +3330,7 @@ int player_get_album_art(player_h player, void **palbum_art, int *psize)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                muse_core_msg_parse_err_e err = MUSE_MSG_PARSE_ERROR_NONE;
                jobj = muse_core_msg_object_new(ret_buf, NULL, &err);
@@ -3228,9 +3400,9 @@ EXIT:
                tbm_bo_unref(bo);
 
        /* return buffer */
-       if (key > INVALID_DEFAULT_VALUE) {
+       if (key > INVALID_DEFAULT_VALUE && CALLBACK_INFO(pc)) {
                LOGD("send msg to release buffer. key:%d", key);
-               player_msg_send1_async(MUSE_PLAYER_API_RETURN_BUFFER, pc, INT, key);
+               PLAYER_SEND_MSG_ASYNC(MUSE_PLAYER_API_RETURN_BUFFER, MSG_FD(pc), ret, MUSE_TYPE_INT, "key", key);
        }
 
        return ret;
@@ -3248,7 +3420,7 @@ int player_audio_effect_get_equalizer_bands_count(player_h player, int *pcount)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(count, ret_buf);
                *pcount = count;
@@ -3268,7 +3440,9 @@ int player_audio_effect_set_equalizer_all_bands(player_h player, int *band_level
 
        LOGD("ENTER");
 
-       player_msg_send_array(api, pc, ret_buf, ret, band_levels, length, sizeof(int));
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "length", length,
+                                       MUSE_TYPE_ARRAY, "band_levels", length, band_levels);
 
        g_free(ret_buf);
        return ret;
@@ -3285,7 +3459,9 @@ int player_audio_effect_set_equalizer_band_level(player_h player, int index, int
 
        LOGD("ENTER");
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, index, INT, level);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "index", index,
+                                       MUSE_TYPE_INT, "level", level);
 
        g_free(ret_buf);
        return ret;
@@ -3303,7 +3479,7 @@ int player_audio_effect_get_equalizer_band_level(player_h player, int index, int
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, index);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "index", index);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(level, ret_buf);
                *plevel = level;
@@ -3324,10 +3500,13 @@ int player_audio_effect_get_equalizer_level_range(player_h player, int *pmin, in
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
-               bool ret_val = TRUE;
-               player_msg_get2(ret_buf, min, INT, max, INT, ret_val);
+               bool ret_val = true;
+               ret_val = _player_get_param_value(ret_buf,
+                                                                       MUSE_TYPE_INT, "min", (void *)&min,
+                                                                       MUSE_TYPE_INT, "max", (void *)&max,
+                                                                       INVALID_MUSE_TYPE_VALUE);
                if (ret_val) {
                        *pmin = min;
                        *pmax = max;
@@ -3351,7 +3530,7 @@ int player_audio_effect_get_equalizer_band_frequency(player_h player, int index,
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, index);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "index", index);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(frequency, ret_buf);
                *pfrequency = frequency;
@@ -3372,7 +3551,7 @@ int player_audio_effect_get_equalizer_band_frequency_range(player_h player, int
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, index);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "index", index);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(range, ret_buf);
                *prange = range;
@@ -3391,7 +3570,7 @@ int player_audio_effect_equalizer_clear(player_h player)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        g_free(ret_buf);
        return ret;
 }
@@ -3408,7 +3587,7 @@ int player_audio_effect_equalizer_is_available(player_h player, bool * pavailabl
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(available, ret_buf);
                *pavailable = available;
@@ -3431,7 +3610,7 @@ int player_set_subtitle_path(player_h player, const char *path)
        if (path && _player_get_valid_path(path, subtitle_path) != PLAYER_ERROR_NONE)
                return PLAYER_ERROR_INVALID_PARAMETER;
 
-       player_msg_send1(api, pc, ret_buf, ret, STRING, subtitle_path);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_STRING, "subtitle_path", (const char*)subtitle_path);
        g_free(ret_buf);
        return ret;
 }
@@ -3446,7 +3625,7 @@ int player_set_subtitle_position_offset(player_h player, int millisecond)
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, millisecond);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "millisecond", millisecond);
 
        g_free(ret_buf);
        return ret;
@@ -3471,7 +3650,7 @@ int player_set_progressive_download_path(player_h player, const char *path)
        if (_player_get_valid_path(path, dw_path) != PLAYER_ERROR_NONE)
                return PLAYER_ERROR_INVALID_PARAMETER;
 
-       player_msg_send1(api, pc, ret_buf, ret, STRING, dw_path);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_STRING, "dw_path", (const char*)dw_path);
        g_free(ret_buf);
        return ret;
 }
@@ -3489,10 +3668,13 @@ int player_get_progressive_download_status(player_h player, unsigned long *pcurr
        LOGD("ENTER");
        LOGW("DEPRECATION WARNING: player_get_progressive_download_status() is deprecated and will be removed from next release.");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
-               bool ret_val = TRUE;
-               player_msg_get2(ret_buf, current, POINTER, total_size, POINTER, ret_val);
+               bool ret_val = true;
+               ret_val = _player_get_param_value(ret_buf,
+                                                                       MUSE_TYPE_POINTER, "current", (void *)&current,
+                                                                       MUSE_TYPE_POINTER, "total_size", (void *)&total_size,
+                                                                       INVALID_MUSE_TYPE_VALUE);
                if (ret_val) {
                        *pcurrent = current;
                        *ptotal_size = total_size;
@@ -3524,7 +3706,7 @@ int player_capture_video(player_h player, player_video_captured_cb callback, voi
                pc->cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = user_data;
        }
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
 
        if (ret != PLAYER_ERROR_NONE)
                set_null_user_cb(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_CAPTURE);
@@ -3545,7 +3727,9 @@ int player_set_streaming_cookie(player_h player, const char *cookie, int size)
 
        LOGD("ENTER");
 
-       player_msg_send2(api, pc, ret_buf, ret, STRING, cookie, INT, size);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_STRING, "cookie", cookie,
+                                       MUSE_TYPE_INT, "size", size);
        g_free(ret_buf);
        return ret;
 }
@@ -3562,7 +3746,9 @@ int player_set_streaming_user_agent(player_h player, const char *user_agent, int
 
        LOGD("ENTER");
 
-       player_msg_send2(api, pc, ret_buf, ret, STRING, user_agent, INT, size);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_STRING, "user_agent", user_agent,
+                                       MUSE_TYPE_INT, "size", size);
        g_free(ret_buf);
        return ret;
 }
@@ -3579,10 +3765,13 @@ int player_get_streaming_download_progress(player_h player, int *pstart, int *pc
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
-               bool ret_val = TRUE;
-               player_msg_get2(ret_buf, start, INT, current, INT, ret_val);
+               bool ret_val = true;
+               ret_val = _player_get_param_value(ret_buf,
+                                                                       MUSE_TYPE_INT, "start", (void *)&start,
+                                                                       MUSE_TYPE_INT, "current", (void *)&current,
+                                                                       INVALID_MUSE_TYPE_VALUE);
                if (ret_val) {
                        *pstart = start;
                        *pcurrent = current;
@@ -3693,7 +3882,9 @@ int player_set_progressive_download_message_cb(player_h player, player_pd_messag
        if (!_player_check_network_availability())
                return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, set);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "type", type,
+                                       MUSE_TYPE_INT, "set", set);
 
        if (ret == PLAYER_ERROR_NONE) {
                pc->cb_info->user_cb[type] = callback;
@@ -3720,7 +3911,9 @@ int player_unset_progressive_download_message_cb(player_h player)
 
        set_null_user_cb_lock(pc->cb_info, type);
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, set);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "type", type,
+                                       MUSE_TYPE_INT, "set", set);
 
        g_free(ret_buf);
        return ret;
@@ -3740,7 +3933,9 @@ int player_set_media_packet_video_frame_decoded_cb(player_h player, player_media
 
        LOGD("ENTER");
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, set);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "type", type,
+                                       MUSE_TYPE_INT, "set", set);
 
        if (ret == PLAYER_ERROR_NONE) {
                pc->cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME] = callback;
@@ -3766,7 +3961,9 @@ int player_unset_media_packet_video_frame_decoded_cb(player_h player)
 
        set_null_user_cb_lock(pc->cb_info, type);
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, set);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "type", type,
+                                       MUSE_TYPE_INT, "set", set);
 
        g_free(ret_buf);
        return ret;
@@ -3785,7 +3982,9 @@ int player_set_video_stream_changed_cb(player_h player, player_video_stream_chan
 
        LOGD("ENTER");
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, set);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "type", type,
+                                       MUSE_TYPE_INT, "set", set);
 
        if (ret == PLAYER_ERROR_NONE) {
                pc->cb_info->user_cb[type] = callback;
@@ -3811,7 +4010,9 @@ int player_unset_video_stream_changed_cb(player_h player)
 
        set_null_user_cb_lock(pc->cb_info, type);
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, set);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "type", type,
+                                       MUSE_TYPE_INT, "set", set);
 
        g_free(ret_buf);
        return ret;
@@ -3839,7 +4040,9 @@ int player_set_media_stream_buffer_status_cb(player_h player, player_stream_type
                return PLAYER_ERROR_INVALID_PARAMETER;
        }
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, set);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "type", type,
+                                       MUSE_TYPE_INT, "set", set);
 
        if (ret == PLAYER_ERROR_NONE) {
                pc->cb_info->user_cb[type] = callback;
@@ -3874,7 +4077,9 @@ int player_unset_media_stream_buffer_status_cb(player_h player, player_stream_ty
 
        set_null_user_cb_lock(pc->cb_info, type);
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, set);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "type", type,
+                                       MUSE_TYPE_INT, "set", set);
 
        g_free(ret_buf);
        return ret;
@@ -3902,7 +4107,9 @@ int player_set_media_stream_seek_cb(player_h player, player_stream_type_e stream
                return PLAYER_ERROR_INVALID_PARAMETER;
        }
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, set);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "type", type,
+                                       MUSE_TYPE_INT, "set", set);
 
        if (ret == PLAYER_ERROR_NONE) {
                pc->cb_info->user_cb[type] = callback;
@@ -3937,7 +4144,9 @@ int player_unset_media_stream_seek_cb(player_h player, player_stream_type_e stre
 
        set_null_user_cb_lock(pc->cb_info, type);
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, set);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "type", type,
+                                       MUSE_TYPE_INT, "set", set);
 
        g_free(ret_buf);
        return ret;
@@ -3966,6 +4175,7 @@ int player_push_media_stream(player_h player, media_packet_h packet)
        bool is_video;
        bool is_audio;
        bool is_eos;
+       int arr_msg_len = 0;
 
        LOGD("ENTER");
 
@@ -3988,6 +4198,8 @@ int player_push_media_stream(player_h player, media_packet_h packet)
        media_format_unref(format);
 
 #ifdef __UN_USED
+       int arr_buf_len = 0;
+
        if (push_media.buf_type == PUSH_MEDIA_BUF_TYPE_TBM) {
                bo = tbm_bo_alloc(pc->cb_info->bufmgr, push_media.size, TBM_BO_DEFAULT);
                if (bo == NULL) {
@@ -4010,10 +4222,19 @@ int player_push_media_stream(player_h player, media_packet_h packet)
                        goto ERROR;
                }
 
-               player_msg_send_array_fd(api, pc, ret_buf, ret, push_media_msg, msg_size, sizeof(char), tfd);
+               arr_msg_len = (msg_size / sizeof(int) + (msg_size % sizeof(int) ? 1 : 0));
+               PLAYER_SEND_MSG_WITH_TFD(api, pc, tfd, ret_buf, ret,
+                                                               MUSE_TYPE_ARRAY, "push_media_msg", arr_msg_len, (int *)push_media_msg);
+
        } else if (push_media.buf_type == PUSH_MEDIA_BUF_TYPE_MSG) {
                buf_size = (int)push_media.size;
-               player_msg_send_array2(api, pc, ret_buf, ret, push_media_msg, msg_size, sizeof(char), buf, buf_size, sizeof(char));
+
+               arr_msg_len = (msg_size / sizeof(int) + (msg_size % sizeof(int) ? 1 : 0));
+               arr_buf_len = (buf_size / sizeof(int) + (buf_size % sizeof(int) ? 1 : 0));
+               PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                               MUSE_TYPE_ARRAY, "push_media_msg", arr_msg_len, (int*)push_media_msg,
+                                               MUSE_TYPE_ARRAY, "buf", arr_buf_len, (int*)buf);
+
        } else
 #endif
        if (push_media.buf_type == PUSH_MEDIA_BUF_TYPE_RAW) {
@@ -4022,7 +4243,10 @@ int player_push_media_stream(player_h player, media_packet_h packet)
                        LOGE("failed to send data");
                        return PLAYER_ERROR_INVALID_OPERATION;
                }
-               player_msg_send_array(api, pc, ret_buf, ret, push_media_msg, msg_size, sizeof(char));
+
+               arr_msg_len = (msg_size / sizeof(int) + (msg_size % sizeof(int) ? 1 : 0));
+               PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                               MUSE_TYPE_ARRAY, "push_media_msg", arr_msg_len, (int*)push_media_msg);
        }
 
        LOGD("ret_buf %s", ret_buf);
@@ -4068,13 +4292,29 @@ int player_set_media_stream_info(player_h player, player_stream_type_e type, med
                        return PLAYER_ERROR_INVALID_PARAMETER;
                }
 
-               player_msg_send7(api, pc, ret_buf, ret, INT, type, INT, mimetype, INT, width, INT, height, INT, avg_bps, INT, max_bps, INT, frame_rate);
+               PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                               MUSE_TYPE_INT, "type", type,
+                                               MUSE_TYPE_INT, "mimetype", mimetype,
+                                               MUSE_TYPE_INT, "width", width,
+                                               MUSE_TYPE_INT, "height", height,
+                                               MUSE_TYPE_INT, "avg_bps", avg_bps,
+                                               MUSE_TYPE_INT, "max_bps", max_bps,
+                                               MUSE_TYPE_INT, "frame_rate", frame_rate);
+
        } else if (type == PLAYER_STREAM_TYPE_AUDIO) {
                if (media_format_get_audio_info(format, &mimetype, &channel, &samplerate, &bit, &avg_bps) != MEDIA_FORMAT_ERROR_NONE) {
                        LOGE("failed to get audio info from format.");
                        return PLAYER_ERROR_INVALID_PARAMETER;
                }
-               player_msg_send6(api, pc, ret_buf, ret, INT, type, INT, mimetype, INT, channel, INT, samplerate, INT, avg_bps, INT, bit);
+
+               PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                               MUSE_TYPE_INT, "type", type,
+                                               MUSE_TYPE_INT, "mimetype", mimetype,
+                                               MUSE_TYPE_INT, "channel", channel,
+                                               MUSE_TYPE_INT, "samplerate", samplerate,
+                                               MUSE_TYPE_INT, "avg_bps", avg_bps,
+                                               MUSE_TYPE_INT, "bit", bit);
+
        }
        media_format_unref(format);
        pc->push_media_stream = TRUE;
@@ -4093,7 +4333,9 @@ int player_set_media_stream_buffer_max_size(player_h player, player_stream_type_
 
        LOGD("ENTER");
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT64, max_size);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "type", type,
+                                       MUSE_TYPE_INT64, "max_size", (INT64)max_size);
 
        g_free(ret_buf);
        return ret;
@@ -4111,7 +4353,7 @@ int player_get_media_stream_buffer_max_size(player_h player, player_stream_type_
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, type);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get_type(max_size, ret_buf, INT64);
                *pmax_size = max_size;
@@ -4130,7 +4372,9 @@ int player_set_media_stream_buffer_min_threshold(player_h player, player_stream_
 
        LOGD("ENTER");
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, percent);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "type", type,
+                                       MUSE_TYPE_INT, "percent", (int)percent);
 
        g_free(ret_buf);
        return ret;
@@ -4148,7 +4392,7 @@ int player_get_media_stream_buffer_min_threshold(player_h player, player_stream_
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, type);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(percent, ret_buf);
                *ppercent = percent;
@@ -4170,7 +4414,7 @@ int player_get_track_count(player_h player, player_stream_type_e type, int *pcou
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, type);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(count, ret_buf);
                *pcount = count;
@@ -4192,7 +4436,7 @@ int player_get_current_track(player_h player, player_stream_type_e type, int *pi
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, type);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(index, ret_buf);
                *pindex = index;
@@ -4212,7 +4456,7 @@ int player_select_track(player_h player, player_stream_type_e type, int index)
 
        LOGD("ENTER");
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, index);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type, MUSE_TYPE_INT, "index", index);
 
        g_free(ret_buf);
        return ret;
@@ -4231,10 +4475,13 @@ int player_get_track_language_code(player_h player, player_stream_type_e type, i
 
        LOGD("ENTER");
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, index);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type, MUSE_TYPE_INT, "index", index);
        if (ret == PLAYER_ERROR_NONE) {
-               bool recv_ret = TRUE;
-               player_msg_get1_string(ret_buf, code_len, INT, code, recv_ret);
+               bool recv_ret = true;
+               recv_ret = _player_get_param_value(ret_buf,
+                                                                               MUSE_TYPE_INT, "code_len", (void *)&code_len,
+                                                                               MUSE_TYPE_STRING, "code", (void *)code,
+                                                                               INVALID_MUSE_TYPE_VALUE);
                if (recv_ret)
                        *pcode = strndup(code, code_len);
                else
@@ -4260,7 +4507,7 @@ int player_foreach_adaptive_variant(player_h player, player_adaptive_variant_cb
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get_type(num, ret_buf, INT);
                if (num > 0)
@@ -4302,7 +4549,10 @@ int player_set_max_adaptive_variant_limit(player_h player, int bandwidth, int wi
 
        LOGD("ENTER");
 
-       player_msg_send3(api, pc, ret_buf, ret, INT, bandwidth, INT, width, INT, height);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "bandwidth", bandwidth,
+                                       MUSE_TYPE_INT, "width", width,
+                                       MUSE_TYPE_INT, "height", height);
        g_free(ret_buf);
 
        LOGD("LEAVE 0x%X", ret);
@@ -4323,11 +4573,14 @@ int player_get_max_adaptive_variant_limit(player_h player, int *pbandwidth, int
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
-               bool ret_val = TRUE;
-
-               player_msg_get3(ret_buf, bandwidth, INT, width, INT, height, INT, ret_val);
+               bool ret_val = true;
+               ret_val = _player_get_param_value(ret_buf,
+                                                                               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) {
                        if (pbandwidth) *pbandwidth = bandwidth;
                        if (pwidth) *pwidth = width;
@@ -4370,7 +4623,7 @@ int player_set_audio_only(player_h player, bool audio_only)
                return PLAYER_ERROR_NONE;
        }
 #endif
-       player_msg_send1(api, pc, ret_buf, ret, INT, audio_only);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "audio_only", (int)audio_only);
        g_free(ret_buf);
 
        LOGD("LEAVE 0x%X", ret);
@@ -4396,7 +4649,7 @@ int player_is_audio_only(player_h player, bool *paudio_only)
        }
 #endif
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(audio_only, ret_buf);
                *paudio_only = (bool)audio_only;
@@ -4417,7 +4670,9 @@ int player_set_streaming_buffering_time(player_h player, int buffer_ms, int rebu
 
        LOGD("ENTER");
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, buffer_ms, INT, rebuffer_ms);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "buffer_ms", buffer_ms,
+                                       MUSE_TYPE_INT, "rebuffer_ms", rebuffer_ms);
        g_free(ret_buf);
 
        LOGD("LEAVE 0x%X", ret);
@@ -4437,12 +4692,14 @@ int player_get_streaming_buffering_time(player_h player, int *buffer_ms, int *re
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
 
        if (ret == PLAYER_ERROR_NONE) {
                bool ret_val = true;
-
-               player_msg_get2(ret_buf, buffering_time, INT, rebuffering_time, INT, ret_val);
+               ret_val = _player_get_param_value(ret_buf,
+                                                                               MUSE_TYPE_INT, "buffering_time", (void *)&buffering_time,
+                                                                               MUSE_TYPE_INT, "rebuffering_time", (void *)&rebuffering_time,
+                                                                               INVALID_MUSE_TYPE_VALUE);
                if (ret_val) {
                        if (buffer_ms) *buffer_ms = buffering_time;
                        if (rebuffer_ms) *rebuffer_ms = rebuffering_time;
@@ -4473,7 +4730,7 @@ int player_360_is_content_spherical(player_h player, bool *is_spherical)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(val, ret_buf);
                *is_spherical = val;
@@ -4498,7 +4755,7 @@ int player_360_set_enabled(player_h player, bool enabled)
 
        LOGD("ENTER %d", enabled);
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, val);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "val", val);
        g_free(ret_buf);
 
        LOGD("LEAVE 0x%X", ret);
@@ -4520,7 +4777,7 @@ int player_360_is_enabled(player_h player, bool *enabled)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(val, ret_buf);
                *enabled = val;
@@ -4544,7 +4801,10 @@ int player_360_set_direction_of_view(player_h player, float yaw, float pitch)
 
        LOGD("ENTER %f %f", yaw, pitch);
 
-       player_msg_send2(api, pc, ret_buf, ret, DOUBLE, yaw, DOUBLE, pitch);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_DOUBLE, "yaw", (double)yaw,
+                                       MUSE_TYPE_DOUBLE, "pitch", (double)pitch);
+
        g_free(ret_buf);
 
        LOGD("LEAVE 0x%X", ret);
@@ -4567,11 +4827,14 @@ int player_360_get_direction_of_view(player_h player, float *yaw, float *pitch)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
 
        if (ret == PLAYER_ERROR_NONE) {
-               bool ret_val = TRUE;
-               player_msg_get2(ret_buf, yaw_val, DOUBLE, pitch_val, DOUBLE, ret_val);
+               bool ret_val = true;
+               ret_val = _player_get_param_value(ret_buf,
+                                                                               MUSE_TYPE_DOUBLE, "yaw_val", (void *)&yaw_val,
+                                                                               MUSE_TYPE_DOUBLE, "pitch_val", (void *)&pitch_val,
+                                                                               INVALID_MUSE_TYPE_VALUE);
                if (ret_val) {
                        *yaw = (float)yaw_val;
                        *pitch = (float)pitch_val;
@@ -4600,7 +4863,7 @@ int player_360_set_zoom(player_h player, float level)
 
        LOGD("ENTER %f", level);
 
-       player_msg_send1(api, pc, ret_buf, ret, DOUBLE, level);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_DOUBLE, "level", (double)level);
        g_free(ret_buf);
 
        LOGD("LEAVE 0x%X", ret);
@@ -4622,7 +4885,7 @@ int player_360_get_zoom(player_h player, float *level)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
 
        if (ret == PLAYER_ERROR_NONE) {
                if (player_msg_get_type(zoom, ret_buf, DOUBLE)) {
@@ -4653,7 +4916,9 @@ int player_360_set_field_of_view(player_h player, int horizontal_degrees, int ve
 
        LOGD("ENTER %d %d", horizontal_degrees, vertical_degrees);
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, horizontal_degrees, INT, vertical_degrees);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "horizontal_degrees", horizontal_degrees,
+                                       MUSE_TYPE_INT, "vertical_degrees", vertical_degrees);
        g_free(ret_buf);
 
        LOGD("LEAVE 0x%X", ret);
@@ -4676,11 +4941,14 @@ int player_360_get_field_of_view(player_h player, int *horizontal_degrees, int *
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
 
        if (ret == PLAYER_ERROR_NONE) {
-               bool ret_val = TRUE;
-               player_msg_get2(ret_buf, h_val, INT, v_val, INT, ret_val);
+               bool ret_val = true;
+               ret_val = _player_get_param_value(ret_buf,
+                                                                               MUSE_TYPE_INT, "h_val", (void *)&h_val,
+                                                                               MUSE_TYPE_INT, "v_val", (void *)&v_val,
+                                                                               INVALID_MUSE_TYPE_VALUE);
                if (ret_val) {
                        *horizontal_degrees = h_val;
                        *vertical_degrees = v_val;
@@ -4707,7 +4975,7 @@ int player_set_replaygain_enabled(player_h player, bool enabled)
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, val);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "val", val);
        g_free(ret_buf);
        return ret;
 }
@@ -4724,7 +4992,7 @@ int player_is_replaygain_enabled(player_h player, bool *enabled)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(val, ret_buf);
                *enabled = (bool) val;
index 9c182ba..94c09f7 100644 (file)
@@ -38,7 +38,7 @@ int player_set_pcm_extraction_mode(player_h player, bool sync, player_audio_pcm_
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, sync);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "sync", sync);
 
        if (ret == PLAYER_ERROR_NONE) {
                pc->cb_info->user_cb[event] = callback;
@@ -60,7 +60,10 @@ int player_set_pcm_spec(player_h player, const char *format, int samplerate, int
 
        LOGD("ENTER");
 
-       player_msg_send3(api, pc, ret_buf, ret, STRING, format, INT, samplerate, INT, channel);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_STRING, "format", format,
+                                       MUSE_TYPE_INT, "samplerate", samplerate,
+                                       MUSE_TYPE_INT, "channel", channel);
 
        g_free(ret_buf);
        return ret;
@@ -76,7 +79,7 @@ int player_set_streaming_playback_rate(player_h player, float rate)
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, DOUBLE, rate);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_DOUBLE, "rate", rate);
        g_free(ret_buf);
        return ret;
 }
@@ -103,7 +106,7 @@ int player_set_media_stream_buffer_status_cb_ex(player_h player, player_stream_t
                return PLAYER_ERROR_INVALID_PARAMETER;
        }
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, set);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type, MUSE_TYPE_INT, "set", set);
 
        if (ret == PLAYER_ERROR_NONE) {
                pc->cb_info->user_cb[type] = callback;
@@ -159,7 +162,7 @@ int player_unset_media_stream_buffer_status_cb_ex(player_h player, player_stream
 
        set_null_user_cb_lock(pc->cb_info, type);
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, set);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type, MUSE_TYPE_INT, "set", set);
 
        g_free(ret_buf);
        return ret;
@@ -175,7 +178,7 @@ int player_set_media_stream_dynamic_resolution(player_h player, bool drc)
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, drc);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "drc", drc);
        g_free(ret_buf);
        return ret;
 }
@@ -192,6 +195,7 @@ int player_set_ecore_wl_display(player_h player, player_display_type_e type, voi
        unsigned int wl_surface_id;
        player_private_display_type_e conv_type;
        unsigned int (*p_disp_set_wl_display)(int, void *) = NULL;
+       int arr_msg_len = 0;
 
        LOGD("ENTER");
        PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
@@ -214,7 +218,9 @@ int player_set_ecore_wl_display(player_h player, player_display_type_e type, voi
                wl_win.type = conv_type;
        } else return PLAYER_ERROR_INVALID_OPERATION;
 
-       player_msg_send_array(api, pc, ret_buf, ret, wl_win_msg, sizeof(wl_win_msg_type), sizeof(char));
+       arr_msg_len = (sizeof(wl_win_msg_type) / sizeof(int) + (sizeof(wl_win_msg_type) % sizeof(int) ? 1 : 0));
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_ARRAY, "wl_win_msg", arr_msg_len, (int*)wl_win_msg);
        g_free(ret_buf);
 
        return ret;
@@ -235,7 +241,7 @@ int player_set_next_uri(player_h player, const char *uri)
        if (_player_get_valid_path(uri, path) != PLAYER_ERROR_NONE)
                return PLAYER_ERROR_INVALID_PARAMETER;
 
-       player_msg_send1(api, pc, ret_buf, ret, STRING, path);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_STRING, "path", path);
 
        g_free(ret_buf);
        return ret;
@@ -253,7 +259,7 @@ int player_get_next_uri(player_h player, char **uri)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get_string(next_uri, ret_buf);
 
@@ -281,7 +287,7 @@ int player_set_gapless(player_h player, bool gapless)
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, gapless);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "gapless", gapless);
        g_free(ret_buf);
        return ret;
 }
@@ -298,7 +304,7 @@ int player_is_gapless(player_h player, bool *gapless)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(value, ret_buf);
                *gapless = value;
@@ -356,7 +362,7 @@ int player_get_media_packet_video_frame_pool_size(player_h player, int *size)
 
        LOGD("ENTER");
 
-       player_msg_send(api, pc, ret_buf, ret);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(value, ret_buf);
                *size = value;
@@ -377,7 +383,7 @@ int player_enable_media_packet_video_frame_decoded_cb(player_h player, bool enab
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, enable);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "enable", enable);
        g_free(ret_buf);
        return ret;
 }
@@ -394,7 +400,9 @@ int player_set_video_codec_type(player_h player, player_video_codec_type_e codec
 
        LOGD("ENTER %d", codec_type);
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, stream_type, INT, codec_type);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "stream_type", stream_type,
+                                       MUSE_TYPE_INT, "codec_type", codec_type);
 
        g_free(ret_buf);
        LOGD("LEAVE");
@@ -415,7 +423,7 @@ int player_get_video_codec_type(player_h player, player_video_codec_type_e *pcod
 
        LOGD("ENTER");
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, stream_type);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "stream_type", stream_type);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(codec_type, ret_buf);
                *pcodec_type = codec_type;
@@ -438,7 +446,9 @@ int player_set_codec_type(player_h player, player_stream_type_e stream_type, pla
 
        LOGD("ENTER stream: %d, codec: %d", stream_type, codec_type);
 
-       player_msg_send2(api, pc, ret_buf, ret, INT, stream_type, INT, codec_type);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+                                       MUSE_TYPE_INT, "stream_type", stream_type,
+                                       MUSE_TYPE_INT, "codec_type", codec_type);
 
        g_free(ret_buf);
        LOGD("LEAVE");
@@ -459,7 +469,7 @@ int player_get_codec_type(player_h player, player_stream_type_e stream_type, pla
 
        LOGD("ENTER stream_type: %d", stream_type);
 
-       player_msg_send1(api, pc, ret_buf, ret, INT, stream_type);
+       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "stream_type", stream_type);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get(codec_type, ret_buf);
                *pcodec_type = codec_type;