replace SNDMSG,SYSMSG,SNDERR,SYSERR with new log macros

... with interface identifiers

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-11-06 15:57:13 +01:00
parent 492df4bb94
commit 62c8e635dc
82 changed files with 1292 additions and 1201 deletions

View file

@ -1003,11 +1003,11 @@ int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
int err;
/* the hw_params must be set at first!!! */
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
if (! params->avail_min) {
SNDMSG("params->avail_min is 0");
snd_check(PCM, "params->avail_min is 0");
return -EINVAL;
}
#if 0
@ -1016,7 +1016,7 @@ int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
*/
if (params->start_threshold <= pcm->buffer_size &&
params->start_threshold > (pcm->buffer_size / params->avail_min) * params->avail_min) {
SNDMSG("params->avail_min problem for start_threshold");
snd_check(PCM, "params->avail_min problem for start_threshold");
return -EINVAL;
}
#endif
@ -1110,7 +1110,7 @@ int snd_pcm_hwsync(snd_pcm_t *pcm)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_pcm_lock(pcm->fast_op_arg);
@ -1155,7 +1155,7 @@ int snd_pcm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_pcm_lock(pcm->fast_op_arg);
@ -1184,7 +1184,7 @@ int snd_pcm_resume(snd_pcm_t *pcm)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
/* lock handled in the callback */
@ -1213,7 +1213,7 @@ int snd_pcm_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_pcm_lock(pcm->fast_op_arg);
@ -1238,7 +1238,7 @@ int snd_pcm_prepare(snd_pcm_t *pcm)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
err = bad_pcm_state(pcm, ~P_STATE(DISCONNECTED), 0);
@ -1268,7 +1268,7 @@ int snd_pcm_reset(snd_pcm_t *pcm)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_pcm_lock(pcm->fast_op_arg);
@ -1293,7 +1293,7 @@ int snd_pcm_start(snd_pcm_t *pcm)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
err = bad_pcm_state(pcm, P_STATE(PREPARED), 0);
@ -1324,7 +1324,7 @@ int snd_pcm_drop(snd_pcm_t *pcm)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE | P_STATE(SETUP) |
@ -1361,7 +1361,7 @@ int snd_pcm_drain(snd_pcm_t *pcm)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE | P_STATE(SETUP), P_STATE(SETUP));
@ -1395,7 +1395,7 @@ int snd_pcm_pause(snd_pcm_t *pcm, int enable)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE, 0);
@ -1428,7 +1428,7 @@ snd_pcm_sframes_t snd_pcm_rewindable(snd_pcm_t *pcm)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE, 0);
@ -1459,7 +1459,7 @@ snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
if (frames == 0)
@ -1494,7 +1494,7 @@ snd_pcm_sframes_t snd_pcm_forwardable(snd_pcm_t *pcm)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE, 0);
@ -1529,7 +1529,7 @@ snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
if (frames == 0)
@ -1573,11 +1573,11 @@ snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_ufr
assert(pcm);
assert(size == 0 || buffer);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
if (pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED) {
SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
snd_check(PCM, "invalid access type %s", snd_pcm_access_name(pcm->access));
return -EINVAL;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE, 0);
@ -1612,11 +1612,11 @@ snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t
assert(pcm);
assert(size == 0 || bufs);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
if (pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) {
SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
snd_check(PCM, "invalid access type %s", snd_pcm_access_name(pcm->access));
return -EINVAL;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE, 0);
@ -1651,11 +1651,11 @@ snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t
assert(pcm);
assert(size == 0 || buffer);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
if (pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED) {
SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
snd_check(PCM, "invalid access type %s", snd_pcm_access_name(pcm->access));
return -EINVAL;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE, 0);
@ -1690,11 +1690,11 @@ snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t s
assert(pcm);
assert(size == 0 || bufs);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
if (pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) {
SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
snd_check(PCM, "invalid access type %s", snd_pcm_access_name(pcm->access));
return -EINVAL;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE, 0);
@ -1774,7 +1774,7 @@ static int __snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds,
if (pcm->fast_ops->poll_descriptors)
return pcm->fast_ops->poll_descriptors(pcm->fast_op_arg, pfds, space);
if (pcm->poll_fd < 0) {
SNDMSG("poll_fd < 0");
snd_check(PCM, "poll_fd < 0");
return -EIO;
}
if (space >= 1 && pfds) {
@ -2340,7 +2340,7 @@ int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out)
assert(pcm);
assert(out);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_output_printf(out, " stream : %s\n", snd_pcm_stream_name(pcm->stream));
@ -2370,7 +2370,7 @@ int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out)
assert(pcm);
assert(out);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_output_printf(out, " tstamp_mode : %s\n", snd_pcm_tstamp_mode_name(pcm->tstamp_mode));
@ -2449,7 +2449,7 @@ snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes)
{
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
return bytes * 8 / pcm->frame_bits;
@ -2465,7 +2465,7 @@ ssize_t snd_pcm_frames_to_bytes(snd_pcm_t *pcm, snd_pcm_sframes_t frames)
{
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
return frames * pcm->frame_bits / 8;
@ -2481,7 +2481,7 @@ long snd_pcm_bytes_to_samples(snd_pcm_t *pcm, ssize_t bytes)
{
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
return bytes * 8 / pcm->sample_bits;
@ -2497,7 +2497,7 @@ ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, long samples)
{
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
return samples * pcm->sample_bits / 8;
@ -2546,7 +2546,7 @@ int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm,
snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler)
{
if (handler->type != SND_ASYNC_HANDLER_PCM) {
SNDMSG("invalid handler type %d", handler->type);
snd_check(PCM, "invalid handler type %d", handler->type);
return NULL;
}
return handler->u.pcm;
@ -2582,29 +2582,29 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
snd_config_get_id(pcm_conf, &id);
val = NULL;
snd_config_get_ascii(pcm_conf, &val);
SNDERR("Invalid type for PCM %s%sdefinition (id: %s, value: %s)", name ? name : "", name ? " " : "", id, val);
snd_error(PCM, "Invalid type for PCM %s%sdefinition (id: %s, value: %s)", name ? name : "", name ? " " : "", id, val);
free(val);
return -EINVAL;
}
err = snd_config_search(pcm_conf, "type", &conf);
if (err < 0) {
SNDERR("type is not defined");
snd_error(PCM, "type is not defined");
return err;
}
err = snd_config_get_id(conf, &id);
if (err < 0) {
SNDERR("unable to get id");
snd_error(PCM, "unable to get id");
return err;
}
err = snd_config_get_string(conf, &str);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return err;
}
err = snd_config_search_definition(pcm_root, "pcm_type", str, &type_conf);
if (err >= 0) {
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for PCM type %s definition", str);
snd_error(PCM, "Invalid type for PCM type %s definition", str);
err = -EINVAL;
goto _err;
}
@ -2618,7 +2618,7 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
@ -2626,12 +2626,12 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "open") == 0) {
err = snd_config_get_string(n, &open_name);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
@ -2719,7 +2719,7 @@ static int snd_pcm_open_noupdate(snd_pcm_t **pcmp, snd_config_t *root,
err = snd_config_search_definition(root, "pcm", name, &pcm_conf);
if (err < 0) {
SNDERR("Unknown PCM %s", name);
snd_error(PCM, "Unknown PCM %s", name);
return err;
}
if (snd_config_get_string(pcm_conf, &str) >= 0)
@ -2972,7 +2972,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
npfds = __snd_pcm_poll_descriptors_count(pcm);
if (npfds <= 0 || npfds >= 16) {
SNDERR("Invalid poll_fds %d", npfds);
snd_error(PCM, "Invalid poll_fds %d", npfds);
return -EIO;
}
pfd = alloca(sizeof(*pfd) * npfds);
@ -2980,7 +2980,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
if (err < 0)
return err;
if (err != npfds) {
SNDMSG("invalid poll descriptors %d", err);
snd_check(PCM, "invalid poll descriptors %d", err);
return -EIO;
}
if (timeout == SND_PCM_WAIT_IO)
@ -2988,7 +2988,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
else if (timeout == SND_PCM_WAIT_DRAIN)
timeout = __snd_pcm_wait_drain_timeout(pcm);
else if (timeout < -1)
SNDMSG("invalid snd_pcm_wait timeout argument %d", timeout);
snd_check(PCM, "invalid snd_pcm_wait timeout argument %d", timeout);
do {
__snd_pcm_unlock(pcm->fast_op_arg);
err_poll = poll(pfd, npfds, timeout);
@ -3078,7 +3078,7 @@ snd_pcm_sframes_t snd_pcm_avail(snd_pcm_t *pcm)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_pcm_lock(pcm->fast_op_arg);
@ -3111,7 +3111,7 @@ int snd_pcm_avail_delay(snd_pcm_t *pcm,
assert(pcm && availp && delayp);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_pcm_lock(pcm->fast_op_arg);
@ -3251,7 +3251,7 @@ int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes
break;
}
default:
SNDMSG("invalid format width %d", width);
snd_check(PCM, "invalid format width %d", width);
return -EINVAL;
}
return 0;
@ -3421,7 +3421,7 @@ int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t
break;
}
default:
SNDMSG("invalid format width %d", width);
snd_check(PCM, "invalid format width %d", width);
return -EINVAL;
}
return 0;
@ -3446,11 +3446,11 @@ int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_
assert(dst_areas);
assert(src_areas);
if (! channels) {
SNDMSG("invalid channels %d", channels);
snd_check(PCM, "invalid channels %d", channels);
return -EINVAL;
}
if (! frames) {
SNDMSG("invalid frames %ld", frames);
snd_check(PCM, "invalid frames %ld", frames);
return -EINVAL;
}
while (channels > 0) {
@ -3589,7 +3589,7 @@ int snd_pcm_hw_params_can_mmap_sample_resolution(const snd_pcm_hw_params_t *para
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_MMAP_VALID);
@ -3609,7 +3609,7 @@ int snd_pcm_hw_params_is_double(const snd_pcm_hw_params_t *params)
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_DOUBLE);
@ -3629,7 +3629,7 @@ int snd_pcm_hw_params_is_batch(const snd_pcm_hw_params_t *params)
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_BATCH);
@ -3649,7 +3649,7 @@ int snd_pcm_hw_params_is_block_transfer(const snd_pcm_hw_params_t *params)
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_BLOCK_TRANSFER);
@ -3669,7 +3669,7 @@ int snd_pcm_hw_params_is_monotonic(const snd_pcm_hw_params_t *params)
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SND_PCM_INFO_MONOTONIC);
@ -3689,7 +3689,7 @@ int snd_pcm_hw_params_can_overrange(const snd_pcm_hw_params_t *params)
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_OVERRANGE);
@ -3709,7 +3709,7 @@ int snd_pcm_hw_params_can_pause(const snd_pcm_hw_params_t *params)
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_PAUSE);
@ -3729,7 +3729,7 @@ int snd_pcm_hw_params_can_resume(const snd_pcm_hw_params_t *params)
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_RESUME);
@ -3749,7 +3749,7 @@ int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params)
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_HALF_DUPLEX);
@ -3769,7 +3769,7 @@ int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params)
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_JOINT_DUPLEX);
@ -3789,7 +3789,7 @@ int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params)
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_SYNC_START);
@ -3805,7 +3805,7 @@ int snd_pcm_hw_params_can_disable_period_wakeup(const snd_pcm_hw_params_t *param
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_NO_PERIOD_WAKEUP);
@ -3828,7 +3828,7 @@ 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");
snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_PERFECT_DRAIN);
@ -3866,7 +3866,7 @@ int snd_pcm_hw_params_supports_audio_ts_type(const snd_pcm_hw_params_t *params,
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
switch (type) {
@ -3903,7 +3903,7 @@ int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
{
assert(params);
if (CHECK_SANITY(params->rate_den == 0)) {
SNDMSG("invalid rate_den value");
snd_check(PCM, "invalid rate_den value");
return -EINVAL;
}
*rate_num = params->rate_num;
@ -3933,7 +3933,7 @@ int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params)
{
assert(params);
if (CHECK_SANITY(params->msbits == 0)) {
SNDMSG("invalid msbits value");
snd_check(PCM, "invalid msbits value");
return -EINVAL;
}
return params->msbits;
@ -3952,7 +3952,7 @@ int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params)
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
snd_check(PCM, "invalid PCM info field");
return -EINVAL;
}
return params->fifo_size;
@ -6395,7 +6395,7 @@ int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
{
assert(pcm && params);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
__snd_pcm_lock(pcm); /* forced lock due to pcm field changes */
@ -6498,7 +6498,7 @@ int snd_pcm_sw_params_set_start_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params
params->start_threshold = pcm->boundary;
break;
default:
SNDMSG("invalid start mode value %d", val);
snd_check(PCM, "invalid start mode value %d", val);
return -EINVAL;
}
return 0;
@ -6546,7 +6546,7 @@ int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params,
params->stop_threshold = pcm->boundary;
break;
default:
SNDMSG("invalid xrun mode value %d", val);
snd_check(PCM, "invalid xrun mode value %d", val);
return -EINVAL;
}
return 0;
@ -6587,7 +6587,7 @@ int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *param
{
assert(pcm && params);
if (CHECK_SANITY(val > SND_PCM_TSTAMP_LAST)) {
SNDMSG("invalid tstamp_mode value %d", val);
snd_check(PCM, "invalid tstamp_mode value %d", val);
return -EINVAL;
}
params->tstamp_mode = val;
@ -6622,7 +6622,7 @@ int snd_pcm_sw_params_set_tstamp_type(snd_pcm_t *pcm, snd_pcm_sw_params_t *param
{
assert(pcm && params);
if (CHECK_SANITY(val > SND_PCM_TSTAMP_TYPE_LAST)) {
SNDMSG("invalid tstamp_type value %d", val);
snd_check(PCM, "invalid tstamp_type value %d", val);
return -EINVAL;
}
params->tstamp_type = val;
@ -6893,8 +6893,9 @@ int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t
{
assert(pcm && params);
if (CHECK_SANITY(val >= pcm->buffer_size)) {
SNDMSG("invalid silent_threshold value %ld (buffer_size = %ld)",
val, pcm->buffer_size);
snd_check(PCM, "invalid silent_threshold value %ld (buffer_size = %ld)",
val, pcm->buffer_size);
return -EINVAL;
}
params->silence_threshold = val;
@ -6951,8 +6952,9 @@ int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *para
{
assert(pcm && params);
if (CHECK_SANITY(val < pcm->boundary && val > pcm->buffer_size)) {
SNDMSG("invalid silence_size %ld (boundary %ld, buffer_size %ld)",
val, pcm->boundary, pcm->buffer_size);
snd_check(PCM, "invalid silence_size %ld (boundary %ld, buffer_size %ld)",
val, pcm->boundary, pcm->buffer_size);
return -EINVAL;
}
params->silence_size = val;
@ -7566,13 +7568,15 @@ snd_pcm_sframes_t __snd_pcm_mmap_commit(snd_pcm_t *pcm,
{
assert(pcm);
if (CHECK_SANITY(offset != *pcm->appl.ptr % pcm->buffer_size)) {
SNDMSG("commit offset (%ld) doesn't match with appl_ptr (%ld) %% buf_size (%ld)",
offset, *pcm->appl.ptr, pcm->buffer_size);
snd_check(PCM, "commit offset (%ld) doesn't match with appl_ptr (%ld) %% buf_size (%ld)",
offset, *pcm->appl.ptr, pcm->buffer_size);
return -EPIPE;
}
if (CHECK_SANITY(frames > snd_pcm_mmap_avail(pcm))) {
SNDMSG("commit frames (%ld) overflow (avail = %ld)", frames,
snd_pcm_mmap_avail(pcm));
snd_check(PCM, "commit frames (%ld) overflow (avail = %ld)", frames,
snd_pcm_mmap_avail(pcm));
return -EPIPE;
}
if (pcm->fast_ops->mmap_commit)
@ -7831,13 +7835,13 @@ int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf,
if (snd_config_get_string(conf, &str) >= 0) {
err = snd_config_search_definition(root, "pcm_slave", str, &conf);
if (err < 0) {
SNDERR("Invalid slave definition");
snd_error(PCM, "Invalid slave definition");
return -EINVAL;
}
to_free = 1;
}
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid slave definition");
snd_error(PCM, "Invalid slave definition");
err = -EINVAL;
goto _err;
}
@ -7877,7 +7881,7 @@ int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf,
err = snd_config_get_string(n, &str);
if (err < 0) {
_invalid:
SNDERR("invalid type for %s", id);
snd_error(PCM, "invalid type for %s", id);
goto _err;
}
if ((fields[k].flags & SCONF_UNCHANGED) &&
@ -7887,7 +7891,7 @@ int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf,
}
f = snd_pcm_format_value(str);
if (f == SND_PCM_FORMAT_UNKNOWN) {
SNDERR("unknown format %s", str);
snd_error(PCM, "unknown format %s", str);
err = -EINVAL;
goto _err;
}
@ -7914,18 +7918,18 @@ int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf,
}
if (k < count)
continue;
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
if (!pcm_conf) {
SNDERR("missing field pcm");
snd_error(PCM, "missing field pcm");
err = -EINVAL;
goto _err;
}
for (k = 0; k < count; ++k) {
if ((fields[k].flags & SCONF_MANDATORY) && !fields[k].present) {
SNDERR("missing field %s", names[fields[k].index]);
snd_error(PCM, "missing field %s", names[fields[k].index]);
err = -EINVAL;
goto _err;
}
@ -8779,10 +8783,10 @@ int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent)
else
s = "overrun";
if (!silent)
SNDERR("%s occurred", s);
snd_error(PCM, "%s occurred", s);
err = snd_pcm_prepare(pcm);
if (err < 0) {
SNDERR("cannot recovery from %s, prepare failed: %s", s, snd_strerror(err));
snd_error(PCM, "cannot recovery from %s, prepare failed: %s", s, snd_strerror(err));
return err;
}
return 0;
@ -8794,7 +8798,7 @@ int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent)
if (err < 0) {
err = snd_pcm_prepare(pcm);
if (err < 0) {
SNDERR("cannot recovery from suspend, prepare failed: %s", snd_strerror(err));
snd_error(PCM, "cannot recovery from suspend, prepare failed: %s", snd_strerror(err));
return err;
}
}
@ -8833,36 +8837,41 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
/* choose all parameters */
err = snd_pcm_hw_params_any(pcm, &params);
if (err < 0) {
SNDERR("Broken configuration for %s: no configurations available",
s);
snd_error(PCM, "Broken configuration for %s: no configurations available",
s);
return err;
}
/* set software resampling */
err = snd_pcm_hw_params_set_rate_resample(pcm, &params, soft_resample);
if (err < 0) {
SNDERR("Resampling setup failed for %s: %s",
s, snd_strerror(err));
snd_error(PCM, "Resampling setup failed for %s: %s",
s, snd_strerror(err));
return err;
}
/* set the selected read/write format */
err = snd_pcm_hw_params_set_access(pcm, &params, access);
if (err < 0) {
SNDERR("Access type not available for %s: %s",
s, snd_strerror(err));
snd_error(PCM, "Access type not available for %s: %s",
s, snd_strerror(err));
return err;
}
/* set the sample format */
err = snd_pcm_hw_params_set_format(pcm, &params, format);
if (err < 0) {
SNDERR("Sample format not available for %s: %s",
s, snd_strerror(err));
snd_error(PCM, "Sample format not available for %s: %s",
s, snd_strerror(err));
return err;
}
/* set the count of channels */
err = snd_pcm_hw_params_set_channels(pcm, &params, channels);
if (err < 0) {
SNDERR("Channels count (%i) not available for %s: %s",
channels, s, snd_strerror(err));
snd_error(PCM, "Channels count (%i) not available for %s: %s",
channels, s, snd_strerror(err));
return err;
}
/* set the stream rate */
@ -8870,13 +8879,15 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
err = INTERNAL(snd_pcm_hw_params_set_rate_near)(pcm, &params, &rrate,
0);
if (err < 0) {
SNDERR("Rate %iHz not available for playback: %s",
rate, snd_strerror(err));
snd_error(PCM, "Rate %iHz not available for playback: %s",
rate, snd_strerror(err));
return err;
}
if (rrate != rate) {
SNDERR("Rate doesn't match (requested %iHz, get %iHz)",
rate, rrate);
snd_error(PCM, "Rate doesn't match (requested %iHz, get %iHz)",
rate, rrate);
return -EINVAL;
}
/* set the buffer time */
@ -8891,30 +8902,34 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
err = INTERNAL(snd_pcm_hw_params_set_period_time_near)(pcm,
&params, &period_time, NULL);
if (err < 0) {
SNDERR("Unable to set period time %i for %s: %s",
period_time, s, snd_strerror(err));
snd_error(PCM, "Unable to set period time %i for %s: %s",
period_time, s, snd_strerror(err));
return err;
}
err = INTERNAL(snd_pcm_hw_params_get_period_size)(&params,
&period_size, NULL);
if (err < 0) {
SNDERR("Unable to get period size for %s: %s",
s, snd_strerror(err));
snd_error(PCM, "Unable to get period size for %s: %s",
s, snd_strerror(err));
return err;
}
buffer_size = period_size * 4;
err = INTERNAL(snd_pcm_hw_params_set_buffer_size_near)(pcm,
&params, &buffer_size);
if (err < 0) {
SNDERR("Unable to set buffer size %lu %s: %s",
buffer_size, s, snd_strerror(err));
snd_error(PCM, "Unable to set buffer size %lu %s: %s",
buffer_size, s, snd_strerror(err));
return err;
}
err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(&params,
&buffer_size);
if (err < 0) {
SNDERR("Unable to get buffer size for %s: %s",
s, snd_strerror(err));
snd_error(PCM, "Unable to get buffer size for %s: %s",
s, snd_strerror(err));
return err;
}
} else {
@ -8922,15 +8937,17 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(&params,
&buffer_size);
if (err < 0) {
SNDERR("Unable to get buffer size for %s: %s",
s, snd_strerror(err));
snd_error(PCM, "Unable to get buffer size for %s: %s",
s, snd_strerror(err));
return err;
}
err = INTERNAL(snd_pcm_hw_params_get_buffer_time)(&params,
&latency, NULL);
if (err < 0) {
SNDERR("Unable to get buffer time (latency) for %s: %s",
s, snd_strerror(err));
snd_error(PCM, "Unable to get buffer time (latency) for %s: %s",
s, snd_strerror(err));
return err;
}
/* set the period time */
@ -8938,31 +8955,35 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
err = INTERNAL(snd_pcm_hw_params_set_period_time_near)(pcm,
&params, &period_time, NULL);
if (err < 0) {
SNDERR("Unable to set period time %i for %s: %s",
period_time, s, snd_strerror(err));
snd_error(PCM, "Unable to set period time %i for %s: %s",
period_time, s, snd_strerror(err));
return err;
}
err = INTERNAL(snd_pcm_hw_params_get_period_size)(&params,
&period_size, NULL);
if (err < 0) {
SNDERR("Unable to get period size for %s: %s",
s, snd_strerror(err));
snd_error(PCM, "Unable to get period size for %s: %s",
s, snd_strerror(err));
return err;
}
}
/* write the parameters to device */
err = snd_pcm_hw_params(pcm, &params);
if (err < 0) {
SNDERR("Unable to set hw params for %s: %s",
s, snd_strerror(err));
snd_error(PCM, "Unable to set hw params for %s: %s",
s, snd_strerror(err));
return err;
}
/* get the current swparams */
err = snd_pcm_sw_params_current(pcm, &swparams);
if (err < 0) {
SNDERR("Unable to determine current swparams for %s: %s",
s, snd_strerror(err));
snd_error(PCM, "Unable to determine current swparams for %s: %s",
s, snd_strerror(err));
return err;
}
/*
@ -8972,8 +8993,9 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
err = snd_pcm_sw_params_set_start_threshold(pcm, &swparams,
(buffer_size / period_size) * period_size);
if (err < 0) {
SNDERR("Unable to set start threshold mode for %s: %s",
s, snd_strerror(err));
snd_error(PCM, "Unable to set start threshold mode for %s: %s",
s, snd_strerror(err));
return err;
}
/*
@ -8982,15 +9004,17 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
*/
err = snd_pcm_sw_params_set_avail_min(pcm, &swparams, period_size);
if (err < 0) {
SNDERR("Unable to set avail min for %s: %s",
s, snd_strerror(err));
snd_error(PCM, "Unable to set avail min for %s: %s",
s, snd_strerror(err));
return err;
}
/* write the parameters to the playback device */
err = snd_pcm_sw_params(pcm, &swparams);
if (err < 0) {
SNDERR("Unable to set sw params for %s: %s",
s, snd_strerror(err));
snd_error(PCM, "Unable to set sw params for %s: %s",
s, snd_strerror(err));
return err;
}
return 0;

View file

@ -650,11 +650,11 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
slave = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
@ -664,7 +664,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_IMA_ADPCM) {
snd_config_delete(sconf);
SNDERR("invalid slave format");
snd_error(PCM, "invalid slave format");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);

View file

@ -525,11 +525,11 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
slave = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
@ -539,7 +539,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_A_LAW) {
snd_config_delete(sconf);
SNDERR("invalid slave format");
snd_error(PCM, "invalid slave format");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);

View file

@ -98,12 +98,13 @@ int _snd_pcm_asym_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED,
slave = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (! slave) {
SNDERR("%s slave is not defined",
stream == SND_PCM_STREAM_PLAYBACK ? "playback" : "capture");
snd_error(PCM, "%s slave is not defined",
stream == SND_PCM_STREAM_PLAYBACK ? "playback" : "capture");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);

View file

@ -278,11 +278,11 @@ int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
slave = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);

