From a97a2b3b2a2dab6891e56ee963f8313539046a84 Mon Sep 17 00:00:00 2001 From: YoungHun Kim Date: Tue, 22 Jan 2019 16:21:39 +0900 Subject: Get the module index using muse configure [Version] 0.4.20 [Profile] Common [Issue Type] Update [Dependency module] N/A Change-Id: I609f9e8fe7b8d243202aa12705151b880ad5d318 --- packaging/capi-media-camera.spec | 2 +- src/camera.c | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 3cc5fe2..875c42e 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.4.19 +Version: 0.4.20 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera.c b/src/camera.c index 9e1dada..4237161 100644 --- a/src/camera.c +++ b/src/camera.c @@ -34,6 +34,7 @@ #undef LOG_TAG #endif #define LOG_TAG "TIZEN_N_CAMERA" +#define MODULE_NAME "camera" /* for device changed callback */ static GMutex g_cam_dev_state_changed_cb_lock; @@ -2279,6 +2280,7 @@ int _camera_independent_request(int api, int device_type, const char *key, int * { int ret = CAMERA_ERROR_NONE; int sock_fd = -1; + int module_index = -1; char *msg = NULL; char recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH] = {'\0',}; @@ -2294,8 +2296,14 @@ int _camera_independent_request(int api, int device_type, const char *key, int * return CAMERA_ERROR_INVALID_OPERATION; } + if (muse_client_get_module_index(MODULE_NAME, &module_index) != MM_ERROR_NONE) { + LOGE("muse client get module index failed"); + ret = CAMERA_ERROR_INVALID_OPERATION; + goto _REQUEST_EXIT; + } + msg = muse_core_msg_new(api, - MUSE_TYPE_INT, "module", MUSE_CAMERA, + MUSE_TYPE_INT, "module", module_index, MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type, 0); if (!msg) { @@ -2354,7 +2362,7 @@ int camera_create(camera_device_e device, camera_h *camera) tbm_bufmgr bufmgr = NULL; muse_camera_api_e api = MUSE_CAMERA_API_CREATE; - muse_core_api_module_e muse_module = MUSE_CAMERA; + int module_index = -1; int device_type = (int)device; if (!camera) { @@ -2371,8 +2379,14 @@ int camera_create(camera_device_e device, camera_h *camera) pid = getpid(); + if (muse_client_get_module_index(MODULE_NAME, &module_index) != MM_ERROR_NONE) { + LOGE("muse client get module index failed"); + ret = CAMERA_ERROR_INVALID_OPERATION; + goto ErrorExit; + } + send_msg = muse_core_msg_new(api, - MUSE_TYPE_INT, "module", muse_module, + MUSE_TYPE_INT, "module", module_index, MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type, MUSE_TYPE_INT, "pid", pid, 0); -- cgit v1.2.3