int vcd_dependency_deinitialize(void);
int vcd_dependency_set_audio_info(sound_stream_info_h stream_info_h, const char* audio_source_type, vce_audio_type_e type, int rate, int channel);
int vcd_dependency_get_audio_source_type(char** audio_source_type);
+int vcd_dependency_set_streaming_mode(vc_audio_streaming_mode_e mode);
int vcd_dependency_start_recording(void);
int vcd_dependency_stop_recording(void);
#include <sound_manager_internal.h>
#include "vce.h"
+#include "voice_control_manager.h"
#include "vc_audio_manager_dlog.h"
#include "vc_audio_manager.h"
static audio_in_h g_audio_h = nullptr;
static vce_audio_type_e g_audio_type = VCE_AUDIO_TYPE_PCM_S16_LE;
+static vc_audio_streaming_mode_e g_streaming_mode = VC_AUDIO_STREAMING_MODE_VC_SERVICE;
static int g_audio_rate = 0;
static int g_audio_channel = 0;
{
int ret = 0;
+ g_streaming_mode = VC_AUDIO_STREAMING_MODE_VC_SERVICE;
g_audio_type = VCE_AUDIO_TYPE_PCM_S16_LE;
g_audio_rate = 16000;
g_audio_channel = 1;
return VCE_ERROR_NONE;
}
+int vcd_dependency_set_streaming_mode(vc_audio_streaming_mode_e mode)
+{
+ if (nullptr == g_audio_h) {
+ VCAM_LOGE("[ERROR] g_audio_h is not created");
+ return VCE_ERROR_INVALID_STATE;
+ }
+
+ g_streaming_mode = mode;
+
+ return VCE_ERROR_NONE;
+}
+
int vcd_dependency_start_recording(void)
{
VCAM_LOGI("");
(vcd_dependency_set_audio_info)dlsym(g_lib_handle, VCD_DEPENDENCY_FUNC_SET_AUDIO_INFO);
g_interface.get_audio_source_type =
(vcd_dependency_get_audio_source_type)dlsym(g_lib_handle, VCD_DEPENDENCY_FUNC_GET_AUDIO_SOURCE_TYPE);
+ g_interface.set_streaming_mode =
+ (vcd_dependency_set_streaming_mode)dlsym(g_lib_handle, VCD_DEPENDENCY_FUNC_SET_STREAMING_MODE);
g_interface.start_recording =
(vcd_dependency_start_recording)dlsym(g_lib_handle, VCD_DEPENDENCY_FUNC_START_RECORDING);
g_interface.stop_recording =
return ret;
}
+int dependency_audio_manager_set_streaming_mode(vc_audio_streaming_mode_e mode)
+{
+ SLOG(LOG_DEBUG, LOG_TAG, "@@@ Set streaming mode");
+ int ret = 0;
+ if (NULL != g_lib_handle) {
+ vcd_dependency_set_streaming_mode func = g_interface.set_streaming_mode;
+
+ if (NULL == func) {
+ SLOG(LOG_ERROR, LOG_TAG, "[ERROR] symbol lookup failed : %s", VCD_DEPENDENCY_FUNC_SET_STREAMING_MODE);
+ } else {
+ try {
+ ret = func(mode);
+ } catch (const std::exception& e) {
+ SLOG(LOG_ERROR, LOG_TAG, "[ERROR] %s of dependency module threw exception : %s",
+ VCD_DEPENDENCY_FUNC_SET_STREAMING_MODE, e.what());
+ }
+
+ if (0 != ret) {
+ SLOG(LOG_ERROR, LOG_TAG, "[ERROR] Fail to set streaming mode, ret(%d)", ret);
+ }
+ }
+ } else {
+ SLOG(LOG_ERROR, LOG_TAG, "[ERROR] g_lib_handle is not valid");
+ }
+
+ SLOG(LOG_DEBUG, LOG_TAG, "@@@");
+ return ret;
+}
+
int dependency_audio_manager_start_recording(void)
{
SLOG(LOG_DEBUG, LOG_TAG, "@@@ Start recording");
#include <tzplatform_config.h>
#include <sound_manager.h>
#include <vce.h>
+#include <voice_control_manager.h>
#ifdef __cplusplus
extern "C" {
typedef int (*vcd_dependency_set_audio_info)(sound_stream_info_h stream_info_h, const char* audio_source_type, vce_audio_type_e type, int rate, int channel);
#define VCD_DEPENDENCY_FUNC_GET_AUDIO_SOURCE_TYPE "vcd_dependency_get_audio_source_type"
typedef int (*vcd_dependency_get_audio_source_type)(char** audio_source_type);
+#define VCD_DEPENDENCY_FUNC_SET_STREAMING_MODE "vcd_dependency_set_streaming_mode"
+typedef int (*vcd_dependency_set_streaming_mode)(vc_audio_streaming_mode_e mode);
#define VCD_DEPENDENCY_FUNC_START_RECORDING "vcd_dependency_start_recording"
typedef int (*vcd_dependency_start_recording)(void);
#define VCD_DEPENDENCY_FUNC_STOP_RECORDING "vcd_dependency_stop_recording"
vcd_dependency_deinitialize deinitialize;
vcd_dependency_set_audio_info set_audio_info;
vcd_dependency_get_audio_source_type get_audio_source_type;
+ vcd_dependency_set_streaming_mode set_streaming_mode;
vcd_dependency_start_recording start_recording;
vcd_dependency_stop_recording stop_recording;
} vcd_dependency_module_interface;
int dependency_audio_manager_deinitialize(void);
int dependency_audio_manager_set_audio_info(sound_stream_info_h stream_info_h, const char* audio_source_type, vce_audio_type_e type, int rate, int channel);
int dependency_audio_manager_get_audio_source_type(char** audio_source_type);
+int dependency_audio_manager_set_streaming_mode(vc_audio_streaming_mode_e mode);
int dependency_audio_manager_start_recording(void);
int dependency_audio_manager_stop_recording(void);
ret = VCD_ERROR_OPERATION_FAILED;
} else {
vcd_config_set_audio_streaming_mode((vcd_audio_streaming_mode_e)streaming_mode);
- ret = vcd_server_mgr_initialize(pid);
+ ret = vcd_server_mgr_initialize(pid, streaming_mode);
service_state = vcd_server_get_service_state();
foreground = vcd_server_get_foreground();
daemon_pid = getpid();
return VCD_ERROR_NONE;
}
+int vcd_recorder_set_audio_streaming_mode(vcd_audio_streaming_mode_e mode)
+{
+ if (0 != dependency_audio_manager_set_streaming_mode((vc_audio_streaming_mode_e)mode)) {
+ SLOG(LOG_WARN, TAG_VCD, "[Recorder] Fail to set audio mode to dependency module(%d)", mode);
+ return VCD_ERROR_OPERATION_FAILED;
+ }
+
+ return VCD_ERROR_NONE;
+}
+
Eina_Bool __read_test_func(void *data)
{
if (VCD_RECORDER_STATE_RECORDING != g_recorder_state) {
int vcd_recorder_get(char** audio_type);
+int vcd_recorder_set_audio_streaming_mode(vcd_audio_streaming_mode_e mode);
+
int vcd_recorder_start_streaming();
int vcd_recorder_send_streaming(const void* buffer, const unsigned int length);
/*
* API for manager
*/
-int vcd_server_mgr_initialize(int pid)
+int vcd_server_mgr_initialize(int pid, vcd_audio_streaming_mode_e mode)
{
/* check if pid is valid */
if (false == vcd_client_manager_is_valid(pid)) {
if (0 != vcdc_send_manager_pid(pid))
SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Fail to send manager pid");
+ vcd_recorder_set_audio_streaming_mode(mode);
+
ecore_timer_add(0.05, __vcd_send_service_state, NULL);
SLOG(LOG_ERROR, TAG_VCD, "[Server Success] Manager initialize : pid(%d)", pid);
/*
* For manager
*/
-int vcd_server_mgr_initialize(int pid);
+int vcd_server_mgr_initialize(int pid, vcd_audio_streaming_mode_e mode);
int vcd_server_mgr_finalize(int pid);