aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-utils-bypath.c
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2018-08-31 13:53:47 +0200
committerThierry Bultel <thierry.bultel@iot.bzh>2018-08-31 13:53:47 +0200
commit80deafbe1bfb87c3a5e9f547c9491afd210e736a (patch)
tree67f83684cf67268dcb65d8062280f848057a74c2 /plugins/alsa/alsa-utils-bypath.c
parentded8e37b50982677480869763f3573ff43858505 (diff)
Added bluez sound playback support
This adds sound playback for incoming sound from connected bluetooth devices. In this version, the softmixer relies on a modified bluez-alsa version (https://github.com/iotbzh/bluez-alsa), that provides an ioplug PCM bluezalsa connection proxy. The softmixer api has a new verb to dynamically set the device to listen to: afb-client-demo ws://localhost:1234/api?token=\uuid=123 smixer bluezalsa_dev '{"interface":"hci0", "device":"F6:32:15:2A:80:70", "profile":"a2dp"}' In this way it is possible to switch from a bluezalsa audio source to another without any further configuration. For now, only interface hci0 is supported. This commit also migrates the softmixer binding to API v3 Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'plugins/alsa/alsa-utils-bypath.c')
-rw-r--r--plugins/alsa/alsa-utils-bypath.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/alsa/alsa-utils-bypath.c b/plugins/alsa/alsa-utils-bypath.c
index 2f22333..4c258c2 100644
--- a/plugins/alsa/alsa-utils-bypath.c
+++ b/plugins/alsa/alsa-utils-bypath.c
@@ -27,6 +27,7 @@
#include <sys/ioctl.h>
#include "alsa-softmixer.h"
+#include "alsa-bluez.h"
// extracted IOCTLs from <alsa/asoundlib.h>
#define _IOR_HACKED(type,nr,size) _IOC(_IOC_READ,(type),(nr),size)
@@ -63,6 +64,10 @@ PUBLIC AlsaPcmCtlT *AlsaByPathOpenPcm(SoftMixerT *mixer, AlsaDevInfoT *pcmDev, s
AlsaPcmCtlT *pcmCtl = calloc(1, sizeof (AlsaPcmCtlT));
char *cardid = NULL;
+ if (pcmDev->pcmplug_params) {
+ pcmDev->cardid = pcmDev->pcmplug_params;
+ }
+
if (!pcmDev->cardid) {
if (pcmDev->subdev) {
if (asprintf(&cardid, "hw:%i,%i,%i", pcmDev->cardidx, pcmDev->device, pcmDev->subdev) == -1)
@@ -115,7 +120,9 @@ PUBLIC snd_ctl_t *AlsaByPathOpenCtl(SoftMixerT *mixer, const char *uid, AlsaSndC
if (dev->cid.devpath)
cardInfo = AlsaByPathInfo(mixer, dev->cid.devpath);
else if (dev->cid.cardid)
- cardInfo = AlsaCtlGetInfo(mixer, dev->cid.cardid);
+ cardInfo = AlsaCtlGetCardInfo(mixer, dev->cid.cardid);
+ else if (dev->cid.pcmplug_params)
+ cardInfo = AlsaCtlGetCardInfo(mixer, dev->cid.pcmplug_params);
if (!cardInfo) {
AFB_ApiError(mixer->api,