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.
* @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)
/**
* @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, ¶m1)) { \
- LOGE("failed to get value(%s)", #param1); \
- ret = FALSE; \
- } \
- if (ret && !muse_core_msg_object_get_value(#param2, __jobj__, MUSE_TYPE_##type2, ¶m2)) { \
- 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__ */
#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"
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;
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);
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)
{
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;
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;
}
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]);
}
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;
/* 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);
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);
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;
}
/* 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);
}
}
/* 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]);
/* 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]);
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]);
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;
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;
PLAYER_DISP_DLOPEN(pc); /* update supported_video */
g_free(ret_buf);
+
+ LOGD("LEAVE 0x%X", ret);
return ret;
ERROR:
g_free(pc);
pc = NULL;
*player = NULL;
+
+ LOGD("LEAVE 0x%X", ret);
return ret;
}
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
}
}
#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);
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);
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);
}
g_free(ret_buf);
+
+ LOGD("LEAVE 0x%X", ret);
return ret;
}
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);
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);
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:
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;
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;
}
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;
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;
}
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;
}
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);
}
#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;
}
}
#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;
}
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;
}
}
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);
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;
}
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);
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;
}
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;
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;
}
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;
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;
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;
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;
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;
}
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;
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
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;
}
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;
}
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;
}
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;
}
#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;
}
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);
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);
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);
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;
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;
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;
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);
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;
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;
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;
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;
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;
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;
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;
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;
LOGD("ENTER");
- player_msg_send(api, pc, ret_buf, ret);
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret);
g_free(ret_buf);
return ret;
}
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;
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;
}
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;
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;
}
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 *)¤t,
+ MUSE_TYPE_POINTER, "total_size", (void *)&total_size,
+ INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
*pcurrent = current;
*ptotal_size = total_size;
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);
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;
}
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;
}
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 *)¤t,
+ INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
*pstart = start;
*pcurrent = current;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
bool is_video;
bool is_audio;
bool is_eos;
+ int arr_msg_len = 0;
LOGD("ENTER");
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) {
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) {
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);
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;
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;
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;
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;
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;
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;
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;
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;
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
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)
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);
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;
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);
}
#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;
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);
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;
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;
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);
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;
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);
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;
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);
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)) {
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);
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;
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;
}
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;