diff options
author | Thierry Bultel <thierry.bultel@iot.bzh> | 2018-06-06 09:01:12 +0200 |
---|---|---|
committer | Thierry Bultel <thierry.bultel@iot.bzh> | 2018-06-06 09:09:11 +0200 |
commit | 38b5a2d09ae3ac33a31434a480549e778b16242d (patch) | |
tree | 53122ca1a8288c66a232b24e349dad384cf6fa73 /plugins/alsa | |
parent | a05bd6782eab1692e87fa365be1491fbe47b41d4 (diff) |
Fixed the MixerInfoAction reply
Make it robust to empty source, and set the source
when input is a direct capture device.
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'plugins/alsa')
-rw-r--r-- | plugins/alsa/alsa-api-mixer.c | 11 | ||||
-rw-r--r-- | plugins/alsa/alsa-api-streams.c | 3 |
2 files changed, 5 insertions, 9 deletions
diff --git a/plugins/alsa/alsa-api-mixer.c b/plugins/alsa/alsa-api-mixer.c index c97f8c6..112adbb 100644 --- a/plugins/alsa/alsa-api-mixer.c +++ b/plugins/alsa/alsa-api-mixer.c @@ -106,15 +106,12 @@ STATIC void MixerInfoAction(AFB_ReqT request, json_object *argsJ) { if (quiet) { json_object_array_add(streamsJ, json_object_new_string(streams[idx]->uid)); } else { - json_object *numidJ; - wrap_json_pack(&numidJ, "{si,si}" - , "volume", streams[idx]->volume - , "mute", streams[idx]->mute - ); - wrap_json_pack(&valueJ, "{ss,ss, so}" + wrap_json_pack(&valueJ, "{ss,ss?,s{si,si}}" , "uid", streams[idx]->uid , "alsa", streams[idx]->source - , "numid", numidJ + , "numid" + , "volume", streams[idx]->volume + , "mute", streams[idx]->mute ); json_object_array_add(streamsJ, valueJ); } diff --git a/plugins/alsa/alsa-api-streams.c b/plugins/alsa/alsa-api-streams.c index e2f3252..487b0fe 100644 --- a/plugins/alsa/alsa-api-streams.c +++ b/plugins/alsa/alsa-api-streams.c @@ -271,11 +271,10 @@ PUBLIC int CreateOneStream(SoftMixerT *mixer, AlsaStreamAudioT *stream) { } } - // return alsa URI only when loopback is used if (loop) { (void) asprintf((char**)&stream->source, "hw:%d,%d,%d", captureDev->cardidx, loop->playback, capturePcm->cid.subdev); } else { - stream->source=NULL; + (void) asprintf((char**)&stream->source, "hw:%d,%d,%d", captureDev->cardidx, captureDev->device, captureDev->subdev); } // create a dedicated verb for this stream |