- unified snd_pcm_hw_params_* functions

- added backward compatibility for older non-compatible functions
- added --with-compat-rc3 to configure script to build library
  backwards compatible with 0.9.0rc3
- added symbol versioning like libc.so.6
  - ALSA_0.9      - alsa base
  - ALSA_0.9.0rc4 - first set of new functions (snd_pcm_hw_params_*)
This commit is contained in:
Jaroslav Kysela 2002-09-17 12:33:05 +00:00
parent cabf841f4e
commit b9343e0834
23 changed files with 1271 additions and 483 deletions

View file

@ -6,9 +6,10 @@ libasound_la_SOURCES = conf.c confmisc.c input.c output.c async.c error.c dlmisc
libasound_la_LIBADD = control/libcontrol.la mixer/libmixer.la pcm/libpcm.la \
rawmidi/librawmidi.la timer/libtimer.la \
hwdep/libhwdep.la seq/libseq.la instr/libinstr.la \
compat/libcompat.la -lm -ldl -lpthread
compat/libcompat.la -lm -ldl -lpthread
libasound_la_LDFLAGS = -version-info $(COMPATNUM)
LDFLAGS = -Wl,--version-script=Versions
control/libcontrol.la:
$(MAKE) -C control libcontrol.la

View file

@ -7,7 +7,8 @@ libpcm_la_SOURCES = atomic.c mask.c interval.c \
pcm_route.c pcm_mulaw.c pcm_alaw.c pcm_adpcm.c \
pcm_rate.c pcm_plug.c pcm_misc.c pcm_mmap.c pcm_multi.c \
pcm_shm.c pcm_file.c pcm_null.c pcm_share.c \
pcm_meter.c pcm_hooks.c pcm_lfloat.c pcm_ladspa.c pcm_symbols.c
pcm_meter.c pcm_hooks.c pcm_lfloat.c pcm_ladspa.c \
pcm_symbols.c
noinst_HEADERS = pcm_local.h pcm_plugin.h mask.h mask_inline.h \
interval.h interval_inline.h plugin_ops.h ladspa.h

File diff suppressed because it is too large Load diff

View file

@ -416,7 +416,7 @@ static int snd_pcm_adpcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
if (err < 0)
return err;
err = snd_pcm_hw_params_get_format(params, &format);
err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format);
if (err < 0)
return err;

View file

@ -312,7 +312,7 @@ static int snd_pcm_alaw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
if (err < 0)
return err;
err = snd_pcm_hw_params_get_format(params, &format);
err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format);
if (err < 0)
return err;

View file