View file

@ -212,7 +212,7 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm,
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (sock < 0) {
int result = -errno;
SYSERR("socket failed");
snd_errornum(PCM, "socket failed");
return result;
}
@ -225,13 +225,13 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm,
if (server) {
if (bind(sock, (struct sockaddr *) addr, size) < 0) {
int result = -errno;
SYSERR("bind failed: %s", filename);
snd_errornum(PCM, "bind failed: %s", filename);
close(sock);
return result;
} else {
if (chmod(filename, ipc_perm) < 0) {
int result = -errno;
SYSERR("chmod failed: %s", filename);
snd_errornum(PCM, "chmod failed: %s", filename);
close(sock);
unlink(filename);
return result;
@ -239,7 +239,7 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm,
if (chown(filename, -1, ipc_gid) < 0) {
#if 0 /* it's not fatal */
int result = -errno;
SYSERR("chown failed: %s", filename);
snd_errornum(PCM, "chown failed: %s", filename);
close(sock);
unlink(filename);
return result;
@ -249,7 +249,7 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm,
} else {
if (connect(sock, (struct sockaddr *) addr, size) < 0) {
int result = -errno;
SYSERR("connect failed: %s", filename);
snd_errornum(PCM, "connect failed: %s", filename);
close(sock);
return result;
}
@ -585,7 +585,7 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
semerr = snd_pcm_direct_semaphore_down(direct,
DIRECT_IPC_SEM_CLIENT);
if (semerr < 0) {
SNDERR("SEMDOWN FAILED with err %d", semerr);
snd_error(PCM, "SEMDOWN FAILED with err %d", semerr);
return semerr;
}
@ -595,7 +595,7 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
semerr = snd_pcm_direct_semaphore_up(direct,
DIRECT_IPC_SEM_CLIENT);
if (semerr < 0) {
SNDERR("SEMUP FAILED with err %d", semerr);
snd_error(PCM, "SEMUP FAILED with err %d", semerr);
return semerr;
}
return 0;
@ -621,11 +621,11 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
ret = snd_pcm_prepare(direct->spcm);
if (ret < 0) {
SNDERR("recover: unable to prepare slave");
snd_error(PCM, "recover: unable to prepare slave");
semerr = snd_pcm_direct_semaphore_up(direct,
DIRECT_IPC_SEM_CLIENT);
if (semerr < 0) {
SNDERR("SEMUP FAILED with err %d", semerr);
snd_error(PCM, "SEMUP FAILED with err %d", semerr);
return semerr;
}
return ret;
@ -641,11 +641,11 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
ret = snd_pcm_start(direct->spcm);
if (ret < 0) {
SNDERR("recover: unable to start slave");
snd_error(PCM, "recover: unable to start slave");
semerr = snd_pcm_direct_semaphore_up(direct,
DIRECT_IPC_SEM_CLIENT);
if (semerr < 0) {
SNDERR("SEMUP FAILED with err %d", semerr);
snd_error(PCM, "SEMUP FAILED with err %d", semerr);
return semerr;
}
return ret;
@ -653,7 +653,7 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
semerr = snd_pcm_direct_semaphore_up(direct,
DIRECT_IPC_SEM_CLIENT);
if (semerr < 0) {
SNDERR("SEMUP FAILED with err %d", semerr);
snd_error(PCM, "SEMUP FAILED with err %d", semerr);
return semerr;
}
return 0;
@ -727,7 +727,7 @@ int snd_pcm_direct_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds,
unsigned int space)
{
if (pcm->poll_fd < 0) {
SNDMSG("poll_fd < 0");
snd_check(PCM, "poll_fd < 0");
return -EIO;
}
if (space >= 1 && pfds) {
@ -845,7 +845,7 @@ static int hw_param_interval_refine_one(snd_pcm_hw_params_t *params,
return 0;
i = hw_param_interval(params, var);
if (snd_interval_empty(i)) {
SNDERR("dshare interval %i empty?", (int)var);
snd_error(PCM, "dshare interval %i empty?", (int)var);
return -EINVAL;
}
if (snd_interval_refine(i, src))
@ -910,7 +910,7 @@ int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
#endif
if (params->rmask & (1<<SND_PCM_HW_PARAM_ACCESS)) {
if (snd_mask_empty(hw_param_mask(params, SND_PCM_HW_PARAM_ACCESS))) {
SNDERR("dshare access mask empty?");
snd_error(PCM, "dshare access mask empty?");
return -EINVAL;
}
if (snd_mask_refine(hw_param_mask(params, SND_PCM_HW_PARAM_ACCESS), &access))
@ -918,7 +918,7 @@ int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
}
if (params->rmask & (1<<SND_PCM_HW_PARAM_FORMAT)) {
if (snd_mask_empty(hw_param_mask(params, SND_PCM_HW_PARAM_FORMAT))) {
SNDERR("dshare format mask empty?");
snd_error(PCM, "dshare format mask empty?");
return -EINVAL;
}
if (snd_mask_refine_set(hw_param_mask(params, SND_PCM_HW_PARAM_FORMAT),
@ -928,7 +928,7 @@ int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
//snd_mask_none(hw_param_mask(params, SND_PCM_HW_PARAM_SUBFORMAT));
if (params->rmask & (1<<SND_PCM_HW_PARAM_CHANNELS)) {
if (snd_interval_empty(hw_param_interval(params, SND_PCM_HW_PARAM_CHANNELS))) {
SNDERR("dshare channels mask empty?");
snd_error(PCM, "dshare channels mask empty?");
return -EINVAL;
}
err = snd_interval_refine_set(hw_param_interval(params, SND_PCM_HW_PARAM_CHANNELS), dshare->channels);
@ -1203,12 +1203,12 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
__again:
if (loops-- <= 0) {
SNDERR("unable to find a valid configuration for slave");
snd_error(PCM, "unable to find a valid configuration for slave");
return -EINVAL;
}
ret = snd_pcm_hw_params_any(spcm, &hw_params);
if (ret < 0) {
SNDERR("snd_pcm_hw_params_any failed");
snd_error(PCM, "snd_pcm_hw_params_any failed");
return ret;
}
ret = snd_pcm_hw_params_set_access(spcm, &hw_params,
@ -1217,7 +1217,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
ret = snd_pcm_hw_params_set_access(spcm, &hw_params,
SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
if (ret < 0) {
SNDERR("slave plugin does not support mmap interleaved or mmap noninterleaved access");
snd_error(PCM, "slave plugin does not support mmap interleaved or mmap noninterleaved access");
return ret;
}
}
@ -1254,7 +1254,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
&hw_params, &format);
}
if (ret < 0) {
SNDERR("requested or auto-format is not available");
snd_error(PCM, "requested or auto-format is not available");
return ret;
}
params->format = format;
@ -1262,13 +1262,13 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
ret = INTERNAL(snd_pcm_hw_params_set_channels_near)(spcm, &hw_params,
(unsigned int *)&params->channels);
if (ret < 0) {
SNDERR("requested count of channels is not available");
snd_error(PCM, "requested count of channels is not available");
return ret;
}
ret = INTERNAL(snd_pcm_hw_params_set_rate_near)(spcm, &hw_params,
(unsigned int *)&params->rate, 0);
if (ret < 0) {
SNDERR("requested rate is not available");
snd_error(PCM, "requested rate is not available");
return ret;
}
@ -1277,14 +1277,14 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
ret = INTERNAL(snd_pcm_hw_params_set_buffer_time_near)(spcm,
&hw_params, (unsigned int *)&params->buffer_time, 0);
if (ret < 0) {
SNDERR("unable to set buffer time");
snd_error(PCM, "unable to set buffer time");
return ret;
}
} else if (params->buffer_size > 0) {
ret = INTERNAL(snd_pcm_hw_params_set_buffer_size_near)(spcm,
&hw_params, (snd_pcm_uframes_t *)&params->buffer_size);
if (ret < 0) {
SNDERR("unable to set buffer size");
snd_error(PCM, "unable to set buffer size");
return ret;
}
} else {
@ -1295,7 +1295,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
ret = INTERNAL(snd_pcm_hw_params_set_period_time_near)(spcm,
&hw_params, (unsigned int *)&params->period_time, 0);
if (ret < 0) {
SNDERR("unable to set period_time");
snd_error(PCM, "unable to set period_time");
return ret;
}
} else if (params->period_size > 0) {
@ -1303,7 +1303,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
&hw_params, (snd_pcm_uframes_t *)&params->period_size,
0);
if (ret < 0) {
SNDERR("unable to set period_size");
snd_error(PCM, "unable to set period_size");
return ret;
}
}
@ -1313,7 +1313,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
ret = INTERNAL(snd_pcm_hw_params_set_periods_near)(spcm,
&hw_params, &params->periods, 0);
if (ret < 0) {
SNDERR("unable to set requested periods");
snd_error(PCM, "unable to set requested periods");
return ret;
}
if (params->periods == 1) {
@ -1325,14 +1325,14 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
params->period_size /= 2;
goto __again;
}
SNDERR("unable to use stream with periods == 1");
snd_error(PCM, "unable to use stream with periods == 1");
return ret;
}
}
ret = snd_pcm_hw_params(spcm, &hw_params);
if (ret < 0) {
SNDERR("unable to install hw params");
snd_error(PCM, "unable to install hw params");
return ret;
}
@ -1356,18 +1356,18 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
ret = snd_pcm_sw_params_current(spcm, &sw_params);
if (ret < 0) {
SNDERR("unable to get current sw_params");
snd_error(PCM, "unable to get current sw_params");
return ret;
}
ret = snd_pcm_sw_params_get_boundary(&sw_params, &boundary);
if (ret < 0) {
SNDERR("unable to get boundary");
snd_error(PCM, "unable to get boundary");
return ret;
}
ret = snd_pcm_sw_params_set_stop_threshold(spcm, &sw_params, boundary);
if (ret < 0) {
SNDERR("unable to set stop threshold");
snd_error(PCM, "unable to set stop threshold");
return ret;
}
@ -1378,7 +1378,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
ret = snd_pcm_sw_params_set_tstamp_mode(spcm, &sw_params,
SND_PCM_TSTAMP_ENABLE);
if (ret < 0) {
SNDERR("unable to tstamp mode MMAP");
snd_error(PCM, "unable to tstamp mode MMAP");
return ret;
}
@ -1386,7 +1386,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
ret = snd_pcm_sw_params_set_tstamp_type(spcm, &sw_params,
dmix->tstamp_type);
if (ret < 0) {
SNDERR("unable to set tstamp type");
snd_error(PCM, "unable to set tstamp type");
return ret;
}
}
@ -1397,12 +1397,12 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
ret = snd_pcm_sw_params_set_silence_threshold(spcm, &sw_params, 0);
if (ret < 0) {
SNDERR("unable to set silence threshold");
snd_error(PCM, "unable to set silence threshold");
return ret;
}
ret = snd_pcm_sw_params_set_silence_size(spcm, &sw_params, boundary);
if (ret < 0) {
SNDERR("unable to set silence threshold (please upgrade to 0.9.0rc8+ driver)");
snd_error(PCM, "unable to set silence threshold (please upgrade to 0.9.0rc8+ driver)");
return ret;
}
@ -1410,7 +1410,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
ret = snd_pcm_sw_params(spcm, &sw_params);
if (ret < 0) {
SNDERR("unable to install sw params (please upgrade to 0.9.0rc8+ driver)");
snd_error(PCM, "unable to install sw params (please upgrade to 0.9.0rc8+ driver)");
return ret;
}
@ -1423,12 +1423,12 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
ret = snd_pcm_start(spcm);
if (ret < 0) {
SNDERR("unable to start PCM stream");
snd_error(PCM, "unable to start PCM stream");
return ret;
}
if (snd_pcm_poll_descriptors_count(spcm) != 1) {
SNDERR("unable to use hardware pcm with fd more than one!!!");
snd_error(PCM, "unable to use hardware pcm with fd more than one!!!");
return ret;
}
snd_pcm_poll_descriptors(spcm, &fd, 1);
@ -1476,7 +1476,7 @@ int snd_pcm_direct_initialize_poll_fd(snd_pcm_direct_t *dmix)
dmix->timer_ticks = 1;
ret = snd_pcm_info(dmix->spcm, &info);
if (ret < 0) {
SNDERR("unable to info for slave pcm");
snd_error(PCM, "unable to info for slave pcm");
return ret;
}
sprintf(name, "hw:CLASS=%i,SCLASS=0,CARD=%i,DEV=%i,SUBDEV=%i",
@ -1491,13 +1491,13 @@ int snd_pcm_direct_initialize_poll_fd(snd_pcm_direct_t *dmix)
ret = snd_timer_open(&dmix->timer, name,
SND_TIMER_OPEN_NONBLOCK);
if (ret < 0) {
SNDERR("unable to open timer '%s'", name);
snd_error(PCM, "unable to open timer '%s'", name);
return ret;
}
}
if (snd_timer_poll_descriptors_count(dmix->timer) != 1) {
SNDERR("unable to use timer '%s' with more than one fd!", name);
snd_error(PCM, "unable to use timer '%s' with more than one fd!", name);
return ret;
}
snd_timer_poll_descriptors(dmix->timer, &dmix->timer_fd, 1);
@ -1598,7 +1598,7 @@ int snd_pcm_direct_open_secondary_client(snd_pcm_t **spcmp, snd_pcm_direct_t *dm
ret = snd_pcm_hw_open_fd(spcmp, client_name, dmix->hw_fd, 0);
if (ret < 0) {
SNDERR("unable to open hardware");
snd_error(PCM, "unable to open hardware");
return ret;
}
@ -1616,7 +1616,7 @@ int snd_pcm_direct_open_secondary_client(snd_pcm_t **spcmp, snd_pcm_direct_t *dm
ret = snd_pcm_mmap(spcm);
if (ret < 0) {
SNDERR("unable to mmap channels");
snd_error(PCM, "unable to mmap channels");
return ret;
}
return 0;
@ -1643,7 +1643,7 @@ int snd_pcm_direct_initialize_secondary_slave(snd_pcm_direct_t *dmix,
ret = snd_pcm_mmap(spcm);
if (ret < 0) {
SNDERR("unable to mmap channels");
snd_error(PCM, "unable to mmap channels");
return ret;
}
return 0;
@ -1666,7 +1666,7 @@ int snd_pcm_direct_set_timer_params(snd_pcm_direct_t *dmix)
}
ret = snd_timer_params(dmix->timer, &params);
if (ret < 0) {
SNDERR("unable to set timer parameters");
snd_error(PCM, "unable to set timer parameters");
return ret;
}
return 0;
@ -1729,7 +1729,7 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
if (cfg == NULL)
return 0;
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("invalid type for bindings");
snd_error(PCM, "invalid type for bindings");
return -EINVAL;
}
snd_config_for_each(i, next, cfg) {
@ -1740,7 +1740,7 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
continue;
err = safe_strtol(id, &cchannel);
if (err < 0 || cchannel < 0) {
SNDERR("invalid client channel in binding: %s", id);
snd_error(PCM, "invalid client channel in binding: %s", id);
return -EINVAL;
}
if ((unsigned)cchannel >= count)
@ -1749,7 +1749,7 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
if (count == 0)
return 0;
if (count > 1024) {
SNDERR("client channel out of range");
snd_error(PCM, "client channel out of range");
return -EINVAL;
}
bindings = malloc(count * sizeof(unsigned int));
@ -1765,13 +1765,14 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
continue;
safe_strtol(id, &cchannel);
if (snd_config_get_integer(n, &schannel) < 0) {
SNDERR("unable to get slave channel (should be integer type) in binding: %s", id);
snd_error(PCM, "unable to get slave channel (should be integer type) in binding: %s", id);
free(bindings);
return -EINVAL;
}
if (schannel < 0 || schannel >= params->channels) {
SNDERR("invalid slave channel number %ld in binding to %ld",
schannel, cchannel);
snd_error(PCM, "invalid slave channel number %ld in binding to %ld",
schannel, cchannel);
free(bindings);
return -EINVAL;
}
@ -1785,7 +1786,7 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
if (chn == chn1)
continue;
if (bindings[chn] == dmix->bindings[chn1]) {
SNDERR("unable to route channels %d,%d to same destination %d", chn, chn1, bindings[chn]);
snd_error(PCM, "unable to route channels %d,%d to same destination %d", chn, chn1, bindings[chn]);
free(bindings);
return -EINVAL;
}
@ -1814,12 +1815,12 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
if (snd_config_get_string(sconf, &str) >= 0) {
if (hop > SND_CONF_MAX_HOPS) {
SNDERR("Too many definition levels (looped?)");
snd_error(PCM, "Too many definition levels (looped?)");
return -EINVAL;
}
err = snd_config_search_definition(root, "pcm", str, &pcm_conf);
if (err < 0) {
SNDERR("Unknown slave PCM %s", str);
snd_error(PCM, "Unknown slave PCM %s", str);
return err;
}
err = _snd_pcm_direct_get_slave_ipc_offset(root, pcm_conf,
@ -1869,11 +1870,11 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
if (strcmp(id, "type") == 0) {
err = snd_config_get_string(n, &str);
if (err < 0) {
SNDERR("Invalid value for PCM type definition");
snd_error(PCM, "Invalid value for PCM type definition");
return -EINVAL;
}
if (strcmp(str, "hw")) {
SNDERR("Invalid type '%s' for slave PCM", str);
snd_error(PCM, "Invalid type '%s' for slave PCM", str);
return -EINVAL;
}
continue;
@ -1888,7 +1889,7 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
if (strcmp(id, "device") == 0) {
err = snd_config_get_integer(n, &device);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return err;
}
continue;
@ -1896,7 +1897,7 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
if (strcmp(id, "subdevice") == 0) {
err = snd_config_get_integer(n, &subdevice);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return err;
}
continue;
@ -1959,7 +1960,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
long key;
err = snd_config_get_integer(n, &key);
if (err < 0) {
SNDERR("The field ipc_key must be an integer type");
snd_error(PCM, "The field ipc_key must be an integer type");
return err;
}
@ -1970,11 +1971,11 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
long perm;
err = snd_config_get_integer(n, &perm);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return err;
}
if ((perm & ~0777) != 0) {
SNDERR("The field ipc_perm must be a valid file permission");
snd_error(PCM, "The field ipc_perm must be a valid file permission");
return -EINVAL;
}
rec->ipc_perm = perm;
@ -1984,7 +1985,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
const char *str;
err = snd_config_get_string(n, &str);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
if (strcmp(str, "no") == 0 || strcmp(str, "off") == 0)
@ -1996,7 +1997,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
else if (strcmp(str, "auto") == 0)
rec->hw_ptr_alignment = SND_PCM_HW_PTR_ALIGNMENT_AUTO;
else {
SNDERR("The field hw_ptr_alignment is invalid : %s", str);
snd_error(PCM, "The field hw_ptr_alignment is invalid : %s", str);
return -EINVAL;
}
@ -2006,7 +2007,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
const char *str;
err = snd_config_get_string(n, &str);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
if (strcmp(str, "default") == 0)
@ -2018,7 +2019,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
else if (strcmp(str, "monotonic_raw") == 0)
rec->tstamp_type = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW;
else {
SNDERR("The field tstamp_type is invalid : %s", str);
snd_error(PCM, "The field tstamp_type is invalid : %s", str);
return -EINVAL;
}
continue;
@ -2028,7 +2029,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
char *endp;
err = snd_config_get_ascii(n, &group);
if (err < 0) {
SNDERR("The field ipc_gid must be a valid group");
snd_error(PCM, "The field ipc_gid must be a valid group");
return err;
}
if (! *group) {
@ -2045,7 +2046,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
return -ENOMEM;
int st = getgrnam_r(group, &grp, buffer, len, &pgrp);
if (st != 0 || !pgrp) {
SNDERR("The field ipc_gid must be a valid group (create group %s)", group);
snd_error(PCM, "The field ipc_gid must be a valid group (create group %s)", group);
free(buffer);
return -EINVAL;
}
@ -2059,7 +2060,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
}
if (strcmp(id, "ipc_key_add_uid") == 0) {
if ((err = snd_config_get_bool(n)) < 0) {
SNDERR("The field ipc_key_add_uid must be a boolean type");
snd_error(PCM, "The field ipc_key_add_uid must be a boolean type");
return err;
}
ipc_key_add_uid = err;
@ -2102,15 +2103,15 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
rec->direct_memory_access = err;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!rec->slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
if (!rec->ipc_key) {
SNDERR("Unique IPC key is not defined");
snd_error(PCM, "Unique IPC key is not defined");
return -EINVAL;
}
if (ipc_key_add_uid)
@ -2175,7 +2176,7 @@ int _snd_pcm_direct_new(snd_pcm_t **pcmp, snd_pcm_direct_t **_dmix, int type,
while (1) {
ret = snd_pcm_direct_semaphore_create_or_connect(dmix);
if (ret < 0) {
SNDERR("unable to create IPC semaphore");
snd_error(PCM, "unable to create IPC semaphore");
goto _err_nosem_free;
}
ret = snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
@ -2190,7 +2191,7 @@ int _snd_pcm_direct_new(snd_pcm_t **pcmp, snd_pcm_direct_t **_dmix, int type,
ret = snd_pcm_direct_shm_create_or_connect(dmix);
if (ret < 0) {
SNDERR("unable to create IPC shm instance");
snd_error(PCM, "unable to create IPC shm instance");
snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
goto _err_nosem_free;
} else {

View file

@ -308,7 +308,7 @@ static inline int snd_pcm_direct_semaphore_up(snd_pcm_direct_t *dmix, int sem_nu
static inline int snd_pcm_direct_semaphore_final(snd_pcm_direct_t *dmix, int sem_num)
{
if (dmix->locked[sem_num] != 1) {
SNDMSG("invalid semaphore count to finalize %d: %d", sem_num, dmix->locked[sem_num]);
snd_check(PCM, "invalid semaphore count to finalize %d: %d", sem_num, dmix->locked[sem_num]);
return -EBUSY;
}
return snd_pcm_direct_semaphore_up(dmix, sem_num);

View file

@ -970,7 +970,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
assert(pcmp);
if (stream != SND_PCM_STREAM_PLAYBACK) {
SNDERR("The dmix plugin supports only playback stream");
snd_error(PCM, "The dmix plugin supports only playback stream");
return -EINVAL;
}
@ -997,19 +997,19 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
mode | SND_PCM_NONBLOCK, NULL);
if (ret < 0) {
SNDERR("unable to open slave");
snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
SNDERR("dmix plugin can be only connected to hw plugin");
snd_error(PCM, "dmix plugin can be only connected to hw plugin");
ret = -EINVAL;
goto _err;
}
ret = snd_pcm_direct_initialize_slave(dmix, spcm, params);
if (ret < 0) {
SNDERR("unable to initialize slave");
snd_error(PCM, "unable to initialize slave");
goto _err;
}
@ -1020,7 +1020,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
ret = snd_pcm_direct_server_create(dmix);
if (ret < 0) {
SNDERR("unable to create server");
snd_error(PCM, "unable to create server");
goto _err;
}
}
@ -1032,7 +1032,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
ret = snd_pcm_direct_client_connect(dmix);
if (ret < 0) {
SNDERR("unable to connect client");
snd_error(PCM, "unable to connect client");
goto _err_nosem;
}
@ -1054,18 +1054,18 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
first_instance = 1;
goto retry;
}
SNDERR("unable to open slave");
snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
SNDERR("dmix plugin can be only connected to hw plugin");
snd_error(PCM, "dmix plugin can be only connected to hw plugin");
ret = -EINVAL;
goto _err;
}
ret = snd_pcm_direct_initialize_secondary_slave(dmix, spcm, params);
if (ret < 0) {
SNDERR("unable to initialize slave");
snd_error(PCM, "unable to initialize slave");
goto _err;
}
}
@ -1075,13 +1075,13 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
ret = shm_sum_create_or_connect(dmix);
if (ret < 0) {
SNDERR("unable to initialize sum ring buffer");
snd_error(PCM, "unable to initialize sum ring buffer");
goto _err;
}
ret = snd_pcm_direct_initialize_poll_fd(dmix);
if (ret < 0) {
SNDERR("unable to initialize poll_fd");
snd_error(PCM, "unable to initialize poll_fd");
goto _err;
}
@ -1325,7 +1325,7 @@ int _snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
params.format = SND_PCM_FORMAT_UNKNOWN;
else if (!(dmix_supported_format & (1ULL << params.format))) {
/* sorry, limited features */
SNDERR("Unsupported format");
snd_error(PCM, "Unsupported format");
snd_config_delete(sconf);
return -EINVAL;
}

View file

@ -667,7 +667,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
assert(pcmp);
if (stream != SND_PCM_STREAM_PLAYBACK) {
SNDERR("The dshare plugin supports only playback stream");
snd_error(PCM, "The dshare plugin supports only playback stream");
return -EINVAL;
}
@ -698,18 +698,18 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
mode | SND_PCM_NONBLOCK, NULL);
if (ret < 0) {
SNDERR("unable to open slave");
snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
SNDERR("dshare plugin can be only connected to hw plugin");
snd_error(PCM, "dshare plugin can be only connected to hw plugin");
goto _err;
}
ret = snd_pcm_direct_initialize_slave(dshare, spcm, params);
if (ret < 0) {
SNDERR("unable to initialize slave");
snd_error(PCM, "unable to initialize slave");
goto _err;
}
@ -718,7 +718,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
if (dshare->shmptr->use_server) {
ret = snd_pcm_direct_server_create(dshare);
if (ret < 0) {
SNDERR("unable to create server");
snd_error(PCM, "unable to create server");
goto _err;
}
}
@ -730,7 +730,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT);
ret = snd_pcm_direct_client_connect(dshare);
if (ret < 0) {
SNDERR("unable to connect client");
snd_error(PCM, "unable to connect client");
goto _err_nosem;
}
@ -753,18 +753,18 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
first_instance = 1;
goto retry;
}
SNDERR("unable to open slave");
snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
SNDERR("dshare plugin can be only connected to hw plugin");
snd_error(PCM, "dshare plugin can be only connected to hw plugin");
ret = -EINVAL;
goto _err;
}
ret = snd_pcm_direct_initialize_secondary_slave(dshare, spcm, params);
if (ret < 0) {
SNDERR("unable to initialize slave");
snd_error(PCM, "unable to initialize slave");
goto _err;
}
}
@ -778,7 +778,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
dshare->u.dshare.chn_mask |= (1ULL << dchn);
}
if (dshare->shmptr->u.dshare.chn_mask & dshare->u.dshare.chn_mask) {
SNDERR("destination channel specified in bindings is already used");
snd_error(PCM, "destination channel specified in bindings is already used");
dshare->u.dshare.chn_mask = 0;
ret = -EINVAL;
goto _err;
@ -787,7 +787,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
ret = snd_pcm_direct_initialize_poll_fd(dshare);
if (ret < 0) {
SNDERR("unable to initialize poll_fd");
snd_error(PCM, "unable to initialize poll_fd");
goto _err;
}

View file

@ -538,7 +538,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
assert(pcmp);
if (stream != SND_PCM_STREAM_CAPTURE) {
SNDERR("The dsnoop plugin supports only capture stream");
snd_error(PCM, "The dsnoop plugin supports only capture stream");
return -EINVAL;
}
@ -564,18 +564,18 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
mode | SND_PCM_NONBLOCK, NULL);
if (ret < 0) {
SNDERR("unable to open slave");
snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
SNDERR("dsnoop plugin can be only connected to hw plugin");
snd_error(PCM, "dsnoop plugin can be only connected to hw plugin");
goto _err;
}
ret = snd_pcm_direct_initialize_slave(dsnoop, spcm, params);
if (ret < 0) {
SNDERR("unable to initialize slave");
snd_error(PCM, "unable to initialize slave");
goto _err;
}
@ -584,7 +584,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
if (dsnoop->shmptr->use_server) {
ret = snd_pcm_direct_server_create(dsnoop);
if (ret < 0) {
SNDERR("unable to create server");
snd_error(PCM, "unable to create server");
goto _err;
}
}
@ -596,7 +596,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT);
ret = snd_pcm_direct_client_connect(dsnoop);
if (ret < 0) {
SNDERR("unable to connect client");
snd_error(PCM, "unable to connect client");
goto _err_nosem;
}
@ -619,18 +619,18 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
first_instance = 1;
goto retry;
}
SNDERR("unable to open slave");
snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
SNDERR("dsnoop plugin can be only connected to hw plugin");
snd_error(PCM, "dsnoop plugin can be only connected to hw plugin");
ret = -EINVAL;
goto _err;
}
ret = snd_pcm_direct_initialize_secondary_slave(dsnoop, spcm, params);
if (ret < 0) {
SNDERR("unable to initialize slave");
snd_error(PCM, "unable to initialize slave");
goto _err;
}
}
@ -640,7 +640,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
ret = snd_pcm_direct_initialize_poll_fd(dsnoop);
if (ret < 0) {
SNDERR("unable to initialize poll_fd");
snd_error(PCM, "unable to initialize poll_fd");
goto _err;
}

View file

@ -95,11 +95,11 @@ int _snd_pcm_empty_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED,
slave = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);

View file

@ -547,12 +547,12 @@ SND_PCM_PLUGIN_DEFINE_FUNC(myplug)
....
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (! slave) {
SNDERR("No slave defined for myplug");
snd_error(PCM, "No slave defined for myplug");
return -EINVAL;
}
@ -690,8 +690,9 @@ int snd_pcm_extplug_create(snd_pcm_extplug_t *extplug, const char *name,
/* We support 1.0.0 to current */
if (extplug->version < 0x010000 ||
extplug->version > SND_PCM_EXTPLUG_VERSION) {
SNDERR("extplug: Plugin version mismatch: 0x%x",
extplug->version);
snd_error(PCM, "extplug: Plugin version mismatch: 0x%x",
extplug->version);
return -ENXIO;
}
@ -781,7 +782,7 @@ int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, u
{
extplug_priv_t *ext = extplug->pcm->private_data;
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
SNDERR("EXTPLUG: invalid parameter type %d", type);
snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
return -EINVAL;
}
return snd_ext_parm_set_list(&ext->sparams[type], num_list, list);
@ -803,11 +804,11 @@ int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type,
{
extplug_priv_t *ext = extplug->pcm->private_data;
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
SNDERR("EXTPLUG: invalid parameter type %d", type);
snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
return -EINVAL;
}
if (is_mask_type(type)) {
SNDERR("EXTPLUG: invalid parameter type %d", type);
snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
return -EINVAL;
}
return snd_ext_parm_set_minmax(&ext->sparams[type], min, max);
@ -829,7 +830,7 @@ int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigne
{
extplug_priv_t *ext = extplug->pcm->private_data;
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
SNDERR("EXTPLUG: invalid parameter type %d", type);
snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
return -EINVAL;
}
return snd_ext_parm_set_list(&ext->params[type], num_list, list);
@ -851,11 +852,11 @@ int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsig
{
extplug_priv_t *ext = extplug->pcm->private_data;
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
SNDERR("EXTPLUG: invalid parameter type %d", type);
snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
return -EINVAL;
}
if (is_mask_type(type)) {
SNDERR("EXTPLUG: invalid parameter type %d", type);
snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
return -EINVAL;
}
return snd_ext_parm_set_minmax(&ext->params[type], min, max);
@ -877,7 +878,7 @@ int snd_pcm_extplug_set_param_link(snd_pcm_extplug_t *extplug, int type,
extplug_priv_t *ext = extplug->pcm->private_data;
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
SNDERR("EXTPLUG: invalid parameter type %d", type);
snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
return -EINVAL;
}
ext->params[type].keep_link = keep_link ? 1 : 0;

View file

@ -239,8 +239,9 @@ static int snd_pcm_file_open_output_file(snd_pcm_file_t *file)
/* clearing */
pipe = popen(file->final_fname + 1, "w");
if (!pipe) {
SYSERR("running %s for writing failed",
file->final_fname);
snd_errornum(PCM, "running %s for writing failed",
file->final_fname);
return -errno;
}
fd = fileno(pipe);
@ -274,8 +275,9 @@ static int snd_pcm_file_open_output_file(snd_pcm_file_t *file)
}
}
if (fd < 0) {
SYSERR("open %s for writing failed",
file->final_fname);
snd_errornum(PCM, "open %s for writing failed",
file->final_fname);
free(tmpfname);
return -errno;
}
@ -303,7 +305,7 @@ static int snd_pcm_file_areas_read_infile(snd_pcm_t *pcm,
return -ENOMEM;
if (file->rbuf_size < frames) {
SYSERR("requested more frames than pcm buffer");
snd_errornum(PCM, "requested more frames than pcm buffer");
return -ENOMEM;
}
@ -312,7 +314,7 @@ static int snd_pcm_file_areas_read_infile(snd_pcm_t *pcm,
return bytes;
bytes = read(file->ifd, file->rbuf, bytes);
if (bytes < 0) {
SYSERR("read from file failed, error: %d", bytes);
snd_errornum(PCM, "read from file failed, error: %d", bytes);
return bytes;
}
@ -376,9 +378,9 @@ write_error:
* be used to signal XRUN on playback device
*/
if (res < 0)
SYSERR("%s write header failed, file data may be corrupt", file->fname);
snd_errornum(PCM, "%s write header failed, file data may be corrupt", file->fname);
else
SNDERR("%s write header incomplete, file data may be corrupt", file->fname);
snd_error(PCM, "%s write header incomplete, file data may be corrupt", file->fname);
memset(&file->wav_header, 0, sizeof(struct wav_fmt));
@ -440,7 +442,7 @@ static int snd_pcm_file_write_bytes(snd_pcm_t *pcm, size_t bytes)
if (err < 0) {
file->wbuf_used_bytes = 0;
file->file_ptr_bytes = 0;
SYSERR("%s write failed, file data may be corrupt", file->fname);
snd_errornum(PCM, "%s write failed, file data may be corrupt", file->fname);
return err;
}
bytes -= err;
@ -791,7 +793,7 @@ static int snd_pcm_file_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
if (file->fd < 0) {
err = snd_pcm_file_open_output_file(file);
if (err < 0) {
SYSERR("failed opening output file %s", file->fname);
snd_errornum(PCM, "failed opening output file %s", file->fname);
return err;
}
}
@ -914,7 +916,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
else if (!strcmp(fmt, "wav"))
format = SND_PCM_FILE_FORMAT_WAV;
else {
SNDERR("file format %s is unknown", fmt);
snd_error(PCM, "file format %s is unknown", fmt);
return -EINVAL;
}
file = calloc(1, sizeof(snd_pcm_file_t));
@ -932,7 +934,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
if (ifname && (stream == SND_PCM_STREAM_CAPTURE)) {
ifd = open(ifname, O_RDONLY); /* TODO: mind blocking mode */
if (ifd < 0) {
SYSERR("open %s for reading failed", ifname);
snd_errornum(PCM, "open %s for reading failed", ifname);
free(file->fname);
free(file);
return -errno;
@ -1057,7 +1059,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "format") == 0) {
err = snd_config_get_string(n, &format);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
@ -1067,7 +1069,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
if (err < 0) {
err = snd_config_get_integer(n, &fd);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
}
@ -1078,7 +1080,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
if (err < 0) {
err = snd_config_get_integer(n, &ifd);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
}
@ -1087,11 +1089,11 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "perm") == 0) {
err = snd_config_get_integer(n, &perm);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return err;
}
if ((perm & ~0777) != 0) {
SNDERR("The field perm must be a valid file permission");
snd_error(PCM, "The field perm must be a valid file permission");
return -EINVAL;
}
continue;
@ -1103,7 +1105,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
trunc = err;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!format) {
@ -1112,13 +1114,13 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
if (snd_config_search(root, "defaults.pcm.file_format", &n) >= 0) {
err = snd_config_get_string(n, &format);
if (err < 0) {
SNDERR("Invalid file format");
snd_error(PCM, "Invalid file format");
return -EINVAL;
}
}
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
@ -1126,7 +1128,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
return err;
if ((!fname || strlen(fname) == 0) && fd < 0) {
snd_config_delete(sconf);
SNDERR("file is not defined");
snd_error(PCM, "file is not defined");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);

View file

@ -350,7 +350,7 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
void *h = NULL;
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid hook definition");
snd_error(PCM, "Invalid hook definition");
return -EINVAL;
}
snd_config_for_each(i, next, conf) {
@ -368,27 +368,27 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
args = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!type) {
SNDERR("type is not defined");
snd_error(PCM, "type is not defined");
return -EINVAL;
}
err = snd_config_get_id(type, &id);
if (err < 0) {
SNDERR("unable to get id");
snd_error(PCM, "unable to get id");
return err;
}
err = snd_config_get_string(type, &str);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return err;
}
err = snd_config_search_definition(root, "pcm_hook_type", str, &type);
if (err >= 0) {
if (snd_config_get_type(type) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for PCM type %s definition", str);
snd_error(PCM, "Invalid type for PCM type %s definition", str);
err = -EINVAL;
goto _err;
}
@ -402,7 +402,7 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
@ -410,12 +410,12 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
if (strcmp(id, "install") == 0) {
err = snd_config_get_string(n, &install);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
@ -428,12 +428,14 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
install_func = h ? snd_dlsym(h, install, SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION)) : NULL;
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s (%s)",
lib ? lib : "[builtin]", errbuf);
snd_error(PCM, "Cannot open shared library %s (%s)",
lib ? lib : "[builtin]", errbuf);
err = -ENOENT;
} else if (!install_func) {
SNDERR("symbol %s is not defined inside %s", install,
lib ? lib : "[builtin]");
snd_error(PCM, "symbol %s is not defined inside %s", install,
lib ? lib : "[builtin]");
snd_dlclose(h);
err = -ENXIO;
}
@ -446,7 +448,7 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
if (args && snd_config_get_string(args, &str) >= 0) {
err = snd_config_search_definition(root, "hook_args", str, &args);
if (err < 0)
SNDERR("unknown hook_args %s", str);
snd_error(PCM, "unknown hook_args %s", str);
else
err = install_func(pcm, args);
snd_config_delete(args);
@ -499,17 +501,17 @@ int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
}
if (strcmp(id, "hooks") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
hooks = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
@ -532,7 +534,7 @@ int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
if (snd_config_get_string(n, &str) >= 0) {
err = snd_config_search_definition(root, "pcm_hook", str, &n);
if (err < 0) {
SNDERR("unknown pcm_hook %s", str);
snd_error(PCM, "unknown pcm_hook %s", str);
} else {
err = snd_pcm_hook_add_conf(rpcm, root, n);
snd_config_delete(n);
@ -681,13 +683,13 @@ int _snd_pcm_hook_ctl_elems_install(snd_pcm_t *pcm, snd_config_t *conf)
return err;
card = snd_pcm_info_get_card(&info);
if (card < 0) {
SNDERR("No card for this PCM");
snd_error(PCM, "No card for this PCM");
return -EINVAL;
}
sprintf(ctl_name, "hw:%d", card);
err = snd_ctl_open(&ctl, ctl_name, 0);
if (err < 0) {
SNDERR("Cannot open CTL %s", ctl_name);
snd_error(PCM, "Cannot open CTL %s", ctl_name);
return err;
}
err = snd_config_imake_pointer(&pcm_conf, "pcm_handle", pcm);

View file

@ -145,7 +145,7 @@ static int sync_ptr1(snd_pcm_hw_t *hw, unsigned int flags)
hw->sync_ptr->flags = flags;
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SYNC_PTR, hw->sync_ptr) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_SYNC_PTR failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_SYNC_PTR failed (%i)", err);
return err;
}
return 0;
@ -268,7 +268,7 @@ static int snd_pcm_hw_nonblock(snd_pcm_t *pcm, int nonblock)
if ((flags = fcntl(fd, F_GETFL)) < 0) {
err = -errno;
SYSMSG("F_GETFL failed (%i)", err);
snd_checknum(PCM, "F_GETFL failed (%i)", err);
return err;
}
if (nonblock)
@ -277,7 +277,7 @@ static int snd_pcm_hw_nonblock(snd_pcm_t *pcm, int nonblock)
flags &= ~O_NONBLOCK;
if (fcntl(fd, F_SETFL, flags) < 0) {
err = -errno;
SYSMSG("F_SETFL for O_NONBLOCK failed (%i)", err);
snd_checknum(PCM, "F_SETFL for O_NONBLOCK failed (%i)", err);
return err;
}
return 0;
@ -291,7 +291,7 @@ static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
if ((flags = fcntl(fd, F_GETFL)) < 0) {
err = -errno;
SYSMSG("F_GETFL failed (%i)", err);
snd_checknum(PCM, "F_GETFL failed (%i)", err);
return err;
}
if (sig >= 0)
@ -300,19 +300,19 @@ static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
flags &= ~O_ASYNC;
if (fcntl(fd, F_SETFL, flags) < 0) {
err = -errno;
SYSMSG("F_SETFL for O_ASYNC failed (%i)", err);
snd_checknum(PCM, "F_SETFL for O_ASYNC failed (%i)", err);
return err;
}
if (sig < 0)
return 0;
if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
err = -errno;
SYSMSG("F_SETSIG failed (%i)", err);
snd_checknum(PCM, "F_SETSIG failed (%i)", err);
return err;
}
if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
err = -errno;
SYSMSG("F_SETOWN failed (%i)", err);
snd_checknum(PCM, "F_SETOWN failed (%i)", err);
return err;
}
return 0;
@ -324,7 +324,7 @@ static int snd_pcm_hw_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
int fd = hw->fd, err;
if (ioctl(fd, SNDRV_PCM_IOCTL_INFO, info) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_INFO failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_INFO failed (%i)", err);
return err;
}
/* may be configurable (optional) */
@ -409,7 +409,7 @@ static int snd_pcm_hw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
int err;
if (hw_params_call(hw, params) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_HW_PARAMS failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_HW_PARAMS failed (%i)", err);
return err;
}
params->info &= ~0xf0000000;
@ -515,7 +515,7 @@ static int snd_pcm_hw_hw_free(snd_pcm_t *pcm)
snd_pcm_hw_change_timer(pcm, 0);
if (ioctl(fd, SNDRV_PCM_IOCTL_HW_FREE) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_HW_FREE failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_HW_FREE failed (%i)", err);
return err;
}
return 0;
@ -541,19 +541,19 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
}
if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW &&
hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 12)) {
SYSMSG("Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW");
snd_checknum(PCM, "Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW");
err = -EINVAL;
goto out;
}
if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC &&
hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 5)) {
SYSMSG("Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC");
snd_checknum(PCM, "Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC");
err = -EINVAL;
goto out;
}
if (ioctl(fd, SNDRV_PCM_IOCTL_SW_PARAMS, params) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
goto out;
}
hw->prepare_reset_sw_params = false;
@ -563,7 +563,7 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
SND_PCM_TSTAMP_TYPE_MONOTONIC;
if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) {
err = -errno;
SNDMSG("TSTAMP failed");
snd_check(PCM, "TSTAMP failed");
goto out;
}
}
@ -589,7 +589,7 @@ static int snd_pcm_hw_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info
i.channel = info->channel;
if (ioctl(fd, SNDRV_PCM_IOCTL_CHANNEL_INFO, &i) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_CHANNEL_INFO failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_CHANNEL_INFO failed (%i)", err);
return err;
}
info->channel = i.channel;
@ -609,13 +609,13 @@ static int snd_pcm_hw_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
if (SNDRV_PROTOCOL_VERSION(2, 0, 13) > hw->version) {
if (ioctl(fd, SNDRV_PCM_IOCTL_STATUS, status) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_STATUS failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_STATUS failed (%i)", err);
return err;
}
} else {
if (ioctl(fd, SNDRV_PCM_IOCTL_STATUS_EXT, status) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_STATUS_EXT failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_STATUS_EXT failed (%i)", err);
return err;
}
}
@ -642,7 +642,7 @@ static int snd_pcm_hw_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
int fd = hw->fd, err;
if (ioctl(fd, SNDRV_PCM_IOCTL_DELAY, delayp) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_DELAY failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_DELAY failed (%i)", err);
return err;
}
return 0;
@ -660,7 +660,7 @@ static int snd_pcm_hw_hwsync(snd_pcm_t *pcm)
} else {
if (ioctl(fd, SNDRV_PCM_IOCTL_HWSYNC) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_HWSYNC failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_HWSYNC failed (%i)", err);
return err;
}
}
@ -690,14 +690,14 @@ static int snd_pcm_hw_prepare(snd_pcm_t *pcm)
snd_pcm_sw_params_current_no_lock(pcm, &sw_params);
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SW_PARAMS, &sw_params) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
return err;
}
hw->prepare_reset_sw_params = false;
}
if (ioctl(fd, SNDRV_PCM_IOCTL_PREPARE) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_PREPARE failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_PREPARE failed (%i)", err);
return err;
}
return query_status_and_control_data(hw);
@ -709,7 +709,7 @@ static int snd_pcm_hw_reset(snd_pcm_t *pcm)
int fd = hw->fd, err;
if (ioctl(fd, SNDRV_PCM_IOCTL_RESET) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_RESET failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_RESET failed (%i)", err);
return err;
}
return query_status_and_control_data(hw);
@ -726,10 +726,10 @@ static int snd_pcm_hw_start(snd_pcm_t *pcm)
issue_applptr(hw);
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_START) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_START failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_START failed (%i)", err);
#if 0
if (err == -EBADFD)
SNDERR("PCM state = %s", snd_pcm_state_name(snd_pcm_hw_state(pcm)));
snd_error(PCM, "PCM state = %s", snd_pcm_state_name(snd_pcm_hw_state(pcm)));
#endif
return err;
}
@ -742,7 +742,7 @@ static int snd_pcm_hw_drop(snd_pcm_t *pcm)
int err;
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_DROP) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_DROP failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_DROP failed (%i)", err);
return err;
} else {
}
@ -792,7 +792,7 @@ __manual_silence:
sw_params.silence_size = silence_size;
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SW_PARAMS, &sw_params) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
return err;
}
hw->prepare_reset_sw_params = true;
@ -800,7 +800,7 @@ __manual_silence:
__skip_silence:
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_DRAIN) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_DRAIN failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_DRAIN failed (%i)", err);
return err;
}
return 0;
@ -812,7 +812,7 @@ static int snd_pcm_hw_pause(snd_pcm_t *pcm, int enable)
int err;
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_PAUSE, enable) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_PAUSE failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_PAUSE failed (%i)", err);
return err;
}
return 0;
@ -829,7 +829,7 @@ static snd_pcm_sframes_t snd_pcm_hw_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t fra
int err;
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_REWIND, &frames) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_REWIND failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_REWIND failed (%i)", err);
return err;
}
err = query_status_and_control_data(hw);
@ -850,7 +850,7 @@ static snd_pcm_sframes_t snd_pcm_hw_forward(snd_pcm_t *pcm, snd_pcm_uframes_t fr
if (SNDRV_PROTOCOL_VERSION(2, 0, 4) <= hw->version) {
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_FORWARD, &frames) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_FORWARD failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_FORWARD failed (%i)", err);
return err;
}
err = query_status_and_control_data(hw);
@ -887,7 +887,7 @@ static int snd_pcm_hw_resume(snd_pcm_t *pcm)
int fd = hw->fd, err;
if (ioctl(fd, SNDRV_PCM_IOCTL_RESUME) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_RESUME failed (%i)", err);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_RESUME failed (%i)", err);
return err;
}
return 0;
@ -898,7 +898,7 @@ static int hw_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
snd_pcm_hw_t *hw1 = pcm1->private_data;
snd_pcm_hw_t *hw2 = pcm2->private_data;
if (ioctl(hw1->fd, SNDRV_PCM_IOCTL_LINK, hw2->fd) < 0) {
SYSMSG("SNDRV_PCM_IOCTL_LINK failed (%i)", -errno);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_LINK failed (%i)", -errno);
return -errno;
}
return 0;
@ -907,7 +907,7 @@ static int hw_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
static int snd_pcm_hw_link_slaves(snd_pcm_t *pcm, snd_pcm_t *master)
{
if (master->type != SND_PCM_TYPE_HW) {
SYSMSG("Invalid type for SNDRV_PCM_IOCTL_LINK (%i)", master->type);
snd_checknum(PCM, "Invalid type for SNDRV_PCM_IOCTL_LINK (%i)", master->type);
return -EINVAL;
}
return hw_link(master, pcm);
@ -928,7 +928,7 @@ static int snd_pcm_hw_unlink(snd_pcm_t *pcm)
snd_pcm_hw_t *hw = pcm->private_data;
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_UNLINK) < 0) {
SYSMSG("SNDRV_PCM_IOCTL_UNLINK failed (%i)", -errno);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_UNLINK failed (%i)", -errno);
return -errno;
}
return 0;
@ -1128,7 +1128,7 @@ static void unmap_status_data(snd_pcm_hw_t *hw)
if (!hw->mmap_status_fallbacked) {
if (munmap((void *)hw->mmap_status,
page_align(sizeof(*hw->mmap_status))) < 0)
SYSMSG("status munmap failed (%u)", errno);
snd_checknum(PCM, "status munmap failed (%u)", errno);
}
}
@ -1137,7 +1137,7 @@ static void unmap_control_data(snd_pcm_hw_t *hw)
if (!hw->mmap_control_fallbacked) {
if (munmap((void *)hw->mmap_control,
page_align(sizeof(*hw->mmap_control))) < 0)
SYSMSG("control munmap failed (%u)", errno);
snd_checknum(PCM, "control munmap failed (%u)", errno);
}
}
@ -1172,7 +1172,7 @@ static int snd_pcm_hw_close(snd_pcm_t *pcm)
int err = 0;
if (close(hw->fd)) {
err = -errno;
SYSMSG("close failed (%i)", err);
snd_checknum(PCM, "close failed (%i)", err);
}
unmap_status_and_control_data(hw);
@ -1295,7 +1295,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
ret = snd_ctl_hw_open(&ctl, NULL, card, 0);
if (ret < 0) {
SYSMSG("Cannot open the associated CTL");
snd_checknum(PCM, "Cannot open the associated CTL");
return NULL;
}
@ -1303,7 +1303,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
ret = snd_ctl_elem_tlv_read(ctl, &id, tlv, sizeof(tlv));
snd_ctl_close(ctl);
if (ret < 0) {
SYSMSG("Cannot read Channel Map TLV");
snd_checknum(PCM, "Cannot read Channel Map TLV");
return NULL;
}
@ -1317,7 +1317,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
type = tlv[SNDRV_CTL_TLVO_TYPE];
if (type != SND_CTL_TLVT_CONTAINER) {
if (!is_chmap_type(type)) {
SYSMSG("Invalid TLV type %d", type);
snd_checknum(PCM, "Invalid TLV type %d", type);
return NULL;
}
start = tlv;
@ -1330,7 +1330,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
nums = 0;
for (p = start; size > 0; ) {
if (!is_chmap_type(p[0])) {
SYSMSG("Invalid TLV type %d", p[0]);
snd_checknum(PCM, "Invalid TLV type %d", p[0]);
return NULL;
}
nums++;
@ -1421,8 +1421,9 @@ static snd_pcm_chmap_t *snd_pcm_hw_get_chmap(snd_pcm_t *pcm)
case SNDRV_PCM_STATE_SUSPENDED:
break;
default:
SYSMSG("Invalid PCM state for chmap_get: %s",
snd_pcm_state_name(FAST_PCM_STATE(hw)));
snd_checknum(PCM, "Invalid PCM state for chmap_get: %s",
snd_pcm_state_name(FAST_PCM_STATE(hw)));
return NULL;
}
map = malloc(pcm->channels * sizeof(map->pos[0]) + sizeof(*map));
@ -1432,7 +1433,7 @@ static snd_pcm_chmap_t *snd_pcm_hw_get_chmap(snd_pcm_t *pcm)
ret = snd_ctl_hw_open(&ctl, NULL, hw->card, 0);
if (ret < 0) {
free(map);
SYSMSG("Cannot open the associated CTL");
snd_checknum(PCM, "Cannot open the associated CTL");
chmap_caps_set_error(hw, CHMAP_CTL_GET);
return NULL;
}
@ -1442,7 +1443,7 @@ static snd_pcm_chmap_t *snd_pcm_hw_get_chmap(snd_pcm_t *pcm)
snd_ctl_close(ctl);
if (ret < 0) {
free(map);
SYSMSG("Cannot read Channel Map ctl");
snd_checknum(PCM, "Cannot read Channel Map ctl");
chmap_caps_set_error(hw, CHMAP_CTL_GET);
return NULL;
}
@ -1468,17 +1469,18 @@ static int snd_pcm_hw_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map)
return -ENXIO;
if (map->channels > 128) {
SYSMSG("Invalid number of channels %d", map->channels);
snd_checknum(PCM, "Invalid number of channels %d", map->channels);
return -EINVAL;
}
if (FAST_PCM_STATE(hw) != SNDRV_PCM_STATE_PREPARED) {
SYSMSG("Invalid PCM state for chmap_set: %s",
snd_pcm_state_name(FAST_PCM_STATE(hw)));
snd_checknum(PCM, "Invalid PCM state for chmap_set: %s",
snd_pcm_state_name(FAST_PCM_STATE(hw)));
return -EBADFD;
}
ret = snd_ctl_hw_open(&ctl, NULL, hw->card, 0);
if (ret < 0) {
SYSMSG("Cannot open the associated CTL");
snd_checknum(PCM, "Cannot open the associated CTL");
chmap_caps_set_error(hw, CHMAP_CTL_SET);
return ret;
}
@ -1496,7 +1498,7 @@ static int snd_pcm_hw_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map)
ret = -ENXIO;
}
if (ret < 0)
SYSMSG("Cannot write Channel Map ctl");
snd_checknum(PCM, "Cannot write Channel Map ctl");
return ret;
}
@ -1506,7 +1508,7 @@ static void snd_pcm_hw_dump(snd_pcm_t *pcm, snd_output_t *out)
char *name;
int err = snd_card_get_name(hw->card, &name);
if (err < 0) {
SNDERR("cannot get card name");
snd_error(PCM, "cannot get card name");
return;
}
snd_output_printf(out, "Hardware PCM card %d '%s' device %d subdevice %d\n",
@ -1627,7 +1629,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
memset(&info, 0, sizeof(info));
if (ioctl(fd, SNDRV_PCM_IOCTL_INFO, &info) < 0) {
ret = -errno;
SYSMSG("SNDRV_PCM_IOCTL_INFO failed (%i)", ret);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_INFO failed (%i)", ret);
close(fd);
return ret;
@ -1648,7 +1650,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
if (ioctl(fd, SNDRV_PCM_IOCTL_PVERSION, &ver) < 0) {
ret = -errno;
SYSMSG("SNDRV_PCM_IOCTL_PVERSION failed (%i)", ret);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_PVERSION failed (%i)", ret);
close(fd);
return ret;
}
@ -1660,7 +1662,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
unsigned int user_ver = SNDRV_PCM_VERSION;
if (ioctl(fd, SNDRV_PCM_IOCTL_USER_PVERSION, &user_ver) < 0) {
ret = -errno;
SNDMSG("USER_PVERSION failed");
snd_check(PCM, "USER_PVERSION failed");
return ret;
}
}
@ -1673,7 +1675,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
int on = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC;
if (ioctl(fd, SNDRV_PCM_IOCTL_TTSTAMP, &on) < 0) {
ret = -errno;
SNDMSG("TTSTAMP failed");
snd_check(PCM, "TTSTAMP failed");
return ret;
}
}
@ -1685,7 +1687,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
int on = 1;
if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) {
ret = -errno;
SNDMSG("TSTAMP failed");
snd_check(PCM, "TSTAMP failed");
return ret;
}
}
@ -1777,7 +1779,7 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
filefmt = SNDRV_FILE_PCM_STREAM_CAPTURE;
break;
default:
SNDERR("invalid stream %d", stream);
snd_error(PCM, "invalid stream %d", stream);
return -EINVAL;
}
sprintf(filename, filefmt, card, device);
@ -1800,14 +1802,14 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
fd = snd_open_device(filename, fmode);
if (fd < 0) {
ret = -errno;
SYSMSG("open '%s' failed (%i)", filename, ret);
snd_checknum(PCM, "open '%s' failed (%i)", filename, ret);
goto _err;
}
if (subdevice >= 0) {
memset(&info, 0, sizeof(info));
if (ioctl(fd, SNDRV_PCM_IOCTL_INFO, &info) < 0) {
ret = -errno;
SYSMSG("SNDRV_PCM_IOCTL_INFO failed (%i)", ret);
snd_checknum(PCM, "SNDRV_PCM_IOCTL_INFO failed (%i)", ret);
goto _err;
}
if (info.subdevice != (unsigned int) subdevice) {
@ -1915,7 +1917,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "device") == 0) {
err = snd_config_get_integer(n, &device);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto fail;
}
continue;
@ -1923,7 +1925,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "subdevice") == 0) {
err = snd_config_get_integer(n, &subdevice);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto fail;
}
continue;
@ -1949,12 +1951,12 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *m;
err = snd_config_search(n, "0", &m);
if (err < 0) {
SNDERR("array expected for rate compound");
snd_error(PCM, "array expected for rate compound");
goto fail;
}
err = snd_config_get_integer(m, &val);
if (err < 0) {
SNDERR("Invalid type for rate.0");
snd_error(PCM, "Invalid type for rate.0");
goto fail;
}
min_rate = max_rate = val;
@ -1962,7 +1964,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
if (err >= 0) {
err = snd_config_get_integer(m, &val);
if (err < 0) {
SNDERR("Invalid type for rate.0");
snd_error(PCM, "Invalid type for rate.0");
goto fail;
}
max_rate = val;
@ -1970,7 +1972,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
} else {
err = snd_config_get_integer(n, &val);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto fail;
}
min_rate = max_rate = val;
@ -1981,7 +1983,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
long val;
err = snd_config_get_integer(n, &val);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto fail;
}
min_rate = val;
@ -1991,7 +1993,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
long val;
err = snd_config_get_integer(n, &val);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto fail;
}
max_rate = val;
@ -2000,7 +2002,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "format") == 0) {
err = snd_config_get_string(n, &str);
if (err < 0) {
SNDERR("invalid type for %s", id);
snd_error(PCM, "invalid type for %s", id);
goto fail;
}
format = snd_pcm_format_value(str);
@ -2010,7 +2012,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
long val;
err = snd_config_get_integer(n, &val);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto fail;
}
channels = val;
@ -2020,7 +2022,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_free_chmaps(chmap);
chmap = _snd_pcm_parse_config_chmaps(n);
if (!chmap) {
SNDERR("Invalid channel map for %s", id);
snd_error(PCM, "Invalid channel map for %s", id);
err = -EINVAL;
goto fail;
}
@ -2030,23 +2032,23 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
long val;
err = snd_config_get_integer(n, &val);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto fail;
}
drain_silence = val;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
err = -EINVAL;
goto fail;
}
if (card < 0) {
SNDERR("card is not defined");
snd_error(PCM, "card is not defined");
err = -EINVAL;
goto fail;
}
if ((min_rate < 0) || (max_rate < min_rate)) {
SNDERR("min_rate - max_rate configuration invalid");
snd_error(PCM, "min_rate - max_rate configuration invalid");
err = -EINVAL;
goto fail;
}

