bool added_successfully = false;
char *device_type_str = NULL;
int device_id = 0;
- mm_sound_device_type_e device_type;
mm_sound_device_io_direction_e device_direction;
sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
if (ret) {
return __convert_sound_manager_error_code(__func__, ret);
}
- ret = mm_sound_get_device_type(device, &device_type);
- if (ret) {
- return __convert_sound_manager_error_code(__func__, ret);
- }
- ret = __convert_device_type(device_type, &device_type_str);
+ ret = mm_sound_get_device_type(device, &device_type_str);
if (ret) {
return __convert_sound_manager_error_code(__func__, ret);
}
bool removed_successfully = false;
char *device_type_str = NULL;
int device_id = 0;
- mm_sound_device_type_e device_type;
mm_sound_device_io_direction_e device_direction;
sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
if (ret) {
return __convert_sound_manager_error_code(__func__, ret);
}
- ret = mm_sound_get_device_type(device, &device_type);
- if (ret) {
- return __convert_sound_manager_error_code(__func__, ret);
- }
- ret = __convert_device_type(device_type, &device_type_str);
+ ret = mm_sound_get_device_type(device, &device_type_str);
if (ret) {
return __convert_sound_manager_error_code(__func__, ret);
}
int sound_manager_get_device_type (sound_device_h device, sound_device_type_e *type)
{
int ret = MM_ERROR_NONE;
- ret = mm_sound_get_device_type(device, (mm_sound_device_type_e*)type);
+ char *device_type = NULL;
+ ret = mm_sound_get_device_type(device, &device_type);
+ if (ret == MM_ERROR_NONE) {
+ ret = __convert_device_type_to_enum(device_type, type);
+ }
return __convert_sound_manager_error_code(__func__, ret);
}
int sound_manager_get_device_io_direction (sound_device_h device, sound_device_io_direction_e *io_direction)
{
int ret = MM_ERROR_NONE;
- ret = mm_sound_get_device_io_direction(device, (mm_sound_device_io_direction_e*)io_direction);
+ mm_sound_device_io_direction_e mm_sound_io_direction;
+ ret = mm_sound_get_device_io_direction(device, &mm_sound_io_direction);
+ if (ret == MM_ERROR_NONE) {
+ ret = __convert_device_io_direction(mm_sound_io_direction, io_direction);
+ }
return __convert_sound_manager_error_code(__func__, ret);
}
*device_type_enum = SOUND_DEVICE_BLUETOOTH;
} else if (!strncmp(device_type, "hdmi", SOUND_DEVICE_TYPE_LEN)) {
*device_type_enum = SOUND_DEVICE_HDMI;
+ } else if (!strncmp(device_type, "forwarding", SOUND_DEVICE_TYPE_LEN)) {
+ *device_type_enum = SOUND_DEVICE_FORWARDING;
} else if (!strncmp(device_type, "usb-audio", SOUND_DEVICE_TYPE_LEN)) {
*device_type_enum = SOUND_DEVICE_USB_AUDIO;
} else {
return ret;
}
+int __convert_device_io_direction (mm_sound_device_io_direction_e io_direction, sound_device_io_direction_e *sound_io_direction)
+{
+ int ret = MM_ERROR_NONE;
+
+ SM_NULL_ARG_CHECK(sound_io_direction);
+
+ switch (io_direction) {
+ case MM_SOUND_DEVICE_IO_DIRECTION_IN:
+ *sound_io_direction = SOUND_DEVICE_IO_DIRECTION_IN;
+ break;
+ case MM_SOUND_DEVICE_IO_DIRECTION_OUT:
+ *sound_io_direction = SOUND_DEVICE_IO_DIRECTION_OUT;
+ break;
+ case MM_SOUND_DEVICE_IO_DIRECTION_BOTH:
+ *sound_io_direction = SOUND_DEVICE_IO_DIRECTION_BOTH;
+ break;
+ }
+ return ret;
+}
+
const char* __convert_api_name (native_api_e api_name)
{
const char* name = NULL;
goto ERROR_CASE;
} else {
while ((w_ret = mm_sound_get_next_device(device_list, &device)) == MM_ERROR_NONE) {
- mm_sound_device_type_e type;
+ char *type = NULL;
+ sound_device_type_e type_e;
ret = mm_sound_get_device_type(device, &type);
+ if (ret != MM_ERROR_NONE)
+ goto ERROR_CASE;
+ ret = __convert_device_type_to_enum(type, &type_e);
if (ret != MM_ERROR_NONE)
goto ERROR_CASE;
switch (mode) {
case _SESSION_MODE_VOICE_WITH_AUDIO_JACK:
- if (type == MM_SOUND_DEVICE_TYPE_AUDIOJACK) {
+ if (type_e == SOUND_DEVICE_AUDIO_JACK) {
mm_sound_device_io_direction_e io_direction;
ret = mm_sound_get_device_io_direction(device, &io_direction);
if (ret != MM_ERROR_NONE)
}
break;
case _SESSION_MODE_VOICE_WITH_BLUETOOTH:
- if (type == MM_SOUND_DEVICE_TYPE_BLUETOOTH) {
+ if (type_e == SOUND_DEVICE_BLUETOOTH) {
mm_sound_device_io_direction_e io_direction;
ret = mm_sound_get_device_io_direction(device, &io_direction);
if (ret != MM_ERROR_NONE)
goto ERROR_CASE;
} else {
while ((w_ret = mm_sound_get_next_device(device_list, &device)) == MM_ERROR_NONE) {
- mm_sound_device_type_e type;
+ char *type = NULL;
+ sound_device_type_e type_e;
ret = mm_sound_get_device_type(device, &type);
if (ret != MM_ERROR_NONE)
goto ERROR_CASE;
- switch (type) {
- case MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER:
+ ret = __convert_device_type_to_enum(type, &type_e);
+ if (ret != MM_ERROR_NONE)
+ goto ERROR_CASE;
+ switch (type_e) {
+ case SOUND_DEVICE_BUILTIN_SPEAKER:
*mode = _SESSION_MODE_VOICE_WITH_BUILTIN_SPEAKER;
need_to_out = true;
break;
- case MM_SOUND_DEVICE_TYPE_BUILTIN_RECEIVER:
+ case SOUND_DEVICE_BUILTIN_RECEIVER:
*mode = _SESSION_MODE_VOICE_WITH_BUILTIN_RECEIVER;
need_to_out = true;
break;
- case MM_SOUND_DEVICE_TYPE_AUDIOJACK:
+ case SOUND_DEVICE_AUDIO_JACK:
*mode = _SESSION_MODE_VOICE_WITH_AUDIO_JACK;
need_to_out = true;
break;
- case MM_SOUND_DEVICE_TYPE_BLUETOOTH:
+ case SOUND_DEVICE_BLUETOOTH:
*mode = _SESSION_MODE_VOICE_WITH_BLUETOOTH;
need_to_out = true;
break;