summaryrefslogtreecommitdiff
path: root/modules/sndio
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-11-09 17:10:07 +0100
committerGitHub <noreply@github.com>2017-11-09 17:10:07 +0100
commita9e09b2c0a99efddfcc16f5e413e2d73aa0e1732 (patch)
treee53a738b94461189540bfe1a2c7b643b41ac488f /modules/sndio
parent4d5d9a6e4e0811b52b427602261d5e0b9bc85f21 (diff)
add support for specifying sample format (#317)
API: ausrc and auplay - add config items for ausrc/auplay format: ausrc_format s16|float auplay_format s16|float - audio.c: convert audio samples to/from signed 16-bit Modules: alsa add test for sample format FLOAT rst: add support for FLOAT sample format audiounit: add support for FLOAT sample format coreaudio: check for signed 16-bit audio format oss: check for signed 16-bit sample format winwave: check for S16LE pulse: add support for FLOAT sample format sndio: check for S16 format gst1: check sample format aufile: check sample format aubridge: check sample format gst: check sample format opensles: check for S16 sample format jack: check sample format alsa: remove usage of local config test: change samples to void pointer test: change sample type to void pointer
Diffstat (limited to 'modules/sndio')
-rw-r--r--modules/sndio/sndio.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/sndio/sndio.c b/modules/sndio/sndio.c
index d3ca9d6..6ac4b67 100644
--- a/modules/sndio/sndio.c
+++ b/modules/sndio/sndio.c
@@ -154,6 +154,12 @@ static int src_alloc(struct ausrc_st **stp, const struct ausrc *as,
if (!stp || !as || !prm)
return EINVAL;
+ if (prm->fmt != AUFMT_S16LE) {
+ warning("sndio: source: unsupported sample format (%s)\n",
+ aufmt_name(prm->fmt));
+ return ENOTSUP;
+ }
+
name = (str_isset(device)) ? device : SIO_DEVANY;
if ((st = mem_zalloc(sizeof(*st), ausrc_destructor)) == NULL)
@@ -222,6 +228,12 @@ static int play_alloc(struct auplay_st **stp, const struct auplay *ap,
if (!stp || !ap || !prm)
return EINVAL;
+ if (prm->fmt != AUFMT_S16LE) {
+ warning("sndio: playback: unsupported sample format (%s)\n",
+ aufmt_name(prm->fmt));
+ return ENOTSUP;
+ }
+
name = (str_isset(device)) ? device : SIO_DEVANY;
if ((st = mem_zalloc(sizeof(*st), auplay_destructor)) == NULL)