From e59883bea6be9611358e9e6aa2aa62ce08d1bb36 Mon Sep 17 00:00:00 2001 From: Michal Ratajsky Date: Mon, 3 Nov 2014 14:16:07 +0100 Subject: oss: Prefer custom list of OSS device directions when assigning controls to streams --- backends/oss/oss-device.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/backends/oss/oss-device.c b/backends/oss/oss-device.c index 0c5f3f3..d2e07a8 100644 --- a/backends/oss/oss-device.c +++ b/backends/oss/oss-device.c @@ -556,10 +556,25 @@ read_mixer_devices (OssDevice *device) if (OSS_MASK_HAS_DEVICE (device->priv->devmask, i) == FALSE) continue; - if (OSS_MASK_HAS_DEVICE (device->priv->recmask, i) == TRUE) + /* The control is assigned to a stream according to the predefined type. + * + * OSS may allow some controls to be both input and output, but the API + * is too simple to tell what exactly is a control capable of. Here we + * simplify things a bit and assign each control to exactly one stream. */ + switch (oss_devices[i].type) { + case OSS_DEV_INPUT: stream = device->priv->input; - else + break; + case OSS_DEV_OUTPUT: stream = device->priv->output; + break; + case OSS_DEV_ANY: + if (OSS_MASK_HAS_DEVICE (device->priv->recmask, i) == TRUE) + stream = device->priv->input; + else + stream = device->priv->output; + break; + } stereo = OSS_MASK_HAS_DEVICE (device->priv->stereodevs, i); control = oss_stream_control_new (oss_devices[i].name, @@ -603,6 +618,10 @@ read_mixer_switch (OssDevice *device) for (i = 0; i < OSS_N_DEVICES; i++) { OssSwitchOption *option; + /* Exclude output controls as this is always a recording + * source switch */ + if (oss_devices[i].type == OSS_DEV_OUTPUT) + continue; if (OSS_MASK_HAS_DEVICE (device->priv->devmask, i) == FALSE || OSS_MASK_HAS_DEVICE (device->priv->recmask, i) == FALSE) continue; -- cgit v1.2.1