summaryrefslogtreecommitdiff
path: root/modules/opensles/player.c
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2014-02-13 16:25:11 +0100
committerAlfred E. Heggestad <aeh@db.org>2014-02-13 16:25:11 +0100
commit2f701685d7230b39ce2e0f8ad230ee84bc156595 (patch)
treed5255baa4cd0975ce263080c77c90c76c1cda1aa /modules/opensles/player.c
parent00133c99c214dfe2159c4b9347a782dd3eda8046 (diff)
update audio-driver modules with new ausrc/play API
Diffstat (limited to 'modules/opensles/player.c')
-rw-r--r--modules/opensles/player.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/modules/opensles/player.c b/modules/opensles/player.c
index a317e5d..b9c9b68 100644
--- a/modules/opensles/player.c
+++ b/modules/opensles/player.c
@@ -17,7 +17,8 @@
struct auplay_st {
struct auplay *ap; /* inheritance */
- int16_t buf[160 * 2];
+ int16_t *sampv;
+ size_t sampc;
auplay_write_h *wh;
void *arg;
@@ -38,6 +39,7 @@ static void auplay_destructor(void *arg)
if (st->outputMixObject != NULL)
(*st->outputMixObject)->Destroy(st->outputMixObject);
+ mem_deref(st->sampv);
mem_deref(st->ap);
}
@@ -46,9 +48,9 @@ static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context)
{
struct auplay_st *st = context;
- st->wh((void *)st->buf, sizeof(st->buf), st->arg);
+ st->wh(st->sampv, st->sampc, st->arg);
- (*st->BufferQueue)->Enqueue(bq, st->buf, sizeof(st->buf));
+ (*st->BufferQueue)->Enqueue(bq, st->sampv, st->sampc * 2);
}
@@ -151,6 +153,14 @@ int opensles_player_alloc(struct auplay_st **stp, struct auplay *ap,
st->wh = wh;
st->arg = arg;
+ st->sampc = prm->srate * prm->ch * prm->ptime / 1000;
+
+ st->sampv = mem_alloc(2 * st->sampc, NULL);
+ if (!st->sampv) {
+ err = ENOMEM;
+ goto out;
+ }
+
err = createOutput(st);
if (err)
goto out;