View file

@ -712,7 +712,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
}
if (strcmp(id, "status") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
status = n;
@ -720,7 +720,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
}
if (strcmp(id, "preamble") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
preamble = n;
@ -733,7 +733,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
hdmi_mode = err;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
memset(status_bits, 0, sizeof(status_bits));
@ -744,12 +744,12 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
long val;
snd_config_t *n = snd_config_iterator_entry(i);
if (snd_config_get_type(n) != SND_CONFIG_TYPE_INTEGER) {
SNDERR("invalid IEC958 status bits");
snd_error(PCM, "invalid IEC958 status bits");
return -EINVAL;
}
err = snd_config_get_integer(n, &val);
if (err < 0) {
SNDERR("invalid IEC958 status bits");
snd_error(PCM, "invalid IEC958 status bits");
return err;
}
status_bits[bytes] = val;
@ -775,19 +775,19 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
else if (strcmp(id, "w") == 0 || strcmp(id, "y") == 0)
idx = PREAMBLE_Y;
else {
SNDERR("invalid IEC958 preamble type %s", id);
snd_error(PCM, "invalid IEC958 preamble type %s", id);
return -EINVAL;
}
err = snd_config_get_integer(n, &val);
if (err < 0) {
SNDERR("invalid IEC958 preamble value");
snd_error(PCM, "invalid IEC958 preamble value");
return err;
}
preamble_vals[idx] = val;
}
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
@ -798,7 +798,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_LE &&
sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_BE) {
snd_config_delete(sconf);
SNDERR("invalid slave format");
snd_error(PCM, "invalid slave format");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);

View file

@ -1086,8 +1086,9 @@ int snd_pcm_ioplug_create(snd_pcm_ioplug_t *ioplug, const char *name,
/* We support 1.0.0 to current */
if (ioplug->version < 0x010000 ||
ioplug->version > SND_PCM_IOPLUG_VERSION) {
SNDERR("ioplug: Plugin version mismatch: 0x%x",
ioplug->version);
snd_error(PCM, "ioplug: Plugin version mismatch: 0x%x",
ioplug->version);
return -ENXIO;
}
@ -1156,7 +1157,7 @@ int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *ioplug, int type, unsigned i
{
ioplug_priv_t *io = ioplug->pcm->private_data;
if (type < 0 || type >= SND_PCM_IOPLUG_HW_PARAMS) {
SNDERR("IOPLUG: invalid parameter type %d", type);
snd_error(PCM, "IOPLUG: invalid parameter type %d", type);
return -EINVAL;
}
if (type == SND_PCM_IOPLUG_HW_PERIODS)
@ -1180,11 +1181,11 @@ int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *ioplug, int type, unsigned
{
ioplug_priv_t *io = ioplug->pcm->private_data;
if (type < 0 || type >= SND_PCM_IOPLUG_HW_PARAMS) {
SNDERR("IOPLUG: invalid parameter type %d", type);
snd_error(PCM, "IOPLUG: invalid parameter type %d", type);
return -EINVAL;
}
if (type == SND_PCM_IOPLUG_HW_ACCESS || type == SND_PCM_IOPLUG_HW_FORMAT) {
SNDERR("IOPLUG: invalid parameter type %d", type);
snd_error(PCM, "IOPLUG: invalid parameter type %d", type);
return -EINVAL;
}
if (type == SND_PCM_IOPLUG_HW_PERIODS)

View file

@ -420,7 +420,7 @@ static int snd_pcm_ladspa_connect_plugin1(snd_pcm_ladspa_plugin_t *plugin,
else {
err = snd_pcm_ladspa_find_port(&port, plugin, io->pdesc | LADSPA_PORT_AUDIO, idx);
if (err < 0) {
SNDERR("unable to find audio %s port %u plugin '%s'", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", idx, plugin->desc->Name);
snd_error(PCM, "unable to find audio %s port %u plugin '%s'", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", idx, plugin->desc->Name);
return err;
}
}
@ -428,12 +428,12 @@ static int snd_pcm_ladspa_connect_plugin1(snd_pcm_ladspa_plugin_t *plugin,
continue;
err = snd_pcm_ladspa_add_to_carray(&eps->channels, idx1, idx);
if (err < 0) {
SNDERR("unable to add channel %u for audio %s plugin '%s'", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
snd_error(PCM, "unable to add channel %u for audio %s plugin '%s'", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
return err;
}
err = snd_pcm_ladspa_add_to_array(&eps->ports, idx1, port);
if (err < 0) {
SNDERR("unable to add port %u for audio %s plugin '%s'", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
snd_error(PCM, "unable to add port %u for audio %s plugin '%s'", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
return err;
}
idx1++;
@ -469,18 +469,18 @@ static int snd_pcm_ladspa_connect_plugin_duplicate1(snd_pcm_ladspa_plugin_t *plu
} else {
err = snd_pcm_ladspa_find_port(&port, plugin, io->pdesc | LADSPA_PORT_AUDIO, 0);
if (err < 0) {
SNDERR("unable to find audio %s port %u plugin '%s'", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", (unsigned int)0, plugin->desc->Name);
snd_error(PCM, "unable to find audio %s port %u plugin '%s'", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", (unsigned int)0, plugin->desc->Name);
return err;
}
}
err = snd_pcm_ladspa_add_to_carray(&eps->channels, 0, idx);
if (err < 0) {
SNDERR("unable to add channel %u for audio %s plugin '%s'", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
snd_error(PCM, "unable to add channel %u for audio %s plugin '%s'", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
return err;
}
err = snd_pcm_ladspa_add_to_array(&eps->ports, 0, port);
if (err < 0) {
SNDERR("unable to add port %u for audio %s plugin '%s'", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
snd_error(PCM, "unable to add port %u for audio %s plugin '%s'", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
return err;
}
return 0;
@ -596,13 +596,13 @@ static int snd_pcm_ladspa_check_connect(snd_pcm_ladspa_plugin_t *plugin,
for (idx = midx = 0; idx < plugin->desc->PortCount; idx++)
if ((plugin->desc->PortDescriptors[idx] & (io->pdesc | LADSPA_PORT_AUDIO)) == (io->pdesc | LADSPA_PORT_AUDIO)) {
if (eps->channels.array[midx] == NO_ASSIGN) {
SNDERR("%s port for plugin %s depth %u is not connected", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name, depth);
snd_error(PCM, "%s port for plugin %s depth %u is not connected", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name, depth);
err++;
}
midx++;
}
if (err > 0) {
SNDERR("%i connection errors total", err);
snd_error(PCM, "%i connection errors total", err);
return -EINVAL;
}
return 0;
@ -640,7 +640,7 @@ static int snd_pcm_ladspa_allocate_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *l
instance->handle = plugin->desc->instantiate(plugin->desc, pcm->rate);
instance->depth = depth;
if (instance->handle == NULL) {
SNDERR("Unable to create instance of LADSPA plugin '%s'", plugin->desc->Name);
snd_error(PCM, "Unable to create instance of LADSPA plugin '%s'", plugin->desc->Name);
free(instance);
return -EINVAL;
}
@ -648,13 +648,13 @@ static int snd_pcm_ladspa_allocate_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *l
if (plugin->policy == SND_PCM_LADSPA_POLICY_DUPLICATE) {
err = snd_pcm_ladspa_connect_plugin_duplicate(plugin, &plugin->input, &plugin->output, instance, idx);
if (err < 0) {
SNDERR("Unable to connect duplicate port of plugin '%s' channel %u depth %u", plugin->desc->Name, idx, instance->depth);
snd_error(PCM, "Unable to connect duplicate port of plugin '%s' channel %u depth %u", plugin->desc->Name, idx, instance->depth);
return err;
}
} else {
err = snd_pcm_ladspa_connect_plugin(plugin, instance);
if (err < 0) {
SNDERR("Unable to connect plugin '%s' depth %u", plugin->desc->Name, depth);
snd_error(PCM, "Unable to connect plugin '%s' depth %u", plugin->desc->Name, depth);
return err;
}
}
@ -1256,7 +1256,7 @@ static int snd_pcm_ladspa_parse_controls(snd_pcm_ladspa_plugin_t *lplug,
int err;
if (snd_config_get_type(controls) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("controls definition must be a compound");
snd_error(PCM, "controls definition must be a compound");
return -EINVAL;
}
@ -1275,16 +1275,16 @@ static int snd_pcm_ladspa_parse_controls(snd_pcm_ladspa_plugin_t *lplug,
err = snd_pcm_ladspa_find_sport(&port, lplug, io->pdesc | LADSPA_PORT_CONTROL, id);
}
if (err < 0) {
SNDERR("Unable to find an control port (%s)", id);
snd_error(PCM, "Unable to find an control port (%s)", id);
return err;
}
if (snd_config_get_ireal(n, &dval) < 0) {
SNDERR("Control port %s has not an float or integer value", id);
snd_error(PCM, "Control port %s has not an float or integer value", id);
return err;
}
err = snd_pcm_ladspa_find_port_idx(&uval, lplug, io->pdesc | LADSPA_PORT_CONTROL, port);
if (err < 0) {
SNDERR("internal error");
snd_error(PCM, "internal error");
return err;
}
io->controls_initialized[uval] = 1;
@ -1304,7 +1304,7 @@ static int snd_pcm_ladspa_parse_bindings(snd_pcm_ladspa_plugin_t *lplug,
int err;
if (snd_config_get_type(bindings) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("bindings definition must be a compound");
snd_error(PCM, "bindings definition must be a compound");
return -EINVAL;
}
snd_config_for_each(i, next, bindings) {
@ -1315,11 +1315,11 @@ static int snd_pcm_ladspa_parse_bindings(snd_pcm_ladspa_plugin_t *lplug,
continue;
err = safe_strtol(id, &channel);
if (err < 0 || channel < 0) {
SNDERR("Invalid channel number: %s", id);
snd_error(PCM, "Invalid channel number: %s", id);
return -EINVAL;
}
if (lplug->policy == SND_PCM_LADSPA_POLICY_DUPLICATE && channel > 0) {
SNDERR("Wrong channel specification for duplicate policy");
snd_error(PCM, "Wrong channel specification for duplicate policy");
return -EINVAL;
}
if (count < (unsigned int)(channel + 1))
@ -1347,19 +1347,19 @@ static int snd_pcm_ladspa_parse_bindings(snd_pcm_ladspa_plugin_t *lplug,
if (err >= 0) {
err = snd_pcm_ladspa_find_port(&array[channel], lplug, io->pdesc | LADSPA_PORT_AUDIO, port);
if (err < 0) {
SNDERR("Unable to find an audio port (%li) for channel %s", port, id);
snd_error(PCM, "Unable to find an audio port (%li) for channel %s", port, id);
return err;
}
continue;
}
err = snd_config_get_string(n, &sport);
if (err < 0) {
SNDERR("Invalid LADSPA port field type for %s", id);
snd_error(PCM, "Invalid LADSPA port field type for %s", id);
return -EINVAL;
}
err = snd_pcm_ladspa_find_sport(&array[channel], lplug, io->pdesc | LADSPA_PORT_AUDIO, sport);
if (err < 0) {
SNDERR("Unable to find an audio port (%s) for channel %s", sport, id);
snd_error(PCM, "Unable to find an audio port (%s) for channel %s", sport, id);
return err;
}
}
@ -1379,7 +1379,7 @@ static int snd_pcm_ladspa_parse_ioconfig(snd_pcm_ladspa_plugin_t *lplug,
/* always add default controls for both input and output */
err = snd_pcm_ladspa_add_default_controls(lplug, io);
if (err < 0) {
SNDERR("error adding default controls");
snd_error(PCM, "error adding default controls");
return err;
}
@ -1388,7 +1388,7 @@ static int snd_pcm_ladspa_parse_ioconfig(snd_pcm_ladspa_plugin_t *lplug,
}
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("input or output definition must be a compound");
snd_error(PCM, "input or output definition must be a compound");
return -EINVAL;
}
snd_config_for_each(i, next, conf) {
@ -1471,7 +1471,7 @@ static int snd_pcm_ladspa_add_plugin(struct list_head *list,
const char *str;
err = snd_config_get_string(n, &str);
if (err < 0) {
SNDERR("policy field must be a string");
snd_error(PCM, "policy field must be a string");
return err;
}
if (strcmp(str, "none") == 0)
@ -1479,14 +1479,14 @@ static int snd_pcm_ladspa_add_plugin(struct list_head *list,
else if (strcmp(str, "duplicate") == 0)
policy = SND_PCM_LADSPA_POLICY_DUPLICATE;
else {
SNDERR("unknown policy definition");
snd_error(PCM, "unknown policy definition");
return -EINVAL;
}
continue;
}
}
if (label == NULL && ladspa_id <= 0) {
SNDERR("no plugin label or id");
snd_error(PCM, "no plugin label or id");
return -EINVAL;
}
lplug = (snd_pcm_ladspa_plugin_t *)calloc(1, sizeof(snd_pcm_ladspa_plugin_t));
@ -1499,14 +1499,14 @@ static int snd_pcm_ladspa_add_plugin(struct list_head *list,
if (filename) {
err = snd_pcm_ladspa_check_file(lplug, filename, label, ladspa_id);
if (err < 0) {
SNDERR("Unable to load plugin '%s' ID %li, filename '%s'", label, ladspa_id, filename);
snd_error(PCM, "Unable to load plugin '%s' ID %li, filename '%s'", label, ladspa_id, filename);
free(lplug);
return err;
}
} else {
err = snd_pcm_ladspa_look_for_plugin(lplug, path, label, ladspa_id);
if (err < 0) {
SNDERR("Unable to find or load plugin '%s' ID %li, path '%s'", label, ladspa_id, path);
snd_error(PCM, "Unable to find or load plugin '%s' ID %li, path '%s'", label, ladspa_id, path);
free(lplug);
return err;
}
@ -1536,7 +1536,7 @@ static int snd_pcm_ladspa_build_plugins(struct list_head *list,
if (plugins == NULL) /* nothing TODO */
return 0;
if (snd_config_get_type(plugins) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("plugins must be defined inside a compound");
snd_error(PCM, "plugins must be defined inside a compound");
return -EINVAL;
}
do {
@ -1549,7 +1549,7 @@ static int snd_pcm_ladspa_build_plugins(struct list_head *list,
continue;
err = safe_strtol(id, &i);
if (err < 0) {
SNDERR("id of field %s is not an integer", id);
snd_error(PCM, "id of field %s is not an integer", id);
return err;
}
if (i == idx) {
@ -1562,7 +1562,7 @@ static int snd_pcm_ladspa_build_plugins(struct list_head *list,
}
} while (hit);
if (list_empty(list)) {
SNDERR("empty plugin list is not accepted");
snd_error(PCM, "empty plugin list is not accepted");
return -EINVAL;
}
return 0;
@ -1776,16 +1776,16 @@ int _snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
cplugins = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
if (plugins) {
if (pplugins || cplugins) {
SNDERR("'plugins' definition cannot be combined with 'playback_plugins' or 'capture_plugins'");
snd_error(PCM, "'plugins' definition cannot be combined with 'playback_plugins' or 'capture_plugins'");
return -EINVAL;
}
pplugins = plugins;

View file

@ -483,11 +483,11 @@ int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
slave = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
@ -497,7 +497,7 @@ int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
if (snd_pcm_format_linear(sformat) != 1 &&
snd_pcm_format_float(sformat) != 1) {
snd_config_delete(sconf);
SNDERR("slave format is not linear integer or linear float");
snd_error(PCM, "slave format is not linear integer or linear float");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
@ -521,7 +521,7 @@ int snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED,
snd_pcm_t *slave ATTRIBUTE_UNUSED,
int close_slave ATTRIBUTE_UNUSED)
{
SNDERR("please, upgrade your GCC to use lfloat plugin");
snd_error(PCM, "please, upgrade your GCC to use lfloat plugin");
return -EINVAL;
}
@ -532,7 +532,7 @@ int _snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED,
snd_pcm_stream_t stream ATTRIBUTE_UNUSED,
int mode ATTRIBUTE_UNUSED)
{
SNDERR("please, upgrade your GCC to use lfloat plugin");
snd_error(PCM, "please, upgrade your GCC to use lfloat plugin");
return -EINVAL;
}

View file

@ -526,11 +526,11 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
slave = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
@ -539,7 +539,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
return err;
if (snd_pcm_format_linear(sformat) != 1) {
snd_config_delete(sconf);
SNDERR("slave format is not linear");
snd_error(PCM, "slave format is not linear");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);

View file

@ -621,23 +621,23 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
int err;
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for scope %s", str);
snd_error(PCM, "Invalid type for scope %s", str);
err = -EINVAL;
goto _err;
}
err = snd_config_search(conf, "type", &c);
if (err < 0) {
SNDERR("type is not defined");
snd_error(PCM, "type is not defined");
goto _err;
}
err = snd_config_get_id(c, &id);
if (err < 0) {
SNDERR("unable to get id");
snd_error(PCM, "unable to get id");
goto _err;
}
err = snd_config_get_string(c, &str);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
err = snd_config_search_definition(root, "pcm_scope_type", str, &type_conf);
@ -652,7 +652,7 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
@ -660,12 +660,12 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
if (strcmp(id, "open") == 0) {
err = snd_config_get_string(n, &open_name);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
@ -678,10 +678,10 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
open_func = h ? dlsym(h, open_name) : NULL;
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
snd_error(PCM, "Cannot open shared library %s (%s)", lib, errbuf);
err = -ENOENT;
} else if (!open_func) {
SNDERR("symbol %s is not defined inside %s", open_name, lib);
snd_error(PCM, "symbol %s is not defined inside %s", open_name, lib);
snd_dlclose(h);
err = -ENXIO;
}
@ -779,24 +779,24 @@ int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "frequency") == 0) {
err = snd_config_get_integer(n, &frequency);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
}
if (strcmp(id, "scopes") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
scopes = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
@ -821,7 +821,7 @@ int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name,
if (snd_config_get_string(n, &str) >= 0) {
err = snd_config_search_definition(root, "pcm_scope", str, &n);
if (err < 0) {
SNDERR("unknown pcm_scope %s", str);
snd_error(PCM, "unknown pcm_scope %s", str);
} else {
err = snd_pcm_meter_add_scope_conf(*pcmp, id, root, n);
snd_config_delete(n);

View file

@ -803,11 +803,11 @@ int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int
if (strcmp(id, "iface") == 0 || strcmp(id, "interface") == 0) {
const char *ptr;
if ((err = snd_config_get_string(n, &ptr)) < 0) {
SNDERR("field %s is not a string", id);
snd_error(PCM, "field %s is not a string", id);
goto _err;
}
if ((err = snd_config_get_ctl_iface_ascii(ptr)) < 0) {
SNDERR("Invalid value for '%s'", id);
snd_error(PCM, "Invalid value for '%s'", id);
goto _err;
}
iface = err;
@ -815,28 +815,28 @@ int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int
}
if (strcmp(id, "name") == 0) {
if ((err = snd_config_get_string(n, &name)) < 0) {
SNDERR("field %s is not a string", id);
snd_error(PCM, "field %s is not a string", id);
goto _err;
}
continue;
}
if (strcmp(id, "index") == 0) {
if ((err = snd_config_get_integer(n, &index)) < 0) {
SNDERR("field %s is not an integer", id);
snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
continue;
}
if (strcmp(id, "device") == 0) {
if ((err = snd_config_get_integer(n, &device)) < 0) {
SNDERR("field %s is not an integer", id);
snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
continue;
}
if (strcmp(id, "subdevice") == 0) {
if ((err = snd_config_get_integer(n, &subdevice)) < 0) {
SNDERR("field %s is not an integer", id);
snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
continue;
@ -844,11 +844,11 @@ int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int
if (cchannelsp && strcmp(id, "count") == 0) {
long v;
if ((err = snd_config_get_integer(n, &v)) < 0) {
SNDERR("field %s is not an integer", id);
snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
if (v < 1 || v > 2) {
SNDERR("Invalid count %ld", v);
snd_error(PCM, "Invalid count %ld", v);
goto _err;
}
*cchannelsp = v;
@ -856,17 +856,17 @@ int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int
}
if (hwctlp && strcmp(id, "hwctl") == 0) {
if ((err = snd_config_get_bool(n)) < 0) {
SNDERR("The field %s must be a boolean type", id);
snd_error(PCM, "The field %s must be a boolean type", id);
return err;
}
*hwctlp = err;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (name == NULL) {
SNDERR("Missing control name");
snd_error(PCM, "Missing control name");
err = -EINVAL;
goto _err;
}

View file

@ -74,7 +74,7 @@ static snd_pcm_sframes_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm,
snd_pcm_uframes_t xfer = 0;
if (snd_pcm_mmap_playback_avail(pcm) < size) {
SNDMSG("too short avail %ld to size %ld", snd_pcm_mmap_playback_avail(pcm), size);
snd_check(PCM, "too short avail %ld to size %ld", snd_pcm_mmap_playback_avail(pcm), size);
return -EPIPE;
}
while (size > 0) {
@ -106,7 +106,7 @@ static snd_pcm_sframes_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm,
snd_pcm_uframes_t xfer = 0;
if (snd_pcm_mmap_capture_avail(pcm) < size) {
SNDMSG("too short avail %ld to size %ld", snd_pcm_mmap_capture_avail(pcm), size);
snd_check(PCM, "too short avail %ld to size %ld", snd_pcm_mmap_capture_avail(pcm), size);
return -EPIPE;
}
while (size > 0) {
@ -244,7 +244,7 @@ int snd_pcm_channel_info_shm(snd_pcm_t *pcm, snd_pcm_channel_info_t *info, int s
info->step = pcm->sample_bits;
break;
default:
SNDMSG("invalid access type %d", pcm->access);
snd_check(PCM, "invalid access type %d", pcm->access);
return -EINVAL;
}
info->addr = 0;
@ -263,11 +263,11 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
unsigned int c;
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
SNDMSG("PCM not set up");
snd_check(PCM, "PCM not set up");
return -EIO;
}
if (CHECK_SANITY(pcm->mmap_channels || pcm->running_areas)) {
SNDMSG("Already mmapped");
snd_check(PCM, "Already mmapped");
return -EBUSY;
}
if (pcm->ops->mmap)
@ -342,7 +342,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
case SND_PCM_AREA_MMAP:
ptr = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, i->u.mmap.fd, i->u.mmap.offset);
if (ptr == MAP_FAILED) {
SYSERR("mmap failed");
snd_errornum(PCM, "mmap failed");
return -errno;
}
i->addr = ptr;
@ -354,23 +354,23 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
/* FIXME: safer permission? */
id = shmget(IPC_PRIVATE, size, 0666);
if (id < 0) {
SYSERR("shmget failed");
snd_errornum(PCM, "shmget failed");
return -errno;
}
i->u.shm.shmid = id;
ptr = shmat(i->u.shm.shmid, 0, 0);
if (ptr == (void *) -1) {
SYSERR("shmat failed");
snd_errornum(PCM, "shmat failed");
return -errno;
}
/* automatically remove segment if not used */
if (shmctl(id, IPC_RMID, NULL) < 0){
SYSERR("shmctl mark remove failed");
snd_errornum(PCM, "shmctl mark remove failed");
return -errno;
}
i->u.shm.area = snd_shm_area_create(id, ptr);
if (i->u.shm.area == NULL) {
SYSERR("snd_shm_area_create failed");
snd_errornum(PCM, "snd_shm_area_create failed");
return -ENOMEM;
}
if (pcm->access == SND_PCM_ACCESS_MMAP_INTERLEAVED ||
@ -387,20 +387,20 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
} else {
ptr = shmat(i->u.shm.shmid, 0, 0);
if (ptr == (void*) -1) {
SYSERR("shmat failed");
snd_errornum(PCM, "shmat failed");
return -errno;
}
}
i->addr = ptr;
break;
#else
SYSERR("shm support not available");
snd_errornum(PCM, "shm support not available");
return -ENOSYS;
#endif
case SND_PCM_AREA_LOCAL:
ptr = malloc(size);
if (ptr == NULL) {
SYSERR("malloc failed");
snd_errornum(PCM, "malloc failed");
return -errno;
}
i->addr = ptr;
@ -445,7 +445,7 @@ int snd_pcm_munmap(snd_pcm_t *pcm)
unsigned int c;
assert(pcm);
if (CHECK_SANITY(! pcm->mmap_channels)) {
SNDMSG("Not mmapped");
snd_check(PCM, "Not mmapped");
return -ENXIO;
}
if (pcm->mmap_shadow) {
@ -476,7 +476,7 @@ int snd_pcm_munmap(snd_pcm_t *pcm)
case SND_PCM_AREA_MMAP:
err = munmap(i->addr, size);
if (err < 0) {
SYSERR("mmap failed");
snd_errornum(PCM, "mmap failed");
return -errno;
}
errno = 0;
@ -500,7 +500,7 @@ int snd_pcm_munmap(snd_pcm_t *pcm)
}
break;
#else
SYSERR("shm support not available");
snd_errornum(PCM, "shm support not available");
return -ENOSYS;
#endif
case SND_PCM_AREA_LOCAL:
@ -567,7 +567,7 @@ snd_pcm_sframes_t snd_pcm_write_mmap(snd_pcm_t *pcm, snd_pcm_uframes_t offset,
break;
}
default:
SNDMSG("invalid access type %d", pcm->access);
snd_check(PCM, "invalid access type %d", pcm->access);
return -EINVAL;
}
if (err < 0)
@ -623,7 +623,7 @@ snd_pcm_sframes_t snd_pcm_read_mmap(snd_pcm_t *pcm, snd_pcm_uframes_t offset,
break;
}
default:
SNDMSG("invalid access type %d", pcm->access);
snd_check(PCM, "invalid access type %d", pcm->access);
return -EINVAL;
}
if (err < 0)

View file

@ -489,11 +489,11 @@ int _snd_pcm_mmap_emul_open(snd_pcm_t **pcmp, const char *name,
slave = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);

View file

@ -538,11 +538,11 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
slave = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
@ -552,7 +552,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_MU_LAW) {
snd_config_delete(sconf);
SNDERR("invalid slave format");
snd_error(PCM, "invalid slave format");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);

View file

@ -266,7 +266,7 @@ static int snd_pcm_multi_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
for (k = 0; k < multi->slaves_count; ++k) {
err = snd_pcm_multi_hw_refine_sprepare(pcm, k, &sparams[k]);
if (err < 0) {
SNDERR("Slave PCM #%d not usable", k);
snd_error(PCM, "Slave PCM #%d not usable", k);
return err;
}
}
@ -1267,7 +1267,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
continue;
if (strcmp(id, "slaves") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
slaves = n;
@ -1275,7 +1275,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
}
if (strcmp(id, "bindings") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
bindings = n;
@ -1283,27 +1283,27 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
}
if (strcmp(id, "master") == 0) {
if (snd_config_get_integer(n, &master_slave) < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slaves) {
SNDERR("slaves is not defined");
snd_error(PCM, "slaves is not defined");
return -EINVAL;
}
if (!bindings) {
SNDERR("bindings is not defined");
snd_error(PCM, "bindings is not defined");
return -EINVAL;
}
snd_config_for_each(i, inext, slaves) {
++slaves_count;
}
if (master_slave < 0 || master_slave >= (long)slaves_count) {
SNDERR("Master slave is out of range (0-%u)", slaves_count-1);
snd_error(PCM, "Master slave is out of range (0-%u)", slaves_count-1);
return -EINVAL;
}
snd_config_for_each(i, inext, bindings) {
@ -1314,14 +1314,14 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
continue;
err = safe_strtol(id, &cchannel);
if (err < 0 || cchannel < 0) {
SNDERR("Invalid channel number: %s", id);
snd_error(PCM, "Invalid channel number: %s", id);
return -EINVAL;
}
if ((unsigned long)cchannel >= channels_count)
channels_count = cchannel + 1;
}
if (channels_count == 0) {
SNDERR("No channels defined");
snd_error(PCM, "No channels defined");
return -EINVAL;
}
slaves_id = calloc(slaves_count, sizeof(*slaves_id));
@ -1365,7 +1365,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
continue;
err = safe_strtol(id, &cchannel);
if (err < 0 || cchannel < 0) {
SNDERR("Invalid channel number: %s", id);
snd_error(PCM, "Invalid channel number: %s", id);
err = -EINVAL;
goto _free;
}
@ -1383,7 +1383,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
if (err < 0) {
err = snd_config_get_integer(n, &val);
if (err < 0) {
SNDERR("Invalid value for %s", id);
snd_error(PCM, "Invalid value for %s", id);
goto _free;
}
sprintf(buf, "%ld", val);
@ -1398,23 +1398,23 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "channel") == 0) {
err = snd_config_get_integer(n, &schannel);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto _free;
}
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
err = -EINVAL;
goto _free;
}
if (slave < 0 || (unsigned int)slave >= slaves_count) {
SNDERR("Invalid or missing sidx for channel %s", id);
snd_error(PCM, "Invalid or missing sidx for channel %s", id);
err = -EINVAL;
goto _free;
}
if (schannel < 0 ||
(unsigned int) schannel >= slaves_channels[slave]) {
SNDERR("Invalid or missing schannel for channel %s", id);
snd_error(PCM, "Invalid or missing schannel for channel %s", id);
err = -EINVAL;
goto _free;
}

View file

@ -386,13 +386,13 @@ int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t strea
if (stream == SND_PCM_STREAM_PLAYBACK) {
fd = open("/dev/null", O_WRONLY);
if (fd < 0) {
SYSERR("Cannot open /dev/null");
snd_errornum(PCM, "Cannot open /dev/null");
return -errno;
}
} else {
fd = open("/dev/full", O_RDONLY);
if (fd < 0) {
SYSERR("Cannot open /dev/full");
snd_errornum(PCM, "Cannot open /dev/full");
return -errno;
}
}
@ -481,12 +481,12 @@ int _snd_pcm_null_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_free_chmaps(chmap);
chmap = _snd_pcm_parse_config_chmaps(n);
if (!chmap) {
SNDERR("Invalid channel map for %s", id);
snd_error(PCM, "Invalid channel map for %s", id);
return -EINVAL;
}
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
snd_pcm_free_chmaps(chmap);
return -EINVAL;
}

View file

@ -2232,7 +2232,7 @@ int snd_pcm_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
return err;
err = sprepare(pcm, &sparams);
if (err < 0) {
SNDERR("Slave PCM not usable");
snd_error(PCM, "Slave PCM not usable");
return err;
}
#ifdef RULES_DEBUG

View file

@ -480,7 +480,7 @@ static int snd_pcm_plug_change_channels(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm
ttable[c * tt_ssize + c] = SND_PCM_PLUGIN_ROUTE_FULL;
break;
default:
SNDERR("Invalid route policy");
snd_error(PCM, "Invalid route policy");
break;
}
}
@ -861,16 +861,16 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
}
if (snd_pcm_format_mask_empty(&sfmt_mask)) {
SNDERR("Unable to find an usable slave format for '%s'", pcm->name);
snd_error(PCM, "Unable to find an usable slave format for '%s'", pcm->name);
for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
if (!snd_pcm_format_mask_test(format_mask, format))
continue;
SNDERR("Format: %s", snd_pcm_format_name(format));
snd_error(PCM, "Format: %s", snd_pcm_format_name(format));
}
for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
if (!snd_pcm_format_mask_test(sformat_mask, format))
continue;
SNDERR("Slave format: %s", snd_pcm_format_name(format));
snd_error(PCM, "Slave format: %s", snd_pcm_format_name(format));
}
return -EINVAL;
}
@ -883,8 +883,9 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
if (snd_pcm_hw_param_never_eq(params, SND_PCM_HW_PARAM_ACCESS, sparams)) {
err = check_access_change(params, sparams);
if (err < 0) {
SNDERR("Unable to find an usable access for '%s'",
pcm->name);
snd_error(PCM, "Unable to find an usable access for '%s'",
pcm->name);
return err;
}
}
@ -950,16 +951,16 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
}
if (snd_pcm_format_mask_empty(&fmt_mask)) {
SNDERR("Unable to find an usable client format");
snd_error(PCM, "Unable to find an usable client format");
for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
if (!snd_pcm_format_mask_test(format_mask, format))
continue;
SNDERR("Format: %s", snd_pcm_format_name(format));
snd_error(PCM, "Format: %s", snd_pcm_format_name(format));
}
for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
if (!snd_pcm_format_mask_test(sformat_mask, format))
continue;
SNDERR("Slave format: %s", snd_pcm_format_name(format));
snd_error(PCM, "Slave format: %s", snd_pcm_format_name(format));
}
return -EINVAL;
}
@ -1293,7 +1294,7 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "ttable") == 0) {
route_policy = PLUG_ROUTE_POLICY_NONE;
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
tt = n;
@ -1302,11 +1303,11 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "route_policy") == 0) {
const char *str;
if ((err = snd_config_get_string(n, &str)) < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
if (tt != NULL)
SNDERR("Table is defined, route policy is ignored");
snd_error(PCM, "Table is defined, route policy is ignored");
if (!strcmp(str, "default"))
route_policy = PLUG_ROUTE_POLICY_DEFAULT;
else if (!strcmp(str, "average"))
@ -1324,11 +1325,11 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
continue;
}
#endif
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 3,

View file

@ -257,8 +257,9 @@ static snd_pcm_sframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm,
frames = plugin->write(pcm, areas, offset, frames,
slave_areas, slave_offset, &slave_frames);
if (CHECK_SANITY(slave_frames > snd_pcm_mmap_playback_avail(slave))) {
SNDMSG("write overflow %ld > %ld", slave_frames,
snd_pcm_mmap_playback_avail(slave));
snd_check(PCM, "write overflow %ld > %ld", slave_frames,
snd_pcm_mmap_playback_avail(slave));
err = -EPIPE;
goto error;
}
@ -314,8 +315,9 @@ static snd_pcm_sframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm,
frames = (plugin->read)(pcm, areas, offset, frames,
slave_areas, slave_offset, &slave_frames);
if (CHECK_SANITY(slave_frames > snd_pcm_mmap_capture_avail(slave))) {
SNDMSG("read overflow %ld > %ld", slave_frames,
snd_pcm_mmap_playback_avail(slave));
snd_check(PCM, "read overflow %ld > %ld", slave_frames,
snd_pcm_mmap_playback_avail(slave));
err = -EPIPE;
goto error;
}
@ -447,7 +449,7 @@ snd_pcm_plugin_mmap_commit(snd_pcm_t *pcm,
xfer += frames;
}
if (CHECK_SANITY(size)) {
SNDMSG("short commit: %ld", size);
snd_check(PCM, "short commit: %ld", size);
return -EPIPE;
}
return xfer;

View file

@ -396,7 +396,7 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
sinfo->period_size = slave->period_size;
if (CHECK_SANITY(rate->pareas)) {
SNDMSG("rate plugin already in use");
snd_check(PCM, "rate plugin already in use");
return -EBUSY;
}
@ -412,7 +412,7 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
rate->orig_in_format = rate->info.in.format;
rate->orig_out_format = rate->info.out.format;
if (choose_preferred_format(rate) < 0) {
SNDERR("No matching format in rate plugin");
snd_error(PCM, "No matching format in rate plugin");
err = -EINVAL;
goto error_pareas;
}
@ -854,7 +854,7 @@ static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate,
return result;
#if 0
if (slave_offset) {
SNDERR("non-zero slave_offset %ld", slave_offset);
snd_error(PCM, "non-zero slave_offset %ld", slave_offset);
return -EIO;
}
#endif
@ -953,7 +953,7 @@ static int snd_pcm_rate_grab_next_period(snd_pcm_t *pcm, snd_pcm_uframes_t hw_of
return result;
#if 0
if (slave_offset) {
SNDERR("non-zero slave_offset %ld", slave_offset);
snd_error(PCM, "non-zero slave_offset %ld", slave_offset);
return -EIO;
}
#endif
@ -1565,20 +1565,20 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
break;
}
if (!type) {
SNDERR("No name given for rate converter");
snd_error(PCM, "No name given for rate converter");
snd_pcm_free(pcm);
free(rate);
return -EINVAL;
}
err = rate_open_func(rate, type, converter, 1);
} else {
SNDERR("Invalid type for rate converter");
snd_error(PCM, "Invalid type for rate converter");
snd_pcm_free(pcm);
free(rate);
return -EINVAL;
}
if (err < 0) {
SNDERR("Cannot find rate converter");
snd_error(PCM, "Cannot find rate converter");
snd_pcm_free(pcm);
free(rate);
return -ENOENT;
@ -1596,7 +1596,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
if (! rate->ops.init || ! (rate->ops.convert || rate->ops.convert_s16) ||
! rate->ops.input_frames || ! rate->ops.output_frames) {
SNDERR("Inproper rate plugin %s initialization", type);
snd_error(PCM, "Inproper rate plugin %s initialization", type);
snd_pcm_free(pcm);
free(rate);
return err;
@ -1698,11 +1698,11 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
converter = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
@ -1714,7 +1714,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
if (sformat != SND_PCM_FORMAT_UNKNOWN &&
snd_pcm_format_linear(sformat) != 1) {
snd_config_delete(sconf);
SNDERR("slave format is not linear");
snd_error(PCM, "slave format is not linear");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);

View file

@ -246,7 +246,7 @@ static void linear_shrink(struct rate_linear *rate,
dst += dst_step;
dst_frames1++;
if (CHECK_SANITY(dst_frames1 > dst_frames)) {
SNDERR("dst_frames overflow");
snd_error(PCM, "dst_frames overflow");
break;
}
}
@ -298,7 +298,7 @@ static void linear_shrink_s16(struct rate_linear *rate,
dst += dst_step;
dst_frames1++;
if (CHECK_SANITY(dst_frames1 > dst_frames)) {
SNDERR("dst_frames overflow");
snd_error(PCM, "dst_frames overflow");
break;
}
}
@ -375,8 +375,9 @@ static int linear_adjust_pitch(void *obj, snd_pcm_rate_info_t *info)
cframes_new = input_frames(rate, info->out.period_size);
if ((cframes > info->in.period_size && cframes_new < info->in.period_size) ||
(cframes < info->in.period_size && cframes_new > info->in.period_size)) {
SNDERR("invalid pcm period_size %ld -> %ld",
info->in.period_size, info->out.period_size);
snd_error(PCM, "invalid pcm period_size %ld -> %ld",
info->in.period_size, info->out.period_size);
return -EIO;
}
cframes = cframes_new;

View file

@ -810,7 +810,7 @@ static int determine_chmap(snd_config_t *tt, snd_pcm_chmap_t **tt_chmap)
continue;
if (chmap->channels >= MAX_CHMAP_CHANNELS) {
SNDERR("Too many channels in ttable chmap");
snd_error(PCM, "Too many channels in ttable chmap");
goto err;
}
chmap->pos[chmap->channels++] = ch;
@ -875,7 +875,7 @@ static int find_matching_chmap(snd_pcm_chmap_query_t **chmaps,
}
if (*found_chmap == NULL) {
SNDERR("Found no matching channel map");
snd_error(PCM, "Found no matching channel map");
return -EINVAL;
}
return 0;
@ -1085,7 +1085,7 @@ static int _snd_pcm_route_determine_ttable(snd_config_t *tt,
continue;
err = safe_strtol(id, &cchannel);
if (err < 0) {
SNDERR("Invalid client channel: %s", id);
snd_error(PCM, "Invalid client channel: %s", id);
return -EINVAL;
}
if (cchannel + 1 > csize)
@ -1100,7 +1100,7 @@ static int _snd_pcm_route_determine_ttable(snd_config_t *tt,
continue;
err = strtochannel(id, chmap, &schannel, 1);
if (err < 0) {
SNDERR("Invalid slave channel: %s", id);
snd_error(PCM, "Invalid slave channel: %s", id);
return -EINVAL;
}
if (schannel + 1 > ssize)
@ -1108,7 +1108,7 @@ static int _snd_pcm_route_determine_ttable(snd_config_t *tt,
}
}
if (csize == 0 || ssize == 0) {
SNDERR("Invalid null ttable configuration");
snd_error(PCM, "Invalid null ttable configuration");
return -EINVAL;
}
*tt_csize = csize;
@ -1168,7 +1168,7 @@ static int _snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_ent
err = safe_strtol(id, &cchannel);
if (err < 0 ||
cchannel < 0 || (unsigned int) cchannel > tt_csize) {
SNDERR("Invalid client channel: %s", id);
snd_error(PCM, "Invalid client channel: %s", id);
return -EINVAL;
}
if (snd_config_get_type(in) != SND_CONFIG_TYPE_COMPOUND)
@ -1183,13 +1183,13 @@ static int _snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_ent
ss = strtochannel(id, chmap, scha, tt_ssize);
if (ss < 0) {
SNDERR("Invalid slave channel: %s", id);
snd_error(PCM, "Invalid slave channel: %s", id);
return -EINVAL;
}
err = snd_config_get_ireal(jnode, &value);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
@ -1197,7 +1197,7 @@ static int _snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_ent
long schannel = scha[k];
if (schannel < 0 || (unsigned int) schannel > tt_ssize ||
(schannels > 0 && schannel >= schannels)) {
SNDERR("Invalid slave channel: %s", id);
snd_error(PCM, "Invalid slave channel: %s", id);
return -EINVAL;
}
ttable[cchannel * tt_ssize + schannel] = value;
@ -1315,7 +1315,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
}
if (strcmp(id, "ttable") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
snd_pcm_free_chmaps(chmaps);
return -EINVAL;
}
@ -1325,21 +1325,21 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "chmap") == 0) {
chmaps = _snd_pcm_parse_config_chmaps(n);
if (!chmaps) {
SNDERR("Invalid channel map for %s", id);
snd_error(PCM, "Invalid channel map for %s", id);
return -EINVAL;
}
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
snd_pcm_free_chmaps(chmaps);
return -EINVAL;
}
if (!tt) {
SNDERR("ttable is not defined");
snd_error(PCM, "ttable is not defined");
snd_pcm_free_chmaps(chmaps);
return -EINVAL;
}
@ -1353,7 +1353,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
if (sformat != SND_PCM_FORMAT_UNKNOWN &&
snd_pcm_format_linear(sformat) != 1) {
snd_config_delete(sconf);
SNDERR("slave format is not linear");
snd_error(PCM, "slave format is not linear");
snd_pcm_free_chmaps(chmaps);
return -EINVAL;
}

View file

@ -238,11 +238,11 @@ static snd_pcm_uframes_t _snd_pcm_share_missing(snd_pcm_t *pcm)
}
err = snd_pcm_mmap_commit(spcm, snd_pcm_mmap_offset(spcm), frames);
if (err < 0) {
SYSMSG("snd_pcm_mmap_commit error");
snd_checknum(PCM, "snd_pcm_mmap_commit error");
return INT_MAX;
}
if (err != frames)
SYSMSG("commit returns %ld for size %ld", err, frames);
snd_checknum(PCM, "commit returns %ld for size %ld", err, frames);
slave_avail -= err;
} else {
if (safety_missing == 0)
@ -282,7 +282,7 @@ static snd_pcm_uframes_t _snd_pcm_share_missing(snd_pcm_t *pcm)
running = 1;
break;
default:
SNDERR("invalid shared PCM state %d", share->state);
snd_error(PCM, "invalid shared PCM state %d", share->state);
return INT_MAX;
}
@ -370,13 +370,13 @@ static void *snd_pcm_share_thread(void *data)
pfd[0].events = POLLIN;
err = snd_pcm_poll_descriptors(spcm, &pfd[1], 1);
if (err != 1) {
SNDERR("invalid poll descriptors %d", err);
snd_error(PCM, "invalid poll descriptors %d", err);
return NULL;
}
Pthread_mutex_lock(&slave->mutex);
err = pipe(slave->poll);
if (err < 0) {
SYSERR("can't create a pipe");
snd_errornum(PCM, "can't create a pipe");
Pthread_mutex_unlock(&slave->mutex);
return NULL;
}
@ -403,7 +403,7 @@ static void *snd_pcm_share_thread(void *data)
snd_pcm_sw_params_set_avail_min(spcm, &slave->sw_params, avail_min);
err = snd_pcm_sw_params(spcm, &slave->sw_params);
if (err < 0) {
SYSERR("snd_pcm_sw_params error");
snd_errornum(PCM, "snd_pcm_sw_params error");
Pthread_mutex_unlock(&slave->mutex);
return NULL;
}
@ -457,7 +457,7 @@ static void _snd_pcm_share_update(snd_pcm_t *pcm)
snd_pcm_sw_params_set_avail_min(spcm, &slave->sw_params, avail_min);
err = snd_pcm_sw_params(spcm, &slave->sw_params);
if (err < 0) {
SYSERR("snd_pcm_sw_params error");
snd_errornum(PCM, "snd_pcm_sw_params error");
return;
}
}
@ -648,7 +648,7 @@ static int snd_pcm_share_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
spcm->buffer_size, 0);
_err:
if (err < 0) {
SNDERR("slave is already running with incompatible setup");
snd_error(PCM, "slave is already running with incompatible setup");
err = -EBUSY;
goto _end;
}
@ -852,11 +852,11 @@ static snd_pcm_sframes_t _snd_pcm_share_mmap_commit(snd_pcm_t *pcm,
snd_pcm_sframes_t err;
err = snd_pcm_mmap_commit(spcm, snd_pcm_mmap_offset(spcm), frames);
if (err < 0) {
SYSMSG("snd_pcm_mmap_commit error");
snd_checknum(PCM, "snd_pcm_mmap_commit error");
return err;
}
if (err != frames) {
SYSMSG("commit returns %ld for size %ld", err, frames);
snd_checknum(PCM, "commit returns %ld for size %ld", err, frames);
return err;
}
}
@ -1399,11 +1399,11 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
for (k = 0; k < channels; ++k) {
if (channels_map[k] >= sizeof(slave_map) / sizeof(slave_map[0])) {
SNDERR("Invalid slave channel (%d) in binding", channels_map[k]);
snd_error(PCM, "Invalid slave channel (%d) in binding", channels_map[k]);
return -EINVAL;
}
if (slave_map[channels_map[k]]) {
SNDERR("Repeated slave channel (%d) in binding", channels_map[k]);
snd_error(PCM, "Repeated slave channel (%d) in binding", channels_map[k]);
return -EINVAL;
}
slave_map[channels_map[k]] = 1;
@ -1516,7 +1516,7 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
snd_pcm_share_t *sh = list_entry(i, snd_pcm_share_t, list);
for (k = 0; k < sh->channels; ++k) {
if (slave_map[sh->slave_channels[k]]) {
SNDERR("Slave channel %d is already in use", sh->slave_channels[k]);
snd_error(PCM, "Slave channel %d is already in use", sh->slave_channels[k]);
Pthread_mutex_unlock(&slave->mutex);
close(sd[0]);
close(sd[1]);
@ -1638,17 +1638,17 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
}
if (strcmp(id, "bindings") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
bindings = n;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 5,
@ -1665,12 +1665,12 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
sname = err >= 0 && sname ? strdup(sname) : NULL;
snd_config_delete(sconf);
if (sname == NULL) {
SNDERR("slave.pcm is not a string");
snd_error(PCM, "slave.pcm is not a string");
return err;
}
if (!bindings) {
SNDERR("bindings is not defined");
snd_error(PCM, "bindings is not defined");
err = -EINVAL;
goto _free;
}
@ -1682,7 +1682,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
continue;
err = safe_strtol(id, &cchannel);
if (err < 0 || cchannel < 0) {
SNDERR("Invalid client channel in binding: %s", id);
snd_error(PCM, "Invalid client channel in binding: %s", id);
err = -EINVAL;
goto _free;
}
@ -1690,7 +1690,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
channels = cchannel + 1;
}
if (channels == 0) {
SNDERR("No bindings defined");
snd_error(PCM, "No bindings defined");
err = -EINVAL;
goto _free;
}

View file

@ -72,7 +72,7 @@ static long snd_pcm_shm_action_fd0(snd_pcm_t *pcm, int *fd)
if (err != 1)
return -EBADFD;
if (ctrl->cmd) {
SNDERR("Server has not done the cmd");
snd_error(PCM, "Server has not done the cmd");
return -EBADFD;
}
return ctrl->result;
@ -99,7 +99,7 @@ static int snd_pcm_shm_new_rbptr(snd_pcm_t *pcm, snd_pcm_shm_t *shm,
mmap_size = page_ptr(shm_rbptr->offset, sizeof(snd_pcm_uframes_t), &offset, &mmap_offset);
ptr = mmap(NULL, mmap_size, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, mmap_offset);
if (ptr == MAP_FAILED || ptr == NULL) {
SYSERR("shm rbptr mmap failed");
snd_errornum(PCM, "shm rbptr mmap failed");
return -errno;
}
if (&pcm->hw == rbptr)
@ -126,7 +126,7 @@ static long snd_pcm_shm_action(snd_pcm_t *pcm)
if (err != 1)
return -EBADFD;
if (ctrl->cmd) {
SNDERR("Server has not done the cmd");
snd_error(PCM, "Server has not done the cmd");
return -EBADFD;
}
result = ctrl->result;
@ -161,7 +161,7 @@ static long snd_pcm_shm_action_fd(snd_pcm_t *pcm, int *fd)
if (err != 1)
return -EBADFD;
if (ctrl->cmd) {
SNDERR("Server has not done the cmd");
snd_error(PCM, "Server has not done the cmd");
return -EBADFD;
}
if (ctrl->hw.changed) {
@ -354,7 +354,7 @@ static int snd_pcm_shm_munmap(snd_pcm_t *pcm)
}
err = close(i->u.mmap.fd);
if (err < 0) {
SYSERR("close failed");
snd_errornum(PCM, "close failed");
return -errno;
}
}
@ -641,7 +641,7 @@ static int make_local_socket(const char *filename)
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (sock < 0) {
SYSERR("socket failed");
snd_errornum(PCM, "socket failed");
return -errno;
}
@ -649,7 +649,7 @@ static int make_local_socket(const char *filename)
memcpy(addr->sun_path, filename, l);
if (connect(sock, (struct sockaddr *) addr, size) < 0) {
SYSERR("connect failed");
snd_errornum(PCM, "connect failed");
return -errno;
}
return sock;
@ -687,7 +687,7 @@ int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
result = make_local_socket(sockname);
if (result < 0) {
SNDERR("server for socket %s is not running", sockname);
snd_error(PCM, "server for socket %s is not running", sockname);
goto _err;
}
sock = result;
@ -702,23 +702,23 @@ int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
req->namelen = snamelen;
err = write(sock, req, reqlen);
if (err < 0) {
SYSERR("write error");
snd_errornum(PCM, "write error");
result = -errno;
goto _err;
}
if ((size_t) err != reqlen) {
SNDERR("write size error");
snd_error(PCM, "write size error");
result = -EINVAL;
goto _err;
}
err = read(sock, &ans, sizeof(ans));
if (err < 0) {
SYSERR("read error");
snd_errornum(PCM, "read error");
result = -errno;
goto _err;
}
if (err != sizeof(ans)) {
SNDERR("read size error");
snd_error(PCM, "read size error");
result = -EINVAL;
goto _err;
}
@ -728,7 +728,7 @@ int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
ctrl = shmat(ans.cookie, 0, 0);
if (!ctrl) {
SYSERR("shmat error");
snd_errornum(PCM, "shmat error");
result = -errno;
goto _err;
}
@ -830,7 +830,7 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "server") == 0) {
err = snd_config_get_string(n, &server);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
@ -838,29 +838,29 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "pcm") == 0) {
err = snd_config_get_string(n, &pcm_name);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!pcm_name) {
SNDERR("pcm is not defined");
snd_error(PCM, "pcm is not defined");
return -EINVAL;
}
if (!server) {
SNDERR("server is not defined");
snd_error(PCM, "server is not defined");
return -EINVAL;
}
err = snd_config_search_definition(root, "server", server, &sconfig);
if (err < 0) {
SNDERR("Unknown server %s", server);
snd_error(PCM, "Unknown server %s", server);
return -EINVAL;
}
if (snd_config_get_type(sconfig) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for server %s definition", server);
snd_error(PCM, "Invalid type for server %s definition", server);
goto _err;
}
snd_config_for_each(i, next, sconfig) {
@ -875,7 +875,7 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "socket") == 0) {
err = snd_config_get_string(n, &sockname);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
@ -883,19 +883,19 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "port") == 0) {
err = snd_config_get_integer(n, &port);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
_err:
err = -EINVAL;
goto __error;
}
if (!sockname) {
SNDERR("socket is not defined");
snd_error(PCM, "socket is not defined");
goto _err;
}
err = snd_pcm_shm_open(pcmp, name, sockname, pcm_name, stream, mode);

View file

@ -632,8 +632,9 @@ static int snd_pcm_softvol_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * param
slave->format != SND_PCM_FORMAT_S24_LE &&
slave->format != SND_PCM_FORMAT_S32_LE &&
slave->format != SND_PCM_FORMAT_S32_BE) {
SNDERR("softvol supports only S16_LE, S16_BE, S24_LE, S24_3LE, "
"S32_LE or S32_BE");
snd_error(PCM, "softvol supports only S16_LE, S16_BE, S24_LE, S24_3LE, "
"S32_LE or S32_BE");
return -EINVAL;
}
svol->sformat = slave->format;
@ -772,14 +773,14 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
return err;
ctl_card = snd_pcm_info_get_card(&info);
if (ctl_card < 0) {
SNDERR("No card defined for softvol control");
snd_error(PCM, "No card defined for softvol control");
return -EINVAL;
}
}
sprintf(tmp_name, "hw:%d", ctl_card);
err = snd_ctl_open(&svol->ctl, tmp_name, 0);
if (err < 0) {
SNDERR("Cannot open CTL %s", tmp_name);
snd_error(PCM, "Cannot open CTL %s", tmp_name);
return err;
}
@ -798,12 +799,12 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
snd_ctl_elem_info_set_id(&cinfo, ctl_id);
if ((err = snd_ctl_elem_info(svol->ctl, &cinfo)) < 0) {
if (err != -ENOENT) {
SNDERR("Cannot get info for CTL %s", tmp_name);
snd_error(PCM, "Cannot get info for CTL %s", tmp_name);
return err;
}
err = add_user_ctl(svol, &cinfo, cchannels);
if (err < 0) {
SNDERR("Cannot add a control");
snd_error(PCM, "Cannot add a control");
return err;
}
} else {
@ -822,14 +823,14 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
(cinfo.access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) != 0)) {
err = snd_ctl_elem_remove(svol->ctl, &cinfo.id);
if (err < 0) {
SNDERR("Control %s mismatch", tmp_name);
snd_error(PCM, "Control %s mismatch", tmp_name);
return err;
}
/* clear cinfo including numid */
snd_ctl_elem_info_clear(&cinfo);
snd_ctl_elem_info_set_id(&cinfo, ctl_id);
if ((err = add_user_ctl(svol, &cinfo, cchannels)) < 0) {
SNDERR("Cannot add a control");
snd_error(PCM, "Cannot add a control");
return err;
}
} else if (svol->max_val > 1) {
@ -852,7 +853,7 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
#ifndef HAVE_SOFT_FLOAT
svol->dB_value = calloc(resolution, sizeof(unsigned int));
if (! svol->dB_value) {
SNDERR("cannot allocate dB table");
snd_error(PCM, "cannot allocate dB table");
return -ENOMEM;
}
svol->min_dB = min_dB;
@ -868,7 +869,7 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
if (svol->zero_dB_val)
svol->dB_value[svol->zero_dB_val] = 65535;
#else
SNDERR("Cannot handle the given dB range and resolution");
snd_error(PCM, "Cannot handle the given dB range and resolution");
return -EINVAL;
#endif
}
@ -1020,28 +1021,28 @@ static int _snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_
}
if (strcmp(id, "name") == 0) {
if ((err = snd_config_get_string(n, &name)) < 0) {
SNDERR("field %s is not a string", id);
snd_error(PCM, "field %s is not a string", id);
goto _err;
}
continue;
}
if (strcmp(id, "index") == 0) {
if ((err = snd_config_get_integer(n, &index)) < 0) {
SNDERR("field %s is not an integer", id);
snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
continue;
}
if (strcmp(id, "device") == 0) {
if ((err = snd_config_get_integer(n, &device)) < 0) {
SNDERR("field %s is not an integer", id);
snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
continue;
}
if (strcmp(id, "subdevice") == 0) {
if ((err = snd_config_get_integer(n, &subdevice)) < 0) {
SNDERR("field %s is not an integer", id);
snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
continue;
@ -1049,21 +1050,21 @@ static int _snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_
if (strcmp(id, "count") == 0) {
long v;
if ((err = snd_config_get_integer(n, &v)) < 0) {
SNDERR("field %s is not an integer", id);
snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
if (v < 1 || v > 2) {
SNDERR("Invalid count %ld", v);
snd_error(PCM, "Invalid count %ld", v);
goto _err;
}
*cchannels = v;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (name == NULL) {
SNDERR("Missing control name");
snd_error(PCM, "Missing control name");
err = -EINVAL;
goto _err;
}
@ -1182,7 +1183,7 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
long v;
err = snd_config_get_integer(n, &v);
if (err < 0) {
SNDERR("Invalid resolution value");
snd_error(PCM, "Invalid resolution value");
return err;
}
resolution = v;
@ -1191,7 +1192,7 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "min_dB") == 0) {
err = snd_config_get_ireal(n, &min_dB);
if (err < 0) {
SNDERR("Invalid min_dB value");
snd_error(PCM, "Invalid min_dB value");
return err;
}
continue;
@ -1199,33 +1200,34 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "max_dB") == 0) {
err = snd_config_get_ireal(n, &max_dB);
if (err < 0) {
SNDERR("Invalid max_dB value");
snd_error(PCM, "Invalid max_dB value");
return err;
}
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
if (!control) {
SNDERR("control is not defined");
snd_error(PCM, "control is not defined");
return -EINVAL;
}
if (min_dB >= 0) {
SNDERR("min_dB must be a negative value");
snd_error(PCM, "min_dB must be a negative value");
return -EINVAL;
}
if (max_dB <= min_dB || max_dB > MAX_DB_UPPER_LIMIT) {
SNDERR("max_dB must be larger than min_dB and less than %d dB",
MAX_DB_UPPER_LIMIT);
snd_error(PCM, "max_dB must be larger than min_dB and less than %d dB",
MAX_DB_UPPER_LIMIT);
return -EINVAL;
}
if (resolution <= 1 || resolution > 1024) {
SNDERR("Invalid resolution value %d", resolution);
snd_error(PCM, "Invalid resolution value %d", resolution);
return -EINVAL;
}
if (mode & SND_PCM_NO_SOFTVOL) {
@ -1247,7 +1249,7 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
sformat != SND_PCM_FORMAT_S24_LE &&
sformat != SND_PCM_FORMAT_S32_LE &&
sformat != SND_PCM_FORMAT_S32_BE) {
SNDERR("only S16_LE, S16_BE, S24_LE, S24_3LE, S32_LE or S32_BE format is supported");
snd_error(PCM, "only S16_LE, S16_BE, S24_LE, S24_3LE, S32_LE or S32_BE format is supported");
snd_config_delete(sconf);
return -EINVAL;
}

View file

@ -236,7 +236,7 @@ int _snd_pcm_scope_level_open(snd_pcm_t *pcm, const char *name,
if (strcmp(id, "bar_width") == 0) {
err = snd_config_get_integer(n, &bar_width);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
@ -244,7 +244,7 @@ int _snd_pcm_scope_level_open(snd_pcm_t *pcm, const char *name,
if (strcmp(id, "decay_ms") == 0) {
err = snd_config_get_integer(n, &decay_ms);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
@ -252,12 +252,12 @@ int _snd_pcm_scope_level_open(snd_pcm_t *pcm, const char *name,
if (strcmp(id, "peak_ms") == 0) {
err = snd_config_get_integer(n, &peak_ms);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (bar_width < 0)