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:
Frédéric Danis 2022-06-15 17:24:41 +02:00 committed by Wim Taymans
parent 64a3edf89e
commit 00d51c3d31
20 changed files with 485 additions and 485 deletions

View file

@ -35,7 +35,7 @@
#include <freeaptx.h>
#include "rtp.h"
#include "a2dp-codecs.h"
#include "media-codecs.h"
#define APTX_LL_LEVEL1(level) (((level) >> 8) & 0xFF)
#define APTX_LL_LEVEL2(level) (((level) >> 0) & 0xFF)
@ -71,19 +71,19 @@ struct msbc_impl {
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
&& 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) ||
(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))
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);
}
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])
{
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;
}
static const struct a2dp_codec_config
static const struct media_codec_config
aptx_frequencies[] = {
{ APTX_SAMPLING_FREQ_48000, 48000, 3 },
{ APTX_SAMPLING_FREQ_44100, 44100, 2 },
@ -127,9 +127,9 @@ aptx_frequencies[] = {
{ 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 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])
{
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)
return -ENOTSUP;
if ((i = a2dp_codec_select_config(aptx_frequencies,
if ((i = media_codec_select_config(aptx_frequencies,
SPA_N_ELEMENTS(aptx_frequencies),
conf.frequency,
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;
}
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 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])
{
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;
}
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,
struct spa_pod_builder *b, struct spa_pod **param)
{
@ -315,7 +315,7 @@ static int codec_get_block_size(void *data)
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 *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.
*/
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,
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;
}
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,
struct spa_audio_info *info)
{
@ -508,7 +508,7 @@ static int msbc_get_block_size(void *data)
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 *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,
.codec_id = A2DP_CODEC_VENDOR,
.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,
.codec_id = A2DP_CODEC_VENDOR,
.vendor = { .vendor_id = APTX_HD_VENDOR_ID,
@ -671,7 +671,7 @@ const struct a2dp_codec a2dp_codec_aptx_hd = {
.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,
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL,
.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",
};
const struct a2dp_codec a2dp_codec_aptx_ll_1 = {
const struct media_codec a2dp_codec_aptx_ll_1 = {
APTX_LL_COMMON_DEFS,
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL,
.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 */
static const struct a2dp_codec aptx_ll_msbc = {
static const struct media_codec aptx_ll_msbc = {
.codec_id = A2DP_CODEC_VENDOR,
.name = "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);
const struct a2dp_codec a2dp_codec_aptx_ll_duplex_0 = {
const struct media_codec a2dp_codec_aptx_ll_duplex_0 = {
APTX_LL_COMMON_DEFS,
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL_DUPLEX,
.vendor = { .vendor_id = APTX_LL_VENDOR_ID,
@ -726,7 +726,7 @@ const struct a2dp_codec a2dp_codec_aptx_ll_duplex_0 = {
.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,
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL_DUPLEX,
.vendor = { .vendor_id = APTX_LL_VENDOR_ID2,
@ -737,7 +737,7 @@ const struct a2dp_codec a2dp_codec_aptx_ll_duplex_1 = {
.info = &duplex_info,
};
A2DP_CODEC_EXPORT_DEF(
MEDIA_CODEC_EXPORT_DEF(
"aptx",
&a2dp_codec_aptx_hd,
&a2dp_codec_aptx,