diff options
author | Kővágó, Zoltán <dirty.ice.hu@gmail.com> | 2019-03-08 23:34:17 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-03-11 10:29:27 +0100 |
commit | 17c56dc1d1882fd98d263a43c71761ffe17c6f65 (patch) | |
tree | 4794639e08b4466b914bfb3f4c89a7ca81a8c698 /audio/audio_legacy.c | |
parent | a93f328177378b4c5e3cf3c98f245415489eaa13 (diff) |
coreaudio: port to -audiodev config
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Message-id: ba58f7e2501b1454b5e0f91c03aad416a404fc6a.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.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/audio/audio_legacy.c b/audio/audio_legacy.c index f58c8b6aee..5f557a2de9 100644 --- a/audio/audio_legacy.c +++ b/audio/audio_legacy.c @@ -109,6 +109,17 @@ static uint32_t frames_to_usecs(uint32_t frames, return (frames * 1000000 + freq / 2) / freq; } + +static void get_frames_to_usecs(const char *env, uint32_t *dst, bool *has_dst, + AudiodevPerDirectionOptions *pdo) +{ + const char *val = getenv(env); + if (val) { + *dst = frames_to_usecs(toui32(val), pdo); + *has_dst = true; + } +} + /* backend specific functions */ /* ALSA */ static void handle_alsa_per_direction( @@ -156,6 +167,19 @@ static void handle_alsa(Audiodev *dev) &aopt->threshold, &aopt->has_threshold); } +/* coreaudio */ +static void handle_coreaudio(Audiodev *dev) +{ + get_frames_to_usecs( + "QEMU_COREAUDIO_BUFFER_SIZE", + &dev->u.coreaudio.out->buffer_length, + &dev->u.coreaudio.out->has_buffer_length, + qapi_AudiodevCoreaudioPerDirectionOptions_base(dev->u.coreaudio.out)); + get_int("QEMU_COREAUDIO_BUFFER_COUNT", + &dev->u.coreaudio.out->buffer_count, + &dev->u.coreaudio.out->has_buffer_count); +} + /* general */ static void handle_per_direction( AudiodevPerDirectionOptions *pdo, const char *prefix) @@ -201,6 +225,10 @@ static AudiodevListEntry *legacy_opt(const char *drvname) handle_alsa(e->dev); break; + case AUDIODEV_DRIVER_COREAUDIO: + handle_coreaudio(e->dev); + break; + default: break; } |