summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-api-mixer.c
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2018-06-06 09:01:12 +0200
committerThierry Bultel <thierry.bultel@iot.bzh>2018-06-06 09:09:11 +0200
commit38b5a2d09ae3ac33a31434a480549e778b16242d (patch)
tree53122ca1a8288c66a232b24e349dad384cf6fa73 /plugins/alsa/alsa-api-mixer.c
parenta05bd6782eab1692e87fa365be1491fbe47b41d4 (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/alsa-api-mixer.c')
-rw-r--r--plugins/alsa/alsa-api-mixer.c11
1 files changed, 4 insertions, 7 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);
}