From c16a9ffd5ee7ad3a184bc3c5ddac2d0049d7243d Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 9 May 2005 10:21:09 +0000 Subject: Add support for the duration calculation --- alsa/sbc.c | 4 ++++ alsa/sbc.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/alsa/sbc.c b/alsa/sbc.c index bd767768..3cebee1f 100644 --- a/alsa/sbc.c +++ b/alsa/sbc.c @@ -1278,6 +1278,8 @@ int sbc_decode(sbc_t *sbc, void *data, int count) sbc->len = samples * priv->frame.channels * 2; + sbc->duration = (1000000 * priv->frame.subbands * priv->frame.blocks) / sbc->rate; + return framelen; } @@ -1337,6 +1339,8 @@ int sbc_encode(sbc_t *sbc, void *data, int count) sbc->len = framelen; + sbc->duration = (1000000 * priv->frame.subbands * priv->frame.blocks) / sbc->rate; + return samples * sbc->channels * 2; } diff --git a/alsa/sbc.h b/alsa/sbc.h index 02353160..568b1d7e 100644 --- a/alsa/sbc.h +++ b/alsa/sbc.h @@ -41,6 +41,8 @@ struct sbc_struct { int size; int len; + unsigned long duration; + void *priv; }; -- cgit