[vdagent-linux PATCH 2/2] vdagentd: volume synchronization from client.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Include the capability of volume sync to set volume or mute to default
sink-input/source-output of guest.
---
 src/vdagentd.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/vdagentd.c b/src/vdagentd.c
index b5c7d14..754d098 100644
--- a/src/vdagentd.c
+++ b/src/vdagentd.c
@@ -40,6 +40,7 @@
 #include "vdagentd-proto.h"
 #include "vdagentd-proto-strings.h"
 #include "vdagentd-uinput.h"
+#include "vdagentd-audio.h"
 #include "vdagentd-xorg-conf.h"
 #include "vdagent-virtio-port.h"
 #include "session-info.h"
@@ -101,6 +102,7 @@ static void send_capabilities(struct vdagent_virtio_port *vport,
     VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_SPARSE_MONITORS_CONFIG);
     VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_GUEST_LINEEND_LF);
     VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_MAX_CLIPBOARD);
+    VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_AUDIO_VOLUME_SYNC);
 
     vdagent_virtio_port_write(vport, VDP_CLIENT_PORT,
                               VD_AGENT_ANNOUNCE_CAPABILITIES, 0,
@@ -379,6 +381,22 @@ int virtio_port_read_complete(
         syslog(LOG_DEBUG, "Set max clipboard: %d", msg->max);
         max_clipboard = msg->max;
         break;
+    case VD_AGENT_AUDIO_VOLUME_SYNC: {
+        uint8_t mute;
+        if (message_header->size < sizeof(VDAgentAudioVolumeSync))
+            goto size_error;
+
+        VDAgentAudioVolumeSync *msg = (VDAgentAudioVolumeSync *)data;
+        mute = msg->flags & VD_AGENT_AUDIO_VOLUME_SYNC_FLAG_IS_MUTE;
+        if (msg->flags & VD_AGENT_AUDIO_VOLUME_SYNC_FLAG_IS_PLAYBACK) {
+            vdagent_audio_playback_sync (mute, msg->nchannels, msg->volume);
+        } else if (msg->flags & VD_AGENT_AUDIO_VOLUME_SYNC_FLAG_IS_RECORD) {
+            vdagent_audio_record_sync (mute, msg->nchannels, msg->volume);
+        } else {
+            syslog(LOG_WARNING, "Unknown audio type (flags %x)", msg->flags);
+        }
+        break;
+    }
     default:
         syslog(LOG_WARNING, "unknown message type %d, ignoring",
                message_header->type);
-- 
2.1.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]