int wl_window_height;
} wl_win_msg_type;
+extern int _player_disp_send_msg(int send_fd, char* msg, int *tfd);
+
/**
* @brief Get value from Message.
* @remarks Does NOT guarantee thread safe.
muse_core_msg_deserialize(#param, buf, NULL, NULL, MUSE_TYPE_ANY, param)
/**
- * @brief Get value from Message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] buf string of message buffer. has key and value
- * @param[out] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] type# The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE)
- * @param[out] ret result of get value
- */
-#define player_msg_get2(buf, param1, type1, param2, type2, ret) \
- do { \
- muse_core_msg_parse_err_e __err__ = MUSE_MSG_PARSE_ERROR_NONE; \
- void *__jobj__ = muse_core_msg_object_new(buf, NULL, &__err__); \
- if (!__jobj__) { \
- LOGE("failed to get msg object. err:%d", __err__); \
- ret = FALSE; \
- } else { \
- if (!muse_core_msg_object_get_value(#param1, __jobj__, MUSE_TYPE_##type1, ¶m1)) { \
- ret = FALSE; \
- LOGE("failed to get %s value", #param1); \
- } \
- if (ret && !muse_core_msg_object_get_value(#param2, __jobj__, MUSE_TYPE_##type2, ¶m2)) { \
- ret = FALSE; \
- LOGE("failed to get %s value", #param2); \
- } \
- muse_core_msg_object_free(__jobj__); \
- } \
- } while (0)
-
-/**
- * @brief Get value from Message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] buf string of message buffer. has key and value
- * @param[out] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] type# The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE)
- * @param[out] ret result of get value
- */
-#define player_msg_get3(buf, param1, type1, param2, type2, param3, type3, ret) \
- do { \
- muse_core_msg_parse_err_e __err__ = MUSE_MSG_PARSE_ERROR_NONE; \
- void *__jobj__ = muse_core_msg_object_new(buf, NULL, &__err__); \
- if (!__jobj__) { \
- LOGE("failed to get msg object. err:%d", __err__); \
- ret = FALSE; \
- } else { \
- if (!muse_core_msg_object_get_value(#param1, __jobj__, MUSE_TYPE_##type1, ¶m1)) { \
- ret = FALSE; \
- LOGE("failed to get %s value", #param1); \
- } \
- if (ret && !muse_core_msg_object_get_value(#param2, __jobj__, MUSE_TYPE_##type2, ¶m2)) { \
- ret = FALSE; \
- LOGE("failed to get %s value", #param2); \
- } \
- if (ret && !muse_core_msg_object_get_value(#param3, __jobj__, MUSE_TYPE_##type3, ¶m3)) { \
- ret = FALSE; \
- LOGE("failed to get %s value", #param3); \
- } \
- muse_core_msg_object_free(__jobj__); \
- } \
- } while (0)
-
-/**
- * @brief Get value from Message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] buf string of message buffer. has key and value
- * @param[out] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] type# The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE)
- * @param[out] ret result of get value
- */
-#define player_msg_get4(buf, param1, type1, param2, type2, param3, type3, param4, type4, ret) \
- do { \
- muse_core_msg_parse_err_e __err__ = MUSE_MSG_PARSE_ERROR_NONE; \
- void *__jobj__ = muse_core_msg_object_new(buf, NULL, &__err__); \
- if (!__jobj__) { \
- LOGE("failed to get msg object. err:%d", __err__); \
- ret = FALSE; \
- } else { \
- if (!muse_core_msg_object_get_value(#param1, __jobj__, MUSE_TYPE_##type1, ¶m1)) { \
- ret = FALSE; \
- LOGE("failed to get %s value", #param1); \
- } \
- if (ret && !muse_core_msg_object_get_value(#param2, __jobj__, MUSE_TYPE_##type2, ¶m2)) { \
- ret = FALSE; \
- LOGE("failed to get %s value", #param2); \
- } \
- if (ret && !muse_core_msg_object_get_value(#param3, __jobj__, MUSE_TYPE_##type3, ¶m3)) { \
- ret = FALSE; \
- LOGE("failed to get %s value", #param3); \
- } \
- if (ret && !muse_core_msg_object_get_value(#param4, __jobj__, MUSE_TYPE_##type4, ¶m4)) { \
- ret = FALSE; \
- LOGE("failed to get %s value", #param4); \
- } \
- muse_core_msg_object_free(__jobj__); \
- } \
- } while (0)
-
-/**
- * @brief Get value from Message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] buf string of message buffer. has key and value
- * @param[out] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] type# The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE)
- * @param[out] str_param the name of param is key, must be local pointer variable.
- * @param[out] ret result of get value
- */
-#define player_msg_get1_string(buf, param1, type1, str_param, ret) \
- do { \
- muse_core_msg_parse_err_e __err__ = MUSE_MSG_PARSE_ERROR_NONE; \
- void *__jobj__ = muse_core_msg_object_new(buf, NULL, &__err__); \
- if (!__jobj__) { \
- LOGE("failed to get msg object. err:%d", __err__); \
- ret = FALSE; \
- } else { \
- if (!muse_core_msg_object_get_value(#param1, __jobj__, MUSE_TYPE_##type1, ¶m1)) { \
- LOGE("failed to get %s value", #param1); \
- ret = FALSE; \
- } \
- if (ret && !muse_core_msg_object_get_value(#str_param, __jobj__, MUSE_TYPE_STRING, str_param)) { \
- LOGE("failed to get %s value", #str_param); \
- ret = FALSE; \
- } \
- muse_core_msg_object_free(__jobj__); \
- } \
- } while (0)
-
-
-/**
- * @brief Get value from Message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] buf string of message buffer. has key and value
- * @param[out] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] type# The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE)
- * @param[out] str_param the name of param is key, must be local pointer variable.
- * @param[out] ret result of get value
- */
-#define player_msg_get2_string(buf, param1, type1, param2, type2, str_param, ret) \
- do { \
- muse_core_msg_parse_err_e __err__ = MUSE_MSG_PARSE_ERROR_NONE; \
- void *__jobj__ = muse_core_msg_object_new(buf, NULL, &__err__); \
- if (!__jobj__) { \
- LOGE("failed to get msg object. err:%d", __err__); \
- ret = FALSE; \
- } else { \
- if (!muse_core_msg_object_get_value(#param1, __jobj__, MUSE_TYPE_##type1, ¶m1)) { \
- LOGE("failed to get %s value", #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(#str_param, __jobj__, MUSE_TYPE_STRING, str_param)) { \
- LOGE("failed to get %s value", #str_param); \
- ret = FALSE; \
- } \
- muse_core_msg_object_free(__jobj__); \
- } \
- } while (0)
-
-#define player_send_msg_with_no_return(fd, msg) \
- do { \
- int __len__ = 0; \
- if ((fd != MM_ERROR_INVALID_ARGUMENT) && muse_core_fd_is_valid(fd)) { \
- __len__ = muse_core_msg_send(fd, msg); \
- if (__len__ <= 0) \
- LOGE("sending message failed"); \
- } else { \
- LOGE("get msg fd failed"); \
- } \
- } while (0)
-
-#define player_send_msg(fd, msg, ret) \
- do { \
- int __len__ = 0; \
- if ((fd != MM_ERROR_INVALID_ARGUMENT) && muse_core_fd_is_valid(fd)) { \
- __len__ = muse_core_msg_send(fd, msg); \
- if (__len__ <= 0) { \
- LOGE("sending message failed"); \
- ret = PLAYER_ERROR_INVALID_OPERATION; \
- } \
- } else { \
- LOGE("get msg fd failed"); \
- ret = PLAYER_ERROR_INVALID_OPERATION; \
- } \
- } while (0)
-
-#define player_send_msg_with_fd(fd, tfd, msg) \
- do { \
- int __len__ = 0; \
- if ((fd > 0) && muse_core_fd_is_valid(fd)) { \
- __len__ = muse_core_msg_send_fd(fd, tfd, msg); \
- if (__len__ <= 0) \
- LOGE("sending message failed"); \
- } else { \
- LOGE("get msg fd failed"); \
- } \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] ret Thre result of API.
- * @param[in] module mused module information
- */
-#define player_msg_return(api, ret, module) \
- do { \
- char *__sndMsg__; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
- 0); \
- player_send_msg(muse_server_module_get_msg_fd(module), __sndMsg__, ret); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] ret Thre result of API.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param the name of param is key, must be local variable. never be pointer.
- */
-#define player_msg_return1(api, ret, module, type, param) \
- do { \
- char *__sndMsg__; \
- type __value__ = (type)param; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
- MUSE_TYPE_##type, #param, __value__, \
- 0); \
- player_send_msg(muse_server_module_get_msg_fd(module), __sndMsg__, ret); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] ret Thre result of API.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- */
-#define player_msg_return2(api, ret, module, type1, param1, type2, param2) \
- do { \
- char *__sndMsg__; \
- type1 __value1__ = (type1)param1; \
- type2 __value2__ = (type2)param2; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
- MUSE_TYPE_##type1, #param1, __value1__, \
- MUSE_TYPE_##type2, #param2, __value2__, \
- 0); \
- player_send_msg(muse_server_module_get_msg_fd(module), __sndMsg__, ret); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] ret Thre result of API.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- */
-#define player_msg_return3(api, ret, module, type1, param1, type2, param2, type3, param3) \
- do { \
- char *__sndMsg__; \
- type1 __value1__ = (type1)param1; \
- type2 __value2__ = (type2)param2; \
- type3 __value3__ = (type3)param3; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
- MUSE_TYPE_##type1, #param1, __value1__, \
- MUSE_TYPE_##type2, #param2, __value2__, \
- MUSE_TYPE_##type3, #param3, __value3__, \
- 0); \
- player_send_msg(muse_server_module_get_msg_fd(module), __sndMsg__, ret); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
* @brief Create and send return message.
* @remarks Does NOT guarantee thread safe.
* @param[in] api The enum of module API.
* @param[in] ret Thre result of API.
* @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
+ * @param[in] variadic argument The argument information to create return msg
*/
-#define player_msg_return4(api, ret, module, type1, param1, type2, param2, type3, param3, type4, param4) \
- do { \
- char *__sndMsg__; \
- type1 __value1__ = (type1)param1; \
- type2 __value2__ = (type2)param2; \
- type3 __value3__ = (type3)param3; \
- type4 __value4__ = (type4)param4; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
- MUSE_TYPE_##type1, #param1, __value1__, \
- MUSE_TYPE_##type2, #param2, __value2__, \
- MUSE_TYPE_##type3, #param3, __value3__, \
- MUSE_TYPE_##type4, #param4, __value4__, \
- 0); \
- player_send_msg(muse_server_module_get_msg_fd(module), __sndMsg__, ret); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] ret Thre result of API.
- * @param[in] module mused module information
- * @param[in] param the name of param is key, must be local array/pointer variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- */
-#define player_msg_return_array(api, ret, module, param, length, datum_size) \
- do { \
- char *__sndMsg__; \
- int *__value__ = (int *)param; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
- MUSE_TYPE_INT, #length, length, \
- MUSE_TYPE_ARRAY, #param, \
- datum_size == sizeof(int) ? length : \
- length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
- __value__, \
- 0); \
- player_send_msg(muse_server_module_get_msg_fd(module), __sndMsg__, ret); \
- muse_core_msg_free(__sndMsg__); \
+#define PLAYER_RETURN_MSG(api, ret, module, ...) \
+ do { \
+ char *__msg__ = NULL; \
+ __msg__ = muse_core_msg_new(api, \
+ MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
+ ##__VA_ARGS__, 0); \
+ ret = _player_disp_send_msg(muse_server_module_get_msg_fd(module), __msg__, NULL); \
+ muse_core_msg_free(__msg__); \
} while (0)
/**
* @param[in] api The enum of module API.
* @param[in] ret Thre result of API.
* @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] tfd the tbm_fd from tbm_bo_export_fd().
+ * @param[in] variadic argument The argument information to create return msg
*/
-#define player_msg_return2_fd(api, ret, module, type1, param1, type2, param2, tfd) \
+#define PLAYER_RETURN_MSG_WITH_TFD(api, ret, module, tfd, ...) \
do { \
- int __fd__; \
- char *__sndMsg__; \
- type1 __value1__ = (type1)param1; \
- type2 __value2__ = (type2)param2; \
+ char *__msg__ = NULL; \
int __tfd__[MUSE_NUM_FD]; \
memset(__tfd__, -1, sizeof(__tfd__)); \
__tfd__[0] = tfd; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
- MUSE_TYPE_##type1, #param1, __value1__, \
- MUSE_TYPE_##type2, #param2, __value2__, \
- 0); \
- __fd__ = muse_server_module_get_msg_fd(module); \
- if (__fd__ > 0) { \
- if (muse_core_msg_send_fd(__fd__, __tfd__, __sndMsg__) <= 0) { \
- LOGE("sending message failed"); \
- ret = PLAYER_ERROR_INVALID_OPERATION; \
- } \
- } else { \
- LOGE("get msg fd failed"); \
- ret = PLAYER_ERROR_INVALID_OPERATION; \
- } \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- */
-#define player_msg_event(api, event, module) \
- do { \
- char *__sndMsg__; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
- 0); \
- player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
+ __msg__ = muse_core_msg_new(api, \
+ MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \
+ ##__VA_ARGS__, 0); \
+ ret = _player_disp_send_msg(muse_server_module_get_msg_fd(module), __msg__, __tfd__); \
+ muse_core_msg_free(__msg__); \
} while (0)
/**
* @param[in] api The enum of module API.
* @param[in] event The event number.
* @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param the name of param is key, must be local variable. never be pointer.
+ * @param[in] variadic argument The argument information to create event msg
*/
-#define player_msg_event1(api, event, module, type, param) \
- do { \
- char *__sndMsg__; \
- type __value__ = (type)param; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
- MUSE_TYPE_##type, #param, __value__, \
- 0); \
- player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- */
-#define player_msg_event2(api, event, module, type1, param1, type2, param2) \
- do { \
- char *__sndMsg__; \
- type1 __value1__ = (type1)param1; \
- type2 __value2__ = (type2)param2; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
- MUSE_TYPE_##type1, #param1, __value1__, \
- MUSE_TYPE_##type2, #param2, __value2__, \
- 0); \
- player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- */
-#define player_msg_event3(api, event, module, type1, param1, type2, param2, type3, param3) \
- do { \
- char *__sndMsg__; \
- type1 __value1__ = (type1)param1; \
- type2 __value2__ = (type2)param2; \
- type3 __value3__ = (type3)param3; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
- MUSE_TYPE_##type1, #param1, __value1__, \
- MUSE_TYPE_##type2, #param2, __value2__, \
- MUSE_TYPE_##type3, #param3, __value3__, \
- 0); \
- player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- */
-#define player_msg_event4(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4) \
- do { \
- char *__sndMsg__; \
- type1 __value1__ = (type1)param1; \
- type2 __value2__ = (type2)param2; \
- type3 __value3__ = (type3)param3; \
- type4 __value4__ = (type4)param4; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
- MUSE_TYPE_##type1, #param1, __value1__, \
- MUSE_TYPE_##type2, #param2, __value2__, \
- MUSE_TYPE_##type3, #param3, __value3__, \
- MUSE_TYPE_##type4, #param4, __value4__, \
- 0); \
- player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] arr_param the name of param is key, must be local pointer/array variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- */
-#define player_msg_event_array(api, event, module, arr_param, length, datum_size) \
- do { \
- char *__sndMsg__; \
- int *__arr_value__ = (int *)arr_param; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
- MUSE_TYPE_INT, #length, length, \
- MUSE_TYPE_ARRAY, #arr_param, \
- datum_size == sizeof(int) ? length : \
- length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
- __arr_value__, \
- 0); \
- player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param the name of param is key, must be local variable. never be pointer.
- * @param[in] tfd the tbm_fd from tbm_bo_export_fd().
- */
-#define player_msg_event1_fd(api, event, module, type, param, tfd) \
- do { \
- char *__sndMsg__; \
- type __value__ = (type)param; \
- int __tfd__[MUSE_NUM_FD]; \
- memset(__tfd__, -1, sizeof(__tfd__)); \
- __tfd__[0] = tfd; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
- MUSE_TYPE_##type, #param, __value__, \
- 0); \
- player_send_msg_with_fd(muse_server_module_get_msg_fd(module), __tfd__, __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
+#define PLAYER_SEND_EVENT_MSG(api, event, module, ...) \
+ do { \
+ char *__msg__ = NULL; \
+ __msg__ = muse_core_msg_new(api, \
+ MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
+ ##__VA_ARGS__, 0); \
+ _player_disp_send_msg(muse_server_module_get_msg_fd(module), __msg__, NULL); \
+ muse_core_msg_free(__msg__); \
} while (0)
/**
* @param[in] api The enum of module API.
* @param[in] event The event number.
* @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
* @param[in] tfd the tbm_fd from tbm_bo_export_fd().
+ * @param[in] variadic argument The argument information to create event msg
*/
-#define player_msg_event4_fd(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4, tfd) \
- do { \
- char *__sndMsg__; \
- type1 __value1__ = (type1)param1; \
- type2 __value2__ = (type2)param2; \
- type3 __value3__ = (type3)param3; \
- type4 __value4__ = (type4)param4; \
+#define PLAYER_SEND_EVENT_MSG_WITH_TFD(api, event, module, tfd, ...) \
+ do { \
+ char *__msg__ = NULL; \
int __tfd__[MUSE_NUM_FD]; \
memset(__tfd__, -1, sizeof(__tfd__)); \
__tfd__[0] = tfd; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
- MUSE_TYPE_##type1, #param1, __value1__, \
- MUSE_TYPE_##type2, #param2, __value2__, \
- MUSE_TYPE_##type3, #param3, __value3__, \
- MUSE_TYPE_##type4, #param4, __value4__, \
- 0); \
- player_send_msg_with_fd(muse_server_module_get_msg_fd(module), __tfd__, __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
+ __msg__ = muse_core_msg_new(api, \
+ MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
+ ##__VA_ARGS__, 0); \
+ _player_disp_send_msg(muse_server_module_get_msg_fd(module), __msg__, __tfd__); \
+ muse_core_msg_free(__msg__); \
} while (0)
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] arr_param the name of param is key, must be local pointer/array variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- */
-#define player_msg_event1_array(api, event, module, type1, param1, arr_param, length, datum_size) \
- do { \
- char *__sndMsg__; \
- type1 __value1__ = (type1)param1; \
- int *__arr_value__ = (int *)arr_param; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
- MUSE_TYPE_##type1, #param1, __value1__, \
- MUSE_TYPE_INT, #length, length, \
- MUSE_TYPE_ARRAY, #arr_param, \
- datum_size == sizeof(int) ? length : \
- length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
- __arr_value__, \
- 0); \
- player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] arr_param the name of param is key, must be local pointer/array variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- */
-#define player_msg_event2_array(api, event, module, type1, param1, type2, param2, arr_param, length, datum_size) \
- do { \
- char *__sndMsg__; \
- type1 __value1__ = (type1)param1; \
- type2 __value2__ = (type2)param2; \
- int *__arr_value__ = (int *)arr_param; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
- MUSE_TYPE_##type1, #param1, __value1__, \
- MUSE_TYPE_##type2, #param2, __value2__, \
- MUSE_TYPE_INT, #length, length, \
- MUSE_TYPE_ARRAY, #arr_param, \
- datum_size == sizeof(int) ? length : \
- length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
- __arr_value__, \
- 0); \
- player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] arr_param the name of param is key, must be local array/pointer variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- */
-#define player_msg_event3_array(api, event, module, type1, param1, type2, param2, type3, param3, arr_param, length, datum_size) \
- do { \
- char *__sndMsg__; \
- type1 __value1__ = (type1)param1; \
- type2 __value2__ = (type2)param2; \
- type3 __value3__ = (type3)param3; \
- int *__arr_value__ = (int *)arr_param; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
- MUSE_TYPE_##type1, #param1, __value1__, \
- MUSE_TYPE_##type2, #param2, __value2__, \
- MUSE_TYPE_##type3, #param3, __value3__, \
- MUSE_TYPE_INT, #length, length, \
- MUSE_TYPE_ARRAY, #arr_param, \
- datum_size == sizeof(int) ? length : \
- length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
- __arr_value__, \
- 0); \
- player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] arr_param the name of param is key, must be local array/pointer variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- */
-#define player_msg_event4_array(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4, arr_param, length, datum_size) \
- do { \
- char *__sndMsg__; \
- type1 __value1__ = (type1)param1; \
- type2 __value2__ = (type2)param2; \
- type3 __value3__ = (type3)param3; \
- type4 __value4__ = (type4)param4; \
- int *__arr_value__ = (int *)arr_param; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
- MUSE_TYPE_##type1, #param1, __value1__, \
- MUSE_TYPE_##type2, #param2, __value2__, \
- MUSE_TYPE_##type3, #param3, __value3__, \
- MUSE_TYPE_##type4, #param4, __value4__, \
- MUSE_TYPE_INT, #length, length, \
- MUSE_TYPE_ARRAY, #arr_param, \
- datum_size == sizeof(int) ? length : \
- length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
- __arr_value__, \
- 0); \
- player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] arr_param the name of param is key, must be local array/pointer variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- */
-#define player_msg_event5_array(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4, type5, param5, arr_param, length, datum_size) \
- do { \
- char *__sndMsg__; \
- type1 __value1__ = (type1)param1; \
- type2 __value2__ = (type2)param2; \
- type3 __value3__ = (type3)param3; \
- type4 __value4__ = (type4)param4; \
- type5 __value5__ = (type5)param5; \
- int *__arr_value__ = (int *)arr_param; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
- MUSE_TYPE_##type1, #param1, __value1__, \
- MUSE_TYPE_##type2, #param2, __value2__, \
- MUSE_TYPE_##type3, #param3, __value3__, \
- MUSE_TYPE_##type4, #param4, __value4__, \
- MUSE_TYPE_##type5, #param5, __value5__, \
- MUSE_TYPE_INT, #length, length, \
- MUSE_TYPE_ARRAY, #arr_param, \
- datum_size == sizeof(int) ? length : \
- length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
- __arr_value__, \
- 0); \
- player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
- } while (0)
-
-/**
- * @brief Create and send return message.
- * @remarks Does NOT guarantee thread safe.
- * @param[in] api The enum of module API.
- * @param[in] event The event number.
- * @param[in] module mused module information
- * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
- * @param[in] param# the name of param is key, must be local variable. never be pointer.
- * @param[in] arr_param the name of param is key, must be local array/pointer variable.
- * @param[in] length The size of array.
- * @param[in] datum_size The size of a array's datum.
- * @param[in] tfd the array of tbm_fd from tbm_bo_export_fd().
- */
-#define player_msg_event8_array_fd(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4, type5, param5, type6, param6, type7, param7, type8, param8, arr_param, length, datum_size, tfd) \
- do { \
- char *__sndMsg__; \
- type1 __value1__ = (type1)param1; \
- type2 __value2__ = (type2)param2; \
- type3 __value3__ = (type3)param3; \
- type4 __value4__ = (type4)param4; \
- type5 __value5__ = (type5)param5; \
- type6 __value6__ = (type6)param6; \
- type7 __value7__ = (type7)param7; \
- type8 __value8__ = (type8)param8; \
- int *__arr_value__ = (int *)arr_param; \
- __sndMsg__ = muse_core_msg_new(api, \
- MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
- MUSE_TYPE_##type1, #param1, __value1__, \
- MUSE_TYPE_##type2, #param2, __value2__, \
- MUSE_TYPE_##type3, #param3, __value3__, \
- MUSE_TYPE_##type4, #param4, __value4__, \
- MUSE_TYPE_##type5, #param5, __value5__, \
- MUSE_TYPE_##type6, #param6, __value6__, \
- MUSE_TYPE_##type7, #param7, __value7__, \
- MUSE_TYPE_##type8, #param8, __value8__, \
- MUSE_TYPE_INT, #length, length, \
- MUSE_TYPE_ARRAY, #arr_param, \
- datum_size == sizeof(int) ? length : \
- length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \
- __arr_value__, \
- 0); \
- player_send_msg_with_fd(muse_server_module_get_msg_fd(module), tfd, __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
+#define PLAYER_SEND_EVENT_MSG_WITH_TFDS(api, event, module, tfds, ...) \
+ do { \
+ char *__msg__ = NULL; \
+ __msg__ = muse_core_msg_new(api, \
+ MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \
+ ##__VA_ARGS__, 0); \
+ _player_disp_send_msg(muse_server_module_get_msg_fd(module), __msg__, tfds); \
+ muse_core_msg_free(__msg__); \
} while (0)
/**
* @remarks Does NOT guarantee thread safe.
* @param[in] module mused module information
*/
-#define player_msg_create_ack(module) \
+#define PLAYER_SEND_CREATE_ACK(module) \
do { \
- char *__sndMsg__; \
- __sndMsg__ = muse_core_msg_new(MUSE_PLAYER_CB_CREATE_ACK, \
+ char *__msg__; \
+ __msg__ = muse_core_msg_new(MUSE_PLAYER_CB_CREATE_ACK, \
0); \
- player_send_msg_with_no_return(muse_server_module_get_msg_fd(module), __sndMsg__); \
- muse_core_msg_free(__sndMsg__); \
+ _player_disp_send_msg(muse_server_module_get_msg_fd(module), __msg__, NULL); \
+ muse_core_msg_free(__msg__); \
} while (0)
#define EXTERNAL_STORAGE_PRIVILEGE_NAME "http://tizen.org/privilege/externalstorage"
#define INTERNET_PRIVILEGE_NAME "http://tizen.org/privilege/internet"
#define NUM_OF_URI_PREFIX 7
+#define INVALID_MUSE_TYPE_VALUE 0
+
static const char *uri_prefix[NUM_OF_URI_PREFIX] = {
"http://",
"https://",
LOGD("num of vdec out buffer, total:%d, extra:%d", num, extra_num);
}
- player_msg_event(api, ev, module);
+ PLAYER_SEND_EVENT_MSG(api, ev, module);
}
static void __player_callback(muse_player_event_e ev, muse_module_h module)
LOGD("ENTER");
- player_msg_event(api, ev, module);
+ PLAYER_SEND_EVENT_MSG(api, ev, module);
}
static void _seek_complate_cb(void *user_data)
return;
}
- player_msg_event4_fd(api, ev, module, INT, width, INT, height, INT, size, INT, key, tfd);
+ PLAYER_SEND_EVENT_MSG_WITH_TFD(api, ev, module, tfd,
+ MUSE_TYPE_INT, "width", width, MUSE_TYPE_INT, "height", height,
+ MUSE_TYPE_INT, "size", (int)size, MUSE_TYPE_INT, "key", key);
return;
}
LOGD("ENTER");
- player_msg_event1(api, ev, module, INT, type);
+ PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "type", (int)type);
}
static int _get_tbm_surface_format(int in_format, uint32_t *out_format)
bool ret_val = false;
uint64_t pts = 0;
int orientation = 0;
+ int msg_len = 0;
memset(&sinfo, 0, sizeof(tbm_surface_info_s));
memset(tfd, INVALID_DEFAULT_VALUE, sizeof(tfd));
muse_player->video_data_list = g_list_append(muse_player->video_data_list, (gpointer)video_data);
g_mutex_unlock(&muse_player->list_lock);
- player_msg_event8_array_fd(api, ev, module, INT, key[0], INT, key[1], INT, key[2], INT, key[3], POINTER, v_data, INT, mimetype, INT64, pts, INT, orientation, surface_info, surface_info_size, sizeof(char), tfd);
+ msg_len = (surface_info_size/sizeof(int) + (surface_info_size%sizeof(int) ? 1 : 0));
+ PLAYER_SEND_EVENT_MSG_WITH_TFDS(api, ev, module, tfd,
+ MUSE_TYPE_INT, "key[0]", key[0], MUSE_TYPE_INT, "key[1]", key[1],
+ MUSE_TYPE_INT, "key[2]", key[2], MUSE_TYPE_INT, "key[3]", key[3],
+ MUSE_TYPE_POINTER, "v_data", v_data, MUSE_TYPE_INT, "mimetype", (int)mimetype,
+ MUSE_TYPE_INT64, "pts", (INT64)pts, MUSE_TYPE_INT, "orientation", orientation,
+ MUSE_TYPE_ARRAY, "surface_info", msg_len, surface_info);
ret_val = true;
ERROR:
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED;
muse_module_h module = (muse_module_h)user_data;
- player_msg_event4(api, ev, module, INT, width, INT, height, INT, fps, INT, bit_rate);
+ PLAYER_SEND_EVENT_MSG(api, ev, module,
+ MUSE_TYPE_INT, "width", width, MUSE_TYPE_INT, "height", height,
+ MUSE_TYPE_INT, "fps", fps, MUSE_TYPE_INT, "bit_rate", bit_rate);
}
static void _media_stream_audio_buffer_status_cb(player_media_stream_buffer_status_e status, void *user_data)
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS;
muse_module_h module = (muse_module_h)user_data;
- player_msg_event1(api, ev, module, INT, status);
+ PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "status", (int)status);
}
static void _media_stream_video_buffer_status_cb(player_media_stream_buffer_status_e status, void *user_data)
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS;
muse_module_h module = (muse_module_h)user_data;
- player_msg_event1(api, ev, module, INT, status);
+ PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "status", (int)status);
}
static void _media_stream_audio_buffer_status_cb_ex(player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data)
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO;
muse_module_h module = (muse_module_h)user_data;
- player_msg_event2(api, ev, module, INT, status, INT64, bytes);
+ PLAYER_SEND_EVENT_MSG(api, ev, module,
+ MUSE_TYPE_INT, "status", (int)status, MUSE_TYPE_INT64, "bytes", (INT64)bytes);
}
static void _media_stream_video_buffer_status_cb_ex(player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data)
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO;
muse_module_h module = (muse_module_h)user_data;
- player_msg_event2(api, ev, module, INT, status, INT64, bytes);
+ PLAYER_SEND_EVENT_MSG(api, ev, module,
+ MUSE_TYPE_INT, "status", (int)status, MUSE_TYPE_INT64, "bytes", (INT64)bytes);
}
static void _media_stream_audio_seek_cb(unsigned long long offset, void *user_data)
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK;
muse_module_h module = (muse_module_h)user_data;
- player_msg_event1(api, ev, module, INT64, offset);
+ PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT64, "offset", (INT64)offset);
}
static void _media_stream_video_seek_cb(unsigned long long offset, void *user_data)
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK;
muse_module_h module = (muse_module_h)user_data;
- player_msg_event1(api, ev, module, INT64, offset);
+ PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT64, "offset", (INT64)offset);
}
static void _interrupted_cb(player_interrupted_code_e code, void *user_data)
LOGD("ENTER");
- player_msg_event1(api, ev, module, INT, code);
+ PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "code", (int)code);
}
static void _set_interrupted_cb(player_h player, void *module, bool set)
LOGD("ENTER");
- player_msg_event1(api, ev, module, INT, code);
+ PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "code", code);
}
static void _set_error_cb(player_h player, void *module, bool set)
LOGD("ENTER");
- player_msg_event2(api, ev, module, INT, duration, STRING, text);
+ PLAYER_SEND_EVENT_MSG(api, ev, module,
+ MUSE_TYPE_INT, "duration", (int)duration, MUSE_TYPE_STRING, "text", (const char*)text);
}
static void _set_subtitle_cb(player_h player, void *module, bool set)
LOGD("ENTER");
- player_msg_event1(api, ev, module, INT, percent);
+ PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "percent", percent);
}
else
ret = legacy_player_unset_progressive_download_message_cb(player);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
}
static void _set_media_packet_video_frame_cb(player_h player, void *data, bool set)
ret = legacy_player_unset_media_packet_video_frame_decoded_cb(player);
}
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
}
static void _set_video_stream_changed_cb(player_h player, void *data, bool set)
else
ret = legacy_player_unset_video_stream_changed_cb(player);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
}
static void _set_media_stream_audio_seek_cb(player_h player, void *data, bool set)
else
ret = legacy_player_unset_media_stream_seek_cb(player, PLAYER_STREAM_TYPE_AUDIO);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
}
static void _set_media_stream_video_seek_cb(player_h player, void *data, bool set)
else
ret = legacy_player_unset_media_stream_seek_cb(player, PLAYER_STREAM_TYPE_VIDEO);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
}
static void _set_media_stream_audio_buffer_cb(player_h player, void *data, bool set)
else
ret = legacy_player_unset_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_AUDIO);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
}
static void _set_media_stream_video_buffer_cb(player_h player, void *data, bool set)
else
ret = legacy_player_unset_media_stream_buffer_status_cb(player, PLAYER_STREAM_TYPE_VIDEO);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
}
static void _set_media_stream_audio_buffer_cb_ex(player_h player, void *data, bool set)
else
ret = legacy_player_unset_media_stream_buffer_status_cb_ex(player, PLAYER_STREAM_TYPE_AUDIO);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
}
static void _set_media_stream_video_buffer_cb_ex(player_h player, void *data, bool set)
else
ret = legacy_player_unset_media_stream_buffer_status_cb_ex(player, PLAYER_STREAM_TYPE_VIDEO);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
}
static void (*set_callback_func[MUSE_PLAYER_EVENT_TYPE_NUM])(player_h player, void *user_data, bool set) = {
}
/* send message */
- player_msg_event1_fd(api, ev, module, INT, key, tfd);
+ PLAYER_SEND_EVENT_MSG_WITH_TFD(api, ev, module, tfd, MUSE_TYPE_INT, "key", key);
return;
}
+int _player_disp_send_msg(int send_fd, char* msg, int *tfd)
+{
+ int send_len = 0;
+
+ if ((send_fd <= 0) || !muse_core_fd_is_valid(send_fd)) {
+ LOGE("invalid socket fd %d", send_fd);
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+
+ if (tfd != NULL) {
+ send_len = muse_core_msg_send_fd(send_fd, tfd, msg);
+ } else {
+ send_len = muse_core_msg_send(send_fd, msg);
+ }
+ if (send_len <= 0) {
+ LOGE("sending message failed");
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+
+ return PLAYER_ERROR_NONE;
+}
+
+int _player_disp_send_msg_async(int send_fd, char* msg)
+{
+ int send_len = 0;
+
+ if ((send_fd <= 0) || !muse_core_fd_is_valid(send_fd)) {
+ LOGE("invalid socket fd %d", send_fd);
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+
+ send_len = muse_core_msg_send(send_fd, msg);
+ if (send_len <= 0) {
+ LOGE("sending message failed");
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+
+ return PLAYER_ERROR_NONE;
+}
+
+static bool _player_disp_get_param_value(char* buf, ...)
+{
+ muse_core_msg_parse_err_e err = MUSE_MSG_PARSE_ERROR_NONE;
+ bool ret = true;
+ va_list var_args;
+ int type = MUSE_TYPE_ANY;
+ char *param_name = NULL;
+ void *value = NULL;
+
+ LOGE("ENTER");
+
+ void *jobj = muse_core_msg_object_new(buf, NULL, &err);
+
+ if (!jobj) {
+ LOGE("failed to get msg object. err:%d", err);
+ return false;
+ }
+
+ va_start(var_args, buf);
+
+ while ((type = va_arg(var_args, int)) != INVALID_MUSE_TYPE_VALUE) {
+ param_name = va_arg(var_args, char *);
+ switch (type) {
+ case MUSE_TYPE_INT:
+ case MUSE_TYPE_INT64:
+ case MUSE_TYPE_DOUBLE:
+ case MUSE_TYPE_STRING:
+ value = va_arg(var_args, void *);
+
+ if (!muse_core_msg_object_get_value(param_name, jobj, type, value)) {
+ ret = false;
+ LOGE("failed to get %s value", param_name);
+ }
+ break;
+ default:
+ LOGE("Unexpected type %d", type);
+ ret = false;
+ break;
+ }
+ }
+
+ muse_core_msg_object_free(jobj);
+
+ va_end(var_args);
+ return ret;
+}
+
int player_disp_create(muse_module_h module)
{
int ret = PLAYER_ERROR_NONE;
if (muse_player == NULL) {
ret = PLAYER_ERROR_OUT_OF_MEMORY;
LOGE("failed to alloc handle 0x%x", ret);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
memset(muse_player, 0x0, sizeof(muse_player_handle_s));
handle = (intptr_t)muse_player;
muse_server_ipc_set_handle(module, handle);
- player_msg_return1(api, ret, module, POINTER, module_addr);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_POINTER, "module_addr", module_addr);
return ret;
ERROR:
free(muse_player);
muse_player = NULL;
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
free(muse_player);
muse_player = NULL;
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return PLAYER_ERROR_NONE; /* to clean up the resource */
}
legacy_player_get_timeout_for_muse(muse_player->player_handle, &timeout);
muse_player->total_size_of_buffers = num;
muse_player->extra_size_of_buffers = extra_num;
- player_msg_return1(api, ret, module, INT, timeout);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "timeout", timeout);
} else {
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
}
return ret;
ret = legacy_player_prepare_async(muse_player->player_handle, _prepare_async_cb, prepare_data);
if (ret == PLAYER_ERROR_NONE) {
legacy_player_get_timeout_for_muse(muse_player->player_handle, &timeout);
- player_msg_return1(api, ret, module, INT, timeout);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "timeout", timeout);
return ret;
} /* else is error */
if (prepare_data)
g_free(prepare_data);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
_remove_export_data(module, 0, TRUE);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
if ((ret = _check_supportable(module, path)) == PLAYER_ERROR_NONE)
ret = legacy_player_set_uri(muse_player->player_handle, path);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
if (ret == PLAYER_ERROR_NONE) {
const char* file_buffering_path = muse_server_module_get_temporal_path();
ret = legacy_player_start(muse_player->player_handle);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_stop(muse_player->player_handle);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_pause(muse_player->player_handle);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
goto ERROR;
}
- player_msg_return1(api, ret, module, INT, bo_addr);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "bo_addr", bo_addr);
/* don't call bo unmap/unref here *
* it will be released at player_disp_deinit_memory_buffer() during _destroy */
if (bo)
tbm_bo_unref(bo);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_state(muse_player->player_handle, &state);
- player_msg_return1(api, ret, module, INT, state);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "state", (int)state);
return ret;
}
double left, right;
bool ret_val = TRUE;
- player_msg_get2(muse_server_module_get_msg(module), left, DOUBLE, right, DOUBLE, ret_val);
+ ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_DOUBLE, "left", (void *)&left,
+ MUSE_TYPE_DOUBLE, "right", (void *)&right,
+ INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
ret = legacy_player_set_volume(muse_player->player_handle, (float)left, (float)right);
} else {
ret = PLAYER_ERROR_INVALID_OPERATION;
}
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_volume(muse_player->player_handle, &left, &right);
- player_msg_return2(api, ret, module, DOUBLE, left, DOUBLE, right);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_DOUBLE, "left", (double)left, MUSE_TYPE_DOUBLE, "right", (double)right);
return ret;
}
char stream_type[MUSE_URI_MAX_LENGTH] = { 0, };
bool ret_val = TRUE;
- player_msg_get1_string(muse_server_module_get_msg(module), stream_index, INT, stream_type, ret_val);
+ ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_INT, "stream_index", (void *)&stream_index,
+ MUSE_TYPE_STRING, "stream_type", (void *)stream_type,
+ INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
ret = legacy_player_set_sound_stream_info_for_mused(muse_player->player_handle, stream_type, stream_index);
ret = PLAYER_ERROR_INVALID_OPERATION;
}
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_set_audio_latency_mode(muse_player->player_handle, (audio_latency_mode_e)latency_mode);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_audio_latency_mode(muse_player->player_handle, &latency_mode);
- player_msg_return1(api, ret, module, INT, latency_mode);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "latency_mode", (int)latency_mode);
return ret;
}
int accurate = 0;
bool ret_val = TRUE;
- player_msg_get2(muse_server_module_get_msg(module), pos, INT, accurate, INT, ret_val);
+ ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_INT, "pos", (void *)&pos,
+ MUSE_TYPE_INT, "accurate", (void *)&accurate,
+ INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
ret = legacy_player_set_play_position(muse_player->player_handle, pos, accurate, _seek_complate_cb, module);
ret = PLAYER_ERROR_INVALID_OPERATION;
}
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_play_position(muse_player->player_handle, &pos);
- player_msg_return1(api, ret, module, INT, pos);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "pos", pos);
return ret;
}
ret = legacy_player_set_mute(muse_player->player_handle, (bool)mute);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_is_muted(muse_player->player_handle, &mute);
- player_msg_return1(api, ret, module, INT, mute);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "mute", (int)mute);
return ret;
}
ret = legacy_player_set_looping(muse_player->player_handle, (bool)looping);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_is_looping(muse_player->player_handle, &looping);
- player_msg_return1(api, ret, module, INT, looping);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "looping", (int)looping);
return ret;
}
ret = legacy_player_get_duration(muse_player->player_handle, &duration);
- player_msg_return1(api, ret, module, INT, duration);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "duration", duration);
return ret;
}
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
player_msg_get_array(wl_win_msg, muse_server_module_get_msg(module));
ret = legacy_player_set_display(muse_player->player_handle, wl_win.type, wl_win.wl_surface_id);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_set_display_mode(muse_player->player_handle, (player_display_mode_e)mode);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_display_mode(muse_player->player_handle, &mode);
- player_msg_return1(api, ret, module, INT, mode);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "mode", (int)mode);
return ret;
}
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
player_msg_get_array(wl_win_msg, muse_server_module_get_msg(module));
ret = legacy_player_set_roi_area(muse_player->player_handle, wl_win.wl_window_x, wl_win.wl_window_y, wl_win.wl_window_width, wl_win.wl_window_height);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_set_playback_rate(muse_player->player_handle, (float)rate);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_set_display_rotation(muse_player->player_handle, (player_display_rotation_e)rotation);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_display_rotation(muse_player->player_handle, &rotation);
- player_msg_return1(api, ret, module, INT, rotation);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "rotation", (int)rotation);
return ret;
}
ret = legacy_player_set_display_visible(muse_player->player_handle, visible);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_is_display_visible(muse_player->player_handle, &value);
- player_msg_return1(api, ret, module, INT, value);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "value", (int)value);
return ret;
}
ret = legacy_player_get_content_info(muse_player->player_handle, key, &value);
if (ret == PLAYER_ERROR_NONE) {
- player_msg_return1(api, ret, module, STRING, value);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_STRING, "value", (const char*)value);
free(value);
} else
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_codec_info(muse_player->player_handle, &audio_codec, &video_codec);
if (ret == PLAYER_ERROR_NONE) {
- player_msg_return2(api, ret, module, STRING, audio_codec, STRING, video_codec);
+ PLAYER_RETURN_MSG(api, ret, module,
+ MUSE_TYPE_STRING, "audio_codec", (const char*)audio_codec,
+ MUSE_TYPE_STRING, "video_codec", (const char*)video_codec);
free(audio_codec);
free(video_codec);
} else
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_audio_stream_info(muse_player->player_handle, &sample_rate, &channel, &bit_rate);
- player_msg_return3(api, ret, module, INT, sample_rate, INT, channel, INT, bit_rate);
+ PLAYER_RETURN_MSG(api, ret, module,
+ MUSE_TYPE_INT, "sample_rate", sample_rate,
+ MUSE_TYPE_INT, "channel", channel,
+ MUSE_TYPE_INT, "bit_rate", bit_rate);
return ret;
}
ret = legacy_player_get_video_stream_info(muse_player->player_handle, &fps, &bit_rate);
- player_msg_return2(api, ret, module, INT, fps, INT, bit_rate);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "fps", fps, MUSE_TYPE_INT, "bit_rate", bit_rate);
return ret;
}
ret = legacy_player_get_video_size(muse_player->player_handle, &width, &height);
- player_msg_return2(api, ret, module, INT, width, INT, height);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "width", width, MUSE_TYPE_INT, "height", height);
return ret;
}
ret = PLAYER_ERROR_INVALID_OPERATION;
goto ERROR;
}
- player_msg_return2_fd(api, ret, module, INT, size, INT, key, tfd);
+ PLAYER_RETURN_MSG_WITH_TFD(api, ret, module, tfd,
+ MUSE_TYPE_INT, "size", size, MUSE_TYPE_INT, "key", key);
} else {
LOGD("album art is empty, didn't make tbm_bo");
size = 0;
- player_msg_return1(api, ret, module, INT, size);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "size", size);
}
return ret;
ERROR:
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_audio_effect_get_equalizer_bands_count(muse_player->player_handle, &count);
- player_msg_return1(api, ret, module, INT, count);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "count", count);
return ret;
}
if (jobj)
muse_core_msg_object_free(jobj);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
int index = 0, level = 0;
bool ret_val = TRUE;
- player_msg_get2(muse_server_module_get_msg(module), index, INT, level, INT, ret_val);
+ ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_INT, "index", (void *)&index,
+ MUSE_TYPE_INT, "level", (void *)&level,
+ INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
ret = legacy_player_audio_effect_set_equalizer_band_level(muse_player->player_handle, index, level);
ret = PLAYER_ERROR_INVALID_OPERATION;
}
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_audio_effect_get_equalizer_band_level(muse_player->player_handle, index, &level);
- player_msg_return1(api, ret, module, INT, level);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "level", level);
return ret;
}
ret = legacy_player_audio_effect_get_equalizer_level_range(muse_player->player_handle, &min, &max);
- player_msg_return2(api, ret, module, INT, min, INT, max);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "min", min, MUSE_TYPE_INT, "max", max);
return ret;
}
ret = legacy_player_audio_effect_get_equalizer_band_frequency(muse_player->player_handle, index, &frequency);
- player_msg_return1(api, ret, module, INT, frequency);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "frequency", frequency);
return ret;
}
ret = legacy_player_audio_effect_get_equalizer_band_frequency_range(muse_player->player_handle, index, &range);
- player_msg_return1(api, ret, module, INT, range);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "range", range);
return ret;
}
ret = legacy_player_audio_effect_equalizer_clear(muse_player->player_handle);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_audio_effect_equalizer_is_available(muse_player->player_handle, &available);
- player_msg_return1(api, ret, module, INT, available);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "available", (int)available);
return ret;
}
if ((ret = _check_supportable(module, dw_path)) == PLAYER_ERROR_NONE)
ret = legacy_player_set_progressive_download_path(muse_player->player_handle, dw_path);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_progressive_download_status(muse_player->player_handle, ¤t, &total_size);
- player_msg_return2(api, ret, module, POINTER, current, POINTER, total_size);
+ PLAYER_RETURN_MSG(api, ret, module,
+ MUSE_TYPE_POINTER, "current", (POINTER)current,
+ MUSE_TYPE_POINTER, "total_size", (POINTER)total_size);
return ret;
}
ret = legacy_player_capture_video(muse_player->player_handle, _capture_video_cb, module);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
if (jobj)
muse_core_msg_object_free(jobj);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
if (jobj)
muse_core_msg_object_free(jobj);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_streaming_download_progress(muse_player->player_handle, &start, ¤t);
- player_msg_return2(api, ret, module, INT, start, INT, current);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "start", start, MUSE_TYPE_INT, "current", current);
return ret;
}
ret = legacy_player_set_subtitle_path(muse_player->player_handle, NULL);
}
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_set_subtitle_position_offset(muse_player->player_handle, millisecond);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
if (jobj)
muse_core_msg_object_free(jobj);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
set_media_stream_info_exit:
media_format_unref(format);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
muse_player_handle_s *muse_player = NULL;
muse_player_event_e type;
int set = 0;
- bool ret_val = TRUE;
+ bool ret_val = true;
+
+ ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_INT, "type", (void *)&type,
+ MUSE_TYPE_INT, "set", (void *)&set,
+ INVALID_MUSE_TYPE_VALUE);
- player_msg_get2(muse_server_module_get_msg(module), type, INT, set, INT, ret_val);
if (ret_val) {
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
if (type < MUSE_PLAYER_EVENT_TYPE_NUM && set_callback_func[type] != NULL)
unsigned long long max_size;
bool ret_val = TRUE;
- player_msg_get2(muse_server_module_get_msg(module), type, INT, max_size, INT64, ret_val);
+ ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_INT, "type", (void *)&type,
+ MUSE_TYPE_INT64, "max_size", (void *)&max_size,
+ INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
ret = legacy_player_set_media_stream_buffer_max_size(muse_player->player_handle, type, max_size);
ret = PLAYER_ERROR_INVALID_OPERATION;
}
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_media_stream_buffer_max_size(muse_player->player_handle, type, &max_size);
if (ret == PLAYER_ERROR_NONE)
- player_msg_return1(api, ret, module, INT64, max_size);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT64, "max_size", (INT64)max_size);
else
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
unsigned percent = 0;
bool ret_val = TRUE;
- player_msg_get2(muse_server_module_get_msg(module), type, INT, percent, INT, ret_val);
+ ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_INT, "type", (void *)&type,
+ MUSE_TYPE_INT, "percent", (void *)&percent,
+ INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
ret = legacy_player_set_media_stream_buffer_min_threshold(muse_player->player_handle, type, percent);
} else {
ret = PLAYER_ERROR_INVALID_OPERATION;
}
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_media_stream_buffer_min_threshold(muse_player->player_handle, type, &percent);
if (ret == PLAYER_ERROR_NONE)
- player_msg_return1(api, ret, module, INT, percent);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "percent", (int)percent);
else
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_set_media_stream_dynamic_resolution(muse_player->player_handle, (bool)drc);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_track_count(muse_player->player_handle, type, &count);
if (ret == PLAYER_ERROR_NONE)
- player_msg_return1(api, ret, module, INT, count);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "count", count);
else
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_current_track(muse_player->player_handle, type, &index);
if (ret == PLAYER_ERROR_NONE)
- player_msg_return1(api, ret, module, INT, index);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "index", index);
else
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
int index = 0;
bool ret_val = TRUE;
- player_msg_get2(muse_server_module_get_msg(module), type, INT, index, INT, ret_val);
+ ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_INT, "type", (void *)&type,
+ MUSE_TYPE_INT, "index", (void *)&index,
+ INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
ret = legacy_player_select_track(muse_player->player_handle, type, index);
} else {
ret = PLAYER_ERROR_INVALID_OPERATION;
}
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
int code_len = 0;
bool ret_val = TRUE;
- player_msg_get2(muse_server_module_get_msg(module), type, INT, index, INT, ret_val);
+ ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_INT, "type", (void *)&type,
+ MUSE_TYPE_INT, "index", (void *)&index,
+ INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
ret = legacy_player_get_track_language_code(muse_player->player_handle, type, index, &code, &code_len);
}
if (ret == PLAYER_ERROR_NONE)
- player_msg_return_array(api, ret, module, code, code_len, sizeof(char));
+ PLAYER_RETURN_MSG(api, ret, module,
+ MUSE_TYPE_INT, "code_len", code_len,
+ MUSE_TYPE_STRING, "code", (const char*)code);
else
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
if (code)
free(code);
ret = legacy_player_set_pcm_extraction_mode(muse_player->player_handle, sync, _audio_frame_decoded_cb, module);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
int channel = 0;
bool ret_val = TRUE;
- player_msg_get2_string(muse_server_module_get_msg(module), samplerate, INT, channel, INT, format, ret_val);
-
+ ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_INT, "samplerate", (void *)&samplerate,
+ MUSE_TYPE_INT, "channel", (void *)&channel,
+ MUSE_TYPE_STRING, "format", (void *)format,
+ INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
ret = legacy_player_set_pcm_spec(muse_player->player_handle, format, samplerate, channel);
ret = PLAYER_ERROR_INVALID_OPERATION;
}
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_set_streaming_playback_rate(muse_player->player_handle, (float)rate);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
if (!_remove_export_data(module, key, FALSE))
LOGE("failed to remove export data : key %d", key);
- /* This funct does not send return value to client *
- * You have to use player_msg_send1_no_return() *
- * when you send msg to muse demon. */
+ /* This funct does not send return value to client. *
+ * You have to use PLAYER_SEND_MSG_ASYNC to return buffer. */
return PLAYER_ERROR_NONE;
}
ret = legacy_player_set_next_uri(muse_player->player_handle, path);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_next_uri(muse_player->player_handle, &next_uri);
if (ret == PLAYER_ERROR_NONE) {
- player_msg_return1(api, ret, module, STRING, next_uri);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_STRING, "next_uri", (const char*)next_uri);
free(next_uri);
} else {
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
}
return ret;
ret = legacy_player_set_gapless(muse_player->player_handle, (bool)gapless);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_is_gapless(muse_player->player_handle, &value);
- player_msg_return1(api, ret, module, INT, value);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "value", (int)value);
return ret;
}
LOGD("size of v buffer: %d", muse_player->total_size_of_buffers);
if (muse_player->total_size_of_buffers > DEFAULT_VDEC_TOTAL_SIZE_OF_BUFFER) {
value = muse_player->total_size_of_buffers;
- player_msg_return1(api, ret, module, INT, value);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "value", value);
} else {
ret = PLAYER_ERROR_INVALID_STATE;
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
}
return ret;
ret = legacy_player_enable_media_packet_video_frame_decoded_cb(muse_player->player_handle, (bool)enable);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_adaptive_variant_info(muse_player->player_handle, &num, &var_info);
if (ret != PLAYER_ERROR_NONE || num <= 0)
- player_msg_return1(api, ret, module, INT, num);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "num", num);
else
- player_msg_return2(api, ret, module, INT, num, STRING, var_info);
+ PLAYER_RETURN_MSG(api, ret, module,
+ MUSE_TYPE_INT, "num", num,
+ MUSE_TYPE_STRING, "var_info", (const char*)var_info);
g_free(var_info);
int width = ADAPTIVE_VARIANT_DEFAULT_VALUE;
int height = ADAPTIVE_VARIANT_DEFAULT_VALUE;
- player_msg_get3(muse_server_module_get_msg(module), bandwidth, INT, width, INT, height, INT, ret_val);
+ ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_INT, "bandwidth", (void *)&bandwidth,
+ MUSE_TYPE_INT, "width", (void *)&width,
+ MUSE_TYPE_INT, "height", (void *)&height,
+ INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
ret = legacy_player_set_max_adaptive_variant_limit(muse_player->player_handle, bandwidth, width, height);
ret = PLAYER_ERROR_INVALID_OPERATION;
}
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_max_adaptive_variant_limit(muse_player->player_handle, &bandwidth, &width, &height);
if (ret == PLAYER_ERROR_NONE)
- player_msg_return3(api, ret, module, INT, bandwidth, INT, width, INT, height);
+ PLAYER_RETURN_MSG(api, ret, module,
+ MUSE_TYPE_INT, "bandwidth", bandwidth,
+ MUSE_TYPE_INT, "width", width,
+ MUSE_TYPE_INT, "height", height);
else
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_set_audio_only(muse_player->player_handle, (bool)audio_only);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_is_audio_only(muse_player->player_handle, &audio_only);
- player_msg_return1(api, ret, module, INT, audio_only);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "audio_only", (int)audio_only);
return ret;
}
int buffer_ms = 0, rebuffer_ms = 0;
bool ret_val = true;
- muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
- player_msg_get2(muse_server_module_get_msg(module), buffer_ms, INT, rebuffer_ms, INT, ret_val);
-
- ret = legacy_player_set_streaming_buffering_time(muse_player->player_handle, buffer_ms, rebuffer_ms);
+ ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_INT, "buffer_ms", (void *)&buffer_ms,
+ MUSE_TYPE_INT, "rebuffer_ms", (void *)&rebuffer_ms,
+ INVALID_MUSE_TYPE_VALUE);
+ if (ret_val) {
+ muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
+ ret = legacy_player_set_streaming_buffering_time(muse_player->player_handle, buffer_ms, rebuffer_ms);
+ } else {
+ ret = PLAYER_ERROR_INVALID_OPERATION; /* FIXME: mismatch with API return type */
+ }
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_streaming_buffering_time(muse_player->player_handle, &buffering_time, &rebuffering_time);
if (ret == PLAYER_ERROR_NONE)
- player_msg_return2(api, ret, module, INT, buffering_time, INT, rebuffering_time);
+ PLAYER_RETURN_MSG(api, ret, module,
+ MUSE_TYPE_INT, "buffering_time", buffering_time, MUSE_TYPE_INT, "rebuffering_time", rebuffering_time);
else
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_360_is_content_spherical(muse_player->player_handle, &val);
- player_msg_return1(api, ret, module, INT, val);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "val", (int)val);
return ret;
}
ret = legacy_player_360_set_enabled(muse_player->player_handle, (bool)val);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_360_is_enabled(muse_player->player_handle, &val);
- player_msg_return1(api, ret, module, INT, val);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "val", (int)val);
return ret;
}
double yaw, pitch;
bool ret_val = TRUE;
- player_msg_get2(muse_server_module_get_msg(module), yaw, DOUBLE, pitch, DOUBLE, ret_val);
+ ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_DOUBLE, "yaw", (void *)&yaw,
+ MUSE_TYPE_DOUBLE, "pitch", (void *)&pitch,
+ INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
ret = legacy_player_360_set_direction_of_view(muse_player->player_handle, (float)yaw, (float)pitch);
} else {
ret = PLAYER_ERROR_INVALID_OPERATION;
}
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_360_get_direction_of_view(muse_player->player_handle, &yaw_val, &pitch_val);
- player_msg_return2(api, ret, module, DOUBLE, yaw_val, DOUBLE, pitch_val);
+ PLAYER_RETURN_MSG(api, ret, module,
+ MUSE_TYPE_DOUBLE, "yaw_val", (double)yaw_val,
+ MUSE_TYPE_DOUBLE, "pitch_val", (double)pitch_val);
+
return ret;
}
ret = legacy_player_360_set_zoom(muse_player->player_handle, (float)level);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_360_get_zoom(muse_player->player_handle, &zoom);
- player_msg_return1(api, ret, module, DOUBLE, zoom);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_DOUBLE, "zoom", (double)zoom);
return ret;
}
int horizontal_degrees = 0, vertical_degrees = 0;
bool ret_val = TRUE;
- player_msg_get2(muse_server_module_get_msg(module), horizontal_degrees, INT, vertical_degrees, INT, ret_val);
+ ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_INT, "horizontal_degrees", (void *)&horizontal_degrees,
+ MUSE_TYPE_INT, "vertical_degrees", (void *)&vertical_degrees,
+ INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
ret = legacy_player_360_set_field_of_view(muse_player->player_handle, horizontal_degrees, vertical_degrees);
} else {
ret = PLAYER_ERROR_INVALID_OPERATION;
}
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_360_get_field_of_view(muse_player->player_handle, &h_val, &v_val);
- player_msg_return2(api, ret, module, INT, h_val, INT, v_val);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "h_val", h_val, MUSE_TYPE_INT, "v_val", v_val);
return ret;
}
ret = legacy_player_set_codec_type(muse_player->player_handle, (player_stream_type_e)stream_type, (player_codec_type_e)codec_type);
EXIT:
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_get_codec_type(muse_player->player_handle, (player_stream_type_e)stream_type, &codec_type);
- player_msg_return1(api, ret, module, INT, codec_type);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "codec_type", (int)codec_type);
return ret;
}
ret = legacy_player_set_replaygain_enabled(muse_player->player_handle, (bool)val);
- player_msg_return(api, ret, module);
+ PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
ret = legacy_player_is_replaygain_enabled(muse_player->player_handle, &val);
- player_msg_return1(api, ret, module, INT, val);
+ PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "val", (int)val);
return ret;
}