g_free(cb_info);
}
+int _get_api_timeout(player_cli_s *pc, muse_player_api_e api)
+{
+ int timeout = 0;
+
+ switch(api) {
+ case MUSE_PLAYER_API_PREPARE:
+ case MUSE_PLAYER_API_PREPARE_ASYNC:
+ case MUSE_PLAYER_API_UNPREPARE:
+ case MUSE_PLAYER_API_START:
+ case MUSE_PLAYER_API_STOP:
+ case MUSE_PLAYER_API_PAUSE:
+ timeout += SERVER_TIMEOUT(pc);
+ default:
+ /* check prepare async is done */
+ if(pc && CALLBACK_INFO(pc) &&
+ CALLBACK_INFO(pc)->user_cb[_PLAYER_EVENT_TYPE_PREPARE])
+ timeout += SERVER_TIMEOUT(pc);
+ break;
+ }
+ timeout += CALLBACK_TIME_OUT;
+ return timeout;
+}
+
int wait_for_cb_return(muse_player_api_e api, callback_cb_info_s *cb_info,
char **ret_buf, int time_out)
{
ret = PLAYER_ERROR_INVALID_OPERATION;
goto ErrorExit;
}
+ mm_player_get_state_timeout(INT_HANDLE(pc), &SERVER_TIMEOUT(pc), TRUE);
+ SERVER_TIMEOUT(pc) += CALLBACK_TIME_OUT;
if(player_msg_get_string(stream_path, ret_buf)) {
LOGD("shmsrc stream path : %s", stream_path);
if(mm_player_set_shm_stream_path(INT_HANDLE(pc), stream_path)
muse_player_api_e api = MUSE_PLAYER_API_PREPARE_ASYNC;
player_cli_s *pc = (player_cli_s *) player;
char *ret_buf = NULL;
+ int is_streaming = 0;
LOGD("ENTER");
}
player_msg_send(api, pc, ret_buf, ret);
+ if(ret == PLAYER_ERROR_NONE) {
+ player_msg_get(is_streaming, ret_buf);
+ IS_STREAMING_CONTENT(pc) = is_streaming;
+ mm_player_get_state_timeout(INT_HANDLE(pc), &SERVER_TIMEOUT(pc),
+ is_streaming);
+ }
+
g_free(ret_buf);
return ret;
}
player_cli_s *pc = (player_cli_s *) player;
char *ret_buf = NULL;
char caps[MUSE_MSG_MAX_LENGTH] = {0};
+ int is_streaming = 0;
LOGD("ENTER");
NULL);
if(ret == PLAYER_ERROR_NONE) {
+ player_msg_get(is_streaming, ret_buf);
+ IS_STREAMING_CONTENT(pc) = is_streaming;
+ mm_player_get_state_timeout(INT_HANDLE(pc), &SERVER_TIMEOUT(pc),
+ is_streaming);
player_msg_get_string(caps, ret_buf);
if(strlen(caps) > 0 &&
mm_player_mused_realize(INT_HANDLE(pc), caps) != MM_ERROR_NONE)
typedef struct {
intptr_t bo;
+ gboolean is_streaming;
+ gint timeout;
}server_info_s;
typedef struct _player_cli_s{
/* server tbm bo */
#define SERVER_TBM_BO(h) ((h)->server.bo)
+/* content type is streaming */
+#define IS_STREAMING_CONTENT(h) ((h)->server.is_streaming)
+/* server state change timeout */
+#define SERVER_TIMEOUT(h) ((h)->server.timeout)
+int _get_api_timeout(player_cli_s *pc, muse_player_api_e api);
int wait_for_cb_return(muse_player_api_e api, callback_cb_info_s *cb_info,
char **ret_buf, int time_out);
int player_sound_register(player_h player, int pid);
+int player_is_streaming(player_h player, bool *is_streaming);
/**
* @brief Called when the video sink bin is crated.
#include <tbm_bufmgr.h>
#include <player2_private.h>
-#define CALLBACK_TIME_OUT 35
+#define CALLBACK_TIME_OUT 5
typedef int32_t INT;
typedef int64_t INT64;
char *__sndMsg__; \
int __len__; \
int __fd__; \
+ int __timeout__ = _get_api_timeout(player, api); \
if(CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
else {ret = PLAYER_ERROR_INVALID_STATE;break;} \
__sndMsg__ = muse_core_msg_json_factory_new(api, \
LOGE("sending message failed"); \
ret = PLAYER_ERROR_INVALID_OPERATION; \
} else \
- ret = wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, CALLBACK_TIME_OUT); \
+ ret = wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
muse_core_msg_json_factory_free(__sndMsg__); \
}while(0)
char *__sndMsg__; \
int __len__; \
int __fd__; \
+ int __timeout__ = _get_api_timeout(player, api); \
type __value__ = (type)param; \
if(CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
else {ret = PLAYER_ERROR_INVALID_STATE;break;} \
LOGE("sending message failed"); \
ret = PLAYER_ERROR_INVALID_OPERATION; \
} else \
- ret = wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, CALLBACK_TIME_OUT); \
+ ret = wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
muse_core_msg_json_factory_free(__sndMsg__); \
}while(0)
char *__sndMsg__; \
int __len__; \
int __fd__; \
+ int __timeout__ = _get_api_timeout(player, api); \
type1 __value1__ = (type1)param1; \
type2 __value2__ = (type2)param2; \
if(CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
LOGE("sending message failed"); \
ret = PLAYER_ERROR_INVALID_OPERATION; \
} else \
- ret = wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, CALLBACK_TIME_OUT); \
+ ret = wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
muse_core_msg_json_factory_free(__sndMsg__); \
}while(0)
char *__sndMsg__; \
int __len__; \
int __fd__; \
+ int __timeout__ = _get_api_timeout(player, api); \
type1 __value1__ = (type1)param1; \
type2 __value2__ = (type2)param2; \
type3 __value3__ = (type3)param3; \
LOGE("sending message failed"); \
ret = PLAYER_ERROR_INVALID_OPERATION; \
} else \
- ret = wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, CALLBACK_TIME_OUT); \
+ ret = wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
muse_core_msg_json_factory_free(__sndMsg__); \
}while(0)
char *__sndMsg__; \
int __len__; \
int __fd__; \
+ int __timeout__ = _get_api_timeout(player, api); \
type1 __value1__ = (type1)param1; \
type2 __value2__ = (type2)param2; \
type3 __value3__ = (type3)param3; \
LOGE("sending message failed"); \
ret = PLAYER_ERROR_INVALID_OPERATION; \
} else \
- ret = wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, CALLBACK_TIME_OUT); \
+ ret = wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
muse_core_msg_json_factory_free(__sndMsg__); \
}while(0)
char *__sndMsg__; \
int __len__; \
int __fd__; \
+ int __timeout__ = _get_api_timeout(player, api); \
int *__value__ = (int *)param; \
if(CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
else {ret = PLAYER_ERROR_INVALID_STATE;break;} \
LOGE("sending message failed"); \
ret = PLAYER_ERROR_INVALID_OPERATION; \
} else \
- ret = wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, CALLBACK_TIME_OUT); \
+ ret = wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
muse_core_msg_json_factory_free(__sndMsg__); \
}while(0)
char *__sndMsg__; \
int __len__; \
int __fd__; \
+ int __timeout__ = _get_api_timeout(player, api); \
int *__value1__ = (int *)param1; \
int *__value2__ = (int *)param2; \
if(CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
LOGE("sending message failed"); \
ret = PLAYER_ERROR_INVALID_OPERATION; \
} else \
- ret = wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, CALLBACK_TIME_OUT); \
+ ret = wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
muse_core_msg_json_factory_free(__sndMsg__); \
}while(0)
Name: capi-media-player
Summary: A Media Daemon player library in Tizen Native API
-Version: 0.3.1
+Version: 0.3.2
Release: 0
Group: Multimedia/API
License: Apache-2.0
muse_player_api_e api = MUSE_PLAYER_API_PREPARE;
player_h player;
char *caps = NULL;
+ bool is_streaming = FALSE;
handle = muse_core_ipc_get_handle(module);
ret = player_prepare(player);
if(ret == PLAYER_ERROR_NONE) {
+ player_is_streaming(player, &is_streaming);
ret = player_get_raw_video_caps(player, &caps);
if(ret == PLAYER_ERROR_NONE && caps) {
- player_msg_return1(api, ret, module, STRING, caps);
+ player_msg_return2(api, ret, module, STRING, caps, INT, is_streaming);
g_free(caps);
- return ret;
- }
+ } else
+ player_msg_return1(api, ret, module, INT, is_streaming);
+
+ return ret;
}
player_msg_return(api, ret, module);
muse_player_api_e api = MUSE_PLAYER_API_PREPARE_ASYNC;
player_h player;
prepare_data_t *prepare_data;
+ bool is_streaming = FALSE;
handle = muse_core_ipc_get_handle(module);
prepare_data->module = module;
ret = player_prepare_async(player, _prepare_async_cb, prepare_data);
+ if(ret == PLAYER_ERROR_NONE) {
+ player_is_streaming(player, &is_streaming);
+ player_msg_return1(api, ret, module, INT, is_streaming);
+ return ret;
+ }
player_msg_return(api, ret, module);