From patchwork Thu Jan 14 13:46:01 2016 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: 567481 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 AD7F214031E for ; Fri, 15 Jan 2016 01:13:38 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=OtgTQ3z6; dkim-atps=neutral Received: from localhost ([::1]:42799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJiee-0003zj-Ko for incoming@patchwork.ozlabs.org; Thu, 14 Jan 2016 09:13:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJiEj-0001ut-Q4 for qemu-devel@nongnu.org; Thu, 14 Jan 2016 08:46:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJiEi-0003ba-Mm for qemu-devel@nongnu.org; Thu, 14 Jan 2016 08:46:49 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:33948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJiEi-0003bQ-FG for qemu-devel@nongnu.org; Thu, 14 Jan 2016 08:46:48 -0500 Received: by mail-wm0-x241.google.com with SMTP id b14so43781109wmb.1 for ; Thu, 14 Jan 2016 05:46:48 -0800 (PST) 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=jxtrcimQIj1OSZXZ5L5mwZvFKU/vj0ppQDUAk9ALNow=; b=OtgTQ3z60eAiLQRWsxrVPmz3/qIZmDtfd44ns4gJL7QtEfqOKyEfsieiIuD2DXptLT fI+X1GNc+m+KiqrgdptN5zqnmmmCd07IEtUYZm1WTTBCV5Z+OYXaED2PQDJSnHCEIN3x 2+Ch/yiFh7sd7r6TcFasiA8dS7eHgdpCpuXnJhzST+cXFog+aJcPekVdxv+naeJqZBbO 3XHNQH+GtL2UD8hbcIdbAcTnBXR0QypjJTh/f4NRCQWh+XGMFu7VyghNziHwgVIDe8SK Gff8hd+PjX9Zx/eDXU0768jnTPU8kjqg3t8MWi4rSocTbQjiBYr+OwiHt6jUFUfKl0H9 JiIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=jxtrcimQIj1OSZXZ5L5mwZvFKU/vj0ppQDUAk9ALNow=; b=IiCNdDuB2WawYdZtDWVauAj2XmAzi4RNBapIj9mbbd+2np8u+PliZrO99ID79yH2md VKw3E3R61q2GAz5A+Kvx3wRYCpBQ17oohDdFCjgJrUNeJy2Ag7qjgU/i2jZCzgNna4Nz BCQN5BHvdXO++mpJJ0hctQVNYEPp6/uuUwO8cwfjUZehhVcVXW7fXXe0nMCdU7/uccEb I+JaORzCHt0DSBhmXWtsS3uYfsD5PaSfJWLYgBwKm7avDqaPbfJR0BFYC+BxVVLSnD20 9yCc7yCKR5RDrpxg6N1ryuHfi5yFhVqIt9U2XfMQL1egnMtWmLiFNZYC/GF4voknDYSn S4JA== X-Gm-Message-State: ALoCoQlqWY4jm4K2EDagPo/z4poHwOl68kFOiXqr9L4/W8zmju797lQGJfYFfHfraRYilmhhhea94NjWu1WYUvPC/htJ/CUE5A== X-Received: by 10.194.158.73 with SMTP id ws9mr4908875wjb.40.1452779207976; Thu, 14 Jan 2016 05:46:47 -0800 (PST) Received: from nullptr.home.dirty-ice.org (188-143-126-18.pool.digikabel.hu. [188.143.126.18]) by smtp.gmail.com with ESMTPSA id 79sm7398061wmo.7.2016.01.14.05.46.47 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Jan 2016 05:46:47 -0800 (PST) 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: Thu, 14 Jan 2016 14:46:01 +0100 Message-Id: <94dc7f4beba288ac31e4e524058b7c4d9d16cb25.1452776884.git.DirtY.iCE.hu@gmail.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Cc: Gerd Hoffmann , Markus Armbruster Subject: [Qemu-devel] [PATCH 48/51] 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 7d5e697..bb9d928 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 9bd61de..e91de45 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.6 ## { 'struct': 'AudiodevPaPerDirectionOptions', 'data': { - '*name': 'str' } } + '*name': 'str', + '*channel-map': 'str' } } ## # @AudiodevPaOptions diff --git a/qemu-options.hx b/qemu-options.hx index a995fca..33ee3f2 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -372,6 +372,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" @@ -525,6 +526,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}][,...]]