From nobody Fri Dec 19 22:04:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15456005591901005.0955840979436; Sun, 23 Dec 2018 13:29:19 -0800 (PST) Received: from localhost ([127.0.0.1]:59997 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbBJE-00032T-Si for importer@patchew.org; Sun, 23 Dec 2018 16:29:16 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52717) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbAkV-0000QN-9R for qemu-devel@nongnu.org; Sun, 23 Dec 2018 15:53:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gbAkJ-0003t8-RK for qemu-devel@nongnu.org; Sun, 23 Dec 2018 15:53:15 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:55632) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gbAkJ-0003k1-CG for qemu-devel@nongnu.org; Sun, 23 Dec 2018 15:53:11 -0500 Received: by mail-wm1-x341.google.com with SMTP id y139so9809824wmc.5 for ; Sun, 23 Dec 2018 12:53:10 -0800 (PST) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-24a3-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:24a3::5]) by smtp.gmail.com with ESMTPSA id g198sm25456920wmd.23.2018.12.23.12.53.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Dec 2018 12:53:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pKXND/VSeufO0cB6Q6G59MV/QtejKT3urPyHZ0tVI1k=; b=s1TQdnZSxHefYt9W+9+Iv1uZl+kHt+83eYFwRcIObHPWjy0ctKcXa59P8LGleidxuI nQbo/d2jHr3BUFGWpBajEF/Jqs6uaXO5Rf2HOHXOVfgnphuIh6a2xlI8E5edf87SM9ky bkySaH1r05QU/CIpcch2yRzoFasG6VXhJ17j1njIAIw7GDuYGsgXXUGHSHv//7Hu95tp 0pSBr3P9Xd87GfjefL1SBa6Bko3l/pk2RTrsov14hel+W40inL4K+I0HcIseex4FytBg 1HFD9v4WpAdoDc1PlRtGnGWpHocDPZD+c9BMD97k3AjB05eZfi49G+frp5AEkkZW2jUq dygw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pKXND/VSeufO0cB6Q6G59MV/QtejKT3urPyHZ0tVI1k=; b=kxr3i2QbZgERdl61JP08oA0zpELQ3jPINKCO3+MHtS1q8rqFStpN20+sP8C4pGDPiN Lb49cUChC/pYuEllrHg4QPOHtoyNf/06Z4aZdPUUcjdG4iUg3j9R2HNKCcFCUjEJ1nVR 2am1SEsj5mmMF6q6gQobqyNEvNzFn6srHBmG/XtIMBtzNlskrm+/Hmy6dHsb23Dlc5OR AwshCO149hbSRj5n71bHJxrWRxoiOOrK/3L+CfW8MVG+hAkMzSNtPAjQCty7AaVhq9/G Pnh9D0A6pmuUeX99flhaczLAk7qLiGLVvjTeSb3OlCHtfNNkXTGQQInFjClTyI4V2SEe xYHA== X-Gm-Message-State: AA+aEWbHA8KRquwG+Q6DEL+neap1AWVa7HfSPI6S1MwGFGtb+blB5amx 2DZSupnovQcN9kR1XviNlw7Ya5SF3OY= X-Google-Smtp-Source: ALg8bN7gnTjLfgWqyIFeAxcImN8+e1lBXFEQsPlrnncRKKo6kquMfLwF5RaGrd9/uKCG/pp3UuG/qQ== X-Received: by 2002:a1c:2686:: with SMTP id m128mr9598917wmm.52.1545598389021; Sun, 23 Dec 2018 12:53:09 -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: Sun, 23 Dec 2018 21:52:25 +0100 Message-Id: <23860c05408d965c70746307bb52a809fc62e3b5.1545598229.git.DirtY.iCE.hu@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH v2 49/52] paaudio: channel-map option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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=C5=91v=C3=A1g=C3=B3, Zolt=C3=A1n --- 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 3b4b29b38f..f472f25e8f 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -337,17 +337,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; =20 pa_threaded_mainloop_lock(c->mainloop); =20 - stream =3D 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 =3D NULL; + } + if (!map) { + pa_channel_map_init_extend(&pa_map, ss->channels, + PA_CHANNEL_MAP_OSS); + } + + stream =3D pa_stream_new(c->context, name, ss, &pa_map); if (!stream) { goto fail; } @@ -424,7 +434,7 @@ static int qpa_init_out(HWVoiceOut *hw, struct audsetti= ngs *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 ); @@ -472,7 +482,7 @@ static int qpa_init_in(HWVoiceIn *hw, struct audsetting= s *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 180bf207a8..f3efa4620b 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: 3.2 ## { 'struct': 'AudiodevPaPerDirectionOptions', 'data': { - '*name': 'str' } } + '*name': 'str', + '*channel-map': 'str' } } =20 ## # @AudiodevPaOptions: diff --git a/qemu-options.hx b/qemu-options.hx index eb65b511fa..d051c52bbb 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -468,6 +468,7 @@ DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev, "-audiodev pa,id=3Did[,prop[=3Dvalue][,...]]\n" " server=3D PulseAudio server address\n" " sink|source.name=3D sink/source device name\n" + " sink|source.channel-map=3D channel map to use\n" #endif #ifdef CONFIG_SDL "-audiodev sdl,id=3Did[,prop[=3Dvalue][,...]]\n" @@ -621,6 +622,14 @@ Sets the PulseAudio @var{server} to connect to. @item sink|source.name=3D@var{sink} Use the specified sink/source for playback/recording. =20 +@item sink|source.channel-map=3D@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=3Dexample,sink.channel-map=3Dfront-left,,front-right +@end example + @end table =20 @item -audiodev sdl,id=3D@var{id}[,@var{prop}[=3D@var{value}][,...]] --=20 2.20.1