From patchwork Fri Aug 21 20:36:35 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: 509643 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 BFD9A1401EF for ; Sat, 22 Aug 2015 06:42:11 +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=u1A9hSmr; dkim-atps=neutral Received: from localhost ([::1]:43617 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSt8b-00070A-5l for incoming@patchwork.ozlabs.org; Fri, 21 Aug 2015 16:42:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38598) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSt3G-0006sw-9c for qemu-devel@nongnu.org; Fri, 21 Aug 2015 16:36:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZSt3F-0007IM-Bu for qemu-devel@nongnu.org; Fri, 21 Aug 2015 16:36:38 -0400 Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]:35327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSt3F-0007I2-1J for qemu-devel@nongnu.org; Fri, 21 Aug 2015 16:36:37 -0400 Received: by wicne3 with SMTP id ne3so24620473wic.0 for ; Fri, 21 Aug 2015 13:36:36 -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=A1K2rTGpoufyWe5LHOZFIOH/VWrgYkr/BY9XWFHLSfo=; b=u1A9hSmrwE8LJfovue2M2Rjm9UL16GfEFpOiFmh8qPvGqcOF4OPBISkIxFolu5nsuq WAhODKSa5VMMSHaCyIv6BtgkXj2VdWWYdf9fMm7h8+Cfo48C7rQDqMp+GUuloCgxJfjs SM460gfgzlljTR6Vjgb7vvPsnPUQpEYw6PvKM39yHyZfazoXHcK7oYWrKd60wUp366Nl JSqEUzKgGkFkyDHNp+qSwYd+GGU1fiB1Q6+Fe/wwqlXplWEWf8+7sJjkkvbJzA9iEmUh EOIGrCSYBCgiR3iHUnPxkUiurJooWlQIwgHxBqFa3plxVnaF1Y21s/D10ehLD7A2TGlN 5Giw== X-Received: by 10.194.90.70 with SMTP id bu6mr18813607wjb.149.1440189396422; Fri, 21 Aug 2015 13:36:36 -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 wx9sm10479830wjb.6.2015.08.21.13.36.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Aug 2015 13:36:36 -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: Fri, 21 Aug 2015 22:36:35 +0200 Message-Id: <7a0ee1852ae953231d72930db12d44aa454b4d59.1440189131.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::22d Cc: Gerd Hoffmann , Markus Armbruster Subject: [Qemu-devel] [PATCH v2 7/9] 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 OSS 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, 27 insertions(+), 5 deletions(-) diff --git a/audio/paaudio.c b/audio/paaudio.c index c7875da..52aa412 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -336,17 +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 pa_map; pa_threaded_mainloop_lock(c->mainloop); - stream = pa_stream_new(c->context, name, ss, map); + if (map && !pa_channel_map_parse(&pa_map, map)) { + dolog("Invalid channel map specified: '%s'\n", map); + map = NULL; + } + if (!map) { + pa_channel_map_init_extend(&pa_map, ss->channels, + PA_CHANNEL_MAP_OSS); + } + + stream = pa_stream_new(c->context, name, ss, &pa_map); if (!stream) { goto fail; } @@ -423,7 +433,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 ); @@ -471,7 +481,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 2852dcc..f683a55 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: OSS 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 4fffb6a..9d17a04 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 OSS 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}][,...]]