From 3d6b20f58304faafcb7e3804ac29d1d81379e79e Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 18 May 2005 14:47:49 +0000 Subject: [PATCH] Make SBC parameters configurable --- alsa/sbc.c | 17 +++++++++++++---- alsa/sbc.h | 3 +++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/alsa/sbc.c b/alsa/sbc.c index 3cebee1ff..3eda2910a 100644 --- a/alsa/sbc.c +++ b/alsa/sbc.c @@ -1225,6 +1225,12 @@ int sbc_init(sbc_t *sbc, unsigned long flags) memset(sbc->priv, 0, sizeof(struct sbc_priv)); + sbc->rate = 44100; + sbc->channels = 2; + sbc->subbands = 8; + sbc->blocks = 16; + sbc->bitpool = 32; + return 0; } @@ -1245,8 +1251,11 @@ int sbc_decode(sbc_t *sbc, void *data, int count) sbc_decoder_init(&priv->dec_state, &priv->frame); priv->init = 1; - sbc->rate = priv->frame.sampling_frequency * 1000; + sbc->rate = priv->frame.sampling_frequency * 1000; sbc->channels = priv->frame.channels; + sbc->subbands = priv->frame.subbands; + sbc->blocks = priv->frame.blocks; + sbc->bitpool = priv->frame.bitpool; } samples = sbc_synthesize_audio(&priv->dec_state, &priv->frame); @@ -1304,9 +1313,9 @@ int sbc_encode(sbc_t *sbc, void *data, int count) priv->frame.channel_mode = MONO; priv->frame.allocation_method = SNR; - priv->frame.subbands = 8; - priv->frame.blocks = 16; - priv->frame.bitpool = 32; + priv->frame.subbands = sbc->subbands; + priv->frame.blocks = sbc->blocks; + priv->frame.bitpool = sbc->bitpool; sbc_encoder_init(&priv->enc_state, &priv->frame); priv->init = 1; diff --git a/alsa/sbc.h b/alsa/sbc.h index 568b1d7ec..f0c6c09d2 100644 --- a/alsa/sbc.h +++ b/alsa/sbc.h @@ -36,6 +36,9 @@ struct sbc_struct { int rate; int channels; + int blocks; + int subbands; + int bitpool; void *data; int size;