From: "Kővágó, Zoltán" <dirty.ice.hu@gmail.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PATCH 22/25] paaudio: channel-map option
Date: Sun, 25 Aug 2019 20:46:24 +0200 [thread overview]
Message-ID: <8ddd9c04b32fca07e3aa4f5a327bcb486a077b2c.1566755452.git.DirtY.iCE.hu@gmail.com> (raw)
In-Reply-To: <cover.1566755452.git.DirtY.iCE.hu@gmail.com>
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 <DirtY.iCE.hu@gmail.com>
---
qapi/audio.json | 7 +++++--
audio/paaudio.c | 18 ++++++++++++++----
qemu-options.hx | 9 +++++++++
3 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/qapi/audio.json b/qapi/audio.json
index dc7f9cb1e2..e9e040a156 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/audio/paaudio.c b/audio/paaudio.c
index 796890a3a5..4ce4f03c72 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
);
@@ -477,7 +487,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/qemu-options.hx b/qemu-options.hx
index 8de6deb691..4eb4d6fe6d 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}][,...]]
--
2.22.0
next prev parent reply other threads:[~2019-08-25 19:08 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-25 18:46 [Qemu-devel] [PATCH 00/25] Audio: Mixeng-free 5.1/7.1 audio support Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 01/25] audio: api for mixeng code free backends Kővágó, Zoltán
2019-08-27 5:43 ` Gerd Hoffmann
2019-08-25 18:46 ` [Qemu-devel] [PATCH 02/25] alsaaudio: port to the new audio backend api Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 03/25] coreaudio: " Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 04/25] dsoundaudio: " Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 05/25] noaudio: " Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 06/25] ossaudio: " Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 07/25] paaudio: " Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 08/25] sdlaudio: " Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 10/25] wavaudio: " Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 11/25] audio: remove remains of the old " Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 12/25] audio: unify input and output mixeng buffer management Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 13/25] audio: remove hw->samples, buffer_size_in/out pcm_ops Kővágó, Zoltán
2019-08-27 5:48 ` Gerd Hoffmann
2019-08-25 18:46 ` [Qemu-devel] [PATCH 14/25] audio: common rate control code for timer based outputs Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 15/25] audio: split ctl_* functions into enable_* and volume_* Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 16/25] audio: add mixeng option (documentation) Kővágó, Zoltán
2019-08-26 13:35 ` Eric Blake
2019-08-26 20:04 ` Zoltán Kővágó
2019-08-25 18:46 ` [Qemu-devel] [PATCH 17/25] audio: make mixeng optional Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 19/25] audio: support more than two channels in volume setting Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 20/25] audio: replace shift in audio_pcm_info with bytes_per_frame Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 21/25] audio: basic support for multichannel audio Kővágó, Zoltán
2019-08-25 18:46 ` Kővágó, Zoltán [this message]
2019-08-25 18:46 ` [Qemu-devel] [PATCH 23/25] usb-audio: do not count on avail bytes actually available Kővágó, Zoltán
2019-08-25 18:46 ` [Qemu-devel] [PATCH 25/25] usbaudio: change playback counters to 64 bit Kővágó, Zoltán
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ddd9c04b32fca07e3aa4f5a327bcb486a077b2c.1566755452.git.DirtY.iCE.hu@gmail.com \
--to=dirty.ice.hu@gmail.com \
--cc=armbru@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).