audio: basic support for multi backend audio
Audio functions no longer access glob_audio_state, instead they get an
AudioState as a parameter. This is required in order to support
multiple backends.
glob_audio_state is also gone, and replaced with a tailq so we can store
more than one states.
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Message-id: 67aef54f9e729a7160fe95c465351115e392164b.1566168923.git.DirtY.iCE.hu@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
diff --git a/audio/audio.h b/audio/audio.h
index 64b0f76..ad2457f 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -78,8 +78,10 @@
typedef struct CaptureVoiceOut CaptureVoiceOut;
typedef struct SWVoiceIn SWVoiceIn;
+typedef struct AudioState AudioState;
typedef struct QEMUSoundCard {
char *name;
+ AudioState *state;
QLIST_ENTRY (QEMUSoundCard) entries;
} QEMUSoundCard;
@@ -92,7 +94,8 @@
void AUD_register_card (const char *name, QEMUSoundCard *card);
void AUD_remove_card (QEMUSoundCard *card);
-CaptureVoiceOut *AUD_add_capture (
+CaptureVoiceOut *AUD_add_capture(
+ AudioState *s,
struct audsettings *as,
struct audio_capture_ops *ops,
void *opaque
@@ -160,8 +163,8 @@
#define audio_MAX(a, b) ((a)<(b)?(b):(a))
#endif
-int wav_start_capture (CaptureState *s, const char *path, int freq,
- int bits, int nchannels);
+int wav_start_capture(AudioState *state, CaptureState *s, const char *path,
+ int freq, int bits, int nchannels);
bool audio_is_cleaning_up(void);
void audio_cleanup(void);
@@ -175,4 +178,7 @@
void audio_init_audiodevs(void);
void audio_legacy_help(void);
+AudioState *audio_state_by_name(const char *name);
+const char *audio_get_id(QEMUSoundCard *card);
+
#endif /* QEMU_AUDIO_H */