summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-api-frontend.c
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2018-05-17 23:52:28 +0200
committerFulup Ar Foll <fulup@iot.bzh>2018-05-17 23:52:28 +0200
commite4d8efb814307bfeec227f72c77a4cf0bdf135bf (patch)
tree0f2d60dd85b926c44765f721583996178c5e124a /plugins/alsa/alsa-api-frontend.c
parent253df14bd84f535a54f4d12c95399899e1343c20 (diff)
Implemented sub API for stream with volume/pause/toggle/...
Diffstat (limited to 'plugins/alsa/alsa-api-frontend.c')
-rw-r--r--plugins/alsa/alsa-api-frontend.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/plugins/alsa/alsa-api-frontend.c b/plugins/alsa/alsa-api-frontend.c
index c01a88b..91ce63f 100644
--- a/plugins/alsa/alsa-api-frontend.c
+++ b/plugins/alsa/alsa-api-frontend.c
@@ -92,10 +92,23 @@ STATIC int ProcessOneLoop(CtlSourceT *source, json_object *loopJ, AlsaSndLoopT *
loopDefParams->sampleSize=0;
}
- // make sure useful information will not be removed
- loop->uid = strdup(loop->uid);
- if (loop->cardid) loop->cardid = strdup(loop->cardid);
- if (loop->devpath) loop->cardid = strdup(loop->devpath);
+ // Fake a sound card to check if loop is a valid Alsa snd driver
+ AlsaPcmInfoT sndLoop;
+ sndLoop.uid = loop->uid;
+ sndLoop.devpath = loop->devpath;
+ sndLoop.cardid = loop->cardid;
+ sndLoop.device = 0;
+ sndLoop.subdev = 0;
+ error = AlsaByPathDevid(source, &sndLoop);
+ if (error) {
+ AFB_ApiError(source->api, "ProcessOneLoop: loop=%s not found config=%s", loop->uid, json_object_get_string(loopJ));
+ goto OnErrorExit;
+ }
+ loop->uid= sndLoop.uid;
+ loop->devpath= sndLoop.devpath;
+ loop->cardid=sndLoop.cardid;
+ loop->cardidx=sndLoop.cardidx;
+
// Default devices is payback=0 capture=1
if (!devicesJ) {