aboutsummaryrefslogtreecommitdiff
path: root/audio/audio_legacy.c
diff options
context:
space:
mode:
authorKővágó, Zoltán <dirty.ice.hu@gmail.com>2019-03-08 23:34:21 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-03-11 10:29:27 +0100
commit2c324b284aac7b87f65af043b8cb6196bd6ad16b (patch)
tree1906c9a5b71e944a466cff0eb3a90738fe71e51b /audio/audio_legacy.c
parentbaf6c7f4b4a7cf71d864964f778255d4b203a798 (diff)
downloadqemu-2c324b284aac7b87f65af043b8cb6196bd6ad16b.zip
qemu-2c324b284aac7b87f65af043b8cb6196bd6ad16b.tar.gz
qemu-2c324b284aac7b87f65af043b8cb6196bd6ad16b.tar.bz2
paaudio: port to -audiodev config
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com> Message-id: c74dc9c282075fba6928c40b2deae057fa0d4049.1552083282.git.DirtY.iCE.hu@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio/audio_legacy.c')
-rw-r--r--audio/audio_legacy.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/audio/audio_legacy.c b/audio/audio_legacy.c
index 94f95bb..8d7f147 100644
--- a/audio/audio_legacy.c
+++ b/audio/audio_legacy.c
@@ -127,6 +127,16 @@ static uint32_t samples_to_usecs(uint32_t samples,
return frames_to_usecs(samples / channels, pdo);
}
+static void get_samples_to_usecs(const char *env, uint32_t *dst, bool *has_dst,
+ AudiodevPerDirectionOptions *pdo)
+{
+ const char *val = getenv(env);
+ if (val) {
+ *dst = samples_to_usecs(toui32(val), pdo);
+ *has_dst = true;
+ }
+}
+
static uint32_t bytes_to_usecs(uint32_t bytes, AudiodevPerDirectionOptions *pdo)
{
AudioFormat fmt = pdo->has_format ? pdo->format : AUDIO_FORMAT_S16;
@@ -247,6 +257,30 @@ static void handle_oss(Audiodev *dev)
get_int("QEMU_OSS_POLICY", &oopt->dsp_policy, &oopt->has_dsp_policy);
}
+/* pulseaudio */
+static void handle_pa_per_direction(
+ AudiodevPaPerDirectionOptions *ppdo, const char *env)
+{
+ get_str(env, &ppdo->name, &ppdo->has_name);
+}
+
+static void handle_pa(Audiodev *dev)
+{
+ handle_pa_per_direction(dev->u.pa.in, "QEMU_PA_SOURCE");
+ handle_pa_per_direction(dev->u.pa.out, "QEMU_PA_SINK");
+
+ get_samples_to_usecs(
+ "QEMU_PA_SAMPLES", &dev->u.pa.in->buffer_length,
+ &dev->u.pa.in->has_buffer_length,
+ qapi_AudiodevPaPerDirectionOptions_base(dev->u.pa.in));
+ get_samples_to_usecs(
+ "QEMU_PA_SAMPLES", &dev->u.pa.out->buffer_length,
+ &dev->u.pa.out->has_buffer_length,
+ qapi_AudiodevPaPerDirectionOptions_base(dev->u.pa.out));
+
+ get_str("QEMU_PA_SERVER", &dev->u.pa.server, &dev->u.pa.has_server);
+}
+
/* general */
static void handle_per_direction(
AudiodevPerDirectionOptions *pdo, const char *prefix)
@@ -304,6 +338,10 @@ static AudiodevListEntry *legacy_opt(const char *drvname)
handle_oss(e->dev);
break;
+ case AUDIODEV_DRIVER_PA:
+ handle_pa(e->dev);
+ break;
+
default:
break;
}