mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-17 01:04:40 +08:00
Make SBC parameters configurable
This commit is contained in:
parent
51efc88dd3
commit
3d6b20f583
17
alsa/sbc.c
17
alsa/sbc.c
@ -1225,6 +1225,12 @@ int sbc_init(sbc_t *sbc, unsigned long flags)
|
|||||||
|
|
||||||
memset(sbc->priv, 0, sizeof(struct sbc_priv));
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1245,8 +1251,11 @@ int sbc_decode(sbc_t *sbc, void *data, int count)
|
|||||||
sbc_decoder_init(&priv->dec_state, &priv->frame);
|
sbc_decoder_init(&priv->dec_state, &priv->frame);
|
||||||
priv->init = 1;
|
priv->init = 1;
|
||||||
|
|
||||||
sbc->rate = priv->frame.sampling_frequency * 1000;
|
sbc->rate = priv->frame.sampling_frequency * 1000;
|
||||||
sbc->channels = priv->frame.channels;
|
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);
|
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.channel_mode = MONO;
|
||||||
|
|
||||||
priv->frame.allocation_method = SNR;
|
priv->frame.allocation_method = SNR;
|
||||||
priv->frame.subbands = 8;
|
priv->frame.subbands = sbc->subbands;
|
||||||
priv->frame.blocks = 16;
|
priv->frame.blocks = sbc->blocks;
|
||||||
priv->frame.bitpool = 32;
|
priv->frame.bitpool = sbc->bitpool;
|
||||||
|
|
||||||
sbc_encoder_init(&priv->enc_state, &priv->frame);
|
sbc_encoder_init(&priv->enc_state, &priv->frame);
|
||||||
priv->init = 1;
|
priv->init = 1;
|
||||||
|
@ -36,6 +36,9 @@ struct sbc_struct {
|
|||||||
|
|
||||||
int rate;
|
int rate;
|
||||||
int channels;
|
int channels;
|
||||||
|
int blocks;
|
||||||
|
int subbands;
|
||||||
|
int bitpool;
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
int size;
|
int size;
|
||||||
|
Loading…
Reference in New Issue
Block a user