EXPORT_API int mas_dependency_stop_recording(void);
EXPORT_API int mas_dependency_change_system_volume(void);
EXPORT_API int mas_dependency_recover_system_volume(void);
+EXPORT_API int mas_dependency_get_audio_format(int* rate, int* channel, int* audio_type);
#ifdef __cplusplus
}
void dependency_default_audio_change_system_volume();
void dependency_default_audio_recover_system_volume();
+void dependency_default_audio_get_audio_format(int* rate, int* channel, int* audio_type);
#endif //_DEPENDENCY_DEFAULT_AUDIO_H_
{
dependency_default_audio_recover_system_volume();
return 0;
-}
\ No newline at end of file
+}
+
+int mas_dependency_get_audio_format(int* rate, int* channel, int* audio_type)
+{
+ dependency_default_audio_get_audio_format(rate, channel, audio_type);
+ return 0;
+}
}
g_volume_stream = NULL;
}
+}
+
+void dependency_default_audio_get_audio_format(int* rate, int* channel, int* audio_type)
+{
+ if (!audio_type || !rate || !channel) {
+ return;
+ }
+ *rate = 16000;
+ *channel = 0;
+ *audio_type = 0;
}
\ No newline at end of file
int dependency_resolver_stop_recording();
int dependency_resolver_change_system_volume();
int dependency_resolver_recover_system_volume();
+int dependency_resolver_get_audio_format(int* rate, int* channel, int* audio_type);
/**************************************************************************************
*** Definitions for dependencies
typedef int (*mas_dependency_change_system_volume)(void);
#define MAS_DEPENDENCY_FUNC_RECOVER_SYSTEM_VOLUME "mas_dependency_recover_system_volume"
typedef int (*mas_dependency_recover_system_volume)(void);
+#define MAS_DEPENDENCY_FUNC_GET_AUDIO_FORMAT "mas_dependency_get_audio_format"
+typedef int (*mas_dependency_get_audio_format)(int* rate, int* channel, int* audio_type);
typedef struct {
mas_dependency_initialize initialize;
mas_dependency_stop_recording stop_recording;
mas_dependency_change_system_volume change_system_volume;
mas_dependency_recover_system_volume recover_system_volume;
+ mas_dependency_get_audio_format get_audio_format;
} mas_dependency;
#ifdef __cplusplus
g_mas_dependency.recover_system_volume =
(mas_dependency_recover_system_volume)dlsym(g_handle,
MAS_DEPENDENCY_FUNC_RECOVER_SYSTEM_VOLUME);
+ g_mas_dependency.get_audio_format =
+ (mas_dependency_get_audio_format)dlsym(g_handle,
+ MAS_DEPENDENCY_FUNC_GET_AUDIO_FORMAT);
int ret = -1;
int dependency_version = 0;
return ret;
}
+
+int dependency_resolver_get_audio_format(int* rate, int* channel, int* audio_type)
+{
+ int ret = -1;
+ if (NULL != g_handle) {
+ mas_dependency_get_audio_format func = g_mas_dependency.get_audio_format;
+ if (NULL == func) {
+ MAS_LOGE("[ERROR] symbol lookup failed : %s", MAS_DEPENDENCY_FUNC_GET_AUDIO_FORMAT);
+ } else {
+ ret = func(rate, channel, audio_type);
+ if (0 != ret) {
+ MAS_LOGE("[ERROR] Fail to get audio format, ret(%d)", ret);
+ }
+ }
+ } else {
+ MAS_LOGE("[ERROR] g_handle is not valid");
+ }
+
+ return ret;
+}
+
return false;
}
- *rate = 16000;
- *channel = 0;
- *audio_type = 0;
+ dependency_resolver_get_audio_format(rate, channel, audio_type);
MWR_LOGD("[END] rate(%d), channel(%d), audio_type(%d)", *rate, *channel, *audio_type);
return true;