From patchwork Sun Sep 8 21:22:21 2019 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: 1159543 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="m82z7gXq"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46RPjC0xK5z9sCJ for ; Mon, 9 Sep 2019 07:35:27 +1000 (AEST) Received: from localhost ([::1]:50736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i74qC-00070w-P9 for incoming@patchwork.ozlabs.org; Sun, 08 Sep 2019 17:35:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46492) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i74e4-0005dx-QS for qemu-devel@nongnu.org; Sun, 08 Sep 2019 17:22:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i74e3-0005vf-CS for qemu-devel@nongnu.org; Sun, 08 Sep 2019 17:22:52 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:44914) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i74e3-0005vT-7x for qemu-devel@nongnu.org; Sun, 08 Sep 2019 17:22:51 -0400 Received: by mail-qk1-x742.google.com with SMTP id i78so11090251qke.11 for ; Sun, 08 Sep 2019 14:22:51 -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=m82z7gXqznQIawbyOw5lUKO2ia7pX4JA/eGEV9ztfCcZCcC1yzN3MEOx+UvsAhz/Xw 1CxeoNAbPW9PNifklZb3MAtPuky+wK8ULobtseQKDu3y04YjsJPTBWhTs32YUDE/owUG 1iPq853lQ6LSM8kn0xcRcdtnhkGWHAXkpGCPf7ucG3cwR//Kk3QKaVLWb67kg3mDDVKy fQ33rynjK0Jdnd5VUxi0O8xrHMaYy+DelI4NROwfLAxwbuVOO7cTFx6QYpmoVcNRsDWq 7gB8BB9u+paU61NFAF0xkS/XcNGZnSBeYSXpT2CoA8ZVZtNbN3SpEpuYcQamr0ub7BRn E7YA== 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=T7MZwavUCRI/Cuy8F1CSmN8H4r16MnbFVlA2TOxGZHpTXrR80DKRMmXfff2A5GIdB/ N0RVBdVaNBckxHKgS3fT7GzcfFi/leO+/Pk7gGKbHVUIazGPPRcqInVCmo+qgOsMK4su e3t4CtYZZnfi7eOsT0SwOv0aS46W79jdphHU0vduEjebBcoYe8bYOPq8CR6oykF682ii y6v1i6DoiZCipUK9hAMfLfpOIatfuIy3L9cazvrElhokmwpMDlQhSjTAuZC3CFP+Sf8i STrAFMVARLD88HzraKB0zFCklX/Qji7bWBVroLQJbi2qQNqC4m27fX2ZOfbKaXF4HeDa LhMA== X-Gm-Message-State: APjAAAWRFFSQDC1FPSnhsiGAB2wpPGnnDp8C6SQDDaSf0ZeTFL4ymBjF eKNoz/AJ5bTgjjxj67U9bD8ZcCNS X-Google-Smtp-Source: APXvYqyBhSkFGnP9gPNDIjzvoHrLWtuHV/J6FhCcmEG0R2/HNqfhClcC5dmqXr1DntV9UG9Pd9AHiA== X-Received: by 2002:a37:b4c7:: with SMTP id d190mr21234459qkf.202.1567977770707; Sun, 08 Sep 2019 14:22:50 -0700 (PDT) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-6ea8-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:6ea8::5]) by smtp.gmail.com with ESMTPSA id e2sm5488112qkg.38.2019.09.08.14.22.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 14:22:50 -0700 (PDT) From: "=?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?=" X-Google-Original-From: =?utf-8?b?S8WRdsOhZ8OzLCBab2x0w6Fu?= To: qemu-devel@nongnu.org Date: Sun, 8 Sep 2019 23:22:21 +0200 Message-Id: <2a463a42ada49cb3582129ab8b1785134aecea9b.1567965065.git.DirtY.iCE.hu@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::742 Subject: [Qemu-devel] [PATCH v2 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 | 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; 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; } @@ -421,7 +431,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 ); @@ -470,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, &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' } } ## # @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=id[,prop[=value][,...]]\n" " server= PulseAudio server address\n" " in|out.name= source/sink device name\n" + " in|out.channel-map= channel map to use\n" #endif #ifdef CONFIG_AUDIO_SDL "-audiodev sdl,id=id[,prop[=value][,...]]\n" @@ -636,6 +637,14 @@ Sets the PulseAudio @var{server} to connect to. @item in|out.name=@var{sink} Use the specified source/sink for recording/playback. +@item in|out.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}][,...]]