[Spice-devel] [vdagent-linux PATCH v2 2/2] vdagentd: volume synchronization from client.
Victor Toso
victortoso at redhat.com
Mon Mar 23 06:12:06 PDT 2015
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
More information about the Spice-devel
mailing list