From patchwork Thu Oct 13 12:26:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 119468 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5C0B2B6F86 for ; Thu, 13 Oct 2011 23:27:33 +1100 (EST) Received: from localhost ([::1]:43691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1REKNg-0004Rz-B6 for incoming@patchwork.ozlabs.org; Thu, 13 Oct 2011 08:27:24 -0400 Received: from eggs.gnu.org ([140.186.70.92]:55697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1REKNL-0003vw-QZ for qemu-devel@nongnu.org; Thu, 13 Oct 2011 08:27:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1REKNG-0006iD-5J for qemu-devel@nongnu.org; Thu, 13 Oct 2011 08:27:03 -0400 Received: from mail-wy0-f173.google.com ([74.125.82.173]:51170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1REKNF-0006gF-UX for qemu-devel@nongnu.org; Thu, 13 Oct 2011 08:26:58 -0400 Received: by mail-wy0-f173.google.com with SMTP id 22so1972788wyh.4 for ; Thu, 13 Oct 2011 05:26:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=WGX6z9IXfHsyHd/jL2lIc7yVGAHMj/3yZGRiPFU3MtQ=; b=uuUgv33xuuPWJPWGAXzmiRmraY1mboCFJX9F++fxDEi++S4aoUc2NhdtKw5ncHLgKt MkTdFwxIP8x3uFHj7JRTijZmgc9Komj2ycuuCcu+6lb537bmYwwBIgcgm49SkN/7PVtZ dYA5/16aPBniVj4H3klqUX73CkjbicxYs/G+k= Received: by 10.227.38.66 with SMTP id a2mr1173632wbe.43.1318508817477; Thu, 13 Oct 2011 05:26:57 -0700 (PDT) Received: from localhost (75.Red-83-60-208.dynamicIP.rima-tde.net. [83.60.208.75]) by mx.google.com with ESMTPS id ek13sm5709623wbb.3.2011.10.13.05.26.56 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Oct 2011 05:26:56 -0700 (PDT) From: "=?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=" To: qemu-devel@nongnu.org Date: Thu, 13 Oct 2011 14:26:20 +0200 Message-Id: <1318508784-8172-7-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 1.7.6.2 In-Reply-To: <1318508784-8172-1-git-send-email-marcandre.lureau@redhat.com> References: <1316621468-32171-1-git-send-email-marcandre.lureau@redhat.com> <1318508784-8172-1-git-send-email-marcandre.lureau@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.173 Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Subject: [Qemu-devel] [PATCH 07/11] audio/spice: add support for volume control X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Changes since v1: - remove #warning since qemu has -Werror by default - do not claim VOICE_VOLUME_CAP if spice doesn't support it --- audio/spiceaudio.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index f972110..92964ae 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -202,7 +202,26 @@ static int line_out_ctl (HWVoiceOut *hw, int cmd, ...) } spice_server_playback_stop (&out->sin); break; + case VOICE_VOLUME: + { +#if ((SPICE_INTERFACE_PLAYBACK_MAJOR >= 1) && (SPICE_INTERFACE_PLAYBACK_MINOR >= 2)) + SWVoiceOut *sw; + va_list ap; + uint16_t vol[2]; + + va_start (ap, cmd); + sw = va_arg (ap, SWVoiceOut *); + va_end (ap); + + vol[0] = sw->vol.l >> 16; + vol[1] = sw->vol.r >> 16; + spice_server_playback_set_volume (&out->sin, 2, vol); + spice_server_playback_set_mute (&out->sin, sw->vol.mute); +#endif + break; + } } + return 0; } @@ -304,7 +323,26 @@ static int line_in_ctl (HWVoiceIn *hw, int cmd, ...) in->active = 0; spice_server_record_stop (&in->sin); break; + case VOICE_VOLUME: + { +#if ((SPICE_INTERFACE_RECORD_MAJOR >= 2) && (SPICE_INTERFACE_RECORD_MINOR >= 2)) + SWVoiceIn *sw; + va_list ap; + uint16_t vol[2]; + + va_start (ap, cmd); + sw = va_arg (ap, SWVoiceIn *); + va_end (ap); + + vol[0] = sw->vol.l >> 16; + vol[1] = sw->vol.r >> 16; + spice_server_record_set_volume (&in->sin, 2, vol); + spice_server_record_set_mute (&in->sin, sw->vol.mute); +#endif + break; + } } + return 0; } @@ -337,6 +375,9 @@ struct audio_driver spice_audio_driver = { .max_voices_in = 1, .voice_size_out = sizeof (SpiceVoiceOut), .voice_size_in = sizeof (SpiceVoiceIn), +#if ((SPICE_INTERFACE_PLAYBACK_MAJOR >= 1) && (SPICE_INTERFACE_PLAYBACK_MINOR >= 2)) + .ctl_caps = VOICE_VOLUME_CAP +#endif }; void qemu_spice_audio_init (void)