summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pcm.c23
-rw-r--r--src/stubs.h1
2 files changed, 22 insertions, 2 deletions
diff --git a/src/pcm.c b/src/pcm.c
index 24dc00a..106cc28 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -47,6 +47,19 @@ format_info_for_sio_enc(const struct sio_enc *enc)
}
const struct format_info*
+format_info_for_sio_par(const struct sio_par *par)
+{
+ const struct sio_enc enc = {
+ .bits = par->bits,
+ .bps = par->bps,
+ .sig = par->sig,
+ .le = par->le,
+ .msb = (par->bps == SIO_BPS(par->bits) ? 1 : par->msb),
+ };
+ return format_info_for_sio_enc(&enc);;
+}
+
+const struct format_info*
format_info_for_format(const snd_pcm_format_t format)
{
for (size_t i = 0; i < ARRAY_SIZE(SUPPORTED_FORMATS); ++i) {
@@ -256,7 +269,8 @@ snd_pcm_open(snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mod
goto fail;
dump_cap(name, &(*pcm)->hw.cap, &(*pcm)->hw.limits);
- (*pcm)->hw.format = SND_PCM_FORMAT_UNKNOWN;
+ const struct format_info *info = format_info_for_sio_par(&(*pcm)->hw.par);
+ (*pcm)->hw.format = (info ? info->fmt : SND_PCM_FORMAT_UNKNOWN);
(*pcm)->hw.period_time = -1;
return 0;
@@ -875,6 +889,13 @@ has_native_support(const snd_pcm_hw_params_t *params, snd_pcm_format_t val)
}
int
+snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params, snd_pcm_format_t *val)
+{
+ *val = params->format;
+ return 0;
+}
+
+int
snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val)
{
const struct format_info *info;
diff --git a/src/stubs.h b/src/stubs.h
index 7ab2178..7526671 100644
--- a/src/stubs.h
+++ b/src/stubs.h
@@ -504,7 +504,6 @@ int snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *para
int snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *_access) { WARNX1("stub"); return 0; }
int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask) { WARNX1("stub"); return 0; }
int snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask) { WARNX1("stub"); return 0; }
-int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params, snd_pcm_format_t *val) { WARNX1("stub"); return 0; }
int snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format) { WARNX1("stub"); return 0; }
int snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format) { WARNX1("stub"); return 0; }
int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask) { WARNX1("stub"); return 0; }