Updated hw_params_(can|is)_* functions

This commit is contained in:
Jaroslav Kysela 2002-10-12 14:32:59 +00:00
parent 0d699d7e19
commit cebc5c9bef

View file

@ -2268,7 +2268,7 @@ int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, snd_output_t *out)
*/ */
int snd_pcm_hw_params_can_mmap_sample_resolution(const snd_pcm_hw_params_t *params) int snd_pcm_hw_params_can_mmap_sample_resolution(const snd_pcm_hw_params_t *params)
{ {
assert(params); assert(params && params->info != ~0U);
return !!(params->info & SNDRV_PCM_INFO_MMAP_VALID); return !!(params->info & SNDRV_PCM_INFO_MMAP_VALID);
} }
@ -2279,13 +2279,13 @@ int snd_pcm_hw_params_can_mmap_sample_resolution(const snd_pcm_hw_params_t *para
* \retval 0 Hardware doesn't do double buffering for start/stop * \retval 0 Hardware doesn't do double buffering for start/stop
* \retval 1 Hardware does double buffering for start/stop * \retval 1 Hardware does double buffering for start/stop
* *
* The return value is always one when given configuration is not exactly one. * It is not allowed to call this function when given configuration is not exactly one.
* Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration * Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration
* from the configuration space. * from the configuration space.
*/ */
int snd_pcm_hw_params_is_double(const snd_pcm_hw_params_t *params) int snd_pcm_hw_params_is_double(const snd_pcm_hw_params_t *params)
{ {
assert(params); assert(params && params->info != ~0U);
return !!(params->info & SNDRV_PCM_INFO_DOUBLE); return !!(params->info & SNDRV_PCM_INFO_DOUBLE);
} }
@ -2296,13 +2296,13 @@ int snd_pcm_hw_params_is_double(const snd_pcm_hw_params_t *params)
* \retval 0 Hardware doesn't do double buffering for data transfers * \retval 0 Hardware doesn't do double buffering for data transfers
* \retval 1 Hardware does double buffering for data transfers * \retval 1 Hardware does double buffering for data transfers
* *
* The return value is always one when given configuration is not exactly one. * It is not allowed to call this function when given configuration is not exactly one.
* Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration * Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration
* from the configuration space. * from the configuration space.
*/ */
int snd_pcm_hw_params_is_batch(const snd_pcm_hw_params_t *params) int snd_pcm_hw_params_is_batch(const snd_pcm_hw_params_t *params)
{ {
assert(params); assert(params && params->info != ~0U);
return !!(params->info & SNDRV_PCM_INFO_BATCH); return !!(params->info & SNDRV_PCM_INFO_BATCH);
} }
@ -2313,13 +2313,13 @@ int snd_pcm_hw_params_is_batch(const snd_pcm_hw_params_t *params)
* \retval 0 Hardware doesn't block transfers * \retval 0 Hardware doesn't block transfers
* \retval 1 Hardware does block transfers * \retval 1 Hardware does block transfers
* *
* The return value is always one when given configuration is not exactly one. * It is not allowed to call this function when given configuration is not exactly one.
* Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration * Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration
* from the configuration space. * from the configuration space.
*/ */
int snd_pcm_hw_params_is_block_transfer(const snd_pcm_hw_params_t *params) int snd_pcm_hw_params_is_block_transfer(const snd_pcm_hw_params_t *params)
{ {
assert(params); assert(params && params->info != ~0U);
return !!(params->info & SNDRV_PCM_INFO_BLOCK_TRANSFER); return !!(params->info & SNDRV_PCM_INFO_BLOCK_TRANSFER);
} }
@ -2330,13 +2330,13 @@ int snd_pcm_hw_params_is_block_transfer(const snd_pcm_hw_params_t *params)
* \retval 0 Hardware doesn't support overrange detection * \retval 0 Hardware doesn't support overrange detection
* \retval 1 Hardware supports overrange detection * \retval 1 Hardware supports overrange detection
* *
* The return value is always one when given configuration is not exactly one. * It is not allowed to call this function when given configuration is not exactly one.
* Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration * Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration
* from the configuration space. * from the configuration space.
*/ */
int snd_pcm_hw_params_can_overrange(const snd_pcm_hw_params_t *params) int snd_pcm_hw_params_can_overrange(const snd_pcm_hw_params_t *params)
{ {
assert(params); assert(params && params->info != ~0U);
return !!(params->info & SNDRV_PCM_INFO_OVERRANGE); return !!(params->info & SNDRV_PCM_INFO_OVERRANGE);
} }
@ -2347,13 +2347,13 @@ int snd_pcm_hw_params_can_overrange(const snd_pcm_hw_params_t *params)
* \retval 0 Hardware doesn't support pause * \retval 0 Hardware doesn't support pause
* \retval 1 Hardware supports pause * \retval 1 Hardware supports pause
* *
* The return value is always one when given configuration is not exactly one. * It is not allowed to call this function when given configuration is not exactly one.
* Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration * Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration
* from the configuration space. * from the configuration space.
*/ */
int snd_pcm_hw_params_can_pause(const snd_pcm_hw_params_t *params) int snd_pcm_hw_params_can_pause(const snd_pcm_hw_params_t *params)
{ {
assert(params); assert(params && params->info != ~0U);
return !!(params->info & SNDRV_PCM_INFO_PAUSE); return !!(params->info & SNDRV_PCM_INFO_PAUSE);
} }
@ -2364,13 +2364,13 @@ int snd_pcm_hw_params_can_pause(const snd_pcm_hw_params_t *params)
* \retval 0 Hardware doesn't support resume * \retval 0 Hardware doesn't support resume
* \retval 1 Hardware supports resume * \retval 1 Hardware supports resume
* *
* The return value is always one when given configuration is not exactly one. * It is not allowed to call this function when given configuration is not exactly one.
* Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration * Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration
* from the configuration space. * from the configuration space.
*/ */
int snd_pcm_hw_params_can_resume(const snd_pcm_hw_params_t *params) int snd_pcm_hw_params_can_resume(const snd_pcm_hw_params_t *params)
{ {
assert(params); assert(params && params->info != ~0U);
return !!(params->info & SNDRV_PCM_INFO_RESUME); return !!(params->info & SNDRV_PCM_INFO_RESUME);
} }
@ -2381,13 +2381,13 @@ int snd_pcm_hw_params_can_resume(const snd_pcm_hw_params_t *params)
* \retval 0 Hardware doesn't do half-duplex * \retval 0 Hardware doesn't do half-duplex
* \retval 1 Hardware does half-duplex * \retval 1 Hardware does half-duplex
* *
* The return value is always one when given configuration is not exactly one. * It is not allowed to call this function when given configuration is not exactly one.
* Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration * Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration
* from the configuration space. * from the configuration space.
*/ */
int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params) int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params)
{ {
assert(params); assert(params && params->info != ~0U);
return !!(params->info & SNDRV_PCM_INFO_HALF_DUPLEX); return !!(params->info & SNDRV_PCM_INFO_HALF_DUPLEX);
} }
@ -2398,13 +2398,13 @@ int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params)
* \retval 0 Hardware doesn't do joint-duplex * \retval 0 Hardware doesn't do joint-duplex
* \retval 1 Hardware does joint-duplex * \retval 1 Hardware does joint-duplex
* *
* The return value is always one when given configuration is not exactly one. * It is not allowed to call this function when given configuration is not exactly one.
* Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration * Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration
* from the configuration space. * from the configuration space.
*/ */
int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params) int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params)
{ {
assert(params); assert(params && params->info != ~0U);
return !!(params->info & SNDRV_PCM_INFO_JOINT_DUPLEX); return !!(params->info & SNDRV_PCM_INFO_JOINT_DUPLEX);
} }
@ -2415,13 +2415,13 @@ int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params)
* \retval 0 Hardware doesn't support synchronized start * \retval 0 Hardware doesn't support synchronized start
* \retval 1 Hardware supports synchronized start * \retval 1 Hardware supports synchronized start
* *
* The return value is always one when given configuration is not exactly one. * It is not allowed to call this function when given configuration is not exactly one.
* Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration * Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration
* from the configuration space. * from the configuration space.
int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params) int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params)
{ {
assert(params); assert(params && params->info != ~0U);
return !!(params->info & SNDRV_PCM_INFO_SYNC_START); return !!(params->info & SNDRV_PCM_INFO_SYNC_START);
} }
@ -2432,15 +2432,14 @@ int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params)
* \param rate_den Pointer to returned rate denominator * \param rate_den Pointer to returned rate denominator
* \return 0 otherwise a negative error code if the info is not available * \return 0 otherwise a negative error code if the info is not available
* *
* The return value is always -EINVAL when given configuration is not exactly one. * It is not allowed to call this function when given configuration is not exactly one.
* Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration * Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration
* from the configuration space. * from the configuration space.
*/ */
int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params, int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
unsigned int *rate_num, unsigned int *rate_den) unsigned int *rate_num, unsigned int *rate_den)
{ {
if (params->rate_den == 0) assert(params && params->rate_den != 0);
return -EINVAL;
*rate_num = params->rate_num; *rate_num = params->rate_num;
*rate_den = params->rate_den; *rate_den = params->rate_den;
return 0; return 0;
@ -2451,14 +2450,13 @@ int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
* \param params Configuration space * \param params Configuration space
* \return signification bits in sample otherwise a negative error code if the info is not available * \return signification bits in sample otherwise a negative error code if the info is not available
* *
* The return value is always -EINVAL when given configuration is not exactly one. * It is not allowed to call this function when given configuration is not exactly one.
* Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration * Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration
* from the configuration space. * from the configuration space.
*/ */
int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params) int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params)
{ {
if (params->msbits == 0) assert(params && params->msbits != 0);
return -EINVAL;
return params->msbits; return params->msbits;
} }
@ -2467,14 +2465,13 @@ int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params)
* \param params Configuration space * \param params Configuration space
* \return FIFO size in frames otherwise a negative error code if the info is not available * \return FIFO size in frames otherwise a negative error code if the info is not available
* *
* The return value is always -EINVAL when given configuration is not exactly one. * It is not allowed to call this function when given configuration is not exactly one.
* Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration * Usually, \link ::snd_pcm_hw_params \endlink function chooses one configuration
* from the configuration space. * from the configuration space.
*/ */
int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params) int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params)
{ {
if (params->fifo_size == 0) assert(params && params->info != ~0U);
return -EINVAL;
return params->fifo_size; return params->fifo_size;
} }