Release version 0.2.6 88/50388/1 accepted/tizen/mobile/20151029.041245 accepted/tizen/tv/20151029.041314 accepted/tizen/wearable/20151029.041328 submit/tizen/20151028.225650
authorJeongmo Yang <jm80.yang@samsung.com>
Wed, 28 Oct 2015 08:35:37 +0000 (17:35 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Wed, 28 Oct 2015 08:35:37 +0000 (17:35 +0900)
1. Add new function for setting pid

Change-Id: I9db8d6ca22bb50ddc8f3ddb0437e7ce9fe1b9519
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
legacy/include/legacy_recorder_internal.h [new file with mode: 0644]
legacy/src/legacy_recorder_internal.c [new file with mode: 0644]
muse/src/muse_recorder_dispatcher.c
packaging/mmsvc-recorder.spec

diff --git a/legacy/include/legacy_recorder_internal.h b/legacy/include/legacy_recorder_internal.h
new file mode 100644 (file)
index 0000000..c2ee102
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __TIZEN_MULTIMEDIA_LEGACY_RECORDER_INTERNAL_H__
+#define        __TIZEN_MULTIMEDIA_LEGACY_RECORDER_INTERNAL_H__
+#include <legacy_recorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+  * @file legacy_recorder_internal.h
+  * @brief This file contains the legacy recorder internal API for framework, related structures and enumerations.
+  */
+
+/**
+ * @brief Set pid of client for sound focus API.
+ * @ingroup CAPI_MEDIA_RECORDER_MUSED_MODULE
+ * @param[in] recorder The handle to the recorder
+ * @param[in] pid The pid of client
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
+ * @pre        The recorder state must be #RECORDER_STATE_CREATED.
+ */
+int legacy_recorder_set_client_pid(recorder_h recorder, int pid);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__TIZEN_MULTIMEDIA_LEGACY_RECORDER_INTERNAL_H__
+
diff --git a/legacy/src/legacy_recorder_internal.c b/legacy/src/legacy_recorder_internal.c
new file mode 100644 (file)
index 0000000..b7bbdf8
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <mm_camcorder.h>
+#include <legacy_recorder.h>
+#include <legacy_recorder_internal.h>
+#include <legacy_recorder_private.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_RECORDER"
+
+int legacy_recorder_set_client_pid(recorder_h recorder, int pid)
+{
+       int ret;
+       recorder_s *handle = (recorder_s *)recorder;
+
+       if (handle == NULL) {
+               LOGE("NULL handle");
+               return RECORDER_ERROR_INVALID_PARAMETER;
+       }
+
+       LOGD("pid %d", pid);
+
+       ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+                                         MMCAM_PID_FOR_SOUND_FOCUS, pid,
+                                         NULL);
+
+       return __convert_recorder_error_code(__func__, ret);
+}
index e6efbb5..1214b09 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdio.h>
 #include "muse_recorder.h"
 #include "muse_recorder_msg.h"
-#include "legacy_recorder.h"
+#include "legacy_recorder_internal.h"
 #include <muse_core.h>
 #include <muse_core_ipc.h>
 #include <muse_core_security.h>
@@ -217,13 +217,14 @@ int recorder_dispatcher_create(muse_module_h module)
 {
        int ret = RECORDER_ERROR_NONE;
        muse_recorder_api_e api = MUSE_RECORDER_API_CREATE;
-       recorder_h recorder;
+       recorder_h recorder = NULL;;
        intptr_t camera_handle;
        muse_camera_handle_s *muse_camera = NULL;
        muse_recorder_info_s *recorder_data;
        tbm_bufmgr bufmgr;
        int recorder_type;
        int client_fd = -1;
+       int pid = 0;
        intptr_t handle;
 
        LOGD("Enter");
@@ -241,7 +242,7 @@ int recorder_dispatcher_create(muse_module_h module)
 
        if (recorder_type == MUSE_RECORDER_TYPE_VIDEO) {
                muse_recorder_msg_get_pointer(camera_handle, muse_core_client_get_msg(module));
-               if (camera_handle == NULL) {
+               if (camera_handle == 0) {
                        LOGE("NULL handle");
                        ret = RECORDER_ERROR_INVALID_PARAMETER;
                        muse_recorder_msg_return(api, ret, module);
@@ -254,8 +255,18 @@ int recorder_dispatcher_create(muse_module_h module)
 
                ret = legacy_recorder_create_videorecorder(muse_camera->camera_handle, &recorder);
        } else if (recorder_type == MUSE_RECORDER_TYPE_AUDIO) {
-               LOGD("audio type");
+               muse_recorder_msg_get(pid, muse_core_client_get_msg(module));
+
+               LOGD("audio type - pid %d", pid);
                ret = legacy_recorder_create_audiorecorder(&recorder);
+               if (ret == RECORDER_ERROR_NONE) {
+                       ret = legacy_recorder_set_client_pid(recorder, pid);
+                       if (ret != RECORDER_ERROR_NONE) {
+                               LOGE("legacy_recorder_set_client_pid failed 0x%x", ret);
+                               legacy_recorder_destroy(recorder);
+                               recorder = NULL;
+                       }
+               }
        }
 
        if (ret == RECORDER_ERROR_NONE) {
@@ -274,6 +285,7 @@ int recorder_dispatcher_create(muse_module_h module)
                }
                muse_recorder_msg_return1(api, ret, module, POINTER, handle);
        } else {
+               LOGE("error 0x%d", ret);
                muse_recorder_msg_return(api, ret, module);
        }
 
index 20b08ec..2f835ac 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-recorder
 Summary:    A Recorder module for muse server
-Version:    0.2.5
+Version:    0.2.6
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0