int ret = CAMERA_ERROR_NONE;
Ecore_Wl_Window *window = NULL;
struct wl_display *display = NULL;
+ struct wl_display *display_wrapper = NULL;
struct wl_surface *surface = NULL;
struct wl_registry *registry = NULL;
+ struct wl_event_queue *queue = NULL;
struct tizen_surface *tz_surface = NULL;
struct tizen_resource *tz_resource = NULL;
goto _DONE;
}
- registry = wl_display_get_registry(display);
+ display_wrapper = wl_proxy_create_wrapper(display);
+ if (!display_wrapper) {
+ LOGE("failed to create wl display wrapper");
+ ret = CAMERA_ERROR_INVALID_OPERATION;
+ goto _DONE;
+ }
+
+ queue = wl_display_create_queue(display);
+ if (!queue) {
+ LOGE("failed to create wl display queue");
+ ret = CAMERA_ERROR_INVALID_OPERATION;
+ goto _DONE;
+ }
+
+ wl_proxy_set_queue((struct wl_proxy *)display_wrapper, queue);
+
+ registry = wl_display_get_registry(display_wrapper);
if (!registry) {
LOGE("failed to get wayland registry");
ret = CAMERA_ERROR_INVALID_OPERATION;
wl_registry_add_listener(registry, &_camera_wl_registry_listener, &tz_surface);
- wl_display_dispatch(display);
- wl_display_roundtrip(display);
+ wl_display_dispatch_queue(display, queue);
+ wl_display_roundtrip_queue(display, queue);
if (!tz_surface) {
LOGE("failed to get tizen surface");
tizen_resource_add_listener(tz_resource, &_camera_tz_resource_listener, &wl_info->parent_id);
- wl_display_roundtrip(display);
+ wl_display_roundtrip_queue(display, queue);
if (wl_info->parent_id > 0) {
int rotation = 0;
registry = NULL;
}
+ if (queue) {
+ wl_event_queue_destroy(queue);
+ queue = NULL;
+ }
+
+ if (display_wrapper) {
+ wl_proxy_wrapper_destroy(display_wrapper);
+ display_wrapper = NULL;
+ }
+
return ret;
}
/*LOGD("send msg %s", msg);*/
- if (cb_info->is_server_connected)
+ if (cb_info->is_server_connected) {
+ g_mutex_lock(&cb_info->fd_lock);
send_ret = muse_core_ipc_send_msg(cb_info->fd, msg);
+ g_mutex_unlock(&cb_info->fd_lock);
+ }
if (send_ret < 0) {
LOGE("msg send failed");
/*LOGD("send msg %s", msg);*/
- if (cb_info->is_server_connected)
+ if (cb_info->is_server_connected) {
+ g_mutex_lock(&cb_info->fd_lock);
send_ret = muse_core_ipc_send_msg(cb_info->fd, msg);
+ g_mutex_unlock(&cb_info->fd_lock);
+ }
if (send_ret < 0) {
LOGE("msg send failed");
g_cond_init(&cb_info->api_cond[i]);
}
+ g_mutex_init(&cb_info->fd_lock);
g_mutex_init(&cb_info->idle_event_mutex);
g_cond_init(&cb_info->idle_event_cond);
g_mutex_init(&cb_info->mp_data_mutex);
__destroy_msg_handler_thread(&cb_info->preview_cb_info);
__destroy_msg_handler_thread(&cb_info->capture_cb_info);
+ g_mutex_clear(&cb_info->fd_lock);
g_mutex_clear(&cb_info->idle_event_mutex);
g_cond_clear(&cb_info->idle_event_cond);
g_mutex_clear(&cb_info->mp_data_mutex);
__destroy_msg_handler_thread(&cb_info->preview_cb_info);
__destroy_msg_handler_thread(&cb_info->capture_cb_info);
+ g_mutex_clear(&cb_info->fd_lock);
g_mutex_clear(&cb_info->idle_event_mutex);
g_cond_clear(&cb_info->idle_event_cond);
g_mutex_clear(&cb_info->mp_data_mutex);
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
+
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
+ pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
value = (count << 16) | interval;
CAMERA_MSG_PARAM_SET(param, INT, value);
return CAMERA_ERROR_OUT_OF_MEMORY;
}
- if (pc->cb_info->is_server_connected)
+ if (pc->cb_info->is_server_connected) {
+ g_mutex_lock(&pc->cb_info->fd_lock);
send_ret = muse_core_ipc_send_msg(pc->cb_info->fd, msg);
+ g_mutex_unlock(&pc->cb_info->fd_lock);
+ }
if (send_ret < 0) {
LOGE("message send failed");
return CAMERA_ERROR_OUT_OF_MEMORY;
}
- if (pc->cb_info->is_server_connected)
+ if (pc->cb_info->is_server_connected) {
+ g_mutex_lock(&pc->cb_info->fd_lock);
send_ret = muse_core_ipc_send_msg(pc->cb_info->fd, msg);
+ g_mutex_unlock(&pc->cb_info->fd_lock);
+ }
if (send_ret < 0) {
LOGE("message send failed");
return CAMERA_ERROR_OUT_OF_MEMORY;
}
- if (pc->cb_info->is_server_connected)
+ if (pc->cb_info->is_server_connected) {
+ g_mutex_lock(&pc->cb_info->fd_lock);
send_ret = muse_core_ipc_send_msg(pc->cb_info->fd, msg);
+ g_mutex_unlock(&pc->cb_info->fd_lock);
+ }
if (send_ret < 0) {
LOGE("message send failed");