[pulseaudio-discuss] Design question: how to store the "preferred ports" of a card

Tanu Kaskinen tanuk at iki.fi
Fri Feb 26 10:19:53 UTC 2016


On Thu, 2016-02-25 at 19:43 +0100, David Henningsson wrote:
> 
> On 2016-02-25 17:18, Tanu Kaskinen wrote:
> > Hi,
> > 
> > Some time ago I submitted a patch[1] for fixing the HDMI routing
> > regression[2]. The patch introduces two new variables for cards:
> > preferred_input_port and preferred_output_port. The variables are
> > internal to module-switch-on-port-available. It turned out that the
> > patch doesn't fix the bug properly, because the variables are not saved
> > on disk, so the user preferences are forgotten on reboot.
> > 
> > Now my question is what approach is preferred for implementing the
> > variable persistence. I'd like to keep the logic of setting the
> > variables in module-switch-on-port-available, but I'd prefer not to
> > create a new file for storing the variables on disk. So, I propose that
> > module-card-restore will take care of saving and restoring the
> > variables.
> > 
> > How should module-switch-on-port-available and module-card-restore
> > communicate with each other? My preference would be to add the
> > variables to pa_card, and add functions
> > pa_card_set_preferred_input_port() and
> > pa_card_set_preferred_output_port(). module-switch-on-port-available
> > would call those when it wants to change the values, and module-card-
> > restore would call them when restoring the values from disk. There
> > would also be new hooks PA_CARD_PREFERRED_INPUT_PORT_CHANGED and the
> > same for output, which module-card-restore would use to update the on-
> > disk database.
> > 
> > Another alternative would be to use the card proplist for storing the
> > variables.
> > 
> > Opinions?
> Hmm, is there anything in the above that differs from the strategy used 
> for the recently added pa_device_port->preferred_profile?

I don't think there is.

> Adding variables to pa_card seems reasonable to me. Perhaps having the 
> same hook for both input and output (and perhaps adding a parameter 
> telling which one changed) would save a few lines of code here and 
> there? But that's mostly a detail.

Ok, I'll do that. Thanks for your input!

-- 
Tanu


More information about the pulseaudio-discuss mailing list