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

David Henningsson david.henningsson at canonical.com
Thu Feb 25 18:43:26 UTC 2016



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?

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.

>
> [1] https://patchwork.freedesktop.org/patch/74014/
> [2] https://bugs.freedesktop.org/show_bug.cgi?id=93946
>
> -- 
> Tanu
>



More information about the pulseaudio-discuss mailing list