diff options
author | Alfred E. Heggestad <aeh@db.org> | 2014-02-13 16:25:11 +0100 |
---|---|---|
committer | Alfred E. Heggestad <aeh@db.org> | 2014-02-13 16:25:11 +0100 |
commit | 2f701685d7230b39ce2e0f8ad230ee84bc156595 (patch) | |
tree | d5255baa4cd0975ce263080c77c90c76c1cda1aa /modules/alsa/alsa_src.c | |
parent | 00133c99c214dfe2159c4b9347a782dd3eda8046 (diff) |
update audio-driver modules with new ausrc/play API
Diffstat (limited to 'modules/alsa/alsa_src.c')
-rw-r--r-- | modules/alsa/alsa_src.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/alsa/alsa_src.c b/modules/alsa/alsa_src.c index 4e2a16a..f95765c 100644 --- a/modules/alsa/alsa_src.c +++ b/modules/alsa/alsa_src.c @@ -21,7 +21,8 @@ struct ausrc_st { pthread_t thread; bool run; snd_pcm_t *read; - struct mbuf *mbr; + int16_t *sampv; + size_t sampc; ausrc_read_h *rh; void *arg; struct ausrc_prm prm; @@ -42,7 +43,7 @@ static void ausrc_destructor(void *arg) if (st->read) snd_pcm_close(st->read); - mem_deref(st->mbr); + mem_deref(st->sampv); mem_deref(st->as); mem_deref(st->device); } @@ -65,7 +66,7 @@ static void *read_thread(void *arg) } while (st->run) { - err = snd_pcm_readi(st->read, st->mbr->buf, num_frames); + err = snd_pcm_readi(st->read, st->sampv, num_frames); if (err == -EPIPE) { snd_pcm_prepare(st->read); continue; @@ -74,7 +75,7 @@ static void *read_thread(void *arg) continue; } - st->rh(st->mbr->buf, err * 2 * st->prm.ch, st->arg); + st->rh(st->sampv, err * st->prm.ch, st->arg); } out: @@ -88,7 +89,6 @@ int alsa_src_alloc(struct ausrc_st **stp, struct ausrc *as, ausrc_read_h *rh, ausrc_error_h *errh, void *arg) { struct ausrc_st *st; - uint32_t sampc; int num_frames; int err; (void)ctx; @@ -113,11 +113,11 @@ int alsa_src_alloc(struct ausrc_st **stp, struct ausrc *as, st->rh = rh; st->arg = arg; - sampc = prm->srate * prm->ch * prm->ptime / 1000; + st->sampc = prm->srate * prm->ch * prm->ptime / 1000; num_frames = st->prm.srate * st->prm.ptime / 1000; - st->mbr = mbuf_alloc(2 * sampc); - if (!st->mbr) { + st->sampv = mem_alloc(2 * st->sampc, NULL); + if (!st->sampv) { err = ENOMEM; goto out; } |