} stream_conf_info_s;
typedef struct _manual_route_info_s {
- char *route_in_devices[AVAIL_DEVICES_MAX];
- char *route_out_devices[AVAIL_DEVICES_MAX];
- int route_in_devices_idx[AVAIL_DEVICES_MAX];
- int route_out_devices_idx[AVAIL_DEVICES_MAX];
+ unsigned int route_in_devices[AVAIL_DEVICES_MAX];
+ unsigned int route_out_devices[AVAIL_DEVICES_MAX];
} manual_route_info_s;
typedef struct _sound_stream_info_s {
Name: capi-media-sound-manager
Summary: Sound Manager library
-Version: 0.3.2
+Version: 0.3.3
Release: 0
Group: Multimedia/API
License: Apache-2.0
int j = 0;
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;
SM_NULL_ARG_CHECK(device);
if (stream_h->stream_conf_info.route_type == STREAM_ROUTE_TYPE_MANUAL) {
+ ret = mm_sound_get_device_id(device, &device_id);
+ 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);
if(!strncmp(stream_h->stream_conf_info.avail_in_devices[i], device_type_str, SOUND_DEVICE_TYPE_LEN)) {
for (j = 0; j < AVAIL_DEVICES_MAX; j++) {
if (!stream_h->manual_route_info.route_in_devices[j]) {
- stream_h->manual_route_info.route_in_devices[j] = strdup(device_type_str);
+ stream_h->manual_route_info.route_in_devices[j] = (unsigned int)device_id;
added_successfully = true;
break;
}
- if (!strncmp(stream_h->manual_route_info.route_in_devices[j], device_type_str, SOUND_DEVICE_TYPE_LEN)) {
+ if (stream_h->manual_route_info.route_in_devices[j] == (unsigned int)device_id) {
/* it was already set */
return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_DUPLICATED);
}
if(!strncmp(stream_h->stream_conf_info.avail_out_devices[i], device_type_str, SOUND_DEVICE_TYPE_LEN)) {
for (j = 0; j < AVAIL_DEVICES_MAX; j++) {
if (!stream_h->manual_route_info.route_out_devices[j]) {
- stream_h->manual_route_info.route_out_devices[j] = strdup(device_type_str);
+ stream_h->manual_route_info.route_out_devices[j] = (unsigned int)device_id;
added_successfully = true;
break;
}
- if (!strncmp(stream_h->manual_route_info.route_out_devices[j], device_type_str, SOUND_DEVICE_TYPE_LEN)) {
+ if (stream_h->manual_route_info.route_out_devices[j] == (unsigned int)device_id) {
/* it was already set */
return __convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_DUPLICATED);
}
int j = 0;
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;
SM_NULL_ARG_CHECK(device);
if (stream_h->stream_conf_info.route_type == STREAM_ROUTE_TYPE_MANUAL) {
+ ret = mm_sound_get_device_id(device, &device_id);
+ 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);
if (stream_h->stream_conf_info.avail_in_devices[i]) {
if(!strncmp(stream_h->stream_conf_info.avail_in_devices[i], device_type_str, SOUND_DEVICE_TYPE_LEN)) {
for (j = 0; j < AVAIL_DEVICES_MAX; j++) {
- if (!strncmp(stream_h->manual_route_info.route_in_devices[j], device_type_str, SOUND_DEVICE_TYPE_LEN)) {
+ if (stream_h->manual_route_info.route_in_devices[j] == (unsigned int)device_id) {
removed_successfully = true;
- free(stream_h->manual_route_info.route_in_devices[j]);
- stream_h->manual_route_info.route_in_devices[j] = NULL;
+ stream_h->manual_route_info.route_in_devices[j] = 0;
break;
}
}
if (stream_h->stream_conf_info.avail_out_devices[i]) {
if(!strncmp(stream_h->stream_conf_info.avail_out_devices[i], device_type_str, SOUND_DEVICE_TYPE_LEN)) {
for (j = 0; j < AVAIL_DEVICES_MAX; j++) {
- if (!strncmp(stream_h->manual_route_info.route_out_devices[j], device_type_str, SOUND_DEVICE_TYPE_LEN)) {
+ if (stream_h->manual_route_info.route_out_devices[j] == (unsigned int)device_id) {
removed_successfully = true;
- free(stream_h->manual_route_info.route_out_devices[j]);
- stream_h->manual_route_info.route_out_devices[j] = NULL;
+ stream_h->manual_route_info.route_out_devices[j] = 0;
break;
}
}
return MM_ERROR_SOUND_INTERNAL;
}
- builder_for_in_devices = g_variant_builder_new(G_VARIANT_TYPE("as"));
- builder_for_out_devices = g_variant_builder_new(G_VARIANT_TYPE("as"));
+ builder_for_in_devices = g_variant_builder_new(G_VARIANT_TYPE("au"));
+ builder_for_out_devices = g_variant_builder_new(G_VARIANT_TYPE("au"));
for (i = 0; i < AVAIL_DEVICES_MAX; i++) {
if (info->route_in_devices[i]) {
- g_variant_builder_add(builder_for_in_devices, "s", info->route_in_devices[i]);
- LOGI("[IN] %s", info->route_in_devices[i]);
+ g_variant_builder_add(builder_for_in_devices, "u", info->route_in_devices[i]);
+ LOGI("[IN] device_id:%u", info->route_in_devices[i]);
} else {
break;
}
}
for (i = 0; i < AVAIL_DEVICES_MAX; i++) {
if (info->route_out_devices[i]) {
- g_variant_builder_add(builder_for_out_devices, "s", info->route_out_devices[i]);
- LOGI("[OUT] %s", info->route_out_devices[i]);
+ g_variant_builder_add(builder_for_out_devices, "u", info->route_out_devices[i]);
+ LOGI("[OUT] device_id:%u", info->route_out_devices[i]);
} else {
break;
}
PA_STREAM_MANAGER_OBJECT_PATH,
PA_STREAM_MANAGER_INTERFACE,
PA_STREAM_MANAGER_METHOD_NAME_SET_STREAM_ROUTE_DEVICES,
- g_variant_new ("(uasas)", index, builder_for_in_devices, builder_for_out_devices),
+ g_variant_new ("(uauau)", index, builder_for_in_devices, builder_for_out_devices),
G_VARIANT_TYPE("(s)"),
G_DBUS_CALL_FLAGS_NONE,
2000,
if (stream_h->stream_conf_info.avail_out_devices[i]) {
free(stream_h->stream_conf_info.avail_out_devices[i]);
}
- if (stream_h->manual_route_info.route_in_devices[i]) {
- free (stream_h->manual_route_info.route_in_devices[i]);
- }
- if (stream_h->manual_route_info.route_out_devices[i]) {
- free (stream_h->manual_route_info.route_out_devices[i]);
- }
}
for (i = 0; i < AVAIL_FRAMEWORKS_MAX; i++) {
if (stream_h->stream_conf_info.avail_frameworks[i]) {
}
else if (g_menu_state == CURRENT_STATUS_ADD_DEVICE_FOR_STREAM_ROUTING)
{
- g_print("*** input device type to add (0:built-in spk, 1:built-in rcv, 2:audio-jack, 3:bt)\n");
+ g_print("*** input device type to add (0:built-in mic, 1:built-in spk, 2:built-in rcv, 3:audio-jack, 4:bt)\n");
}
else if (g_menu_state == CURRENT_STATUS_REMOVE_DEVICE_FOR_STREAM_ROUTING)
{
- g_print("*** input device type to remove (0:built-in spk, 1:built-in rcv, 2:audio-jack, 3:bt)\n");
+ g_print("*** input device type to remove (0:built-in mic, 1:built-in spk, 2:built-in rcv, 3:audio-jack, 4:bt)\n");
}
else if (g_menu_state == CURRENT_STATUS_APPLY_STREAM_ROUTING)
{
bool need_to_go = false;
device_type = atoi(cmd);
switch(device_type) {
- case 0: /* built-in spk */
+ case 0: /* built-in mic */
+ selected_type = SOUND_DEVICE_BUILTIN_MIC;
+ break;
+ case 1: /* built-in spk */
selected_type = SOUND_DEVICE_BUILTIN_SPEAKER;
break;
- case 1: /* built-in rcv */
+ case 2: /* built-in rcv */
selected_type = SOUND_DEVICE_BUILTIN_RECEIVER;
break;
- case 2: /* audio-jack */
+ case 3: /* audio-jack */
selected_type = SOUND_DEVICE_AUDIO_JACK;
break;
- case 3: /* bt */
+ case 4: /* bt */
selected_type = SOUND_DEVICE_BLUETOOTH;
break;
default:
bool need_to_go = false;
device_type = atoi(cmd);
switch(device_type) {
- case 0: /* built-in spk */
+ case 0: /* built-in mic */
+ selected_type = SOUND_DEVICE_BUILTIN_MIC;
+ break;
+ case 1: /* built-in spk */
selected_type = SOUND_DEVICE_BUILTIN_SPEAKER;
break;
- case 1: /* built-in rcv */
+ case 2: /* built-in rcv */
selected_type = SOUND_DEVICE_BUILTIN_RECEIVER;
break;
- case 2: /* audio-jack */
+ case 3: /* audio-jack */
selected_type = SOUND_DEVICE_AUDIO_JACK;
break;
- case 3: /* bt */
+ case 4: /* bt */
selected_type = SOUND_DEVICE_BLUETOOTH;
break;
default: