mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-14 08:56:37 -05:00
a2dp-codecs: add settings to codec init function
To make it possible to add extra config options in init. Also add a method to update settings in a codec.
This commit is contained in:
parent
deb3fa1d9b
commit
5bb7a0f573
7 changed files with 18 additions and 12 deletions
|
|
@ -103,7 +103,7 @@ static struct {
|
||||||
|
|
||||||
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct spa_dict *info, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
const struct spa_dict *settings, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
a2dp_aac_t conf;
|
a2dp_aac_t conf;
|
||||||
int freq;
|
int freq;
|
||||||
|
|
@ -219,7 +219,8 @@ static int codec_enum_config(const struct a2dp_codec *codec,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
void *config, size_t config_len, const struct spa_audio_info *info, size_t mtu)
|
void *config, size_t config_len, const struct spa_audio_info *info,
|
||||||
|
const struct spa_dict *settings, size_t mtu)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
a2dp_aac_t *conf = config;
|
a2dp_aac_t *conf = config;
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
|
|
||||||
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct spa_dict *info, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
const struct spa_dict *settings, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
a2dp_aptx_t conf;
|
a2dp_aptx_t conf;
|
||||||
size_t actual_conf_size = codec_get_caps_size(codec);
|
size_t actual_conf_size = codec_get_caps_size(codec);
|
||||||
|
|
@ -218,7 +218,8 @@ static int codec_get_block_size(void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
void *config, size_t config_len, const struct spa_audio_info *info, size_t mtu)
|
void *config, size_t config_len, const struct spa_audio_info *info,
|
||||||
|
const struct spa_dict *settings, size_t mtu)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
int res;
|
int res;
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags, uint8
|
||||||
|
|
||||||
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct spa_dict *info, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
const struct spa_dict *settings, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
a2dp_ldac_t conf;
|
a2dp_ldac_t conf;
|
||||||
|
|
||||||
|
|
@ -308,7 +308,8 @@ static int codec_get_block_size(void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
void *config, size_t config_len, const struct spa_audio_info *info, size_t mtu)
|
void *config, size_t config_len, const struct spa_audio_info *info,
|
||||||
|
const struct spa_dict *settings, size_t mtu)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
a2dp_ldac_t *conf = config;
|
a2dp_ldac_t *conf = config;
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ static uint8_t default_bitpool(uint8_t freq, uint8_t mode)
|
||||||
|
|
||||||
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct spa_dict *info, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
const struct spa_dict *settings, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
a2dp_sbc_t conf;
|
a2dp_sbc_t conf;
|
||||||
int bitpool;
|
int bitpool;
|
||||||
|
|
@ -303,7 +303,8 @@ static int codec_get_block_size(void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
void *config, size_t config_len, const struct spa_audio_info *info, size_t mtu)
|
void *config, size_t config_len, const struct spa_audio_info *info,
|
||||||
|
const struct spa_dict *settings, size_t mtu)
|
||||||
{
|
{
|
||||||
struct impl *this;
|
struct impl *this;
|
||||||
a2dp_sbc_t *conf = config;
|
a2dp_sbc_t *conf = config;
|
||||||
|
|
|
||||||
|
|
@ -339,7 +339,7 @@ struct a2dp_codec {
|
||||||
uint8_t caps[A2DP_MAX_CAPS_SIZE]);
|
uint8_t caps[A2DP_MAX_CAPS_SIZE]);
|
||||||
int (*select_config) (const struct a2dp_codec *codec, uint32_t flags,
|
int (*select_config) (const struct a2dp_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct spa_dict *info, uint8_t config[A2DP_MAX_CAPS_SIZE]);
|
const struct spa_dict *settings, uint8_t config[A2DP_MAX_CAPS_SIZE]);
|
||||||
int (*enum_config) (const struct a2dp_codec *codec,
|
int (*enum_config) (const struct a2dp_codec *codec,
|
||||||
const void *caps, size_t caps_size, uint32_t id, uint32_t idx,
|
const void *caps, size_t caps_size, uint32_t id, uint32_t idx,
|
||||||
struct spa_pod_builder *builder, struct spa_pod **param);
|
struct spa_pod_builder *builder, struct spa_pod **param);
|
||||||
|
|
@ -348,9 +348,11 @@ struct a2dp_codec {
|
||||||
struct spa_audio_info *info);
|
struct spa_audio_info *info);
|
||||||
|
|
||||||
void *(*init) (const struct a2dp_codec *codec, uint32_t flags, void *config, size_t config_size,
|
void *(*init) (const struct a2dp_codec *codec, uint32_t flags, void *config, size_t config_size,
|
||||||
const struct spa_audio_info *info, size_t mtu);
|
const struct spa_audio_info *info, const struct spa_dict *settings, size_t mtu);
|
||||||
void (*deinit) (void *data);
|
void (*deinit) (void *data);
|
||||||
|
|
||||||
|
int (*update_settings) (void *data, const struct spa_dict *settings);
|
||||||
|
|
||||||
int (*get_block_size) (void *data);
|
int (*get_block_size) (void *data);
|
||||||
int (*get_num_blocks) (void *data);
|
int (*get_num_blocks) (void *data);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -666,7 +666,7 @@ static int do_start(struct impl *this)
|
||||||
this->codec_data = this->codec->init(this->codec, 0,
|
this->codec_data = this->codec->init(this->codec, 0,
|
||||||
this->transport->configuration,
|
this->transport->configuration,
|
||||||
this->transport->configuration_len,
|
this->transport->configuration_len,
|
||||||
&port->current_format,
|
&port->current_format, NULL,
|
||||||
this->transport->write_mtu);
|
this->transport->write_mtu);
|
||||||
if (this->codec_data == NULL)
|
if (this->codec_data == NULL)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
|
||||||
|
|
@ -505,7 +505,7 @@ static int transport_start(struct impl *this)
|
||||||
this->codec_data = this->codec->init(this->codec, 0,
|
this->codec_data = this->codec->init(this->codec, 0,
|
||||||
this->transport->configuration,
|
this->transport->configuration,
|
||||||
this->transport->configuration_len,
|
this->transport->configuration_len,
|
||||||
&port->current_format,
|
&port->current_format, NULL,
|
||||||
this->transport->read_mtu);
|
this->transport->read_mtu);
|
||||||
if (this->codec_data == NULL)
|
if (this->codec_data == NULL)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue