From bc696e5f922886553bdcbf5240ffb0315346841c Mon Sep 17 00:00:00 2001 From: YoungHun Kim Date: Mon, 7 Aug 2017 17:32:37 +0900 Subject: [PATCH] Update camera by the splited muse library Change-Id: I0e8f287af92be7d268ceccfa66b888cda90edd47 --- CMakeLists.txt | 4 +- packaging/capi-media-camera.spec | 4 +- src/camera.c | 81 ++++++++++++++++++++-------------------- 3 files changed, 44 insertions(+), 45 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 39523d9..1f068d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,9 +10,9 @@ SET(submodule "camera") # for package file IF(TIZEN_FEATURE_EVAS_RENDERER) -SET(dependents "glib-2.0 gio-2.0 libtbm dlog mm-common capi-base-common capi-media-tool ecore elementary mmsvc-camera tizen-extension-client mm-evas-renderer") +SET(dependents "glib-2.0 gio-2.0 libtbm dlog mm-common capi-base-common capi-media-tool ecore elementary mmsvc-camera tizen-extension-client mm-evas-renderer muse-client") ELSE(TIZEN_FEATURE_EVAS_RENDERER) -SET(dependents "glib-2.0 gio-2.0 libtbm dlog mm-common capi-base-common capi-media-tool ecore elementary mmsvc-camera tizen-extension-client") +SET(dependents "glib-2.0 gio-2.0 libtbm dlog mm-common capi-base-common capi-media-tool ecore elementary mmsvc-camera tizen-extension-client muse-client") ENDIF(TIZEN_FEATURE_EVAS_RENDERER) SET(pc_dependents "capi-base-common capi-media-tool libtbm evas ecore elementary") SET(fw_name "${project_prefix}-${service}-${submodule}") diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 8df44b2..41eb4c1 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -1,6 +1,6 @@ Name: capi-media-camera Summary: A Camera API -Version: 0.3.3 +Version: 0.3.4 Release: 0 Group: Multimedia/API License: Apache-2.0 @@ -9,7 +9,7 @@ BuildRequires: cmake BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gio-2.0) -BuildRequires: pkgconfig(mused) +BuildRequires: pkgconfig(muse-client) BuildRequires: pkgconfig(mm-common) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(mmsvc-camera) diff --git a/src/camera.c b/src/camera.c index 5512643..cbd973c 100644 --- a/src/camera.c +++ b/src/camera.c @@ -23,10 +23,9 @@ #include #include #include -#include -#include #include #include +#include #include #include #include @@ -450,7 +449,7 @@ static void _camera_msg_send(int api, camera_cb_info_s *cb_info, return; } - msg = muse_core_msg_json_factory_new(api, NULL); + msg = muse_core_msg_new(api, NULL); if (!msg) { LOGE("msg failed: api %d", api); @@ -466,7 +465,7 @@ static void _camera_msg_send(int api, camera_cb_info_s *cb_info, __camera_update_api_waiting(cb_info, api, 1); g_mutex_lock(&cb_info->fd_lock); - send_ret = muse_core_ipc_send_msg(cb_info->fd, msg); + send_ret = muse_core_msg_send(cb_info->fd, msg); g_mutex_unlock(&cb_info->fd_lock); } @@ -481,7 +480,7 @@ static void _camera_msg_send(int api, camera_cb_info_s *cb_info, __camera_update_api_waiting(cb_info, api, -1); - muse_core_msg_json_factory_free(msg); + muse_core_msg_free(msg); return; } @@ -506,12 +505,12 @@ static void _camera_msg_send_param1(int api, camera_cb_info_s *cb_info, switch (param->type) { case MUSE_TYPE_INT: - msg = muse_core_msg_json_factory_new(api, + msg = muse_core_msg_new(api, param->type, param->name, param->value.value_INT, NULL); break; case MUSE_TYPE_STRING: - msg = muse_core_msg_json_factory_new(api, + msg = muse_core_msg_new(api, param->type, param->name, param->value.value_STRING, NULL); break; @@ -535,7 +534,7 @@ static void _camera_msg_send_param1(int api, camera_cb_info_s *cb_info, __camera_update_api_waiting(cb_info, api, 1); g_mutex_lock(&cb_info->fd_lock); - send_ret = muse_core_ipc_send_msg(cb_info->fd, msg); + send_ret = muse_core_msg_send(cb_info->fd, msg); g_mutex_unlock(&cb_info->fd_lock); } @@ -551,7 +550,7 @@ static void _camera_msg_send_param1(int api, camera_cb_info_s *cb_info, __camera_update_api_waiting(cb_info, api, -1); - muse_core_msg_json_factory_free(msg); + muse_core_msg_free(msg); return; } @@ -1938,30 +1937,30 @@ static void __camera_process_msg(camera_cb_info_s *cb_info, char *msg) switch (get_type) { case MUSE_CAMERA_GET_TYPE_INT: - muse_core_msg_json_deserialize("get_value", msg, NULL, &cb_info->get_int[get_index], NULL, MUSE_TYPE_INT); + muse_core_msg_deserialize("get_value", msg, NULL, NULL, MUSE_TYPE_INT, &cb_info->get_int[get_index]); break; case MUSE_CAMERA_GET_TYPE_INT_PAIR: - muse_core_msg_json_deserialize("get_value0", msg, NULL, &cb_info->get_int_pair[get_index][0], NULL, MUSE_TYPE_INT); - muse_core_msg_json_deserialize("get_value1", msg, NULL, &cb_info->get_int_pair[get_index][1], NULL, MUSE_TYPE_INT); + muse_core_msg_deserialize("get_value0", msg, NULL, NULL, MUSE_TYPE_INT, &cb_info->get_int_pair[get_index][0]); + muse_core_msg_deserialize("get_value1", msg, NULL, NULL, MUSE_TYPE_INT, &cb_info->get_int_pair[get_index][1]); break; case MUSE_CAMERA_GET_TYPE_ARRAY: if (api == MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA) { - muse_core_msg_json_deserialize("get_value", - msg, NULL, cb_info->get_display_roi_area, NULL, MUSE_TYPE_ARRAY); + muse_core_msg_deserialize("get_value", + msg, NULL, NULL, MUSE_TYPE_ARRAY, cb_info->get_display_roi_area); LOGD("get display roi %d,%d,%dx%d", cb_info->get_display_roi_area[0], cb_info->get_display_roi_area[1], cb_info->get_display_roi_area[2], cb_info->get_display_roi_area[3]); } else { - muse_core_msg_json_deserialize("get_value", - msg, NULL, cb_info->get_geotag, NULL, MUSE_TYPE_ARRAY); + muse_core_msg_deserialize("get_value", + msg, NULL, NULL, MUSE_TYPE_ARRAY, cb_info->get_geotag); LOGD("get geotag %lf, %lf, %lf", cb_info->get_geotag[0], cb_info->get_geotag[1], cb_info->get_geotag[2]); } break; case MUSE_CAMERA_GET_TYPE_STRING: - muse_core_msg_json_deserialize("get_value", msg, NULL, cb_info->get_string[get_index], NULL, MUSE_TYPE_STRING); + muse_core_msg_deserialize("get_value", msg, NULL, NULL, MUSE_TYPE_STRING, cb_info->get_string[get_index]); break; default: LOGW("unknown type %d", get_type); @@ -2020,7 +2019,7 @@ static void *_camera_msg_recv_func(gpointer data) recv_msg = cb_info->recv_msg; while (g_atomic_int_get(&cb_info->msg_recv_running)) { - recv_length = muse_core_ipc_recv_msg(cb_info->fd, recv_msg); + recv_length = muse_core_msg_recv(cb_info->fd, recv_msg); if (recv_length <= 0) { cb_info->is_server_connected = FALSE; LOGE("receive msg failed - server disconnected"); @@ -2098,7 +2097,7 @@ static void *_camera_msg_recv_func(gpointer data) if (!cb_info->is_server_connected) { /* send error msg for server disconnection */ - char *error_msg = muse_core_msg_json_factory_new(MUSE_CAMERA_CB_EVENT, + char *error_msg = muse_core_msg_new(MUSE_CAMERA_CB_EVENT, MUSE_TYPE_INT, "error", CAMERA_ERROR_SERVICE_DISCONNECTED, MUSE_TYPE_INT, "current_state", CAMERA_STATE_NONE, NULL); @@ -2114,7 +2113,7 @@ static void *_camera_msg_recv_func(gpointer data) MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, error_msg); - muse_core_msg_json_factory_free(error_msg); + muse_core_msg_free(error_msg); error_msg = NULL; LOGE("add error msg for service disconnection done"); @@ -2457,13 +2456,13 @@ int _camera_independent_request(int api, int device_type, const char *key, int * return CAMERA_ERROR_INVALID_PARAMETER; } - sock_fd = muse_core_client_new(); + sock_fd = muse_client_new(); if (sock_fd < 0) { - LOGE("muse_core_client_new failed"); + LOGE("muse_client_new failed"); return CAMERA_ERROR_INVALID_OPERATION; } - msg = muse_core_msg_json_factory_new(api, + msg = muse_core_msg_new(api, MUSE_TYPE_INT, "module", MUSE_CAMERA, MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type, 0); @@ -2473,9 +2472,9 @@ int _camera_independent_request(int api, int device_type, const char *key, int * goto _REQUEST_EXIT; } - ret = muse_core_ipc_send_msg(sock_fd, msg); + ret = muse_core_msg_send(sock_fd, msg); - muse_core_msg_json_factory_free(msg); + muse_core_msg_free(msg); msg = NULL; if (ret < 0) { @@ -2484,7 +2483,7 @@ int _camera_independent_request(int api, int device_type, const char *key, int * goto _REQUEST_EXIT; } - ret = muse_core_ipc_recv_msg(sock_fd, recv_msg); + ret = muse_core_msg_recv(sock_fd, recv_msg); if (ret <= 0) { LOGE("recv msg failed %d", errno); ret = CAMERA_ERROR_INVALID_OPERATION; @@ -2498,7 +2497,7 @@ int _camera_independent_request(int api, int device_type, const char *key, int * } if (ret == CAMERA_ERROR_NONE) - muse_core_msg_json_deserialize(key, recv_msg, NULL, value, NULL, MUSE_TYPE_ANY); + muse_core_msg_deserialize(key, recv_msg, NULL, NULL, MUSE_TYPE_ANY, value); LOGD("api %d - value %d", api, *value); @@ -2531,16 +2530,16 @@ int camera_create(camera_device_e device, camera_h *camera) return CAMERA_ERROR_INVALID_PARAMETER; } - sock_fd = muse_core_client_new(); + sock_fd = muse_client_new(); if (sock_fd < 0) { - LOGE("muse_core_client_new failed - returned fd %d", sock_fd); + LOGE("muse_client_new failed - returned fd %d", sock_fd); ret = CAMERA_ERROR_INVALID_OPERATION; goto ErrorExit; } pid = getpid(); - send_msg = muse_core_msg_json_factory_new(api, + send_msg = muse_core_msg_new(api, MUSE_TYPE_INT, "module", muse_module, MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type, MUSE_TYPE_INT, "pid", pid, @@ -2552,9 +2551,9 @@ int camera_create(camera_device_e device, camera_h *camera) goto ErrorExit; } - send_ret = muse_core_ipc_send_msg(sock_fd, send_msg); + send_ret = muse_core_msg_send(sock_fd, send_msg); - muse_core_msg_json_factory_free(send_msg); + muse_core_msg_free(send_msg); send_msg = NULL; if (send_ret < 0) { @@ -3227,7 +3226,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ length = sizeof(camera_wl_info_s) / sizeof(int) + \ (sizeof(camera_wl_info_s) % sizeof(int) ? 1 : 0); - msg = muse_core_msg_json_factory_new(api, + msg = muse_core_msg_new(api, MUSE_TYPE_INT, "type", type, MUSE_TYPE_ARRAY, "wl_info", length, (int *)&pc->wl_info, NULL); @@ -3240,7 +3239,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ __camera_update_api_waiting(pc->cb_info, api, 1); g_mutex_lock(&pc->cb_info->fd_lock); - send_ret = muse_core_ipc_send_msg(pc->cb_info->fd, msg); + send_ret = muse_core_msg_send(pc->cb_info->fd, msg); g_mutex_unlock(&pc->cb_info->fd_lock); } @@ -3253,7 +3252,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ __camera_update_api_waiting(pc->cb_info, api, -1); - muse_core_msg_json_factory_free(msg); + muse_core_msg_free(msg); LOGD("wayland parent id : %d, window %d,%d,%dx%d", pc->wl_info.parent_id, pc->wl_info.window_x, pc->wl_info.window_y, @@ -4987,7 +4986,7 @@ int camera_attr_set_geotag(camera_h camera, double latitude, double longitude, d length = sizeof(set_geotag) / sizeof(int) + \ (sizeof(set_geotag) % sizeof(int) ? 1 : 0); - msg = muse_core_msg_json_factory_new(api, + msg = muse_core_msg_new(api, MUSE_TYPE_ARRAY, "set_geotag", length, (int *)set_geotag, NULL); if (!msg) { @@ -4999,7 +4998,7 @@ int camera_attr_set_geotag(camera_h camera, double latitude, double longitude, d __camera_update_api_waiting(pc->cb_info, api, 1); g_mutex_lock(&pc->cb_info->fd_lock); - send_ret = muse_core_ipc_send_msg(pc->cb_info->fd, msg); + send_ret = muse_core_msg_send(pc->cb_info->fd, msg); g_mutex_unlock(&pc->cb_info->fd_lock); } @@ -5012,7 +5011,7 @@ int camera_attr_set_geotag(camera_h camera, double latitude, double longitude, d __camera_update_api_waiting(pc->cb_info, api, -1); - muse_core_msg_json_factory_free(msg); + muse_core_msg_free(msg); LOGD("ret : 0x%x", ret); @@ -6573,7 +6572,7 @@ int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, i length = sizeof(set_display_roi_area) / sizeof(int) + \ (sizeof(set_display_roi_area) % sizeof(int) ? 1 : 0); - msg = muse_core_msg_json_factory_new(api, + msg = muse_core_msg_new(api, MUSE_TYPE_ARRAY, "set_display_roi_area", length, (int *)set_display_roi_area, NULL); if (!msg) { @@ -6585,7 +6584,7 @@ int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, i __camera_update_api_waiting(pc->cb_info, api, 1); g_mutex_lock(&pc->cb_info->fd_lock); - send_ret = muse_core_ipc_send_msg(pc->cb_info->fd, msg); + send_ret = muse_core_msg_send(pc->cb_info->fd, msg); g_mutex_unlock(&pc->cb_info->fd_lock); } @@ -6598,7 +6597,7 @@ int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, i __camera_update_api_waiting(pc->cb_info, api, -1); - muse_core_msg_json_factory_free(msg); + muse_core_msg_free(msg); LOGD("ret : 0x%x", ret); -- 2.7.4