From patchwork Mon Aug 17 16:55:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?B?Wm9sdMOhbiBLxZF2w6Fnw7M=?= X-Patchwork-Id: 508029 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0AFFE140134 for ; Tue, 18 Aug 2015 02:56:17 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=O8peLLi9; dkim-atps=neutral Received: from localhost ([::1]:60554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRNhm-0001iA-VY for incoming@patchwork.ozlabs.org; Mon, 17 Aug 2015 12:56:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRNgt-0000xI-OX for qemu-devel@nongnu.org; Mon, 17 Aug 2015 12:55:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZRNgs-00008F-JW for qemu-devel@nongnu.org; Mon, 17 Aug 2015 12:55:19 -0400 Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]:37579) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRNgs-00007p-9h for qemu-devel@nongnu.org; Mon, 17 Aug 2015 12:55:18 -0400 Received: by wibhh20 with SMTP id hh20so86429288wib.0 for ; Mon, 17 Aug 2015 09:55:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=wp9vumKYXa2HsKHTzFLcEGW8bK4SOO5C24O2D4yd7Ls=; b=O8peLLi9m2y658AhUMD24RdiX1Ssp+paGptD+aLfVvvkI6V225Us0X5jzrMDK0PB2D FTAC22E9SXxerJ8VbP2fn7qvyT5h0M0SRzek7IEiltA4iCZQ61tUBMm2vqt1ziE4RIwG ICgvPw7Obb4m3cE3TWYnY8WNfnU2yt4qP2Mry0mhX7szrhA68QXozp2m+JN5Ywp0s5ix VQXVIX31S3c3yLjriF05ijQ/UxaYUJpZLMj6hE598fSfhNXNdMdefCynRKT1E6raGxb9 CJsE2xpXtMx692ZRZvVAniTlO6DW76e9QtwAB8RL/ju+8X+CCmSggF33NxfwwEha5UYm hciw== X-Received: by 10.194.204.163 with SMTP id kz3mr4471884wjc.28.1439830517559; Mon, 17 Aug 2015 09:55:17 -0700 (PDT) Received: from nullptr.home.dirty-ice.org (178-164-172-216.pool.digikabel.hu. [178.164.172.216]) by smtp.gmail.com with ESMTPSA id bd9sm17524895wib.18.2015.08.17.09.55.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Aug 2015 09:55:17 -0700 (PDT) From: "=?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?=" X-Google-Original-From: =?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?= To: qemu-devel@nongnu.org Date: Mon, 17 Aug 2015 18:55:16 +0200 Message-Id: <3a9eb4d0c1c547c953c983a008db4d108558eebe.1439821260.git.DirtY.iCE.hu@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::231 Cc: Gerd Hoffmann , Markus Armbruster Subject: [Qemu-devel] [PATCH 3/5] paaudio: channel-map option 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 Add an option to change the channel map used by pulseaudio. If not specified, falls back to an ALSA compatible channel map. Signed-off-by: Kővágó, Zoltán --- audio/paaudio.c | 18 +++++++++++------- qapi/audio.json | 5 ++++- qemu-options.hx | 9 +++++++++ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/audio/paaudio.c b/audio/paaudio.c index d2267ee..10fc54f 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -336,23 +336,27 @@ static pa_stream *qpa_simple_new ( pa_stream_direction_t dir, const char *dev, const pa_sample_spec *ss, - const pa_channel_map *map, + const char *map, const pa_buffer_attr *attr, int *rerror) { int r; pa_stream *stream; pa_stream_flags_t flags; - pa_channel_map my_map; + pa_channel_map pa_map; pa_threaded_mainloop_lock(c->mainloop); + if (map && !pa_channel_map_parse(&pa_map, map)) { + dolog("Invalid channel map specified: '%s'\n", map); + map = NULL; + } if (!map) { - map = pa_channel_map_init_extend(&my_map, ss->channels, - PA_CHANNEL_MAP_ALSA); + pa_channel_map_init_extend(&pa_map, ss->channels, + PA_CHANNEL_MAP_ALSA); } - stream = pa_stream_new(c->context, name, ss, map); + stream = pa_stream_new(c->context, name, ss, &pa_map); if (!stream) { goto fail; } @@ -428,7 +432,7 @@ static int qpa_init_out(HWVoiceOut *hw, struct audsettings *as, PA_STREAM_PLAYBACK, ppdo->has_name ? ppdo->name : NULL, &ss, - NULL, /* channel map */ + ppdo->has_channel_map ? ppdo->channel_map : NULL, &ba, /* buffering attributes */ &error ); @@ -476,7 +480,7 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque) PA_STREAM_RECORD, ppdo->has_name ? ppdo->name : NULL, &ss, - NULL, /* channel map */ + ppdo->has_channel_map ? ppdo->channel_map : NULL, NULL, /* buffering attributes */ &error ); diff --git a/qapi/audio.json b/qapi/audio.json index 0216a10..9070ac5 100644 --- a/qapi/audio.json +++ b/qapi/audio.json @@ -119,11 +119,14 @@ # # @name: #optional name of the sink/source to use # +# @channel-map: #optional channel map to use (default: ALSA compatible map) +# # Since: 2.5 ## { 'struct': 'AudiodevPaPerDirectionOptions', 'data': { - '*name': 'str' } } + '*name': 'str', + '*channel-map': 'str' } } ## # @AudiodevPaOptions diff --git a/qemu-options.hx b/qemu-options.hx index 8e5ab7c..382b0ab 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -365,6 +365,7 @@ DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev, "-audiodev pa,id=id[,prop[=value][,...]]\n" " server= PulseAudio server address\n" " sink|source.name= sink/source device name\n" + " sink|source.channel-map= channel map to use\n" #endif #ifdef CONFIG_SDL "-audiodev sdl,id=id[,prop[=value][,...]]\n" @@ -518,6 +519,14 @@ Sets the PulseAudio @var{server} to connect to. @item sink|source.name=@var{sink} Use the specified sink/source for playback/recording. +@item sink|source.channel-map=@var{map} +Use the specified channel map. The default is an ALSA compatible +channel map. Do not forget to escape commas inside the map: + +@example +-audiodev pa,id=example,sink.channel-map=front-left,,front-right +@end example + @end table @item -audiodev sdl,id=@var{id}[,@var{prop}[=@var{value}][,...]]