summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeongmo Yang <jm80.yang@samsung.com>2016-02-25 12:39:53 +0900
committerJeongmo Yang <jm80.yang@samsung.com>2016-03-09 12:43:49 +0900
commit1b562f22c1fc8066bbef300e386cb2b1df25f100 (patch)
tree0e77367fff25ffffdaee819e5122a0586c1a5e26
parent1ce51f8f20f6d07ff1ce3552f4e757db1f7429af (diff)
downloadrecorder-1b562f22c1fc8066bbef300e386cb2b1df25f100.tar.gz
recorder-1b562f22c1fc8066bbef300e386cb2b1df25f100.tar.bz2
recorder-1b562f22c1fc8066bbef300e386cb2b1df25f100.zip
Change-Id: I5caca63d53bc397b0c88aab79a4f1629b0546cab Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r--CMakeLists.txt4
-rw-r--r--include/recorder.h21
-rw-r--r--packaging/capi-media-recorder.spec3
-rw-r--r--src/recorder.c54
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/recorder_test.c19
6 files changed, 98 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ea5eab1..1569e97 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,8 +9,8 @@ SET(service "media")
SET(submodule "recorder")
# for package file
-SET(dependents "dlog capi-media-camera capi-media-audio-io mmsvc-recorder storage mused")
-SET(pc_dependents "capi-base-common capi-media-camera capi-media-audio-io")
+SET(dependents "dlog capi-media-camera capi-media-audio-io mmsvc-recorder storage mused capi-media-sound-manager")
+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.h b/include/recorder.h
index cf66acb..bf6c9f8 100644
--- a/include/recorder.h
+++ b/include/recorder.h
@@ -19,6 +19,7 @@
#include <tizen.h>
#include <camera.h>
#include <audio_io.h>
+#include <sound_manager.h>
#ifdef __cplusplus
extern "C" {
@@ -650,6 +651,26 @@ int recorder_set_file_format(recorder_h recorder, recorder_file_format_e format)
int recorder_get_file_format(recorder_h recorder, recorder_file_format_e *format);
+/**
+ * @brief Sets the recorder's sound manager stream information.
+ * @since_tizen 3.0
+ * @remarks You can set sound stream information including audio routing.
+ * For more details, please refer to @ref CAPI_MEDIA_SOUND_MANAGER_MODULE
+ * @param[in] recorder The handle to the media recorder
+ * @param[in] stream_info The sound manager info
+ * @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_STATE Invalid state
+ * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY
+ * @see #sound_stream_info_h
+ * @see sound_manager_create_stream_information()
+ * @see sound_manager_destroy_stream_information()
+ */
+int recorder_set_sound_stream_info(recorder_h recorder, sound_stream_info_h stream_info);
+
+
/**
* @}
*/
diff --git a/packaging/capi-media-recorder.spec b/packaging/capi-media-recorder.spec
index c2166a6..a647604 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.2.20
+Version: 0.2.21
Release: 0
Group: Multimedia/API
License: Apache-2.0
@@ -17,6 +17,7 @@ BuildRequires: pkgconfig(evas)
BuildRequires: pkgconfig(elementary)
BuildRequires: pkgconfig(capi-media-tool)
BuildRequires: pkgconfig(capi-media-audio-io)
+BuildRequires: pkgconfig(capi-media-sound-manager)
BuildRequires: pkgconfig(storage)
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
diff --git a/src/recorder.c b/src/recorder.c
index 2f8290b..d41f0e7 100644
--- a/src/recorder.c
+++ b/src/recorder.c
@@ -18,6 +18,8 @@
#include <stdlib.h>
#include <string.h>
#include <recorder.h>
+#include <sound_manager.h>
+#include <sound_manager_internal.h>
#include <storage.h>
#include <muse_recorder.h>
#include <muse_recorder_msg.h>
@@ -985,7 +987,7 @@ static int _recorder_create_common(recorder_h *recorder, muse_recorder_type_e ty
goto _ERR_RECORDER_EXIT;
}
- ret = client_wait_for_cb_return(MUSE_RECORDER_API_CREATE, pc->cb_info, CALLBACK_TIME_OUT);
+ ret = client_wait_for_cb_return(MUSE_RECORDER_API_CREATE, pc->cb_info, RECORDER_CALLBACK_TIME_OUT);
if (ret == RECORDER_ERROR_NONE) {
muse_recorder_msg_get_pointer(handle, pc->cb_info->recv_msg);
if (handle == 0) {
@@ -1534,6 +1536,56 @@ int recorder_get_file_format(recorder_h recorder, recorder_file_format_e *format
}
+int recorder_set_sound_stream_info(recorder_h recorder, sound_stream_info_h stream_info)
+{
+ int ret = RECORDER_ERROR_NONE;
+ muse_recorder_api_e api = MUSE_RECORDER_API_SET_SOUND_STREAM_INFO;
+ recorder_cli_s *pc = NULL;
+ bool is_available = false;
+ int sock_fd;
+ int stream_index = 0;
+ char *stream_type = NULL;
+
+ if (recorder == NULL || stream_info == NULL) {
+ LOGE("NULL pointer handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ pc = (recorder_cli_s *)recorder;
+ if (pc->cb_info == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", RECORDER_ERROR_INVALID_PARAMETER);
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ sock_fd = pc->cb_info->fd;
+
+ LOGD("ENTER");
+
+ ret = sound_manager_is_available_stream_information(stream_info, NATIVE_API_RECORDER, &is_available);
+ if (ret != SOUND_MANAGER_ERROR_NONE) {
+ LOGE("stream info verification failed");
+ return RECORDER_ERROR_INVALID_OPERATION;
+ }
+
+ if (is_available == false) {
+ LOGE("stream information is not available");
+ return RECORDER_ERROR_INVALID_OPERATION;
+ }
+
+ ret = sound_manager_get_type_from_stream_information(stream_info, &stream_type);
+ ret |= sound_manager_get_index_from_stream_information(stream_info, &stream_index);
+
+ LOGD("sound manager return [0x%x]", ret);
+
+ if (ret == SOUND_MANAGER_ERROR_NONE)
+ muse_recorder_msg_send2(api, sock_fd, pc->cb_info, ret, STRING, stream_type, INT, stream_index);
+ else
+ ret = RECORDER_ERROR_INVALID_OPERATION;
+
+ return ret;
+}
+
+
int recorder_set_state_changed_cb(recorder_h recorder, recorder_state_changed_cb callback, void* user_data)
{
if (recorder == NULL || callback == NULL) {
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index de39ed5..88541b7 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -5,7 +5,7 @@ SET(fw_test "${fw_name}-test")
#link_directories(${CMAKE_SOURCE_DIR}/../)
INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_test} REQUIRED elementary evas)
+pkg_check_modules(${fw_test} REQUIRED elementary evas capi-media-sound-manager)
FOREACH(flag ${${fw_test}_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
MESSAGE(${flag})
diff --git a/test/recorder_test.c b/test/recorder_test.c
index eb96abd..4825ecf 100644
--- a/test/recorder_test.c
+++ b/test/recorder_test.c
@@ -31,6 +31,7 @@
#include <dlog.h>
#include <Ecore.h>
#include <Elementary.h>
+#include <sound_manager.h>
/*-----------------------------------------------------------------------
| GLOBAL VARIABLE DEFINITIONS: |
@@ -1396,6 +1397,14 @@ static gboolean init_handle()
return TRUE;
}
+
+
+static void _sound_stream_focus_state_changed_cb(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data)
+{
+ g_print("focus changed : reason %d\n", reason_for_change);
+ return;
+}
+
/**
* This function is to change camcorder mode.
*
@@ -1517,6 +1526,16 @@ static gboolean mode_change()
continue;
}
+ {
+ sound_stream_info_h stream_info = NULL;
+
+ sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, _sound_stream_focus_state_changed_cb, hcamcorder, &stream_info);
+ if (stream_info) {
+ recorder_set_sound_stream_info(hcamcorder->recorder, stream_info);
+ sound_manager_destroy_stream_information(stream_info);
+ }
+ }
+
err = recorder_attr_set_audio_device(hcamcorder->recorder, RECORDER_AUDIO_DEVICE_MIC);
if (err != RECORDER_ERROR_NONE) {
LOGE("set audio device failed 0x%x", err);