From 3fc6c01afb1be4a218411764da80c48b6930c4a2 Mon Sep 17 00:00:00 2001 From: YoungHun Kim Date: Mon, 7 Aug 2017 17:44:00 +0900 Subject: [PATCH] Update recorder by the splited muse library Change-Id: I5f29be19533e7becb9751a41e4866cd182bb1b45 --- CMakeLists.txt | 2 +- include/recorder_private.h | 1 + packaging/capi-media-recorder.spec | 4 +- src/recorder.c | 75 +++++++++++++++++++------------------- 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 746e552..e6fe52a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ SET(service "media") SET(submodule "recorder") # for package file -SET(dependents "glib-2.0 gio-2.0 dlog capi-media-camera capi-media-audio-io mmsvc-recorder storage mused capi-media-sound-manager libtzplatform-config") +SET(dependents "glib-2.0 gio-2.0 dlog capi-media-camera capi-media-audio-io mmsvc-recorder storage muse-client capi-media-sound-manager libtzplatform-config") SET(pc_dependents "capi-base-common capi-media-camera capi-media-audio-io capi-media-sound-manager") SET(fw_name "${project_prefix}-${service}-${submodule}") diff --git a/include/recorder_private.h b/include/recorder_private.h index b69f691..9955a9a 100644 --- a/include/recorder_private.h +++ b/include/recorder_private.h @@ -21,6 +21,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/packaging/capi-media-recorder.spec b/packaging/capi-media-recorder.spec index 4671832..1565651 100644 --- a/packaging/capi-media-recorder.spec +++ b/packaging/capi-media-recorder.spec @@ -1,6 +1,6 @@ Name: capi-media-recorder Summary: A Recorder API -Version: 0.3.3 +Version: 0.3.4 Release: 0 Group: Multimedia/API License: Apache-2.0 @@ -14,7 +14,7 @@ BuildRequires: pkgconfig(capi-media-camera) BuildRequires: pkgconfig(mmsvc-camera) BuildRequires: pkgconfig(mmsvc-recorder) BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(mused) +BuildRequires: pkgconfig(muse-client) BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(appcore-efl) diff --git a/src/recorder.c b/src/recorder.c index 38f833f..d08ab8d 100644 --- a/src/recorder.c +++ b/src/recorder.c @@ -25,10 +25,9 @@ #include #include #include -#include -#include +#include +#include #include -#include #include #include #include @@ -298,13 +297,13 @@ static void _recorder_client_user_callback(recorder_cb_info_s *cb_info, char *re _recorder_release_imported_bo(&bo); /* return buffer */ - send_msg = muse_core_msg_json_factory_new(MUSE_RECORDER_API_RETURN_BUFFER, + send_msg = muse_core_msg_new(MUSE_RECORDER_API_RETURN_BUFFER, MUSE_TYPE_INT, "tbm_key", tbm_key, NULL); - if (muse_core_ipc_send_msg(cb_info->fd, send_msg) <= 0) + if (muse_core_msg_send(cb_info->fd, send_msg) <= 0) LOGE("sending message failed"); - muse_core_msg_json_factory_free(send_msg); + muse_core_msg_free(send_msg); break; } case MUSE_RECORDER_EVENT_TYPE_MUXED_STREAM: @@ -338,13 +337,13 @@ static void _recorder_client_user_callback(recorder_cb_info_s *cb_info, char *re _recorder_release_imported_bo(&bo); /* return buffer */ - send_msg = muse_core_msg_json_factory_new(MUSE_RECORDER_API_RETURN_BUFFER, + send_msg = muse_core_msg_new(MUSE_RECORDER_API_RETURN_BUFFER, MUSE_TYPE_INT, "tbm_key", tbm_key, NULL); if (send_msg) { - if (muse_core_ipc_send_msg(cb_info->fd, send_msg) <= 0) + if (muse_core_msg_send(cb_info->fd, send_msg) <= 0) LOGE("sending message failed"); - muse_core_msg_json_factory_free(send_msg); + muse_core_msg_free(send_msg); send_msg = NULL; } else { LOGE("failed to create send msg for key %d", tbm_key); @@ -958,7 +957,7 @@ static void *_recorder_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"); @@ -1037,7 +1036,7 @@ static void *_recorder_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_RECORDER_CB_EVENT, + char *error_msg = muse_core_msg_new(MUSE_RECORDER_CB_EVENT, MUSE_TYPE_INT, "error", RECORDER_ERROR_SERVICE_DISCONNECTED, MUSE_TYPE_INT, "current_state", RECORDER_STATE_NONE, NULL); @@ -1055,7 +1054,7 @@ static void *_recorder_msg_recv_func(gpointer data) MUSE_RECORDER_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"); @@ -1302,7 +1301,7 @@ static int _recorder_msg_send(int api, recorder_cb_info_s *cb_info, int *ret, in return RECORDER_ERROR_INVALID_PARAMETER; } - msg = muse_core_msg_json_factory_new(api, NULL); + msg = muse_core_msg_new(api, NULL); if (!msg) { LOGE("msg creation failed: api %d", api); return RECORDER_ERROR_OUT_OF_MEMORY; @@ -1312,7 +1311,7 @@ static int _recorder_msg_send(int api, recorder_cb_info_s *cb_info, int *ret, in if (cb_info->is_server_connected) { __recorder_update_api_waiting(cb_info, api, 1); - send_ret = muse_core_ipc_send_msg(cb_info->fd, msg); + send_ret = muse_core_msg_send(cb_info->fd, msg); } if (send_ret < 0) { @@ -1324,7 +1323,7 @@ static int _recorder_msg_send(int api, recorder_cb_info_s *cb_info, int *ret, in __recorder_update_api_waiting(cb_info, api, -1); - muse_core_msg_json_factory_free(msg); + muse_core_msg_free(msg); return RECORDER_ERROR_NONE; } @@ -1344,13 +1343,13 @@ static int _recorder_msg_send_param1(int api, recorder_cb_info_s *cb_info, int * switch (param->type) { case MUSE_TYPE_INT: - msg = muse_core_msg_json_factory_new(api, param->type, param->name, param->value.value_INT, NULL); + msg = muse_core_msg_new(api, param->type, param->name, param->value.value_INT, NULL); break; case MUSE_TYPE_DOUBLE: - msg = muse_core_msg_json_factory_new(api, param->type, param->name, param->value.value_DOUBLE, NULL); + msg = muse_core_msg_new(api, param->type, param->name, param->value.value_DOUBLE, NULL); break; case MUSE_TYPE_STRING: - msg = muse_core_msg_json_factory_new(api, param->type, param->name, param->value.value_STRING, NULL); + msg = muse_core_msg_new(api, param->type, param->name, param->value.value_STRING, NULL); break; default: LOGE("unknown type %d", param->type); @@ -1368,7 +1367,7 @@ static int _recorder_msg_send_param1(int api, recorder_cb_info_s *cb_info, int * if (cb_info->is_server_connected) { __recorder_update_api_waiting(cb_info, api, 1); - send_ret = muse_core_ipc_send_msg(cb_info->fd, msg); + send_ret = muse_core_msg_send(cb_info->fd, msg); } if (send_ret < 0) { @@ -1380,7 +1379,7 @@ static int _recorder_msg_send_param1(int api, recorder_cb_info_s *cb_info, int * __recorder_update_api_waiting(cb_info, api, -1); - muse_core_msg_json_factory_free(msg); + muse_core_msg_free(msg); return RECORDER_ERROR_NONE; } @@ -1518,15 +1517,15 @@ static int _recorder_create_common(recorder_h *recorder, muse_recorder_type_e ty goto _ERR_RECORDER_EXIT; } - 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 = RECORDER_ERROR_INVALID_OPERATION; goto _ERR_RECORDER_EXIT; } if (type == MUSE_RECORDER_TYPE_AUDIO) { - send_msg = muse_core_msg_json_factory_new(MUSE_RECORDER_API_CREATE, + send_msg = muse_core_msg_new(MUSE_RECORDER_API_CREATE, MUSE_TYPE_INT, "module", MUSE_RECORDER, MUSE_TYPE_INT, PARAM_RECORDER_TYPE, MUSE_RECORDER_TYPE_AUDIO, MUSE_TYPE_INT, "pid", getpid(), @@ -1534,7 +1533,7 @@ static int _recorder_create_common(recorder_h *recorder, muse_recorder_type_e ty } else { pc->camera = camera; camera_handle = (intptr_t)((camera_cli_s *)camera)->remote_handle; - send_msg = muse_core_msg_json_factory_new(MUSE_RECORDER_API_CREATE, + send_msg = muse_core_msg_new(MUSE_RECORDER_API_CREATE, MUSE_TYPE_INT, "module", MUSE_RECORDER, MUSE_TYPE_INT, PARAM_RECORDER_TYPE, MUSE_RECORDER_TYPE_VIDEO, MUSE_TYPE_INT, "pid", getpid(), @@ -1550,9 +1549,9 @@ static int _recorder_create_common(recorder_h *recorder, muse_recorder_type_e ty LOGD("sock_fd : %d, msg : %s", sock_fd, send_msg); - 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) { @@ -1942,7 +1941,7 @@ int recorder_set_video_resolution(recorder_h recorder, int width, int height) LOGD("ENTER"); - send_msg = muse_core_msg_json_factory_new(api, + send_msg = muse_core_msg_new(api, MUSE_TYPE_INT, "width", width, MUSE_TYPE_INT, "height", height, NULL); @@ -1950,7 +1949,7 @@ int recorder_set_video_resolution(recorder_h recorder, int width, int height) if (pc->cb_info->is_server_connected) { __recorder_update_api_waiting(pc->cb_info, api, 1); - send_ret = muse_core_ipc_send_msg(pc->cb_info->fd, send_msg); + send_ret = muse_core_msg_send(pc->cb_info->fd, send_msg); } if (send_ret < 0) { @@ -1962,7 +1961,7 @@ int recorder_set_video_resolution(recorder_h recorder, int width, int height) __recorder_update_api_waiting(pc->cb_info, api, -1); - muse_core_msg_json_factory_free(send_msg); + muse_core_msg_free(send_msg); } else { LOGE("failed to create msg"); ret = RECORDER_ERROR_OUT_OF_MEMORY; @@ -2229,7 +2228,7 @@ int recorder_set_sound_stream_info(recorder_h recorder, sound_stream_info_h stre LOGD("sound manager return [0x%x]", ret); if (ret == SOUND_MANAGER_ERROR_NONE) { - send_msg = muse_core_msg_json_factory_new(api, + send_msg = muse_core_msg_new(api, MUSE_TYPE_STRING, "stream_type", stream_type, MUSE_TYPE_INT, "stream_index", stream_index, NULL); @@ -2237,7 +2236,7 @@ int recorder_set_sound_stream_info(recorder_h recorder, sound_stream_info_h stre if (pc->cb_info->is_server_connected) { __recorder_update_api_waiting(pc->cb_info, api, 1); - send_ret = muse_core_ipc_send_msg(pc->cb_info->fd, send_msg); + send_ret = muse_core_msg_send(pc->cb_info->fd, send_msg); } if (send_ret < 0) { @@ -2249,7 +2248,7 @@ int recorder_set_sound_stream_info(recorder_h recorder, sound_stream_info_h stre __recorder_update_api_waiting(pc->cb_info, api, -1); - muse_core_msg_json_factory_free(send_msg); + muse_core_msg_free(send_msg); } else { LOGE("failed to create msg"); ret = RECORDER_ERROR_OUT_OF_MEMORY; @@ -3398,14 +3397,14 @@ int recorder_get_device_state(recorder_type_e type, recorder_device_state_e *sta LOGD("Enter - type %d", type); - 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 = RECORDER_ERROR_INVALID_OPERATION; goto _GET_DEVICE_STATE_EXIT; } - send_msg = muse_core_msg_json_factory_new(MUSE_RECORDER_API_GET_DEVICE_STATE, + send_msg = muse_core_msg_new(MUSE_RECORDER_API_GET_DEVICE_STATE, MUSE_TYPE_INT, "module", MUSE_RECORDER, MUSE_TYPE_INT, PARAM_RECORDER_TYPE, type, NULL); @@ -3417,9 +3416,9 @@ int recorder_get_device_state(recorder_type_e type, recorder_device_state_e *sta LOGD("sock_fd : %d, msg : %s", sock_fd, send_msg); - ret = muse_core_ipc_send_msg(sock_fd, send_msg); + 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 (ret < 0) { @@ -3428,7 +3427,7 @@ int recorder_get_device_state(recorder_type_e type, recorder_device_state_e *sta goto _GET_DEVICE_STATE_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 = RECORDER_ERROR_INVALID_OPERATION; -- 2.7.4