The new parameter is for device role. It can be nullable.
[Version] 11.1.61
[Issue Type] API
Change-Id: I336a1e82521e9b21300fb907333127c17c0249c5
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
Name: pulseaudio-modules-tizen
Summary: Pulseaudio modules for Tizen
-Version: 11.1.60
+Version: 11.1.61
Release: 0
Group: Multimedia/Audio
License: LGPL-2.1+
pa_log_info("find device [%s]", type);
- if ((device = pa_device_manager_get_device(dm, type))) {
+ if ((device = pa_device_manager_get_device(dm, type, NULL))) {
if (pa_tz_device_is_use_internal_codec(device))
pa_tz_device_set_running_and_notify(device, is_running);
else
return dm->device_list;
}
-pa_tz_device* pa_device_manager_get_device(pa_device_manager *dm, const char *type) {
+pa_tz_device* pa_device_manager_get_device(pa_device_manager *dm, const char *type, const char *role) {
pa_assert(dm);
- return device_list_get_device(dm, type, NULL, NULL);
+ return device_list_get_device(dm, type, role, NULL);
}
pa_tz_device* pa_device_manager_get_device_by_id(pa_device_manager *dm, uint32_t id) {
/* Get device list, returned pa_idxset contains 'pa_tz_device' */
pa_idxset* pa_device_manager_get_device_list(pa_device_manager *dm);
-/* Get device which of type is 'device_type'
- * When there is multi-device for that 'device_type', return first one */
-pa_tz_device* pa_device_manager_get_device(pa_device_manager *dm, const char *device_type);
+/* Get device of 'type' and 'role'.
+ * If there are multiple devices for the 'type' and set the 'role' to NULL,
+ * it will return the first one, so-called, default device. */
+pa_tz_device* pa_device_manager_get_device(pa_device_manager *dm, const char *type, const char *role);
pa_tz_device* pa_device_manager_get_device_by_id(pa_device_manager *dm, uint32_t id);
/* get device with sink or source */
goto finish;
}
/* get a device of default role from previous device type */
- if (!(device = pa_device_manager_get_device(m->dm, sp->preferred_device.types[direction]))) {
+ if (!(device = pa_device_manager_get_device(m->dm, sp->preferred_device.types[direction], NULL))) {
pa_log_error("could not get device[%s]", sp->preferred_device.types[direction]);
ret = RET_MSG_ERROR_DEVICE_NOT_FOUND;
goto finish;
} else {
/* If the request is for a different device type,
* check the previous device role and move streams to default role if needed. */
- if ((prev_device = pa_device_manager_get_device(m->dm, prev_device_type)))
+ if ((prev_device = pa_device_manager_get_device(m->dm, prev_device_type, NULL)))
new_device = pa_hashmap_first((direction == STREAM_DIRECTION_OUT) ?
prev_device->playback_devices : prev_device->capture_devices);
if (new_device) {
}
PA_IDXSET_FOREACH(device_type, avail_device_types, idx) {
- device = pa_device_manager_get_device(m->dm, device_type);
+ device = pa_device_manager_get_device(m->dm, device_type, NULL);
if (!device)
continue;
direction = pa_tz_device_get_direction(device);
}
PA_IDXSET_FOREACH(device_type, avail_device_types, idx) {
- if ((next_device = pa_device_manager_get_device(m->dm, device_type))) {
+ if ((next_device = pa_device_manager_get_device(m->dm, device_type, NULL))) {
creation_time = pa_tz_device_get_creation_time(next_device);
direction = pa_tz_device_get_direction(next_device);
if ((find_direction & direction) == 0)
continue;
}
if (ret_next) {
- if ((*next_device = pa_device_manager_get_device(m->dm, device_type))) {
+ if ((*next_device = pa_device_manager_get_device(m->dm, device_type, NULL))) {
pa_log_debug("found next device[%s, %p]", device_type, *next_device);
break;
}
}
} else if (route_type == STREAM_ROUTE_TYPE_AUTO_LAST_CONNECTED) {
PA_IDXSET_FOREACH(device_type, devices, idx) {
- if ((*next_device = pa_device_manager_get_device(m->dm, device_type))) {
+ if ((*next_device = pa_device_manager_get_device(m->dm, device_type, NULL))) {
creation_time = pa_tz_device_get_creation_time(*next_device);
if (!latest_device || (latest_creation_time <= creation_time)) {
latest_device = *next_device;
const char *stream_role = pa_proplist_gets(si->proplist, PA_PROP_MEDIA_ROLE);
const char *cur_device_type = pa_proplist_gets(si->proplist, PA_PROP_MEDIA_ROUTE_AUTO_ACTIVE_DEV);
char *device_type = pa_tz_device_get_type(device);
- pa_tz_device *cur_device = pa_device_manager_get_device(m->dm, cur_device_type);
+ pa_tz_device *cur_device = pa_device_manager_get_device(m->dm, cur_device_type, NULL);
pa_sink *sink = pa_tz_device_get_sink(device, NULL);
if (is_connected) {