[pulseaudio-discuss] [[PATCH v0] 1/5] device-port: Allow setting the card name while creating a port.

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Tue Jun 4 06:56:58 PDT 2013


On Mon, 2013-06-03 at 21:01 +0300, Tanu Kaskinen wrote:
> On Mon, 2013-06-03 at 20:31 +0300, Tanu Kaskinen wrote:
> > On Thu, 2013-04-18 at 02:24 +0200, poljar (Damir Jelić) wrote:
> > > Since we want to be able to set/restore port properties while creating a
> > > port and the port properties are saved with the card name as a key we
> > > need to know the card name before the port is connected to a card.
> > > 
> > > This patch enables assigning a card name to the port_new_data struct.
> > 
> > Thanks, will apply. I added an assertion to pa_device_port_new():
> > pa_assert(data->card_name).
> 
> Actually, no, I won't apply this. The problem is that the card name
> isn't known before pa_card_new() has been called. pa_namereg_register()
> may alter the name if it conflicts with a name that has been registered
> earlier.
> 
> I think it makes sense to first create a card with pa_card_new(), then
> create the ports with pa_device_port_new() and add them to the
> previously created card. Finally, pa_card_put() will be called (that
> function doesn't exist yet).
> 
> In order to make module-card-restore work, there's a complication: the
> CARD_NEW function will be too early for restoring the port properties,
> and CARD_PUT will be too late. Perhaps there should be
> CARD_PORTS_INSTALLED, called by pa_card_install_ports(), which would be
> called between pa_card_new() and pa_card_put().

Correction: the CARD_PORTS_INSTALLED hook won't be necessary for
restoring port properties. Such hook would be useful if there were some
card properties that depended on the ports, but for port properties it's
sufficient to use the PORT_NEW hook, provided that
pa_device_port_new_data contains a pa_card pointer (which isn't possible
currently, but will be possible if ports are created between the call to
pa_card_new() and pa_card_put()).

-- 
Tanu



More information about the pulseaudio-discuss mailing list