From: Abramo Bagnara Date: Mon, 15 Jan 2001 13:36:14 +0000 (+0000) Subject: Fixed right access use for pcm_plug X-Git-Tag: v1.0.3~1024 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=fa6f875f57f3d4cf6ed92c9434cd1bc80a3dbf2d;p=alsa-lib.git Fixed right access use for pcm_plug --- diff --git a/include/pcm.h b/include/pcm.h index cd138ba5..6b958a47 100644 --- a/include/pcm.h +++ b/include/pcm.h @@ -106,6 +106,8 @@ int mask_single(const mask_t *mask); int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); int snd_pcm_hw_param_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var); +int snd_pcm_hw_param_test(const snd_pcm_hw_params_t *params, + snd_pcm_hw_param_t var, unsigned int val); int snd_pcm_hw_param_setinteger(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var); int snd_pcm_hw_param_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, diff --git a/src/pcm/pcm_params.c b/src/pcm/pcm_params.c index 154a53aa..336e45f1 100644 --- a/src/pcm/pcm_params.c +++ b/src/pcm/pcm_params.c @@ -1051,7 +1051,7 @@ typedef struct _snd_pcm_hw_strategy_simple_choices { } snd_pcm_hw_strategy_simple_choices_t; int snd_pcm_hw_param_test(const snd_pcm_hw_params_t *params, - snd_pcm_hw_param_t var, unsigned int val) + snd_pcm_hw_param_t var, unsigned int val) { if (hw_is_mask(var)) { const mask_t *mask = hw_param_mask_c(params, var); diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index 9f7ba854..87b31112 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -199,8 +199,8 @@ static int snd_pcm_plug_hw_link(snd_pcm_hw_params_t *params, snd_pcm_t *slave, unsigned long private ATTRIBUTE_UNUSED) { - int rate_always, channels_always, format_always, access_always; - int rate_never, channels_never, format_never, access_never; + int rate_always, channels_always, format_always; + int rate_never, channels_never, format_never; unsigned int links = (SND_PCM_HW_PARBIT_PERIOD_TIME | SND_PCM_HW_PARBIT_TICK_TIME); const mask_t *format_mask, *sformat_mask; @@ -268,13 +268,6 @@ static int snd_pcm_plug_hw_link(snd_pcm_hw_params_t *params, snd_pcm_hw_param_never_eq(params, SND_PCM_HW_PARAM_RATE, sparams)); - access_always = snd_pcm_hw_param_always_eq(params, - SND_PCM_HW_PARAM_ACCESS, - sparams); - access_never = (!access_always && - snd_pcm_hw_param_never_eq(params, - SND_PCM_HW_PARAM_ACCESS, - sparams)); if (rate_always) links |= (SND_PCM_HW_PARBIT_RATE | @@ -610,7 +603,10 @@ static int snd_pcm_plug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) clt_params.channels = snd_pcm_hw_param_value(params, SND_PCM_HW_PARAM_CHANNELS, 0); clt_params.rate = snd_pcm_hw_param_value(params, SND_PCM_HW_PARAM_RATE, 0); - slv_params.access = snd_pcm_hw_param_first(slave, &sparams, SND_PCM_HW_PARAM_ACCESS, 0); + if (snd_pcm_hw_param_test(params, SND_PCM_HW_PARAM_ACCESS, clt_params.access)) + slv_params.access = clt_params.access; + else + slv_params.access = snd_pcm_hw_param_first(slave, &sparams, SND_PCM_HW_PARAM_ACCESS, 0); slv_params.format = snd_pcm_hw_param_value(&sparams, SND_PCM_HW_PARAM_FORMAT, 0); slv_params.channels = snd_pcm_hw_param_value(&sparams, SND_PCM_HW_PARAM_CHANNELS, 0); slv_params.rate = snd_pcm_hw_param_value(&sparams, SND_PCM_HW_PARAM_RATE, 0);