[PATCH v2 09/18] alsa: Add node support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/28/2013 09:48 AM, Tanu Kaskinen wrote:
> ---
>   src/modules/alsa/alsa-mixer.c  | 2 ++
>   src/modules/alsa/alsa-sink.c   | 6 ++++++
>   src/modules/alsa/alsa-source.c | 6 ++++++
>   src/modules/alsa/alsa-ucm.c    | 2 ++
>   4 files changed, 16 insertions(+)
>
> diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
> index 63afc24..08ee203 100644
> --- a/src/modules/alsa/alsa-mixer.c
> +++ b/src/modules/alsa/alsa-mixer.c
> @@ -4496,6 +4496,8 @@ static pa_device_port* device_port_alsa_init(pa_hashmap *ports, /* card ports */
>           pa_device_port_new_data_set_name(&port_data, name);
>           pa_device_port_new_data_set_description(&port_data, description);
>           pa_device_port_new_data_set_direction(&port_data, path->direction == PA_ALSA_DIRECTION_OUTPUT ? PA_DIRECTION_OUTPUT : PA_DIRECTION_INPUT);
> +        pa_device_port_new_data_set_create_node(&port_data, true);
> +        pa_node_new_data_set_fallback_name_prefix(&port_data.node_data, "alsa");
>
>           p = pa_device_port_new(core, &port_data, sizeof(pa_alsa_port_data));
>           pa_device_port_new_data_done(&port_data);
> diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
> index 759f9f8..56ec7e9 100644
> --- a/src/modules/alsa/alsa-sink.c
> +++ b/src/modules/alsa/alsa-sink.c
> @@ -2030,6 +2030,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
>       pa_sink_new_data data;
>       pa_alsa_profile_set *profile_set = NULL;
>       void *state = NULL;
> +    bool belong_to_card = !!mapping;
>
>       pa_assert(m);
>       pa_assert(ma);
> @@ -2292,6 +2293,11 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
>       else if (u->mixer_path_set)
>           pa_alsa_add_ports(&data, u->mixer_path_set, card);
>
> +    if (!belong_to_card) {
> +        pa_sink_new_data_set_create_node(&data, true);
> +        pa_node_new_data_set_fallback_name_prefix(&data.node_data, "alsa");
> +    }

There could be use cases where we have sinks connected to cards but 
still no ports, in which case we should still create a node, I suppose. 
E g, if you have a mapping entry in the profile set file but nothing in 
paths-output key of that section?

> +
>       u->sink = pa_sink_new(m->core, &data, PA_SINK_HARDWARE | PA_SINK_LATENCY | (u->use_tsched ? PA_SINK_DYNAMIC_LATENCY : 0) |
>                             (set_formats ? PA_SINK_SET_FORMATS : 0));
>       pa_sink_new_data_done(&data);
> diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
> index 8b6fe82..7064f35 100644
> --- a/src/modules/alsa/alsa-source.c
> +++ b/src/modules/alsa/alsa-source.c
> @@ -1740,6 +1740,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
>       pa_source_new_data data;
>       pa_alsa_profile_set *profile_set = NULL;
>       void *state = NULL;
> +    bool belong_to_card = !!mapping;
>
>       pa_assert(m);
>       pa_assert(ma);
> @@ -1991,6 +1992,11 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
>       else if (u->mixer_path_set)
>           pa_alsa_add_ports(&data, u->mixer_path_set, card);
>
> +    if (!belong_to_card) {
> +        pa_source_new_data_set_create_node(&data, true);
> +        pa_node_new_data_set_fallback_name_prefix(&data.node_data, "alsa");
> +    }
> +
>       u->source = pa_source_new(m->core, &data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY|(u->use_tsched ? PA_SOURCE_DYNAMIC_LATENCY : 0));
>       pa_source_new_data_done(&data);
>
> diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
> index 1c1cd9c..fdded87 100644
> --- a/src/modules/alsa/alsa-ucm.c
> +++ b/src/modules/alsa/alsa-ucm.c
> @@ -694,6 +694,8 @@ static void ucm_add_port_combination(
>           pa_device_port_new_data_set_name(&port_data, name);
>           pa_device_port_new_data_set_description(&port_data, desc);
>           pa_device_port_new_data_set_direction(&port_data, is_sink ? PA_DIRECTION_OUTPUT : PA_DIRECTION_INPUT);
> +        pa_device_port_new_data_set_create_node(&port_data, true);
> +        pa_node_new_data_set_fallback_name_prefix(&port_data.node_data, "alsa");
>
>           port = pa_device_port_new(core, &port_data, 0);
>           pa_device_port_new_data_done(&port_data);
>



-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux