int ret = PLAYER_ERROR_NONE;
player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
+ char *ret_buf = NULL;
int set = 1;
if (MUSE_PLAYER_EVENT_TYPE_BUFFERING == type) {
return PLAYER_ERROR_INVALID_OPERATION;
LOGI("Event type : %d ", type);
- PLAYER_SEND_MSG_ASYNC(api, MSG_FD(pc), ret, MUSE_TYPE_INT, "type", type, MUSE_TYPE_INT, "set", 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;
pc->cb_info->user_data[type] = user_data;
}
+
+ g_free(ret_buf);
return ret;
}
int ret = PLAYER_ERROR_NONE;
player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
+ char *ret_buf = NULL;
int set = 0;
LOGI("Event type : %d ", type);
PLAYER_NULL_ARG_CHECK(CALLBACK_INFO(pc));
set_null_user_cb_lock(CALLBACK_INFO(pc), type);
- PLAYER_SEND_MSG_ASYNC(api, MSG_FD(pc), ret, MUSE_TYPE_INT, "type", type, MUSE_TYPE_INT, "set", 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;
}
int player_set_media_packet_video_frame_decoded_cb(player_h player, player_media_packet_video_decoded_cb callback, void *user_data)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(callback);
- int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *)player;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- char *ret_buf = NULL;
- muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME;
- int set = 1;
-
- LOGD("ENTER");
-
- 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;
- pc->cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME] = user_data;
- LOGI("Event type : %d ", MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME);
- }
-
- g_free(ret_buf);
- return ret;
+ return __set_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME, player, callback, user_data);
}
int player_unset_media_packet_video_frame_decoded_cb(player_h player)
{
- PLAYER_INSTANCE_CHECK(player);
- int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *)player;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- char *ret_buf = NULL;
- muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME;
- int set = 0;
-
- LOGD("ENTER");
-
- set_null_user_cb_lock(pc->cb_info, type);
-
- 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 __unset_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME, player);
}
int player_set_video_stream_changed_cb(player_h player, player_video_stream_changed_cb callback, void *user_data)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(callback);
- int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *)player;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- char *ret_buf = NULL;
- muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED;
- int set = 1;
-
- LOGD("ENTER");
-
- 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;
- pc->cb_info->user_data[type] = user_data;
- LOGI("Event type : %d ", type);
- }
-
- g_free(ret_buf);
- return ret;
+ return __set_callback(MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED, player, callback, user_data);
}
int player_unset_video_stream_changed_cb(player_h player)
{
- PLAYER_INSTANCE_CHECK(player);
- int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *)player;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- char *ret_buf = NULL;
- muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED;
- int set = 0;
-
- LOGD("ENTER");
-
- set_null_user_cb_lock(pc->cb_info, type);
-
- 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 __unset_callback(MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED, player);
}
int player_set_media_stream_buffer_status_cb(player_h player, player_stream_type_e stream_type, player_media_stream_buffer_status_cb callback, void *user_data)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *)player;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- char *ret_buf = NULL;
muse_player_event_e type;
- int set = 1;
LOGD("ENTER");
return PLAYER_ERROR_INVALID_PARAMETER;
}
- 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;
- pc->cb_info->user_data[type] = user_data;
- LOGI("Event type : %d ", type);
- }
-
- g_free(ret_buf);
- return ret;
+ return __set_callback(type, player, callback, user_data);
}
int player_unset_media_stream_buffer_status_cb(player_h player, player_stream_type_e stream_type)
{
PLAYER_INSTANCE_CHECK(player);
- int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *)player;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- char *ret_buf = NULL;
muse_player_event_e type;
- int set = 0;
LOGD("ENTER");
return PLAYER_ERROR_INVALID_PARAMETER;
}
- set_null_user_cb_lock(pc->cb_info, type);
-
- 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 __unset_callback(type, player);
}
int player_set_media_stream_seek_cb(player_h player, player_stream_type_e stream_type, player_media_stream_seek_cb callback, void *user_data)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *)player;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- char *ret_buf = NULL;
muse_player_event_e type;
- int set = 1;
LOGD("ENTER");
return PLAYER_ERROR_INVALID_PARAMETER;
}
- 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;
- pc->cb_info->user_data[type] = user_data;
- LOGI("Event type : %d ", type);
- }
-
- g_free(ret_buf);
- return ret;
+ return __set_callback(type, player, callback, user_data);
}
int player_unset_media_stream_seek_cb(player_h player, player_stream_type_e stream_type)
{
PLAYER_INSTANCE_CHECK(player);
- int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *)player;
- muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
- char *ret_buf = NULL;
muse_player_event_e type;
- int set = 0;
LOGD("ENTER");
return PLAYER_ERROR_INVALID_PARAMETER;
}
- set_null_user_cb_lock(pc->cb_info, type);
-
- 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 __unset_callback(type, player);
}
/* TODO Implement raw data socket channel */