@ -270,7 +270,7 @@ static int snd_pcm_hw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
*params = old;
pmask = snd_pcm_hw_param_get_mask(params, SND_PCM_HW_PARAM_ACCESS);
oldmask = *(snd_pcm_access_mask_t *)pmask;
if (snd_pcm_hw_params_get_access(params, &access) < 0)
if (INTERNAL(snd_pcm_hw_params_get_access)(params, &access) < 0)
goto _err;
switch (access) {
case SND_PCM_ACCESS_MMAP_INTERLEAVED:

View file

@ -278,11 +278,11 @@ static int snd_pcm_lfloat_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
if (err < 0)
return err;
if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
err = snd_pcm_hw_params_get_format(params, &src_format);
err = INTERNAL(snd_pcm_hw_params_get_format)(params, &src_format);
dst_format = slave->format;
} else {
src_format = slave->format;
err = snd_pcm_hw_params_get_format(params, &dst_format);
err = INTERNAL(snd_pcm_hw_params_get_format)(params, &dst_format);
}
if (snd_pcm_format_linear(src_format)) {
lfloat->int32_idx = snd_pcm_linear_get32_index(src_format, SND_PCM_FORMAT_S32);

View file

@ -318,7 +318,7 @@ static int snd_pcm_linear_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
snd_pcm_plugin_hw_params_slave);
if (err < 0)
return err;
err = snd_pcm_hw_params_get_format(params, &format);
err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format);
if (err < 0)
return err;
linear->use_getput = (snd_pcm_format_physical_width(format) == 24 ||

View file

@ -496,12 +496,11 @@ int snd_pcm_hw_param_set_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
snd_set_mode_t mode,
snd_pcm_hw_param_t var);
int snd_pcm_hw_param_set_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, int *dir, unsigned int *rval);
snd_pcm_hw_param_t var, unsigned int *rval, int *dir);
int snd_pcm_hw_param_set_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, int *dir, unsigned int *rval);
snd_pcm_hw_param_t var, unsigned int *rval, int *dir);
int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, unsigned int val,
int *dir, unsigned int *rval);
snd_pcm_hw_param_t var, unsigned int *val, int *dir);
int snd_pcm_hw_param_set_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
snd_set_mode_t mode,
snd_pcm_hw_param_t var,
@ -520,12 +519,139 @@ int snd_pcm_hw_param_set(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
int snd_pcm_hw_param_set_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
snd_set_mode_t mode,
snd_pcm_hw_param_t var, const snd_mask_t *mask);
int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, int *dir);
unsigned int snd_pcm_hw_param_get_min(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, int *dir);
unsigned int snd_pcm_hw_param_get_max(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, int *dir);
int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
unsigned int *val, int *dir);
int snd_pcm_hw_param_get_min(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var,
unsigned int *val, int *dir);
int snd_pcm_hw_param_get_max(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var,
unsigned int *val, int *dir);
#ifdef INTERNAL
int INTERNAL(snd_pcm_hw_params_get_access)(const snd_pcm_hw_params_t *params, snd_pcm_access_t *access);
int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access);
int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access);
int INTERNAL(snd_pcm_hw_params_set_access_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access);
int INTERNAL(snd_pcm_hw_params_set_access_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access);
int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
int snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
int INTERNAL(snd_pcm_hw_params_get_format)(const snd_pcm_hw_params_t *params, snd_pcm_format_t *val);
int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
int INTERNAL(snd_pcm_hw_params_set_format_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format);
int INTERNAL(snd_pcm_hw_params_set_format_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format);
int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
int INTERNAL(snd_pcm_hw_params_get_subformat)(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);
int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat);
int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat);
int INTERNAL(snd_pcm_hw_params_set_subformat_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);
int INTERNAL(snd_pcm_hw_params_set_subformat_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);
int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
int INTERNAL(snd_pcm_hw_params_get_channels)(const snd_pcm_hw_params_t *params, unsigned int *val);
int INTERNAL(snd_pcm_hw_params_get_channels_min)(const snd_pcm_hw_params_t *params, unsigned int *val);
int INTERNAL(snd_pcm_hw_params_get_channels_max)(const snd_pcm_hw_params_t *params, unsigned int *val);
int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max);
int INTERNAL(snd_pcm_hw_params_set_channels_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int INTERNAL(snd_pcm_hw_params_set_channels_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int INTERNAL(snd_pcm_hw_params_set_channels_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int INTERNAL(snd_pcm_hw_params_get_rate)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_get_rate_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_get_rate_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
int INTERNAL(snd_pcm_hw_params_set_rate_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_set_rate_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_set_rate_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_get_period_time)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_get_period_time_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_get_period_time_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
int INTERNAL(snd_pcm_hw_params_set_period_time_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_set_period_time_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_set_period_time_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_get_period_size)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
int INTERNAL(snd_pcm_hw_params_get_period_size_min)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
int INTERNAL(snd_pcm_hw_params_get_period_size_max)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir);
int INTERNAL(snd_pcm_hw_params_set_period_size_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
int INTERNAL(snd_pcm_hw_params_set_period_size_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
int INTERNAL(snd_pcm_hw_params_set_period_size_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
int INTERNAL(snd_pcm_hw_params_get_periods)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_get_periods_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_get_periods_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
int INTERNAL(snd_pcm_hw_params_get_buffer_time)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_get_buffer_time_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_get_buffer_time_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
int INTERNAL(snd_pcm_hw_params_set_buffer_time_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_set_buffer_time_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_set_buffer_time_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_get_buffer_size)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int INTERNAL(snd_pcm_hw_params_get_buffer_size_min)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int INTERNAL(snd_pcm_hw_params_get_buffer_size_max)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max);
int INTERNAL(snd_pcm_hw_params_set_buffer_size_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int INTERNAL(snd_pcm_hw_params_set_buffer_size_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int INTERNAL(snd_pcm_hw_params_set_buffer_size_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int INTERNAL(snd_pcm_hw_params_get_tick_time)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_get_tick_time_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_get_tick_time_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
int INTERNAL(snd_pcm_hw_params_set_tick_time_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_set_tick_time_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int INTERNAL(snd_pcm_hw_params_set_tick_time_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
#endif /* INTERNAL */
const char *snd_pcm_hw_param_name(snd_pcm_hw_param_t param);
void snd_pcm_hw_param_dump(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, snd_output_t *out);

View file

@ -327,7 +327,7 @@ static int snd_pcm_mulaw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
if (err < 0)
return err;
err = snd_pcm_hw_params_get_format(params, &format);
err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format);
if (err < 0)
return err;

View file

@ -101,8 +101,8 @@ void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params)
/* Return the value for field PAR if it's fixed in configuration space
defined by PARAMS. Return -EINVAL otherwise
*/
int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, int *dir)
int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
unsigned int *val, int *dir)
{
if (hw_is_mask(var)) {
const snd_mask_t *mask = hw_param_mask_c(params, var);
@ -110,53 +110,62 @@ int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params,
return -EINVAL;
if (dir)
*dir = 0;
return snd_mask_value(mask);
}
if (hw_is_interval(var)) {
if (val)
*val = snd_mask_value(mask);
return 0;
} else if (hw_is_interval(var)) {
const snd_interval_t *i = hw_param_interval_c(params, var);
if (snd_interval_empty(i) || !snd_interval_single(i))
return -EINVAL;
if (dir)
*dir = i->openmin;
return snd_interval_value(i);
if (val)
*val = snd_interval_value(i);
return 0;
}
assert(0);
return -EINVAL;
}
/* Return the minimum value for field PAR. */
unsigned int snd_pcm_hw_param_get_min(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, int *dir)
int snd_pcm_hw_param_get_min(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
unsigned int *val, int *dir)
{
if (hw_is_mask(var)) {
if (dir)
*dir = 0;
return snd_mask_min(hw_param_mask_c(params, var));
}
if (hw_is_interval(var)) {
if (val)
*val = snd_mask_min(hw_param_mask_c(params, var));
return 0;
} else if (hw_is_interval(var)) {
const snd_interval_t *i = hw_param_interval_c(params, var);
if (dir)
*dir = i->openmin;
return snd_interval_min(i);
if (val)
*val = snd_interval_min(i);
return 0;
}
assert(0);
return 0;
}
/* Return the maximum value for field PAR. */
unsigned int snd_pcm_hw_param_get_max(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, int *dir)
int snd_pcm_hw_param_get_max(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
unsigned int *val, int *dir)
{
if (hw_is_mask(var)) {
if (dir)
*dir = 0;
return snd_mask_max(hw_param_mask_c(params, var));
}
if (hw_is_interval(var)) {
if (val)
*val = snd_mask_max(hw_param_mask_c(params, var));
return 0;
} else if (hw_is_interval(var)) {
const snd_interval_t *i = hw_param_interval_c(params, var);
if (dir)
*dir = - (int) i->openmax;
return snd_interval_max(i);
if (val)
*val = snd_interval_max(i);
return 0;
}
assert(0);
return 0;
@ -294,10 +303,9 @@ static int _snd_pcm_hw_param_set_first(snd_pcm_hw_params_t *params,
int snd_pcm_hw_param_set_first(snd_pcm_t *pcm,
snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var,
int *dir, unsigned int *rval)
unsigned int *rval, int *dir)
{
int err;
unsigned int val;
err = _snd_pcm_hw_param_set_first(params, var);
if (err < 0)
@ -307,10 +315,7 @@ int snd_pcm_hw_param_set_first(snd_pcm_t *pcm,
if (err < 0)
return err;
}
val = snd_pcm_hw_param_get(params, var, dir);
if (rval)
*rval = val;
return 0;
return snd_pcm_hw_param_get(params, var, rval, dir);
}
static int _snd_pcm_hw_param_set_last(snd_pcm_hw_params_t *params,
@ -340,10 +345,9 @@ static int _snd_pcm_hw_param_set_last(snd_pcm_hw_params_t *params,
int snd_pcm_hw_param_set_last(snd_pcm_t *pcm,
snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var,
int *dir, unsigned int *rval)
unsigned int *rval, int *dir)
{
int err;
unsigned int val;
err = _snd_pcm_hw_param_set_last(params, var);
if (err < 0)
@ -353,10 +357,7 @@ int snd_pcm_hw_param_set_last(snd_pcm_t *pcm,
if (err < 0)
return err;
}
val = snd_pcm_hw_param_get(params, var, dir);
if (rval)
*rval = val;
return 0;
return snd_pcm_hw_param_get(params, var, rval, dir);
}
int _snd_pcm_hw_param_set_min(snd_pcm_hw_params_t *params,
@ -421,8 +422,7 @@ int snd_pcm_hw_param_set_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
if (err < 0)
goto _fail;
}
*val = snd_pcm_hw_param_get_min(params, var, dir);
return 0;
return snd_pcm_hw_param_get_min(params, var, val, dir);
_fail:
if (mode == SND_TRY)
*params = save;
@ -493,8 +493,7 @@ int snd_pcm_hw_param_set_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
if (err < 0)
goto _fail;
}
*val = snd_pcm_hw_param_get_max(params, var, dir);
return 0;
return snd_pcm_hw_param_get_max(params, var, val, dir);
_fail:
if (mode == SND_TRY)
*params = save;
@ -603,9 +602,10 @@ int snd_pcm_hw_param_set_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
if (err < 0)
goto _fail;
}
*min = snd_pcm_hw_param_get_min(params, var, mindir);
*max = snd_pcm_hw_param_get_max(params, var, maxdir);
return 0;
err = snd_pcm_hw_param_get_min(params, var, min, mindir);
if (err < 0)
return err;
return snd_pcm_hw_param_get_max(params, var, max, maxdir);
_fail:
if (mode == SND_TRY)
*params = save;
@ -762,12 +762,12 @@ int snd_pcm_hw_param_set_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
Return the value found.
*/
int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, unsigned int best,
int *dir, unsigned int *val)
snd_pcm_hw_param_t var,
unsigned int *val, int *dir)
{
snd_pcm_hw_params_t save;
int err;
unsigned int saved_min;
unsigned int best = *val, saved_min;
int last = 0;
int min, max;
int mindir, maxdir;
@ -811,9 +811,9 @@ int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
}
_end:
if (last)
err = snd_pcm_hw_param_set_last(pcm, params, var, dir, val);
err = snd_pcm_hw_param_set_last(pcm, params, var, val, dir);
else
err = snd_pcm_hw_param_set_first(pcm, params, var, dir, val);
err = snd_pcm_hw_param_set_first(pcm, params, var, val, dir);
return err;
}
@ -899,14 +899,14 @@ static int snd_pcm_hw_param_set_near_minmax(snd_pcm_t *pcm,
snd_pcm_hw_params_t tmp;
int err;
if (!boundary_lt(min, *mindir, max, *maxdir))
return snd_pcm_hw_param_set_near(pcm, params, var, min, mindir, NULL);
return snd_pcm_hw_param_set_near(pcm, params, var, &min, mindir);
tmp = *params;
err = snd_pcm_hw_param_set_near(pcm, &tmp, var, min, mindir, &min);
err = snd_pcm_hw_param_set_near(pcm, &tmp, var, &min, mindir);
if (err < 0)
return err;
if (boundary_lt(min, *mindir, max, *maxdir)) {
tmp = *params;
err = snd_pcm_hw_param_set_near(pcm, &tmp, var, max, maxdir, &max);
err = snd_pcm_hw_param_set_near(pcm, &tmp, var, &max, maxdir);
} else {
max = min;
*maxdir = *mindir;
@ -924,8 +924,9 @@ void snd_pcm_hw_param_refine_near(snd_pcm_t *pcm,
{
unsigned int min, max;
int mindir, maxdir;
min = snd_pcm_hw_param_get_min(src, var, &mindir);
max = snd_pcm_hw_param_get_max(src, var, &maxdir);
snd_pcm_hw_param_get_min(src, var, &min, &mindir);
snd_pcm_hw_param_get_max(src, var, &max, &maxdir);
snd_pcm_hw_param_set_near_minmax(pcm, params, var,
min, &mindir, max, &maxdir);
}
@ -987,31 +988,31 @@ static int snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{
int err;
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_ACCESS, 0, NULL);
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_ACCESS, NULL, 0);
if (err < 0)
return err;
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_FORMAT, 0, NULL);
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_FORMAT, NULL, 0);
if (err < 0)
return err;
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, 0, NULL);
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, NULL, 0);
if (err < 0)
return err;
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_CHANNELS, 0, NULL);
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_CHANNELS, NULL, 0);
if (err < 0)
return err;
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_RATE, 0, NULL);
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_RATE, NULL, 0);
if (err < 0)
return err;
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, 0, NULL);
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, NULL, 0);
if (err < 0)
return err;
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, 0, NULL);
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, NULL, 0);
if (err < 0)
return err;
err = snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, 0, NULL);
err = snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL, 0);
if (err < 0)
return err;
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, 0, NULL);
err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, NULL, 0);
if (err < 0)
return err;
return 0;
@ -2179,15 +2180,15 @@ int _snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
return err;
pcm->setup = 1;
snd_pcm_hw_params_get_access(params, &pcm->access);
snd_pcm_hw_params_get_format(params, &pcm->format);
snd_pcm_hw_params_get_subformat(params, &pcm->subformat);
pcm->channels = snd_pcm_hw_params_get_channels(params);
pcm->rate = snd_pcm_hw_params_get_rate(params, 0);
pcm->period_time = snd_pcm_hw_params_get_period_time(params, 0);
pcm->period_size = snd_pcm_hw_params_get_period_size(params, 0);
pcm->buffer_size = snd_pcm_hw_params_get_buffer_size(params);
pcm->tick_time = snd_pcm_hw_params_get_tick_time(params, 0);
INTERNAL(snd_pcm_hw_params_get_access)(params, &pcm->access);
INTERNAL(snd_pcm_hw_params_get_format)(params, &pcm->format);
INTERNAL(snd_pcm_hw_params_get_subformat)(params, &pcm->subformat);
INTERNAL(snd_pcm_hw_params_get_channels)(params, &pcm->channels);
INTERNAL(snd_pcm_hw_params_get_rate)(params, &pcm->rate, 0);
INTERNAL(snd_pcm_hw_params_get_period_time)(params, &pcm->period_time, 0);
INTERNAL(snd_pcm_hw_params_get_period_size)(params, &pcm->period_size, 0);
INTERNAL(snd_pcm_hw_params_get_buffer_size)(params, &pcm->buffer_size);
INTERNAL(snd_pcm_hw_params_get_tick_time)(params, &pcm->tick_time, 0);
pcm->sample_bits = snd_pcm_format_physical_width(pcm->format);
pcm->frame_bits = pcm->sample_bits * pcm->channels;
fb = pcm->frame_bits;

