summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--doc/audio_io_doc.h4
-rw-r--r--include/audio_io.h2
-rw-r--r--packaging/capi-media-audio-io.spec3
-rw-r--r--src/audio_io_private.c18
5 files changed, 23 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a3dfa67..3b17008 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(INC_DIR include)
INCLUDE_DIRECTORIES(${INC_DIR})
-SET(dependents "dlog glib-2.0 mm-sound capi-base-common capi-media-sound-manager")
+SET(dependents "dlog glib-2.0 mm-sound capi-base-common capi-media-sound-manager capi-system-info")
SET(pc_dependents "capi-base-common capi-media-sound-manager")
INCLUDE(FindPkgConfig)
diff --git a/doc/audio_io_doc.h b/doc/audio_io_doc.h
index 3f2adb4..ac80511 100644
--- a/doc/audio_io_doc.h
+++ b/doc/audio_io_doc.h
@@ -47,8 +47,8 @@
* The input and output devices both have an available set of queries, to find the suggested buffer size, sampling rate, channel type,
* and sample type. For output, there is an additional query, to get the sound type (these types are defined in the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API).
*
- * Reading and writing is done by allocating a buffer and passing the buffer to the input device
- * via audio_in_start_recording(), audio_in_read(), or writing to the buffer and passing it to the output device via audio_out_write().
+ * Reading from input device is done by audio_in_read() with allocated buffer after audio_in_prepare().
+ * Similarly, writing to output device is done by audio_out_write() with allocated buffer after audio_out_prepare().
*
*/
diff --git a/include/audio_io.h b/include/audio_io.h
index 170bf90..4e9e95e 100644
--- a/include/audio_io.h
+++ b/include/audio_io.h
@@ -292,7 +292,7 @@ int audio_in_flush(audio_in_h input);
* @retval #AUDIO_IO_ERROR_SOUND_POLICY Sound policy error
* @retval #AUDIO_IO_ERROR_INVALID_OPERATION Invalid operation
* @retval #AUDIO_IO_ERROR_NOT_SUPPORTED Not supported
- * @pre audio_in_start_recording().
+ * @pre audio_in_prepare()
*/
int audio_in_read(audio_in_h input, void *buffer, unsigned int length);
diff --git a/packaging/capi-media-audio-io.spec b/packaging/capi-media-audio-io.spec
index 5e3a5e8..fd0ef0d 100644
--- a/packaging/capi-media-audio-io.spec
+++ b/packaging/capi-media-audio-io.spec
@@ -1,7 +1,7 @@
#sbs-git:slp/api/audio-io capi-media-audio-io 0.1.0 da265a7364928d92084360809316e36f666f053f
Name: capi-media-audio-io
Summary: An Audio Input & Audio Output library in Tizen Native API
-Version: 0.2.34
+Version: 0.2.36
Release: 0
Group: libdevel
License: Apache-2.0
@@ -12,6 +12,7 @@ BuildRequires: pkgconfig(mm-sound)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(capi-media-sound-manager)
BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-system-info)
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Requires(post): libprivilege-control
diff --git a/src/audio_io_private.c b/src/audio_io_private.c
index 789e286..77920f1 100644
--- a/src/audio_io_private.c
+++ b/src/audio_io_private.c
@@ -28,6 +28,11 @@
#endif
#define LOG_TAG "TIZEN_N_AUDIO_IO"
+#include <system_info.h>
+
+#define FEATURE_MICROPHONE "http://tizen.org/feature/microphone"
+
+
/*
* Internal Implementation
*/
@@ -73,6 +78,10 @@ int __convert_audio_io_error_code(int code, char *func_name)
ret = AUDIO_IO_ERROR_SOUND_POLICY;
msg = "AUDIO_IO_ERROR_SOUND_POLICY";
break;
+ case MM_ERROR_NOT_SUPPORT_API:
+ ret = AUDIO_IO_ERROR_NOT_SUPPORTED;
+ msg = "AUDIO_IO_ERROR_NOT_SUPPORTED";
+ break;
}
if(ret != AUDIO_IO_ERROR_NONE) {
LOGE("[%s] %s(0x%08x) : core fw error(0x%x)",func_name,msg, ret, code);
@@ -251,12 +260,19 @@ int audio_in_create_private(int sample_rate, audio_channel_e channel, audio_samp
{
int ret = 0;
audio_in_s *handle = NULL;
+ bool mic_enable = false;
/* input condition check */
AUDIO_IO_NULL_ARG_CHECK(input);
- if(__check_parameter(sample_rate, channel, type) != AUDIO_IO_ERROR_NONE)
+ if (__check_parameter(sample_rate, channel, type) != AUDIO_IO_ERROR_NONE)
return AUDIO_IO_ERROR_INVALID_PARAMETER;
+ /* MIC is not enabled, return false */
+ ret = system_info_get_platform_bool(FEATURE_MICROPHONE, &mic_enable);
+ LOGI("system_info_platform [%s]=[%d], ret[%d]", FEATURE_MICROPHONE, mic_enable, ret);
+ if (ret != SYSTEM_INFO_ERROR_NONE || !mic_enable)
+ return __convert_audio_io_error_code(MM_ERROR_NOT_SUPPORT_API, (char*)__FUNCTION__);
+
/* Create Handle & Fill information */
if ((handle = (audio_in_s*)malloc( sizeof(audio_in_s))) == NULL) {
LOGE("ERROR : AUDIO_IO_ERROR_OUT_OF_MEMORY(0x%08x)", AUDIO_IO_ERROR_OUT_OF_MEMORY);