audio: remove remains of the old backend api

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Message-id: 497decab6d0f0fb9529bea63ec7ce0bd7b553038.1568927990.git.DirtY.iCE.hu@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Kővágó, Zoltán 2019-09-19 23:24:19 +02:00 committed by Gerd Hoffmann
parent ef3612e11b
commit 3f5bbfc25a
2 changed files with 6 additions and 43 deletions

View File

@ -541,7 +541,7 @@ static size_t audio_pcm_hw_find_min_in (HWVoiceIn *hw)
return m;
}
size_t audio_pcm_hw_get_live_in(HWVoiceIn *hw)
static size_t audio_pcm_hw_get_live_in(HWVoiceIn *hw)
{
size_t live = hw->total_samples_captured - audio_pcm_hw_find_min_in (hw);
if (audio_bug(__func__, live > hw->samples)) {
@ -551,29 +551,7 @@ size_t audio_pcm_hw_get_live_in(HWVoiceIn *hw)
return live;
}
size_t audio_pcm_hw_clip_out(HWVoiceOut *hw, void *pcm_buf,
size_t live, size_t pending)
{
size_t left = hw->samples - pending;
size_t len = MIN (left, live);
size_t clipped = 0;
while (len) {
struct st_sample *src = hw->mix_buf + hw->rpos;
uint8_t *dst = advance (pcm_buf, hw->rpos << hw->info.shift);
size_t samples_till_end_of_buf = hw->samples - hw->rpos;
size_t samples_to_clip = MIN (len, samples_till_end_of_buf);
hw->clip (dst, src, samples_to_clip);
hw->rpos = (hw->rpos + samples_to_clip) % hw->samples;
len -= samples_to_clip;
clipped += samples_to_clip;
}
return clipped;
}
static void audio_pcm_hw_clip_out2(HWVoiceOut *hw, void *pcm_buf, size_t len)
static void audio_pcm_hw_clip_out(HWVoiceOut *hw, void *pcm_buf, size_t len)
{
size_t clipped = 0;
size_t pos = hw->rpos;
@ -1083,7 +1061,7 @@ static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, size_t live)
}
decr = MIN(size >> hw->info.shift, live);
audio_pcm_hw_clip_out2(hw, buf, decr);
audio_pcm_hw_clip_out(hw, buf, decr);
proc = hw->pcm_ops->put_buffer_out(hw, buf, decr << hw->info.shift) >>
hw->info.shift;
@ -1146,11 +1124,7 @@ static void audio_run_out (AudioState *s)
}
prev_rpos = hw->rpos;
if (hw->pcm_ops->run_out) {
played = hw->pcm_ops->run_out(hw, live);
} else {
played = audio_pcm_hw_run_out(hw, live);
}
replay_audio_out(&played);
if (audio_bug(__func__, hw->rpos >= hw->samples)) {
dolog("hw->rpos=%zu hw->samples=%zu played=%zu\n",
@ -1247,13 +1221,9 @@ static void audio_run_in (AudioState *s)
size_t captured = 0, min;
if (replay_mode != REPLAY_MODE_PLAY) {
if (hw->pcm_ops->run_in) {
captured = hw->pcm_ops->run_in(hw);
} else {
captured = audio_pcm_hw_run_in(
hw, hw->samples - audio_pcm_hw_get_live_in(hw));
}
}
replay_audio_in(&captured, hw->conv_buf, &hw->wpos, hw->samples);
min = audio_pcm_hw_find_min_in (hw);

View File

@ -153,7 +153,6 @@ struct audio_driver {
struct audio_pcm_ops {
int (*init_out)(HWVoiceOut *hw, audsettings *as, void *drv_opaque);
void (*fini_out)(HWVoiceOut *hw);
size_t (*run_out)(HWVoiceOut *hw, size_t live);
size_t (*write) (HWVoiceOut *hw, void *buf, size_t size);
/*
* get a buffer that after later can be passed to put_buffer_out; optional
@ -171,7 +170,6 @@ struct audio_pcm_ops {
int (*init_in) (HWVoiceIn *hw, audsettings *as, void *drv_opaque);
void (*fini_in) (HWVoiceIn *hw);
size_t (*run_in)(HWVoiceIn *hw);
size_t (*read) (HWVoiceIn *hw, void *buf, size_t size);
void *(*get_buffer_in)(HWVoiceIn *hw, size_t *size);
void (*put_buffer_in)(HWVoiceIn *hw, void *buf, size_t size);
@ -237,11 +235,6 @@ audio_driver *audio_driver_lookup(const char *name);
void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as);
void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len);
size_t audio_pcm_hw_get_live_in(HWVoiceIn *hw);
size_t audio_pcm_hw_clip_out(HWVoiceOut *hw, void *pcm_buf,
size_t live, size_t pending);
int audio_bug (const char *funcname, int cond);
void *audio_calloc (const char *funcname, int nmemb, size_t size);