From nobody Wed Nov 12 07:06:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1568576753; cv=none; d=zoho.com; s=zohoarc; b=W48dBAxid4ZVEU9oF/79+j+LcaNeTaS/1kwpIFR//s/JPb16nBhuRzTmqbQfQ3qsxytfSsm7c6geldtDtYf8J5WSR8PvdIpVoo29zlC1d4barCrTSn1Qo0vFrsLlI4IVYyMKF+T/CiWsWCMlDLKhdWlQ8/t/zZSdbQcouYz6Y7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568576753; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=F6I/soIJaEjYxfRI9EDWkY2N9iUGEIeYzLkqeKMKgzM=; b=IE3iimOVa7GsKIa6W/GXBT4QfoNutg0nGMxEjQEX8ayOqZh+Jj3Dsqy8tAbhrPDU4EHXZw0ZbGn90n2KwnkeHsQWbWsDplsej2Rz89vx59XlpVEU3wexhkHWA9J7Q9lLkMwC45mQeppbbU2YNMlSzPj7J+FQyrFAUOCEfNKhzGg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568576753158429.0775067807858; Sun, 15 Sep 2019 12:45:53 -0700 (PDT) Received: from localhost ([::1]:56746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9aT2-0004WK-39 for importer@patchew.org; Sun, 15 Sep 2019 15:45:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40150) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9a7r-0006GX-M3 for qemu-devel@nongnu.org; Sun, 15 Sep 2019 15:24:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9a7q-000235-E7 for qemu-devel@nongnu.org; Sun, 15 Sep 2019 15:23:59 -0400 Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]:42356) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i9a7q-00022q-6o for qemu-devel@nongnu.org; Sun, 15 Sep 2019 15:23:58 -0400 Received: by mail-ed1-x541.google.com with SMTP id y91so31230566ede.9 for ; Sun, 15 Sep 2019 12:23:58 -0700 (PDT) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-74ef-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:74ef::5]) by smtp.gmail.com with ESMTPSA id j20sm6480562edy.95.2019.09.15.12.23.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Sep 2019 12:23:56 -0700 (PDT) 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=F6I/soIJaEjYxfRI9EDWkY2N9iUGEIeYzLkqeKMKgzM=; b=uggAw7VyF5bomrgCYRcPQvEYvbRjxY0l/aET2ssc3qVreA0SUk2n7m+DhmO9G44eT3 YXCFn1/6qhhY3MH2YQNFfNVrn04EJox2OmYjZn7SHdtIhsLYyAbGYV4N/yeoxCyJW6B7 z4z5m5qj//wU6vx/1yN7+DTcOpfNlL7DXyzNx8HDRyEecmTZ711cw9Bt/rasn+zACpYB +3wDdK5kK+6VjGIOBxag62gvCRGcNQuciFiWOjmGioExuL5mhnPTHpntY0xhkHw/sDmR JYDrpFJDIzr12cBCXeWxdq8lmPwwZO2EGbM0QRpINpzhmrn7l5a3gTVZn/4fiHQwgQq2 lA0A== 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=F6I/soIJaEjYxfRI9EDWkY2N9iUGEIeYzLkqeKMKgzM=; b=lbhp3vJKLjhW+n3phQHF+uoEiagBbd9Z5skDKAN2vwqgrCBkIkI5pVm4KQN++QiOR/ FmaSbUu8ZqhxIRTXrZcRi303v1reGQ0qWmeuaqrwVbCGxq9g1xIUlCwyAdTP+Bp5eE5v peSz8p0MaQTHQUa6KxozbcZr8+dsEgPEN1i/LMvaOsshHbXGoT6PE3iBfUOl4k/7QwO3 mSQp/4oOdf7HmgHLauO5jX5+MlVti/W/JWpxdSzNslumepV2OdS5phRdLftrCzDWo/Az vJMbkHXeWL9Pv51N9HMyble3DGIt+K4ZHHFBzsdOOSyGBPQ4EkTDF7jWuIQxnCbmDNQn aTIQ== X-Gm-Message-State: APjAAAXbLnmCGaHWvl1Hc5lpo/LZEKtWb7viq73iyB0yJ+snS0Z7DojK 7oN0F+qYH5MM/QcXHdozKDB8mTQg X-Google-Smtp-Source: APXvYqx8bEKfNQ7yDzi2XR4/PMTVT0tG2C7VVEtiZKDPmdwwlE7dlJ0EKqWr3B5JlydHGweY7QQi3w== X-Received: by 2002:a50:e70c:: with SMTP id a12mr58020237edn.73.1568575437084; Sun, 15 Sep 2019 12:23:57 -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: Sun, 15 Sep 2019 21:23:37 +0200 Message-Id: <66670d43bd932be0919668cec6a8cd172bfb8383.1568574965.git.DirtY.iCE.hu@gmail.com> X-Mailer: git-send-email 2.23.0 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::541 Subject: [Qemu-devel] [PATCH v3 21/24] paaudio: channel-map option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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 | 7 +++++-- qemu-options.hx | 9 +++++++++ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/audio/paaudio.c b/audio/paaudio.c index d195b1caa8..20402b0718 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -338,17 +338,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; } @@ -421,7 +431,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 ); @@ -470,7 +480,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, &ba, /* buffering attributes */ &error ); diff --git a/qapi/audio.json b/qapi/audio.json index 0535eff794..07003808cb 100644 --- a/qapi/audio.json +++ b/qapi/audio.json @@ -214,13 +214,16 @@ # @latency: latency you want PulseAudio to achieve in microseconds # (default 15000) # +# @channel-map: channel map to use (default: OSS compatible map, since: 4.= 2) +# # Since: 4.0 ## { 'struct': 'AudiodevPaPerDirectionOptions', 'base': 'AudiodevPerDirectionOptions', 'data': { - '*name': 'str', - '*latency': 'uint32' } } + '*name': 'str', + '*latency': 'uint32', + '*channel-map': 'str' } } =20 ## # @AudiodevPaOptions: diff --git a/qemu-options.hx b/qemu-options.hx index 734a3b5d65..6aee778896 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -471,6 +471,7 @@ DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev, "-audiodev pa,id=3Did[,prop[=3Dvalue][,...]]\n" " server=3D PulseAudio server address\n" " in|out.name=3D source/sink device name\n" + " in|out.channel-map=3D channel map to use\n" #endif #ifdef CONFIG_AUDIO_SDL "-audiodev sdl,id=3Did[,prop[=3Dvalue][,...]]\n" @@ -636,6 +637,14 @@ Sets the PulseAudio @var{server} to connect to. @item in|out.name=3D@var{sink} Use the specified source/sink for recording/playback. =20 +@item in|out.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.23.0