muse_core_msg_json_factory_free(__sndMsg__); \
} while (0)
+/**
+ * @brief Create and send message. Wait for server result.
+ * @remarks Does NOT guarantee thread safe.
+ * @param[in] api The enum of module API.
+ * @param[in] player The handle of capi media player.
+ * @param[out] retbuf The buffer of return message. Must be char pointer.Must free after use.
+ * @param[out] ret The return value from server.
+ * @param[in] type The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
+ * @param[in] param# the name of param is key, must be local variable. never be pointer.
+ */
+#define player_msg_send7(api, player, retbuf, ret, type1, param1, type2, param2, type3, param3, type4, param4, type5, param5, type6, param6, type7, param7) \
+ do { \
+ char *__sndMsg__; \
+ int __len__; \
+ int __fd__; \
+ int __timeout__ = client_get_api_timeout(player, api); \
+ type1 __value1__ = (type1)param1; \
+ type2 __value2__ = (type2)param2; \
+ type3 __value3__ = (type3)param3; \
+ type4 __value4__ = (type4)param4; \
+ type5 __value5__ = (type5)param5; \
+ type6 __value6__ = (type6)param6; \
+ type7 __value7__ = (type7)param7; \
+ if (CALLBACK_INFO(player)) __fd__ = MSG_FD(player); \
+ else {ret = PLAYER_ERROR_INVALID_STATE; break; } \
+ __sndMsg__ = muse_core_msg_json_factory_new(api, \
+ MUSE_TYPE_##type1, #param1, __value1__, \
+ MUSE_TYPE_##type2, #param2, __value2__, \
+ MUSE_TYPE_##type3, #param3, __value3__, \
+ MUSE_TYPE_##type4, #param4, __value4__, \
+ MUSE_TYPE_##type5, #param5, __value5__, \
+ MUSE_TYPE_##type6, #param6, __value6__, \
+ MUSE_TYPE_##type7, #param7, __value7__, \
+ 0); \
+ __len__ = muse_core_ipc_send_msg(__fd__, __sndMsg__); \
+ if (__len__ <= 0) { \
+ LOGE("sending message failed"); \
+ ret = PLAYER_ERROR_INVALID_OPERATION; \
+ } else \
+ ret = client_wait_for_cb_return(api, CALLBACK_INFO(player), &retbuf, __timeout__); \
+ muse_core_msg_json_factory_free(__sndMsg__); \
+ } while (0)
+
/**
* @brief Create and send message. Wait for server result.
* @remarks Does NOT guarantee thread safe.
}
#ifdef TIZEN_FEATURE_EVAS_RENDERER
else if (conv_type == PLAYER_PRIVATE_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
+ if (!CALLBACK_INFO(pc)) {
+ LOGE("there is no cb info in player handle");
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+
/* evas object surface */
LOGI("evas surface type");
wl_win.type = conv_type;
if (EVAS_HANDLE(pc)) {
LOGW("evas client already exists");
- if (CALLBACK_INFO(pc))
- player_unset_media_packet_video_frame_decoded_cb(player);
+ player_unset_media_packet_video_frame_decoded_cb(player);
+
if (mm_evas_renderer_destroy(&EVAS_HANDLE(pc)) != MM_ERROR_NONE)
LOGW("fail to unset evas client");
__player_unset_retrieve_buffer_cb(player);
- g_free(pc->cb_info->evas_info);
+
/* need to set display information again to new handle */
EVAS_INFO(pc)->update_needed = TRUE;
}
#endif
else
return PLAYER_ERROR_INVALID_PARAMETER;
- } else
+ } else {
return PLAYER_ERROR_INVALID_PARAMETER;
+ }
} else { /* PLAYER_DISPLAY_TYPE_NONE */
LOGI("Wayland surface type is NONE");
wl_win.type = conv_type;
muse_player_api_e api = MUSE_PLAYER_API_SET_MEDIA_STREAM_INFO;
char *ret_buf = NULL;
media_format_mimetype_e mimetype;
- int width;
- int height;
- int avg_bps;
- int max_bps;
- int channel;
- int samplerate;
- int bit;
+ int width = 0;
+ int height = 0;
+ int avg_bps = 0;
+ int max_bps = 0;
+ int channel = 0;
+ int samplerate = 0;
+ int bit = 0;
+ int frame_rate = 0;
LOGD("ENTER");
media_format_ref(format);
if (type == PLAYER_STREAM_TYPE_VIDEO) {
- media_format_get_video_info(format, &mimetype, &width, &height, &avg_bps, &max_bps);
- player_msg_send6(api, pc, ret_buf, ret, INT, type, INT, mimetype, INT, width, INT, height, INT, avg_bps, INT, max_bps);
+ if (media_format_get_video_info(format, &mimetype, &width, &height, &avg_bps, &max_bps) != MEDIA_FORMAT_ERROR_NONE ||
+ media_format_get_video_frame_rate(format, &frame_rate) != MEDIA_FORMAT_ERROR_NONE) {
+ LOGE("failed to get video info from format.");
+ return PLAYER_ERROR_INVALID_PARAMETER;
+ }
+
+ player_msg_send7(api, pc, ret_buf, ret, INT, type, INT, mimetype, INT, width, INT, height, INT, avg_bps, INT, max_bps, INT, frame_rate);
} else if (type == PLAYER_STREAM_TYPE_AUDIO) {
- media_format_get_audio_info(format, &mimetype, &channel, &samplerate, &bit, &avg_bps);
+ if (media_format_get_audio_info(format, &mimetype, &channel, &samplerate, &bit, &avg_bps) != MEDIA_FORMAT_ERROR_NONE) {
+ LOGE("failed to get audio info from format.");
+ return PLAYER_ERROR_INVALID_PARAMETER;
+ }
player_msg_send6(api, pc, ret_buf, ret, INT, type, INT, mimetype, INT, channel, INT, samplerate, INT, avg_bps, INT, bit);
}
media_format_unref(format);