[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 21/26] paaudio: channel-map option
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 21/26] paaudio: channel-map option |
Date: |
Thu, 19 Sep 2019 10:36:24 +0200 |
From: Kővágó, Zoltán <address@hidden>
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 <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
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 d195b1caa8d8..20402b071804 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 0535eff7948f..07003808cba7 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 734a3b5d6569..6aee778896b8 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.18.1
- [Qemu-devel] [PULL 12/26] audio: unify input and output mixeng buffer management, (continued)
- [Qemu-devel] [PULL 12/26] audio: unify input and output mixeng buffer management, Gerd Hoffmann, 2019/09/19
- [Qemu-devel] [PULL 02/26] alsaaudio: port to the new audio backend api, Gerd Hoffmann, 2019/09/19
- [Qemu-devel] [PULL 09/26] spiceaudio: port to the new audio backend api, Gerd Hoffmann, 2019/09/19
- [Qemu-devel] [PULL 16/26] audio: make mixeng optional, Gerd Hoffmann, 2019/09/19
- [Qemu-devel] [PULL 10/26] wavaudio: port to the new audio backend api, Gerd Hoffmann, 2019/09/19
- [Qemu-devel] [PULL 04/26] dsoundaudio: port to the new audio backend api, Gerd Hoffmann, 2019/09/19
- [Qemu-devel] [PULL 07/26] paaudio: port to the new audio backend api, Gerd Hoffmann, 2019/09/19
- [Qemu-devel] [PULL 25/26] audio: fix buffer-length typo in documentation, Gerd Hoffmann, 2019/09/19
- [Qemu-devel] [PULL 26/26] audio: fix ALSA period-length typo in documentation, Gerd Hoffmann, 2019/09/19
- [Qemu-devel] [PULL 13/26] audio: common rate control code for timer based outputs, Gerd Hoffmann, 2019/09/19
- [Qemu-devel] [PULL 21/26] paaudio: channel-map option,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 23/26] usb-audio: support more than two channels of audio, Gerd Hoffmann, 2019/09/19
- [Qemu-devel] [PULL 24/26] usbaudio: change playback counters to 64 bit, Gerd Hoffmann, 2019/09/19
- [Qemu-devel] [PULL 19/26] audio: replace shift in audio_pcm_info with bytes_per_frame, Gerd Hoffmann, 2019/09/19
- [Qemu-devel] [PULL 06/26] ossaudio: port to the new audio backend api, Gerd Hoffmann, 2019/09/19
- [Qemu-devel] [PULL 14/26] audio: split ctl_* functions into enable_* and volume_*, Gerd Hoffmann, 2019/09/19
- Re: [Qemu-devel] [PULL 00/26] Audio 20190919 patches, Peter Maydell, 2019/09/19