mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-17 08:56:49 -05:00
acp: pass udev PROFILE_SETS to acp device
This commit is contained in:
parent
e478ba7e34
commit
eaf7606e3f
3 changed files with 17 additions and 4 deletions
|
|
@ -286,6 +286,8 @@ struct spa_device_methods {
|
||||||
* "webcam", "microphone", "headset",
|
* "webcam", "microphone", "headset",
|
||||||
* "headphone", "hands-free", "car", "hifi",
|
* "headphone", "hands-free", "car", "hifi",
|
||||||
* "computer", "portable" */
|
* "computer", "portable" */
|
||||||
|
#define SPA_KEY_DEVICE_PROFILE "device.profile " /**< profile for the device */
|
||||||
|
#define SPA_KEY_DEVICE_PROFILE_SET "device.profile-set" /**< profile set for the device */
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -793,6 +793,8 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
struct acp_dict_item items[4];
|
||||||
|
uint32_t n_items = 0;
|
||||||
|
|
||||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||||
|
|
@ -820,14 +822,20 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
reset_props(&this->props);
|
reset_props(&this->props);
|
||||||
|
|
||||||
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_ALSA_PATH)))
|
if (info) {
|
||||||
snprintf(this->props.device, sizeof(this->props.device)-1, "%s", str);
|
if ((str = spa_dict_lookup(info, SPA_KEY_API_ALSA_PATH)) != NULL)
|
||||||
|
snprintf(this->props.device, sizeof(this->props.device)-1, "%s", str);
|
||||||
|
if ((str = spa_dict_lookup(info, SPA_KEY_DEVICE_PROFILE_SET)) != NULL)
|
||||||
|
items[n_items++] = ACP_DICT_ITEM_INIT("profile-set", str);
|
||||||
|
if ((str = spa_dict_lookup(info, SPA_KEY_DEVICE_PROFILE)) != NULL)
|
||||||
|
items[n_items++] = ACP_DICT_ITEM_INIT("profile", str);
|
||||||
|
}
|
||||||
|
|
||||||
spa_log_debug(this->log, "probe card %s", this->props.device);
|
spa_log_debug(this->log, "probe card %s", this->props.device);
|
||||||
if ((str = strchr(this->props.device, ':')) == NULL)
|
if ((str = strchr(this->props.device, ':')) == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
this->card = acp_card_new(atoi(str+1), NULL);
|
this->card = acp_card_new(atoi(str+1), &ACP_DICT_INIT(items, n_items));
|
||||||
if (this->card == NULL)
|
if (this->card == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ static int emit_object_info(struct impl *this, uint32_t id, struct udev_device *
|
||||||
snd_ctl_t *ctl_hndl;
|
snd_ctl_t *ctl_hndl;
|
||||||
const char *str;
|
const char *str;
|
||||||
char path[32];
|
char path[32];
|
||||||
struct spa_dict_item items[22];
|
struct spa_dict_item items[23];
|
||||||
uint32_t n_items = 0;
|
uint32_t n_items = 0;
|
||||||
int res, pcm;
|
int res, pcm;
|
||||||
|
|
||||||
|
|
@ -239,6 +239,9 @@ static int emit_object_info(struct impl *this, uint32_t id, struct udev_device *
|
||||||
if ((str = udev_device_get_property_value(dev, "PULSE_NAME")) && *str)
|
if ((str = udev_device_get_property_value(dev, "PULSE_NAME")) && *str)
|
||||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_NAME, str);
|
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_NAME, str);
|
||||||
|
|
||||||
|
if ((str = udev_device_get_property_value(dev, "PULSE_PROFILE_SET")) && *str)
|
||||||
|
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_PROFILE_SET, str);
|
||||||
|
|
||||||
if ((str = udev_device_get_property_value(dev, "SOUND_CLASS")) && *str)
|
if ((str = udev_device_get_property_value(dev, "SOUND_CLASS")) && *str)
|
||||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_CLASS, str);
|
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_CLASS, str);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue