summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-05-18 14:47:49 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-05-18 14:47:49 +0000
commit3d6b20f58304faafcb7e3804ac29d1d81379e79e (patch)
tree5eba5f7fccd648cd0f94837b82b77f2a68c34de1
parent51efc88dd3dcd082c9a95bdfa499641f927cbf07 (diff)
Make SBC parameters configurable
-rw-r--r--alsa/sbc.c17
-rw-r--r--alsa/sbc.h3
2 files changed, 16 insertions, 4 deletions
diff --git a/alsa/sbc.c b/alsa/sbc.c
index 3cebee1f..3eda2910 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 568b1d7e..f0c6c09d 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;