[pulseaudio-discuss] [PATCH v2 09/18] alsa: Add node support
Tanu Kaskinen
tanu.kaskinen at linux.intel.com
Wed Jul 3 03:45:47 PDT 2013
On Fri, 2013-06-28 at 17:25 +0300, Tanu Kaskinen wrote:
> On Fri, 2013-06-28 at 12:34 +0200, David Henningsson wrote:
> > 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?
>
> Good point, I need to fix this.
I fixed it by changing the if condition to
pa_hashmap_isempty(data.ports).
This still isn't a very good way to handle mappings without paths,
however. The mapping should have a node that exists for the whole life
time of the card, but now the node exists only when the right profile is
active. I think pathless mappings should synthesize a port for
themselves. I'm not currently bothered by this problem enough to fix it,
maybe later.
--
Tanu
More information about the pulseaudio-discuss
mailing list