#define INVALID_MUSE_TYPE_VALUE 0
#define MAX_S_PATH_LEN 32
+#define MODULE_NAME "player"
#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"
#define PLAYER_FEATURE_SPHERICAL_VIDEO "http://tizen.org/feature/multimedia.player.spherical_video"
+#define PLAYER_FEATURE_AUDIO_OFFLOAD "http://tizen.org/feature/multimedia.player.audio_offload"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
-typedef enum {
- TIZEN_PROFILE_UNKNOWN = 0,
- TIZEN_PROFILE_MOBILE = 0x1,
- TIZEN_PROFILE_WEARABLE = 0x2,
- TIZEN_PROFILE_TV = 0x4,
- TIZEN_PROFILE_IVI = 0x8,
- TIZEN_PROFILE_COMMON = 0x10,
-} tizen_profile_t;
typedef struct {
tbm_fd tfd[MUSE_NUM_FD];
- char* buffer;
+ 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 {
gint fd;
gint fd_id;
bool use_tsurf_pool;
-} _media_pkt_fin_data;
+} _media_pkt_video_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);
+typedef struct {
+ gint key;
+ gint fd;
+ gint fd_id;
+ tbm_bo bo;
+} _media_pkt_audio_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 void __player_media_packet_video_decoded_cb(media_packet_h packet, 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);
+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 _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;
return ret;
}
-int _player_send_msg_async(int send_fd, char* msg)
+int _player_send_msg_async(int send_fd, char *msg)
{
int send_len = 0;
return PLAYER_ERROR_NONE;
}
-static tizen_profile_t _get_tizen_profile()
-{
- char *profileName;
- static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
-
- if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
- return profile;
-
- system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
- switch (*profileName) {
- case 'm':
- case 'M':
- profile = TIZEN_PROFILE_MOBILE;
- break;
- case 'w':
- case 'W':
- profile = TIZEN_PROFILE_WEARABLE;
- break;
- case 't':
- case 'T':
- profile = TIZEN_PROFILE_TV;
- break;
- case 'i':
- case 'I':
- profile = TIZEN_PROFILE_IVI;
- break;
- default: // common or unknown ==> ALL ARE COMMON.
- profile = TIZEN_PROFILE_COMMON;
- }
- free(profileName);
-
- return profile;
-}
-
static int _get_current_state(player_cli_s *pc, player_state_e *pstate)
{
PLAYER_INSTANCE_CHECK(pc);
return ret;
}
-static bool _player_get_param_value(char* buf, ...)
+static bool _player_get_param_value(char *buf, ...)
{
muse_core_msg_parse_err_e err = MUSE_MSG_PARSE_ERROR_NONE;
bool ret = true;
char *param_name = NULL;
void *value = NULL;
- LOGE("ENTER");
-
void *jobj = muse_core_msg_object_new(buf, NULL, &err);
if (!jobj) {
return ret;
}
-int _player_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
+int _player_video_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
{
int ret = MEDIA_PACKET_FINALIZE;
muse_player_api_e api = MUSE_PLAYER_API_RETURN_VIDEO_DATA;
- _media_pkt_fin_data *fin_data = (_media_pkt_fin_data *) user_data;
+ _media_pkt_video_fin_data *fin_data = (_media_pkt_video_fin_data *)user_data;
intptr_t v_data = 0;
char *snd_msg = NULL;
int snd_len = 0;
/* continue the remained job */
}
if (tsurf) {
- /* LOGD("_player_media_packet_finalize tsurf destroy %p", tsurf); */
+ /* LOGD("tsurf destroy %p", tsurf); */
tbm_surface_destroy(tsurf);
tsurf = NULL;
}
return ret;
}
+int _player_audio_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
+{
+ int ret = MEDIA_PACKET_FINALIZE;
+ muse_player_api_e api = MUSE_PLAYER_API_RETURN_BUFFER;
+ _media_pkt_audio_fin_data *fin_data = (_media_pkt_audio_fin_data *)user_data;
+
+ if (!pkt) {
+ LOGE("invalid parameter buffer %p, user_data %p", pkt, user_data);
+ return ret;
+ }
+
+ if (!fin_data) {
+ LOGE("invalid fin_data");
+ goto EXIT;
+ }
+
+ if (fin_data->bo) {
+ /* LOGD("release memory - %p", fin_data->bo); */
+ tbm_bo_unref(fin_data->bo);
+ }
+
+ if (fin_data->fd > INVALID_DEFAULT_VALUE && muse_core_fd_is_valid(fin_data->fd)) {
+ if (muse_client_check_fd_id_value(fin_data->fd, fin_data->fd_id) == FALSE) {
+ LOGE("[fd:%d,id:%d] is invalid.", fin_data->fd, fin_data->fd_id);
+ goto EXIT;
+ }
+
+ PLAYER_SEND_MSG_ASYNC_WITH_NO_RETURN(api, fin_data->fd, MUSE_TYPE_INT, "key", fin_data->key);
+ } else {
+ LOGE("[fd:%d] is invalid.", fin_data->fd);
+ }
+
+EXIT:
+ if (fin_data) {
+ g_free(fin_data);
+ fin_data = NULL;
+ }
+
+ return ret;
+}
+
static bool _player_video_roi_area_is_valid(double x_scale, double y_scale,
double w_scale, double h_scale)
{
return TRUE;
}
-static void *_get_mem(player_cli_s * player, int size)
+static void *_get_mem(player_cli_s *player, int size)
{
player_data_s *mem = g_new(player_data_s, sizeof(player_data_s));
if (mem) {
return NULL;
}
-static void _del_mem(player_cli_s * player)
+static void _del_mem(player_cli_s *player)
{
player_data_s *mem;
while (player->head) {
}
}
-static int player_recv_msg(callback_cb_info_s * cb_info, tbm_fd *tfd)
+static int player_recv_msg(callback_cb_info_s *cb_info, tbm_fd *tfd)
{
int recvLen = 0;
msg_buff_s *buff = &cb_info->buff;
- memset(buff->recvMsg, 0x00, sizeof(char)*buff->bufLen);
+ memset(buff->recvMsg, 0x00, sizeof(char) * buff->bufLen);
memset(tfd, INVALID_DEFAULT_VALUE, sizeof(*tfd) * MUSE_NUM_FD);
recvLen = muse_core_msg_recv_fd(cb_info->fd, buff->recvMsg, MUSE_MSG_MAX_LENGTH, tfd);
if (recvLen <= 0) {
/* check the first msg */
if (buff->part_of_msg && buff->recvMsg[0] != '{')
{
- gchar *tmp = strndup(buff->recvMsg, recvLen);
+ gchar *tmp = g_strndup(buff->recvMsg, recvLen);
if (!tmp) {
LOGE("failed to copy msg.");
return 0;
}
- LOGD("get remained part of msg %d + %d, %d", recvLen, strlen(buff->part_of_msg), buff->bufLen);
+ LOGD("get remained part of msg %d + %zu, %d", recvLen, strlen(buff->part_of_msg), buff->bufLen);
/* realloc buffer */
- if (recvLen+strlen(buff->part_of_msg) >= buff->bufLen) {
- LOGD("realloc Buffer %d -> %d", buff->bufLen, recvLen+strlen(buff->part_of_msg)+1);
- buff->bufLen = recvLen+strlen(buff->part_of_msg)+1;
+ if (recvLen + strlen(buff->part_of_msg) >= buff->bufLen) {
+ LOGD("realloc Buffer %d -> %d", buff->bufLen, (int)(recvLen + strlen(buff->part_of_msg) + 1));
+ buff->bufLen = recvLen + strlen(buff->part_of_msg) + 1;
buff->recvMsg = g_renew(char, buff->recvMsg, buff->bufLen);
if (!buff->recvMsg) {
LOGE("failed renew buffer.");
- if (tmp)
- free(tmp);
+ g_free(tmp);
return 0;
}
- memset(buff->recvMsg, 0x00, sizeof(char)*buff->bufLen);
+ memset(buff->recvMsg, 0x00, sizeof(char) * buff->bufLen);
}
- snprintf(buff->recvMsg, buff->bufLen, "%s%s", buff->part_of_msg, tmp);
+ g_snprintf(buff->recvMsg, buff->bufLen, "%s%s", buff->part_of_msg, tmp);
recvLen += strlen(buff->part_of_msg);
- free(buff->part_of_msg);
+ g_free(buff->part_of_msg);
buff->part_of_msg = NULL;
- free(tmp);
+ g_free(tmp);
tmp = NULL;
}
/* check the last msg */
- if (buff->recvMsg[recvLen-1] != '}') {
+ if (buff->recvMsg[recvLen - 1] != '}') {
char *part_pos = strrchr(buff->recvMsg, '}');
- int part_len = ((part_pos) ? (strlen(part_pos+1)) : (0));
+ int part_len = ((part_pos) ? (strlen(part_pos + 1)) : (0));
if (part_len > 0) {
- buff->part_of_msg = strndup(part_pos+1, part_len);
+ buff->part_of_msg = g_strndup(part_pos + 1, part_len);
if (!buff->part_of_msg) {
LOGE("failed to alloc buffer for part of msg.");
return 0;
}
- LOGD("get part of msg: %d, %s", strlen(buff->part_of_msg), buff->part_of_msg);
+ LOGD("get part of msg: %zu, %s", strlen(buff->part_of_msg), buff->part_of_msg);
recvLen -= part_len;
}
}
return recvLen;
}
-static void set_null_user_cb(callback_cb_info_s * cb_info, muse_player_event_e event)
+static void set_null_user_cb(callback_cb_info_s *cb_info, muse_player_event_e event)
{
if (cb_info && event < MUSE_PLAYER_EVENT_TYPE_NUM) {
cb_info->user_cb[event] = NULL;
/* Notice : have to be called via API to avoid deadlock
* to clear the cb setting at the cb thread, set_null_user_cb() have to be called instead.
*/
-static void set_null_user_cb_lock(callback_cb_info_s * cb_info, muse_player_event_e event)
+static void set_null_user_cb_lock(callback_cb_info_s *cb_info, muse_player_event_e event)
{
bool lock = false;
static int __set_callback(muse_player_event_e type, player_h player, void *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;
+ 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) {
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(callback);
+
+ if (type == MUSE_PLAYER_EVENT_TYPE_BUFFERING) {
if (!_player_check_network_availability())
return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
+ pc->cb_info->drop_buffering_message = FALSE;
}
if (!CALLBACK_INFO(pc))
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;
}
static int __unset_callback(muse_player_event_e type, player_h player)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *) player;
+ 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;
+ PLAYER_INSTANCE_CHECK(player);
+
LOGI("Event type : %d ", type);
PLAYER_NULL_ARG_CHECK(CALLBACK_INFO(pc));
+
+ if ((type == MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME) ||
+ (type == MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME)) {
+ /* check state condition */
+ player_state_e state = PLAYER_STATE_NONE;
+
+ if (_get_current_state(pc, &state) != PLAYER_ERROR_NONE) {
+ LOGE("Failed to get current state");
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+
+ if (state > PLAYER_STATE_READY) {
+ LOGE("Invalid state %d", state);
+ return PLAYER_ERROR_INVALID_STATE;
+ }
+ }
+
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;
}
-static void __prepare_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __prepare_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_PREPARE;
- ((player_prepared_cb) cb_info->user_cb[ev]) (cb_info->user_data[ev]);
+ ((player_prepared_cb)cb_info->user_cb[ev])(cb_info->user_data[ev]);
set_null_user_cb(cb_info, ev);
}
-static void __complete_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __complete_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_COMPLETE;
- ((player_completed_cb) cb_info->user_cb[ev]) (cb_info->user_data[ev]);
+ ((player_completed_cb)cb_info->user_cb[ev])(cb_info->user_data[ev]);
+}
+
+static void __player_media_packet_video_decoded_cb(media_packet_h packet, void *user_data)
+{
+ if (!packet || !user_data) {
+ LOGE("invalid param [packet:%p, user_data:%p]", packet, user_data);
+ return;
+ }
+
+ LOGD("render packet %p", packet);
+
+ mm_display_interface_evas_render(DP_INTERFACE((player_cli_s *)user_data), packet);
}
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
-static void __retrieve_buffer_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __retrieve_buffer_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER;
- ((player_retrieve_buffer_cb) cb_info->user_cb[ev]) (cb_info->user_data[ev]);
+ ((player_retrieve_buffer_cb)cb_info->user_cb[ev])(cb_info->user_data[ev]);
}
-#endif
-static void __interrupt_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __interrupt_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_INTERRUPT;
- ((player_interrupted_cb) cb_info->user_cb[ev]) (PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT, cb_info->user_data[ev]);
+ ((player_interrupted_cb)cb_info->user_cb[ev])(PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT, cb_info->user_data[ev]);
}
-static void __error_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __error_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
int code;
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_ERROR;
set_null_user_cb(cb_info, MUSE_PLAYER_EVENT_TYPE_PREPARE);
}
}
- ((player_error_cb) cb_info->user_cb[ev]) (code, cb_info->user_data[ev]);
+ ((player_error_cb)cb_info->user_cb[ev])(code, cb_info->user_data[ev]);
}
}
-static void __disconnected_error_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __disconnected_error_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_ERROR;
- ((player_error_cb) cb_info->user_cb[ev]) (PLAYER_ERROR_SERVICE_DISCONNECTED, cb_info->user_data[ev]);
+ ((player_error_cb)cb_info->user_cb[ev])(PLAYER_ERROR_SERVICE_DISCONNECTED, cb_info->user_data[ev]);
}
-static void __buffering_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __buffering_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
int percent;
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_BUFFERING;
- if (player_msg_get(percent, recv_data->buffer))
- ((player_buffering_cb) cb_info->user_cb[ev]) (percent, cb_info->user_data[ev]);
+ if (player_msg_get(percent, recv_data->buffer)) {
+ g_mutex_lock(&cb_info->buffering_cb_mutex);
+ if (cb_info->drop_buffering_message) {
+ LOGD("Drop buffering callback");
+ g_mutex_unlock(&cb_info->buffering_cb_mutex);
+ return;
+ }
+ g_mutex_unlock(&cb_info->buffering_cb_mutex);
+ ((player_buffering_cb)cb_info->user_cb[ev])(percent, cb_info->user_data[ev]);
+ }
+
}
-static void __subtitle_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __subtitle_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
int duration = 0;
char text[MUSE_URI_MAX_LENGTH] = { 0, };
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]);
+ ((player_subtitle_updated_cb)cb_info->user_cb[ev])(duration, text, cb_info->user_data[ev]);
}
-static void __capture_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __capture_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
unsigned char *data = NULL;
int width = 0;
data = g_new(unsigned char, size);
if (data) {
memcpy(data, thandle.ptr, size);
- ((player_video_captured_cb) cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE]) (data, width, height, size, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE]);
+ ((player_video_captured_cb)cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE])(data, width, height, size, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE]);
g_free(data);
- } else
+ } else {
LOGE("g_new failure");
+ }
tbm_bo_unmap(bo);
}
EXIT:
- if (recv_data->tfd[0] > INVALID_DEFAULT_VALUE)
- close(recv_data->tfd[0]);
+ PLAYER_CLOSE_FD(recv_data->tfd[0]);
+
memset(recv_data->tfd, INVALID_DEFAULT_VALUE, sizeof(recv_data->tfd));
if (bo)
set_null_user_cb(cb_info, MUSE_PLAYER_EVENT_TYPE_CAPTURE);
}
-static void __seek_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __seek_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
+ int ret = MM_ERROR_NONE;
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_SEEK;
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- void *dl_handle = NULL;
- int (*p_disp_set_evas_display_visible)(void *, bool) = NULL;
-#endif
+ mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
+
g_mutex_lock(&cb_info->seek_cb_mutex);
switch (cb_info->seek_cb_state) {
break;
}
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- if (cb_info->evas_info && cb_info->evas_info->support_video) {
- if (cb_info->evas_info->handle && cb_info->evas_info->visible != EVAS_VISIBLE_FALSE) {
- dl_handle = dlopen(PATH_DISP_LIB, RTLD_LAZY);
- if (dl_handle) {
- PLAYER_DISP_DLSYM(dl_handle, p_disp_set_evas_display_visible, "disp_set_evas_display_visible");
- int ret = p_disp_set_evas_display_visible(cb_info->evas_info->handle, true);
- dlclose(dl_handle);
- if (ret != MM_ERROR_NONE)
- LOGW("failed to set visible at evas 0x%x", ret);
- else
- cb_info->evas_info->visible = EVAS_VISIBLE_TRUE;
- } else {
- LOGW("not support video rendering");
- }
- }
+ ret = mm_display_interface_get_type(cb_info->dp_info.interface, &display_type);
+ if (ret == MM_ERROR_NONE && display_type == MM_DISPLAY_TYPE_EVAS &&
+ cb_info->dp_info.visible != PLAYER_VISIBLE_INFO_FALSE) {
+ LOGW("set display visible true for EVAS");
+ if (mm_display_interface_evas_set_visible(cb_info->dp_info.interface, true) != MM_ERROR_NONE)
+ LOGE("mm_display_interface_evas_set_visible failed");
+ } else {
+ LOGW("get display type ret 0x%x, type %d", ret, display_type);
}
-#endif
+
LOGD("call seek cb");
- ((player_seek_completed_cb) cb_info->user_cb[ev]) (cb_info->user_data[ev]);
+ ((player_seek_completed_cb)cb_info->user_cb[ev])(cb_info->user_data[ev]);
set_null_user_cb(cb_info, ev);
break;
g_mutex_unlock(&cb_info->seek_cb_mutex);
}
-static void __player_remove_tsurf_list(player_cli_s * pc)
+static void __player_remove_tsurf_list(player_cli_s *pc)
{
GList *l = NULL;
LOGD("total num of tsurf list = %d", g_list_length(pc->cb_info->tsurf_list));
for (l = g_list_first(pc->cb_info->tsurf_list); l; l = g_list_next(l)) {
- player_tsurf_info_t* tmp = (player_tsurf_info_t *)l->data;
+ player_tsurf_info_s *tmp = (player_tsurf_info_s *)l->data;
LOGD("%p will be removed", tmp);
if (tmp) {
return;
}
-static player_tsurf_info_t* __player_get_tsurf_from_list(callback_cb_info_s * cb_info, int *key, int height, int width)
+static player_tsurf_info_s *__player_get_tsurf_from_list(callback_cb_info_s *cb_info, intptr_t key, int height, int width)
{
GList *l = NULL;
g_mutex_lock(&cb_info->data_mutex);
for (l = g_list_first(cb_info->tsurf_list); l; l = g_list_next(l)) {
- player_tsurf_info_t *tmp = (player_tsurf_info_t *)l->data;
- if (tmp && key && (tmp->key[0] == key[0])) {
- LOGD("found tsurf_data of tbm_key %d", key[0]);
+ player_tsurf_info_s *tmp = (player_tsurf_info_s *)l->data;
+ if (tmp && key && (tmp->key == key)) {
+ LOGD("found tsurf_data of tbm_key %" PRIdPTR, key);
/* need to check tsuf info to support DRC */
if ((tbm_surface_get_height(tmp->tsurf) != height) ||
return rotate;
}
-static void __media_packet_video_frame_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
tbm_bo bo[4] = { NULL, };
- int key[4] = { INVALID_DEFAULT_VALUE, };
tbm_surface_info_s sinfo;
char *surface_info = (char *)&sinfo;
media_packet_h pkt = NULL;
tbm_surface_h tsurf = NULL;
- player_tsurf_info_t *tsurf_data = NULL;
+ player_tsurf_info_s *tsurf_data = NULL;
int bo_num = 0;
media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12;
bool make_pkt_fmt = false;
int ret = MEDIA_FORMAT_ERROR_NONE;
- _media_pkt_fin_data *fin_data = NULL;
+ _media_pkt_video_fin_data *fin_data = NULL;
+ intptr_t key = 0;
intptr_t v_data = 0;
uint64_t pts = 0;
int i = 0, orientation = 0;
void *jobj = muse_core_msg_object_new(recv_data->buffer, NULL, &err);
if (!jobj ||
- !muse_core_msg_object_get_value("key[0]", jobj, MUSE_TYPE_ANY, &key[0]) ||
- !muse_core_msg_object_get_value("key[1]", jobj, MUSE_TYPE_ANY, &key[1]) ||
- !muse_core_msg_object_get_value("key[2]", jobj, MUSE_TYPE_ANY, &key[2]) ||
- !muse_core_msg_object_get_value("key[3]", jobj, MUSE_TYPE_ANY, &key[3]) ||
+ !muse_core_msg_object_get_value("key", jobj, MUSE_TYPE_POINTER, &key) ||
!muse_core_msg_object_get_value("v_data", jobj, MUSE_TYPE_POINTER, &v_data) ||
!muse_core_msg_object_get_value("mimetype", jobj, MUSE_TYPE_ANY, &mimetype) ||
!muse_core_msg_object_get_value("pts", jobj, MUSE_TYPE_INT64, &pts) ||
bo[i] = tbm_bo_import_fd(cb_info->bufmgr, recv_data->tfd[i]);
}
- tsurf_data = g_new(player_tsurf_info_t, 1);
- if (!tsurf_data) {
- LOGE("failed to alloc tsurf info");
- goto ERROR;
- }
- memset(tsurf_data->key, INVALID_DEFAULT_VALUE, sizeof(tsurf_data->key));
-
tsurf = tbm_surface_internal_create_with_bos(&sinfo, bo, bo_num);
if (!tsurf) {
LOGE("failed to create tbm surface");
- g_free(tsurf_data);
goto ERROR;
}
- memcpy(tsurf_data->key, key, sizeof(tsurf_data->key));
- tsurf_data->tsurf = tsurf;
+
if (cb_info->use_tsurf_pool) {
+ tsurf_data = g_try_new(player_tsurf_info_s, 1);
+ if (!tsurf_data) {
+ LOGE("failed to alloc tsurf info");
+ goto ERROR;
+ }
+ tsurf_data->key = key;
+ tsurf_data->tsurf = tsurf;
+
g_mutex_lock(&cb_info->data_mutex);
cb_info->tsurf_list = g_list_append(cb_info->tsurf_list, tsurf_data);
- LOGD("key %d is added to the pool", key[0]);
+ LOGD("key %" PRIdPTR " is added to the pool", key);
if (cb_info->video_frame_pool_size < g_list_length(cb_info->tsurf_list))
LOGE("need to check the pool size: %d < %d", cb_info->video_frame_pool_size, g_list_length(cb_info->tsurf_list));
g_mutex_unlock(&cb_info->data_mutex);
}
}
- fin_data = g_new0(_media_pkt_fin_data, 1);
+ fin_data = g_try_new0(_media_pkt_video_fin_data, 1);
if (!fin_data) {
LOGE("failed to alloc fin_data");
goto ERROR;
/* Keep the fd id to check validation when the pkt is destroyed. */
fin_data->fd_id = muse_client_get_fd_id_value(fin_data->fd);
- ret = media_packet_create_from_tbm_surface(cb_info->pkt_fmt, tsurf, (media_packet_finalize_cb) _player_media_packet_finalize, (void *)fin_data, &pkt);
+ ret = media_packet_create_from_tbm_surface(cb_info->pkt_fmt, tsurf, (media_packet_finalize_cb)_player_video_media_packet_finalize, (void *)fin_data, &pkt);
if (ret != MEDIA_PACKET_ERROR_NONE || !pkt) {
LOGE("media_packet_create_from_tbm_surface failed %d %p", ret, pkt);
goto ERROR;
}
if (pts != 0) {
- ret = media_packet_set_pts(pkt, (uint64_t) pts);
+ ret = media_packet_set_pts(pkt, (uint64_t)pts);
if (ret != MEDIA_PACKET_ERROR_NONE)
LOGE("media_packet_set_pts failed");
}
if (cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]) {
/* call media packet callback */
- ((player_media_packet_video_decoded_cb) cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]) (pkt, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]);
+ ((player_media_packet_video_decoded_cb)cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME])(pkt, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]);
} else {
LOGE("_video_decoded_cb is not set");
media_packet_destroy(pkt);
}
- for (i = 0; i < MUSE_NUM_FD; i++) { /* if tsruf pool is enabled, bo_num can be zero. */
- if (recv_data->tfd[i] > INVALID_DEFAULT_VALUE)
- close(recv_data->tfd[i]);
- }
+ /* if tsruf pool is enabled, bo_num can be zero. */
+ for (i = 0; i < MUSE_NUM_FD; i++)
+ PLAYER_CLOSE_FD(recv_data->tfd[i]);
for (i = 0; i < bo_num; i++) {
if (bo[i])
ERROR:
if (pkt)
media_packet_destroy(pkt);
+ else if (!tsurf_data && tsurf)
+ tbm_surface_destroy(tsurf);
if (fin_data)
g_free(fin_data);
- for (i = 0; i < MUSE_NUM_FD; i++) { /* if tsruf pool is enabled, bo_num can be zero. */
- if (recv_data->tfd[i] > INVALID_DEFAULT_VALUE)
- close(recv_data->tfd[i]);
- }
+ /* if tsruf pool is enabled, bo_num can be zero. */
+ for (i = 0; i < MUSE_NUM_FD; i++)
+ PLAYER_CLOSE_FD(recv_data->tfd[i]);
for (i = 0; i < bo_num; i++) {
if (bo[i])
return;
}
-static void __audio_frame_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __media_packet_audio_frame_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
+ int ret = MEDIA_FORMAT_ERROR_NONE;
tbm_bo bo = NULL;
tbm_bo_handle thandle;
int key = INVALID_DEFAULT_VALUE;
- player_audio_raw_data_s audio;
+ player_audio_decoded_data_info_t audio;
+ media_packet_h pkt = NULL;
+ media_format_h fmt = NULL;
+ _media_pkt_audio_fin_data *fin_data = NULL;
if (!player_msg_get(key, recv_data->buffer)) {
LOGE("failed to get key value from msg.");
goto EXIT;
}
- memcpy(&audio, thandle.ptr, sizeof(player_audio_raw_data_s));
- audio.data = thandle.ptr + sizeof(player_audio_raw_data_s);
+ memcpy(&audio, thandle.ptr, sizeof(player_audio_decoded_data_info_t));
+ audio.data = thandle.ptr + sizeof(player_audio_decoded_data_info_t);
+ tbm_bo_unmap(bo);
/* LOGD("user callback data %p, size %d", audio.data, audio.size); */
- ((player_audio_pcm_extraction_cb) cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME]) (&audio, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME]);
- tbm_bo_unmap(bo);
+ if (cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME]) {
+ ret = media_format_create(&fmt);
+ if (ret != MEDIA_FORMAT_ERROR_NONE || !fmt) {
+ LOGE("failed to create media format 0x%X %p", ret, fmt);
+ goto EXIT;
+ }
+
+ ret = media_format_set_audio_mime(fmt, audio.pcm_format);
+ ret |= media_format_set_audio_samplerate(fmt, audio.rate);
+ ret |= media_format_set_audio_channel(fmt, audio.channel);
+ ret |= media_format_set_audio_channel_mask(fmt, audio.channel_mask);
+ if (ret != MEDIA_FORMAT_ERROR_NONE) {
+ LOGE("failed to set audio format 0x%X", ret);
+ goto EXIT;
+ }
+
+ fin_data = g_new0(_media_pkt_audio_fin_data, 1);
+ if (!fin_data) {
+ LOGE("failed to alloc fin_data");
+ goto EXIT;
+ }
+
+ fin_data->key = key;
+ fin_data->fd = cb_info->fd;
+ fin_data->bo = bo;
+
+ /* Keep the fd id to check validation when the pkt is destroyed. */
+ fin_data->fd_id = muse_client_get_fd_id_value(fin_data->fd);
+
+ ret = media_packet_create_from_external_memory(fmt, audio.data, audio.size,
+ (media_packet_finalize_cb)_player_audio_media_packet_finalize, (void *)fin_data, &pkt);
+ if (ret != MEDIA_PACKET_ERROR_NONE || !pkt) {
+ LOGE("failed to create media packet 0x%X %p", ret, pkt);
+ if (pkt)
+ media_packet_destroy(pkt); /* fin_data will be free in finalize function. */
+ else
+ g_free(fin_data);
+ goto EXIT;
+ }
+
+ media_format_unref(fmt);
+ fmt = NULL;
+
+ ((player_media_packet_audio_decoded_cb)cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME])
+ (pkt, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME]);
+ } else {
+ LOGE("there is no registered cb");
+ goto EXIT;
+ }
EXIT:
- if (recv_data->tfd[0] > INVALID_DEFAULT_VALUE)
- close(recv_data->tfd[0]);
+ PLAYER_CLOSE_FD(recv_data->tfd[0]);
+
memset(recv_data->tfd, INVALID_DEFAULT_VALUE, sizeof(recv_data->tfd));
- if (bo)
- tbm_bo_unref(bo);
+ if (fmt)
+ media_format_unref(fmt);
/* return buffer */
- if (key > INVALID_DEFAULT_VALUE) {
+ if ((cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME] == NULL) &&
+ (key > INVALID_DEFAULT_VALUE)) {
+
+ if (bo) tbm_bo_unref(bo);
+
/* LOGD("send msg to release buffer. key:%d", key); */
PLAYER_SEND_MSG_ASYNC_WITH_NO_RETURN(MUSE_PLAYER_API_RETURN_BUFFER, cb_info->fd, MUSE_TYPE_INT, "key", key);
}
-}
-static void __video_frame_render_error_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
-{
+ return;
}
-static void __pd_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __video_frame_render_error_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
- int type;
- muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_PD;
-
- if (player_msg_get(type, recv_data->buffer))
- ((player_pd_message_cb) cb_info->user_cb[ev]) (type, cb_info->user_data[ev]);
}
-static void __supported_audio_effect_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __supported_audio_effect_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
}
-static void __supported_audio_effect_preset_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __supported_audio_effect_preset_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
}
-static void __missed_plugin_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __missed_plugin_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
}
-static void __media_stream_video_buffer_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __media_stream_video_buffer_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
/* player_media_stream_buffer_status_e status; */
int status;
if (player_msg_get(status, recv_data->buffer)) {
((player_media_stream_buffer_status_cb)
- cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS]) ((player_media_stream_buffer_status_e) status, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS]);
+ cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS])
+ ((player_media_stream_buffer_status_e)status,
+ cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS]);
}
}
-static void __media_stream_audio_buffer_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __media_stream_audio_buffer_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
/* player_media_stream_buffer_status_e status; */
int status;
if (player_msg_get(status, recv_data->buffer)) {
((player_media_stream_buffer_status_cb)
cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS])
- ((player_media_stream_buffer_status_e) status, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS]);
+ ((player_media_stream_buffer_status_e) status,
+ cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS]);
}
}
-static void __media_stream_video_buffer_cb_handler_ex(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __media_stream_video_buffer_cb_handler_ex(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
/* player_media_stream_buffer_status_e status; */
int status;
}
}
-static void __media_stream_audio_buffer_cb_handler_ex(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __media_stream_audio_buffer_cb_handler_ex(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
/* player_media_stream_buffer_status_e status; */
int status;
}
-static void __media_stream_video_seek_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __media_stream_video_seek_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
unsigned long long offset;
}
}
-static void __media_stream_audio_seek_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __media_stream_audio_seek_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
unsigned long long offset;
}
}
-static void __video_stream_changed_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
+static void __video_stream_changed_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
{
int width;
int height;
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])
+ ((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]);
}
}
-static void (*_user_callbacks[MUSE_PLAYER_EVENT_TYPE_NUM]) (callback_cb_info_s * cb_info, _player_recv_data *recv_data) = {
- __prepare_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_PREPARE */
+static void (*_user_callbacks[MUSE_PLAYER_EVENT_TYPE_NUM])(callback_cb_info_s *cb_info, _player_recv_data *recv_data) = {
+ __prepare_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_PREPARE */
__complete_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_COMPLETE */
__interrupt_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_INTERRUPT */
__error_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_ERROR */
__capture_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_CAPTURE */
__seek_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_SEEK */
__media_packet_video_frame_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME */
- __audio_frame_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME */
+ __media_packet_audio_frame_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME */
__video_frame_render_error_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR */
- __pd_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_PD */
__supported_audio_effect_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT */
__supported_audio_effect_preset_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_SUPPORTED_AUDIO_EFFECT_PRESET */
__missed_plugin_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_MISSED_PLUGIN */
__media_stream_audio_seek_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK */
NULL, /* MUSE_PLAYER_EVENT_TYPE_AUDIO_STREAM_CHANGED */
__video_stream_changed_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED */
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
__retrieve_buffer_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER */
-#endif
__disconnected_error_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED */
};
_player_cb_data *data = (_player_cb_data *)user_data;
muse_player_event_e ev;
- if (data == NULL) {
- LOGE("data is null");
+ if (!data || !data->cb_info) {
+ LOGE("invalid user data");
return FALSE;
}
- LOGD("enter ev:%d", data->int_data);
-
- g_mutex_lock(&data->event_mutex);
ev = data->int_data;
-
- if (data->cb_info == NULL) {
- /* tried to remove before at _player_remove_idle_event */
- LOGW("cb_info is NULL. event %d", data->int_data);
- goto DONE;
- }
+ if ((ev != MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME) &&
+ (ev != MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME))
+ LOGD("enter ev:%d(%p)", ev, data);
/* remove event from list */
g_mutex_lock(&data->cb_info->event_queue.idle_ev_mutex);
}
g_mutex_unlock(&data->cb_info->event_queue.idle_ev_mutex);
- if (data->cb_info->user_cb[ev])
- _user_callbacks[ev] (data->cb_info, data->recv_data);
+ if ((data->cb_info->user_cb[ev] || ev == MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED) &&
+ (_user_callbacks[ev]))
+ _user_callbacks[ev](data->cb_info, data->recv_data);
else
LOGW("user callback is unset. type : %d", ev);
-DONE:
- /* unlock and release event */
- g_mutex_unlock(&data->event_mutex);
- g_mutex_clear(&data->event_mutex);
-
- if (data->recv_data) {
- g_free(data->recv_data->buffer);
- g_free(data->recv_data);
- }
- g_free(data);
-
return FALSE; /* remove from the event list */
}
{
if ((event_id == MUSE_PLAYER_EVENT_TYPE_INTERRUPT) ||
(event_id == MUSE_PLAYER_EVENT_TYPE_BUFFERING) ||
- (event_id == MUSE_PLAYER_EVENT_TYPE_PD) ||
(event_id == MUSE_PLAYER_EVENT_TYPE_COMPLETE) ||
(event_id == MUSE_PLAYER_EVENT_TYPE_ERROR) ||
(event_id == MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED) ||
}
}
+static void _destroy_event_data(gpointer user_data)
+{
+ _player_cb_data *data = (_player_cb_data *)user_data;
+
+ if (data == NULL) {
+ LOGW("data is null");
+ return;
+ }
+
+ LOGD("remove event data %p (%d)", data, data->int_data);
+ if (data->recv_data) {
+ g_free(data->recv_data->buffer);
+ data->recv_data->buffer = NULL;
+ g_free(data->recv_data);
+ data->recv_data = NULL;
+ }
+
+ g_free(data);
+}
+
static void *_player_event_queue_loop(void *param)
{
if (!param) {
while (1) {
g_mutex_lock(&ev->qlock);
- event_data = (_player_cb_data *) g_queue_pop_head(ev->queue);
+ event_data = (_player_cb_data *)g_queue_pop_head(ev->queue);
g_mutex_unlock(&ev->qlock);
- if (event_data) {
- muse_player_event_e event_type = ((_player_cb_data *)event_data)->int_data;
-
- if (event_type == MUSE_PLAYER_EVENT_TYPE_SEEK) {
- g_mutex_lock(&cb_info->seek_cb_mutex);
- if (cb_info->seek_cb_state == PLAYER_SEEK_CB_STATE_WAIT) {
- /* push event into queue again. */
- _player_event_queue_add(ev, event_data);
- g_mutex_unlock(&cb_info->seek_cb_mutex);
- break;
- }
+
+ if (!event_data)
+ break;
+
+ muse_player_event_e event_type = event_data->int_data;
+
+ if (event_type == MUSE_PLAYER_EVENT_TYPE_SEEK) {
+ g_mutex_lock(&cb_info->seek_cb_mutex);
+ if (cb_info->seek_cb_state == PLAYER_SEEK_CB_STATE_WAIT) {
+ /* push event into queue again. */
+ _player_event_queue_add(ev, event_data);
g_mutex_unlock(&cb_info->seek_cb_mutex);
+ break;
+ }
+ g_mutex_unlock(&cb_info->seek_cb_mutex);
+ } else if (event_type == MUSE_PLAYER_EVENT_TYPE_BUFFERING) {
+ g_mutex_lock(&cb_info->buffering_cb_mutex);
+ if (cb_info->drop_buffering_message) {
+ LOGD("Drop buffering event");
+ g_mutex_unlock(&cb_info->buffering_cb_mutex);
+
+ _destroy_event_data(event_data);
+ break;
}
+ g_mutex_unlock(&cb_info->buffering_cb_mutex);
+ }
- if (_player_need_sync_context(event_data->int_data)) {
- if (cb_info->user_cb[event_data->int_data] &&
- _user_callbacks[event_data->int_data]) {
- g_mutex_lock(&ev->idle_ev_mutex);
- ev->idle_ev_list = g_list_append(ev->idle_ev_list, (gpointer)event_data);
- g_mutex_unlock(&ev->idle_ev_mutex);
-
- LOGD("add ev %d to main loop", event_data->int_data);
-
- g_idle_add_full(G_PRIORITY_DEFAULT,
- (GSourceFunc)_player_event_job_function,
- (gpointer)event_data,
- NULL);
- } else {
- LOGW("there is no registered cb for ev:%d", event_data->int_data);
- if (event_data->recv_data) {
- g_free(event_data->recv_data->buffer);
- g_free(event_data->recv_data);
- }
- g_free(event_data);
- }
+ if (_player_need_sync_context(event_type)) {
+ if ((cb_info->user_cb[event_type] || (event_type == MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED)) &&
+ _user_callbacks[event_type]) {
+ g_mutex_lock(&ev->idle_ev_mutex);
+ ev->idle_ev_list = g_list_append(ev->idle_ev_list, (gpointer)event_data);
+ g_mutex_unlock(&ev->idle_ev_mutex);
+
+ LOGD("add ev %d to main loop", event_type);
+
+ g_idle_add_full(G_PRIORITY_DEFAULT,
+ (GSourceFunc)_player_event_job_function,
+ (gpointer)event_data,
+ (GDestroyNotify)_destroy_event_data);
} else {
- _player_event_job_function(event_data);
+ LOGW("there is no registered cb for ev:%d", event_type);
+ _destroy_event_data(event_data);
}
} else {
- break;
+ _player_event_job_function(event_data);
+ _destroy_event_data(event_data);
}
}
}
return NULL;
}
-static gboolean _player_event_queue_new(callback_cb_info_s * cb_info)
+static gboolean _player_event_queue_new(callback_cb_info_s *cb_info)
{
g_return_val_if_fail(cb_info, FALSE);
player_event_queue *ev = &cb_info->event_queue;
g_mutex_init(&ev->idle_ev_mutex);
- ev->thread = g_thread_new("cb_event_thread", _player_event_queue_loop, (gpointer) cb_info);
+ ev->thread = g_thread_new("cb_event_thread", _player_event_queue_loop, (gpointer)cb_info);
g_return_val_if_fail(ev->thread, FALSE);
LOGI("event queue thread %p", ev->thread);
continue;
}
- if (g_mutex_trylock(&event_data->event_mutex)) {
-
- gboolean ret = FALSE;
- if (remove_all || (event_data->int_data == event_type)) {
-
- LOGD("remove idle event [%p:%d]", event_data, event_data->int_data);
-
- ret = g_idle_remove_by_data(event_data);
- if (ret == FALSE) {
- /* will be handled at _player_event_job_function() as an exception */
- event_data->cb_info = NULL;
- LOGW("failed to remove, idle callback will be called later");
- }
+ if ((event_data->int_data != event_type) && !remove_all)
+ continue;
- /* set cb to null */
- set_null_user_cb(cb_info, event_data->int_data);
- ev->idle_ev_list = g_list_remove(ev->idle_ev_list, (gpointer)event_data);
+ LOGD("remove idle event [%p:%d]", event_data, event_data->int_data);
- g_mutex_unlock(&event_data->event_mutex);
+ /* set cb to null */
+ if (remove_all)
+ set_null_user_cb(cb_info, event_data->int_data);
- if (ret == TRUE) {
- g_mutex_clear(&event_data->event_mutex);
- if (event_data->recv_data) {
- g_free(event_data->recv_data->buffer);
- g_free(event_data->recv_data);
- }
- g_free(event_data);
- event_data = NULL;
- LOGD("remove idle event done");
- } /* else : will be handled if the cb is called. */
- } else {
- g_mutex_unlock(&event_data->event_mutex);
- }
- } else {
- LOGW("event(%d) lock failed. it's being called...", event_data->int_data);
- }
+ ev->idle_ev_list = g_list_remove(ev->idle_ev_list, (gpointer)event_data);
- /* continue: keep checking next event_data */
+ if (!g_idle_remove_by_data(event_data))
+ LOGW("failed to find source with %p", event_data);
}
if (remove_all) {
return;
}
-static void _player_event_queue_destroy(callback_cb_info_s * cb_info)
+static void _player_event_queue_destroy(callback_cb_info_s *cb_info)
{
g_return_if_fail(cb_info);
player_event_queue *ev = &cb_info->event_queue;
ev->thread = NULL;
while (!g_queue_is_empty(ev->queue)) {
- event_data = (_player_cb_data *) g_queue_pop_head(ev->queue);
+ event_data = (_player_cb_data *)g_queue_pop_head(ev->queue);
if (event_data) {
g_free(event_data->recv_data->buffer);
g_free(event_data->recv_data);
g_mutex_clear(&ev->idle_ev_mutex);
}
-static void _player_event_queue_remove(player_event_queue * ev_queue, int ev)
+static void _player_event_queue_remove(player_event_queue *ev_queue, int ev)
{
GList *item;
g_mutex_unlock(&ev_queue->qlock);
}
-static void _player_event_queue_add(player_event_queue * ev, _player_cb_data * data)
+static void _player_event_queue_add(player_event_queue *ev, _player_cb_data *data)
{
if (ev->running) {
g_mutex_lock(&ev->qlock);
- g_queue_push_tail(ev->queue, (gpointer) data);
+ g_queue_push_tail(ev->queue, (gpointer)data);
g_mutex_unlock(&ev->qlock);
g_cond_signal(&ev->cond);
}
}
-static bool _user_callback_handler(callback_cb_info_s * cb_info, muse_player_event_e event, _player_recv_data *recv_data)
+static bool _user_callback_handler(callback_cb_info_s *cb_info, muse_player_event_e event, _player_recv_data *recv_data)
{
/* LOGD("get event %d", event); */
data->int_data = (int)event;
data->cb_info = cb_info;
data->recv_data = recv_data;
- g_mutex_init(&data->event_mutex);
_player_event_queue_add(&cb_info->event_queue, data);
return true;
}
}
- LOGE("failed to add event to queue");
+ LOGE("failed to add event to queue %d", event);
return false;
}
-static void _add_ret_msg(muse_player_api_e api, callback_cb_info_s * cb_info, int offset, int parse_len)
+static void _add_ret_msg(muse_player_api_e api, callback_cb_info_s *cb_info, int offset, int parse_len)
{
ret_msg_s *msg = NULL;
ret_msg_s *last = cb_info->buff.retMsgHead;
msg = g_new(ret_msg_s, 1);
if (msg) {
msg->api = api;
- msg->msg = strndup(cb_info->buff.recvMsg + offset, parse_len);
+ msg->msg = g_strndup(cb_info->buff.recvMsg + offset, parse_len);
msg->next = NULL;
if (last == NULL)
cb_info->buff.retMsgHead = msg;
LOGE("g_new failure");
}
-static ret_msg_s *_get_ret_msg(muse_player_api_e api, callback_cb_info_s * cb_info)
+static ret_msg_s *_get_ret_msg(muse_player_api_e api, callback_cb_info_s *cb_info)
{
ret_msg_s *msg = cb_info->buff.retMsgHead;
ret_msg_s *prev = NULL;
return NULL;
}
-static void _remove_all_ret_msg(callback_cb_info_s * cb_info)
+static void _remove_all_ret_msg(callback_cb_info_s *cb_info)
{
ret_msg_s *msg = cb_info->buff.retMsgHead;
ret_msg_s *prev = NULL;
}
}
-static void _notify_disconnected(callback_cb_info_s * cb_info)
+static void _notify_disconnected(callback_cb_info_s *cb_info)
{
muse_player_event_e event = MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED;
if (!cb_info || !cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR])
data->int_data = (int)event;
data->cb_info = cb_info;
data->recv_data = NULL;
- g_mutex_init(&data->event_mutex);
_player_event_queue_add(&cb_info->event_queue, data);
}
}
while (offset < len) {
api = MUSE_PLAYER_API_MAX;
// LOGD(">>>>>> [%d/%d] %p, %s", offset, len, recvMsg + offset, recvMsg + offset);
-// usleep(10*1000);
+// usleep(10 * 1000);
void *jobj = muse_core_msg_object_new(recvMsg + offset, &parse_len, &err);
if (jobj) {
recv_data = g_new0(_player_recv_data, 1);
if (recv_data != NULL) {
memcpy(recv_data->tfd, tfd, sizeof(recv_data->tfd));
- recv_data->buffer = strndup(recvMsg+offset, parse_len);
+ recv_data->buffer = g_strndup(recvMsg + offset, parse_len);
} else {
LOGE("failed to alloc recv_data.");
g_mutex_unlock(&cb_info->player_mutex);
g_mutex_unlock(&cb_info->player_mutex);
}
} else {
- LOGE("Failed to get value. offset:%d/%d, [msg][ %s ]", offset, len, (recvMsg+offset));
+ LOGE("Failed to get value. offset:%d/%d, [msg][ %s ]", offset, len, (recvMsg + offset));
}
muse_core_msg_object_free(jobj);
} else {
g_mutex_init(&cb_info->data_mutex);
g_mutex_init(&cb_info->seek_cb_mutex);
+ g_mutex_init(&cb_info->buffering_cb_mutex);
+ cb_info->drop_buffering_message = FALSE;
buff = &cb_info->buff;
buff->recvMsg = g_new(char, MUSE_MSG_MAX_LENGTH + 1);
g_atomic_int_set(&cb_info->running, 1);
cb_info->fd = sockfd;
- cb_info->thread = g_thread_new("callback_thread", client_cb_handler, (gpointer) cb_info);
cb_info->tfd = INVALID_DEFAULT_VALUE;
+ cb_info->data_fd = INVALID_DEFAULT_VALUE;
+ cb_info->thread = g_thread_new("callback_thread", client_cb_handler, (gpointer) cb_info);
return cb_info;
}
-static void callback_destroy(callback_cb_info_s * cb_info)
+static void callback_destroy(callback_cb_info_s *cb_info)
{
int i;
g_return_if_fail(cb_info);
g_mutex_clear(&cb_info->data_mutex);
g_mutex_clear(&cb_info->seek_cb_mutex);
+ g_mutex_clear(&cb_info->buffering_cb_mutex);
g_free(cb_info->buff.recvMsg);
_remove_all_ret_msg(cb_info);
- if (cb_info->buff.part_of_msg)
- g_free(cb_info->buff.part_of_msg);
+ g_free(cb_info->buff.part_of_msg);
+
g_free(cb_info);
}
-int client_get_api_timeout(player_cli_s * pc, muse_player_api_e api)
+int client_get_api_timeout(player_cli_s *pc, muse_player_api_e api)
{
int timeout = 0;
return timeout; /* ms */
}
-int client_wait_for_cb_return(muse_player_api_e api, callback_cb_info_s * cb_info, char **ret_buf, int time_out)
+int client_wait_for_cb_return(muse_player_api_e api, callback_cb_info_s *cb_info, char **ret_buf, int time_out)
{
int ret = PLAYER_ERROR_NONE;
gint64 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_MILLISECOND;
return ret;
}
-int client_wait_for_server_ack(muse_player_api_e api, callback_cb_info_s * cb_info, int time_out)
+int client_wait_for_server_ack(muse_player_api_e api, callback_cb_info_s *cb_info, int time_out)
{
int ret = PLAYER_ERROR_NONE;
gint64 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_MILLISECOND;
* Public Implementation
*/
-int player_create(player_h * player)
+int player_create(player_h *player)
{
- PLAYER_INSTANCE_CHECK(player);
-
int ret = PLAYER_ERROR_NONE;
int sock_fd = INVALID_DEFAULT_VALUE;
int pid = getpid();
muse_player_api_e api = MUSE_PLAYER_API_CREATE;
- muse_core_api_module_e module = MUSE_PLAYER;
+ int module_index = INVALID_DEFAULT_VALUE;
player_cli_s *pc = NULL;
- char *ret_buf = NULL;
+ gchar *ret_buf = NULL;
int retry_count = CONNECTION_RETRY;
- bool retry = false;
+
+ PLAYER_INSTANCE_CHECK(player);
LOGD("ENTER");
if (pc == NULL)
return PLAYER_ERROR_OUT_OF_MEMORY;
- while (--retry_count) {
+ while (retry_count--) {
ret = PLAYER_ERROR_NONE;
sock_fd = muse_client_new();
if (sock_fd <= INVALID_DEFAULT_VALUE) {
LOGE("connection failure %d", errno);
ret = PLAYER_ERROR_INVALID_OPERATION;
- retry = true;
usleep(CONNECTION_TIME_OUT * G_TIME_SPAN_MILLISECOND);
+ goto ERROR_RETRY;
+ }
+
+ if (muse_client_get_module_index(MODULE_NAME, &module_index) != MM_ERROR_NONE) {
+ LOGE("muse client get module index failed");
+ ret = PLAYER_ERROR_INVALID_OPERATION;
goto ERROR;
}
PLAYER_SEND_MSG_ASYNC(api, sock_fd, ret,
- MUSE_TYPE_INT, "module", module,
+ MUSE_TYPE_INT, "module", module_index,
MUSE_TYPE_INT, "pid", pid);
if (ret == PLAYER_ERROR_INVALID_OPERATION)
goto ERROR;
}
ret = client_wait_for_server_ack(api, pc->cb_info, CREATE_CB_TIME_OUT);
- if (ret == PLAYER_ERROR_INVALID_OPERATION) {
- retry = true;
- goto ERROR;
- }
- retry = false;
+ if (ret == PLAYER_ERROR_INVALID_OPERATION)
+ goto ERROR_RETRY;
if (!_player_event_queue_new(pc->cb_info)) {
LOGE("fail to create event queue");
ret = client_wait_for_cb_return(api, pc->cb_info, &ret_buf, CALLBACK_TIME_OUT * 2);
if (ret == PLAYER_ERROR_NONE) {
intptr_t module_addr = 0;
- *player = (player_h) pc;
+ *player = (player_h)pc;
if (player_msg_get_type(module_addr, ret_buf, POINTER)) {
pc->cb_info->data_fd = muse_client_new_data_ch();
if ((pc->cb_info->data_fd < 0) || (!muse_core_fd_is_valid(pc->cb_info->data_fd))) {
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);
+ LOGD("Data channel fd %d, muse module addr %"PRIxPTR, pc->cb_info->data_fd, module_addr);
} else {
ret = PLAYER_ERROR_INVALID_OPERATION;
goto ERROR;
} else {
goto ERROR;
}
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- pc->cb_info->evas_info = g_new0(player_evas_info_s, 1);
- if (pc->cb_info->evas_info == NULL) {
- ret = PLAYER_ERROR_OUT_OF_MEMORY;
- goto ERROR;
- }
- EVAS_INFO(pc)->visible = EVAS_VISIBLE_NONE;
-#endif
+
pc->cb_info->bufmgr = tbm_bufmgr_init(-1);
pc->push_media_stream = FALSE;
- pc->support_video = FALSE;
- EVAS_INFO(pc)->support_video = FALSE;
- pc->is_audio_only = FALSE;
- PLAYER_DISP_DLOPEN(pc); /* update supported_video */
+ /* get display interface handle */
+ if (mm_display_interface_init(&DP_INTERFACE(pc)) != MM_ERROR_NONE)
+ LOGW("display interface init failed");
g_free(ret_buf);
LOGD("LEAVE 0x%X", ret);
return ret;
- ERROR:
+ERROR:
+ retry_count = 0;
+ERROR_RETRY:
if (pc && pc->cb_info) {
if (pc->cb_info->event_queue.running)
_player_event_queue_destroy(pc->cb_info);
muse_client_close(sock_fd);
}
sock_fd = INVALID_DEFAULT_VALUE;
+
g_free(ret_buf);
ret_buf = NULL;
LOGE("ret value : %d, retry #%d", ret, CONNECTION_RETRY - retry_count);
- if (!retry)
- break;
}
g_free(pc);
pc = NULL;
int player_destroy(player_h player)
{
- PLAYER_INSTANCE_CHECK(player);
-
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_DESTROY;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
+
+ PLAYER_INSTANCE_CHECK(player);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- int (*p_disp_destroy_evas_display)(void **) = NULL;
-#endif
LOGD("ENTER %p", pc);
/* clear cb and release mem */
set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_PREPARE);
_player_release_internal_memory(pc, true);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- if (CALLBACK_INFO(pc) && EVAS_INFO(pc)) {
- if (EVAS_INFO(pc)->support_video && EVAS_HANDLE(pc)) {
+ if (DP_INTERFACE(pc)) {
+ PLAYER_GET_DISPLAY_TYPE(pc, display_type);
+
+ if (display_type == MM_DISPLAY_TYPE_EVAS) {
player_unset_media_packet_video_frame_decoded_cb(player);
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_destroy_evas_display, "disp_destroy_evas_display");
- if (p_disp_destroy_evas_display(&EVAS_HANDLE(pc)) != MM_ERROR_NONE)
- LOGW("fail to unset evas client");
__player_unset_retrieve_buffer_cb(player);
}
- g_free(EVAS_INFO(pc));
+
+ mm_display_interface_deinit(DP_INTERFACE(pc));
+ DP_INTERFACE(pc) = NULL;
}
-#endif
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
callback_destroy(CALLBACK_INFO(pc));
}
- if (pc->dl_handle)
- PLAYER_DISP_DLCLOSE(pc->dl_handle); /* update supported_video */
-
g_free(pc);
pc = NULL;
int player_prepare_async(player_h player, player_prepared_cb callback, void *user_data)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_PREPARE_ASYNC;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
- LOGD("ENTER");
+ PLAYER_INSTANCE_CHECK(player);
+
+ LOGD("ENTER %p %p", pc, callback);
if (pc->cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
LOGE("PLAYER_ERROR_INVALID_OPERATION (0x%08x) : preparing...", PLAYER_ERROR_INVALID_OPERATION);
int player_prepare(player_h player)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_PREPARE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+
LOGD("ENTER %p", pc);
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_unprepare(player_h player)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
+ int mm_ret = MM_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_UNPREPARE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
- int (*p_disp_evas_display_retrieve_all_packets)(void *, bool) = NULL;
player_state_e state = PLAYER_STATE_NONE;
+ mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
+
+ PLAYER_INSTANCE_CHECK(player);
LOGD("ENTER %p", pc);
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);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- if (EVAS_INFO(pc)->support_video && EVAS_HANDLE(pc)) {
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_evas_display_retrieve_all_packets, "disp_evas_display_retrieve_all_packets");
- ret = p_disp_evas_display_retrieve_all_packets(EVAS_HANDLE(pc), false);
- if (ret != PLAYER_ERROR_NONE)
- LOGI("mm_evas_renderer_retrieve_all_packets returned error");
+ if (!DP_INTERFACE(pc))
+ goto _PLAYER_UNPREPARE;
+
+
+ PLAYER_GET_DISPLAY_TYPE(pc, display_type);
+
+ if (display_type != MM_DISPLAY_TYPE_EVAS)
+ goto _PLAYER_UNPREPARE;
+
+ if (CALLBACK_INFO(pc)->dp_info.visible != PLAYER_VISIBLE_INFO_FALSE) {
+ mm_ret = mm_display_interface_evas_set_visible(DP_INTERFACE(pc), false);
+ if (mm_ret != MM_ERROR_NONE) {
+ LOGE("mm_display_interface_evas_set_visible failed 0x%x", mm_ret);
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+ }
+
+ mm_ret = mm_display_interface_evas_flush(DP_INTERFACE(pc), false);
+ if (mm_ret != MM_ERROR_NONE) {
+ LOGE("mm_display_interface_evas_flush failed 0x%x", mm_ret);
+ return PLAYER_ERROR_INVALID_OPERATION;
}
-#endif
+_PLAYER_UNPREPARE:
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
_player_release_internal_memory(pc, false);
pc->cb_info->video_frame_pool_size = 0;
__player_remove_tsurf_list(pc);
- pc->is_audio_only = FALSE;
g_free(ret_buf);
/* 1. correct the protocol prefix to lower case
* 2. remove 'file://' prefix
* 3. covert '/opt/usr/media/xxx' file path to '/opt/usr/home/owner/media/xxx' */
-int _player_get_valid_path(const char* uri, char* valid_path)
+int _player_get_valid_path(const char *uri, char *valid_path)
{
gchar *file_path = NULL;
GError *err = NULL;
if (protocol) {
- file_path = g_strconcat(protocol, uri+strlen(protocol), NULL);
- strncpy(valid_path, (file_path) ? (file_path) : (uri), MAX_URL_LEN-1);
+ file_path = g_strconcat(protocol, uri + strlen(protocol), NULL);
+ strncpy(valid_path, (file_path) ? (file_path) : (uri), MAX_URL_LEN - 1);
g_free(protocol);
g_free(file_path);
SECURE_LOGE("Invalid URI '%s', err: %s", uri,
(err != NULL) ? err->message : "unknown error");
- if (err) g_error_free(err);
- if (file_path) g_free(file_path);
+ g_error_free(err);
+ g_free(file_path);
return PLAYER_ERROR_INVALID_PARAMETER;
}
if (storage_get_origin_internal_path((file_path) ? (file_path) : (uri), MAX_URL_LEN, valid_path) < 0) {
/* cannot convert path. use the original one. */
- strncpy(valid_path, (file_path) ? (file_path) : (uri), MAX_URL_LEN-1);
+ strncpy(valid_path, (file_path) ? (file_path) : (uri), MAX_URL_LEN - 1);
} else {
/* need to use converted path. */
SECURE_LOGD("Converted path : %s -> %s", uri, valid_path);
int player_set_uri(player_h player, const char *uri)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(uri);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_URI;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
char path[MAX_URL_LEN] = {0, };
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(uri);
+
LOGD("ENTER");
if (_player_get_valid_path(uri, path) != PLAYER_ERROR_NONE)
SECURE_LOGD("new path : %s", path);
- PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_STRING, "path", (const char*)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);
int player_set_memory_buffer(player_h player, const void *data, int size)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(data);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_MEMORY_BUFFER;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
tbm_bo bo = NULL;
tbm_bo_handle thandle;
tbm_fd tfd = INVALID_DEFAULT_VALUE;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(data);
+
LOGD("ENTER");
/* before setting mem buffer, player state have to be checked. */
pc->push_media_stream = FALSE;
EXIT:
- if (tfd > INVALID_DEFAULT_VALUE)
- close(tfd);
+ PLAYER_CLOSE_FD(tfd);
tbm_bo_unref(bo);
return ret;
}
-static void _player_release_internal_memory(player_cli_s * pc, bool deinit_server_mem)
+static void _player_release_internal_memory(player_cli_s *pc, bool deinit_server_mem)
{
if (!pc)
return;
_player_deinit_memory_buffer(pc);
}
-static int _player_deinit_memory_buffer(player_cli_s * pc)
+static int _player_deinit_memory_buffer(player_cli_s *pc)
{
PLAYER_INSTANCE_CHECK(pc);
int ret = PLAYER_ERROR_NONE;
int player_get_state(player_h player, player_state_e *pstate)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pstate);
int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
+
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pstate);
LOGD("ENTER");
int player_set_volume(player_h player, float left, float right)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(left >= 0 && left <= 1.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- PLAYER_CHECK_CONDITION(right >= 0 && right <= 1.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_VOLUME;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
- LOGD("ENTER");
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(left, 0, 1.0);
+ PLAYER_RANGE_ARG_CHECK(right, 0, 1.0);
+
+ /* not support to set different value into each channel */
+ PLAYER_CHECK_CONDITION(left == right, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
+
+ LOGD("ENTER %f", left);
PLAYER_SEND_MSG(api, pc, ret_buf, ret,
- MUSE_TYPE_DOUBLE, "right", (double)right,
- MUSE_TYPE_DOUBLE, "left", (double)left);
+ MUSE_TYPE_DOUBLE, "volume", (double)left);
g_free(ret_buf);
return ret;
}
-int player_get_volume(player_h player, float *pleft, float *pright)
+int player_get_volume(player_h player, float *left, float *right)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pleft && pright);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_GET_VOLUME;
- player_cli_s *pc = (player_cli_s *) player;
- double left = -1;
- double right = -1;
+ player_cli_s *pc = (player_cli_s *)player;
+ double volume = 0.0;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(left && right);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
if (ret == PLAYER_ERROR_NONE) {
bool ret_val = true;
ret_val = _player_get_param_value(ret_buf,
- MUSE_TYPE_DOUBLE, "left", (void *)&left,
- MUSE_TYPE_DOUBLE, "right", (void *)&right,
+ MUSE_TYPE_DOUBLE, "volume", (void *)&volume,
INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
- *pleft = (float)left;
- *pright = (float)right;
+ *left = (float)volume;
+ *right = (float)volume;
} else {
LOGE("failed to get value from msg");
ret = PLAYER_ERROR_INVALID_OPERATION;
int player_set_sound_stream_info(player_h player, sound_stream_info_h stream_info)
{
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SOUND_STREAM);
- PLAYER_INSTANCE_CHECK(player);
-
muse_player_api_e api = MUSE_PLAYER_API_SET_SOUND_STREAM_INFO;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
bool is_available = false;
char *ret_buf = NULL;
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SOUND_STREAM);
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(stream_info);
+
LOGD("ENTER");
/* check if stream_info is valid */
ret = sound_manager_get_index_from_stream_information(stream_info, &stream_index);
if (ret == SOUND_MANAGER_ERROR_NONE)
PLAYER_SEND_MSG(api, pc, ret_buf, ret,
- MUSE_TYPE_STRING, "stream_type", (const char*)stream_type,
+ MUSE_TYPE_STRING, "stream_type", (const char *)stream_type,
MUSE_TYPE_INT, "stream_index", stream_index);
else
ret = PLAYER_ERROR_INVALID_OPERATION;
int player_set_audio_latency_mode(player_h player, audio_latency_mode_e latency_mode)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_AUDIO_LATENCY_MODE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(latency_mode, AUDIO_LATENCY_MODE_LOW, AUDIO_LATENCY_MODE_HIGH);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "latency_mode", (int)latency_mode);
return ret;
}
-int player_get_audio_latency_mode(player_h player, audio_latency_mode_e * platency_mode)
+int player_get_audio_latency_mode(player_h player, audio_latency_mode_e *platency_mode)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(platency_mode);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_GET_AUDIO_LATENCY_MODE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int latency_mode = -1;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(platency_mode);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_start(player_h player)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_START;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
+
+ PLAYER_INSTANCE_CHECK(player);
LOGD("ENTER %p", pc);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- int (*p_disp_set_evas_display_visible)(void *, bool) = NULL;
-
- if (CALLBACK_INFO(pc) && EVAS_INFO(pc)->support_video) {
- if (EVAS_HANDLE(pc) && (EVAS_INFO(pc)->visible == EVAS_VISIBLE_NONE
- || EVAS_INFO(pc)->visible == EVAS_VISIBLE_TRUE)) {
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_visible, "disp_set_evas_display_visible");
- ret = p_disp_set_evas_display_visible(EVAS_HANDLE(pc), true);
- if (ret != MM_ERROR_NONE) {
- LOGE("mm_evas_renderer_set_visible err 0x%x", ret);
- return PLAYER_ERROR_INVALID_OPERATION;
- }
- /* avoid setting true at all times, when player is resumed */
- EVAS_INFO(pc)->visible = EVAS_VISIBLE_TRUE;
- }
+
+ if (!DP_INTERFACE(pc))
+ goto _PLAYER_START;
+
+ PLAYER_GET_DISPLAY_TYPE(pc, display_type);
+
+ if (display_type != MM_DISPLAY_TYPE_EVAS ||
+ CALLBACK_INFO(pc)->dp_info.visible == PLAYER_VISIBLE_INFO_FALSE)
+ goto _PLAYER_START;
+
+ /* set proper visible to evas renderer */
+ if (mm_display_interface_evas_set_visible(DP_INTERFACE(pc), true) != MM_ERROR_NONE) {
+ LOGE("mm_display_interface_evas_set_visible failed");
+ return PLAYER_ERROR_INVALID_OPERATION;
}
-#endif
+
+ /* avoid setting true at all times, when player is resumed */
+ CALLBACK_INFO(pc)->dp_info.visible = PLAYER_VISIBLE_INFO_TRUE;
+
+_PLAYER_START:
+ g_mutex_lock(&pc->cb_info->buffering_cb_mutex);
+ pc->cb_info->drop_buffering_message = TRUE;
+ g_mutex_unlock(&pc->cb_info->buffering_cb_mutex);
+
+ _player_remove_idle_event(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_BUFFERING, false);
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
+ g_mutex_lock(&pc->cb_info->buffering_cb_mutex);
+ pc->cb_info->drop_buffering_message = FALSE;
+ g_mutex_unlock(&pc->cb_info->buffering_cb_mutex);
+
g_free(ret_buf);
LOGD("LEAVE 0x%X", ret);
int player_stop(player_h player)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
+ int mm_ret = MM_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_STOP;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
player_state_e state = PLAYER_STATE_NONE;
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- int (*p_disp_set_evas_display_visible)(void *, bool) = NULL;
-#endif
+ mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
+
+ PLAYER_INSTANCE_CHECK(player);
+
LOGD("ENTER %p", pc);
/* check player state */
return PLAYER_ERROR_INVALID_STATE;
}
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- if (CALLBACK_INFO(pc) && EVAS_HANDLE(pc) &&
- EVAS_INFO(pc)->support_video && (EVAS_INFO(pc)->visible == EVAS_VISIBLE_NONE
- || EVAS_INFO(pc)->visible == EVAS_VISIBLE_TRUE)) {
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_visible, "disp_set_evas_display_visible");
- ret = p_disp_set_evas_display_visible(EVAS_HANDLE(pc), false);
- if (ret != MM_ERROR_NONE) {
- LOGE("mm_evas_renderer_set_visible err 0x%x", ret);
- return PLAYER_ERROR_INVALID_OPERATION;
- }
- /* do not update EVAS_INFO(pc)->visible to set visible true if start again */
+ if (!DP_INTERFACE(pc))
+ goto _PLAYER_STOP;
+
+ PLAYER_GET_DISPLAY_TYPE(pc, display_type);
+
+ if (display_type != MM_DISPLAY_TYPE_EVAS ||
+ CALLBACK_INFO(pc)->dp_info.visible == PLAYER_VISIBLE_INFO_FALSE)
+ goto _PLAYER_STOP;
+
+ mm_ret = mm_display_interface_evas_set_visible(DP_INTERFACE(pc), false);
+ if (mm_ret != MM_ERROR_NONE) {
+ LOGE("mm_display_interface_evas_set_visible failed 0x%x", mm_ret);
+ return PLAYER_ERROR_INVALID_OPERATION;
}
-#endif
+_PLAYER_STOP:
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);
int player_pause(player_h player)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_PAUSE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+
LOGD("ENTER %p", pc);
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
static int _set_play_position(player_h player, int64_t pos, bool accurate, player_seek_completed_cb callback, void *user_data)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(pos >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_PLAY_POSITION;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_CHECK_CONDITION(pos >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
+
LOGD("ENTER %p", pc);
if (!pc->cb_info) {
int player_set_play_position(player_h player, int milliseconds, bool accurate, player_seek_completed_cb callback, void *user_data)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(milliseconds >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-
int ret = PLAYER_ERROR_NONE;
int64_t pos = (int64_t)(milliseconds * G_GINT64_CONSTANT(1000000));
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_CHECK_CONDITION(milliseconds >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
+
LOGD("ENTER");
ret = _set_play_position(player, pos, accurate, callback, user_data);
int player_set_play_position_nsec(player_h player, int64_t nanoseconds, bool accurate, player_seek_completed_cb callback, void *user_data)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(nanoseconds >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-
int ret = PLAYER_ERROR_NONE;
int64_t pos = nanoseconds;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_CHECK_CONDITION(nanoseconds >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
+
LOGD("ENTER");
ret = _set_play_position(player, pos, accurate, callback, user_data);
static int _get_play_position(player_h player, int64_t *pos)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pos);
-
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_GET_PLAY_POSITION;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pos);
+
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
if (ret == PLAYER_ERROR_NONE) {
int player_get_play_position(player_h player, int *milliseconds)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(milliseconds);
-
int ret = PLAYER_ERROR_NONE;
int64_t pos = 0;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(milliseconds);
+
/* LOGD("ENTER"); */
ret = _get_play_position(player, &pos);
int player_get_play_position_nsec(player_h player, int64_t *nanoseconds)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(nanoseconds);
-
int ret = PLAYER_ERROR_NONE;
int64_t pos = 0;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(nanoseconds);
+
/* LOGD("ENTER"); */
ret = _get_play_position(player, &pos);
int player_set_mute(player_h player, bool muted)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_MUTE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int mute = (int)muted;
+ PLAYER_INSTANCE_CHECK(player);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "mute", mute);
return ret;
}
-int player_is_muted(player_h player, bool * muted)
+int player_is_muted(player_h player, bool *muted)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(muted);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_IS_MUTED;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int mute = -1;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(muted);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
if (ret == PLAYER_ERROR_NONE) {
player_msg_get(mute, ret_buf);
- *muted = (bool) mute;
+ *muted = (bool)mute;
}
g_free(ret_buf);
int player_set_looping(player_h player, bool looping)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_LOOPING;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "looping", (int)looping);
return ret;
}
-int player_is_looping(player_h player, bool * plooping)
+int player_is_looping(player_h player, bool *plooping)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(plooping);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_IS_LOOPING;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int looping = 0;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(plooping);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
static int _get_duration(player_h player, int64_t *duration)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(duration);
-
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_GET_DURATION;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(duration);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_get_duration(player_h player, int *milliseconds)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(milliseconds);
-
int ret = PLAYER_ERROR_NONE;
int64_t duration = 0; /* nsec */
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(milliseconds);
+
LOGD("ENTER");
ret = _get_duration(player, &duration);
int player_get_duration_nsec(player_h player, int64_t *nanoseconds)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(nanoseconds);
-
int ret = PLAYER_ERROR_NONE;
int64_t duration = 0; /* nsec */
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(nanoseconds);
+
LOGD("ENTER");
ret = _get_duration(player, &duration);
}
/* The player_display_type_e is different at wearable profile */
-int _player_convert_display_type(player_display_type_e type, player_private_display_type_e *out_type)
+int _player_convert_display_type(player_display_type_e type, mm_display_type_e *out_type)
{
int ret = PLAYER_ERROR_NONE;
+
PLAYER_NULL_ARG_CHECK(out_type);
switch (type) {
case PLAYER_DISPLAY_TYPE_OVERLAY:
- *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_OVERLAY;
- break;
- case PLAYER_DISPLAY_TYPE_OBSOLETE_EVAS_WNONE:
- if (_get_tizen_profile() == TIZEN_PROFILE_WEARABLE)
- *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_NONE;
- else
- *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_EVAS;
+ *out_type = MM_DISPLAY_TYPE_OVERLAY;
break;
- case PLAYER_DISPLAY_TYPE_OBSOLETE_NONE_WEVAS:
- if (_get_tizen_profile() == TIZEN_PROFILE_WEARABLE)
- *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_EVAS;
- else
- *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_NONE;
+ case PLAYER_DISPLAY_TYPE_OVERLAY_SYNC_UI:
+ *out_type = MM_DISPLAY_TYPE_OVERLAY_SYNC_UI;
break;
case PLAYER_DISPLAY_TYPE_EVAS:
- *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_EVAS;
+ *out_type = MM_DISPLAY_TYPE_EVAS;
break;
case PLAYER_DISPLAY_TYPE_NONE:
- *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_NONE;
+ *out_type = MM_DISPLAY_TYPE_NONE;
break;
default:
ret = PLAYER_ERROR_INVALID_PARAMETER;
}
LOGD("display type(%d) -> (%d)", type, *out_type);
+
return ret;
}
int player_set_display(player_h player, player_display_type_e type, player_display_h display)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
+ int mm_ret = MM_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
wl_win_msg_type wl_win;
char *wl_win_msg = (char *)&wl_win;
- unsigned int wl_surface_id;
- player_private_display_type_e conv_type;
- unsigned int (*p_disp_set_wl_display)(int, void *) = NULL;
+ mm_display_type_e conv_type = MM_DISPLAY_TYPE_NONE;
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;
- int (*p_disp_set_evas_display_old_info)(void *, void *, int, int, int) = NULL;
- int (*p_disp_set_evas_display_roi_area)(void *, int, int, int, int) = NULL;
- void (*p_disp_media_packet_video_decode_cb)(media_packet_h, void *) = NULL;
-#endif
pid_t pid = getpid();
pid_t tid = syscall(SYS_gettid);
- LOGD("ENTER");
+ PLAYER_INSTANCE_CHECK(player);
- LOGD("Check if API is called in main thread. pid [%d], tid [%d]", pid, tid);
- if (pid != tid) {
- LOGE("API isn't called in main thread");
- return PLAYER_ERROR_INVALID_OPERATION;
+ if (type != PLAYER_DISPLAY_TYPE_NONE) {
+ LOGD("Check if API is called in main thread. pid [%d], tid [%d]", pid, tid);
+ if (pid != tid) {
+ LOGE("API isn't called in main thread");
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
}
- PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
+ /* check display interface handle */
+ if (!DP_INTERFACE(pc)) {
+ LOGE("display interface not supported");
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
LOGD("ENTER type: %d", type);
- if (type == PLAYER_DISPLAY_TYPE_OBSOLETE_EVAS_WNONE ||
- type == PLAYER_DISPLAY_TYPE_OBSOLETE_NONE_WEVAS) {
- LOGW("DEPRECATION WARNING: display type(%d) is deprecated and will be removed from next release. Use newly defined type value instead.", type);
- }
/* before setting display, player state have to be checked. */
PLAYER_STATE_CHECK(pc, PLAYER_STATE_IDLE);
if (ret != PLAYER_ERROR_NONE)
return ret;
- if (conv_type != PLAYER_PRIVATE_DISPLAY_TYPE_NONE) {
- if (!display)
+ if (conv_type != MM_DISPLAY_TYPE_NONE) {
+ if (!display) {
+ LOGE("type[%d] NULL handle for display", type);
return PLAYER_ERROR_INVALID_PARAMETER;
-
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- /**
- * To support repeating play and stop, Evas_handle should not be destroyed in player_unprepare.
- * When the display type changes, Player need to destroy Evas_handle to set values of video output,
- * Otherwise, the values is not set because of checking Evas_handle.
- */
- if (CALLBACK_INFO(pc) && EVAS_HANDLE(pc)) {
- LOGW("evas client already exists");
- player_unset_media_packet_video_frame_decoded_cb(player);
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_destroy_evas_display, "disp_destroy_evas_display");
- if (p_disp_destroy_evas_display(&EVAS_HANDLE(pc)) != MM_ERROR_NONE)
- LOGW("fail to unset evas client");
- __player_unset_retrieve_buffer_cb(player);
- /* need to set display information again to new handle */
- EVAS_INFO(pc)->update_needed = TRUE;
}
-#endif
- /* set evas_render or wayland */
- if (conv_type == PLAYER_PRIVATE_DISPLAY_TYPE_OVERLAY) {
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_wl_display, "disp_set_wl_display");
- wl_surface_id = p_disp_set_wl_display(ELM_WAYLAND_WIN, display);
- if (wl_surface_id > 0) {
- wl_win.surface_id = wl_surface_id;
- wl_win.type = conv_type;
- } else return PLAYER_ERROR_INVALID_OPERATION;
+
+ mm_ret = mm_display_interface_set_display(DP_INTERFACE(pc), conv_type, display, &wl_win.surface_id);
+ if (mm_ret != MM_ERROR_NONE) {
+ LOGE("[INVALID_OPERATION] set display failed[0x%x]", mm_ret);
+ return PLAYER_ERROR_INVALID_OPERATION;
}
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- else if (conv_type == PLAYER_PRIVATE_DISPLAY_TYPE_EVAS) {
- if (!CALLBACK_INFO(pc)) {
- LOGE("there is no cb info in player handle");
+
+ if (conv_type == MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
+ g_strlcpy(wl_win.exported_shell_handle, (char *)display, MAX_EXPORTED_SHELL_HANDLE_LEN);
+ } else if (conv_type == MM_DISPLAY_TYPE_EVAS) {
+ /* before evas handle is created, user could set display information */
+ player_display_mode_e mode = PLAYER_DISPLAY_MODE_LETTER_BOX;
+ player_display_rotation_e rotation = PLAYER_DISPLAY_ROTATION_NONE;
+ bool visible = false;
+
+ ret = player_get_display_mode(player, &mode);
+ ret |= player_get_display_rotation(player, &rotation);
+ ret |= player_is_display_visible(player, &visible);
+
+ if (ret != PLAYER_ERROR_NONE) {
+ LOGE("get current display settings");
return PLAYER_ERROR_INVALID_OPERATION;
}
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_create_evas_display, "disp_create_evas_display");
- ret = p_disp_create_evas_display(display, &EVAS_HANDLE(pc));
- if (ret != MM_ERROR_NONE) return PLAYER_ERROR_INVALID_OPERATION;
+ LOGD("current setting : mode %d, rotation %d, visible %d, roi %d,%d,%dx%d",
+ mode, rotation, visible,
+ CALLBACK_INFO(pc)->dp_info.roi_x,
+ CALLBACK_INFO(pc)->dp_info.roi_y,
+ CALLBACK_INFO(pc)->dp_info.roi_w,
+ CALLBACK_INFO(pc)->dp_info.roi_h);
+
+ mm_ret = mm_display_interface_evas_set_mode(DP_INTERFACE(pc), mode);
+ mm_ret |= mm_display_interface_evas_set_rotation(DP_INTERFACE(pc), rotation);
+ mm_ret |= mm_display_interface_evas_set_visible(DP_INTERFACE(pc), visible);
+ if (mode == PLAYER_DISPLAY_MODE_DST_ROI) {
+ mm_ret |= mm_display_interface_evas_set_roi_area(DP_INTERFACE(pc),
+ CALLBACK_INFO(pc)->dp_info.roi_x, CALLBACK_INFO(pc)->dp_info.roi_y,
+ CALLBACK_INFO(pc)->dp_info.roi_w, CALLBACK_INFO(pc)->dp_info.roi_h);
+ }
+
+ if (mm_ret != MM_ERROR_NONE) {
+ LOGE("set mm_display_interface failed");
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
- /* before evas handle is created, user could set display information */
- if (EVAS_INFO(pc)->update_needed) {
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_old_info, "disp_set_evas_display_old_info");
- ret = p_disp_set_evas_display_old_info(display, EVAS_HANDLE(pc), EVAS_INFO(pc)->mode, EVAS_INFO(pc)->rotation, EVAS_INFO(pc)->visible);
- if (ret != MM_ERROR_NONE) return PLAYER_ERROR_INVALID_OPERATION;
- if (EVAS_INFO(pc)->mode == PLAYER_DISPLAY_MODE_DST_ROI) {
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_roi_area, "disp_set_evas_display_roi_area");
- ret = p_disp_set_evas_display_roi_area(EVAS_HANDLE(pc), EVAS_INFO(pc)->roi_x, EVAS_INFO(pc)->roi_y, EVAS_INFO(pc)->roi_w, EVAS_INFO(pc)->roi_h);
- if (ret != MM_ERROR_NONE) return PLAYER_ERROR_INVALID_OPERATION;
- }
- EVAS_INFO(pc)->update_needed = FALSE;
+ if (player_set_media_packet_video_frame_decoded_cb(player,
+ __player_media_packet_video_decoded_cb, player) != MM_ERROR_NONE) {
+ LOGE("fail to set decoded callback");
+ return PLAYER_ERROR_INVALID_OPERATION;
}
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_media_packet_video_decode_cb, "disp_media_packet_video_decode_cb");
- ret = player_set_media_packet_video_frame_decoded_cb(player, p_disp_media_packet_video_decode_cb, (void *)EVAS_HANDLE(pc));
- if (ret != PLAYER_ERROR_NONE)
- LOGW("fail to set decoded callback");
if (__player_set_retrieve_buffer_cb(player, __retrieve_buffer_cb, pc))
LOGW("fail to set __retrieve_buffer_cb");
}
-#endif
- } else { /* PLAYER_DISPLAY_TYPE_NONE */
- LOGI("Wayland surface type is NONE");
- wl_win.type = conv_type;
}
- arr_msg_len = (sizeof(wl_win_msg_type)/sizeof(int) + (sizeof(wl_win_msg_type)%sizeof(int) ? 1 : 0));
+ wl_win.type = conv_type;
+
+ 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);
+ MUSE_TYPE_ARRAY, "wl_win_msg", arr_msg_len, (int *)wl_win_msg);
+
g_free(ret_buf);
return ret;
int player_set_display_mode(player_h player, player_display_mode_e mode)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(PLAYER_DISPLAY_MODE_LETTER_BOX <= mode && mode < PLAYER_DISPLAY_MODE_NUM, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
int ret = PLAYER_ERROR_NONE;
+ int mm_ret = MM_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_MODE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- int (*p_disp_set_evas_display_disp_mode)(void *, int) = NULL;
-#endif
+ mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
+
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(mode, PLAYER_DISPLAY_MODE_LETTER_BOX, PLAYER_DISPLAY_MODE_DST_ROI);
+
LOGD("ENTER");
- PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- if (EVAS_HANDLE(pc)) {
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_disp_mode, "disp_set_evas_display_disp_mode");
- ret = p_disp_set_evas_display_disp_mode(EVAS_HANDLE(pc), mode);
- if (ret != MM_ERROR_NONE)
+ PLAYER_GET_DISPLAY_TYPE(pc, display_type);
+
+ if (display_type == MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
+ LOGE("Function is not available in MM_DISPLAY_TYPE_OVERLAY_SYNC_UI type");
+ return PLAYER_ERROR_NOT_AVAILABLE;
+ }
+
+ if (display_type == MM_DISPLAY_TYPE_EVAS) {
+ mm_ret = mm_display_interface_evas_set_mode(DP_INTERFACE(pc), mode);
+ if (mm_ret != MM_ERROR_NONE) {
+ LOGE("mm_display_interface_evas_set_mode failed 0x%x", mm_ret);
return PLAYER_ERROR_INVALID_OPERATION;
- else
- return PLAYER_ERROR_NONE;
- } else {
- EVAS_INFO(pc)->mode = mode;
- EVAS_INFO(pc)->update_needed = TRUE;
+ }
}
-#endif
+
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "mode", (int)mode);
+
g_free(ret_buf);
+
return ret;
}
-int player_get_display_mode(player_h player, player_display_mode_e * pmode)
+int player_get_display_mode(player_h player, player_display_mode_e *pmode)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pmode);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_GET_DISPLAY_MODE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int mode = -1;
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- int (*p_disp_get_evas_display_disp_mode)(void *, int *) = NULL;
-#endif
+ mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
+
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pmode);
LOGD("ENTER");
- PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
-
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- if (EVAS_HANDLE(pc)) {
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_get_evas_display_disp_mode, "disp_get_evas_display_disp_mode");
- ret = p_disp_get_evas_display_disp_mode(EVAS_HANDLE(pc), &mode);
- *pmode = (player_display_mode_e) mode;
- if (ret != MM_ERROR_NONE)
- return PLAYER_ERROR_INVALID_OPERATION;
- else
- return PLAYER_ERROR_NONE;
+
+ PLAYER_GET_DISPLAY_TYPE(pc, display_type);
+
+ if (display_type == MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
+ LOGE("Function is not available in MM_DISPLAY_TYPE_OVERLAY_SYNC_UI type");
+ return PLAYER_ERROR_NOT_AVAILABLE;
}
-#endif
+
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
+
if (ret == PLAYER_ERROR_NONE) {
player_msg_get_type(mode, ret_buf, INT);
*pmode = mode;
}
g_free(ret_buf);
+
return ret;
}
int player_set_video_roi_area(player_h player, double x_scale, double y_scale,
double w_scale, double h_scale)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_VIDEO_ROI_AREA;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
+
+ PLAYER_INSTANCE_CHECK(player);
LOGD("ENTER");
- PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
- PLAYER_CHECK_CONDITION(CALLBACK_INFO(pc) != NULL && EVAS_HANDLE(pc) == NULL,
- PLAYER_ERROR_INVALID_OPERATION, "Display type is EVAS, video display interface is not supported");
+
+ PLAYER_GET_DISPLAY_TYPE(pc, display_type);
+
+ if (display_type == MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
+ LOGE("Function is not available in MM_DISPLAY_TYPE_OVERLAY_SYNC_UI type");
+ return PLAYER_ERROR_NOT_AVAILABLE;
+ }
+
+ if (display_type == MM_DISPLAY_TYPE_EVAS) {
+ LOGE("Display type is EVAS, video display interface is not supported");
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
if (!_player_video_roi_area_is_valid(x_scale, y_scale, w_scale, h_scale))
return PLAYER_ERROR_INVALID_PARAMETER;
int player_get_video_roi_area(player_h player, double *x_scale, double *y_scale,
double *w_scale, double *h_scale)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(x_scale && y_scale && w_scale && h_scale);
-
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_GET_VIDEO_ROI_AREA;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
double scale_x = 0, scale_y = 0, scale_w = 0, scale_h = 0;
+ mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
+
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_GET_DISPLAY_TYPE(pc, display_type);
+
+ if (display_type == MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
+ LOGE("Function is not available in MM_DISPLAY_TYPE_OVERLAY_SYNC_UI type");
+ return PLAYER_ERROR_NOT_AVAILABLE;
+ }
+
+ PLAYER_NULL_ARG_CHECK(x_scale && y_scale && w_scale && h_scale);
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_set_display_roi_area(player_h player, int x, int y, int width, int height)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(width > 0 && height > 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-
int ret = PLAYER_ERROR_NONE;
+ int mm_ret = MM_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_ROI_AREA;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
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
+ mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
+
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_CHECK_CONDITION(width > 0 && height > 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
LOGD("ENTER");
- PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- if (EVAS_HANDLE(pc)) {
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_roi_area, "disp_set_evas_display_roi_area");
- ret = p_disp_set_evas_display_roi_area(EVAS_HANDLE(pc), x, y, width, height);
- if (ret == MM_ERROR_EVASRENDER_INVALID_ARGUMENT)
+ PLAYER_GET_DISPLAY_TYPE(pc, display_type);
+
+ if (display_type == MM_DISPLAY_TYPE_EVAS) {
+ mm_ret = mm_display_interface_evas_set_roi_area(DP_INTERFACE(pc), x, y, width, height);
+ if (mm_ret == MM_ERROR_EVASRENDER_INVALID_ARGUMENT)
return PLAYER_ERROR_INVALID_PARAMETER;
- else if (ret != MM_ERROR_NONE)
+ else if (mm_ret != MM_ERROR_NONE)
return PLAYER_ERROR_INVALID_OPERATION;
- else
- return PLAYER_ERROR_NONE;
- } else {
- EVAS_INFO(pc)->roi_x = x;
- EVAS_INFO(pc)->roi_y = y;
- EVAS_INFO(pc)->roi_w = width;
- EVAS_INFO(pc)->roi_h = height;
- EVAS_INFO(pc)->update_needed = TRUE;
}
-#endif
+
wl_win.win_roi_x = x;
wl_win.win_roi_y = y;
wl_win.win_roi_width = width;
wl_win.win_roi_height = height;
- arr_msg_len = (sizeof(wl_win_msg_type)/sizeof(int) + (sizeof(wl_win_msg_type)%sizeof(int) ? 1 : 0));
+ 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);
+ MUSE_TYPE_ARRAY, "wl_win_msg", arr_msg_len, (int *)wl_win_msg);
+
+ if (ret == PLAYER_ERROR_NONE) {
+ CALLBACK_INFO(pc)->dp_info.roi_x = x;
+ CALLBACK_INFO(pc)->dp_info.roi_y = y;
+ CALLBACK_INFO(pc)->dp_info.roi_w = width;
+ CALLBACK_INFO(pc)->dp_info.roi_h = height;
+ }
g_free(ret_buf);
+
return ret;
}
int player_set_playback_rate(player_h player, float rate)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(rate >= -5.0 && rate <= 5.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_PLAYBACK_RATE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(rate, -5.0, 5.0);
+
LOGD("ENTER");
if (rate != 0) {
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_DOUBLE, "rate", (double)rate);
int player_set_display_rotation(player_h player, player_display_rotation_e rotation)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(PLAYER_DISPLAY_ROTATION_NONE <= rotation && rotation <= PLAYER_DISPLAY_ROTATION_270, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-
int ret = PLAYER_ERROR_NONE;
+ int mm_ret = MM_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_ROTATION;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- int (*p_disp_set_evas_display_rotation)(void *, int) = NULL;
-#endif
+ mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
+
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(rotation, PLAYER_DISPLAY_ROTATION_NONE, PLAYER_DISPLAY_ROTATION_270);
LOGD("ENTER");
- PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- if (EVAS_HANDLE(pc)) {
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_rotation, "disp_set_evas_display_rotation");
- ret = p_disp_set_evas_display_rotation(EVAS_HANDLE(pc), rotation);
- if (ret != MM_ERROR_NONE)
+ PLAYER_GET_DISPLAY_TYPE(pc, display_type);
+
+ if (display_type == MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
+ LOGE("Function is not available in MM_DISPLAY_TYPE_OVERLAY_SYNC_UI type");
+ return PLAYER_ERROR_NOT_AVAILABLE;
+ }
+
+ if (display_type == MM_DISPLAY_TYPE_EVAS) {
+ mm_ret = mm_display_interface_evas_set_rotation(DP_INTERFACE(pc), rotation);
+ if (mm_ret != MM_ERROR_NONE) {
+ LOGE("mm_display_interface_evas_set_rotation failed 0x%x", mm_ret);
return PLAYER_ERROR_INVALID_OPERATION;
- else
- return PLAYER_ERROR_NONE;
- } else {
- EVAS_INFO(pc)->rotation = rotation;
- EVAS_INFO(pc)->update_needed = TRUE;
+ }
}
-#endif
+
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "rotation", (int)rotation);
+
g_free(ret_buf);
+
return ret;
}
-int player_get_display_rotation(player_h player, player_display_rotation_e * protation)
+int player_get_display_rotation(player_h player, player_display_rotation_e *protation)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(protation);
int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_GET_DISPLAY_ROTATION;
char *ret_buf = NULL;
int rotation = -1;
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- int (*p_disp_get_evas_display_rotation)(void *, int *) = NULL;
-#endif
+ mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
- LOGD("ENTER");
- PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
-
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- if (EVAS_HANDLE(pc)) {
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_get_evas_display_rotation, "disp_get_evas_display_rotation");
- ret = p_disp_get_evas_display_rotation(EVAS_HANDLE(pc), &rotation);
- *protation = (player_display_rotation_e) rotation;
- if (ret != MM_ERROR_NONE)
- return PLAYER_ERROR_INVALID_OPERATION;
- else
- return PLAYER_ERROR_NONE;
- }
-#endif
- PLAYER_SEND_MSG(api, pc, ret_buf, ret);
- if (ret == PLAYER_ERROR_NONE) {
- player_msg_get_type(rotation, ret_buf, INT);
- *protation = rotation;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_GET_DISPLAY_TYPE(pc, display_type);
+
+ if (display_type == MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
+ LOGE("Function is not available in MM_DISPLAY_TYPE_OVERLAY_SYNC_UI type");
+ return PLAYER_ERROR_NOT_AVAILABLE;
+ }
+
+ PLAYER_NULL_ARG_CHECK(protation);
+
+ LOGD("ENTER");
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret);
+
+ if (ret == PLAYER_ERROR_NONE) {
+ player_msg_get_type(rotation, ret_buf, INT);
+ *protation = rotation;
}
g_free(ret_buf);
+
return ret;
}
int player_set_display_visible(player_h player, bool visible)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *) player;
+ int mm_ret = MM_ERROR_NONE;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_VISIBLE;
char *ret_buf = NULL;
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- int (*p_disp_set_evas_display_visible)(void *, bool) = NULL;
-#endif
+ mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
+
+ PLAYER_INSTANCE_CHECK(player);
LOGD("ENTER");
- PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- if (EVAS_HANDLE(pc)) {
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_visible, "disp_set_evas_display_visible");
- ret = p_disp_set_evas_display_visible(EVAS_HANDLE(pc), visible);
- if (ret != MM_ERROR_NONE)
- return PLAYER_ERROR_INVALID_OPERATION;
+ PLAYER_GET_DISPLAY_TYPE(pc, display_type);
- EVAS_INFO(pc)->visible = visible ? EVAS_VISIBLE_TRUE : EVAS_VISIBLE_FALSE;
- return PLAYER_ERROR_NONE;
- } else {
- EVAS_INFO(pc)->visible = visible ? EVAS_VISIBLE_TRUE : EVAS_VISIBLE_FALSE;
- EVAS_INFO(pc)->update_needed = TRUE;
+ if (display_type == MM_DISPLAY_TYPE_EVAS) {
+ mm_ret = mm_display_interface_evas_set_visible(DP_INTERFACE(pc), visible);
+ if (mm_ret != MM_ERROR_NONE) {
+ LOGE("mm_display_interface_evas_set_visible failed 0x%x", mm_ret);
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
}
-#endif
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "visible", (int)visible);
+
g_free(ret_buf);
+
+ if (ret == PLAYER_ERROR_NONE)
+ CALLBACK_INFO(pc)->dp_info.visible = visible ? PLAYER_VISIBLE_INFO_TRUE : PLAYER_VISIBLE_INFO_FALSE;
+
return ret;
}
-int player_is_display_visible(player_h player, bool * pvisible)
+int player_is_display_visible(player_h player, bool *pvisible)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pvisible);
int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_IS_DISPLAY_VISIBLE;
char *ret_buf = NULL;
int value = -1;
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- bool visible = 0;
- int (*p_disp_get_evas_display_visible)(void *, bool *) = NULL;
-#endif
- LOGD("ENTER");
- PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pvisible);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- if (EVAS_HANDLE(pc)) {
- PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_get_evas_display_visible, "disp_get_evas_display_visible");
- ret = p_disp_get_evas_display_visible(EVAS_HANDLE(pc), &visible);
- if (visible)
- *pvisible = TRUE;
- else
- *pvisible = FALSE;
+ LOGD("ENTER");
- if (ret != MM_ERROR_NONE)
- return PLAYER_ERROR_INVALID_OPERATION;
- else
- return PLAYER_ERROR_NONE;
- }
-#endif
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
+
if (ret == PLAYER_ERROR_NONE) {
player_msg_get_type(value, ret_buf, INT);
}
g_free(ret_buf);
+
return ret;
}
int player_get_content_info(player_h player, player_content_info_e key, char **pvalue)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pvalue);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_GET_CONTENT_INFO;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
char value[MUSE_MSG_MAX_LENGTH] = { 0, };
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pvalue);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "key", (int)key);
int player_get_codec_info(player_h player, char **paudio_codec, char **pvideo_codec)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(paudio_codec || pvideo_codec);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_GET_CODEC_INFO;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
char video_codec[MUSE_MSG_MAX_LENGTH] = { 0, };
char audio_codec[MUSE_MSG_MAX_LENGTH] = { 0, };
bool ret_val = TRUE;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(paudio_codec || pvideo_codec);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_get_audio_stream_info(player_h player, int *psample_rate, int *pchannel, int *pbit_rate)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(psample_rate || pchannel || pbit_rate);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_GET_AUDIO_STREAM_INFO;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int sample_rate = 0;
int channel = 0;
int bit_rate = 0;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(psample_rate || pchannel || pbit_rate);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_get_video_stream_info(player_h player, int *pfps, int *pbit_rate)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pfps || pbit_rate);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_GET_VIDEO_STREAM_INFO;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int fps = 0;
int bit_rate = 0;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pfps || pbit_rate);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_get_video_size(player_h player, int *pwidth, int *pheight)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pwidth && pheight);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_GET_VIDEO_SIZE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int width = 0;
int height = 0;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pwidth && pheight);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_get_album_art(player_h player, void **palbum_art, int *psize)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(palbum_art && psize);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_GET_ALBUM_ART;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
char *album_art;
int size = 0;
int key = INVALID_DEFAULT_VALUE;
void *jobj = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(palbum_art && psize);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
if (jobj)
muse_core_msg_object_free(jobj);
- if (ret_buf)
- g_free(ret_buf);
+ g_free(ret_buf);
- if (tfd > INVALID_DEFAULT_VALUE)
- close(tfd);
+ PLAYER_CLOSE_FD(tfd);
if (CALLBACK_INFO(pc))
pc->cb_info->tfd = INVALID_DEFAULT_VALUE;
int player_audio_effect_get_equalizer_bands_count(player_h player, int *pcount)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pcount);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_GET_EQUALIZER_BANDS_COUNT;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int count;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pcount);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_audio_effect_set_equalizer_all_bands(player_h player, int *band_levels, int length)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(band_levels);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_SET_EQUALIZER_ALL_BANDS;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(band_levels);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret,
int player_audio_effect_set_equalizer_band_level(player_h player, int index, int level)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_SET_EQUALIZER_BAND_LEVEL;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret,
int player_audio_effect_get_equalizer_band_level(player_h player, int index, int *plevel)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(plevel);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_GET_EQUALIZER_BAND_LEVEL;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int level;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(plevel);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "index", index);
int player_audio_effect_get_equalizer_level_range(player_h player, int *pmin, int *pmax)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pmin && pmax);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_GET_EQUALIZER_LEVEL_RANGE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int min = 0, max = 0;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pmin && pmax);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_audio_effect_get_equalizer_band_frequency(player_h player, int index, int *pfrequency)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pfrequency);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_GET_EQUALIZER_BAND_FREQUENCY;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int frequency;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pfrequency);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "index", index);
int player_audio_effect_get_equalizer_band_frequency_range(player_h player, int index, int *prange)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(prange);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_GET_EQUALIZER_BAND_FREQUENCY_RANGE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int range;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(prange);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "index", index);
int player_audio_effect_equalizer_clear(player_h player)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_EQUALIZER_CLEAR;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
return ret;
}
-int player_audio_effect_equalizer_is_available(player_h player, bool * pavailable)
+int player_audio_effect_equalizer_is_available(player_h player, bool *pavailable)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pavailable);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_AUDIO_EFFECT_EQUALIZER_IS_AVAILABLE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int available;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pavailable);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_set_subtitle_path(player_h player, const char *path)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_SUBTITLE_PATH;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
char subtitle_path[MAX_URL_LEN] = {0, };
+ PLAYER_INSTANCE_CHECK(player);
+
LOGD("ENTER");
if (path && _player_get_valid_path(path, subtitle_path) != PLAYER_ERROR_NONE)
return PLAYER_ERROR_INVALID_PARAMETER;
- PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_STRING, "subtitle_path", (const char*)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;
}
int player_set_subtitle_position_offset(player_h player, int milliseconds)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_SUBTITLE_POSITION_OFFSET;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
- LOGD("ENTER");
-
- PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "milliseconds", milliseconds);
-
- g_free(ret_buf);
- return ret;
-}
-
-int player_set_progressive_download_path(player_h player, const char *path)
-{
PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(path);
- int ret = PLAYER_ERROR_NONE;
- muse_player_api_e api = MUSE_PLAYER_API_SET_PROGRESSIVE_DOWNLOAD_PATH;
- player_cli_s *pc = (player_cli_s *) player;
- char *ret_buf = NULL;
- char dw_path[MAX_URL_LEN] = {0, };
LOGD("ENTER");
- LOGW("DEPRECATION WARNING: player_set_progressive_download_path() is deprecated and will be removed from next release.");
-
- if (!_player_check_network_availability())
- return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
- if (_player_get_valid_path(path, dw_path) != PLAYER_ERROR_NONE)
- return PLAYER_ERROR_INVALID_PARAMETER;
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "milliseconds", milliseconds);
- PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_STRING, "dw_path", (const char*)dw_path);
g_free(ret_buf);
return ret;
}
-int player_get_progressive_download_status(player_h player, unsigned long *pcurrent, unsigned long *ptotal_size)
+int player_capture_video(player_h player, player_video_captured_cb callback, void *user_data)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pcurrent && ptotal_size);
int ret = PLAYER_ERROR_NONE;
- muse_player_api_e api = MUSE_PLAYER_API_GET_PROGRESSIVE_DOWNLOAD_STATUS;
- player_cli_s *pc = (player_cli_s *) player;
+ muse_player_api_e api = MUSE_PLAYER_API_CAPTURE_VIDEO;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
- unsigned long current, total_size;
-
- LOGD("ENTER");
- LOGW("DEPRECATION WARNING: player_get_progressive_download_status() is deprecated and will be removed from next release.");
-
- PLAYER_SEND_MSG(api, pc, ret_buf, ret);
- if (ret == PLAYER_ERROR_NONE) {
- 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;
- } else {
- ret = PLAYER_ERROR_INVALID_OPERATION;
- }
- }
- g_free(ret_buf);
- return ret;
-
-}
-int player_capture_video(player_h player, player_video_captured_cb callback, void *user_data)
-{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- int ret = PLAYER_ERROR_NONE;
- muse_player_api_e api = MUSE_PLAYER_API_CAPTURE_VIDEO;
- player_cli_s *pc = (player_cli_s *) player;
- char *ret_buf = NULL;
LOGD("ENTER");
if (pc->cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE]) {
int player_set_streaming_cookie(player_h player, const char *cookie, int size)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(cookie);
- PLAYER_CHECK_CONDITION(size >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_STREAMING_COOKIE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(cookie);
+ PLAYER_CHECK_CONDITION(size >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret,
int player_set_streaming_user_agent(player_h player, const char *user_agent, int size)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(user_agent);
- PLAYER_CHECK_CONDITION(size >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_STREAMING_USER_AGENT;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(user_agent);
+ PLAYER_CHECK_CONDITION(size >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret,
return ret;
}
-int player_get_streaming_download_progress(player_h player, int *pstart, int *pcurrent)
+int player_get_streaming_download_progress(player_h player, int *start, int *end)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pstart && pcurrent);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_GET_STREAMING_DOWNLOAD_PROGRESS;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
- int start = 0, current = 0;
+ int start_pos = 0, end_pos = 0;
+
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(start && end);
LOGD("ENTER");
if (ret == PLAYER_ERROR_NONE) {
bool ret_val = true;
ret_val = _player_get_param_value(ret_buf,
- MUSE_TYPE_INT, "start", (void *)&start,
- MUSE_TYPE_INT, "current", (void *)¤t,
+ MUSE_TYPE_INT, "start_pos", (void *)&start_pos,
+ MUSE_TYPE_INT, "end_pos", (void *)&end_pos,
INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
- *pstart = start;
- *pcurrent = current;
+ *start = start_pos;
+ *end = end_pos;
} else {
ret = PLAYER_ERROR_INVALID_OPERATION;
}
}
g_free(ret_buf);
return ret;
-
}
int player_set_completed_cb(player_h player, player_completed_cb callback, void *user_data)
return __set_callback(MUSE_PLAYER_EVENT_TYPE_COMPLETE, player, callback, user_data);
}
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
static void __retrieve_buffer_cb(void *user_data)
{
player_cli_s *player = (player_cli_s *)user_data;
int ret = PLAYER_ERROR_NONE;
bool gapless = false;
- int (*p_disp_evas_display_retrieve_all_packets)(void *, bool) = NULL;
- ret = player_is_gapless((player_h)user_data, &gapless);
+ ret = player_is_gapless((player_h)player, &gapless);
if (ret != PLAYER_ERROR_NONE) {
LOGW("player_is_gapless is failed");
return;
}
- PLAYER_DISP_DLSYM(player->dl_handle, p_disp_evas_display_retrieve_all_packets, "disp_evas_display_retrieve_all_packets");
- ret = p_disp_evas_display_retrieve_all_packets(EVAS_HANDLE(player), gapless);
- if (ret != PLAYER_ERROR_NONE)
- LOGI("mm_evas_renderer_retrieve_all_packets returned error");
+ ret = mm_display_interface_evas_flush(DP_INTERFACE(player), gapless);
+
+ LOGW("flush all packet : 0x%x [gapless %d]", ret, gapless);
}
static int __player_set_retrieve_buffer_cb(player_h player, player_retrieve_buffer_cb callback, void *user_data)
{
return __unset_callback(MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER, player);
}
-#endif
int player_unset_completed_cb(player_h player)
{
return __unset_callback(MUSE_PLAYER_EVENT_TYPE_SUBTITLE, player);
}
-int player_set_progressive_download_message_cb(player_h player, player_pd_message_cb callback, void *user_data)
+int player_set_media_packet_video_frame_decoded_cb(player_h player, player_media_packet_video_decoded_cb callback, void *user_data)
+{
+ 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)
+{
+ return __unset_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME, player);
+}
+
+int player_set_media_packet_audio_frame_decoded_cb(player_h player, media_format_h format,
+ player_audio_extract_option_e opt, player_media_packet_audio_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;
+ player_cli_s *pc = (player_cli_s *)player;
+ muse_player_api_e api = MUSE_PLAYER_API_SET_MEDIA_PACKET_AUDIO_FRAME_DECODED_CB;
char *ret_buf = NULL;
- muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_PD;
- int set = 1;
+ media_format_mimetype_e mimetype = MEDIA_FORMAT_MAX;
+ int channel = 0;
+ int samplerate = 0;
+
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(callback);
+ PLAYER_RANGE_ARG_CHECK(opt, PLAYER_AUDIO_EXTRACT_DEFAULT, PLAYER_AUDIO_EXTRACT_NO_SYNC_AND_DEINTERLEAVE);
LOGD("ENTER");
- LOGW("DEPRECATION WARNING: player_set_progressive_download_message_cb() is deprecated and will be removed from next release.");
- if (!_player_check_network_availability())
- return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
+ if (format) {
+ media_format_ref(format);
+ if (media_format_get_audio_info(format, &mimetype, &channel, &samplerate, NULL, NULL) != MEDIA_FORMAT_ERROR_NONE) {
+ LOGE("failed to get audio info from media format.");
+ media_format_unref(format);
+ return PLAYER_ERROR_INVALID_PARAMETER;
+ }
+ media_format_unref(format);
+
+ if (mimetype < MEDIA_FORMAT_PCM || mimetype > MEDIA_FORMAT_PCM_U32BE) {
+ LOGW("Not supported audio format type : 0x%X", mimetype);
+ return PLAYER_ERROR_INVALID_PARAMETER;
+ }
+ }
+
+ LOGD("pcm spec : 0x%X, %d, %d", mimetype, channel, samplerate);
PLAYER_SEND_MSG(api, pc, ret_buf, ret,
- MUSE_TYPE_INT, "type", type,
- MUSE_TYPE_INT, "set", set);
+ MUSE_TYPE_INT, "opt", opt,
+ MUSE_TYPE_INT, "mimetype", mimetype,
+ MUSE_TYPE_INT, "channel", channel,
+ MUSE_TYPE_INT, "samplerate", samplerate);
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);
+ pc->cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME] = callback;
+ pc->cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME] = user_data;
+ LOGI("Event type : %d ", MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME);
}
g_free(ret_buf);
return ret;
}
-int player_unset_progressive_download_message_cb(player_h player)
+int player_unset_media_packet_audio_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_PD;
- int set = 0;
-
- LOGD("ENTER");
- LOGW("DEPRECATION WARNING: player_unset_progressive_download_message_cb() is deprecated and will be removed from next release.");
-
- 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);
+ return __unset_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME, player);
+}
- g_free(ret_buf);
- return ret;
+int player_set_video_stream_changed_cb(player_h player, player_video_stream_changed_cb callback, void *user_data)
+{
+ return __set_callback(MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED, player, callback, user_data);
+}
+int player_unset_video_stream_changed_cb(player_h player)
+{
+ return __unset_callback(MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED, player);
}
-int player_set_media_packet_video_frame_decoded_cb(player_h player, player_media_packet_video_decoded_cb callback, void *user_data)
+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)
{
+ muse_player_event_e type;
+
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);
+ if (stream_type == PLAYER_STREAM_TYPE_VIDEO) {
+ type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS;
+ } else if (stream_type == PLAYER_STREAM_TYPE_AUDIO) {
+ type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS;
+ } else {
+ LOGE("PLAYER_ERROR_INVALID_PARAMETER(type : %d)", stream_type);
+ return PLAYER_ERROR_INVALID_PARAMETER;
}
- g_free(ret_buf);
- return ret;
+ return __set_callback(type, player, callback, user_data);
}
-int player_unset_media_packet_video_frame_decoded_cb(player_h player)
+int player_unset_media_stream_buffer_status_cb(player_h player, player_stream_type_e stream_type)
{
+ muse_player_event_e 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 = 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;
-}
-
-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;
-}
-
-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;
-}
-
-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");
-
- if (stream_type == PLAYER_STREAM_TYPE_VIDEO)
+ if (stream_type == PLAYER_STREAM_TYPE_VIDEO) {
type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS;
- else if (stream_type == PLAYER_STREAM_TYPE_AUDIO)
+ } else if (stream_type == PLAYER_STREAM_TYPE_AUDIO) {
type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS;
- else {
+ } else {
LOGE("PLAYER_ERROR_INVALID_PARAMETER(type : %d)", stream_type);
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 __unset_callback(type, player);
}
-int player_unset_media_stream_buffer_status_cb(player_h player, player_stream_type_e stream_type)
+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);
- 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");
- if (stream_type == PLAYER_STREAM_TYPE_VIDEO)
- type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS;
- else if (stream_type == PLAYER_STREAM_TYPE_AUDIO)
- type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS;
- else {
- LOGE("PLAYER_ERROR_INVALID_PARAMETER(type : %d)", stream_type);
- 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;
-}
-
-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");
- if (stream_type == PLAYER_STREAM_TYPE_VIDEO)
+ if (stream_type == PLAYER_STREAM_TYPE_VIDEO) {
type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK;
- else if (stream_type == PLAYER_STREAM_TYPE_AUDIO)
+ } else if (stream_type == PLAYER_STREAM_TYPE_AUDIO) {
type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK;
- else {
+ } else {
LOGE("PLAYER_ERROR_INVALID_PARAMETER(type : %d)", stream_type);
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;
+
+ PLAYER_INSTANCE_CHECK(player);
LOGD("ENTER");
- if (stream_type == PLAYER_STREAM_TYPE_VIDEO)
+ if (stream_type == PLAYER_STREAM_TYPE_VIDEO) {
type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK;
- else if (stream_type == PLAYER_STREAM_TYPE_AUDIO)
+ } else if (stream_type == PLAYER_STREAM_TYPE_AUDIO) {
type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK;
- else {
+ } else {
LOGE("PLAYER_ERROR_INVALID_PARAMETER(type : %d)", stream_type);
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 */
int player_push_media_stream(player_h player, media_packet_h packet)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(packet);
int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *) player;
+ int packet_ret = MEDIA_PACKET_ERROR_NONE;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_PUSH_MEDIA_STREAM;
char *ret_buf = NULL;
player_push_media_msg_type push_media;
bool is_audio;
bool is_eos;
int arr_msg_len = 0;
+ char *codec_data = NULL;
+ unsigned int codec_data_size = 0;
+
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(packet);
LOGD("ENTER");
- media_packet_get_buffer_data_ptr(packet, (void **)&buf);
- media_packet_get_buffer_size(packet, &push_media.size);
- media_packet_get_pts(packet, &push_media.pts);
- media_packet_get_format(packet, &format);
- media_packet_get_flags(packet, &push_media.flags);
+ if (media_packet_get_buffer_data_ptr(packet, (void **)&buf) != MEDIA_PACKET_ERROR_NONE) {
+ LOGE("failed to get buffer data ptr");
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
- push_media.buf_type = PUSH_MEDIA_BUF_TYPE_RAW;
+ if (media_packet_get_buffer_size(packet, &push_media.size) != MEDIA_PACKET_ERROR_NONE) {
+ LOGE("failed to get buffer size");
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+
+ if (media_packet_get_pts(packet, &push_media.pts) != MEDIA_PACKET_ERROR_NONE) {
+ LOGE("failed to get buffer pts");
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+
+ if (media_packet_get_format(packet, &format) != MEDIA_PACKET_ERROR_NONE) { /* format ref count is increased */
+ LOGE("failed to get media format");
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
- media_packet_is_video(packet, &is_video);
- media_packet_is_audio(packet, &is_audio);
- media_packet_is_end_of_stream(packet, &is_eos);
+ packet_ret = media_packet_get_flags(packet, &push_media.flags);
+ packet_ret |= media_packet_is_video(packet, &is_video);
+ packet_ret |= media_packet_is_audio(packet, &is_audio);
+ packet_ret |= media_packet_is_end_of_stream(packet, &is_eos);
if (is_video)
- media_format_get_video_info(format, &push_media.mimetype, &push_media.width, &push_media.height, NULL, NULL);
+ packet_ret |= media_format_get_video_info(format, &push_media.mimetype,
+ &push_media.width, &push_media.height, NULL, NULL);
else if (is_audio)
- media_format_get_audio_info(format, &push_media.mimetype, NULL, NULL, NULL, NULL);
+ packet_ret |= media_format_get_audio_info(format, &push_media.mimetype,
+ &push_media.channels, &push_media.samplerate, NULL, NULL);
media_format_unref(format);
+ if (packet_ret != MEDIA_PACKET_ERROR_NONE) {
+ LOGE("failed to get media packet info");
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+
+ if (media_packet_get_codec_data(packet, (void **)&codec_data, &codec_data_size) == MEDIA_PACKET_ERROR_NONE) {
+ if (codec_data_size > 0 && codec_data_size <= sizeof(push_media.codec_data))
+ memcpy(push_media.codec_data, codec_data, codec_data_size);
+ }
+
+ push_media.codec_data_size = codec_data_size;
+ push_media.buf_type = PUSH_MEDIA_BUF_TYPE_RAW;
+
#ifdef __UN_USED
int arr_buf_len = 0;
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);
+ MUSE_TYPE_ARRAY, "push_media_msg", arr_msg_len, (int *)push_media_msg,
+ MUSE_TYPE_ARRAY, "buf", arr_buf_len, (int *)buf);
} else
#endif
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);
+ MUSE_TYPE_ARRAY, "push_media_msg", arr_msg_len, (int *)push_media_msg);
}
LOGD("ret_buf %s", ret_buf);
#ifdef __UN_USED
- ERROR:
- if (tfd > INVALID_DEFAULT_VALUE)
- close(tfd);
+ERROR:
+
+ PLAYER_CLOSE_FD(tfd);
if (push_media.buf_type == PUSH_MEDIA_BUF_TYPE_TBM)
tbm_bo_unref(bo);
return ret;
}
-int player_set_media_stream_info(player_h player, player_stream_type_e type, media_format_h format)
+int player_foreach_media_stream_supported_format(player_h player, player_supported_media_format_cb callback, void *user_data)
{
+ int ret = PLAYER_ERROR_NONE;
+ player_cli_s *pc = (player_cli_s *)player;
+ muse_player_api_e api = MUSE_PLAYER_API_GET_MEDIA_STREAM_SUPPORTED_FORMAT;
+ char *ret_buf = NULL;
+ int format_info[MAX_SUPPORTED_MEDIA_FORMAT] = {0,};
+ int len = 0, idx = 0;
+
PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(callback);
+
+ LOGD("ENTER");
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret);
+
+ player_msg_get_type(len, ret_buf, INT);
+ player_msg_get_array(format_info, ret_buf);
+
+ LOGD("num of format %d", len);
+ for (idx = 0 ; idx < len ; idx++) {
+ if (!callback(format_info[idx], user_data)) {
+ LOGW("stop foreach callback");
+ break;
+ }
+ }
+
+ LOGD("LEAVE 0x%X", ret);
+ g_free(ret_buf);
+ return ret;
+}
+
+int player_set_media_stream_info(player_h player, player_stream_type_e type, media_format_h format)
+{
g_return_val_if_fail(format, PLAYER_ERROR_INVALID_OPERATION);
int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_SET_MEDIA_STREAM_INFO;
char *ret_buf = NULL;
media_format_mimetype_e mimetype;
int bit = 0;
int frame_rate = 0;
+ PLAYER_INSTANCE_CHECK(player);
+
LOGD("ENTER");
media_format_ref(format);
int player_set_media_stream_buffer_max_size(player_h player, player_stream_type_e type, unsigned long long max_size)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(PLAYER_STREAM_TYPE_DEFAULT <= type && type <= PLAYER_STREAM_TYPE_TEXT, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- PLAYER_CHECK_CONDITION(max_size > 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-
int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_SET_MEDIA_STREAM_BUFFER_MAX_SIZE;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(type, PLAYER_STREAM_TYPE_AUDIO, PLAYER_STREAM_TYPE_VIDEO);
+ PLAYER_CHECK_CONDITION(max_size > 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret,
int player_get_media_stream_buffer_max_size(player_h player, player_stream_type_e type, unsigned long long *pmax_size)
{
int ret = PLAYER_ERROR_NONE;
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pmax_size);
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_GET_MEDIA_STREAM_BUFFER_MAX_SIZE;
char *ret_buf = NULL;
unsigned long long max_size;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pmax_size);
+ PLAYER_RANGE_ARG_CHECK(type, PLAYER_STREAM_TYPE_AUDIO, PLAYER_STREAM_TYPE_VIDEO);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type);
int player_set_media_stream_buffer_min_threshold(player_h player, player_stream_type_e type, unsigned int percent)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(PLAYER_STREAM_TYPE_DEFAULT <= type && type <= PLAYER_STREAM_TYPE_TEXT, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-
int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_SET_MEDIA_STREAM_BUFFER_MIN_THRESHOLD;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(type, PLAYER_STREAM_TYPE_DEFAULT, PLAYER_STREAM_TYPE_TEXT);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret,
int player_get_media_stream_buffer_min_threshold(player_h player, player_stream_type_e type, unsigned int *ppercent)
{
int ret = PLAYER_ERROR_NONE;
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(ppercent);
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_GET_MEDIA_STREAM_BUFFER_MIN_THRESHOLD;
char *ret_buf = NULL;
- uint percent;
+ unsigned int percent;
+
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(ppercent);
LOGD("ENTER");
int player_get_track_count(player_h player, player_stream_type_e type, int *pcount)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pcount);
int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_GET_TRACK_COUNT;
char *ret_buf = NULL;
int count;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pcount);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type);
int player_get_current_track(player_h player, player_stream_type_e type, int *pindex)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pindex);
int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_GET_CURRENT_TRACK;
char *ret_buf = NULL;
int index;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pindex);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type);
int player_select_track(player_h player, player_stream_type_e type, int index)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_SELECT_TRACK;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type, MUSE_TYPE_INT, "index", index);
int player_get_track_language_code(player_h player, player_stream_type_e type, int index, char **pcode)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pcode);
int ret = PLAYER_ERROR_NONE;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_GET_TRACK_LANGUAGE_CODE;
char *ret_buf = NULL;
char code[MUSE_MSG_MAX_LENGTH] = { 0, };
int code_len = 0;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pcode);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "type", type, MUSE_TYPE_INT, "index", index);
int player_foreach_adaptive_variant(player_h player, player_adaptive_variant_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;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_GET_ADAPTIVE_VARIANT_INFO;
char *ret_buf = NULL;
char var_info[MUSE_MSG_MAX_LENGTH] = { 0, };
char *token = NULL;
char *ptr = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(callback);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_set_max_adaptive_variant_limit(player_h player, int bandwidth, int width, int height)
{
int ret = PLAYER_ERROR_NONE;
+ player_cli_s *pc = (player_cli_s *)player;
+ muse_player_api_e api = MUSE_PLAYER_API_SET_MAX_ADAPTIVE_VARIANT_LIMIT;
+ char *ret_buf = NULL;
+
PLAYER_INSTANCE_CHECK(player);
PLAYER_CHECK_CONDITION(bandwidth >= -1 && width >= -1 && height >= -1,
PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- player_cli_s *pc = (player_cli_s *) player;
- muse_player_api_e api = MUSE_PLAYER_API_SET_MAX_ADAPTIVE_VARIANT_LIMIT;
- char *ret_buf = NULL;
LOGD("ENTER");
int player_get_max_adaptive_variant_limit(player_h player, int *pbandwidth, int *pwidth, int *pheight)
{
int ret = PLAYER_ERROR_NONE;
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(pbandwidth || pwidth || pheight);
-
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_GET_MAX_ADAPTIVE_VARIANT_LIMIT;
char *ret_buf = NULL;
int bandwidth = -1, width = -1, height = -1;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(pbandwidth || pwidth || pheight);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_set_audio_only(player_h player, bool audio_only)
{
int ret = PLAYER_ERROR_NONE;
- PLAYER_INSTANCE_CHECK(player);
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_SET_AUDIO_ONLY;
char *ret_buf = NULL;
player_state_e state = PLAYER_STATE_NONE;
+ PLAYER_INSTANCE_CHECK(player);
+
LOGD("ENTER audio_only: %d", audio_only);
/* check player state */
return PLAYER_ERROR_INVALID_STATE;
}
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- if (EVAS_HANDLE(pc)) {
- pc->is_audio_only = (gboolean)audio_only;
- return PLAYER_ERROR_NONE;
- }
-#endif
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);
- return ret;
+ return ret;
}
int player_is_audio_only(player_h player, bool *paudio_only)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(paudio_only);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_IS_AUDIO_ONLY;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int audio_only = 0;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(paudio_only);
+
LOGD("ENTER");
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- if (EVAS_HANDLE(pc)) {
- *paudio_only = (bool)pc->is_audio_only;
- return PLAYER_ERROR_NONE;
- }
-#endif
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;
}
+
g_free(ret_buf);
LOGD("LEAVE 0x%X", ret);
+
return ret;
}
-int player_set_streaming_buffering_time(player_h player, int buffer_ms, int rebuffer_ms)
+int player_set_streaming_buffering_time(player_h player, int prebuffer_ms, int rebuffer_ms)
{
+#define MIN_BUFFER_TIME -1
int ret = PLAYER_ERROR_NONE;
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(buffer_ms >= 0 && rebuffer_ms >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
muse_player_api_e api = MUSE_PLAYER_API_SET_STREAMING_BUFFERING_TIME;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_CHECK_CONDITION(prebuffer_ms >= MIN_BUFFER_TIME && rebuffer_ms >= MIN_BUFFER_TIME,
+ PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret,
- MUSE_TYPE_INT, "buffer_ms", buffer_ms,
+ MUSE_TYPE_INT, "prebuffer_ms", prebuffer_ms,
MUSE_TYPE_INT, "rebuffer_ms", rebuffer_ms);
g_free(ret_buf);
return ret;
}
-int player_get_streaming_buffering_time(player_h player, int *buffer_ms, int *rebuffer_ms)
+int player_get_streaming_buffering_time(player_h player, int *prebuffer_ms, int *rebuffer_ms)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(buffer_ms || rebuffer_ms);
-
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_GET_STREAMING_BUFFERING_TIME;
- player_cli_s *pc = (player_cli_s *) player;
- int buffering_time = 0, rebuffering_time = 0;
+ player_cli_s *pc = (player_cli_s *)player;
+ int prebuffering_time = 0, rebuffering_time = 0;
char *ret_buf = NULL;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(prebuffer_ms || rebuffer_ms);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
if (ret == PLAYER_ERROR_NONE) {
bool ret_val = true;
ret_val = _player_get_param_value(ret_buf,
- MUSE_TYPE_INT, "buffering_time", (void *)&buffering_time,
- MUSE_TYPE_INT, "rebuffering_time", (void *)&rebuffering_time,
+ MUSE_TYPE_INT, "prebuffer_ms", (void *)&prebuffering_time,
+ MUSE_TYPE_INT, "rebuffer_ms", (void *)&rebuffering_time,
INVALID_MUSE_TYPE_VALUE);
if (ret_val) {
- if (buffer_ms) *buffer_ms = buffering_time;
+ if (prebuffer_ms) *prebuffer_ms = prebuffering_time;
if (rebuffer_ms) *rebuffer_ms = rebuffering_time;
} else {
ret = PLAYER_ERROR_INVALID_OPERATION;
int player_360_is_content_spherical(player_h player, bool *is_spherical)
{
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
-
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(is_spherical);
-
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_360_IS_CONTENT_SPHERICAL;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int val = 0;
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(is_spherical);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_360_set_enabled(player_h player, bool enabled)
{
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
-
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_360_SET_ENABLED;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int val = (int)enabled;
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
+ PLAYER_INSTANCE_CHECK(player);
+
LOGD("ENTER %d", enabled);
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "val", val);
int player_360_is_enabled(player_h player, bool *enabled)
{
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
-
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(enabled);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_360_IS_ENABLED;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int val = 0;
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(enabled);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_360_set_direction_of_view(player_h player, float yaw, float pitch)
{
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
-
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(yaw >= (float)-M_PI && yaw <= (float)M_PI, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- PLAYER_CHECK_CONDITION(pitch >= (float)-M_PI/2 && pitch <= (float)M_PI/2, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_360_SET_DIRECTION_OF_VIEW;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(yaw, (float)-M_PI, (float)M_PI);
+ PLAYER_RANGE_ARG_CHECK(pitch, ((float)-M_PI / 2), ((float)M_PI / 2));
+
LOGD("ENTER %f %f", yaw, pitch);
PLAYER_SEND_MSG(api, pc, ret_buf, ret,
int player_360_get_direction_of_view(player_h player, float *yaw, float *pitch)
{
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
-
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(yaw && pitch);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_360_GET_DIRECTION_OF_VIEW;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
double yaw_val = -1;
double pitch_val = -1;
char *ret_buf = NULL;
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(yaw && pitch);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_360_set_zoom(player_h player, float level)
{
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
-
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(level >= 1.0 && level <= 10.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_360_SET_ZOOM;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(level, 1.0, 10.0);
+
LOGD("ENTER %f", level);
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_DOUBLE, "level", (double)level);
int player_360_get_zoom(player_h player, float *level)
{
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
-
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(level);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_360_GET_ZOOM;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
double zoom = -1;
char *ret_buf = NULL;
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(level);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
LOGD("LEAVE 0x%X", ret);
return ret;
-
}
int player_360_set_field_of_view(player_h player, int horizontal_degrees, int vertical_degrees)
{
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
-
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(horizontal_degrees >= 1 && horizontal_degrees <= 360, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- PLAYER_CHECK_CONDITION(vertical_degrees >= 1 && vertical_degrees <= 180, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_360_SET_FIELD_OF_VIEW;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(horizontal_degrees, 1, 360);
+ PLAYER_RANGE_ARG_CHECK(vertical_degrees, 1, 180);
+
LOGD("ENTER %d %d", horizontal_degrees, vertical_degrees);
PLAYER_SEND_MSG(api, pc, ret_buf, ret,
int player_360_get_field_of_view(player_h player, int *horizontal_degrees, int *vertical_degrees)
{
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
-
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(horizontal_degrees && vertical_degrees);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_360_GET_FIELD_OF_VIEW;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
int h_val = -1;
int v_val = -1;
char *ret_buf = NULL;
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(horizontal_degrees && vertical_degrees);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
int player_360_set_zoom_with_field_of_view(player_h player, float level, int horizontal_degrees, int vertical_degrees)
{
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
- PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
-
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(horizontal_degrees >= 1 && horizontal_degrees <= 360, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- PLAYER_CHECK_CONDITION(vertical_degrees >= 1 && vertical_degrees <= 180, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- PLAYER_CHECK_CONDITION(level >= 1.0 && level <= 10.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_360_SET_ZOOM_WITH_FIELD_OF_VIEW;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_OPENGL);
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_SPHERICAL_VIDEO);
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(horizontal_degrees, 1, 360);
+ PLAYER_RANGE_ARG_CHECK(vertical_degrees, 1, 180);
+ PLAYER_RANGE_ARG_CHECK(level, 1.0, 10.0);
+
LOGD("ENTER %f %d %d", level, horizontal_degrees, vertical_degrees);
PLAYER_SEND_MSG(api, pc, ret_buf, ret,
int player_set_replaygain_enabled(player_h player, bool enabled)
{
- PLAYER_INSTANCE_CHECK(player);
int ret = PLAYER_ERROR_NONE;
muse_player_api_e api = MUSE_PLAYER_API_SET_REPLAYGAIN_ENABLED;
- player_cli_s *pc = (player_cli_s *) player;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int val = (int)enabled;
+ PLAYER_INSTANCE_CHECK(player);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "val", val);
int player_is_replaygain_enabled(player_h player, bool *enabled)
{
+ int ret = PLAYER_ERROR_NONE;
+ muse_player_api_e api = MUSE_PLAYER_API_IS_REPLAYGAIN_ENABLED;
+ player_cli_s *pc = (player_cli_s *)player;
+ char *ret_buf = NULL;
+ int val = -1;
+
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(enabled);
+
+ LOGD("ENTER");
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret);
+ if (ret == PLAYER_ERROR_NONE) {
+ player_msg_get(val, ret_buf);
+ *enabled = (bool)val;
+ }
+
+ g_free(ret_buf);
+ return ret;
+}
+
+int player_audio_pitch_set_enabled(player_h player, bool enabled)
+{
int ret = PLAYER_ERROR_NONE;
- muse_player_api_e api = MUSE_PLAYER_API_IS_REPLAYGAIN_ENABLED;
- player_cli_s *pc = (player_cli_s *) player;
+ muse_player_api_e api = MUSE_PLAYER_API_PITCH_SET_ENABLED;
+ player_cli_s *pc = (player_cli_s *)player;
+ char *ret_buf = NULL;
+ int val = (int)enabled;
+
+ PLAYER_INSTANCE_CHECK(player);
+
+ LOGD("ENTER");
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "val", val);
+ g_free(ret_buf);
+ return ret;
+}
+
+int player_audio_pitch_is_enabled(player_h player, bool *enabled)
+{
+ int ret = PLAYER_ERROR_NONE;
+ muse_player_api_e api = MUSE_PLAYER_API_PITCH_IS_ENABLED;
+ player_cli_s *pc = (player_cli_s *)player;
+ char *ret_buf = NULL;
+ int val = -1;
+
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(enabled);
+
+ LOGD("ENTER");
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret);
+ if (ret == PLAYER_ERROR_NONE) {
+ player_msg_get(val, ret_buf);
+ *enabled = (bool)val;
+ }
+
+ g_free(ret_buf);
+ return ret;
+}
+
+int player_audio_pitch_set_value(player_h player, float value)
+{
+ int ret = PLAYER_ERROR_NONE;
+ muse_player_api_e api = MUSE_PLAYER_API_PITCH_SET_VALUE;
+ player_cli_s *pc = (player_cli_s *)player;
+ char *ret_buf = NULL;
+
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(value, 0.5, 2.0);
+
+ LOGD("ENTER %1.3f", value);
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_DOUBLE, "pitch", (double)value);
+ g_free(ret_buf);
+
+ LOGD("LEAVE 0x%X", ret);
+ return ret;
+}
+
+int player_audio_pitch_get_value(player_h player, float *value)
+{
+ int ret = PLAYER_ERROR_NONE;
+ muse_player_api_e api = MUSE_PLAYER_API_PITCH_GET_VALUE;
+ player_cli_s *pc = (player_cli_s *)player;
+ double pitch = 0.0;
+ char *ret_buf = NULL;
+
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(value);
+
+ LOGD("ENTER");
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret);
+
+ if (ret == PLAYER_ERROR_NONE) {
+ if (player_msg_get_type(pitch, ret_buf, DOUBLE)) {
+ *value = (float)pitch;
+ } else {
+ LOGE("failed to get pitch value");
+ ret = PLAYER_ERROR_INVALID_OPERATION;
+ }
+ }
+
+ g_free(ret_buf);
+
+ LOGD("LEAVE 0x%X", ret);
+ return ret;
+}
+
+int player_audio_offload_foreach_supported_format(player_h player, player_supported_media_format_cb callback, void *user_data)
+{
+ int ret = PLAYER_ERROR_NONE;
+ player_cli_s *pc = (player_cli_s *)player;
+ muse_player_api_e api = MUSE_PLAYER_API_AUDIO_OFFLOAD_GET_SUPPORTED_FORMAT;
+ char *ret_buf = NULL;
+ int format_info[MAX_SUPPORTED_MEDIA_FORMAT] = {0,};
+ int len = 0, idx = 0;
+
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_AUDIO_OFFLOAD);
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(callback);
+
+ LOGD("ENTER");
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret);
+
+ player_msg_get_type(len, ret_buf, INT);
+ player_msg_get_array(format_info, ret_buf);
+
+ LOGD("num of format %d", len);
+ for (idx = 0 ; idx < len ; idx++) {
+ if (!callback(format_info[idx], user_data)) {
+ LOGW("stop foreach callback");
+ break;
+ }
+ }
+
+ LOGD("LEAVE 0x%X", ret);
+ g_free(ret_buf);
+ return ret;
+}
+
+int player_audio_offload_set_enabled(player_h player, bool enabled)
+{
+ int ret = PLAYER_ERROR_NONE;
+ muse_player_api_e api = MUSE_PLAYER_API_AUDIO_OFFLOAD_SET_ENABLED;
+ player_cli_s *pc = (player_cli_s *)player;
+ char *ret_buf = NULL;
+ int val = (int)enabled;
+
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_AUDIO_OFFLOAD);
+ PLAYER_INSTANCE_CHECK(player);
+
+ LOGD("ENTER");
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "val", val);
+ g_free(ret_buf);
+ return ret;
+}
+
+int player_audio_offload_is_enabled(player_h player, bool *enabled)
+{
+ int ret = PLAYER_ERROR_NONE;
+ muse_player_api_e api = MUSE_PLAYER_API_AUDIO_OFFLOAD_IS_ENABLED;
+ player_cli_s *pc = (player_cli_s *)player;
+ char *ret_buf = NULL;
+ int val = -1;
+
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_AUDIO_OFFLOAD);
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(enabled);
+
+ LOGD("ENTER");
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret);
+ if (ret == PLAYER_ERROR_NONE) {
+ player_msg_get(val, ret_buf);
+ *enabled = (bool)val;
+ }
+
+ g_free(ret_buf);
+ return ret;
+}
+
+int player_audio_offload_is_activated(player_h player, bool *activated)
+{
+ int ret = PLAYER_ERROR_NONE;
+ muse_player_api_e api = MUSE_PLAYER_API_AUDIO_OFFLOAD_IS_ACTIVATED;
+ player_cli_s *pc = (player_cli_s *)player;
char *ret_buf = NULL;
int val = -1;
+ PLAYER_FEATURE_CHECK(PLAYER_FEATURE_AUDIO_OFFLOAD);
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(activated);
+
LOGD("ENTER");
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
if (ret == PLAYER_ERROR_NONE) {
player_msg_get(val, ret_buf);
- *enabled = (bool) val;
+ *activated = (bool)val;
}
g_free(ret_buf);
return ret;
}
+int player_set_audio_codec_type(player_h player, player_codec_type_e codec_type)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(codec_type, PLAYER_CODEC_TYPE_HW, PLAYER_CODEC_TYPE_SW);
+
+ int ret = PLAYER_ERROR_NONE;
+ muse_player_api_e api = MUSE_PLAYER_API_SET_CODEC_TYPE;
+ player_cli_s *pc = (player_cli_s *)player;
+ char *ret_buf = NULL;
+
+ LOGD("ENTER codec: %d", codec_type);
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+ MUSE_TYPE_INT, "stream_type", PLAYER_STREAM_TYPE_AUDIO,
+ MUSE_TYPE_INT, "codec_type", codec_type);
+
+ g_free(ret_buf);
+ LOGD("LEAVE");
+ return ret;
+
+}
+
+int player_get_audio_codec_type(player_h player, player_codec_type_e *codec_type)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(codec_type);
+
+ int ret = PLAYER_ERROR_NONE;
+ muse_player_api_e api = MUSE_PLAYER_API_GET_CODEC_TYPE;
+ player_cli_s *pc = (player_cli_s *)player;
+ char *ret_buf = NULL;
+ int type = 0;
+
+ LOGD("ENTER");
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret,
+ MUSE_TYPE_INT, "stream_type", PLAYER_STREAM_TYPE_AUDIO);
+ if (ret == PLAYER_ERROR_NONE) {
+ player_msg_get(type, ret_buf);
+ *codec_type = type;
+ }
+
+ g_free(ret_buf);
+ LOGD("LEAVE codec: %d", *codec_type);
+ return ret;
+}