View file

@ -593,14 +593,14 @@ static int snd_pcm_plug_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
unsigned int rate_min, channels_max;
/* HACK: to avoid overflow in PARTBIT_RATE code */
rate_min = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, NULL);
snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, &rate_min, NULL);
if (rate_min < 4000) {
_snd_pcm_hw_param_set_min(params, SND_PCM_HW_PARAM_RATE, 4000, 0);
if (snd_pcm_hw_param_empty(params, SND_PCM_HW_PARAM_RATE))
return -EINVAL;
}
/* HACK: to avoid overflow in PERIOD_SIZE code */
channels_max = snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_CHANNELS, NULL);
snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_CHANNELS, &channels_max, NULL);
if (channels_max > 10000) {
_snd_pcm_hw_param_set_max(params, SND_PCM_HW_PARAM_CHANNELS, 10000, 0);
if (snd_pcm_hw_param_empty(params, SND_PCM_HW_PARAM_CHANNELS))
@ -798,8 +798,8 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
links |= SND_PCM_HW_PARBIT_RATE;
else {
/* This is a temporary hack, waiting for a better solution */
rate_min = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, &rate_mindir);
srate_min = snd_pcm_hw_param_get_min(sparams, SND_PCM_HW_PARAM_RATE, &srate_mindir);
snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, &rate_min, &rate_mindir);
snd_pcm_hw_param_get_min(sparams, SND_PCM_HW_PARAM_RATE, &srate_min, &srate_mindir);
if (rate_min == srate_min && srate_mindir > rate_mindir) {
err = _snd_pcm_hw_param_set_min(params, SND_PCM_HW_PARAM_RATE, srate_min, srate_mindir);
if (err < 0)
@ -859,14 +859,14 @@ static int snd_pcm_plug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
err = snd_pcm_hw_refine_soft(slave, &sparams);
assert(err >= 0);
snd_pcm_hw_params_get_access(params, &clt_params.access);
snd_pcm_hw_params_get_format(params, &clt_params.format);
clt_params.channels = snd_pcm_hw_params_get_channels(params);
clt_params.rate = snd_pcm_hw_params_get_rate(params, 0);
INTERNAL(snd_pcm_hw_params_get_access)(params, &clt_params.access);
INTERNAL(snd_pcm_hw_params_get_format)(params, &clt_params.format);
INTERNAL(snd_pcm_hw_params_get_channels)(params, &clt_params.channels);
INTERNAL(snd_pcm_hw_params_get_rate)(params, &clt_params.rate, 0);
snd_pcm_hw_params_get_format(&sparams, &slv_params.format);
slv_params.channels = snd_pcm_hw_params_get_channels(&sparams);
slv_params.rate = snd_pcm_hw_params_get_rate(&sparams, 0);
INTERNAL(snd_pcm_hw_params_get_format)(&sparams, &slv_params.format);
INTERNAL(snd_pcm_hw_params_get_channels)(&sparams, &slv_params.channels);
INTERNAL(snd_pcm_hw_params_get_rate)(&sparams, &slv_params.rate, 0);
snd_pcm_plug_clear(pcm);
if (!(clt_params.format == slv_params.format &&
clt_params.channels == slv_params.channels &&
@ -874,7 +874,7 @@ static int snd_pcm_plug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
!plug->ttable &&
snd_pcm_hw_params_test_access(slave, &sparams,
clt_params.access) >= 0)) {
slv_params.access = snd_pcm_hw_params_set_access_first(slave, &sparams);
INTERNAL(snd_pcm_hw_params_set_access_first)(slave, &sparams, &slv_params.access);
err = snd_pcm_plug_insert_plugins(pcm, &clt_params, &slv_params);
if (err < 0)
return err;

View file

@ -375,15 +375,19 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
return err;
if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
err = snd_pcm_hw_params_get_format(params, &src_format);
err = INTERNAL(snd_pcm_hw_params_get_format)(params, &src_format);
if (err < 0)
return err;
dst_format = slave->format;
src_rate = snd_pcm_hw_params_get_rate(params, 0);
err = INTERNAL(snd_pcm_hw_params_get_rate)(params, &src_rate, 0);
dst_rate = slave->rate;
} else {
src_format = slave->format;
err = snd_pcm_hw_params_get_format(params, &dst_format);
err = INTERNAL(snd_pcm_hw_params_get_format)(params, &dst_format);
if (err < 0)
return err;
src_rate = slave->rate;
dst_rate = snd_pcm_hw_params_get_rate(params, 0);
err = INTERNAL(snd_pcm_hw_params_get_rate)(params, &dst_rate, 0);
}
if (err < 0)
return err;

View file

@ -612,11 +612,11 @@ static int snd_pcm_route_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
return err;
if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
err = snd_pcm_hw_params_get_format(params, &src_format);
err = INTERNAL(snd_pcm_hw_params_get_format)(params, &src_format);
dst_format = slave->format;
} else {
src_format = slave->format;
err = snd_pcm_hw_params_get_format(params, &dst_format);
err = INTERNAL(snd_pcm_hw_params_get_format)(params, &dst_format);
}
if (err < 0)
return err;