mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
bluez5: Rename codec API from *a2dp* to *media*
The BlueZ Media1 interface will not only be used for A2DP but also for LE Audio and code related can be shared.
This commit is contained in:
parent
64a3edf89e
commit
00d51c3d31
20 changed files with 485 additions and 485 deletions
|
|
@ -114,13 +114,13 @@ extern "C" {
|
||||||
/** keys for bluez5 factory names */
|
/** keys for bluez5 factory names */
|
||||||
#define SPA_NAME_API_BLUEZ5_ENUM_DBUS "api.bluez5.enum.dbus" /**< a dbus Device interface */
|
#define SPA_NAME_API_BLUEZ5_ENUM_DBUS "api.bluez5.enum.dbus" /**< a dbus Device interface */
|
||||||
#define SPA_NAME_API_BLUEZ5_DEVICE "api.bluez5.device" /**< a Device interface */
|
#define SPA_NAME_API_BLUEZ5_DEVICE "api.bluez5.device" /**< a Device interface */
|
||||||
#define SPA_NAME_API_BLUEZ5_A2DP_SINK "api.bluez5.a2dp.sink" /**< a playback Node interface for A2DP profiles */
|
#define SPA_NAME_API_BLUEZ5_MEDIA_SINK "api.bluez5.media.sink" /**< a playback Node interface for A2DP/BAP profiles */
|
||||||
#define SPA_NAME_API_BLUEZ5_A2DP_SOURCE "api.bluez5.a2dp.source" /**< a capture Node interface for A2DP profiles */
|
#define SPA_NAME_API_BLUEZ5_MEDIA_SOURCE "api.bluez5.media.source" /**< a capture Node interface for A2DP/BAP profiles */
|
||||||
#define SPA_NAME_API_BLUEZ5_SCO_SINK "api.bluez5.sco.sink" /**< a playback Node interface for HSP/HFP profiles */
|
#define SPA_NAME_API_BLUEZ5_SCO_SINK "api.bluez5.sco.sink" /**< a playback Node interface for HSP/HFP profiles */
|
||||||
#define SPA_NAME_API_BLUEZ5_SCO_SOURCE "api.bluez5.sco.source" /**< a capture Node interface for HSP/HFP profiles */
|
#define SPA_NAME_API_BLUEZ5_SCO_SOURCE "api.bluez5.sco.source" /**< a capture Node interface for HSP/HFP profiles */
|
||||||
|
|
||||||
/** keys for codec factory names */
|
/** keys for codec factory names */
|
||||||
#define SPA_NAME_API_CODEC_BLUEZ5_A2DP "api.codec.bluez5.a2dp" /**< Bluez5 A2DP codec plugin */
|
#define SPA_NAME_API_CODEC_BLUEZ5_MEDIA "api.codec.bluez5.media" /**< Bluez5 Media codec plugin */
|
||||||
|
|
||||||
/** keys for v4l2 factory names */
|
/** keys for v4l2 factory names */
|
||||||
#define SPA_NAME_API_V4L2_ENUM_UDEV "api.v4l2.enum.udev" /**< a v4l2 udev Device interface */
|
#define SPA_NAME_API_V4L2_ENUM_UDEV "api.v4l2.enum.udev" /**< a v4l2 udev Device interface */
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
#include <fdk-aac/aacdecoder_lib.h>
|
#include <fdk-aac/aacdecoder_lib.h>
|
||||||
|
|
||||||
#include "rtp.h"
|
#include "rtp.h"
|
||||||
#include "a2dp-codecs.h"
|
#include "media-codecs.h"
|
||||||
|
|
||||||
static struct spa_log *log;
|
static struct spa_log *log;
|
||||||
static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.codecs.aac");
|
static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.codecs.aac");
|
||||||
|
|
@ -65,7 +65,7 @@ struct impl {
|
||||||
int samplesize;
|
int samplesize;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_fill_caps(const struct media_codec *codec, uint32_t flags,
|
||||||
uint8_t caps[A2DP_MAX_CAPS_SIZE])
|
uint8_t caps[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
static const a2dp_aac_t a2dp_aac = {
|
static const a2dp_aac_t a2dp_aac = {
|
||||||
|
|
@ -98,7 +98,7 @@ static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return sizeof(a2dp_aac);
|
return sizeof(a2dp_aac);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct a2dp_codec_config
|
static const struct media_codec_config
|
||||||
aac_frequencies[] = {
|
aac_frequencies[] = {
|
||||||
{ AAC_SAMPLING_FREQ_48000, 48000, 11 },
|
{ AAC_SAMPLING_FREQ_48000, 48000, 11 },
|
||||||
{ AAC_SAMPLING_FREQ_44100, 44100, 10 },
|
{ AAC_SAMPLING_FREQ_44100, 44100, 10 },
|
||||||
|
|
@ -114,7 +114,7 @@ aac_frequencies[] = {
|
||||||
{ AAC_SAMPLING_FREQ_8000, 8000, 0 },
|
{ AAC_SAMPLING_FREQ_8000, 8000, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct a2dp_codec_config
|
static const struct media_codec_config
|
||||||
aac_channel_modes[] = {
|
aac_channel_modes[] = {
|
||||||
{ AAC_CHANNELS_2, 2, 1 },
|
{ AAC_CHANNELS_2, 2, 1 },
|
||||||
{ AAC_CHANNELS_1, 1, 0 },
|
{ AAC_CHANNELS_1, 1, 0 },
|
||||||
|
|
@ -130,9 +130,9 @@ static int get_valid_aac_bitrate(a2dp_aac_t *conf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_select_config(const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct a2dp_codec_audio_info *info,
|
const struct media_codec_audio_info *info,
|
||||||
const struct spa_dict *settings, 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;
|
||||||
|
|
@ -154,7 +154,7 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
else
|
else
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
|
|
||||||
if ((i = a2dp_codec_select_config(aac_frequencies,
|
if ((i = media_codec_select_config(aac_frequencies,
|
||||||
SPA_N_ELEMENTS(aac_frequencies),
|
SPA_N_ELEMENTS(aac_frequencies),
|
||||||
AAC_GET_FREQUENCY(conf),
|
AAC_GET_FREQUENCY(conf),
|
||||||
info ? info->rate : A2DP_CODEC_DEFAULT_RATE
|
info ? info->rate : A2DP_CODEC_DEFAULT_RATE
|
||||||
|
|
@ -162,7 +162,7 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
AAC_SET_FREQUENCY(conf, aac_frequencies[i].config);
|
AAC_SET_FREQUENCY(conf, aac_frequencies[i].config);
|
||||||
|
|
||||||
if ((i = a2dp_codec_select_config(aac_channel_modes,
|
if ((i = media_codec_select_config(aac_channel_modes,
|
||||||
SPA_N_ELEMENTS(aac_channel_modes),
|
SPA_N_ELEMENTS(aac_channel_modes),
|
||||||
conf.channels,
|
conf.channels,
|
||||||
info ? info->channels : A2DP_CODEC_DEFAULT_CHANNELS
|
info ? info->channels : A2DP_CODEC_DEFAULT_CHANNELS
|
||||||
|
|
@ -177,7 +177,7 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return sizeof(conf);
|
return sizeof(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_enum_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_enum_config(const struct media_codec *codec, uint32_t flags,
|
||||||
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 *b, struct spa_pod **param)
|
struct spa_pod_builder *b, struct spa_pod **param)
|
||||||
{
|
{
|
||||||
|
|
@ -246,7 +246,7 @@ static int codec_enum_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return *param == NULL ? -EIO : 1;
|
return *param == NULL ? -EIO : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_validate_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_validate_config(const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
struct spa_audio_info *info)
|
struct spa_audio_info *info)
|
||||||
{
|
{
|
||||||
|
|
@ -296,7 +296,7 @@ static int codec_validate_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *codec_init_props(const struct a2dp_codec *codec, uint32_t flags, const struct spa_dict *settings)
|
static void *codec_init_props(const struct media_codec *codec, uint32_t flags, const struct spa_dict *settings)
|
||||||
{
|
{
|
||||||
struct props *p = calloc(1, sizeof(struct props));
|
struct props *p = calloc(1, sizeof(struct props));
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
@ -316,7 +316,7 @@ static void codec_clear_props(void *props)
|
||||||
free(props);
|
free(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
static void *codec_init(const struct media_codec *codec, uint32_t flags,
|
||||||
void *config, size_t config_len, const struct spa_audio_info *info,
|
void *config, size_t config_len, const struct spa_audio_info *info,
|
||||||
void *props, size_t mtu)
|
void *props, size_t mtu)
|
||||||
{
|
{
|
||||||
|
|
@ -630,7 +630,7 @@ static void codec_set_log(struct spa_log *global_log)
|
||||||
spa_log_topic_init(log, &log_topic);
|
spa_log_topic_init(log, &log_topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_aac = {
|
const struct media_codec a2dp_codec_aac = {
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_AAC,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_AAC,
|
||||||
.codec_id = A2DP_CODEC_MPEG24,
|
.codec_id = A2DP_CODEC_MPEG24,
|
||||||
.name = "aac",
|
.name = "aac",
|
||||||
|
|
@ -654,7 +654,7 @@ const struct a2dp_codec a2dp_codec_aac = {
|
||||||
.set_log = codec_set_log,
|
.set_log = codec_set_log,
|
||||||
};
|
};
|
||||||
|
|
||||||
A2DP_CODEC_EXPORT_DEF(
|
MEDIA_CODEC_EXPORT_DEF(
|
||||||
"aac",
|
"aac",
|
||||||
&a2dp_codec_aac
|
&a2dp_codec_aac
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
#include <freeaptx.h>
|
#include <freeaptx.h>
|
||||||
|
|
||||||
#include "rtp.h"
|
#include "rtp.h"
|
||||||
#include "a2dp-codecs.h"
|
#include "media-codecs.h"
|
||||||
|
|
||||||
#define APTX_LL_LEVEL1(level) (((level) >> 8) & 0xFF)
|
#define APTX_LL_LEVEL1(level) (((level) >> 8) & 0xFF)
|
||||||
#define APTX_LL_LEVEL2(level) (((level) >> 0) & 0xFF)
|
#define APTX_LL_LEVEL2(level) (((level) >> 0) & 0xFF)
|
||||||
|
|
@ -71,19 +71,19 @@ struct msbc_impl {
|
||||||
sbc_t msbc;
|
sbc_t msbc;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool codec_is_hd(const struct a2dp_codec *codec)
|
static inline bool codec_is_hd(const struct media_codec *codec)
|
||||||
{
|
{
|
||||||
return codec->vendor.codec_id == APTX_HD_CODEC_ID
|
return codec->vendor.codec_id == APTX_HD_CODEC_ID
|
||||||
&& codec->vendor.vendor_id == APTX_HD_VENDOR_ID;
|
&& codec->vendor.vendor_id == APTX_HD_VENDOR_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool codec_is_ll(const struct a2dp_codec *codec)
|
static inline bool codec_is_ll(const struct media_codec *codec)
|
||||||
{
|
{
|
||||||
return (codec->id == SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL) ||
|
return (codec->id == SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL) ||
|
||||||
(codec->id == SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL_DUPLEX);
|
(codec->id == SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL_DUPLEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline size_t codec_get_caps_size(const struct a2dp_codec *codec)
|
static inline size_t codec_get_caps_size(const struct media_codec *codec)
|
||||||
{
|
{
|
||||||
if (codec_is_hd(codec))
|
if (codec_is_hd(codec))
|
||||||
return sizeof(a2dp_aptx_hd_t);
|
return sizeof(a2dp_aptx_hd_t);
|
||||||
|
|
@ -93,7 +93,7 @@ static inline size_t codec_get_caps_size(const struct a2dp_codec *codec)
|
||||||
return sizeof(a2dp_aptx_t);
|
return sizeof(a2dp_aptx_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_fill_caps(const struct media_codec *codec, uint32_t flags,
|
||||||
uint8_t caps[A2DP_MAX_CAPS_SIZE])
|
uint8_t caps[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
size_t actual_conf_size = codec_get_caps_size(codec);
|
size_t actual_conf_size = codec_get_caps_size(codec);
|
||||||
|
|
@ -119,7 +119,7 @@ static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return actual_conf_size;
|
return actual_conf_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct a2dp_codec_config
|
static const struct media_codec_config
|
||||||
aptx_frequencies[] = {
|
aptx_frequencies[] = {
|
||||||
{ APTX_SAMPLING_FREQ_48000, 48000, 3 },
|
{ APTX_SAMPLING_FREQ_48000, 48000, 3 },
|
||||||
{ APTX_SAMPLING_FREQ_44100, 44100, 2 },
|
{ APTX_SAMPLING_FREQ_44100, 44100, 2 },
|
||||||
|
|
@ -127,9 +127,9 @@ aptx_frequencies[] = {
|
||||||
{ APTX_SAMPLING_FREQ_16000, 16000, 0 },
|
{ APTX_SAMPLING_FREQ_16000, 16000, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_select_config(const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct a2dp_codec_audio_info *info,
|
const struct media_codec_audio_info *info,
|
||||||
const struct spa_dict *settings, 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;
|
||||||
|
|
@ -145,7 +145,7 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
codec->vendor.codec_id != conf.info.codec_id)
|
codec->vendor.codec_id != conf.info.codec_id)
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
|
|
||||||
if ((i = a2dp_codec_select_config(aptx_frequencies,
|
if ((i = media_codec_select_config(aptx_frequencies,
|
||||||
SPA_N_ELEMENTS(aptx_frequencies),
|
SPA_N_ELEMENTS(aptx_frequencies),
|
||||||
conf.frequency,
|
conf.frequency,
|
||||||
info ? info->rate : A2DP_CODEC_DEFAULT_RATE
|
info ? info->rate : A2DP_CODEC_DEFAULT_RATE
|
||||||
|
|
@ -163,9 +163,9 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return actual_conf_size;
|
return actual_conf_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_select_config_ll(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_select_config_ll(const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct a2dp_codec_audio_info *info,
|
const struct media_codec_audio_info *info,
|
||||||
const struct spa_dict *settings, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
const struct spa_dict *settings, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
a2dp_aptx_ll_ext_t conf = { 0 };
|
a2dp_aptx_ll_ext_t conf = { 0 };
|
||||||
|
|
@ -218,7 +218,7 @@ static int codec_select_config_ll(const struct a2dp_codec *codec, uint32_t flags
|
||||||
return actual_conf_size;
|
return actual_conf_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_enum_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_enum_config(const struct media_codec *codec, uint32_t flags,
|
||||||
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 *b, struct spa_pod **param)
|
struct spa_pod_builder *b, struct spa_pod **param)
|
||||||
{
|
{
|
||||||
|
|
@ -315,7 +315,7 @@ static int codec_get_block_size(void *data)
|
||||||
return this->codesize;
|
return this->codesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
static void *codec_init(const struct media_codec *codec, uint32_t flags,
|
||||||
void *config, size_t config_len, const struct spa_audio_info *info,
|
void *config, size_t config_len, const struct spa_audio_info *info,
|
||||||
void *props, size_t mtu)
|
void *props, size_t mtu)
|
||||||
{
|
{
|
||||||
|
|
@ -458,7 +458,7 @@ static int codec_decode(void *data,
|
||||||
* When connected as SRC to SNK, aptX-LL sink may send back mSBC data.
|
* When connected as SRC to SNK, aptX-LL sink may send back mSBC data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int msbc_enum_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int msbc_enum_config(const struct media_codec *codec, uint32_t flags,
|
||||||
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 *b, struct spa_pod **param)
|
struct spa_pod_builder *b, struct spa_pod **param)
|
||||||
{
|
{
|
||||||
|
|
@ -479,7 +479,7 @@ static int msbc_enum_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return *param == NULL ? -EIO : 1;
|
return *param == NULL ? -EIO : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msbc_validate_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int msbc_validate_config(const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
struct spa_audio_info *info)
|
struct spa_audio_info *info)
|
||||||
{
|
{
|
||||||
|
|
@ -508,7 +508,7 @@ static int msbc_get_block_size(void *data)
|
||||||
return MSBC_DECODED_SIZE;
|
return MSBC_DECODED_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *msbc_init(const struct a2dp_codec *codec, uint32_t flags,
|
static void *msbc_init(const struct media_codec *codec, uint32_t flags,
|
||||||
void *config, size_t config_len, const struct spa_audio_info *info,
|
void *config, size_t config_len, const struct spa_audio_info *info,
|
||||||
void *props, size_t mtu)
|
void *props, size_t mtu)
|
||||||
{
|
{
|
||||||
|
|
@ -610,7 +610,7 @@ static int msbc_decode(void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_aptx = {
|
const struct media_codec a2dp_codec_aptx = {
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX,
|
||||||
.codec_id = A2DP_CODEC_VENDOR,
|
.codec_id = A2DP_CODEC_VENDOR,
|
||||||
.vendor = { .vendor_id = APTX_VENDOR_ID,
|
.vendor = { .vendor_id = APTX_VENDOR_ID,
|
||||||
|
|
@ -633,7 +633,7 @@ const struct a2dp_codec a2dp_codec_aptx = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_aptx_hd = {
|
const struct media_codec a2dp_codec_aptx_hd = {
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_HD,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_HD,
|
||||||
.codec_id = A2DP_CODEC_VENDOR,
|
.codec_id = A2DP_CODEC_VENDOR,
|
||||||
.vendor = { .vendor_id = APTX_HD_VENDOR_ID,
|
.vendor = { .vendor_id = APTX_HD_VENDOR_ID,
|
||||||
|
|
@ -671,7 +671,7 @@ const struct a2dp_codec a2dp_codec_aptx_hd = {
|
||||||
.increase_bitpool = codec_increase_bitpool
|
.increase_bitpool = codec_increase_bitpool
|
||||||
|
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_aptx_ll_0 = {
|
const struct media_codec a2dp_codec_aptx_ll_0 = {
|
||||||
APTX_LL_COMMON_DEFS,
|
APTX_LL_COMMON_DEFS,
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL,
|
||||||
.vendor = { .vendor_id = APTX_LL_VENDOR_ID,
|
.vendor = { .vendor_id = APTX_LL_VENDOR_ID,
|
||||||
|
|
@ -680,7 +680,7 @@ const struct a2dp_codec a2dp_codec_aptx_ll_0 = {
|
||||||
.endpoint_name = "aptx_ll_0",
|
.endpoint_name = "aptx_ll_0",
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_aptx_ll_1 = {
|
const struct media_codec a2dp_codec_aptx_ll_1 = {
|
||||||
APTX_LL_COMMON_DEFS,
|
APTX_LL_COMMON_DEFS,
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL,
|
||||||
.vendor = { .vendor_id = APTX_LL_VENDOR_ID2,
|
.vendor = { .vendor_id = APTX_LL_VENDOR_ID2,
|
||||||
|
|
@ -690,7 +690,7 @@ const struct a2dp_codec a2dp_codec_aptx_ll_1 = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Voice channel mSBC, not a real A2DP codec */
|
/* Voice channel mSBC, not a real A2DP codec */
|
||||||
static const struct a2dp_codec aptx_ll_msbc = {
|
static const struct media_codec aptx_ll_msbc = {
|
||||||
.codec_id = A2DP_CODEC_VENDOR,
|
.codec_id = A2DP_CODEC_VENDOR,
|
||||||
.name = "aptx_ll_msbc",
|
.name = "aptx_ll_msbc",
|
||||||
.description = "aptX-LL mSBC",
|
.description = "aptX-LL mSBC",
|
||||||
|
|
@ -715,7 +715,7 @@ static const struct spa_dict_item duplex_info_items[] = {
|
||||||
};
|
};
|
||||||
static const struct spa_dict duplex_info = SPA_DICT_INIT_ARRAY(duplex_info_items);
|
static const struct spa_dict duplex_info = SPA_DICT_INIT_ARRAY(duplex_info_items);
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_aptx_ll_duplex_0 = {
|
const struct media_codec a2dp_codec_aptx_ll_duplex_0 = {
|
||||||
APTX_LL_COMMON_DEFS,
|
APTX_LL_COMMON_DEFS,
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL_DUPLEX,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL_DUPLEX,
|
||||||
.vendor = { .vendor_id = APTX_LL_VENDOR_ID,
|
.vendor = { .vendor_id = APTX_LL_VENDOR_ID,
|
||||||
|
|
@ -726,7 +726,7 @@ const struct a2dp_codec a2dp_codec_aptx_ll_duplex_0 = {
|
||||||
.info = &duplex_info,
|
.info = &duplex_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_aptx_ll_duplex_1 = {
|
const struct media_codec a2dp_codec_aptx_ll_duplex_1 = {
|
||||||
APTX_LL_COMMON_DEFS,
|
APTX_LL_COMMON_DEFS,
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL_DUPLEX,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL_DUPLEX,
|
||||||
.vendor = { .vendor_id = APTX_LL_VENDOR_ID2,
|
.vendor = { .vendor_id = APTX_LL_VENDOR_ID2,
|
||||||
|
|
@ -737,7 +737,7 @@ const struct a2dp_codec a2dp_codec_aptx_ll_duplex_1 = {
|
||||||
.info = &duplex_info,
|
.info = &duplex_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
A2DP_CODEC_EXPORT_DEF(
|
MEDIA_CODEC_EXPORT_DEF(
|
||||||
"aptx",
|
"aptx",
|
||||||
&a2dp_codec_aptx_hd,
|
&a2dp_codec_aptx_hd,
|
||||||
&a2dp_codec_aptx,
|
&a2dp_codec_aptx,
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
#include <sbc/sbc.h>
|
#include <sbc/sbc.h>
|
||||||
|
|
||||||
#include "a2dp-codecs.h"
|
#include "media-codecs.h"
|
||||||
|
|
||||||
struct impl {
|
struct impl {
|
||||||
sbc_t sbc;
|
sbc_t sbc;
|
||||||
|
|
@ -51,7 +51,7 @@ struct duplex_impl {
|
||||||
sbc_t sbc;
|
sbc_t sbc;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_fill_caps(const struct media_codec *codec, uint32_t flags,
|
||||||
uint8_t caps[A2DP_MAX_CAPS_SIZE])
|
uint8_t caps[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
const a2dp_faststream_t a2dp_faststream = {
|
const a2dp_faststream_t a2dp_faststream = {
|
||||||
|
|
@ -69,20 +69,20 @@ static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return sizeof(a2dp_faststream);
|
return sizeof(a2dp_faststream);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct a2dp_codec_config
|
static const struct media_codec_config
|
||||||
frequencies[] = {
|
frequencies[] = {
|
||||||
{ FASTSTREAM_SINK_SAMPLING_FREQ_48000, 48000, 1 },
|
{ FASTSTREAM_SINK_SAMPLING_FREQ_48000, 48000, 1 },
|
||||||
{ FASTSTREAM_SINK_SAMPLING_FREQ_44100, 44100, 0 },
|
{ FASTSTREAM_SINK_SAMPLING_FREQ_44100, 44100, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct a2dp_codec_config
|
static const struct media_codec_config
|
||||||
duplex_frequencies[] = {
|
duplex_frequencies[] = {
|
||||||
{ FASTSTREAM_SOURCE_SAMPLING_FREQ_16000, 16000, 0 },
|
{ FASTSTREAM_SOURCE_SAMPLING_FREQ_16000, 16000, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_select_config(const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct a2dp_codec_audio_info *info,
|
const struct media_codec_audio_info *info,
|
||||||
const struct spa_dict *settings, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
const struct spa_dict *settings, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
a2dp_faststream_t conf;
|
a2dp_faststream_t conf;
|
||||||
|
|
@ -108,7 +108,7 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
if (codec->duplex_codec)
|
if (codec->duplex_codec)
|
||||||
conf.direction |= FASTSTREAM_DIRECTION_SOURCE;
|
conf.direction |= FASTSTREAM_DIRECTION_SOURCE;
|
||||||
|
|
||||||
if ((i = a2dp_codec_select_config(frequencies,
|
if ((i = media_codec_select_config(frequencies,
|
||||||
SPA_N_ELEMENTS(frequencies),
|
SPA_N_ELEMENTS(frequencies),
|
||||||
conf.sink_frequency,
|
conf.sink_frequency,
|
||||||
info ? info->rate : A2DP_CODEC_DEFAULT_RATE
|
info ? info->rate : A2DP_CODEC_DEFAULT_RATE
|
||||||
|
|
@ -116,7 +116,7 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
conf.sink_frequency = frequencies[i].config;
|
conf.sink_frequency = frequencies[i].config;
|
||||||
|
|
||||||
if ((i = a2dp_codec_select_config(duplex_frequencies,
|
if ((i = media_codec_select_config(duplex_frequencies,
|
||||||
SPA_N_ELEMENTS(duplex_frequencies),
|
SPA_N_ELEMENTS(duplex_frequencies),
|
||||||
conf.source_frequency,
|
conf.source_frequency,
|
||||||
16000
|
16000
|
||||||
|
|
@ -129,7 +129,7 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return sizeof(conf);
|
return sizeof(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_enum_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_enum_config(const struct media_codec *codec, uint32_t flags,
|
||||||
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 *b, struct spa_pod **param)
|
struct spa_pod_builder *b, struct spa_pod **param)
|
||||||
{
|
{
|
||||||
|
|
@ -209,7 +209,7 @@ static size_t ceil2(size_t v)
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
static void *codec_init(const struct media_codec *codec, uint32_t flags,
|
||||||
void *config, size_t config_len, const struct spa_audio_info *info,
|
void *config, size_t config_len, const struct spa_audio_info *info,
|
||||||
void *props, size_t mtu)
|
void *props, size_t mtu)
|
||||||
{
|
{
|
||||||
|
|
@ -372,7 +372,7 @@ static SPA_UNUSED int codec_decode(void *data,
|
||||||
* When connected as SRC to SNK, FastStream sink may send back SBC data.
|
* When connected as SRC to SNK, FastStream sink may send back SBC data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int duplex_enum_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int duplex_enum_config(const struct media_codec *codec, uint32_t flags,
|
||||||
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 *b, struct spa_pod **param)
|
struct spa_pod_builder *b, struct spa_pod **param)
|
||||||
{
|
{
|
||||||
|
|
@ -411,7 +411,7 @@ static int duplex_enum_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return *param == NULL ? -EIO : 1;
|
return *param == NULL ? -EIO : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int duplex_validate_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int duplex_validate_config(const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
struct spa_audio_info *info)
|
struct spa_audio_info *info)
|
||||||
{
|
{
|
||||||
|
|
@ -441,7 +441,7 @@ static int duplex_get_block_size(void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *duplex_init(const struct a2dp_codec *codec, uint32_t flags,
|
static void *duplex_init(const struct media_codec *codec, uint32_t flags,
|
||||||
void *config, size_t config_len, const struct spa_audio_info *info,
|
void *config, size_t config_len, const struct spa_audio_info *info,
|
||||||
void *props, size_t mtu)
|
void *props, size_t mtu)
|
||||||
{
|
{
|
||||||
|
|
@ -577,7 +577,7 @@ static int duplex_decode(void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Voice channel SBC, not a real A2DP codec */
|
/* Voice channel SBC, not a real A2DP codec */
|
||||||
static const struct a2dp_codec duplex_codec = {
|
static const struct media_codec duplex_codec = {
|
||||||
.codec_id = A2DP_CODEC_VENDOR,
|
.codec_id = A2DP_CODEC_VENDOR,
|
||||||
.name = "faststream_sbc",
|
.name = "faststream_sbc",
|
||||||
.description = "FastStream duplex SBC",
|
.description = "FastStream duplex SBC",
|
||||||
|
|
@ -614,7 +614,7 @@ static const struct a2dp_codec duplex_codec = {
|
||||||
.reduce_bitpool = codec_reduce_bitpool, \
|
.reduce_bitpool = codec_reduce_bitpool, \
|
||||||
.increase_bitpool = codec_increase_bitpool
|
.increase_bitpool = codec_increase_bitpool
|
||||||
|
|
||||||
static const struct a2dp_codec a2dp_codec_faststream = {
|
const struct media_codec a2dp_codec_faststream = {
|
||||||
FASTSTREAM_COMMON_DEFS,
|
FASTSTREAM_COMMON_DEFS,
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_FASTSTREAM,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_FASTSTREAM,
|
||||||
.name = "faststream",
|
.name = "faststream",
|
||||||
|
|
@ -625,7 +625,7 @@ static const struct spa_dict_item duplex_info_items[] = {
|
||||||
};
|
};
|
||||||
static const struct spa_dict duplex_info = SPA_DICT_INIT_ARRAY(duplex_info_items);
|
static const struct spa_dict duplex_info = SPA_DICT_INIT_ARRAY(duplex_info_items);
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_faststream_duplex = {
|
const struct media_codec a2dp_codec_faststream_duplex = {
|
||||||
FASTSTREAM_COMMON_DEFS,
|
FASTSTREAM_COMMON_DEFS,
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_FASTSTREAM_DUPLEX,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_FASTSTREAM_DUPLEX,
|
||||||
.name = "faststream_duplex",
|
.name = "faststream_duplex",
|
||||||
|
|
@ -633,7 +633,7 @@ const struct a2dp_codec a2dp_codec_faststream_duplex = {
|
||||||
.info = &duplex_info,
|
.info = &duplex_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
A2DP_CODEC_EXPORT_DEF(
|
MEDIA_CODEC_EXPORT_DEF(
|
||||||
"faststream",
|
"faststream",
|
||||||
&a2dp_codec_faststream,
|
&a2dp_codec_faststream,
|
||||||
&a2dp_codec_faststream_duplex
|
&a2dp_codec_faststream_duplex
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "rtp.h"
|
#include "rtp.h"
|
||||||
#include "a2dp-codecs.h"
|
#include "media-codecs.h"
|
||||||
|
|
||||||
#define BITRATE_MIN 96000
|
#define BITRATE_MIN 96000
|
||||||
#define BITRATE_MAX 512000
|
#define BITRATE_MAX 512000
|
||||||
|
|
@ -86,7 +86,7 @@ struct impl {
|
||||||
int32_t buf[2][LC3PLUS_MAX_SAMPLES];
|
int32_t buf[2][LC3PLUS_MAX_SAMPLES];
|
||||||
};
|
};
|
||||||
|
|
||||||
static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_fill_caps(const struct media_codec *codec, uint32_t flags,
|
||||||
uint8_t caps[A2DP_MAX_CAPS_SIZE])
|
uint8_t caps[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
const a2dp_lc3plus_hr_t a2dp_lc3plus_hr = {
|
const a2dp_lc3plus_hr_t a2dp_lc3plus_hr = {
|
||||||
|
|
@ -102,9 +102,9 @@ static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return sizeof(a2dp_lc3plus_hr);
|
return sizeof(a2dp_lc3plus_hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_select_config(const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct a2dp_codec_audio_info *info,
|
const struct media_codec_audio_info *info,
|
||||||
const struct spa_dict *settings, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
const struct spa_dict *settings, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
a2dp_lc3plus_hr_t conf;
|
a2dp_lc3plus_hr_t conf;
|
||||||
|
|
@ -150,8 +150,8 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return sizeof(conf);
|
return sizeof(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_caps_preference_cmp(const struct a2dp_codec *codec, uint32_t flags, const void *caps1, size_t caps1_size,
|
static int codec_caps_preference_cmp(const struct media_codec *codec, uint32_t flags, const void *caps1, size_t caps1_size,
|
||||||
const void *caps2, size_t caps2_size, const struct a2dp_codec_audio_info *info, const struct spa_dict *global_settings)
|
const void *caps2, size_t caps2_size, const struct media_codec_audio_info *info, const struct spa_dict *global_settings)
|
||||||
{
|
{
|
||||||
a2dp_lc3plus_hr_t conf1, conf2;
|
a2dp_lc3plus_hr_t conf1, conf2;
|
||||||
a2dp_lc3plus_hr_t *conf;
|
a2dp_lc3plus_hr_t *conf;
|
||||||
|
|
@ -160,7 +160,7 @@ static int codec_caps_preference_cmp(const struct a2dp_codec *codec, uint32_t fl
|
||||||
|
|
||||||
/* Order selected configurations by preference */
|
/* Order selected configurations by preference */
|
||||||
res1 = codec->select_config(codec, 0, caps1, caps1_size, info, NULL, (uint8_t *)&conf1);
|
res1 = codec->select_config(codec, 0, caps1, caps1_size, info, NULL, (uint8_t *)&conf1);
|
||||||
res2 = codec->select_config(codec, 0, caps2, caps2_size, info, NULL, (uint8_t *)&conf2);
|
res2 = codec->select_config(codec, 0, caps2, caps2_size, info , NULL, (uint8_t *)&conf2);
|
||||||
|
|
||||||
#define PREFER_EXPR(expr) \
|
#define PREFER_EXPR(expr) \
|
||||||
do { \
|
do { \
|
||||||
|
|
@ -190,7 +190,7 @@ static int codec_caps_preference_cmp(const struct a2dp_codec *codec, uint32_t fl
|
||||||
#undef PREFER_BOOL
|
#undef PREFER_BOOL
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_enum_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_enum_config(const struct media_codec *codec, uint32_t flags,
|
||||||
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 *b, struct spa_pod **param)
|
struct spa_pod_builder *b, struct spa_pod **param)
|
||||||
{
|
{
|
||||||
|
|
@ -263,7 +263,7 @@ static int codec_enum_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return *param == NULL ? -EIO : 1;
|
return *param == NULL ? -EIO : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_validate_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_validate_config(const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
struct spa_audio_info *info)
|
struct spa_audio_info *info)
|
||||||
{
|
{
|
||||||
|
|
@ -342,7 +342,7 @@ static bool check_mtu_vs_frame_dms(struct impl *this)
|
||||||
return (size_t)this->mtu >= header_size + ceildiv(payload_size, max_fragments);
|
return (size_t)this->mtu >= header_size + ceildiv(payload_size, max_fragments);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
static void *codec_init(const struct media_codec *codec, uint32_t flags,
|
||||||
void *config, size_t config_len, const struct spa_audio_info *info,
|
void *config, size_t config_len, const struct spa_audio_info *info,
|
||||||
void *props, size_t mtu)
|
void *props, size_t mtu)
|
||||||
{
|
{
|
||||||
|
|
@ -758,7 +758,7 @@ static int codec_increase_bitpool(void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_lc3plus_hr = {
|
const struct media_codec a2dp_codec_lc3plus_hr = {
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_LC3PLUS_HR,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_LC3PLUS_HR,
|
||||||
.name = "lc3plus_hr",
|
.name = "lc3plus_hr",
|
||||||
.codec_id = A2DP_CODEC_VENDOR,
|
.codec_id = A2DP_CODEC_VENDOR,
|
||||||
|
|
@ -782,7 +782,7 @@ const struct a2dp_codec a2dp_codec_lc3plus_hr = {
|
||||||
.increase_bitpool = codec_increase_bitpool
|
.increase_bitpool = codec_increase_bitpool
|
||||||
};
|
};
|
||||||
|
|
||||||
A2DP_CODEC_EXPORT_DEF(
|
MEDIA_CODEC_EXPORT_DEF(
|
||||||
"lc3plus",
|
"lc3plus",
|
||||||
&a2dp_codec_lc3plus_hr
|
&a2dp_codec_lc3plus_hr
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "rtp.h"
|
#include "rtp.h"
|
||||||
#include "a2dp-codecs.h"
|
#include "media-codecs.h"
|
||||||
|
|
||||||
#define LDACBT_EQMID_AUTO -1
|
#define LDACBT_EQMID_AUTO -1
|
||||||
|
|
||||||
|
|
@ -79,7 +79,7 @@ struct impl {
|
||||||
int frame_count;
|
int frame_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags, uint8_t caps[A2DP_MAX_CAPS_SIZE])
|
static int codec_fill_caps(const struct media_codec *codec, uint32_t flags, uint8_t caps[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
static const a2dp_ldac_t a2dp_ldac = {
|
static const a2dp_ldac_t a2dp_ldac = {
|
||||||
.info.vendor_id = LDAC_VENDOR_ID,
|
.info.vendor_id = LDAC_VENDOR_ID,
|
||||||
|
|
@ -97,7 +97,7 @@ static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags, uint8
|
||||||
return sizeof(a2dp_ldac);
|
return sizeof(a2dp_ldac);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct a2dp_codec_config
|
static const struct media_codec_config
|
||||||
ldac_frequencies[] = {
|
ldac_frequencies[] = {
|
||||||
{ LDACBT_SAMPLING_FREQ_044100, 44100, 3 },
|
{ LDACBT_SAMPLING_FREQ_044100, 44100, 3 },
|
||||||
{ LDACBT_SAMPLING_FREQ_048000, 48000, 2 },
|
{ LDACBT_SAMPLING_FREQ_048000, 48000, 2 },
|
||||||
|
|
@ -105,16 +105,16 @@ ldac_frequencies[] = {
|
||||||
{ LDACBT_SAMPLING_FREQ_096000, 96000, 0 },
|
{ LDACBT_SAMPLING_FREQ_096000, 96000, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct a2dp_codec_config
|
static const struct media_codec_config
|
||||||
ldac_channel_modes[] = {
|
ldac_channel_modes[] = {
|
||||||
{ LDACBT_CHANNEL_MODE_STEREO, 2, 2 },
|
{ LDACBT_CHANNEL_MODE_STEREO, 2, 2 },
|
||||||
{ LDACBT_CHANNEL_MODE_DUAL_CHANNEL, 2, 1 },
|
{ LDACBT_CHANNEL_MODE_DUAL_CHANNEL, 2, 1 },
|
||||||
{ LDACBT_CHANNEL_MODE_MONO, 1, 0 },
|
{ LDACBT_CHANNEL_MODE_MONO, 1, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_select_config(const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct a2dp_codec_audio_info *info,
|
const struct media_codec_audio_info *info,
|
||||||
const struct spa_dict *settings, 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;
|
||||||
|
|
@ -129,7 +129,7 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
codec->vendor.codec_id != conf.info.codec_id)
|
codec->vendor.codec_id != conf.info.codec_id)
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
|
|
||||||
if ((i = a2dp_codec_select_config(ldac_frequencies,
|
if ((i = media_codec_select_config(ldac_frequencies,
|
||||||
SPA_N_ELEMENTS(ldac_frequencies),
|
SPA_N_ELEMENTS(ldac_frequencies),
|
||||||
conf.frequency,
|
conf.frequency,
|
||||||
info ? info->rate : A2DP_CODEC_DEFAULT_RATE
|
info ? info->rate : A2DP_CODEC_DEFAULT_RATE
|
||||||
|
|
@ -137,7 +137,7 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
conf.frequency = ldac_frequencies[i].config;
|
conf.frequency = ldac_frequencies[i].config;
|
||||||
|
|
||||||
if ((i = a2dp_codec_select_config(ldac_channel_modes,
|
if ((i = media_codec_select_config(ldac_channel_modes,
|
||||||
SPA_N_ELEMENTS(ldac_channel_modes),
|
SPA_N_ELEMENTS(ldac_channel_modes),
|
||||||
conf.channel_mode,
|
conf.channel_mode,
|
||||||
info ? info->channels : A2DP_CODEC_DEFAULT_CHANNELS
|
info ? info->channels : A2DP_CODEC_DEFAULT_CHANNELS
|
||||||
|
|
@ -150,7 +150,7 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return sizeof(conf);
|
return sizeof(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_enum_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_enum_config(const struct media_codec *codec, uint32_t flags,
|
||||||
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 *b, struct spa_pod **param)
|
struct spa_pod_builder *b, struct spa_pod **param)
|
||||||
{
|
{
|
||||||
|
|
@ -284,7 +284,7 @@ static int string_to_eqmid(const char * eqmid)
|
||||||
return LDACBT_EQMID_AUTO;
|
return LDACBT_EQMID_AUTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *codec_init_props(const struct a2dp_codec *codec, uint32_t flags, const struct spa_dict *settings)
|
static void *codec_init_props(const struct media_codec *codec, uint32_t flags, const struct spa_dict *settings)
|
||||||
{
|
{
|
||||||
struct props *p = calloc(1, sizeof(struct props));
|
struct props *p = calloc(1, sizeof(struct props));
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
@ -385,7 +385,7 @@ static int codec_set_props(void *props, const struct spa_pod *param)
|
||||||
return prev_eqmid != p->eqmid;
|
return prev_eqmid != p->eqmid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
static void *codec_init(const struct media_codec *codec, uint32_t flags,
|
||||||
void *config, size_t config_len, const struct spa_audio_info *info,
|
void *config, size_t config_len, const struct spa_audio_info *info,
|
||||||
void *props, size_t mtu)
|
void *props, size_t mtu)
|
||||||
{
|
{
|
||||||
|
|
@ -570,7 +570,7 @@ static int codec_encode(void *data,
|
||||||
return src_used;
|
return src_used;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_ldac = {
|
const struct media_codec a2dp_codec_ldac = {
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_LDAC,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_LDAC,
|
||||||
.codec_id = A2DP_CODEC_VENDOR,
|
.codec_id = A2DP_CODEC_VENDOR,
|
||||||
.vendor = { .vendor_id = LDAC_VENDOR_ID,
|
.vendor = { .vendor_id = LDAC_VENDOR_ID,
|
||||||
|
|
@ -598,7 +598,7 @@ const struct a2dp_codec a2dp_codec_ldac = {
|
||||||
.increase_bitpool = codec_increase_bitpool,
|
.increase_bitpool = codec_increase_bitpool,
|
||||||
};
|
};
|
||||||
|
|
||||||
A2DP_CODEC_EXPORT_DEF(
|
MEDIA_CODEC_EXPORT_DEF(
|
||||||
"ldac",
|
"ldac",
|
||||||
&a2dp_codec_ldac
|
&a2dp_codec_ldac
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
#include <opus_multistream.h>
|
#include <opus_multistream.h>
|
||||||
|
|
||||||
#include "rtp.h"
|
#include "rtp.h"
|
||||||
#include "a2dp-codecs.h"
|
#include "media-codecs.h"
|
||||||
|
|
||||||
static struct spa_log *log;
|
static struct spa_log *log;
|
||||||
static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.codecs.opus");
|
static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.codecs.opus");
|
||||||
|
|
@ -395,7 +395,7 @@ static void parse_settings(struct props *props, const struct spa_dict *settings)
|
||||||
props->bidi_application = OPUS_APPLICATION_RESTRICTED_LOWDELAY;
|
props->bidi_application = OPUS_APPLICATION_RESTRICTED_LOWDELAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_channel_conf(const struct a2dp_codec *codec, a2dp_opus_05_t *caps, const struct props *props)
|
static int set_channel_conf(const struct media_codec *codec, a2dp_opus_05_t *caps, const struct props *props)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Predefined codec profiles
|
* Predefined codec profiles
|
||||||
|
|
@ -469,7 +469,7 @@ static int set_channel_conf(const struct a2dp_codec *codec, a2dp_opus_05_t *caps
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_default_bitrates(const struct a2dp_codec *codec, bool bidi, int *min, int *max, int *init)
|
static void get_default_bitrates(const struct media_codec *codec, bool bidi, int *min, int *max, int *init)
|
||||||
{
|
{
|
||||||
int tmp;
|
int tmp;
|
||||||
|
|
||||||
|
|
@ -514,7 +514,7 @@ static void get_default_bitrates(const struct a2dp_codec *codec, bool bidi, int
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_mapping(const struct a2dp_codec *codec, const a2dp_opus_05_direction_t *conf,
|
static int get_mapping(const struct media_codec *codec, const a2dp_opus_05_direction_t *conf,
|
||||||
bool use_surround_encoder, uint8_t *streams_ret, uint8_t *coupled_streams_ret,
|
bool use_surround_encoder, uint8_t *streams_ret, uint8_t *coupled_streams_ret,
|
||||||
const uint8_t **surround_mapping, uint32_t *positions)
|
const uint8_t **surround_mapping, uint32_t *positions)
|
||||||
{
|
{
|
||||||
|
|
@ -576,7 +576,7 @@ static int get_mapping(const struct a2dp_codec *codec, const a2dp_opus_05_direct
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_fill_caps(const struct media_codec *codec, uint32_t flags,
|
||||||
uint8_t caps[A2DP_MAX_CAPS_SIZE])
|
uint8_t caps[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
a2dp_opus_05_t a2dp_opus_05 = {
|
a2dp_opus_05_t a2dp_opus_05 = {
|
||||||
|
|
@ -613,9 +613,9 @@ static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return sizeof(a2dp_opus_05);
|
return sizeof(a2dp_opus_05);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_select_config(const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct a2dp_codec_audio_info *info,
|
const struct media_codec_audio_info *info,
|
||||||
const struct spa_dict *global_settings, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
const struct spa_dict *global_settings, uint8_t config[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
struct props props;
|
struct props props;
|
||||||
|
|
@ -715,8 +715,8 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return sizeof(conf);
|
return sizeof(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_caps_preference_cmp(const struct a2dp_codec *codec, uint32_t flags, const void *caps1, size_t caps1_size,
|
static int codec_caps_preference_cmp(const struct media_codec *codec, uint32_t flags, const void *caps1, size_t caps1_size,
|
||||||
const void *caps2, size_t caps2_size, const struct a2dp_codec_audio_info *info,
|
const void *caps2, size_t caps2_size, const struct media_codec_audio_info *info,
|
||||||
const struct spa_dict *global_settings)
|
const struct spa_dict *global_settings)
|
||||||
{
|
{
|
||||||
a2dp_opus_05_t conf1, conf2, cap1, cap2;
|
a2dp_opus_05_t conf1, conf2, cap1, cap2;
|
||||||
|
|
@ -768,12 +768,12 @@ static int codec_caps_preference_cmp(const struct a2dp_codec *codec, uint32_t fl
|
||||||
#undef PREFER_BOOL
|
#undef PREFER_BOOL
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_duplex_codec(const struct a2dp_codec *codec)
|
static bool is_duplex_codec(const struct media_codec *codec)
|
||||||
{
|
{
|
||||||
return codec->id == 0;
|
return codec->id == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool use_surround_encoder(const struct a2dp_codec *codec, bool is_sink)
|
static bool use_surround_encoder(const struct media_codec *codec, bool is_sink)
|
||||||
{
|
{
|
||||||
if (codec->id == SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_PRO)
|
if (codec->id == SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_PRO)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -784,11 +784,11 @@ static bool use_surround_encoder(const struct a2dp_codec *codec, bool is_sink)
|
||||||
return !is_sink;
|
return !is_sink;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_enum_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_enum_config(const struct media_codec *codec, uint32_t flags,
|
||||||
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 *b, struct spa_pod **param)
|
struct spa_pod_builder *b, struct spa_pod **param)
|
||||||
{
|
{
|
||||||
const bool surround_encoder = use_surround_encoder(codec, flags & A2DP_CODEC_FLAG_SINK);
|
const bool surround_encoder = use_surround_encoder(codec, flags & MEDIA_CODEC_FLAG_SINK);
|
||||||
a2dp_opus_05_t conf;
|
a2dp_opus_05_t conf;
|
||||||
a2dp_opus_05_direction_t *dir;
|
a2dp_opus_05_direction_t *dir;
|
||||||
struct spa_pod_frame f[1];
|
struct spa_pod_frame f[1];
|
||||||
|
|
@ -823,11 +823,11 @@ static int codec_enum_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return *param == NULL ? -EIO : 1;
|
return *param == NULL ? -EIO : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_validate_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_validate_config(const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
struct spa_audio_info *info)
|
struct spa_audio_info *info)
|
||||||
{
|
{
|
||||||
const bool surround_encoder = use_surround_encoder(codec, flags & A2DP_CODEC_FLAG_SINK);
|
const bool surround_encoder = use_surround_encoder(codec, flags & MEDIA_CODEC_FLAG_SINK);
|
||||||
const a2dp_opus_05_direction_t *dir1, *dir2;
|
const a2dp_opus_05_direction_t *dir1, *dir2;
|
||||||
const a2dp_opus_05_t *conf;
|
const a2dp_opus_05_t *conf;
|
||||||
|
|
||||||
|
|
@ -898,7 +898,7 @@ static int parse_frame_dms(int bitfield)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *codec_init_props(const struct a2dp_codec *codec, uint32_t flags, const struct spa_dict *settings)
|
static void *codec_init_props(const struct media_codec *codec, uint32_t flags, const struct spa_dict *settings)
|
||||||
{
|
{
|
||||||
struct props *p;
|
struct props *p;
|
||||||
|
|
||||||
|
|
@ -919,11 +919,11 @@ static void codec_clear_props(void *props)
|
||||||
free(props);
|
free(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
static void *codec_init(const struct media_codec *codec, uint32_t flags,
|
||||||
void *config, size_t config_len, const struct spa_audio_info *info,
|
void *config, size_t config_len, const struct spa_audio_info *info,
|
||||||
void *props, size_t mtu)
|
void *props, size_t mtu)
|
||||||
{
|
{
|
||||||
const bool surround_encoder = use_surround_encoder(codec, flags & A2DP_CODEC_FLAG_SINK);
|
const bool surround_encoder = use_surround_encoder(codec, flags & MEDIA_CODEC_FLAG_SINK);
|
||||||
a2dp_opus_05_t *conf = config;
|
a2dp_opus_05_t *conf = config;
|
||||||
a2dp_opus_05_direction_t *dir;
|
a2dp_opus_05_direction_t *dir;
|
||||||
struct impl *this = NULL;
|
struct impl *this = NULL;
|
||||||
|
|
@ -1380,21 +1380,21 @@ static void codec_set_log(struct spa_log *global_log)
|
||||||
.start_decode = codec_start_decode, \
|
.start_decode = codec_start_decode, \
|
||||||
.decode = codec_decode
|
.decode = codec_decode
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_opus_05 = {
|
const struct media_codec a2dp_codec_opus_05 = {
|
||||||
OPUS_05_COMMON_FULL_DEFS,
|
OPUS_05_COMMON_FULL_DEFS,
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05,
|
||||||
.name = "opus_05",
|
.name = "opus_05",
|
||||||
.description = "Opus",
|
.description = "Opus",
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_opus_05_51 = {
|
const struct media_codec a2dp_codec_opus_05_51 = {
|
||||||
OPUS_05_COMMON_DEFS,
|
OPUS_05_COMMON_DEFS,
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_51,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_51,
|
||||||
.name = "opus_05_51",
|
.name = "opus_05_51",
|
||||||
.description = "Opus 5.1 Surround",
|
.description = "Opus 5.1 Surround",
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_opus_05_71 = {
|
const struct media_codec a2dp_codec_opus_05_71 = {
|
||||||
OPUS_05_COMMON_DEFS,
|
OPUS_05_COMMON_DEFS,
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_71,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_71,
|
||||||
.name = "opus_05_71",
|
.name = "opus_05_71",
|
||||||
|
|
@ -1402,14 +1402,14 @@ const struct a2dp_codec a2dp_codec_opus_05_71 = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Bidi return channel codec: doesn't have endpoints */
|
/* Bidi return channel codec: doesn't have endpoints */
|
||||||
const struct a2dp_codec a2dp_codec_opus_05_return = {
|
const struct media_codec a2dp_codec_opus_05_return = {
|
||||||
OPUS_05_COMMON_FULL_DEFS,
|
OPUS_05_COMMON_FULL_DEFS,
|
||||||
.id = 0,
|
.id = 0,
|
||||||
.name = "opus_05_duplex_bidi",
|
.name = "opus_05_duplex_bidi",
|
||||||
.description = "Opus Duplex Bidi channel",
|
.description = "Opus Duplex Bidi channel",
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_opus_05_duplex = {
|
const struct media_codec a2dp_codec_opus_05_duplex = {
|
||||||
OPUS_05_COMMON_FULL_DEFS,
|
OPUS_05_COMMON_FULL_DEFS,
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_DUPLEX,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_DUPLEX,
|
||||||
.name = "opus_05_duplex",
|
.name = "opus_05_duplex",
|
||||||
|
|
@ -1417,7 +1417,7 @@ const struct a2dp_codec a2dp_codec_opus_05_duplex = {
|
||||||
.duplex_codec = &a2dp_codec_opus_05_return,
|
.duplex_codec = &a2dp_codec_opus_05_return,
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_opus_05_pro = {
|
const struct media_codec a2dp_codec_opus_05_pro = {
|
||||||
OPUS_05_COMMON_DEFS,
|
OPUS_05_COMMON_DEFS,
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_PRO,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_PRO,
|
||||||
.name = "opus_05_pro",
|
.name = "opus_05_pro",
|
||||||
|
|
@ -1427,7 +1427,7 @@ const struct a2dp_codec a2dp_codec_opus_05_pro = {
|
||||||
.duplex_codec = &a2dp_codec_opus_05_return,
|
.duplex_codec = &a2dp_codec_opus_05_return,
|
||||||
};
|
};
|
||||||
|
|
||||||
A2DP_CODEC_EXPORT_DEF(
|
MEDIA_CODEC_EXPORT_DEF(
|
||||||
"opus",
|
"opus",
|
||||||
&a2dp_codec_opus_05,
|
&a2dp_codec_opus_05,
|
||||||
&a2dp_codec_opus_05_51,
|
&a2dp_codec_opus_05_51,
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
#include <sbc/sbc.h>
|
#include <sbc/sbc.h>
|
||||||
|
|
||||||
#include "rtp.h"
|
#include "rtp.h"
|
||||||
#include "a2dp-codecs.h"
|
#include "media-codecs.h"
|
||||||
|
|
||||||
#define MAX_FRAME_COUNT 16
|
#define MAX_FRAME_COUNT 16
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ struct impl {
|
||||||
int max_bitpool;
|
int max_bitpool;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int codec_fill_caps(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_fill_caps(const struct media_codec *codec, uint32_t flags,
|
||||||
uint8_t caps[A2DP_MAX_CAPS_SIZE])
|
uint8_t caps[A2DP_MAX_CAPS_SIZE])
|
||||||
{
|
{
|
||||||
static const a2dp_sbc_t a2dp_sbc = {
|
static const a2dp_sbc_t a2dp_sbc = {
|
||||||
|
|
@ -121,7 +121,7 @@ static uint8_t default_bitpool(uint8_t freq, uint8_t mode, bool xq)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const struct a2dp_codec_config
|
static const struct media_codec_config
|
||||||
sbc_frequencies[] = {
|
sbc_frequencies[] = {
|
||||||
{ SBC_SAMPLING_FREQ_48000, 48000, 3 },
|
{ SBC_SAMPLING_FREQ_48000, 48000, 3 },
|
||||||
{ SBC_SAMPLING_FREQ_44100, 44100, 2 },
|
{ SBC_SAMPLING_FREQ_44100, 44100, 2 },
|
||||||
|
|
@ -129,13 +129,13 @@ sbc_frequencies[] = {
|
||||||
{ SBC_SAMPLING_FREQ_16000, 16000, 0 },
|
{ SBC_SAMPLING_FREQ_16000, 16000, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct a2dp_codec_config
|
static const struct media_codec_config
|
||||||
sbc_xq_frequencies[] = {
|
sbc_xq_frequencies[] = {
|
||||||
{ SBC_SAMPLING_FREQ_44100, 44100, 1 },
|
{ SBC_SAMPLING_FREQ_44100, 44100, 1 },
|
||||||
{ SBC_SAMPLING_FREQ_48000, 48000, 0 },
|
{ SBC_SAMPLING_FREQ_48000, 48000, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct a2dp_codec_config
|
static const struct media_codec_config
|
||||||
sbc_channel_modes[] = {
|
sbc_channel_modes[] = {
|
||||||
{ SBC_CHANNEL_MODE_JOINT_STEREO, 2, 3 },
|
{ SBC_CHANNEL_MODE_JOINT_STEREO, 2, 3 },
|
||||||
{ SBC_CHANNEL_MODE_STEREO, 2, 2 },
|
{ SBC_CHANNEL_MODE_STEREO, 2, 2 },
|
||||||
|
|
@ -143,22 +143,22 @@ sbc_channel_modes[] = {
|
||||||
{ SBC_CHANNEL_MODE_MONO, 1, 0 },
|
{ SBC_CHANNEL_MODE_MONO, 1, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct a2dp_codec_config
|
static const struct media_codec_config
|
||||||
sbc_xq_channel_modes[] = {
|
sbc_xq_channel_modes[] = {
|
||||||
{ SBC_CHANNEL_MODE_DUAL_CHANNEL, 2, 2 },
|
{ SBC_CHANNEL_MODE_DUAL_CHANNEL, 2, 2 },
|
||||||
{ SBC_CHANNEL_MODE_JOINT_STEREO, 2, 1 },
|
{ SBC_CHANNEL_MODE_JOINT_STEREO, 2, 1 },
|
||||||
{ SBC_CHANNEL_MODE_STEREO, 2, 0 },
|
{ SBC_CHANNEL_MODE_STEREO, 2, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_select_config(const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct a2dp_codec_audio_info *info,
|
const struct media_codec_audio_info *info,
|
||||||
const struct spa_dict *settings, 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, i;
|
int bitpool, i;
|
||||||
size_t n;
|
size_t n;
|
||||||
const struct a2dp_codec_config *configs;
|
const struct media_codec_config *configs;
|
||||||
bool xq = false;
|
bool xq = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -176,7 +176,7 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
configs = sbc_frequencies;
|
configs = sbc_frequencies;
|
||||||
n = SPA_N_ELEMENTS(sbc_frequencies);
|
n = SPA_N_ELEMENTS(sbc_frequencies);
|
||||||
}
|
}
|
||||||
if ((i = a2dp_codec_select_config(configs, n, conf.frequency,
|
if ((i = media_codec_select_config(configs, n, conf.frequency,
|
||||||
info ? info->rate : A2DP_CODEC_DEFAULT_RATE
|
info ? info->rate : A2DP_CODEC_DEFAULT_RATE
|
||||||
)) < 0)
|
)) < 0)
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
|
|
@ -189,7 +189,7 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
configs = sbc_channel_modes;
|
configs = sbc_channel_modes;
|
||||||
n = SPA_N_ELEMENTS(sbc_channel_modes);
|
n = SPA_N_ELEMENTS(sbc_channel_modes);
|
||||||
}
|
}
|
||||||
if ((i = a2dp_codec_select_config(configs, n, conf.channel_mode,
|
if ((i = media_codec_select_config(configs, n, conf.channel_mode,
|
||||||
info ? info->channels : A2DP_CODEC_DEFAULT_CHANNELS
|
info ? info->channels : A2DP_CODEC_DEFAULT_CHANNELS
|
||||||
)) < 0)
|
)) < 0)
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
|
|
@ -229,8 +229,8 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
|
||||||
return sizeof(conf);
|
return sizeof(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_caps_preference_cmp(const struct a2dp_codec *codec, uint32_t flags, const void *caps1, size_t caps1_size,
|
static int codec_caps_preference_cmp(const struct media_codec *codec, uint32_t flags, const void *caps1, size_t caps1_size,
|
||||||
const void *caps2, size_t caps2_size, const struct a2dp_codec_audio_info *info, const struct spa_dict *global_settings)
|
const void *caps2, size_t caps2_size, const struct media_codec_audio_info *info, const struct spa_dict *global_settings)
|
||||||
{
|
{
|
||||||
a2dp_sbc_t conf1, conf2;
|
a2dp_sbc_t conf1, conf2;
|
||||||
a2dp_sbc_t *conf;
|
a2dp_sbc_t *conf;
|
||||||
|
|
@ -275,7 +275,7 @@ static int codec_caps_preference_cmp(const struct a2dp_codec *codec, uint32_t fl
|
||||||
#undef PREFER_BOOL
|
#undef PREFER_BOOL
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_validate_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_validate_config(const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
struct spa_audio_info *info)
|
struct spa_audio_info *info)
|
||||||
{
|
{
|
||||||
|
|
@ -356,7 +356,7 @@ static int codec_set_bitpool(struct impl *this, int bitpool)
|
||||||
return this->sbc.bitpool;
|
return this->sbc.bitpool;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_enum_config(const struct a2dp_codec *codec, uint32_t flags,
|
static int codec_enum_config(const struct media_codec *codec, uint32_t flags,
|
||||||
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 *b, struct spa_pod **param)
|
struct spa_pod_builder *b, struct spa_pod **param)
|
||||||
{
|
{
|
||||||
|
|
@ -453,7 +453,7 @@ static int codec_get_block_size(void *data)
|
||||||
return this->codesize;
|
return this->codesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *codec_init(const struct a2dp_codec *codec, uint32_t flags,
|
static void *codec_init(const struct media_codec *codec, uint32_t flags,
|
||||||
void *config, size_t config_len, const struct spa_audio_info *info,
|
void *config, size_t config_len, const struct spa_audio_info *info,
|
||||||
void *props, size_t mtu)
|
void *props, size_t mtu)
|
||||||
{
|
{
|
||||||
|
|
@ -638,7 +638,7 @@ static int codec_decode(void *data,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_sbc = {
|
const struct media_codec a2dp_codec_sbc = {
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_SBC,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_SBC,
|
||||||
.codec_id = A2DP_CODEC_SBC,
|
.codec_id = A2DP_CODEC_SBC,
|
||||||
.name = "sbc",
|
.name = "sbc",
|
||||||
|
|
@ -660,7 +660,7 @@ const struct a2dp_codec a2dp_codec_sbc = {
|
||||||
.increase_bitpool = codec_increase_bitpool,
|
.increase_bitpool = codec_increase_bitpool,
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_sbc_xq = {
|
const struct media_codec a2dp_codec_sbc_xq = {
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_SBC_XQ,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_SBC_XQ,
|
||||||
.codec_id = A2DP_CODEC_SBC,
|
.codec_id = A2DP_CODEC_SBC,
|
||||||
.name = "sbc_xq",
|
.name = "sbc_xq",
|
||||||
|
|
@ -682,7 +682,7 @@ const struct a2dp_codec a2dp_codec_sbc_xq = {
|
||||||
.increase_bitpool = codec_increase_bitpool,
|
.increase_bitpool = codec_increase_bitpool,
|
||||||
};
|
};
|
||||||
|
|
||||||
A2DP_CODEC_EXPORT_DEF(
|
MEDIA_CODEC_EXPORT_DEF(
|
||||||
"sbc",
|
"sbc",
|
||||||
&a2dp_codec_sbc,
|
&a2dp_codec_sbc,
|
||||||
&a2dp_codec_sbc_xq
|
&a2dp_codec_sbc_xq
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -51,7 +51,7 @@
|
||||||
#include <spa/debug/pod.h>
|
#include <spa/debug/pod.h>
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "a2dp-codecs.h"
|
#include "media-codecs.h"
|
||||||
|
|
||||||
static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.device");
|
static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.device");
|
||||||
#undef SPA_LOG_TOPIC_DEFAULT
|
#undef SPA_LOG_TOPIC_DEFAULT
|
||||||
|
|
@ -140,7 +140,7 @@ struct impl {
|
||||||
unsigned int save_profile:1;
|
unsigned int save_profile:1;
|
||||||
uint32_t prev_bt_connected_profiles;
|
uint32_t prev_bt_connected_profiles;
|
||||||
|
|
||||||
const struct a2dp_codec **supported_codecs;
|
const struct media_codec **supported_codecs;
|
||||||
size_t supported_codec_count;
|
size_t supported_codec_count;
|
||||||
|
|
||||||
struct dynamic_node dyn_a2dp_source;
|
struct dynamic_node dyn_a2dp_source;
|
||||||
|
|
@ -167,9 +167,9 @@ static void init_node(struct impl *this, struct node *node, uint32_t id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_a2dp_codecs(struct impl *this, enum spa_bluetooth_audio_codec id, const struct a2dp_codec **codecs, size_t size)
|
static void get_media_codecs(struct impl *this, enum spa_bluetooth_audio_codec id, const struct media_codec **codecs, size_t size)
|
||||||
{
|
{
|
||||||
const struct a2dp_codec * const *c;
|
const struct media_codec * const *c;
|
||||||
|
|
||||||
spa_assert(size > 0);
|
spa_assert(size > 0);
|
||||||
spa_assert(this->supported_codecs);
|
spa_assert(this->supported_codecs);
|
||||||
|
|
@ -184,18 +184,18 @@ static void get_a2dp_codecs(struct impl *this, enum spa_bluetooth_audio_codec id
|
||||||
*codecs = NULL;
|
*codecs = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct a2dp_codec *get_supported_a2dp_codec(struct impl *this, enum spa_bluetooth_audio_codec id, size_t *idx)
|
static const struct media_codec *get_supported_media_codec(struct impl *this, enum spa_bluetooth_audio_codec id, size_t *idx)
|
||||||
{
|
{
|
||||||
const struct a2dp_codec *a2dp_codec = NULL;
|
const struct media_codec *media_codec = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < this->supported_codec_count; ++i) {
|
for (i = 0; i < this->supported_codec_count; ++i) {
|
||||||
if (this->supported_codecs[i]->id == id) {
|
if (this->supported_codecs[i]->id == id) {
|
||||||
a2dp_codec = this->supported_codecs[i];
|
media_codec = this->supported_codecs[i];
|
||||||
if (idx)
|
if (idx)
|
||||||
*idx = i;
|
*idx = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return a2dp_codec;
|
return media_codec;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int get_hfp_codec(enum spa_bluetooth_audio_codec id)
|
static unsigned int get_hfp_codec(enum spa_bluetooth_audio_codec id)
|
||||||
|
|
@ -245,10 +245,10 @@ static const char *get_hfp_codec_name(unsigned int codec)
|
||||||
|
|
||||||
static const char *get_codec_name(struct spa_bt_transport *t, bool a2dp_duplex)
|
static const char *get_codec_name(struct spa_bt_transport *t, bool a2dp_duplex)
|
||||||
{
|
{
|
||||||
if (t->a2dp_codec != NULL) {
|
if (t->media_codec != NULL) {
|
||||||
if (a2dp_duplex && t->a2dp_codec->duplex_codec)
|
if (a2dp_duplex && t->media_codec->duplex_codec)
|
||||||
return t->a2dp_codec->duplex_codec->name;
|
return t->media_codec->duplex_codec->name;
|
||||||
return t->a2dp_codec->name;
|
return t->media_codec->name;
|
||||||
}
|
}
|
||||||
return get_hfp_codec_name(t->codec);
|
return get_hfp_codec_name(t->codec);
|
||||||
}
|
}
|
||||||
|
|
@ -301,7 +301,7 @@ static void emit_info(struct impl *this, bool full);
|
||||||
|
|
||||||
static float get_soft_volume_boost(struct node *node)
|
static float get_soft_volume_boost(struct node *node)
|
||||||
{
|
{
|
||||||
const struct a2dp_codec *codec = node->transport ? node->transport->a2dp_codec : NULL;
|
const struct media_codec *codec = node->transport ? node->transport->media_codec : NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For A2DP duplex, the duplex microphone channel sometimes does not appear
|
* For A2DP duplex, the duplex microphone channel sometimes does not appear
|
||||||
|
|
@ -406,16 +406,16 @@ static const struct spa_bt_transport_events transport_events = {
|
||||||
|
|
||||||
static void get_channels(struct spa_bt_transport *t, bool a2dp_duplex, uint32_t *n_channels, uint32_t *channels)
|
static void get_channels(struct spa_bt_transport *t, bool a2dp_duplex, uint32_t *n_channels, uint32_t *channels)
|
||||||
{
|
{
|
||||||
const struct a2dp_codec *codec;
|
const struct media_codec *codec;
|
||||||
struct spa_audio_info info = { 0 };
|
struct spa_audio_info info = { 0 };
|
||||||
|
|
||||||
if (!a2dp_duplex || !t->a2dp_codec || !t->a2dp_codec->duplex_codec) {
|
if (!a2dp_duplex || !t->media_codec || !t->media_codec->duplex_codec) {
|
||||||
*n_channels = t->n_channels;
|
*n_channels = t->n_channels;
|
||||||
memcpy(channels, t->channels, t->n_channels * sizeof(uint32_t));
|
memcpy(channels, t->channels, t->n_channels * sizeof(uint32_t));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
codec = t->a2dp_codec->duplex_codec;
|
codec = t->media_codec->duplex_codec;
|
||||||
|
|
||||||
if (!codec->validate_config ||
|
if (!codec->validate_config ||
|
||||||
codec->validate_config(codec, 0,
|
codec->validate_config(codec, 0,
|
||||||
|
|
@ -514,7 +514,7 @@ static struct spa_bt_transport *find_transport(struct impl *this, int profile, e
|
||||||
|
|
||||||
spa_list_for_each(t, &device->transport_list, device_link) {
|
spa_list_for_each(t, &device->transport_list, device_link) {
|
||||||
bool codec_ok = codec == 0 ||
|
bool codec_ok = codec == 0 ||
|
||||||
(t->a2dp_codec != NULL && t->a2dp_codec->id == codec) ||
|
(t->media_codec != NULL && t->media_codec->id == codec) ||
|
||||||
get_hfp_codec_id(t->codec) == codec;
|
get_hfp_codec_id(t->codec) == codec;
|
||||||
|
|
||||||
if ((t->profile & device->connected_profiles) &&
|
if ((t->profile & device->connected_profiles) &&
|
||||||
|
|
@ -679,13 +679,13 @@ static int emit_nodes(struct impl *this)
|
||||||
if (this->bt_dev->connected_profiles & SPA_BT_PROFILE_A2DP_SOURCE) {
|
if (this->bt_dev->connected_profiles & SPA_BT_PROFILE_A2DP_SOURCE) {
|
||||||
t = find_transport(this, SPA_BT_PROFILE_A2DP_SOURCE, 0);
|
t = find_transport(this, SPA_BT_PROFILE_A2DP_SOURCE, 0);
|
||||||
if (t) {
|
if (t) {
|
||||||
this->props.codec = t->a2dp_codec->id;
|
this->props.codec = t->media_codec->id;
|
||||||
emit_dynamic_node(&this->dyn_a2dp_source, this, t,
|
emit_dynamic_node(&this->dyn_a2dp_source, this, t,
|
||||||
2, SPA_NAME_API_BLUEZ5_A2DP_SOURCE, false);
|
2, SPA_NAME_API_BLUEZ5_MEDIA_SOURCE, false);
|
||||||
|
|
||||||
if (t->a2dp_codec->duplex_codec) {
|
if (t->media_codec->duplex_codec) {
|
||||||
emit_dynamic_node(&this->dyn_a2dp_sink, this, t,
|
emit_dynamic_node(&this->dyn_a2dp_sink, this, t,
|
||||||
3, SPA_NAME_API_BLUEZ5_A2DP_SINK, true);
|
3, SPA_NAME_API_BLUEZ5_MEDIA_SINK, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -694,13 +694,13 @@ static int emit_nodes(struct impl *this)
|
||||||
if (this->bt_dev->connected_profiles & SPA_BT_PROFILE_A2DP_SOURCE) {
|
if (this->bt_dev->connected_profiles & SPA_BT_PROFILE_A2DP_SOURCE) {
|
||||||
t = find_transport(this, SPA_BT_PROFILE_A2DP_SOURCE, 0);
|
t = find_transport(this, SPA_BT_PROFILE_A2DP_SOURCE, 0);
|
||||||
if (t) {
|
if (t) {
|
||||||
this->props.codec = t->a2dp_codec->id;
|
this->props.codec = t->media_codec->id;
|
||||||
emit_dynamic_node(&this->dyn_a2dp_source, this, t,
|
emit_dynamic_node(&this->dyn_a2dp_source, this, t,
|
||||||
DEVICE_ID_SOURCE, SPA_NAME_API_BLUEZ5_A2DP_SOURCE, false);
|
DEVICE_ID_SOURCE, SPA_NAME_API_BLUEZ5_MEDIA_SOURCE, false);
|
||||||
|
|
||||||
if (t->a2dp_codec->duplex_codec) {
|
if (t->media_codec->duplex_codec) {
|
||||||
emit_node(this, t,
|
emit_node(this, t,
|
||||||
DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_A2DP_SINK, true);
|
DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_MEDIA_SINK, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -708,17 +708,17 @@ static int emit_nodes(struct impl *this)
|
||||||
if (this->bt_dev->connected_profiles & SPA_BT_PROFILE_A2DP_SINK) {
|
if (this->bt_dev->connected_profiles & SPA_BT_PROFILE_A2DP_SINK) {
|
||||||
t = find_transport(this, SPA_BT_PROFILE_A2DP_SINK, this->props.codec);
|
t = find_transport(this, SPA_BT_PROFILE_A2DP_SINK, this->props.codec);
|
||||||
if (t) {
|
if (t) {
|
||||||
this->props.codec = t->a2dp_codec->id;
|
this->props.codec = t->media_codec->id;
|
||||||
emit_node(this, t, DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_A2DP_SINK, false);
|
emit_node(this, t, DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_MEDIA_SOURCE, false);
|
||||||
|
|
||||||
if (t->a2dp_codec->duplex_codec) {
|
if (t->media_codec->duplex_codec) {
|
||||||
emit_node(this, t,
|
emit_node(this, t,
|
||||||
DEVICE_ID_SOURCE, SPA_NAME_API_BLUEZ5_A2DP_SOURCE, true);
|
DEVICE_ID_SOURCE, SPA_NAME_API_BLUEZ5_MEDIA_SINK, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_supported_a2dp_codec(this, this->props.codec, NULL) == NULL)
|
if (get_supported_media_codec(this, this->props.codec, NULL) == NULL)
|
||||||
this->props.codec = 0;
|
this->props.codec = 0;
|
||||||
break;
|
break;
|
||||||
case DEVICE_PROFILE_HSP_HFP:
|
case DEVICE_PROFILE_HSP_HFP:
|
||||||
|
|
@ -818,13 +818,13 @@ static int set_profile(struct impl *this, uint32_t profile, enum spa_bluetooth_a
|
||||||
*/
|
*/
|
||||||
if (profile == DEVICE_PROFILE_A2DP && !(this->bt_dev->connected_profiles & SPA_BT_PROFILE_A2DP_SOURCE)) {
|
if (profile == DEVICE_PROFILE_A2DP && !(this->bt_dev->connected_profiles & SPA_BT_PROFILE_A2DP_SOURCE)) {
|
||||||
int ret;
|
int ret;
|
||||||
const struct a2dp_codec *codecs[64];
|
const struct media_codec *codecs[64];
|
||||||
|
|
||||||
get_a2dp_codecs(this, codec, codecs, SPA_N_ELEMENTS(codecs));
|
get_media_codecs(this, codec, codecs, SPA_N_ELEMENTS(codecs));
|
||||||
|
|
||||||
this->switching_codec = true;
|
this->switching_codec = true;
|
||||||
|
|
||||||
ret = spa_bt_device_ensure_a2dp_codec(this->bt_dev, codecs);
|
ret = spa_bt_device_ensure_media_codec(this->bt_dev, codecs);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (ret != -ENOTSUP)
|
if (ret != -ENOTSUP)
|
||||||
spa_log_error(this->log, "failed to switch codec (%d), setting basic profile", ret);
|
spa_log_error(this->log, "failed to switch codec (%d), setting basic profile", ret);
|
||||||
|
|
@ -914,7 +914,7 @@ static void profiles_changed(void *userdata, uint32_t prev_profiles, uint32_t pr
|
||||||
|
|
||||||
if (this->bt_dev->connected_profiles & SPA_BT_PROFILE_A2DP_SINK) {
|
if (this->bt_dev->connected_profiles & SPA_BT_PROFILE_A2DP_SINK) {
|
||||||
free(this->supported_codecs);
|
free(this->supported_codecs);
|
||||||
this->supported_codecs = spa_bt_device_get_supported_a2dp_codecs(
|
this->supported_codecs = spa_bt_device_get_supported_media_codecs(
|
||||||
this->bt_dev, &this->supported_codec_count, true);
|
this->bt_dev, &this->supported_codec_count, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -930,7 +930,7 @@ static void profiles_changed(void *userdata, uint32_t prev_profiles, uint32_t pr
|
||||||
nodes_changed);
|
nodes_changed);
|
||||||
break;
|
break;
|
||||||
case DEVICE_PROFILE_A2DP:
|
case DEVICE_PROFILE_A2DP:
|
||||||
if (get_supported_a2dp_codec(this, this->props.codec, NULL) == NULL)
|
if (get_supported_media_codec(this, this->props.codec, NULL) == NULL)
|
||||||
this->props.codec = 0;
|
this->props.codec = 0;
|
||||||
nodes_changed = (connected_change & (SPA_BT_PROFILE_A2DP_SINK |
|
nodes_changed = (connected_change & (SPA_BT_PROFILE_A2DP_SINK |
|
||||||
SPA_BT_PROFILE_A2DP_SOURCE));
|
SPA_BT_PROFILE_A2DP_SOURCE));
|
||||||
|
|
@ -1019,15 +1019,15 @@ static uint32_t profile_direction_mask(struct impl *this, uint32_t index, enum s
|
||||||
struct spa_bt_device *device = this->bt_dev;
|
struct spa_bt_device *device = this->bt_dev;
|
||||||
uint32_t mask;
|
uint32_t mask;
|
||||||
bool have_output = false, have_input = false;
|
bool have_output = false, have_input = false;
|
||||||
const struct a2dp_codec *a2dp_codec;
|
const struct media_codec *media_codec;
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case DEVICE_PROFILE_A2DP:
|
case DEVICE_PROFILE_A2DP:
|
||||||
if (device->connected_profiles & SPA_BT_PROFILE_A2DP_SINK)
|
if (device->connected_profiles & SPA_BT_PROFILE_A2DP_SINK)
|
||||||
have_output = true;
|
have_output = true;
|
||||||
|
|
||||||
a2dp_codec = get_supported_a2dp_codec(this, codec, NULL);
|
media_codec = get_supported_media_codec(this, codec, NULL);
|
||||||
if (a2dp_codec && a2dp_codec->duplex_codec)
|
if (media_codec && media_codec->duplex_codec)
|
||||||
have_input = true;
|
have_input = true;
|
||||||
break;
|
break;
|
||||||
case DEVICE_PROFILE_HSP_HFP:
|
case DEVICE_PROFILE_HSP_HFP:
|
||||||
|
|
@ -1129,7 +1129,7 @@ static void set_initial_profile(struct impl *this)
|
||||||
|
|
||||||
if (this->supported_codecs)
|
if (this->supported_codecs)
|
||||||
free(this->supported_codecs);
|
free(this->supported_codecs);
|
||||||
this->supported_codecs = spa_bt_device_get_supported_a2dp_codecs(
|
this->supported_codecs = spa_bt_device_get_supported_media_codecs(
|
||||||
this->bt_dev, &this->supported_codec_count, true);
|
this->bt_dev, &this->supported_codec_count, true);
|
||||||
|
|
||||||
/* Prefer A2DP, then HFP, then null, but select AG if the device
|
/* Prefer A2DP, then HFP, then null, but select AG if the device
|
||||||
|
|
@ -1152,7 +1152,7 @@ static void set_initial_profile(struct impl *this)
|
||||||
if (t) {
|
if (t) {
|
||||||
this->profile = (i == SPA_BT_PROFILE_A2DP_SOURCE) ?
|
this->profile = (i == SPA_BT_PROFILE_A2DP_SOURCE) ?
|
||||||
DEVICE_PROFILE_AG : DEVICE_PROFILE_A2DP;
|
DEVICE_PROFILE_AG : DEVICE_PROFILE_A2DP;
|
||||||
this->props.codec = t->a2dp_codec->id;
|
this->props.codec = t->media_codec->id;
|
||||||
spa_log_debug(this->log, "initial profile A2DP profile:%d codec:%d",
|
spa_log_debug(this->log, "initial profile A2DP profile:%d codec:%d",
|
||||||
this->profile, this->props.codec);
|
this->profile, this->props.codec);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1213,19 +1213,19 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder *
|
||||||
n_sink++;
|
n_sink++;
|
||||||
if (codec) {
|
if (codec) {
|
||||||
size_t idx;
|
size_t idx;
|
||||||
const struct a2dp_codec *a2dp_codec = get_supported_a2dp_codec(this, codec, &idx);
|
const struct media_codec *media_codec = get_supported_media_codec(this, codec, &idx);
|
||||||
if (a2dp_codec == NULL) {
|
if (media_codec == NULL) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
name_and_codec = spa_aprintf("%s-%s", name, a2dp_codec->name);
|
name_and_codec = spa_aprintf("%s-%s", name, media_codec->name);
|
||||||
name = name_and_codec;
|
name = name_and_codec;
|
||||||
if (profile == SPA_BT_PROFILE_A2DP_SINK && !a2dp_codec->duplex_codec) {
|
if (profile == SPA_BT_PROFILE_A2DP_SINK && !media_codec->duplex_codec) {
|
||||||
desc_and_codec = spa_aprintf(_("High Fidelity Playback (A2DP Sink, codec %s)"),
|
desc_and_codec = spa_aprintf(_("High Fidelity Playback (A2DP Sink, codec %s)"),
|
||||||
a2dp_codec->description);
|
media_codec->description);
|
||||||
} else {
|
} else {
|
||||||
desc_and_codec = spa_aprintf(_("High Fidelity Duplex (A2DP Source/Sink, codec %s)"),
|
desc_and_codec = spa_aprintf(_("High Fidelity Duplex (A2DP Source/Sink, codec %s)"),
|
||||||
a2dp_codec->description);
|
media_codec->description);
|
||||||
|
|
||||||
}
|
}
|
||||||
desc = desc_and_codec;
|
desc = desc_and_codec;
|
||||||
|
|
@ -1560,7 +1560,7 @@ static struct spa_pod *build_route(struct impl *this, struct spa_pod_builder *b,
|
||||||
return spa_pod_builder_pop(b, &f[0]);
|
return spa_pod_builder_pop(b, &f[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool iterate_supported_a2dp_codecs(struct impl *this, int *j, const struct a2dp_codec **codec)
|
static bool iterate_supported_media_codecs(struct impl *this, int *j, const struct media_codec **codec)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -1582,12 +1582,12 @@ static struct spa_pod *build_prop_info(struct impl *this, struct spa_pod_builder
|
||||||
{
|
{
|
||||||
struct spa_pod_frame f[2];
|
struct spa_pod_frame f[2];
|
||||||
struct spa_pod_choice *choice;
|
struct spa_pod_choice *choice;
|
||||||
const struct a2dp_codec *codec;
|
const struct media_codec *codec;
|
||||||
size_t n;
|
size_t n;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
#define FOR_EACH_A2DP_CODEC(j, codec) \
|
#define FOR_EACH_A2DP_CODEC(j, codec) \
|
||||||
for (j = -1; iterate_supported_a2dp_codecs(this, &j, &codec);)
|
for (j = -1; iterate_supported_media_codecs(this, &j, &codec);)
|
||||||
#define FOR_EACH_HFP_CODEC(j) \
|
#define FOR_EACH_HFP_CODEC(j) \
|
||||||
for (j = HFP_AUDIO_CODEC_MSBC; j >= HFP_AUDIO_CODEC_CVSD; --j) \
|
for (j = HFP_AUDIO_CODEC_MSBC; j >= HFP_AUDIO_CODEC_CVSD; --j) \
|
||||||
if (spa_bt_device_supports_hfp_codec(this->bt_dev, j) == 1)
|
if (spa_bt_device_supports_hfp_codec(this->bt_dev, j) == 1)
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "codec-loader.h"
|
#include "codec-loader.h"
|
||||||
|
|
||||||
#define A2DP_CODEC_LIB_BASE "bluez5/libspa-codec-bluez5-"
|
#define MEDIA_CODEC_LIB_BASE "bluez5/libspa-codec-bluez5-"
|
||||||
|
|
||||||
/* AVDTP allows 0x3E endpoints, can't have more codecs than that */
|
/* AVDTP allows 0x3E endpoints, can't have more codecs than that */
|
||||||
#define MAX_CODECS 0x3E
|
#define MAX_CODECS 0x3E
|
||||||
|
|
@ -40,7 +40,7 @@ static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.codecs");
|
||||||
#define SPA_LOG_TOPIC_DEFAULT &log_topic
|
#define SPA_LOG_TOPIC_DEFAULT &log_topic
|
||||||
|
|
||||||
struct impl {
|
struct impl {
|
||||||
const struct a2dp_codec *codecs[MAX_CODECS + 1];
|
const struct media_codec *codecs[MAX_CODECS + 1];
|
||||||
struct spa_handle *handles[MAX_HANDLES];
|
struct spa_handle *handles[MAX_HANDLES];
|
||||||
size_t n_codecs;
|
size_t n_codecs;
|
||||||
size_t n_handles;
|
size_t n_handles;
|
||||||
|
|
@ -48,7 +48,7 @@ struct impl {
|
||||||
struct spa_log *log;
|
struct spa_log *log;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int codec_order(const struct a2dp_codec *c)
|
static int codec_order(const struct media_codec *c)
|
||||||
{
|
{
|
||||||
static const enum spa_bluetooth_audio_codec order[] = {
|
static const enum spa_bluetooth_audio_codec order[] = {
|
||||||
SPA_BLUETOOTH_AUDIO_CODEC_LDAC,
|
SPA_BLUETOOTH_AUDIO_CODEC_LDAC,
|
||||||
|
|
@ -78,8 +78,8 @@ static int codec_order(const struct a2dp_codec *c)
|
||||||
|
|
||||||
static int codec_order_cmp(const void *a, const void *b)
|
static int codec_order_cmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const struct a2dp_codec * const *ca = a;
|
const struct media_codec * const *ca = a;
|
||||||
const struct a2dp_codec * const *cb = b;
|
const struct media_codec * const *cb = b;
|
||||||
int ia = codec_order(*ca);
|
int ia = codec_order(*ca);
|
||||||
int ib = codec_order(*cb);
|
int ib = codec_order(*cb);
|
||||||
if (*ca == *cb)
|
if (*ca == *cb)
|
||||||
|
|
@ -87,7 +87,7 @@ static int codec_order_cmp(const void *a, const void *b)
|
||||||
return (ia == ib) ? (*ca < *cb ? -1 : 1) : ia - ib;
|
return (ia == ib) ? (*ca < *cb ? -1 : 1) : ia - ib;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int load_a2dp_codecs_from(struct impl *impl, const char *factory_name, const char *libname)
|
static int load_media_codecs_from(struct impl *impl, const char *factory_name, const char *libname)
|
||||||
{
|
{
|
||||||
struct spa_handle *handle = NULL;
|
struct spa_handle *handle = NULL;
|
||||||
void *iface;
|
void *iface;
|
||||||
|
|
@ -108,7 +108,7 @@ static int load_a2dp_codecs_from(struct impl *impl, const char *factory_name, co
|
||||||
|
|
||||||
spa_log_debug(impl->log, "loading codecs from %s", factory_name);
|
spa_log_debug(impl->log, "loading codecs from %s", factory_name);
|
||||||
|
|
||||||
if ((res = spa_handle_get_interface(handle, SPA_TYPE_INTERFACE_Bluez5CodecA2DP, &iface)) < 0) {
|
if ((res = spa_handle_get_interface(handle, SPA_TYPE_INTERFACE_Bluez5CodecMedia, &iface)) < 0) {
|
||||||
spa_log_warn(impl->log, "Bluetooth codec plugin %s has no codec interface",
|
spa_log_warn(impl->log, "Bluetooth codec plugin %s has no codec interface",
|
||||||
factory_name);
|
factory_name);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
@ -116,15 +116,15 @@ static int load_a2dp_codecs_from(struct impl *impl, const char *factory_name, co
|
||||||
|
|
||||||
bluez5_codec_a2dp = iface;
|
bluez5_codec_a2dp = iface;
|
||||||
|
|
||||||
if (bluez5_codec_a2dp->iface.version != SPA_VERSION_BLUEZ5_CODEC_A2DP) {
|
if (bluez5_codec_a2dp->iface.version != SPA_VERSION_BLUEZ5_CODEC_MEDIA) {
|
||||||
spa_log_warn(impl->log, "codec plugin %s has incompatible ABI version (%d != %d)",
|
spa_log_warn(impl->log, "codec plugin %s has incompatible ABI version (%d != %d)",
|
||||||
factory_name, bluez5_codec_a2dp->iface.version, SPA_VERSION_BLUEZ5_CODEC_A2DP);
|
factory_name, bluez5_codec_a2dp->iface.version, SPA_VERSION_BLUEZ5_CODEC_MEDIA);
|
||||||
res = -ENOENT;
|
res = -ENOENT;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; bluez5_codec_a2dp->codecs[i]; ++i) {
|
for (i = 0; bluez5_codec_a2dp->codecs[i]; ++i) {
|
||||||
const struct a2dp_codec *c = bluez5_codec_a2dp->codecs[i];
|
const struct media_codec *c = bluez5_codec_a2dp->codecs[i];
|
||||||
size_t j;
|
size_t j;
|
||||||
|
|
||||||
if (impl->n_codecs >= MAX_CODECS) {
|
if (impl->n_codecs >= MAX_CODECS) {
|
||||||
|
|
@ -134,14 +134,14 @@ static int load_a2dp_codecs_from(struct impl *impl, const char *factory_name, co
|
||||||
|
|
||||||
/* Don't load duplicate endpoints */
|
/* Don't load duplicate endpoints */
|
||||||
for (j = 0; j < impl->n_codecs; ++j) {
|
for (j = 0; j < impl->n_codecs; ++j) {
|
||||||
const struct a2dp_codec *c2 = impl->codecs[j];
|
const struct media_codec *c2 = impl->codecs[j];
|
||||||
const char *ep1 = c->endpoint_name ? c->endpoint_name : c->name;
|
const char *ep1 = c->endpoint_name ? c->endpoint_name : c->name;
|
||||||
const char *ep2 = c2->endpoint_name ? c2->endpoint_name : c2->name;
|
const char *ep2 = c2->endpoint_name ? c2->endpoint_name : c2->name;
|
||||||
if (spa_streq(ep1, ep2))
|
if (spa_streq(ep1, ep2))
|
||||||
goto next_codec;
|
goto next_codec;
|
||||||
}
|
}
|
||||||
|
|
||||||
spa_log_debug(impl->log, "loaded A2DP codec %s from %s", c->name, factory_name);
|
spa_log_debug(impl->log, "loaded media codec %s from %s", c->name, factory_name);
|
||||||
|
|
||||||
if (c->set_log)
|
if (c->set_log)
|
||||||
c->set_log(impl->log);
|
c->set_log(impl->log);
|
||||||
|
|
@ -166,22 +166,22 @@ fail:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct a2dp_codec * const *load_a2dp_codecs(struct spa_plugin_loader *loader, struct spa_log *log)
|
const struct media_codec * const *load_media_codecs(struct spa_plugin_loader *loader, struct spa_log *log)
|
||||||
{
|
{
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
bool has_sbc;
|
bool has_sbc;
|
||||||
size_t i;
|
size_t i;
|
||||||
const struct { const char *factory; const char *lib; } plugins[] = {
|
const struct { const char *factory; const char *lib; } plugins[] = {
|
||||||
#define A2DP_CODEC_FACTORY_LIB(basename) \
|
#define MEDIA_CODEC_FACTORY_LIB(basename) \
|
||||||
{ A2DP_CODEC_FACTORY_NAME(basename), A2DP_CODEC_LIB_BASE basename }
|
{ MEDIA_CODEC_FACTORY_NAME(basename), MEDIA_CODEC_LIB_BASE basename }
|
||||||
A2DP_CODEC_FACTORY_LIB("aac"),
|
MEDIA_CODEC_FACTORY_LIB("aac"),
|
||||||
A2DP_CODEC_FACTORY_LIB("aptx"),
|
MEDIA_CODEC_FACTORY_LIB("aptx"),
|
||||||
A2DP_CODEC_FACTORY_LIB("faststream"),
|
MEDIA_CODEC_FACTORY_LIB("faststream"),
|
||||||
A2DP_CODEC_FACTORY_LIB("ldac"),
|
MEDIA_CODEC_FACTORY_LIB("ldac"),
|
||||||
A2DP_CODEC_FACTORY_LIB("sbc"),
|
MEDIA_CODEC_FACTORY_LIB("sbc"),
|
||||||
A2DP_CODEC_FACTORY_LIB("lc3plus"),
|
MEDIA_CODEC_FACTORY_LIB("lc3plus"),
|
||||||
A2DP_CODEC_FACTORY_LIB("opus")
|
MEDIA_CODEC_FACTORY_LIB("opus")
|
||||||
#undef A2DP_CODEC_FACTORY_LIB
|
#undef MEDIA_CODEC_FACTORY_LIB
|
||||||
};
|
};
|
||||||
|
|
||||||
impl = calloc(sizeof(struct impl), 1);
|
impl = calloc(sizeof(struct impl), 1);
|
||||||
|
|
@ -194,7 +194,7 @@ const struct a2dp_codec * const *load_a2dp_codecs(struct spa_plugin_loader *load
|
||||||
spa_log_topic_init(impl->log, &log_topic);
|
spa_log_topic_init(impl->log, &log_topic);
|
||||||
|
|
||||||
for (i = 0; i < SPA_N_ELEMENTS(plugins); ++i)
|
for (i = 0; i < SPA_N_ELEMENTS(plugins); ++i)
|
||||||
load_a2dp_codecs_from(impl, plugins[i].factory, plugins[i].lib);
|
load_media_codecs_from(impl, plugins[i].factory, plugins[i].lib);
|
||||||
|
|
||||||
has_sbc = false;
|
has_sbc = false;
|
||||||
for (i = 0; i < impl->n_codecs; ++i)
|
for (i = 0; i < impl->n_codecs; ++i)
|
||||||
|
|
@ -203,19 +203,19 @@ const struct a2dp_codec * const *load_a2dp_codecs(struct spa_plugin_loader *load
|
||||||
|
|
||||||
if (!has_sbc) {
|
if (!has_sbc) {
|
||||||
spa_log_error(impl->log, "failed to load A2DP SBC codec from plugins");
|
spa_log_error(impl->log, "failed to load A2DP SBC codec from plugins");
|
||||||
free_a2dp_codecs(impl->codecs);
|
free_media_codecs(impl->codecs);
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
qsort(impl->codecs, impl->n_codecs, sizeof(const struct a2dp_codec *), codec_order_cmp);
|
qsort(impl->codecs, impl->n_codecs, sizeof(const struct media_codec *), codec_order_cmp);
|
||||||
|
|
||||||
return impl->codecs;
|
return impl->codecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_a2dp_codecs(const struct a2dp_codec * const *a2dp_codecs)
|
void free_media_codecs(const struct media_codec * const *media_codecs)
|
||||||
{
|
{
|
||||||
struct impl *impl = SPA_CONTAINER_OF(a2dp_codecs, struct impl, codecs);
|
struct impl *impl = SPA_CONTAINER_OF(media_codecs, struct impl, codecs);
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < impl->n_handles; ++i)
|
for (i = 0; i < impl->n_handles; ++i)
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@
|
||||||
#include <spa/support/plugin-loader.h>
|
#include <spa/support/plugin-loader.h>
|
||||||
|
|
||||||
#include "a2dp-codec-caps.h"
|
#include "a2dp-codec-caps.h"
|
||||||
#include "a2dp-codecs.h"
|
#include "media-codecs.h"
|
||||||
|
|
||||||
const struct a2dp_codec * const *load_a2dp_codecs(struct spa_plugin_loader *loader, struct spa_log *log);
|
const struct media_codec * const *load_media_codecs(struct spa_plugin_loader *loader, struct spa_log *log);
|
||||||
void free_a2dp_codecs(const struct a2dp_codec * const *a2dp_codecs);
|
void free_media_codecs(const struct media_codec * const *media_codecs);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -158,9 +158,9 @@ extern "C" {
|
||||||
#define HFP_AUDIO_CODEC_CVSD 0x01
|
#define HFP_AUDIO_CODEC_CVSD 0x01
|
||||||
#define HFP_AUDIO_CODEC_MSBC 0x02
|
#define HFP_AUDIO_CODEC_MSBC 0x02
|
||||||
|
|
||||||
#define A2DP_OBJECT_MANAGER_PATH "/MediaEndpoint"
|
#define MEDIA_OBJECT_MANAGER_PATH "/MediaEndpoint"
|
||||||
#define A2DP_SINK_ENDPOINT A2DP_OBJECT_MANAGER_PATH "/A2DPSink"
|
#define A2DP_SINK_ENDPOINT MEDIA_OBJECT_MANAGER_PATH "/A2DPSink"
|
||||||
#define A2DP_SOURCE_ENDPOINT A2DP_OBJECT_MANAGER_PATH "/A2DPSource"
|
#define A2DP_SOURCE_ENDPOINT MEDIA_OBJECT_MANAGER_PATH "/A2DPSource"
|
||||||
|
|
||||||
#define SPA_BT_UNKNOWN_DELAY 0
|
#define SPA_BT_UNKNOWN_DELAY 0
|
||||||
|
|
||||||
|
|
@ -412,7 +412,7 @@ static inline enum spa_bt_form_factor spa_bt_form_factor_from_class(uint32_t blu
|
||||||
return SPA_BT_FORM_FACTOR_UNKNOWN;
|
return SPA_BT_FORM_FACTOR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct spa_bt_a2dp_codec_switch;
|
struct spa_bt_media_codec_switch;
|
||||||
struct spa_bt_transport;
|
struct spa_bt_transport;
|
||||||
|
|
||||||
struct spa_bt_device_events {
|
struct spa_bt_device_events {
|
||||||
|
|
@ -482,16 +482,16 @@ struct spa_bt_device {
|
||||||
DBusPendingCall *battery_pending_call;
|
DBusPendingCall *battery_pending_call;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct a2dp_codec;
|
struct media_codec;
|
||||||
|
|
||||||
struct spa_bt_device *spa_bt_device_find(struct spa_bt_monitor *monitor, const char *path);
|
struct spa_bt_device *spa_bt_device_find(struct spa_bt_monitor *monitor, const char *path);
|
||||||
struct spa_bt_device *spa_bt_device_find_by_address(struct spa_bt_monitor *monitor, const char *remote_address, const char *local_address);
|
struct spa_bt_device *spa_bt_device_find_by_address(struct spa_bt_monitor *monitor, const char *remote_address, const char *local_address);
|
||||||
int spa_bt_device_add_profile(struct spa_bt_device *device, enum spa_bt_profile profile);
|
int spa_bt_device_add_profile(struct spa_bt_device *device, enum spa_bt_profile profile);
|
||||||
int spa_bt_device_connect_profile(struct spa_bt_device *device, enum spa_bt_profile profile);
|
int spa_bt_device_connect_profile(struct spa_bt_device *device, enum spa_bt_profile profile);
|
||||||
int spa_bt_device_check_profiles(struct spa_bt_device *device, bool force);
|
int spa_bt_device_check_profiles(struct spa_bt_device *device, bool force);
|
||||||
int spa_bt_device_ensure_a2dp_codec(struct spa_bt_device *device, const struct a2dp_codec * const *codecs);
|
int spa_bt_device_ensure_media_codec(struct spa_bt_device *device, const struct media_codec * const *codecs);
|
||||||
bool spa_bt_device_supports_a2dp_codec(struct spa_bt_device *device, const struct a2dp_codec *codec, bool sink);
|
bool spa_bt_device_supports_media_codec(struct spa_bt_device *device, const struct media_codec *codec, bool sink);
|
||||||
const struct a2dp_codec **spa_bt_device_get_supported_a2dp_codecs(struct spa_bt_device *device, size_t *count, bool sink);
|
const struct media_codec **spa_bt_device_get_supported_media_codecs(struct spa_bt_device *device, size_t *count, bool sink);
|
||||||
int spa_bt_device_ensure_hfp_codec(struct spa_bt_device *device, unsigned int codec);
|
int spa_bt_device_ensure_hfp_codec(struct spa_bt_device *device, unsigned int codec);
|
||||||
int spa_bt_device_supports_hfp_codec(struct spa_bt_device *device, unsigned int codec);
|
int spa_bt_device_supports_hfp_codec(struct spa_bt_device *device, unsigned int codec);
|
||||||
int spa_bt_device_release_transports(struct spa_bt_device *device);
|
int spa_bt_device_release_transports(struct spa_bt_device *device);
|
||||||
|
|
@ -570,7 +570,7 @@ struct spa_bt_transport {
|
||||||
struct spa_list device_link;
|
struct spa_list device_link;
|
||||||
enum spa_bt_profile profile;
|
enum spa_bt_profile profile;
|
||||||
enum spa_bt_transport_state state;
|
enum spa_bt_transport_state state;
|
||||||
const struct a2dp_codec *a2dp_codec;
|
const struct media_codec *media_codec;
|
||||||
unsigned int codec;
|
unsigned int codec;
|
||||||
void *configuration;
|
void *configuration;
|
||||||
int configuration_len;
|
int configuration_len;
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
#include <spa/utils/string.h>
|
#include <spa/utils/string.h>
|
||||||
|
|
||||||
#include "a2dp-codecs.h"
|
#include "media-codecs.h"
|
||||||
|
|
||||||
int a2dp_codec_select_config(const struct a2dp_codec_config configs[], size_t n,
|
int media_codec_select_config(const struct media_codec_config configs[], size_t n,
|
||||||
uint32_t cap, int preferred_value)
|
uint32_t cap, int preferred_value)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
@ -60,9 +60,9 @@ int a2dp_codec_select_config(const struct a2dp_codec_config configs[], size_t n,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool a2dp_codec_check_caps(const struct a2dp_codec *codec, unsigned int codec_id,
|
bool media_codec_check_caps(const struct media_codec *codec, unsigned int codec_id,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct a2dp_codec_audio_info *info,
|
const struct media_codec_audio_info *info,
|
||||||
const struct spa_dict *global_settings)
|
const struct spa_dict *global_settings)
|
||||||
{
|
{
|
||||||
uint8_t config[A2DP_MAX_CAPS_SIZE];
|
uint8_t config[A2DP_MAX_CAPS_SIZE];
|
||||||
|
|
@ -98,7 +98,7 @@ impl_get_interface(struct spa_handle *handle, const char *type, void **interface
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
if (spa_streq(type, SPA_TYPE_INTERFACE_Bluez5CodecA2DP))
|
if (spa_streq(type, SPA_TYPE_INTERFACE_Bluez5CodecMedia))
|
||||||
*interface = &this->bluez5_codec_a2dp;
|
*interface = &this->bluez5_codec_a2dp;
|
||||||
else
|
else
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -136,10 +136,10 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this = (struct impl *) handle;
|
this = (struct impl *) handle;
|
||||||
|
|
||||||
this->bluez5_codec_a2dp.codecs = codec_plugin_a2dp_codecs;
|
this->bluez5_codec_a2dp.codecs = codec_plugin_media_codecs;
|
||||||
this->bluez5_codec_a2dp.iface = SPA_INTERFACE_INIT(
|
this->bluez5_codec_a2dp.iface = SPA_INTERFACE_INIT(
|
||||||
SPA_TYPE_INTERFACE_Bluez5CodecA2DP,
|
SPA_TYPE_INTERFACE_Bluez5CodecMedia,
|
||||||
SPA_VERSION_BLUEZ5_CODEC_A2DP,
|
SPA_VERSION_BLUEZ5_CODEC_MEDIA,
|
||||||
NULL,
|
NULL,
|
||||||
this);
|
this);
|
||||||
|
|
||||||
|
|
@ -147,7 +147,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct spa_interface_info impl_interfaces[] = {
|
static const struct spa_interface_info impl_interfaces[] = {
|
||||||
{SPA_TYPE_INTERFACE_Bluez5CodecA2DP,},
|
{SPA_TYPE_INTERFACE_Bluez5CodecMedia,},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -42,28 +42,28 @@
|
||||||
* when any of the structs or semantics change.
|
* when any of the structs or semantics change.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SPA_TYPE_INTERFACE_Bluez5CodecA2DP SPA_TYPE_INFO_INTERFACE_BASE "Bluez5:Codec:A2DP:Private"
|
#define SPA_TYPE_INTERFACE_Bluez5CodecMedia SPA_TYPE_INFO_INTERFACE_BASE "Bluez5:Codec:Media:Private"
|
||||||
|
|
||||||
#define SPA_VERSION_BLUEZ5_CODEC_A2DP 5
|
#define SPA_VERSION_BLUEZ5_CODEC_MEDIA 5
|
||||||
|
|
||||||
struct spa_bluez5_codec_a2dp {
|
struct spa_bluez5_codec_a2dp {
|
||||||
struct spa_interface iface;
|
struct spa_interface iface;
|
||||||
const struct a2dp_codec * const *codecs; /**< NULL terminated array */
|
const struct media_codec * const *codecs; /**< NULL terminated array */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define A2DP_CODEC_FACTORY_NAME(basename) (SPA_NAME_API_CODEC_BLUEZ5_A2DP "." basename)
|
#define MEDIA_CODEC_FACTORY_NAME(basename) (SPA_NAME_API_CODEC_BLUEZ5_MEDIA "." basename)
|
||||||
|
|
||||||
#ifdef CODEC_PLUGIN
|
#ifdef CODEC_PLUGIN
|
||||||
#define A2DP_CODEC_EXPORT_DEF(basename,...) \
|
#define MEDIA_CODEC_EXPORT_DEF(basename,...) \
|
||||||
const char *codec_plugin_factory_name = A2DP_CODEC_FACTORY_NAME(basename); \
|
const char *codec_plugin_factory_name = MEDIA_CODEC_FACTORY_NAME(basename); \
|
||||||
static const struct a2dp_codec * const codec_plugin_a2dp_codec_list[] = { __VA_ARGS__, NULL }; \
|
static const struct media_codec * const codec_plugin_media_codec_list[] = { __VA_ARGS__, NULL }; \
|
||||||
const struct a2dp_codec * const * const codec_plugin_a2dp_codecs = codec_plugin_a2dp_codec_list;
|
const struct media_codec * const * const codec_plugin_media_codecs = codec_plugin_media_codec_list;
|
||||||
|
|
||||||
extern const struct a2dp_codec * const * const codec_plugin_a2dp_codecs;
|
extern const struct media_codec * const * const codec_plugin_media_codecs;
|
||||||
extern const char *codec_plugin_factory_name;
|
extern const char *codec_plugin_factory_name;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define A2DP_CODEC_FLAG_SINK (1 << 0)
|
#define MEDIA_CODEC_FLAG_SINK (1 << 0)
|
||||||
|
|
||||||
#define A2DP_CODEC_DEFAULT_RATE 48000
|
#define A2DP_CODEC_DEFAULT_RATE 48000
|
||||||
#define A2DP_CODEC_DEFAULT_CHANNELS 2
|
#define A2DP_CODEC_DEFAULT_CHANNELS 2
|
||||||
|
|
@ -74,12 +74,12 @@ enum {
|
||||||
NEED_FLUSH_FRAGMENT = 2,
|
NEED_FLUSH_FRAGMENT = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct a2dp_codec_audio_info {
|
struct media_codec_audio_info {
|
||||||
uint32_t rate;
|
uint32_t rate;
|
||||||
uint32_t channels;
|
uint32_t channels;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct a2dp_codec {
|
struct media_codec {
|
||||||
enum spa_bluetooth_audio_codec id;
|
enum spa_bluetooth_audio_codec id;
|
||||||
uint8_t codec_id;
|
uint8_t codec_id;
|
||||||
a2dp_vendor_codec_t vendor;
|
a2dp_vendor_codec_t vendor;
|
||||||
|
|
@ -91,18 +91,20 @@ struct a2dp_codec {
|
||||||
|
|
||||||
const size_t send_buf_size;
|
const size_t send_buf_size;
|
||||||
|
|
||||||
const struct a2dp_codec *duplex_codec; /**< Codec for non-standard A2DP duplex channel */
|
const struct media_codec *duplex_codec; /**< Codec for non-standard A2DP duplex channel */
|
||||||
|
|
||||||
int (*fill_caps) (const struct a2dp_codec *codec, uint32_t flags,
|
struct spa_log *log;
|
||||||
|
|
||||||
|
int (*fill_caps) (const struct media_codec *codec, uint32_t flags,
|
||||||
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 media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
const struct a2dp_codec_audio_info *info,
|
const struct media_codec_audio_info *info,
|
||||||
const struct spa_dict *global_settings, uint8_t config[A2DP_MAX_CAPS_SIZE]);
|
const struct spa_dict *global_settings, uint8_t config[A2DP_MAX_CAPS_SIZE]);
|
||||||
int (*enum_config) (const struct a2dp_codec *codec, uint32_t flags,
|
int (*enum_config) (const struct media_codec *codec, uint32_t flags,
|
||||||
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);
|
||||||
int (*validate_config) (const struct a2dp_codec *codec, uint32_t flags,
|
int (*validate_config) (const struct media_codec *codec, uint32_t flags,
|
||||||
const void *caps, size_t caps_size,
|
const void *caps, size_t caps_size,
|
||||||
struct spa_audio_info *info);
|
struct spa_audio_info *info);
|
||||||
|
|
||||||
|
|
@ -111,17 +113,17 @@ struct a2dp_codec {
|
||||||
* The caps handed in correspond to this codec_id, but are
|
* The caps handed in correspond to this codec_id, but are
|
||||||
* otherwise not checked beforehand.
|
* otherwise not checked beforehand.
|
||||||
*/
|
*/
|
||||||
int (*caps_preference_cmp) (const struct a2dp_codec *codec, uint32_t flags, const void *caps1, size_t caps1_size,
|
int (*caps_preference_cmp) (const struct media_codec *codec, uint32_t flags, const void *caps1, size_t caps1_size,
|
||||||
const void *caps2, size_t caps2_size, const struct a2dp_codec_audio_info *info,
|
const void *caps2, size_t caps2_size, const struct media_codec_audio_info *info,
|
||||||
const struct spa_dict *global_settings);
|
const struct spa_dict *global_settings);
|
||||||
|
|
||||||
void *(*init_props) (const struct a2dp_codec *codec, uint32_t flags, const struct spa_dict *settings);
|
void *(*init_props) (const struct media_codec *codec, uint32_t flags, const struct spa_dict *settings);
|
||||||
void (*clear_props) (void *);
|
void (*clear_props) (void *);
|
||||||
int (*enum_props) (void *props, const struct spa_dict *settings, uint32_t id, uint32_t idx,
|
int (*enum_props) (void *props, const struct spa_dict *settings, uint32_t id, uint32_t idx,
|
||||||
struct spa_pod_builder *builder, struct spa_pod **param);
|
struct spa_pod_builder *builder, struct spa_pod **param);
|
||||||
int (*set_props) (void *props, const struct spa_pod *param);
|
int (*set_props) (void *props, const struct spa_pod *param);
|
||||||
|
|
||||||
void *(*init) (const struct a2dp_codec *codec, uint32_t flags, void *config, size_t config_size,
|
void *(*init) (const struct media_codec *codec, uint32_t flags, void *config, size_t config_size,
|
||||||
const struct spa_audio_info *info, void *props, size_t mtu);
|
const struct spa_audio_info *info, void *props, size_t mtu);
|
||||||
void (*deinit) (void *data);
|
void (*deinit) (void *data);
|
||||||
|
|
||||||
|
|
@ -151,17 +153,17 @@ struct a2dp_codec {
|
||||||
void (*set_log) (struct spa_log *global_log);
|
void (*set_log) (struct spa_log *global_log);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct a2dp_codec_config {
|
struct media_codec_config {
|
||||||
uint32_t config;
|
uint32_t config;
|
||||||
int value;
|
int value;
|
||||||
unsigned int priority;
|
unsigned int priority;
|
||||||
};
|
};
|
||||||
|
|
||||||
int a2dp_codec_select_config(const struct a2dp_codec_config configs[], size_t n,
|
int media_codec_select_config(const struct media_codec_config configs[], size_t n,
|
||||||
uint32_t cap, int preferred_value);
|
uint32_t cap, int preferred_value);
|
||||||
|
|
||||||
bool a2dp_codec_check_caps(const struct a2dp_codec *codec, unsigned int codec_id,
|
bool media_codec_check_caps(const struct media_codec *codec, unsigned int codec_id,
|
||||||
const void *caps, size_t caps_size, const struct a2dp_codec_audio_info *info,
|
const void *caps, size_t caps_size, const struct media_codec_audio_info *info,
|
||||||
const struct spa_dict *global_settings);
|
const struct spa_dict *global_settings);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* Spa A2DP Sink
|
/* Spa Media Sink
|
||||||
*
|
*
|
||||||
* Copyright © 2018 Wim Taymans
|
* Copyright © 2018 Wim Taymans
|
||||||
*
|
*
|
||||||
|
|
@ -53,9 +53,9 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "rtp.h"
|
#include "rtp.h"
|
||||||
#include "a2dp-codecs.h"
|
#include "media-codecs.h"
|
||||||
|
|
||||||
static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.sink.a2dp");
|
static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.sink.media");
|
||||||
#undef SPA_LOG_TOPIC_DEFAULT
|
#undef SPA_LOG_TOPIC_DEFAULT
|
||||||
#define SPA_LOG_TOPIC_DEFAULT &log_topic
|
#define SPA_LOG_TOPIC_DEFAULT &log_topic
|
||||||
|
|
||||||
|
|
@ -152,7 +152,7 @@ struct impl {
|
||||||
uint64_t next_time;
|
uint64_t next_time;
|
||||||
uint64_t last_error;
|
uint64_t last_error;
|
||||||
|
|
||||||
const struct a2dp_codec *codec;
|
const struct media_codec *codec;
|
||||||
bool codec_props_changed;
|
bool codec_props_changed;
|
||||||
void *codec_props;
|
void *codec_props;
|
||||||
void *codec_data;
|
void *codec_data;
|
||||||
|
|
@ -788,7 +788,7 @@ again:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void a2dp_on_flush(struct spa_source *source)
|
static void media_on_flush(struct spa_source *source)
|
||||||
{
|
{
|
||||||
struct impl *this = source->data;
|
struct impl *this = source->data;
|
||||||
|
|
||||||
|
|
@ -809,7 +809,7 @@ static void a2dp_on_flush(struct spa_source *source)
|
||||||
flush_data(this, this->current_time);
|
flush_data(this, this->current_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void a2dp_on_flush_timeout(struct spa_source *source)
|
static void media_on_flush_timeout(struct spa_source *source)
|
||||||
{
|
{
|
||||||
struct impl *this = source->data;
|
struct impl *this = source->data;
|
||||||
uint64_t exp;
|
uint64_t exp;
|
||||||
|
|
@ -827,7 +827,7 @@ static void a2dp_on_flush_timeout(struct spa_source *source)
|
||||||
flush_data(this, this->current_time);
|
flush_data(this, this->current_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void a2dp_on_timeout(struct spa_source *source)
|
static void media_on_timeout(struct spa_source *source)
|
||||||
{
|
{
|
||||||
struct impl *this = source->data;
|
struct impl *this = source->data;
|
||||||
struct port *port = &this->port;
|
struct port *port = &this->port;
|
||||||
|
|
@ -897,7 +897,7 @@ static int do_start(struct impl *this)
|
||||||
|
|
||||||
this->following = is_following(this);
|
this->following = is_following(this);
|
||||||
|
|
||||||
spa_log_debug(this->log, "%p: start following:%d", this, this->following);
|
spa_log_debug(this->log, "%p: start following:%d", this, this->following);
|
||||||
|
|
||||||
if ((res = spa_bt_transport_acquire(this->transport, false)) < 0)
|
if ((res = spa_bt_transport_acquire(this->transport, false)) < 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -911,7 +911,7 @@ static int do_start(struct impl *this)
|
||||||
spa_log_hexdump(this->log, SPA_LOG_LEVEL_DEBUG, 2, conf, (size_t)size);
|
spa_log_hexdump(this->log, SPA_LOG_LEVEL_DEBUG, 2, conf, (size_t)size);
|
||||||
|
|
||||||
this->codec_data = this->codec->init(this->codec,
|
this->codec_data = this->codec->init(this->codec,
|
||||||
this->is_duplex ? A2DP_CODEC_FLAG_SINK : 0,
|
this->is_duplex ? MEDIA_CODEC_FLAG_SINK : 0,
|
||||||
this->transport->configuration,
|
this->transport->configuration,
|
||||||
this->transport->configuration_len,
|
this->transport->configuration_len,
|
||||||
&port->current_format,
|
&port->current_format,
|
||||||
|
|
@ -920,8 +920,8 @@ static int do_start(struct impl *this)
|
||||||
if (this->codec_data == NULL)
|
if (this->codec_data == NULL)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
spa_log_info(this->log, "%p: using A2DP codec %s, delay:%"PRIi64" ms", this, this->codec->description,
|
spa_log_info(this->log, "%p: using A2DP codec %s, delay:%"PRIi64" ms", this, this->codec->description,
|
||||||
(int64_t)(spa_bt_transport_get_delay_nsec(this->transport) / SPA_NSEC_PER_MSEC));
|
(int64_t)(spa_bt_transport_get_delay_nsec(this->transport) / SPA_NSEC_PER_MSEC));
|
||||||
|
|
||||||
this->seqnum = 0;
|
this->seqnum = 0;
|
||||||
|
|
||||||
|
|
@ -932,8 +932,7 @@ static int do_start(struct impl *this)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
spa_log_debug(this->log, "%p: block_size %d", this,
|
spa_log_debug(this->log, "%p: block_size %d", this, this->block_size);
|
||||||
this->block_size);
|
|
||||||
|
|
||||||
val = this->codec->send_buf_size > 0
|
val = this->codec->send_buf_size > 0
|
||||||
/* The kernel doubles the SO_SNDBUF option value set by setsockopt(). */
|
/* The kernel doubles the SO_SNDBUF option value set by setsockopt(). */
|
||||||
|
|
@ -963,21 +962,21 @@ static int do_start(struct impl *this)
|
||||||
|
|
||||||
this->source.data = this;
|
this->source.data = this;
|
||||||
this->source.fd = this->timerfd;
|
this->source.fd = this->timerfd;
|
||||||
this->source.func = a2dp_on_timeout;
|
this->source.func = media_on_timeout;
|
||||||
this->source.mask = SPA_IO_IN;
|
this->source.mask = SPA_IO_IN;
|
||||||
this->source.rmask = 0;
|
this->source.rmask = 0;
|
||||||
spa_loop_add_source(this->data_loop, &this->source);
|
spa_loop_add_source(this->data_loop, &this->source);
|
||||||
|
|
||||||
this->flush_timer_source.data = this;
|
this->flush_timer_source.data = this;
|
||||||
this->flush_timer_source.fd = this->flush_timerfd;
|
this->flush_timer_source.fd = this->flush_timerfd;
|
||||||
this->flush_timer_source.func = a2dp_on_flush_timeout;
|
this->flush_timer_source.func = media_on_flush_timeout;
|
||||||
this->flush_timer_source.mask = SPA_IO_IN;
|
this->flush_timer_source.mask = SPA_IO_IN;
|
||||||
this->flush_timer_source.rmask = 0;
|
this->flush_timer_source.rmask = 0;
|
||||||
spa_loop_add_source(this->data_loop, &this->flush_timer_source);
|
spa_loop_add_source(this->data_loop, &this->flush_timer_source);
|
||||||
|
|
||||||
this->flush_source.data = this;
|
this->flush_source.data = this;
|
||||||
this->flush_source.fd = this->transport->fd;
|
this->flush_source.fd = this->transport->fd;
|
||||||
this->flush_source.func = a2dp_on_flush;
|
this->flush_source.func = media_on_flush;
|
||||||
this->flush_source.mask = 0;
|
this->flush_source.mask = 0;
|
||||||
this->flush_source.rmask = 0;
|
this->flush_source.rmask = 0;
|
||||||
spa_loop_add_source(this->data_loop, &this->flush_source);
|
spa_loop_add_source(this->data_loop, &this->flush_source);
|
||||||
|
|
@ -1198,7 +1197,7 @@ impl_node_port_enum_params(void *object, int seq,
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if ((res = this->codec->enum_config(this->codec,
|
if ((res = this->codec->enum_config(this->codec,
|
||||||
this->is_duplex ? A2DP_CODEC_FLAG_SINK : 0,
|
this->is_duplex ? MEDIA_CODEC_FLAG_SINK : 0,
|
||||||
this->transport->configuration,
|
this->transport->configuration,
|
||||||
this->transport->configuration_len,
|
this->transport->configuration_len,
|
||||||
id, result.index, &b, ¶m)) != 1)
|
id, result.index, &b, ¶m)) != 1)
|
||||||
|
|
@ -1711,12 +1710,12 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
spa_log_error(this->log, "a transport is needed");
|
spa_log_error(this->log, "a transport is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (this->transport->a2dp_codec == NULL) {
|
if (this->transport->media_codec == NULL) {
|
||||||
spa_log_error(this->log, "a transport codec is needed");
|
spa_log_error(this->log, "a transport codec is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->codec = this->transport->a2dp_codec;
|
this->codec = this->transport->media_codec;
|
||||||
|
|
||||||
if (this->is_duplex) {
|
if (this->is_duplex) {
|
||||||
if (!this->codec->duplex_codec) {
|
if (!this->codec->duplex_codec) {
|
||||||
|
|
@ -1728,7 +1727,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
if (this->codec->init_props != NULL)
|
if (this->codec->init_props != NULL)
|
||||||
this->codec_props = this->codec->init_props(this->codec,
|
this->codec_props = this->codec->init_props(this->codec,
|
||||||
this->is_duplex ? A2DP_CODEC_FLAG_SINK : 0,
|
this->is_duplex ? MEDIA_CODEC_FLAG_SINK : 0,
|
||||||
this->transport->device->settings);
|
this->transport->device->settings);
|
||||||
|
|
||||||
reset_props(this, &this->props);
|
reset_props(this, &this->props);
|
||||||
|
|
@ -1770,15 +1769,15 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
static const struct spa_dict_item info_items[] = {
|
static const struct spa_dict_item info_items[] = {
|
||||||
{ SPA_KEY_FACTORY_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
|
{ SPA_KEY_FACTORY_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
|
||||||
{ SPA_KEY_FACTORY_DESCRIPTION, "Play audio with the a2dp" },
|
{ SPA_KEY_FACTORY_DESCRIPTION, "Play audio with the media" },
|
||||||
{ SPA_KEY_FACTORY_USAGE, SPA_KEY_API_BLUEZ5_TRANSPORT"=<transport>" },
|
{ SPA_KEY_FACTORY_USAGE, SPA_KEY_API_BLUEZ5_TRANSPORT"=<transport>" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
|
static const struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
|
||||||
|
|
||||||
const struct spa_handle_factory spa_a2dp_sink_factory = {
|
const struct spa_handle_factory spa_media_sink_factory = {
|
||||||
SPA_VERSION_HANDLE_FACTORY,
|
SPA_VERSION_HANDLE_FACTORY,
|
||||||
SPA_NAME_API_BLUEZ5_A2DP_SINK,
|
SPA_NAME_API_BLUEZ5_MEDIA_SINK,
|
||||||
&info,
|
&info,
|
||||||
impl_get_size,
|
impl_get_size,
|
||||||
impl_init,
|
impl_init,
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* Spa A2DP Source
|
/* Spa Media Source
|
||||||
*
|
*
|
||||||
* Copyright © 2018 Wim Taymans
|
* Copyright © 2018 Wim Taymans
|
||||||
* Copyright © 2019 Collabora Ltd.
|
* Copyright © 2019 Collabora Ltd.
|
||||||
|
|
@ -54,9 +54,9 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "rtp.h"
|
#include "rtp.h"
|
||||||
#include "a2dp-codecs.h"
|
#include "media-codecs.h"
|
||||||
|
|
||||||
static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.source.a2dp");
|
static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.source.media");
|
||||||
#undef SPA_LOG_TOPIC_DEFAULT
|
#undef SPA_LOG_TOPIC_DEFAULT
|
||||||
#define SPA_LOG_TOPIC_DEFAULT &log_topic
|
#define SPA_LOG_TOPIC_DEFAULT &log_topic
|
||||||
|
|
||||||
|
|
@ -156,7 +156,7 @@ struct impl {
|
||||||
uint64_t current_time;
|
uint64_t current_time;
|
||||||
uint64_t next_time;
|
uint64_t next_time;
|
||||||
|
|
||||||
const struct a2dp_codec *codec;
|
const struct media_codec *codec;
|
||||||
bool codec_props_changed;
|
bool codec_props_changed;
|
||||||
void *codec_props;
|
void *codec_props;
|
||||||
void *codec_data;
|
void *codec_data;
|
||||||
|
|
@ -448,7 +448,7 @@ static int32_t decode_data(struct impl *this, uint8_t *src, uint32_t src_size,
|
||||||
return dst_size - avail;
|
return dst_size - avail;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void a2dp_on_ready_read(struct spa_source *source)
|
static void media_on_ready_read(struct spa_source *source)
|
||||||
{
|
{
|
||||||
struct impl *this = source->data;
|
struct impl *this = source->data;
|
||||||
struct port *port = &this->port;
|
struct port *port = &this->port;
|
||||||
|
|
@ -533,7 +533,7 @@ static int set_duplex_timeout(struct impl *this, uint64_t timeout)
|
||||||
this->duplex_timerfd, 0, &ts, NULL);
|
this->duplex_timerfd, 0, &ts, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void a2dp_on_duplex_timeout(struct spa_source *source)
|
static void media_on_duplex_timeout(struct spa_source *source)
|
||||||
{
|
{
|
||||||
struct impl *this = source->data;
|
struct impl *this = source->data;
|
||||||
uint64_t exp;
|
uint64_t exp;
|
||||||
|
|
@ -543,7 +543,7 @@ static void a2dp_on_duplex_timeout(struct spa_source *source)
|
||||||
|
|
||||||
set_duplex_timeout(this, this->duplex_timeout);
|
set_duplex_timeout(this, this->duplex_timeout);
|
||||||
|
|
||||||
a2dp_on_ready_read(source);
|
media_on_ready_read(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int setup_matching(struct impl *this)
|
static int setup_matching(struct impl *this)
|
||||||
|
|
@ -567,7 +567,7 @@ static int setup_matching(struct impl *this)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void a2dp_on_timeout(struct spa_source *source)
|
static void media_on_timeout(struct spa_source *source)
|
||||||
{
|
{
|
||||||
struct impl *this = source->data;
|
struct impl *this = source->data;
|
||||||
struct port *port = &this->port;
|
struct port *port = &this->port;
|
||||||
|
|
@ -631,7 +631,7 @@ static int transport_start(struct impl *this)
|
||||||
this->transport_acquired = true;
|
this->transport_acquired = true;
|
||||||
|
|
||||||
this->codec_data = this->codec->init(this->codec,
|
this->codec_data = this->codec->init(this->codec,
|
||||||
this->is_duplex ? 0 : A2DP_CODEC_FLAG_SINK,
|
this->is_duplex ? 0 : MEDIA_CODEC_FLAG_SINK,
|
||||||
this->transport->configuration,
|
this->transport->configuration,
|
||||||
this->transport->configuration_len,
|
this->transport->configuration_len,
|
||||||
&port->current_format,
|
&port->current_format,
|
||||||
|
|
@ -640,7 +640,7 @@ static int transport_start(struct impl *this)
|
||||||
if (this->codec_data == NULL)
|
if (this->codec_data == NULL)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
spa_log_info(this->log, "%p: using A2DP codec %s", this, this->codec->description);
|
spa_log_info(this->log, "%p: using A2DP codec %s", this, this->codec->description);
|
||||||
|
|
||||||
val = fcntl(this->transport->fd, F_GETFL);
|
val = fcntl(this->transport->fd, F_GETFL);
|
||||||
if (fcntl(this->transport->fd, F_SETFL, val | O_NONBLOCK) < 0)
|
if (fcntl(this->transport->fd, F_SETFL, val | O_NONBLOCK) < 0)
|
||||||
|
|
@ -672,7 +672,7 @@ static int transport_start(struct impl *this)
|
||||||
|
|
||||||
if (!this->use_duplex_source) {
|
if (!this->use_duplex_source) {
|
||||||
this->source.fd = this->transport->fd;
|
this->source.fd = this->transport->fd;
|
||||||
this->source.func = a2dp_on_ready_read;
|
this->source.func = media_on_ready_read;
|
||||||
this->source.mask = SPA_IO_IN;
|
this->source.mask = SPA_IO_IN;
|
||||||
this->source.rmask = 0;
|
this->source.rmask = 0;
|
||||||
spa_loop_add_source(this->data_loop, &this->source);
|
spa_loop_add_source(this->data_loop, &this->source);
|
||||||
|
|
@ -689,7 +689,7 @@ static int transport_start(struct impl *this)
|
||||||
* XXX: forward stream.
|
* XXX: forward stream.
|
||||||
*/
|
*/
|
||||||
this->source.fd = this->duplex_timerfd;
|
this->source.fd = this->duplex_timerfd;
|
||||||
this->source.func = a2dp_on_duplex_timeout;
|
this->source.func = media_on_duplex_timeout;
|
||||||
this->source.mask = SPA_IO_IN;
|
this->source.mask = SPA_IO_IN;
|
||||||
this->source.rmask = 0;
|
this->source.rmask = 0;
|
||||||
spa_loop_add_source(this->data_loop, &this->source);
|
spa_loop_add_source(this->data_loop, &this->source);
|
||||||
|
|
@ -700,7 +700,7 @@ static int transport_start(struct impl *this)
|
||||||
|
|
||||||
this->timer_source.data = this;
|
this->timer_source.data = this;
|
||||||
this->timer_source.fd = this->timerfd;
|
this->timer_source.fd = this->timerfd;
|
||||||
this->timer_source.func = a2dp_on_timeout;
|
this->timer_source.func = media_on_timeout;
|
||||||
this->timer_source.mask = SPA_IO_IN;
|
this->timer_source.mask = SPA_IO_IN;
|
||||||
this->timer_source.rmask = 0;
|
this->timer_source.rmask = 0;
|
||||||
spa_loop_add_source(this->data_loop, &this->timer_source);
|
spa_loop_add_source(this->data_loop, &this->timer_source);
|
||||||
|
|
@ -968,7 +968,7 @@ impl_node_port_enum_params(void *object, int seq,
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if ((res = this->codec->enum_config(this->codec,
|
if ((res = this->codec->enum_config(this->codec,
|
||||||
this->is_duplex ? 0 : A2DP_CODEC_FLAG_SINK,
|
this->is_duplex ? 0 : MEDIA_CODEC_FLAG_SINK,
|
||||||
this->transport->configuration,
|
this->transport->configuration,
|
||||||
this->transport->configuration_len,
|
this->transport->configuration_len,
|
||||||
id, result.index, &b, ¶m)) != 1)
|
id, result.index, &b, ¶m)) != 1)
|
||||||
|
|
@ -1555,7 +1555,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
spa_atou32(str, &this->quantum_limit, 0);
|
spa_atou32(str, &this->quantum_limit, 0);
|
||||||
if ((str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)) != NULL)
|
if ((str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)) != NULL)
|
||||||
sscanf(str, "pointer:%p", &this->transport);
|
sscanf(str, "pointer:%p", &this->transport);
|
||||||
if ((str = spa_dict_lookup(info, "bluez5.a2dp-source-role")) != NULL)
|
if ((str = spa_dict_lookup(info, "bluez5.media-source-role")) != NULL)
|
||||||
this->is_input = spa_streq(str, "input");
|
this->is_input = spa_streq(str, "input");
|
||||||
if ((str = spa_dict_lookup(info, "api.bluez5.a2dp-duplex")) != NULL)
|
if ((str = spa_dict_lookup(info, "api.bluez5.a2dp-duplex")) != NULL)
|
||||||
this->is_duplex = spa_atob(str);
|
this->is_duplex = spa_atob(str);
|
||||||
|
|
@ -1565,11 +1565,11 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
spa_log_error(this->log, "a transport is needed");
|
spa_log_error(this->log, "a transport is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (this->transport->a2dp_codec == NULL) {
|
if (this->transport->media_codec == NULL) {
|
||||||
spa_log_error(this->log, "a transport codec is needed");
|
spa_log_error(this->log, "a transport codec is needed");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
this->codec = this->transport->a2dp_codec;
|
this->codec = this->transport->media_codec;
|
||||||
|
|
||||||
if (this->is_duplex) {
|
if (this->is_duplex) {
|
||||||
if (!this->codec->duplex_codec) {
|
if (!this->codec->duplex_codec) {
|
||||||
|
|
@ -1583,7 +1583,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
if (this->codec->init_props != NULL)
|
if (this->codec->init_props != NULL)
|
||||||
this->codec_props = this->codec->init_props(this->codec,
|
this->codec_props = this->codec->init_props(this->codec,
|
||||||
this->is_duplex ? 0 : A2DP_CODEC_FLAG_SINK,
|
this->is_duplex ? 0 : MEDIA_CODEC_FLAG_SINK,
|
||||||
this->transport->device->settings);
|
this->transport->device->settings);
|
||||||
|
|
||||||
spa_bt_transport_add_listener(this->transport,
|
spa_bt_transport_add_listener(this->transport,
|
||||||
|
|
@ -1627,15 +1627,15 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
static const struct spa_dict_item info_items[] = {
|
static const struct spa_dict_item info_items[] = {
|
||||||
{ SPA_KEY_FACTORY_AUTHOR, "Collabora Ltd. <contact@collabora.com>" },
|
{ SPA_KEY_FACTORY_AUTHOR, "Collabora Ltd. <contact@collabora.com>" },
|
||||||
{ SPA_KEY_FACTORY_DESCRIPTION, "Capture bluetooth audio with a2dp" },
|
{ SPA_KEY_FACTORY_DESCRIPTION, "Capture bluetooth audio with media" },
|
||||||
{ SPA_KEY_FACTORY_USAGE, SPA_KEY_API_BLUEZ5_TRANSPORT"=<transport>" },
|
{ SPA_KEY_FACTORY_USAGE, SPA_KEY_API_BLUEZ5_TRANSPORT"=<transport>" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
|
static const struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
|
||||||
|
|
||||||
const struct spa_handle_factory spa_a2dp_source_factory = {
|
const struct spa_handle_factory spa_media_source_factory = {
|
||||||
SPA_VERSION_HANDLE_FACTORY,
|
SPA_VERSION_HANDLE_FACTORY,
|
||||||
SPA_NAME_API_BLUEZ5_A2DP_SOURCE,
|
SPA_NAME_API_BLUEZ5_MEDIA_SOURCE,
|
||||||
&info,
|
&info,
|
||||||
impl_get_size,
|
impl_get_size,
|
||||||
impl_init,
|
impl_init,
|
||||||
|
|
@ -17,9 +17,9 @@ cdata.set('HAVE_BLUEZ_5_HCI', dependency('bluez', version: '< 6', required: fals
|
||||||
bluez5_sources = [
|
bluez5_sources = [
|
||||||
'plugin.c',
|
'plugin.c',
|
||||||
'codec-loader.c',
|
'codec-loader.c',
|
||||||
'a2dp-codecs.c',
|
'media-codecs.c',
|
||||||
'a2dp-sink.c',
|
'media-sink.c',
|
||||||
'a2dp-source.c',
|
'media-source.c',
|
||||||
'sco-sink.c',
|
'sco-sink.c',
|
||||||
'sco-source.c',
|
'sco-source.c',
|
||||||
'sco-io.c',
|
'sco-io.c',
|
||||||
|
|
@ -59,7 +59,7 @@ bluez5lib = shared_library('spa-bluez5',
|
||||||
codec_args = [ '-DCODEC_PLUGIN' ]
|
codec_args = [ '-DCODEC_PLUGIN' ]
|
||||||
|
|
||||||
bluez_codec_sbc = shared_library('spa-codec-bluez5-sbc',
|
bluez_codec_sbc = shared_library('spa-codec-bluez5-sbc',
|
||||||
[ 'a2dp-codec-sbc.c', 'a2dp-codecs.c' ],
|
[ 'a2dp-codec-sbc.c', 'media-codecs.c' ],
|
||||||
include_directories : [ configinc ],
|
include_directories : [ configinc ],
|
||||||
c_args : codec_args,
|
c_args : codec_args,
|
||||||
dependencies : [ spa_dep, sbc_dep ],
|
dependencies : [ spa_dep, sbc_dep ],
|
||||||
|
|
@ -67,7 +67,7 @@ bluez_codec_sbc = shared_library('spa-codec-bluez5-sbc',
|
||||||
install_dir : spa_plugindir / 'bluez5')
|
install_dir : spa_plugindir / 'bluez5')
|
||||||
|
|
||||||
bluez_codec_faststream = shared_library('spa-codec-bluez5-faststream',
|
bluez_codec_faststream = shared_library('spa-codec-bluez5-faststream',
|
||||||
[ 'a2dp-codec-faststream.c', 'a2dp-codecs.c' ],
|
[ 'a2dp-codec-faststream.c', 'media-codecs.c' ],
|
||||||
include_directories : [ configinc ],
|
include_directories : [ configinc ],
|
||||||
c_args : codec_args,
|
c_args : codec_args,
|
||||||
dependencies : [ spa_dep, sbc_dep ],
|
dependencies : [ spa_dep, sbc_dep ],
|
||||||
|
|
@ -76,7 +76,7 @@ bluez_codec_faststream = shared_library('spa-codec-bluez5-faststream',
|
||||||
|
|
||||||
if fdk_aac_dep.found()
|
if fdk_aac_dep.found()
|
||||||
bluez_codec_aac = shared_library('spa-codec-bluez5-aac',
|
bluez_codec_aac = shared_library('spa-codec-bluez5-aac',
|
||||||
[ 'a2dp-codec-aac.c', 'a2dp-codecs.c' ],
|
[ 'a2dp-codec-aac.c', 'media-codecs.c' ],
|
||||||
include_directories : [ configinc ],
|
include_directories : [ configinc ],
|
||||||
c_args : codec_args,
|
c_args : codec_args,
|
||||||
dependencies : [ spa_dep, fdk_aac_dep ],
|
dependencies : [ spa_dep, fdk_aac_dep ],
|
||||||
|
|
@ -86,7 +86,7 @@ endif
|
||||||
|
|
||||||
if aptx_dep.found()
|
if aptx_dep.found()
|
||||||
bluez_codec_aptx = shared_library('spa-codec-bluez5-aptx',
|
bluez_codec_aptx = shared_library('spa-codec-bluez5-aptx',
|
||||||
[ 'a2dp-codec-aptx.c', 'a2dp-codecs.c' ],
|
[ 'a2dp-codec-aptx.c', 'media-codecs.c' ],
|
||||||
include_directories : [ configinc ],
|
include_directories : [ configinc ],
|
||||||
c_args : codec_args,
|
c_args : codec_args,
|
||||||
dependencies : [ spa_dep, aptx_dep, sbc_dep ],
|
dependencies : [ spa_dep, aptx_dep, sbc_dep ],
|
||||||
|
|
@ -102,7 +102,7 @@ if ldac_dep.found()
|
||||||
ldac_dep += ldac_abr_dep
|
ldac_dep += ldac_abr_dep
|
||||||
endif
|
endif
|
||||||
bluez_codec_ldac = shared_library('spa-codec-bluez5-ldac',
|
bluez_codec_ldac = shared_library('spa-codec-bluez5-ldac',
|
||||||
[ 'a2dp-codec-ldac.c', 'a2dp-codecs.c' ],
|
[ 'a2dp-codec-ldac.c', 'media-codecs.c' ],
|
||||||
include_directories : [ configinc ],
|
include_directories : [ configinc ],
|
||||||
c_args : ldac_args,
|
c_args : ldac_args,
|
||||||
dependencies : [ spa_dep, ldac_dep ],
|
dependencies : [ spa_dep, ldac_dep ],
|
||||||
|
|
@ -112,7 +112,7 @@ endif
|
||||||
|
|
||||||
if get_option('bluez5-codec-lc3plus').allowed() and lc3plus_dep.found()
|
if get_option('bluez5-codec-lc3plus').allowed() and lc3plus_dep.found()
|
||||||
bluez_codec_lc3plus = shared_library('spa-codec-bluez5-lc3plus',
|
bluez_codec_lc3plus = shared_library('spa-codec-bluez5-lc3plus',
|
||||||
[ 'a2dp-codec-lc3plus.c', 'a2dp-codecs.c' ],
|
[ 'a2dp-codec-lc3plus.c', 'media-codecs.c' ],
|
||||||
include_directories : [ configinc ],
|
include_directories : [ configinc ],
|
||||||
c_args : codec_args,
|
c_args : codec_args,
|
||||||
dependencies : [ spa_dep, lc3plus_dep, mathlib ],
|
dependencies : [ spa_dep, lc3plus_dep, mathlib ],
|
||||||
|
|
@ -124,7 +124,7 @@ if get_option('bluez5-codec-opus').allowed() and opus_dep.found()
|
||||||
opus_args = codec_args
|
opus_args = codec_args
|
||||||
opus_dep = [ opus_dep ]
|
opus_dep = [ opus_dep ]
|
||||||
bluez_codec_opus = shared_library('spa-codec-bluez5-opus',
|
bluez_codec_opus = shared_library('spa-codec-bluez5-opus',
|
||||||
[ 'a2dp-codec-opus.c', 'a2dp-codecs.c' ],
|
[ 'a2dp-codec-opus.c', 'media-codecs.c' ],
|
||||||
include_directories : [ configinc ],
|
include_directories : [ configinc ],
|
||||||
c_args : opus_args,
|
c_args : opus_args,
|
||||||
dependencies : [ spa_dep, opus_dep, mathlib ],
|
dependencies : [ spa_dep, opus_dep, mathlib ],
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@
|
||||||
|
|
||||||
extern const struct spa_handle_factory spa_bluez5_dbus_factory;
|
extern const struct spa_handle_factory spa_bluez5_dbus_factory;
|
||||||
extern const struct spa_handle_factory spa_bluez5_device_factory;
|
extern const struct spa_handle_factory spa_bluez5_device_factory;
|
||||||
extern const struct spa_handle_factory spa_a2dp_sink_factory;
|
extern const struct spa_handle_factory spa_media_sink_factory;
|
||||||
extern const struct spa_handle_factory spa_a2dp_source_factory;
|
extern const struct spa_handle_factory spa_media_source_factory;
|
||||||
extern const struct spa_handle_factory spa_sco_sink_factory;
|
extern const struct spa_handle_factory spa_sco_sink_factory;
|
||||||
extern const struct spa_handle_factory spa_sco_source_factory;
|
extern const struct spa_handle_factory spa_sco_source_factory;
|
||||||
|
|
||||||
|
|
@ -48,10 +48,10 @@ int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t
|
||||||
*factory = &spa_bluez5_device_factory;
|
*factory = &spa_bluez5_device_factory;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
*factory = &spa_a2dp_sink_factory;
|
*factory = &spa_media_sink_factory;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
*factory = &spa_a2dp_source_factory;
|
*factory = &spa_media_source_factory;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
*factory = &spa_sco_sink_factory;
|
*factory = &spa_sco_sink_factory;
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@
|
||||||
#include <spa/utils/json.h>
|
#include <spa/utils/json.h>
|
||||||
#include <spa/utils/string.h>
|
#include <spa/utils/string.h>
|
||||||
|
|
||||||
#include "a2dp-codecs.h"
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.quirks");
|
static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.quirks");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue