mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
bluez5: add Opus as a (Pipewire-specific) A2DP vendor codec
Support Opus as A2DP vendor codec. The specification for vendor A2DP codec is our Pipewire-specific one, so it is compatible only with devices running Pipewire.
This commit is contained in:
parent
bf52b2acff
commit
434cc6a90b
7 changed files with 1397 additions and 1 deletions
|
|
@ -116,6 +116,10 @@ option('bluez5-codec-lc3plus',
|
|||
description: 'Enable LC3plus open source codec implementation',
|
||||
type: 'feature',
|
||||
value: 'auto')
|
||||
option('bluez5-codec-opus',
|
||||
description: 'Enable Opus open source codec implementation',
|
||||
type: 'feature',
|
||||
value: 'auto')
|
||||
option('control',
|
||||
description: 'Enable control spa plugin integration',
|
||||
type: 'feature',
|
||||
|
|
|
|||
|
|
@ -49,6 +49,11 @@ enum spa_bluetooth_audio_codec {
|
|||
SPA_BLUETOOTH_AUDIO_CODEC_FASTSTREAM,
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_FASTSTREAM_DUPLEX,
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_LC3PLUS_HR,
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05,
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_51,
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_71,
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_DUPLEX,
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_PRO,
|
||||
|
||||
/* HFP */
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_CVSD = 0x100,
|
||||
|
|
|
|||
|
|
@ -53,6 +53,11 @@ static const struct spa_type_info spa_type_bluetooth_audio_codec[] = {
|
|||
{ SPA_BLUETOOTH_AUDIO_CODEC_FASTSTREAM, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "faststream", NULL },
|
||||
{ SPA_BLUETOOTH_AUDIO_CODEC_FASTSTREAM_DUPLEX, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "faststream_duplex", NULL },
|
||||
{ SPA_BLUETOOTH_AUDIO_CODEC_LC3PLUS_HR, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "lc3plus_hr", NULL },
|
||||
{ SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "opus_05", NULL },
|
||||
{ SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_51, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "opus_05_51", NULL },
|
||||
{ SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_71, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "opus_05_71", NULL },
|
||||
{ SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_DUPLEX, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "opus_05_duplex", NULL },
|
||||
{ SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_PRO, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "opus_05_pro", NULL },
|
||||
|
||||
{ SPA_BLUETOOTH_AUDIO_CODEC_CVSD, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "cvsd", NULL },
|
||||
{ SPA_BLUETOOTH_AUDIO_CODEC_MSBC, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "msbc", NULL },
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ if get_option('spa-plugins').allowed()
|
|||
endif
|
||||
endif
|
||||
summary({'LC3plus': lc3plus_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs')
|
||||
opus_dep = dependency('opus', required : get_option('bluez5-codec-opus'))
|
||||
summary({'Opus': opus_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs')
|
||||
endif
|
||||
avcodec_dep = dependency('libavcodec', required: get_option('ffmpeg'))
|
||||
jack_dep = dependency('jack', version : '>= 1.9.10', required: get_option('jack'))
|
||||
|
|
|
|||
1362
spa/plugins/bluez5/a2dp-codec-opus.c
Normal file
1362
spa/plugins/bluez5/a2dp-codec-opus.c
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -63,6 +63,11 @@ static int codec_order(const struct a2dp_codec *c)
|
|||
SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL_DUPLEX,
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_FASTSTREAM,
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_FASTSTREAM_DUPLEX,
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05,
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_51,
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_71,
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_DUPLEX,
|
||||
SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_PRO,
|
||||
};
|
||||
size_t i;
|
||||
for (i = 0; i < SPA_N_ELEMENTS(order); ++i)
|
||||
|
|
@ -174,7 +179,8 @@ const struct a2dp_codec * const *load_a2dp_codecs(struct spa_plugin_loader *load
|
|||
A2DP_CODEC_FACTORY_LIB("faststream"),
|
||||
A2DP_CODEC_FACTORY_LIB("ldac"),
|
||||
A2DP_CODEC_FACTORY_LIB("sbc"),
|
||||
A2DP_CODEC_FACTORY_LIB("lc3plus")
|
||||
A2DP_CODEC_FACTORY_LIB("lc3plus"),
|
||||
A2DP_CODEC_FACTORY_LIB("opus")
|
||||
#undef A2DP_CODEC_FACTORY_LIB
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -121,3 +121,15 @@ if get_option('bluez5-codec-lc3plus').allowed() and lc3plus_dep.found()
|
|||
install : true,
|
||||
install_dir : spa_plugindir / 'bluez5')
|
||||
endif
|
||||
|
||||
if get_option('bluez5-codec-opus').allowed() and opus_dep.found()
|
||||
opus_args = codec_args
|
||||
opus_dep = [ opus_dep ]
|
||||
bluez_codec_opus = shared_library('spa-codec-bluez5-opus',
|
||||
[ 'a2dp-codec-opus.c', 'a2dp-codecs.c' ],
|
||||
include_directories : [ configinc ],
|
||||
c_args : opus_args,
|
||||
dependencies : [ spa_dep, opus_dep, mathlib ],
|
||||
install : true,
|
||||
install_dir : spa_plugindir / 'bluez5')
|
||||
endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue