mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
We would like to have BT device codec capability checks beyond what's possible based on A2DP caps. Split SBC-XQ to a separate codec, and enable it in the device-dependent check (although currently it just uses the config option).
105 lines
2.2 KiB
C
105 lines
2.2 KiB
C
/*
|
|
* BlueALSA - bluez-a2dp.c
|
|
* Copyright (c) 2016-2017 Arkadiusz Bokowy
|
|
*
|
|
* This file is a part of bluez-alsa.
|
|
*
|
|
* This project is licensed under the terms of the MIT license.
|
|
*
|
|
*/
|
|
|
|
#include "a2dp-codecs.h"
|
|
|
|
bool a2dp_codec_check_caps(const struct a2dp_codec *codec, unsigned int codec_id, const void *caps, size_t caps_size)
|
|
{
|
|
uint8_t config[A2DP_MAX_CAPS_SIZE];
|
|
int res;
|
|
|
|
if (codec_id != codec->codec_id)
|
|
return false;
|
|
|
|
if (caps == NULL)
|
|
return false;
|
|
|
|
res = codec->select_config(codec, 0, caps, caps_size, NULL, config);
|
|
if (res < 0)
|
|
return false;
|
|
|
|
return ((size_t)res == caps_size);
|
|
}
|
|
|
|
#if ENABLE_MP3
|
|
const a2dp_mpeg_t bluez_a2dp_mpeg = {
|
|
.layer =
|
|
MPEG_LAYER_MP1 |
|
|
MPEG_LAYER_MP2 |
|
|
MPEG_LAYER_MP3,
|
|
.crc = 1,
|
|
.channel_mode =
|
|
MPEG_CHANNEL_MODE_MONO |
|
|
MPEG_CHANNEL_MODE_DUAL_CHANNEL |
|
|
MPEG_CHANNEL_MODE_STEREO |
|
|
MPEG_CHANNEL_MODE_JOINT_STEREO,
|
|
.mpf = 1,
|
|
.frequency =
|
|
MPEG_SAMPLING_FREQ_16000 |
|
|
MPEG_SAMPLING_FREQ_22050 |
|
|
MPEG_SAMPLING_FREQ_24000 |
|
|
MPEG_SAMPLING_FREQ_32000 |
|
|
MPEG_SAMPLING_FREQ_44100 |
|
|
MPEG_SAMPLING_FREQ_48000,
|
|
.bitrate =
|
|
MPEG_BIT_RATE_VBR |
|
|
MPEG_BIT_RATE_320000 |
|
|
MPEG_BIT_RATE_256000 |
|
|
MPEG_BIT_RATE_224000 |
|
|
MPEG_BIT_RATE_192000 |
|
|
MPEG_BIT_RATE_160000 |
|
|
MPEG_BIT_RATE_128000 |
|
|
MPEG_BIT_RATE_112000 |
|
|
MPEG_BIT_RATE_96000 |
|
|
MPEG_BIT_RATE_80000 |
|
|
MPEG_BIT_RATE_64000 |
|
|
MPEG_BIT_RATE_56000 |
|
|
MPEG_BIT_RATE_48000 |
|
|
MPEG_BIT_RATE_40000 |
|
|
MPEG_BIT_RATE_32000 |
|
|
MPEG_BIT_RATE_FREE,
|
|
};
|
|
#endif
|
|
|
|
extern struct a2dp_codec a2dp_codec_sbc;
|
|
extern struct a2dp_codec a2dp_codec_sbc_xq;
|
|
#if ENABLE_LDAC
|
|
extern struct a2dp_codec a2dp_codec_ldac;
|
|
#endif
|
|
#if ENABLE_AAC
|
|
extern struct a2dp_codec a2dp_codec_aac;
|
|
#endif
|
|
#if ENABLE_MP3
|
|
extern struct a2dp_codec a2dp_codec_mpeg;
|
|
#endif
|
|
#if ENABLE_APTX
|
|
extern struct a2dp_codec a2dp_codec_aptx;
|
|
extern struct a2dp_codec a2dp_codec_aptx_hd;
|
|
#endif
|
|
|
|
const struct a2dp_codec *a2dp_codec_list[] = {
|
|
#if ENABLE_LDAC
|
|
&a2dp_codec_ldac,
|
|
#endif
|
|
#if ENABLE_APTX
|
|
&a2dp_codec_aptx_hd,
|
|
&a2dp_codec_aptx,
|
|
#endif
|
|
#if ENABLE_AAC
|
|
&a2dp_codec_aac,
|
|
#endif
|
|
#if ENABLE_MP3
|
|
&a2dp_codec_mpeg,
|
|
#endif
|
|
&a2dp_codec_sbc_xq,
|
|
&a2dp_codec_sbc,
|
|
NULL,
|
|
};
|
|
const struct a2dp_codec **a2dp_codecs = a2dp_codec_list;
|