pcm: hw: introduce SNDRV_PCM_INFO_PERFECT_DRAIN

Handle the driver informing us that it is not necessary to set up
silencing upon playback draining. This will be the case for drivers
which are guaranteed to not read any samples beyond the application
pointer.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2023-04-25 14:36:19 +02:00
parent dd9cb31a90
commit 90e25887d2
5 changed files with 30 additions and 1 deletions

View file

@ -3707,6 +3707,29 @@ int snd_pcm_hw_params_can_disable_period_wakeup(const snd_pcm_hw_params_t *param
return !!(params->info & SNDRV_PCM_INFO_NO_PERIOD_WAKEUP);
}
/**
* \brief Check if hardware is capable of perfect drain
* \param params Configuration space
* \retval 0 Hardware doesn't do perfect drain
* \retval 1 Hardware does perfect drain
*
* This function should only be called when the configuration space
* contains a single configuration. Call #snd_pcm_hw_params to choose
* a single configuration from the configuration space.
*
* Perfect drain means that the hardware does not use samples
* beyond the stream application pointer.
*/
int snd_pcm_hw_params_is_perfect_drain(const snd_pcm_hw_params_t *params)
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_PERFECT_DRAIN);
}
/**
* \brief Check if hardware supports audio wallclock timestamps
* \param params Configuration space