audio: rename AudioState -> AudioBackend
Naming is hard. But in general in QEMU, a host "backend" is the term used to fullfill the request made by the device or frontend. AudioBackend will become an abstract base class in a follow-up series. Currently the frontend is QEMUSoundCard, we are going to drop that next. Note that "audiodev" is the corresponding QAPI type name (or configuration). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
6fcd22cfdb
commit
7d75c12ad1
15 changed files with 97 additions and 97 deletions
|
|
@ -41,7 +41,7 @@ struct pollhlp {
|
|||
struct pollfd *pfds;
|
||||
int count;
|
||||
int mask;
|
||||
AudioState *s;
|
||||
AudioBackend *s;
|
||||
};
|
||||
|
||||
typedef struct ALSAVoiceOut {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void hmp_wavcapture(Monitor *mon, const QDict *qdict)
|
|||
const char *audiodev = qdict_get_str(qdict, "audiodev");
|
||||
CaptureState *s;
|
||||
Error *local_err = NULL;
|
||||
AudioState *as = audio_state_by_name(audiodev, &local_err);
|
||||
AudioBackend *as = audio_be_by_name(audiodev, &local_err);
|
||||
|
||||
if (!as) {
|
||||
error_report_err(local_err);
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ static audio_driver *audio_driver_lookup(const char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static AudioState *default_audio_state;
|
||||
static AudioBackend *default_audio_be;
|
||||
|
||||
const struct mixeng_volume nominal_volume = {
|
||||
.mute = 0,
|
||||
|
|
@ -380,7 +380,7 @@ void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len)
|
|||
/*
|
||||
* Capture
|
||||
*/
|
||||
static CaptureVoiceOut *audio_pcm_capture_find_specific(AudioState *s,
|
||||
static CaptureVoiceOut *audio_pcm_capture_find_specific(AudioBackend *s,
|
||||
struct audsettings *as)
|
||||
{
|
||||
CaptureVoiceOut *cap;
|
||||
|
|
@ -460,7 +460,7 @@ static void audio_detach_capture (HWVoiceOut *hw)
|
|||
|
||||
static int audio_attach_capture (HWVoiceOut *hw)
|
||||
{
|
||||
AudioState *s = hw->s;
|
||||
AudioBackend *s = hw->s;
|
||||
CaptureVoiceOut *cap;
|
||||
|
||||
audio_detach_capture (hw);
|
||||
|
|
@ -798,7 +798,7 @@ static void audio_pcm_print_info (const char *cap, struct audio_pcm_info *info)
|
|||
/*
|
||||
* Timer
|
||||
*/
|
||||
static int audio_is_timer_needed(AudioState *s)
|
||||
static int audio_is_timer_needed(AudioBackend *s)
|
||||
{
|
||||
HWVoiceIn *hwi = NULL;
|
||||
HWVoiceOut *hwo = NULL;
|
||||
|
|
@ -816,7 +816,7 @@ static int audio_is_timer_needed(AudioState *s)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void audio_reset_timer (AudioState *s)
|
||||
static void audio_reset_timer(AudioBackend *s)
|
||||
{
|
||||
if (audio_is_timer_needed(s)) {
|
||||
timer_mod_anticipate_ns(s->ts,
|
||||
|
|
@ -838,7 +838,7 @@ static void audio_reset_timer (AudioState *s)
|
|||
static void audio_timer (void *opaque)
|
||||
{
|
||||
int64_t now, diff;
|
||||
AudioState *s = opaque;
|
||||
AudioBackend *s = opaque;
|
||||
|
||||
now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
diff = now - s->timer_last;
|
||||
|
|
@ -921,7 +921,7 @@ void AUD_set_active_out (SWVoiceOut *sw, int on)
|
|||
|
||||
hw = sw->hw;
|
||||
if (sw->active != on) {
|
||||
AudioState *s = sw->s;
|
||||
AudioBackend *s = sw->s;
|
||||
SWVoiceOut *temp_sw;
|
||||
SWVoiceCap *sc;
|
||||
|
||||
|
|
@ -969,7 +969,7 @@ void AUD_set_active_in (SWVoiceIn *sw, int on)
|
|||
|
||||
hw = sw->hw;
|
||||
if (sw->active != on) {
|
||||
AudioState *s = sw->s;
|
||||
AudioBackend *s = sw->s;
|
||||
SWVoiceIn *temp_sw;
|
||||
|
||||
if (on) {
|
||||
|
|
@ -1137,7 +1137,7 @@ static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, size_t live)
|
|||
return clipped;
|
||||
}
|
||||
|
||||
static void audio_run_out (AudioState *s)
|
||||
static void audio_run_out(AudioBackend *s)
|
||||
{
|
||||
HWVoiceOut *hw = NULL;
|
||||
SWVoiceOut *sw;
|
||||
|
|
@ -1291,7 +1291,7 @@ static size_t audio_pcm_hw_run_in(HWVoiceIn *hw, size_t samples)
|
|||
return conv;
|
||||
}
|
||||
|
||||
static void audio_run_in (AudioState *s)
|
||||
static void audio_run_in(AudioBackend *s)
|
||||
{
|
||||
HWVoiceIn *hw = NULL;
|
||||
|
||||
|
|
@ -1339,7 +1339,7 @@ static void audio_run_in (AudioState *s)
|
|||
}
|
||||
}
|
||||
|
||||
static void audio_run_capture (AudioState *s)
|
||||
static void audio_run_capture(AudioBackend *s)
|
||||
{
|
||||
CaptureVoiceOut *cap;
|
||||
|
||||
|
|
@ -1386,7 +1386,7 @@ static void audio_run_capture (AudioState *s)
|
|||
}
|
||||
}
|
||||
|
||||
void audio_run(AudioState *s, const char *msg)
|
||||
void audio_run(AudioBackend *s, const char *msg)
|
||||
{
|
||||
audio_run_out(s);
|
||||
audio_run_in(s);
|
||||
|
|
@ -1559,7 +1559,7 @@ size_t audio_generic_read(HWVoiceIn *hw, void *buf, size_t size)
|
|||
return total;
|
||||
}
|
||||
|
||||
static bool audio_driver_init(AudioState *s, struct audio_driver *drv,
|
||||
static bool audio_driver_init(AudioBackend *s, struct audio_driver *drv,
|
||||
Audiodev *dev, Error **errp)
|
||||
{
|
||||
s->drv_opaque = drv->init(dev, errp);
|
||||
|
|
@ -1592,7 +1592,7 @@ static bool audio_driver_init(AudioState *s, struct audio_driver *drv,
|
|||
static void audio_vm_change_state_handler (void *opaque, bool running,
|
||||
RunState state)
|
||||
{
|
||||
AudioState *s = opaque;
|
||||
AudioBackend *s = opaque;
|
||||
HWVoiceOut *hwo = NULL;
|
||||
HWVoiceIn *hwi = NULL;
|
||||
|
||||
|
|
@ -1613,9 +1613,9 @@ static void audio_vm_change_state_handler (void *opaque, bool running,
|
|||
|
||||
static const VMStateDescription vmstate_audio;
|
||||
|
||||
static void audio_state_init(Object *obj)
|
||||
static void audio_be_init(Object *obj)
|
||||
{
|
||||
AudioState *s = AUDIO_STATE(obj);
|
||||
AudioBackend *s = AUDIO_BACKEND(obj);
|
||||
|
||||
QLIST_INIT(&s->hw_head_out);
|
||||
QLIST_INIT(&s->hw_head_in);
|
||||
|
|
@ -1629,9 +1629,9 @@ static void audio_state_init(Object *obj)
|
|||
vmstate_register_any(NULL, &vmstate_audio, s);
|
||||
}
|
||||
|
||||
static void audio_state_finalize(Object *obj)
|
||||
static void audio_be_finalize(Object *obj)
|
||||
{
|
||||
AudioState *s = AUDIO_STATE(obj);
|
||||
AudioBackend *s = AUDIO_BACKEND(obj);
|
||||
HWVoiceOut *hwo, *hwon;
|
||||
HWVoiceIn *hwi, *hwin;
|
||||
|
||||
|
|
@ -1692,7 +1692,7 @@ static Object *get_audiodevs_root(void)
|
|||
|
||||
void audio_cleanup(void)
|
||||
{
|
||||
default_audio_state = NULL;
|
||||
default_audio_be = NULL;
|
||||
|
||||
object_unparent(get_audiodevs_root());
|
||||
}
|
||||
|
|
@ -1743,14 +1743,14 @@ void audio_create_default_audiodevs(void)
|
|||
* if dev == NULL => legacy implicit initialization, return the already created
|
||||
* state or create a new one
|
||||
*/
|
||||
static AudioState *audio_init(Audiodev *dev, Error **errp)
|
||||
static AudioBackend *audio_init(Audiodev *dev, Error **errp)
|
||||
{
|
||||
int done = 0;
|
||||
const char *drvname;
|
||||
AudioState *s;
|
||||
AudioBackend *s;
|
||||
struct audio_driver *driver;
|
||||
|
||||
s = AUDIO_STATE(object_new(TYPE_AUDIO_STATE));
|
||||
s = AUDIO_BACKEND(object_new(TYPE_AUDIO_BACKEND));
|
||||
|
||||
if (dev) {
|
||||
/* -audiodev option */
|
||||
|
|
@ -1766,7 +1766,7 @@ static AudioState *audio_init(Audiodev *dev, Error **errp)
|
|||
goto out;
|
||||
}
|
||||
} else {
|
||||
assert(!default_audio_state);
|
||||
assert(!default_audio_be);
|
||||
for (;;) {
|
||||
AudiodevListEntry *e = QSIMPLEQ_FIRST(&default_audiodevs);
|
||||
if (!e) {
|
||||
|
|
@ -1797,11 +1797,11 @@ out:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
AudioState *audio_get_default_audio_state(Error **errp)
|
||||
AudioBackend *audio_get_default_audio_be(Error **errp)
|
||||
{
|
||||
if (!default_audio_state) {
|
||||
default_audio_state = audio_init(NULL, errp);
|
||||
if (!default_audio_state) {
|
||||
if (!default_audio_be) {
|
||||
default_audio_be = audio_init(NULL, errp);
|
||||
if (!default_audio_be) {
|
||||
if (!QSIMPLEQ_EMPTY(&audiodevs)) {
|
||||
error_append_hint(errp, "Perhaps you wanted to use -audio or set audiodev=%s?\n",
|
||||
QSIMPLEQ_FIRST(&audiodevs)->dev->id);
|
||||
|
|
@ -1809,21 +1809,21 @@ AudioState *audio_get_default_audio_state(Error **errp)
|
|||
}
|
||||
}
|
||||
|
||||
return default_audio_state;
|
||||
return default_audio_be;
|
||||
}
|
||||
|
||||
bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp)
|
||||
{
|
||||
if (!card->state) {
|
||||
card->state = audio_get_default_audio_state(errp);
|
||||
if (!card->state) {
|
||||
if (!card->be) {
|
||||
card->be = audio_get_default_audio_be(errp);
|
||||
if (!card->be) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
card->name = g_strdup (name);
|
||||
memset (&card->entries, 0, sizeof (card->entries));
|
||||
QLIST_INSERT_HEAD(&card->state->card_head, card, entries);
|
||||
QLIST_INSERT_HEAD(&card->be->card_head, card, entries);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1837,7 +1837,7 @@ void AUD_remove_card (QEMUSoundCard *card)
|
|||
static struct audio_pcm_ops capture_pcm_ops;
|
||||
|
||||
CaptureVoiceOut *AUD_add_capture(
|
||||
AudioState *s,
|
||||
AudioBackend *s,
|
||||
struct audsettings *as,
|
||||
struct audio_capture_ops *ops,
|
||||
void *cb_opaque
|
||||
|
|
@ -2220,7 +2220,7 @@ int audio_buffer_bytes(AudiodevPerDirectionOptions *pdo,
|
|||
audioformat_bytes_per_sample(as->fmt);
|
||||
}
|
||||
|
||||
AudioState *audio_state_by_name(const char *name, Error **errp)
|
||||
AudioBackend *audio_be_by_name(const char *name, Error **errp)
|
||||
{
|
||||
Object *obj = object_resolve_path_component(get_audiodevs_root(), name);
|
||||
|
||||
|
|
@ -2228,15 +2228,15 @@ AudioState *audio_state_by_name(const char *name, Error **errp)
|
|||
error_setg(errp, "audiodev '%s' not found", name);
|
||||
return NULL;
|
||||
} else {
|
||||
return AUDIO_STATE(obj);
|
||||
return AUDIO_BACKEND(obj);
|
||||
}
|
||||
}
|
||||
|
||||
const char *audio_get_id(QEMUSoundCard *card)
|
||||
{
|
||||
if (card->state) {
|
||||
assert(card->state->dev);
|
||||
return card->state->dev->id;
|
||||
if (card->be) {
|
||||
assert(card->be->dev);
|
||||
return card->be->dev->id;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
|
@ -2305,19 +2305,19 @@ AudiodevList *qmp_query_audiodevs(Error **errp)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static const TypeInfo audio_state_info = {
|
||||
.name = TYPE_AUDIO_STATE,
|
||||
static const TypeInfo audio_be_info = {
|
||||
.name = TYPE_AUDIO_BACKEND,
|
||||
.parent = TYPE_OBJECT,
|
||||
.instance_size = sizeof(AudioState),
|
||||
.instance_init = audio_state_init,
|
||||
.instance_finalize = audio_state_finalize,
|
||||
.instance_size = sizeof(AudioBackend),
|
||||
.instance_init = audio_be_init,
|
||||
.instance_finalize = audio_be_finalize,
|
||||
.abstract = false, /* TODO: subclass drivers and make it abstract */
|
||||
.class_size = sizeof(AudioStateClass),
|
||||
.class_size = sizeof(AudioBackendClass),
|
||||
};
|
||||
|
||||
static void register_types(void)
|
||||
{
|
||||
type_register_static(&audio_state_info);
|
||||
type_register_static(&audio_be_info);
|
||||
}
|
||||
|
||||
type_init(register_types);
|
||||
|
|
|
|||
|
|
@ -64,14 +64,14 @@ typedef struct SWVoiceOut SWVoiceOut;
|
|||
typedef struct CaptureVoiceOut CaptureVoiceOut;
|
||||
typedef struct SWVoiceIn SWVoiceIn;
|
||||
|
||||
struct AudioStateClass {
|
||||
struct AudioBackendClass {
|
||||
ObjectClass parent_class;
|
||||
};
|
||||
|
||||
typedef struct AudioState AudioState;
|
||||
typedef struct AudioBackend AudioBackend;
|
||||
typedef struct QEMUSoundCard {
|
||||
char *name;
|
||||
AudioState *state;
|
||||
AudioBackend *be;
|
||||
QLIST_ENTRY (QEMUSoundCard) entries;
|
||||
} QEMUSoundCard;
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ typedef struct QEMUAudioTimeStamp {
|
|||
bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp);
|
||||
void AUD_remove_card (QEMUSoundCard *card);
|
||||
CaptureVoiceOut *AUD_add_capture(
|
||||
AudioState *s,
|
||||
AudioBackend *s,
|
||||
struct audsettings *as,
|
||||
struct audio_capture_ops *ops,
|
||||
void *opaque
|
||||
|
|
@ -164,14 +164,14 @@ void audio_create_default_audiodevs(void);
|
|||
void audio_init_audiodevs(void);
|
||||
void audio_help(void);
|
||||
|
||||
AudioState *audio_state_by_name(const char *name, Error **errp);
|
||||
AudioState *audio_get_default_audio_state(Error **errp);
|
||||
AudioBackend *audio_be_by_name(const char *name, Error **errp);
|
||||
AudioBackend *audio_get_default_audio_be(Error **errp);
|
||||
const char *audio_get_id(QEMUSoundCard *card);
|
||||
|
||||
#define DEFINE_AUDIO_PROPERTIES(_s, _f) \
|
||||
DEFINE_PROP_AUDIODEV("audiodev", _s, _f)
|
||||
|
||||
#define TYPE_AUDIO_STATE "audio-state"
|
||||
OBJECT_DECLARE_TYPE(AudioState, AudioStateClass, AUDIO_STATE)
|
||||
#define TYPE_AUDIO_BACKEND "audio-backend"
|
||||
OBJECT_DECLARE_TYPE(AudioBackend, AudioBackendClass, AUDIO_BACKEND)
|
||||
|
||||
#endif /* QEMU_AUDIO_H */
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ struct audio_pcm_info {
|
|||
int swap_endianness;
|
||||
};
|
||||
|
||||
typedef struct AudioState AudioState;
|
||||
typedef struct AudioBackend AudioBackend;
|
||||
typedef struct SWVoiceCap SWVoiceCap;
|
||||
|
||||
typedef struct STSampleBuffer {
|
||||
|
|
@ -69,7 +69,7 @@ typedef struct STSampleBuffer {
|
|||
} STSampleBuffer;
|
||||
|
||||
typedef struct HWVoiceOut {
|
||||
AudioState *s;
|
||||
AudioBackend *s;
|
||||
int enabled;
|
||||
int poll_mode;
|
||||
int pending_disable;
|
||||
|
|
@ -90,7 +90,7 @@ typedef struct HWVoiceOut {
|
|||
} HWVoiceOut;
|
||||
|
||||
typedef struct HWVoiceIn {
|
||||
AudioState *s;
|
||||
AudioBackend *s;
|
||||
int enabled;
|
||||
int poll_mode;
|
||||
struct audio_pcm_info info;
|
||||
|
|
@ -112,7 +112,7 @@ typedef struct HWVoiceIn {
|
|||
|
||||
struct SWVoiceOut {
|
||||
QEMUSoundCard *card;
|
||||
AudioState *s;
|
||||
AudioBackend *s;
|
||||
struct audio_pcm_info info;
|
||||
t_sample *conv;
|
||||
STSampleBuffer resample_buf;
|
||||
|
|
@ -129,7 +129,7 @@ struct SWVoiceOut {
|
|||
|
||||
struct SWVoiceIn {
|
||||
QEMUSoundCard *card;
|
||||
AudioState *s;
|
||||
AudioBackend *s;
|
||||
int active;
|
||||
struct audio_pcm_info info;
|
||||
void *rate;
|
||||
|
|
@ -150,7 +150,7 @@ struct audio_driver {
|
|||
void *(*init) (Audiodev *, Error **);
|
||||
void (*fini) (void *);
|
||||
#ifdef CONFIG_GIO
|
||||
void (*set_dbus_server) (AudioState *s, GDBusObjectManagerServer *manager, bool p2p);
|
||||
void (*set_dbus_server)(AudioBackend *s, GDBusObjectManagerServer *manager, bool p2p);
|
||||
#endif
|
||||
struct audio_pcm_ops *pcm_ops;
|
||||
int max_voices_out;
|
||||
|
|
@ -208,7 +208,7 @@ static inline void *advance(void *p, size_t incr)
|
|||
return (uint8_t *)p + incr;
|
||||
}
|
||||
|
||||
int wav_start_capture(AudioState *state, CaptureState *s, const char *path,
|
||||
int wav_start_capture(AudioBackend *state, CaptureState *s, const char *path,
|
||||
int freq, int bits, int nchannels);
|
||||
|
||||
void audio_generic_run_buffer_in(HWVoiceIn *hw);
|
||||
|
|
@ -240,7 +240,7 @@ struct SWVoiceCap {
|
|||
QLIST_ENTRY (SWVoiceCap) entries;
|
||||
};
|
||||
|
||||
typedef struct AudioState {
|
||||
typedef struct AudioBackend {
|
||||
Object parent;
|
||||
|
||||
struct audio_driver *drv;
|
||||
|
|
@ -260,7 +260,7 @@ typedef struct AudioState {
|
|||
bool timer_running;
|
||||
uint64_t timer_last;
|
||||
VMChangeStateEntry *vmse;
|
||||
} AudioState;
|
||||
} AudioBackend;
|
||||
|
||||
extern const struct mixeng_volume nominal_volume;
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len);
|
|||
|
||||
int audio_bug (const char *funcname, int cond);
|
||||
|
||||
void audio_run(AudioState *s, const char *msg);
|
||||
void audio_run(AudioBackend *s, const char *msg);
|
||||
|
||||
const char *audio_application_name(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#define HWBUF hw->conv_buf
|
||||
#endif
|
||||
|
||||
static void glue(audio_init_nb_voices_, TYPE)(AudioState *s,
|
||||
static void glue(audio_init_nb_voices_, TYPE)(AudioBackend *s,
|
||||
struct audio_driver *drv, int min_voices)
|
||||
{
|
||||
int max_voices = glue (drv->max_voices_, TYPE);
|
||||
|
|
@ -221,7 +221,7 @@ static void glue (audio_pcm_hw_del_sw_, TYPE) (SW *sw)
|
|||
static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp)
|
||||
{
|
||||
HW *hw = *hwp;
|
||||
AudioState *s = hw->s;
|
||||
AudioBackend *s = hw->s;
|
||||
|
||||
if (!hw->sw_head.lh_first) {
|
||||
#ifdef DAC
|
||||
|
|
@ -236,12 +236,12 @@ static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp)
|
|||
}
|
||||
}
|
||||
|
||||
static HW *glue(audio_pcm_hw_find_any_, TYPE)(AudioState *s, HW *hw)
|
||||
static HW *glue(audio_pcm_hw_find_any_, TYPE)(AudioBackend *s, HW *hw)
|
||||
{
|
||||
return hw ? hw->entries.le_next : glue (s->hw_head_, TYPE).lh_first;
|
||||
}
|
||||
|
||||
static HW *glue(audio_pcm_hw_find_any_enabled_, TYPE)(AudioState *s, HW *hw)
|
||||
static HW *glue(audio_pcm_hw_find_any_enabled_, TYPE)(AudioBackend *s, HW *hw)
|
||||
{
|
||||
while ((hw = glue(audio_pcm_hw_find_any_, TYPE)(s, hw))) {
|
||||
if (hw->enabled) {
|
||||
|
|
@ -251,7 +251,7 @@ static HW *glue(audio_pcm_hw_find_any_enabled_, TYPE)(AudioState *s, HW *hw)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static HW *glue(audio_pcm_hw_find_specific_, TYPE)(AudioState *s, HW *hw,
|
||||
static HW *glue(audio_pcm_hw_find_specific_, TYPE)(AudioBackend *s, HW *hw,
|
||||
struct audsettings *as)
|
||||
{
|
||||
while ((hw = glue(audio_pcm_hw_find_any_, TYPE)(s, hw))) {
|
||||
|
|
@ -262,7 +262,7 @@ static HW *glue(audio_pcm_hw_find_specific_, TYPE)(AudioState *s, HW *hw,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioState *s,
|
||||
static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioBackend *s,
|
||||
struct audsettings *as)
|
||||
{
|
||||
HW *hw;
|
||||
|
|
@ -398,7 +398,7 @@ AudiodevPerDirectionOptions *glue(audio_get_pdo_, TYPE)(Audiodev *dev)
|
|||
abort();
|
||||
}
|
||||
|
||||
static HW *glue(audio_pcm_hw_add_, TYPE)(AudioState *s, struct audsettings *as)
|
||||
static HW *glue(audio_pcm_hw_add_, TYPE)(AudioBackend *s, struct audsettings *as)
|
||||
{
|
||||
HW *hw;
|
||||
AudiodevPerDirectionOptions *pdo = glue(audio_get_pdo_, TYPE)(s->dev);
|
||||
|
|
@ -424,7 +424,7 @@ static HW *glue(audio_pcm_hw_add_, TYPE)(AudioState *s, struct audsettings *as)
|
|||
}
|
||||
|
||||
static SW *glue(audio_pcm_create_voice_pair_, TYPE)(
|
||||
AudioState *s,
|
||||
AudioBackend *s,
|
||||
const char *sw_name,
|
||||
struct audsettings *as
|
||||
)
|
||||
|
|
@ -494,7 +494,7 @@ SW *glue (AUD_open_, TYPE) (
|
|||
struct audsettings *as
|
||||
)
|
||||
{
|
||||
AudioState *s;
|
||||
AudioBackend *s;
|
||||
AudiodevPerDirectionOptions *pdo;
|
||||
|
||||
if (audio_bug(__func__, !card || !name || !callback_fn || !as)) {
|
||||
|
|
@ -503,7 +503,7 @@ SW *glue (AUD_open_, TYPE) (
|
|||
goto fail;
|
||||
}
|
||||
|
||||
s = card->state;
|
||||
s = card->be;
|
||||
pdo = glue(audio_get_pdo_, TYPE)(s->dev);
|
||||
|
||||
ldebug ("open %s, freq %d, nchannels %d, fmt %d\n",
|
||||
|
|
|
|||
|
|
@ -458,7 +458,7 @@ listener_in_vanished_cb(GDBusConnection *connection,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
dbus_audio_register_listener(AudioState *s,
|
||||
dbus_audio_register_listener(AudioBackend *s,
|
||||
GDBusMethodInvocation *invocation,
|
||||
#ifdef G_OS_UNIX
|
||||
GUnixFDList *fd_list,
|
||||
|
|
@ -615,7 +615,7 @@ dbus_audio_register_listener(AudioState *s,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
dbus_audio_register_out_listener(AudioState *s,
|
||||
dbus_audio_register_out_listener(AudioBackend *s,
|
||||
GDBusMethodInvocation *invocation,
|
||||
#ifdef G_OS_UNIX
|
||||
GUnixFDList *fd_list,
|
||||
|
|
@ -631,7 +631,7 @@ dbus_audio_register_out_listener(AudioState *s,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
dbus_audio_register_in_listener(AudioState *s,
|
||||
dbus_audio_register_in_listener(AudioBackend *s,
|
||||
GDBusMethodInvocation *invocation,
|
||||
#ifdef G_OS_UNIX
|
||||
GUnixFDList *fd_list,
|
||||
|
|
@ -646,7 +646,7 @@ dbus_audio_register_in_listener(AudioState *s,
|
|||
}
|
||||
|
||||
static void
|
||||
dbus_audio_set_server(AudioState *s, GDBusObjectManagerServer *server, bool p2p)
|
||||
dbus_audio_set_server(AudioBackend *s, GDBusObjectManagerServer *server, bool p2p)
|
||||
{
|
||||
DBusAudio *da = s->drv_opaque;
|
||||
|
||||
|
|
|
|||
|
|
@ -107,13 +107,13 @@ static void oss_anal_close (int *fdp)
|
|||
|
||||
static void oss_helper_poll_out (void *opaque)
|
||||
{
|
||||
AudioState *s = opaque;
|
||||
AudioBackend *s = opaque;
|
||||
audio_run(s, "oss_poll_out");
|
||||
}
|
||||
|
||||
static void oss_helper_poll_in (void *opaque)
|
||||
{
|
||||
AudioState *s = opaque;
|
||||
AudioBackend *s = opaque;
|
||||
audio_run(s, "oss_poll_in");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ static struct capture_ops wav_capture_ops = {
|
|||
.info = wav_capture_info
|
||||
};
|
||||
|
||||
int wav_start_capture(AudioState *state, CaptureState *s, const char *path,
|
||||
int wav_start_capture(AudioBackend *state, CaptureState *s, const char *path,
|
||||
int freq, int bits, int nchannels)
|
||||
{
|
||||
WAVState *wav;
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ static void pcspk_realizefn(DeviceState *dev, Error **errp)
|
|||
|
||||
isa_register_ioport(isadev, &s->ioport, s->iobase);
|
||||
|
||||
if (s->card.state && AUD_register_card(s_spk, &s->card, errp)) {
|
||||
if (s->card.be && AUD_register_card(s_spk, &s->card, errp)) {
|
||||
pcspk_audio_init(s);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -760,7 +760,7 @@ static void machine_set_audiodev(Object *obj, const char *value,
|
|||
{
|
||||
MachineState *ms = MACHINE(obj);
|
||||
|
||||
if (!audio_state_by_name(value, errp)) {
|
||||
if (!audio_be_by_name(value, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -499,16 +499,16 @@ static void set_audiodev(Object *obj, Visitor *v, const char* name,
|
|||
{
|
||||
const Property *prop = opaque;
|
||||
QEMUSoundCard *card = object_field_prop_ptr(obj, prop);
|
||||
AudioState *state;
|
||||
AudioBackend *state;
|
||||
g_autofree char *str = NULL;
|
||||
|
||||
if (!visit_type_str(v, name, &str, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
state = audio_state_by_name(str, errp);
|
||||
state = audio_be_by_name(str, errp);
|
||||
if (state) {
|
||||
card->state = state;
|
||||
card->be = state;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -220,16 +220,16 @@ dbus_display_complete(UserCreatable *uc, Error **errp)
|
|||
}
|
||||
|
||||
if (dd->audiodev && *dd->audiodev) {
|
||||
AudioState *audio_state = audio_state_by_name(dd->audiodev, errp);
|
||||
if (!audio_state) {
|
||||
AudioBackend *audio_be = audio_be_by_name(dd->audiodev, errp);
|
||||
if (!audio_be) {
|
||||
return;
|
||||
}
|
||||
if (!g_str_equal(audio_state->drv->name, "dbus")) {
|
||||
if (!g_str_equal(audio_be->drv->name, "dbus")) {
|
||||
error_setg(errp, "Audiodev '%s' is not compatible with DBus",
|
||||
dd->audiodev);
|
||||
return;
|
||||
}
|
||||
audio_state->drv->set_dbus_server(audio_state, dd->server, dd->p2p);
|
||||
audio_be->drv->set_dbus_server(audio_be, dd->server, dd->p2p);
|
||||
}
|
||||
|
||||
consoles = g_array_new(FALSE, FALSE, sizeof(guint32));
|
||||
|
|
|
|||
10
ui/vnc.c
10
ui/vnc.c
|
|
@ -1276,7 +1276,7 @@ static void audio_add(VncState *vs)
|
|||
ops.destroy = audio_capture_destroy;
|
||||
ops.capture = audio_capture;
|
||||
|
||||
vs->audio_cap = AUD_add_capture(vs->vd->audio_state, &vs->as, &ops, vs);
|
||||
vs->audio_cap = AUD_add_capture(vs->vd->audio_be, &vs->as, &ops, vs);
|
||||
if (!vs->audio_cap) {
|
||||
error_report("Failed to add audio capture");
|
||||
}
|
||||
|
|
@ -2193,7 +2193,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
|
|||
send_ext_key_event_ack(vs);
|
||||
break;
|
||||
case VNC_ENCODING_AUDIO:
|
||||
if (vs->vd->audio_state) {
|
||||
if (vs->vd->audio_be) {
|
||||
vnc_set_feature(vs, VNC_FEATURE_AUDIO);
|
||||
send_ext_audio_ack(vs);
|
||||
}
|
||||
|
|
@ -4236,12 +4236,12 @@ void vnc_display_open(const char *id, Error **errp)
|
|||
|
||||
audiodev = qemu_opt_get(opts, "audiodev");
|
||||
if (audiodev) {
|
||||
vd->audio_state = audio_state_by_name(audiodev, errp);
|
||||
if (!vd->audio_state) {
|
||||
vd->audio_be = audio_be_by_name(audiodev, errp);
|
||||
if (!vd->audio_be) {
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
vd->audio_state = audio_get_default_audio_state(NULL);
|
||||
vd->audio_be = audio_get_default_audio_be(NULL);
|
||||
}
|
||||
|
||||
device_id = qemu_opt_get(opts, "display");
|
||||
|
|
|
|||
2
ui/vnc.h
2
ui/vnc.h
|
|
@ -184,7 +184,7 @@ struct VncDisplay
|
|||
VncDisplaySASL sasl;
|
||||
#endif
|
||||
|
||||
AudioState *audio_state;
|
||||
AudioBackend *audio_be;
|
||||
|
||||
VMChangeStateEntry *vmstate_handler_entry;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue