diff options
author | David 'Digit' Turner <digit@android.com> | 2010-05-10 18:37:10 -0700 |
---|---|---|
committer | David 'Digit' Turner <digit@android.com> | 2010-05-10 23:26:57 -0700 |
commit | a5d412078b8e7478d81df03710eacc7a21096ba2 (patch) | |
tree | 7b6fb338233657c9885bd94f08dee3aa2973c98f /audio | |
parent | 20894ae3fa98f82da925fbeb72e616eef509758a (diff) | |
download | external_qemu-a5d412078b8e7478d81df03710eacc7a21096ba2.zip external_qemu-a5d412078b8e7478d81df03710eacc7a21096ba2.tar.gz external_qemu-a5d412078b8e7478d81df03710eacc7a21096ba2.tar.bz2 |
Upstream: Replace sys-queue.h with qemu-queue.h
Change-Id: I5c51f54a7fe2ea702420429bbf0c789ed6d8c534
Diffstat (limited to 'audio')
-rw-r--r-- | audio/audio.c | 38 | ||||
-rw-r--r-- | audio/audio.h | 18 | ||||
-rw-r--r-- | audio/audio_int.h | 32 | ||||
-rw-r--r-- | audio/audio_pt_int.c | 1 | ||||
-rw-r--r-- | audio/audio_template.h | 48 |
5 files changed, 66 insertions, 71 deletions
diff --git a/audio/audio.c b/audio/audio.c index cd4f0da..2d77f14 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -876,8 +876,8 @@ static void audio_detach_capture (HWVoiceOut *hw) sw->rate = NULL; } - LIST_REMOVE (sw, entries); - LIST_REMOVE (sc, entries); + QLIST_REMOVE (sw, entries); + QLIST_REMOVE (sc, entries); qemu_free (sc); if (was_active) { /* We have removed soft voice from the capture: @@ -921,8 +921,8 @@ static int audio_attach_capture (HWVoiceOut *hw) qemu_free (sw); return -1; } - LIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries); - LIST_INSERT_HEAD (&hw->cap_head, sc, entries); + QLIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries); + QLIST_INSERT_HEAD (&hw->cap_head, sc, entries); #ifdef DEBUG_CAPTURE asprintf (&sw->name, "for %p %d,%d,%d", hw, sw->info.freq, sw->info.bits, sw->info.nchannels); @@ -1946,9 +1946,9 @@ static void audio_init (void) return; } - LIST_INIT (&s->hw_head_out); - LIST_INIT (&s->hw_head_in); - LIST_INIT (&s->cap_head); + QLIST_INIT (&s->hw_head_out); + QLIST_INIT (&s->hw_head_in); + QLIST_INIT (&s->cap_head); atexit (audio_atexit); s->ts = qemu_new_timer (vm_clock, audio_timer, s); @@ -2001,7 +2001,7 @@ static void audio_init (void) initialized = 1; - LIST_INIT (&s->card_head); + QLIST_INIT (&s->card_head); register_savevm ("audio", 0, 1, audio_save, audio_load, s); qemu_mod_timer (s->ts, qemu_get_clock (vm_clock) + conf.period.ticks); } @@ -2011,12 +2011,12 @@ void AUD_register_card (const char *name, QEMUSoundCard *card) audio_init (); card->name = qemu_strdup (name); memset (&card->entries, 0, sizeof (card->entries)); - LIST_INSERT_HEAD (&glob_audio_state.card_head, card, entries); + QLIST_INSERT_HEAD (&glob_audio_state.card_head, card, entries); } void AUD_remove_card (QEMUSoundCard *card) { - LIST_REMOVE (card, entries); + QLIST_REMOVE (card, entries); qemu_free (card->name); } @@ -2053,7 +2053,7 @@ CaptureVoiceOut *AUD_add_capture ( cap = audio_pcm_capture_find_specific (as); if (cap) { - LIST_INSERT_HEAD (&cap->cb_head, cb, entries); + QLIST_INSERT_HEAD (&cap->cb_head, cb, entries); return cap; } else { @@ -2068,8 +2068,8 @@ CaptureVoiceOut *AUD_add_capture ( } hw = &cap->hw; - LIST_INIT (&hw->sw_head); - LIST_INIT (&cap->cb_head); + QLIST_INIT (&hw->sw_head); + QLIST_INIT (&cap->cb_head); /* XXX find a more elegant way */ hw->samples = 4096 * 4; @@ -2097,8 +2097,8 @@ CaptureVoiceOut *AUD_add_capture ( [hw->info.swap_endianness] [audio_bits_to_index (hw->info.bits)]; - LIST_INSERT_HEAD (&s->cap_head, cap, entries); - LIST_INSERT_HEAD (&cap->cb_head, cb, entries); + QLIST_INSERT_HEAD (&s->cap_head, cap, entries); + QLIST_INSERT_HEAD (&cap->cb_head, cb, entries); hw = NULL; while ((hw = audio_pcm_hw_find_any_out (hw))) { @@ -2124,7 +2124,7 @@ void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque) for (cb = cap->cb_head.lh_first; cb; cb = cb->entries.le_next) { if (cb->opaque == cb_opaque) { cb->ops.destroy (cb_opaque); - LIST_REMOVE (cb, entries); + QLIST_REMOVE (cb, entries); qemu_free (cb); if (!cap->cb_head.lh_first) { @@ -2141,12 +2141,12 @@ void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque) st_rate_stop (sw->rate); sw->rate = NULL; } - LIST_REMOVE (sw, entries); - LIST_REMOVE (sc, entries); + QLIST_REMOVE (sw, entries); + QLIST_REMOVE (sc, entries); qemu_free (sc); sw = sw1; } - LIST_REMOVE (cap, entries); + QLIST_REMOVE (cap, entries); qemu_free (cap); } return; diff --git a/audio/audio.h b/audio/audio.h index ee923e4..13fc7cc 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -24,11 +24,10 @@ #ifndef QEMU_AUDIO_H #define QEMU_AUDIO_H -#include "config.h" -#include "qemu-common.h" -#include "sys-queue.h" +#include "config-host.h" +#include "qemu-queue.h" -typedef void (*audio_callback_fn_t) (void *opaque, int avail); +typedef void (*audio_callback_fn) (void *opaque, int avail); typedef enum { AUD_FMT_U8, @@ -71,7 +70,7 @@ struct capture_ops { typedef struct CaptureState { void *opaque; struct capture_ops ops; - LIST_ENTRY (CaptureState) entries; + QLIST_ENTRY (CaptureState) entries; } CaptureState; typedef struct SWVoiceOut SWVoiceOut; @@ -80,7 +79,7 @@ typedef struct SWVoiceIn SWVoiceIn; typedef struct QEMUSoundCard { char *name; - LIST_ENTRY (QEMUSoundCard) entries; + QLIST_ENTRY (QEMUSoundCard) entries; } QEMUSoundCard; typedef struct QEMUAudioTimeStamp { @@ -109,7 +108,7 @@ SWVoiceOut *AUD_open_out ( SWVoiceOut *sw, const char *name, void *callback_opaque, - audio_callback_fn_t callback_fn, + audio_callback_fn callback_fn, struct audsettings *settings ); @@ -130,7 +129,7 @@ SWVoiceIn *AUD_open_in ( SWVoiceIn *sw, const char *name, void *callback_opaque, - audio_callback_fn_t callback_fn, + audio_callback_fn callback_fn, struct audsettings *settings ); @@ -148,9 +147,6 @@ static inline void *advance (void *p, int incr) return (d + incr); } -uint32_t popcount (uint32_t u); -uint32_t lsbindex (uint32_t u); - #ifdef __GNUC__ #define audio_MIN(a, b) ( __extension__ ({ \ __typeof (a) ta = a; \ diff --git a/audio/audio_int.h b/audio/audio_int.h index 0ae03fd..a78f394 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -52,7 +52,7 @@ struct audio_option { struct audio_callback { void *opaque; - audio_callback_fn_t fn; + audio_callback_fn fn; }; struct audio_pcm_info { @@ -81,10 +81,10 @@ typedef struct HWVoiceOut { struct st_sample *mix_buf; int samples; - LIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head; - LIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head; + QLIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head; + QLIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head; struct audio_pcm_ops *pcm_ops; - LIST_ENTRY (HWVoiceOut) entries; + QLIST_ENTRY (HWVoiceOut) entries; } HWVoiceOut; typedef struct HWVoiceIn { @@ -100,9 +100,9 @@ typedef struct HWVoiceIn { struct st_sample *conv_buf; int samples; - LIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head; + QLIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head; struct audio_pcm_ops *pcm_ops; - LIST_ENTRY (HWVoiceIn) entries; + QLIST_ENTRY (HWVoiceIn) entries; } HWVoiceIn; struct SWVoiceOut { @@ -119,7 +119,7 @@ struct SWVoiceOut { char *name; struct mixeng_volume vol; struct audio_callback callback; - LIST_ENTRY (SWVoiceOut) entries; + QLIST_ENTRY (SWVoiceOut) entries; }; struct SWVoiceIn { @@ -135,7 +135,7 @@ struct SWVoiceIn { char *name; struct mixeng_volume vol; struct audio_callback callback; - LIST_ENTRY (SWVoiceIn) entries; + QLIST_ENTRY (SWVoiceIn) entries; }; struct audio_driver { @@ -169,20 +169,20 @@ struct audio_pcm_ops { struct capture_callback { struct audio_capture_ops ops; void *opaque; - LIST_ENTRY (capture_callback) entries; + QLIST_ENTRY (capture_callback) entries; }; struct CaptureVoiceOut { HWVoiceOut hw; void *buf; - LIST_HEAD (cb_listhead, capture_callback) cb_head; - LIST_ENTRY (CaptureVoiceOut) entries; + QLIST_HEAD (cb_listhead, capture_callback) cb_head; + QLIST_ENTRY (CaptureVoiceOut) entries; }; struct SWVoiceCap { SWVoiceOut sw; CaptureVoiceOut *cap; - LIST_ENTRY (SWVoiceCap) entries; + QLIST_ENTRY (SWVoiceCap) entries; }; struct AudioState { @@ -192,10 +192,10 @@ struct AudioState { void* drv_out_opaque; QEMUTimer *ts; - LIST_HEAD (card_listhead, QEMUSoundCard) card_head; - LIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in; - LIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out; - LIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head; + QLIST_HEAD (card_listhead, QEMUSoundCard) card_head; + QLIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in; + QLIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out; + QLIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head; int nb_hw_voices_out; int nb_hw_voices_in; int vm_running; diff --git a/audio/audio_pt_int.c b/audio/audio_pt_int.c index c753774..e889a98 100644 --- a/audio/audio_pt_int.c +++ b/audio/audio_pt_int.c @@ -1,3 +1,4 @@ +#include "qemu-common.h" #include "audio.h" #define AUDIO_CAP "audio-pt" diff --git a/audio/audio_template.h b/audio/audio_template.h index d6c1037..9f75f19 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -184,12 +184,12 @@ static void glue (audio_pcm_sw_fini_, TYPE) (SW *sw) static void glue (audio_pcm_hw_add_sw_, TYPE) (HW *hw, SW *sw) { - LIST_INSERT_HEAD (&hw->sw_head, sw, entries); + QLIST_INSERT_HEAD (&hw->sw_head, sw, entries); } static void glue (audio_pcm_hw_del_sw_, TYPE) (SW *sw) { - LIST_REMOVE (sw, entries); + QLIST_REMOVE (sw, entries); } static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp) @@ -201,7 +201,7 @@ static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp) #ifdef DAC audio_detach_capture (hw); #endif - LIST_REMOVE (hw, entries); + QLIST_REMOVE (hw, entries); glue (s->nb_hw_voices_, TYPE) += 1; glue (audio_pcm_hw_free_resources_ ,TYPE) (hw); BEGIN_NOSIGALRM @@ -270,9 +270,9 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as) } hw->pcm_ops = drv->pcm_ops; - LIST_INIT (&hw->sw_head); + QLIST_INIT (&hw->sw_head); #ifdef DAC - LIST_INIT (&hw->cap_head); + QLIST_INIT (&hw->cap_head); #endif BEGIN_NOSIGALRM err = glue (hw->pcm_ops->init_, TYPE) (hw, as); @@ -299,7 +299,7 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as) goto err1; } - LIST_INSERT_HEAD (&s->glue (hw_head_, TYPE), hw, entries); + QLIST_INSERT_HEAD (&s->glue (hw_head_, TYPE), hw, entries); glue (s->nb_hw_voices_, TYPE) -= 1; #ifdef DAC audio_attach_capture (hw); @@ -409,7 +409,7 @@ SW *glue (AUD_open_, TYPE) ( SW *sw, const char *name, void *callback_opaque , - audio_callback_fn_t callback_fn, + audio_callback_fn callback_fn, struct audsettings *as ) { @@ -492,32 +492,30 @@ SW *glue (AUD_open_, TYPE) ( } } - if (sw) { - sw->card = card; - sw->vol = nominal_volume; - sw->callback.fn = callback_fn; - sw->callback.opaque = callback_opaque; + sw->card = card; + sw->vol = nominal_volume; + sw->callback.fn = callback_fn; + sw->callback.opaque = callback_opaque; #ifdef DAC - if (live) { - int mixed = - (live << old_sw->info.shift) - * old_sw->info.bytes_per_second - / sw->info.bytes_per_second; + if (live) { + int mixed = + (live << old_sw->info.shift) + * old_sw->info.bytes_per_second + / sw->info.bytes_per_second; #ifdef DEBUG_PLIVE - dolog ("Silence will be mixed %d\n", mixed); + dolog ("Silence will be mixed %d\n", mixed); #endif - sw->total_hw_samples_mixed += mixed; - } + sw->total_hw_samples_mixed += mixed; + } #endif #ifdef DEBUG_AUDIO - dolog ("%s\n", name); - audio_pcm_print_info ("hw", &sw->hw->info); - audio_pcm_print_info ("sw", &sw->info); + dolog ("%s\n", name); + audio_pcm_print_info ("hw", &sw->hw->info); + audio_pcm_print_info ("sw", &sw->info); #endif - } return sw; @@ -563,7 +561,7 @@ uint64_t glue (AUD_get_elapsed_usec_, TYPE) (SW *sw, QEMUAudioTimeStamp *ts) return 0; } - return (delta * sw->hw->info.freq) / 1000000; + return muldiv64 (delta, sw->hw->info.freq, 1000000); } #undef TYPE |