[pulseaudio-discuss] [PATCH 2/2] alsa-ucm: Add the ability to set modargs from UCM config

Tanu Kaskinen tanuk at iki.fi
Thu Jun 9 12:54:50 UTC 2016


On Tue, 2016-05-03 at 18:26 +0530, arun at accosted.net wrote:
> @@ -1253,6 +1255,7 @@ static int ucm_create_mapping_direction(
>          pa_alsa_profile_set *ps,
>          pa_alsa_profile *p,
>          pa_alsa_ucm_device *device,
> +        pa_alsa_ucm_verb *verb,
>          const char *verb_name,

The verb_name argument could be removed, since it's available through
the verb object.

> @@ -1310,6 +1324,7 @@ static int ucm_create_mapping_for_modifier(
>          pa_alsa_profile_set *ps,
>          pa_alsa_profile *p,
>          pa_alsa_ucm_modifier *modifier,
> +        pa_alsa_ucm_verb *verb,
>          const char *verb_name,

Same as above.

> @@ -1355,6 +1385,7 @@ static int ucm_create_mapping(
>          pa_alsa_profile_set *ps,
>          pa_alsa_profile *p,
>          pa_alsa_ucm_device *device,
> +        pa_alsa_ucm_verb *verb,
>          const char *verb_name,

Same as above.

> @@ -249,7 +249,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
>          PA_IDXSET_FOREACH(am, nd->profile->output_mappings, idx) {
>  
>              if (!am->sink)
> -                am->sink = pa_alsa_sink_new(c->module, u->modargs, __FILE__, c, am);
> +                am->sink = pa_alsa_sink_new(c->module, am->sink_modargs ? am->sink_modargs : u->modargs, __FILE__, c, am);

I think it would be nicer if the place where you prepare am-
>sink_modargs would always set the variable, so that we could always
pass am->sink_modargs here.

> +static pa_modargs* prepare_modargs(const char *module, const char *config) {
> +    pa_modargs *ma;
> +
> +    /* It's easier to re-parse the module arguments than to do a deep modargs copy */
> +    ma = pa_modargs_new(module, valid_modargs);
> +    if (!ma)
> +        return NULL;

This should never happen, so an assertion would be better here.

-- 
Tanu


More information about the pulseaudio-discuss mailing list