mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
bluez5: remove HFP codec id from transports
Make HFP codec id backend/codec internal detail. Remove spa_bt_transport::codec field which is now unused.
This commit is contained in:
parent
3f9fb8d664
commit
83f6d719b1
7 changed files with 24 additions and 32 deletions
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "defs.h"
|
||||
#include "media-codecs.h"
|
||||
#include "hfp-codec-caps.h"
|
||||
|
||||
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.bluez5.hsphfpd");
|
||||
#undef SPA_LOG_TOPIC_DEFAULT
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "defs.h"
|
||||
#include "media-codecs.h"
|
||||
#include "hfp-codec-caps.h"
|
||||
|
||||
#ifdef HAVE_LIBUSB
|
||||
#include <libusb.h>
|
||||
|
|
@ -281,7 +282,6 @@ static int rfcomm_new_transport(struct rfcomm *rfcomm, int codec_id)
|
|||
t->backend = &backend->this;
|
||||
t->n_channels = 1;
|
||||
t->channels[0] = SPA_AUDIO_CHANNEL_MONO;
|
||||
t->codec = codec_id;
|
||||
t->media_codec = codec;
|
||||
|
||||
td = t->user_data;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "defs.h"
|
||||
#include "media-codecs.h"
|
||||
#include "hfp-codec-caps.h"
|
||||
|
||||
#define INITIAL_INTERVAL_NSEC (500 * SPA_NSEC_PER_MSEC)
|
||||
#define ACTION_INTERVAL_NSEC (3000 * SPA_NSEC_PER_MSEC)
|
||||
|
|
@ -142,7 +143,6 @@ static struct spa_bt_transport *_transport_create(struct impl *backend,
|
|||
t->backend = &backend->this;
|
||||
t->profile = profile;
|
||||
t->media_codec = codec;
|
||||
t->codec = codec_id;
|
||||
t->n_channels = 1;
|
||||
t->channels[0] = SPA_AUDIO_CHANNEL_MONO;
|
||||
|
||||
|
|
@ -564,7 +564,6 @@ static DBusHandlerResult ofono_new_audio_connection(DBusConnection *conn, DBusMe
|
|||
}
|
||||
|
||||
t->fd = fd;
|
||||
t->codec = codec_id;
|
||||
t->media_codec = codec;
|
||||
|
||||
spa_log_debug(backend->log, "transport %p: NewConnection %s, fd %d codec %s",
|
||||
|
|
|
|||
|
|
@ -3500,17 +3500,6 @@ static int transport_update_props(struct spa_bt_transport *transport,
|
|||
transport->bap_initiator = ep->acceptor;
|
||||
}
|
||||
}
|
||||
else if (spa_streq(key, "Codec")) {
|
||||
uint8_t value;
|
||||
|
||||
if (type != DBUS_TYPE_BYTE)
|
||||
goto next;
|
||||
dbus_message_iter_get_basic(&it[1], &value);
|
||||
|
||||
spa_log_debug(monitor->log, "transport %p: %s=%02x", transport, key, value);
|
||||
|
||||
transport->codec = value;
|
||||
}
|
||||
else if (spa_streq(key, "Configuration")) {
|
||||
DBusMessageIter iter;
|
||||
uint8_t *value;
|
||||
|
|
|
|||
|
|
@ -143,10 +143,6 @@ extern "C" {
|
|||
#define BUS_TYPE_USB 1
|
||||
#define BUS_TYPE_OTHER 255
|
||||
|
||||
#define HFP_AUDIO_CODEC_CVSD 0x01
|
||||
#define HFP_AUDIO_CODEC_MSBC 0x02
|
||||
#define HFP_AUDIO_CODEC_LC3_SWB 0x03
|
||||
|
||||
#define A2DP_OBJECT_MANAGER_PATH "/MediaEndpoint"
|
||||
#define A2DP_SINK_ENDPOINT A2DP_OBJECT_MANAGER_PATH "/A2DPSink"
|
||||
#define A2DP_SOURCE_ENDPOINT A2DP_OBJECT_MANAGER_PATH "/A2DPSource"
|
||||
|
|
@ -161,14 +157,6 @@ extern "C" {
|
|||
|
||||
#define SPA_BT_NO_BATTERY ((uint8_t)255)
|
||||
|
||||
/* HFP uses SBC encoding with precisely defined parameters. Hence, the size
|
||||
* of the input (number of PCM samples) and output is known up front. */
|
||||
#define MSBC_DECODED_SIZE 240
|
||||
#define MSBC_PAYLOAD_SIZE 57 /* 1 byte padding follows payload */
|
||||
#define LC3_SWB_DECODED_SIZE 960 /* 32 kHz mono S24_32 @ 7.5 ms */
|
||||
#define LC3_SWB_PAYLOAD_SIZE 58
|
||||
#define HFP_CODEC_PACKET_SIZE 60 /* 2 bytes header + payload */
|
||||
|
||||
enum spa_bt_media_direction {
|
||||
SPA_BT_MEDIA_SOURCE,
|
||||
SPA_BT_MEDIA_SINK,
|
||||
|
|
@ -676,7 +664,6 @@ struct spa_bt_transport {
|
|||
enum spa_bt_profile profile;
|
||||
enum spa_bt_transport_state state;
|
||||
const struct media_codec *media_codec;
|
||||
unsigned int codec;
|
||||
void *configuration;
|
||||
int configuration_len;
|
||||
char *endpoint_path;
|
||||
|
|
|
|||
16
spa/plugins/bluez5/hfp-codec-caps.h
Normal file
16
spa/plugins/bluez5/hfp-codec-caps.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/* Spa HFP codec API */
|
||||
/* SPDX-FileCopyrightText: Copyright © 2025 Pauli Virtanen */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
|
||||
#ifndef SPA_BLUEZ5_HFP_CODEC_CAPS_H_
|
||||
#define SPA_BLUEZ5_HFP_CODEC_CAPS_H_
|
||||
|
||||
#include <spa/param/bluetooth/audio.h>
|
||||
|
||||
#define HFP_AUDIO_CODEC_CVSD 0x01
|
||||
#define HFP_AUDIO_CODEC_MSBC 0x02
|
||||
#define HFP_AUDIO_CODEC_LC3_SWB 0x03
|
||||
|
||||
#define HFP_H2_PACKET_SIZE 60
|
||||
|
||||
#endif
|
||||
|
|
@ -29,6 +29,8 @@
|
|||
#include <sbc/sbc.h>
|
||||
|
||||
#include "defs.h"
|
||||
#include "media-codecs.h"
|
||||
#include "hfp-codec-caps.h"
|
||||
|
||||
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.bluez5.sco-io");
|
||||
#undef SPA_LOG_TOPIC_DEFAULT
|
||||
|
|
@ -224,14 +226,12 @@ struct spa_bt_sco_io *spa_bt_sco_io_create(struct spa_bt_transport *transport, s
|
|||
io->read_size = 0;
|
||||
} else {
|
||||
/* Set some sensible initial packet size */
|
||||
switch (transport->codec) {
|
||||
case HFP_AUDIO_CODEC_CVSD:
|
||||
switch (transport->media_codec->id) {
|
||||
case SPA_BLUETOOTH_AUDIO_CODEC_CVSD:
|
||||
io->read_size = 48; /* 3ms S16_LE 8000 Hz */
|
||||
break;
|
||||
case HFP_AUDIO_CODEC_MSBC:
|
||||
case HFP_AUDIO_CODEC_LC3_SWB:
|
||||
default:
|
||||
io->read_size = HFP_CODEC_PACKET_SIZE;
|
||||
io->read_size = HFP_H2_PACKET_SIZE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue