SET(INC_DIR include)
INCLUDE_DIRECTORIES(${INC_DIR})
-SET(dependents "dlog mm-sound capi-base-common capi-media-sound-manager mm-common mm-session libpulse vconf")
+SET(dependents "dlog mm-sound capi-base-common capi-media-sound-manager mm-common mm-session libpulse vconf dpm")
SET(pc_dependents "capi-base-common capi-media-sound-manager")
INCLUDE(FindPkgConfig)
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
ADD_DEFINITIONS("-DTIZEN_DEBUG")
+ADD_DEFINITIONS("-DENABLE_DPM")
#ADD_DEFINITIONS("-D_AUDIO_IO_DEBUG_TIMING_")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
Name: capi-media-audio-io
Summary: An Audio Input & Audio Output library in Tizen Native API
-Version: 0.3.30
+Version: 0.3.31
Release: 0
Group: Multimedia/API
License: Apache-2.0
BuildRequires: pkgconfig(capi-media-sound-manager)
BuildRequires: pkgconfig(capi-base-common)
BuildRequires: pkgconfig(libpulse)
+BuildRequires: pkgconfig(dpm)
%description
An Audio Input & Audio Output library in Tizen Native API
#include <mm.h>
#include "CAudioIODef.h"
-
+#ifdef ENABLE_DPM
+#include <dpm/context.h>
+#include <dpm/restriction.h>
+#endif
using namespace std;
using namespace tizen_media_audio;
pa_threaded_mainloop_signal(pClient->__mpMainloop, 0);
}
+static bool __is_microphone_restricted(void) {
+ int state = 1;
+#ifdef ENABLE_DPM
+ dpm_context_h dpm_ctx_h;
+ dpm_restriction_policy_h dpm_policy_h;
+ int ret = 0;
+
+ if ((dpm_ctx_h = dpm_context_create())) {
+ if ((dpm_policy_h = dpm_context_acquire_restriction_policy(dpm_ctx_h))) {
+ /* state: 0(disallowed), 1(allowed) */
+ if ((ret = dpm_restriction_get_microphone_state(dpm_policy_h, &state)))
+ AUDIO_IO_LOGE("Failed to dpm_restriction_get_microphone_state(), ret(0x%x)", ret);
+ dpm_context_release_restriction_policy(dpm_ctx_h, dpm_policy_h);
+ } else
+ AUDIO_IO_LOGE("Failed to dpm_context_acquire_restriction_policy()");
+ dpm_context_destroy(dpm_ctx_h);
+ } else
+ AUDIO_IO_LOGE("Failed to dpm_context_create()");
+#endif
+ return (state ? false : true);
+}
+
void CPulseAudioClient::__streamStateChangeCb(pa_stream* s, void* user_data) {
assert(s);
assert(user_data);
case PA_STREAM_FAILED:
AUDIO_IO_LOGD("The stream is failed");
- pClient->__mpListener->onStateChanged(CAudioInfo::EAudioIOState::AUDIO_IO_STATE_IDLE);
+ pClient->__mpListener->onStateChanged(CAudioInfo::EAudioIOState::AUDIO_IO_STATE_IDLE,
+ __is_microphone_restricted());
pa_threaded_mainloop_signal(pClient->__mpMainloop, 0);
break;