Get the module index using muse configure 89/198189/4 accepted/tizen/unified/20190218.063818 submit/tizen/20190129.225447 submit/tizen/20190130.080354 submit/tizen/20190214.113838
authorYoungHun Kim <yh8004.kim@samsung.com>
Tue, 22 Jan 2019 07:23:37 +0000 (16:23 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Tue, 22 Jan 2019 10:18:32 +0000 (19:18 +0900)
[Version] 0.3.16
[Profile] Common
[Issue Type] Update
[Dependency module] N/A

Change-Id: I06ea92ad2e5371a3ac4bb73d3d4f284fd0299f70

packaging/capi-media-recorder.spec
src/recorder.c

index d7fc9eb..e8ca824 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-recorder
 Summary:    A Recorder API
-Version:    0.3.15
+Version:    0.3.16
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index fef62ed..691f291 100644 (file)
@@ -36,6 +36,7 @@
 #undef LOG_TAG
 #endif
 #define LOG_TAG "TIZEN_N_RECORDER"
+#define MODULE_NAME "recorder"
 
 /* for device changed callback */
 static GMutex g_rec_dev_state_changed_cb_lock;
@@ -1459,6 +1460,7 @@ static int _recorder_create_common(recorder_h *recorder, muse_recorder_type_e ty
        int ret = RECORDER_ERROR_NONE;
        int destroy_ret = RECORDER_ERROR_NONE;
        int sock_fd = -1;
+       int module_index = -1;
        int send_ret = 0;
        char *send_msg = NULL;
        char *root_directory = NULL;
@@ -1499,9 +1501,15 @@ static int _recorder_create_common(recorder_h *recorder, muse_recorder_type_e ty
                goto _ERR_RECORDER_EXIT;
        }
 
+       if (muse_client_get_module_index(MODULE_NAME, &module_index) != MM_ERROR_NONE) {
+               LOGE("muse client get module index failed");
+               ret = RECORDER_ERROR_INVALID_OPERATION;
+               goto _ERR_RECORDER_EXIT;
+       }
+
        if (type == MUSE_RECORDER_TYPE_AUDIO) {
                send_msg = muse_core_msg_new(MUSE_RECORDER_API_CREATE,
-                       MUSE_TYPE_INT, "module", MUSE_RECORDER,
+                       MUSE_TYPE_INT, "module", module_index,
                        MUSE_TYPE_INT, PARAM_RECORDER_TYPE, MUSE_RECORDER_TYPE_AUDIO,
                        MUSE_TYPE_INT, "pid", getpid(),
                        NULL);
@@ -1509,7 +1517,7 @@ static int _recorder_create_common(recorder_h *recorder, muse_recorder_type_e ty
                pc->camera = camera;
                camera_handle = (intptr_t)((camera_cli_s *)camera)->remote_handle;
                send_msg = muse_core_msg_new(MUSE_RECORDER_API_CREATE,
-                       MUSE_TYPE_INT, "module", MUSE_RECORDER,
+                       MUSE_TYPE_INT, "module", module_index,
                        MUSE_TYPE_INT, PARAM_RECORDER_TYPE, MUSE_RECORDER_TYPE_VIDEO,
                        MUSE_TYPE_INT, "pid", getpid(),
                        MUSE_TYPE_POINTER, "camera_handle", camera_handle,
@@ -3428,6 +3436,7 @@ int recorder_get_device_state(recorder_type_e type, recorder_device_state_e *sta
 {
        int ret = RECORDER_ERROR_NONE;
        int sock_fd = -1;
+       int module_index = -1;
        int get_device_state = 0;
        char *send_msg = NULL;
        char recv_msg[MUSE_RECORDER_MSG_MAX_LENGTH] = {'\0',};
@@ -3446,8 +3455,14 @@ int recorder_get_device_state(recorder_type_e type, recorder_device_state_e *sta
                goto _GET_DEVICE_STATE_EXIT;
        }
 
+       if (muse_client_get_module_index(MODULE_NAME, &module_index) != MM_ERROR_NONE) {
+               LOGE("muse client get module index failed");
+               ret = RECORDER_ERROR_INVALID_OPERATION;
+               goto _GET_DEVICE_STATE_EXIT;
+       }
+
        send_msg = muse_core_msg_new(MUSE_RECORDER_API_GET_DEVICE_STATE,
-               MUSE_TYPE_INT, "module", MUSE_RECORDER,
+               MUSE_TYPE_INT, "module", module_index,
                MUSE_TYPE_INT, PARAM_RECORDER_TYPE, type,
                NULL);
        if (!send_msg) {