[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 11/50] sdlaudio: port to -audiodev config
From: |
Kővágó, Zoltán |
Subject: |
[Qemu-devel] [PATCH v3 11/50] sdlaudio: port to -audiodev config |
Date: |
Thu, 17 Jan 2019 00:36:44 +0100 |
Signed-off-by: Kővágó, Zoltán <address@hidden>
---
audio/audio_legacy.c | 12 ++++++++++++
audio/sdlaudio.c | 22 ++++------------------
2 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/audio/audio_legacy.c b/audio/audio_legacy.c
index d173ff042e..aa6c789096 100644
--- a/audio/audio_legacy.c
+++ b/audio/audio_legacy.c
@@ -285,6 +285,14 @@ static void handle_pa(Audiodev *dev)
get_str("QEMU_PA_SERVER", &dev->u.pa.server, &dev->u.pa.has_server);
}
+/* SDL */
+static void handle_sdl(Audiodev *dev)
+{
+ /* SDL is output only */
+ get_samples_to_usecs("QEMU_SDL_SAMPLES", &dev->out->buffer_len,
+ &dev->out->has_buffer_len, dev->out);
+}
+
/* general */
static void handle_per_direction(
AudiodevPerDirectionOptions *pdo, const char *prefix)
@@ -348,6 +356,10 @@ static AudiodevListEntry *legacy_opt(const char *drvname)
handle_pa(e->dev);
break;
+ case AUDIODEV_DRIVER_SDL:
+ handle_sdl(e->dev);
+ break;
+
default:
break;
}
diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c
index 097841fde1..cf6ac19927 100644
--- a/audio/sdlaudio.c
+++ b/audio/sdlaudio.c
@@ -49,12 +49,6 @@ typedef struct SDLVoiceOut {
int decr;
} SDLVoiceOut;
-static struct {
- int nb_samples;
-} conf = {
- .nb_samples = 1024
-};
-
static struct SDLAudioState {
int exit;
#if USE_SEMAPHORE
@@ -63,6 +57,7 @@ static struct SDLAudioState {
#endif
int initialized;
bool driver_created;
+ Audiodev *dev;
} glob_sdl;
typedef struct SDLAudioState SDLAudioState;
@@ -392,7 +387,7 @@ static int sdl_init_out(HWVoiceOut *hw, struct audsettings
*as,
req.freq = as->freq;
req.format = aud_to_sdlfmt (as->fmt);
req.channels = as->nchannels;
- req.samples = conf.nb_samples;
+ req.samples = audio_buffer_samples(s->dev->out, as, 11610);
req.callback = sdl_callback;
req.userdata = sdl;
@@ -467,6 +462,7 @@ static void *sdl_audio_init(Audiodev *dev)
#endif
s->driver_created = true;
+ s->dev = dev;
return s;
}
@@ -480,18 +476,9 @@ static void sdl_audio_fini (void *opaque)
#endif
SDL_QuitSubSystem (SDL_INIT_AUDIO);
s->driver_created = false;
+ s->dev = NULL;
}
-static struct audio_option sdl_options[] = {
- {
- .name = "SAMPLES",
- .tag = AUD_OPT_INT,
- .valp = &conf.nb_samples,
- .descr = "Size of SDL buffer in samples"
- },
- { /* End of list */ }
-};
-
static struct audio_pcm_ops sdl_pcm_ops = {
.init_out = sdl_init_out,
.fini_out = sdl_fini_out,
@@ -503,7 +490,6 @@ static struct audio_pcm_ops sdl_pcm_ops = {
static struct audio_driver sdl_audio_driver = {
.name = "sdl",
.descr = "SDL http://www.libsdl.org",
- .options = sdl_options,
.init = sdl_audio_init,
.fini = sdl_audio_fini,
.pcm_ops = &sdl_pcm_ops,
--
2.20.1
- [Qemu-devel] [PATCH v3 01/50] qapi: qapi for audio backends, (continued)
- [Qemu-devel] [PATCH v3 01/50] qapi: qapi for audio backends, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 13/50] wavaudio: port to -audiodev config, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 22/50] audio: do not run each backend in audio_run, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 10/50] paaudio: port to -audiodev config, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 07/50] dsoundaudio: port to -audiodev config, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 14/50] audio: -audiodev command line option: cleanup, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 12/50] spiceaudio: port to -audiodev config, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 20/50] paaudio: properly disconnect streams in fini_*, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 11/50] sdlaudio: port to -audiodev config,
Kővágó, Zoltán <=
- [Qemu-devel] [PATCH v3 16/50] audio: basic support for multi backend audio, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 18/50] audio: audiodev= parameters no longer optional when -audiodev present, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 21/50] audio: remove audio_MIN, audio_MAX, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 30/50] noaudio: port to the new audio backend api, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 23/50] paaudio: fix playback glitches, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 17/50] audio: add audiodev properties to frontends, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 05/50] alsaaudio: port to -audiodev config, Kővágó, Zoltán, 2019/01/16
- [Qemu-devel] [PATCH v3 02/50] audio: use qapi AudioFormat instead of audfmt_e, Kővágó, Zoltán, 2019/01/16